From 8dd891aced61f6a12193970f78012d81ea9b2ee1 Mon Sep 17 00:00:00 2001 From: Ian Pittwood <pittwoodian@gmail.com> Date: Mon, 8 Apr 2019 15:57:44 -0500 Subject: [PATCH] Remove flask YAML web editor from Spyglass Spyglass was originally built with a web-based YAML editor. Unfortunately, the presence of the editor has caused some problems. It can cause the Docker container to freeze before creating the intermediary YAML file. The execution of the flask app is also the root cause for the Bandit B104 errors and B605 error. Since the target audience for Spyglass is developers, it can be assumed that they will have access to an editor with support for YAML files. Having a web-based version of the YAML editor is unnecessary and will just result in more code to maintain in the future. Removes the editor script from utils. Removes the yaml-editor entry point from the package. Removes references to the yaml-editor from the CLI and engine. Resolves all known Bandit errors. In the future, a pause in execution could be provided to allow users to make quick edits. Log messages could also notify users when a placeholder value is inserted in the intermediary so they can fix it. Change-Id: Ibc37e61f93b33904ea839e12fe5a8d586985e0b1 --- MANIFEST.in | 2 - doc/source/getting_started.rst | 4 - doc/source/index.rst | 1 - doc/source/yaml-editor.rst | 65 ------- setup.py | 3 - spyglass/parser/engine.py | 23 +-- spyglass/spyglass.py | 11 +- spyglass/utils/editor/__init__.py | 0 spyglass/utils/editor/editor.py | 170 ------------------ spyglass/utils/editor/static/app.js | 92 ---------- spyglass/utils/editor/static/favicon.ico | Bin 1150 -> 0 bytes .../editor/static/jquery-linedtextarea.css | 68 ------- .../editor/static/jquery-linedtextarea.js | 126 ------------- spyglass/utils/editor/static/js-yaml.min.js | 1 - spyglass/utils/editor/templates/yaml.html | 38 ---- 15 files changed, 3 insertions(+), 601 deletions(-) delete mode 100644 doc/source/yaml-editor.rst delete mode 100644 spyglass/utils/editor/__init__.py delete mode 100644 spyglass/utils/editor/editor.py delete mode 100644 spyglass/utils/editor/static/app.js delete mode 100644 spyglass/utils/editor/static/favicon.ico delete mode 100755 spyglass/utils/editor/static/jquery-linedtextarea.css delete mode 100755 spyglass/utils/editor/static/jquery-linedtextarea.js delete mode 100644 spyglass/utils/editor/static/js-yaml.min.js delete mode 100644 spyglass/utils/editor/templates/yaml.html diff --git a/MANIFEST.in b/MANIFEST.in index e00b83e..d6f43a3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,2 @@ -recursive-include spyglass/utils/editor/static * -recursive-include spyglass/utils/editor/templates * recursive-include spyglass/ **.yaml recursive-include spyglass/ **.json diff --git a/doc/source/getting_started.rst b/doc/source/getting_started.rst index bca3532..ef1df4a 100644 --- a/doc/source/getting_started.rst +++ b/doc/source/getting_started.rst @@ -72,9 +72,6 @@ Supported Features 2. Remote Data Source Plugin: Supports extracting site data from a REST endpoint. -3. YAML Editor for Intermediary YAML: Support runtime editing of missing - site parameters, see :ref:`yaml-editor-info` - Future Work ----------- 1) Schema based manifest generation instead of Jinja2 templates. It shall @@ -160,7 +157,6 @@ Options: excel spec -idir, --intermediary_dir PATH The path where intermediary file needs to be generated - -e, --edit_intermediary Flag to let user edit intermediary -m, --generate_manifests Generate manifests from the generated intermediary file -mdir, --manifest_dir PATH The path where manifest files needs to be diff --git a/doc/source/index.rst b/doc/source/index.rst index 924681c..b0ec2b9 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -33,4 +33,3 @@ fed to Shipyard for site deployment / updates. getting_started tugboat - yaml-editor diff --git a/doc/source/yaml-editor.rst b/doc/source/yaml-editor.rst deleted file mode 100644 index 7e5a246..0000000 --- a/doc/source/yaml-editor.rst +++ /dev/null @@ -1,65 +0,0 @@ -.. - Copyright 2018 AT&T Intellectual Property. - All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); you may - not use this file except in compliance with the License. You may obtain - a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - License for the specific language governing permissions and limitations - under the License. - -.. _yaml-editor-info: - -=========== -Yaml Editor -=========== - -What is Yaml Editor? --------------------- - -Yaml Editor is a spyglass utility which lets user edit their generated -intermediary file in a browser window. It is a minimal flask app which is -invoked from the parser engine in order to let user edit fields which -could not be fetched via :ref:`tugboatinfo` plugin. - - -Yaml Editor Utility Inputs --------------------------- - - a) Yaml File: Yaml file required to be edited (This is required field) - b) Port: Port on which app shall be running - c) Host: This is only used to form URL which can be followed to open file in browser - d) String: String which is required to be updated in the file (default is '#CHANGE_ME') - -Yaml Editor Utility Usage -------------------------- - - With Spyglass (edit option is True by default): - :: - - spyglass -mg --edit_intermediary -t tugboat -x SiteDesignSpec_v0.1.xlsx -e excel_spec_upstream.yaml -d site_config.yaml -s airship-seaworthy --template_dir=<relative path to '../examples/templates' - - As a stand-alone editor: - :: - - yaml-editor -f <yaml-file> - - Help: - :: - - > yaml-editor --help - Usage: yaml-editor [OPTIONS] - - Options: - -f, --file FILENAME Path with file name to the intermediary yaml file. - [required] - -h, --host TEXT Optional host parameter to run Flask on. - -p, --port INTEGER Optional port parameter to run Flask on. - -s, --string TEXT Text which is required to be changed on yaml file. - --help Show this message and exit. diff --git a/setup.py b/setup.py index 4b43c75..12326cd 100644 --- a/setup.py +++ b/setup.py @@ -30,13 +30,10 @@ setup( 'netaddr', 'pyyaml', 'jinja2', - 'flask', - 'flask-bootstrap', ], entry_points={ 'console_scripts': [ 'spyglass=spyglass.spyglass:main', - 'yaml-editor=spyglass.utils.editor.editor:main', ], 'data_extractor_plugins': ['formation=spyglass.data_extractor.plugins.formation:FormationPlugin', diff --git a/spyglass/parser/engine.py b/spyglass/parser/engine.py index f3ba441..95ab944 100644 --- a/spyglass/parser/engine.py +++ b/spyglass/parser/engine.py @@ -15,11 +15,9 @@ import copy import json import logging -import os import pkg_resources import pprint import sys -import tempfile import jsonschema import netaddr @@ -394,28 +392,11 @@ class ProcessDataSource: f.write(yaml_file) f.close() - def generate_intermediary_yaml(self, edit_intermediary=False): + def generate_intermediary_yaml(self): """ Generating intermediary yaml """ LOG.info("Start: Generate Intermediary") self._apply_design_rules() self._get_genesis_node_details() # This will validate the extracted data from different sources. self._validate_intermediary_data(self.data) - if edit_intermediary: - self.edit_intermediary_yaml() - # This will check if user edited changes are in order. - self._validate_intermediary_data(self.data) - self.intermediary_yaml = self.data - return self.intermediary_yaml - - def edit_intermediary_yaml(self): - """ Edit generated data using on browser """ - LOG.info( - "edit_intermediary_yaml: Invoking web server for yaml editing" - ) - with tempfile.NamedTemporaryFile(mode="r+") as file_obj: - yaml.safe_dump(self.data, file_obj, default_flow_style=False) - host = self._get_genesis_node_ip() - os.system("yaml-editor -f {0} -h {1}".format(file_obj.name, host)) - file_obj.seek(0) - self.data = yaml.safe_load(file_obj) + return self.data diff --git a/spyglass/spyglass.py b/spyglass/spyglass.py index 9d53a3a..7a3733e 100644 --- a/spyglass/spyglass.py +++ b/spyglass/spyglass.py @@ -64,12 +64,6 @@ LOG = logging.getLogger("spyglass") type=click.Path(exists=True), help="The path where intermediary file needs to be generated", ) -@click.option( - "--edit_intermediary/--no_edit_intermediary", - "-e/-nedit", - default=True, - help="Flag to let user edit intermediary", -) @click.option( "--generate_manifests", "-m", @@ -117,7 +111,6 @@ def main(*args, **kwargs): # Extract user provided inputs generate_intermediary = kwargs["generate_intermediary"] intermediary_dir = kwargs["intermediary_dir"] - edit_intermediary = kwargs["edit_intermediary"] generate_manifests = kwargs["generate_manifests"] manifest_dir = kwargs["manifest_dir"] intermediary = kwargs["intermediary"] @@ -208,9 +201,7 @@ def main(*args, **kwargs): ) LOG.info("Generate intermediary yaml") - intermediary_yaml = process_input_ob.generate_intermediary_yaml( - edit_intermediary - ) + intermediary_yaml = process_input_ob.generate_intermediary_yaml() else: LOG.info("Loading intermediary from user provided input") with open(intermediary, "r") as intermediary_file: diff --git a/spyglass/utils/editor/__init__.py b/spyglass/utils/editor/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/spyglass/utils/editor/editor.py b/spyglass/utils/editor/editor.py deleted file mode 100644 index 726e0e3..0000000 --- a/spyglass/utils/editor/editor.py +++ /dev/null @@ -1,170 +0,0 @@ -# Copyright 2018 AT&T Intellectual Property. All other rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the 'License'); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an 'AS IS' BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -import json -import logging -import os -import sys - -import click -import yaml - -from flask import Flask, request, render_template, send_from_directory -from flask_bootstrap import Bootstrap - - -app_path = os.path.dirname(os.path.abspath(__file__)) -app = Flask( - "Yaml Editor!", - template_folder=os.path.join(app_path, "templates"), - static_folder=os.path.join(app_path, "static"), -) -Bootstrap(app) -logging.getLogger("werkzeug").setLevel(logging.ERROR) -LOG = app.logger - - -@app.route("/favicon.ico") -def favicon(): - return send_from_directory(app.static_folder, "favicon.ico") - - -@app.route("/", methods=["GET", "POST"]) -def index(): - """Renders index page to edit provided yaml file.""" - LOG.info("Rendering yaml file for editing") - with open(app.config["YAML_FILE"]) as file_obj: - data = yaml.safe_load(file_obj) - return render_template( - "yaml.html", - data=json.dumps(data), - change_str=app.config["STRING_TO_CHANGE"], - ) - - -@app.route("/save", methods=["POST"]) -def save(): - """Save current progress on file.""" - LOG.info("Saving edited inputs from user to yaml file") - out = request.json.get("yaml_data") - with open(app.config["YAML_FILE"], "w") as file_obj: - yaml.safe_dump(out, file_obj, default_flow_style=False) - return "Data saved successfully!" - - -@app.route("/saveExit", methods=["POST"]) -def save_exit(): - """Save current progress on file and shuts down the server.""" - LOG.info( - "Saving edited inputs from user to yaml file and shutting" - " down server" - ) - out = request.json.get("yaml_data") - with open(app.config["YAML_FILE"], "w") as file_obj: - yaml.safe_dump(out, file_obj, default_flow_style=False) - func = request.environ.get("werkzeug.server.shutdown") - if func: - func() - return "Saved successfully, Shutting down app! You may close the tab!" - - -@app.errorhandler(404) -def page_not_found(e): - """Serves 404 error.""" - LOG.info("User tried to access unavailable page.") - return "<h1>404: Page not Found!</h1>" - - -def run(*args, **kwargs): - """Starts the server.""" - LOG.info("Initiating web server for yaml editing") - port = kwargs.get("port", None) - if not port: - port = 8161 - app.run(host="0.0.0.0", port=port, debug=False) - - -@click.command() -@click.option( - "--file", - "-f", - required=True, - type=click.File(), - multiple=False, - help="Path with file name to the intermediary yaml file.", -) -@click.option( - "--host", - "-h", - default="0.0.0.0", - type=click.STRING, - multiple=False, - help="Optional host parameter to run Flask on.", -) -@click.option( - "--port", - "-p", - default=8161, - type=click.INT, - multiple=False, - help="Optional port parameter to run Flask on.", -) -@click.option( - "--string", - "-s", - default="#CHANGE_ME", - type=click.STRING, - multiple=False, - help="Text which is required to be changed on yaml file.", -) -def main(*args, **kwargs): - LOG.setLevel(logging.INFO) - LOG.info("Initiating yaml-editor") - try: - yaml.safe_load(kwargs["file"]) - except yaml.YAMLError as e: - LOG.error("EXITTING - Please provide a valid yaml file.") - if hasattr(e, "problem_mark"): - mark = e.problem_mark - LOG.error( - "Error position: ({0}:{1})".format( - mark.line + 1, mark.column + 1 - ) - ) - sys.exit(2) - except Exception: - LOG.error("EXITTING - Please provide a valid yaml file.") - sys.exit(2) - LOG.info( - """ - -############################################################################## - -Please go to http://{0}:{1}/ to edit your yaml file. - -############################################################################## - - """.format( - kwargs["host"], kwargs["port"] - ) - ) - app.config["YAML_FILE"] = kwargs["file"].name - app.config["STRING_TO_CHANGE"] = kwargs["string"] - run(*args, **kwargs) - - -if __name__ == "__main__": - """Invoked when used as a script.""" - main() diff --git a/spyglass/utils/editor/static/app.js b/spyglass/utils/editor/static/app.js deleted file mode 100644 index b0e834a..0000000 --- a/spyglass/utils/editor/static/app.js +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2018 AT&T Intellectual Property. All other rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -// This file includes all the frond-end functionality being used for the -// yaml editor application. - - -/** - * Calls /save URL to save edit progress. - * @param {String} data Stringified JSON data. - */ -function save(data) { - $.ajax({ - type: 'POST', - url: '/save', - data: data, - success: function(res) { - setTimeout(function() { alert(res); }, 3); - }, - contentType: 'application/json;charset=UTF-8' - }); -} - -/** - * Calls /saveExit URL to save edit progress and shut down web server. - * @param {String} data Stringified JSON data. - */ -function saveAndExit(data) { - $.ajax({ - type: 'POST', - url: '/saveExit', - data: data, - success: function(res) { - setTimeout(function() { alert(res); }, 3); - }, - contentType: 'application/json;charset=UTF-8' - }); -} - -/** - * Collects and validates data from textarea. - * @returns {String} Stringified JSON data. - */ -function getSimpleData() { - var data = $("#yaml_data").val(); - try { - var index = data.indexOf(changeStr) - if (index != -1) { - var lineNum = data.substring(0, index).split('\n').length; - alert('Please change value on line '+ lineNum + '!') - return null - } - data = jsyaml.load(data) - } - catch(err) { - alert(err) - return null - } - return JSON.stringify({yaml_data : data}) -} - -/** - * Function to save edit progress. - */ -function saveSimple() { - var data = getSimpleData() - if (data) { - save(data) - } -} - -/** - * Function to save edit progress and shut down web server. - */ -function saveExitSimple() { - var data = getSimpleData() - if (data) { - saveAndExit(data) - } -} diff --git a/spyglass/utils/editor/static/favicon.ico b/spyglass/utils/editor/static/favicon.ico deleted file mode 100644 index d3dca27a02a14c2554c5ae693af87100e1d5359f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmb7?TS!xJ9LN9ZqM#`0A*7djtf!!tpeM1H=qaM7vLJ~POGcTOAkBr9SjI}`=G?_i zk8bD8UEEEVx4Frh#&pwkn_8x(cGJA9h>CCjbEMG1C=Q?h@BjZDKEMB!kWKVUNg=e| zN3ukO>?VZlr_dD5tmbJTg#PpGSVb8BM^kgLoYb7ZzFC!{xuLr1SyGFc22FO!o_{H! zIa@-c>0%LEAQc;n4U5YB2`KYo3BCsJYqIYX`HAa9m07x7d8Q~;d3p^Q#i^>ZC8;_| zt=L%OT=dm)u-tP&ng0^1t1Sz>uf0-1PSR~MlG?H+jc44fYmfhgj^oT-X4K#gCz$9m z>Y94LchefiqQ-gE74<dk<p%@+(dIl%H%U$5_9qc^bw|<Vi=opSg+<o}qdf%1GmPr+ zGUTBp=w<c=u27mSKPMI`P8E{MqgmS;${L!TOb4Q`<}o_Ag3&h#^gIc{D7T}|(1U8v zIOLH8l;(j2b&)1Zo^~l&ky%D=Z#|S$U#u=;E3GST&M$Z`KYqpdhcECtg6QoT0jp|- z!aI!`QwZ7{%8J_EN0PJ|#r)REEpk9)d}Own^&N1tKE!925uaH`?DY~_v@IBjOya43 z1a(zTcuan<5>2kP!XUV-{(ccF_??13{Ng<Voe>O<%)qU7!Nat{=js#IF&Lc%cUPZl zud;6Fk4(&?FAzh}Ka4;}1kZZM5FVOF|G<P$le<HGnPo#iHuVva=hGM%oTN-)C_V>% zO?(vQ|BLTx^ddI7fU&oq){wv$y^Ha8pAn{Y*-~9@b7j-I`T6s+FkU#Uy=XB9&}t2? z#}*XM#wz9d>+@x4jW?C+eD<+LIDdz;9}agI4%ctcoYmm}rYn$N;_ey9g~P|z_y<I6 zrOoE<iow}B_$Qtr*th`n1#+n-t9%!Ir@vgjBiVc~slG@p;biu(N#P9rLA5hP@3&8v kCp)e$RIGFP0VXJ2gwQ}}5GdJ1JIRzS8?ck+dG-?W1E&H;nE(I) diff --git a/spyglass/utils/editor/static/jquery-linedtextarea.css b/spyglass/utils/editor/static/jquery-linedtextarea.css deleted file mode 100755 index 82ad0bd..0000000 --- a/spyglass/utils/editor/static/jquery-linedtextarea.css +++ /dev/null @@ -1,68 +0,0 @@ -/** - * jQuery Lined Textarea Plugin - * http://alan.blog-city.com/jquerylinedtextarea.htm - * - * Copyright (c) 2010 Alan Williamson - * - * Released under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * Usage: - * Displays a line number count column to the left of the textarea - * - * Class up your textarea with a given class, or target it directly - * with JQuery Selectors - * - * $(".lined").linedtextarea({ - * selectedLine: 10, - * selectedClass: 'lineselect' - * }); - * - */ - -.linedwrap { - border: 1px solid #c0c0c0; - padding: 3px; -} - -.linedtextarea { - padding: 0px; - margin: 0px; -} - -.linedtextarea textarea, .linedwrap .codelines .lineno { - font-size: 10pt; - font-family: monospace; - line-height: normal !important; -} - -.linedtextarea textarea { - padding-right:0.3em; - padding-top:0.3em; - border: 0; -} - -.linedwrap .lines { - margin-top: 0px; - width: 50px; - float: left; - overflow: hidden; - border-right: 1px solid #c0c0c0; - margin-right: 10px; -} - -.linedwrap .codelines { - padding-top: 5px; -} - -.linedwrap .codelines .lineno { - color:#AAAAAA; - padding-right: 0.5em; - padding-top: 0.0em; - text-align: right; - white-space: nowrap; -} - -.linedwrap .codelines .lineselect { - color: red; -} diff --git a/spyglass/utils/editor/static/jquery-linedtextarea.js b/spyglass/utils/editor/static/jquery-linedtextarea.js deleted file mode 100755 index b3699d6..0000000 --- a/spyglass/utils/editor/static/jquery-linedtextarea.js +++ /dev/null @@ -1,126 +0,0 @@ -/** - * jQuery Lined Textarea Plugin - * http://alan.blog-city.com/jquerylinedtextarea.htm - * - * Copyright (c) 2010 Alan Williamson - * - * Version: - * $Id: jquery-linedtextarea.js 464 2010-01-08 10:36:33Z alan $ - * - * Released under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * Usage: - * Displays a line number count column to the left of the textarea - * - * Class up your textarea with a given class, or target it directly - * with JQuery Selectors - * - * $(".lined").linedtextarea({ - * selectedLine: 10, - * selectedClass: 'lineselect' - * }); - * - * History: - * - 2010.01.08: Fixed a Google Chrome layout problem - * - 2010.01.07: Refactored code for speed/readability; Fixed horizontal sizing - * - 2010.01.06: Initial Release - * - */ -(function($) { - - $.fn.linedtextarea = function(options) { - - // Get the Options - var opts = $.extend({}, $.fn.linedtextarea.defaults, options); - - - /* - * Helper function to make sure the line numbers are always - * kept up to the current system - */ - var fillOutLines = function(codeLines, h, lineNo){ - while ( (codeLines.height() - h ) <= 0 ){ - if ( lineNo == opts.selectedLine ) - codeLines.append("<div class='lineno lineselect'>" + lineNo + "</div>"); - else - codeLines.append("<div class='lineno'>" + lineNo + "</div>"); - - lineNo++; - } - return lineNo; - }; - - - /* - * Iterate through each of the elements are to be applied to - */ - return this.each(function() { - var lineNo = 1; - var textarea = $(this); - - /* Turn off the wrapping of as we don't want to screw up the line numbers */ - textarea.attr("wrap", "off"); - textarea.css({resize:'none'}); - var originalTextAreaWidth = textarea.outerWidth(); - - /* Wrap the text area in the elements we need */ - textarea.wrap("<div class='linedtextarea'></div>"); - var linedTextAreaDiv = textarea.parent().wrap("<div class='linedwrap' style='width:" + originalTextAreaWidth + "px'></div>"); - var linedWrapDiv = linedTextAreaDiv.parent(); - - linedWrapDiv.prepend("<div class='lines' style='width:50px'></div>"); - - var linesDiv = linedWrapDiv.find(".lines"); - linesDiv.height( textarea.height() + 6 ); - - - /* Draw the number bar; filling it out where necessary */ - linesDiv.append( "<div class='codelines'></div>" ); - var codeLinesDiv = linesDiv.find(".codelines"); - lineNo = fillOutLines( codeLinesDiv, linesDiv.height(), 1 ); - - /* Move the textarea to the selected line */ - if ( opts.selectedLine != -1 && !isNaN(opts.selectedLine) ){ - var fontSize = parseInt( textarea.height() / (lineNo-2) ); - var position = parseInt( fontSize * opts.selectedLine ) - (textarea.height()/2); - textarea[0].scrollTop = position; - } - - - /* Set the width */ - var sidebarWidth = linesDiv.outerWidth(); - var paddingHorizontal = parseInt( linedWrapDiv.css("border-left-width") ) + parseInt( linedWrapDiv.css("border-right-width") ) + parseInt( linedWrapDiv.css("padding-left") ) + parseInt( linedWrapDiv.css("padding-right") ); - var linedWrapDivNewWidth = originalTextAreaWidth - paddingHorizontal; - var textareaNewWidth = originalTextAreaWidth - sidebarWidth - paddingHorizontal - 20; - - textarea.width( textareaNewWidth ); - linedWrapDiv.width( linedWrapDivNewWidth ); - - - - /* React to the scroll event */ - textarea.scroll( function(tn){ - var domTextArea = $(this)[0]; - var scrollTop = domTextArea.scrollTop; - var clientHeight = domTextArea.clientHeight; - codeLinesDiv.css( {'margin-top': (-1*scrollTop) + "px"} ); - lineNo = fillOutLines( codeLinesDiv, scrollTop + clientHeight, lineNo ); - }); - - - /* Should the textarea get resized outside of our control */ - textarea.resize( function(tn){ - var domTextArea = $(this)[0]; - linesDiv.height( domTextArea.clientHeight + 6 ); - }); - - }); - }; - - // default options - $.fn.linedtextarea.defaults = { - selectedLine: -1, - selectedClass: 'lineselect' - }; -})(jQuery); diff --git a/spyglass/utils/editor/static/js-yaml.min.js b/spyglass/utils/editor/static/js-yaml.min.js deleted file mode 100644 index 078bf73..0000000 --- a/spyglass/utils/editor/static/js-yaml.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsyaml=e()}}(function(){return function o(a,s,c){function u(t,e){if(!s[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(l)return l(t,!0);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}var r=s[t]={exports:{}};a[t][0].call(r.exports,function(e){return u(a[t][1][e]||e)},r,r.exports,o,a,s,c)}return s[t].exports}for(var l="function"==typeof require&&require,e=0;e<c.length;e++)u(c[e]);return u}({1:[function(e,t,n){"use strict";var i=e("./js-yaml/loader"),r=e("./js-yaml/dumper");function o(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}t.exports.Type=e("./js-yaml/type"),t.exports.Schema=e("./js-yaml/schema"),t.exports.FAILSAFE_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.JSON_SCHEMA=e("./js-yaml/schema/json"),t.exports.CORE_SCHEMA=e("./js-yaml/schema/core"),t.exports.DEFAULT_SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_FULL_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.load=i.load,t.exports.loadAll=i.loadAll,t.exports.safeLoad=i.safeLoad,t.exports.safeLoadAll=i.safeLoadAll,t.exports.dump=r.dump,t.exports.safeDump=r.safeDump,t.exports.YAMLException=e("./js-yaml/exception"),t.exports.MINIMAL_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.scan=o("scan"),t.exports.parse=o("parse"),t.exports.compose=o("compose"),t.exports.addConstructor=o("addConstructor")},{"./js-yaml/dumper":3,"./js-yaml/exception":4,"./js-yaml/loader":5,"./js-yaml/schema":7,"./js-yaml/schema/core":8,"./js-yaml/schema/default_full":9,"./js-yaml/schema/default_safe":10,"./js-yaml/schema/failsafe":11,"./js-yaml/schema/json":12,"./js-yaml/type":13}],2:[function(e,t,n){"use strict";function i(e){return null==e}t.exports.isNothing=i,t.exports.isObject=function(e){return"object"==typeof e&&null!==e},t.exports.toArray=function(e){return Array.isArray(e)?e:i(e)?[]:[e]},t.exports.repeat=function(e,t){var n,i="";for(n=0;n<t;n+=1)i+=e;return i},t.exports.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},t.exports.extend=function(e,t){var n,i,r,o;if(t)for(n=0,i=(o=Object.keys(t)).length;n<i;n+=1)e[r=o[n]]=t[r];return e}},{}],3:[function(e,t,n){"use strict";var c=e("./common"),d=e("./exception"),i=e("./schema/default_full"),r=e("./schema/default_safe"),l=Object.prototype.toString,u=Object.prototype.hasOwnProperty,o=9,h=10,a=32,m=33,g=34,y=35,x=37,v=38,A=39,b=42,w=44,C=45,k=58,j=62,S=63,I=64,E=91,O=93,F=96,_=123,N=124,M=125,s={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},p=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function f(e){var t,n,i;if(t=e.toString(16).toUpperCase(),e<=255)n="x",i=2;else if(e<=65535)n="u",i=4;else{if(!(e<=4294967295))throw new d("code point within a string may not be greater than 0xFFFFFFFF");n="U",i=8}return"\\"+n+c.repeat("0",i-t.length)+t}function T(e){this.schema=e.schema||i,this.indent=Math.max(1,e.indent||2),this.skipInvalid=e.skipInvalid||!1,this.flowLevel=c.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,i,r,o,a,s,c;if(null===t)return{};for(n={},r=0,o=(i=Object.keys(t)).length;r<o;r+=1)a=i[r],s=String(t[a]),"!!"===a.slice(0,2)&&(a="tag:yaml.org,2002:"+a.slice(2)),(c=e.compiledTypeMap.fallback[a])&&u.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[a]=s;return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function L(e,t){for(var n,i=c.repeat(" ",t),r=0,o=-1,a="",s=e.length;r<s;)-1===(o=e.indexOf("\n",r))?(n=e.slice(r),r=s):(n=e.slice(r,o+1),r=o+1),n.length&&"\n"!==n&&(a+=i),a+=n;return a}function D(e,t){return"\n"+c.repeat(" ",e.indent*t)}function U(e){return e===a||e===o}function q(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&65279!==e||65536<=e&&e<=1114111}function Y(e){return q(e)&&65279!==e&&e!==w&&e!==E&&e!==O&&e!==_&&e!==M&&e!==k&&e!==y}function R(e){return/^\n* /.test(e)}var B=1,P=2,W=3,K=4,$=5;function H(e,t,n,i,r){var o,a,s,c=!1,u=!1,l=-1!==i,p=-1,f=q(s=e.charCodeAt(0))&&65279!==s&&!U(s)&&s!==C&&s!==S&&s!==k&&s!==w&&s!==E&&s!==O&&s!==_&&s!==M&&s!==y&&s!==v&&s!==b&&s!==m&&s!==N&&s!==j&&s!==A&&s!==g&&s!==x&&s!==I&&s!==F&&!U(e.charCodeAt(e.length-1));if(t)for(o=0;o<e.length;o++){if(!q(a=e.charCodeAt(o)))return $;f=f&&Y(a)}else{for(o=0;o<e.length;o++){if((a=e.charCodeAt(o))===h)c=!0,l&&(u=u||i<o-p-1&&" "!==e[p+1],p=o);else if(!q(a))return $;f=f&&Y(a)}u=u||l&&i<o-p-1&&" "!==e[p+1]}return c||u?9<n&&R(e)?$:u?K:W:f&&!r(e)?B:P}function G(i,r,o,a){i.dump=function(){if(0===r.length)return"''";if(!i.noCompatMode&&-1!==p.indexOf(r))return"'"+r+"'";var e=i.indent*Math.max(1,o),t=-1===i.lineWidth?-1:Math.max(Math.min(i.lineWidth,40),i.lineWidth-e),n=a||-1<i.flowLevel&&o>=i.flowLevel;switch(H(r,n,i.indent,t,function(e){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n<i;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}(i,e)})){case B:return r;case P:return"'"+r.replace(/'/g,"''")+"'";case W:return"|"+V(r,i.indent)+Z(L(r,e));case K:return">"+V(r,i.indent)+Z(L(function(e,t){var n,i,r=/(\n+)([^\n]*)/g,o=(s=e.indexOf("\n"),s=-1!==s?s:e.length,r.lastIndex=s,z(e.slice(0,s),t)),a="\n"===e[0]||" "===e[0];var s;for(;i=r.exec(e);){var c=i[1],u=i[2];n=" "===u[0],o+=c+(a||n||""===u?"":"\n")+z(u,t),a=n}return o}(r,t),e));case $:return'"'+function(e){for(var t,n,i,r="",o=0;o<e.length;o++)55296<=(t=e.charCodeAt(o))&&t<=56319&&56320<=(n=e.charCodeAt(o+1))&&n<=57343?(r+=f(1024*(t-55296)+n-56320+65536),o++):(i=s[t],r+=!i&&q(t)?e[o]:i||f(t));return r}(r)+'"';default:throw new d("impossible error: invalid scalar style")}}()}function V(e,t){var n=R(e)?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function Z(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function z(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,a=0,s=0,c="";n=r.exec(e);)t<(s=n.index)-o&&(i=o<a?a:s,c+="\n"+e.slice(o,i),o=i+1),a=s;return c+="\n",e.length-o>t&&o<a?c+=e.slice(o,a)+"\n"+e.slice(a+1):c+=e.slice(o),c.slice(1)}function J(e,t,n){var i,r,o,a,s,c;for(o=0,a=(r=n?e.explicitTypes:e.implicitTypes).length;o<a;o+=1)if(((s=r[o]).instanceOf||s.predicate)&&(!s.instanceOf||"object"==typeof t&&t instanceof s.instanceOf)&&(!s.predicate||s.predicate(t))){if(e.tag=n?s.tag:"?",s.represent){if(c=e.styleMap[s.tag]||s.defaultStyle,"[object Function]"===l.call(s.represent))i=s.represent(t,c);else{if(!u.call(s.represent,c))throw new d("!<"+s.tag+'> tag resolver accepts not "'+c+'" style');i=s.represent[c](t,c)}e.dump=i}return!0}return!1}function Q(e,t,n,i,r,o){e.tag=null,e.dump=n,J(e,n,!1)||J(e,n,!0);var a=l.call(e.dump);i&&(i=e.flowLevel<0||e.flowLevel>t);var s,c,u="[object Object]"===a||"[object Array]"===a;if(u&&(c=-1!==(s=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&0<t)&&(r=!1),c&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(u&&c&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),"[object Object]"===a)i&&0!==Object.keys(e.dump).length?(!function(e,t,n,i){var r,o,a,s,c,u,l="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new d("sortKeys must be a boolean or a function");for(r=0,o=f.length;r<o;r+=1)u="",i&&0===r||(u+=D(e,t)),s=n[a=f[r]],Q(e,t+1,a,!0,!0,!0)&&((c=null!==e.tag&&"?"!==e.tag||e.dump&&1024<e.dump.length)&&(e.dump&&h===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,c&&(u+=D(e,t)),Q(e,t+1,s,!0,c)&&(e.dump&&h===e.dump.charCodeAt(0)?u+=":":u+=": ",l+=u+=e.dump));e.tag=p,e.dump=l||"{}"}(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(!function(e,t,n){var i,r,o,a,s,c="",u=e.tag,l=Object.keys(n);for(i=0,r=l.length;i<r;i+=1)s=e.condenseFlow?'"':"",0!==i&&(s+=", "),a=n[o=l[i]],Q(e,t,o,!1,!1)&&(1024<e.dump.length&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Q(e,t,a,!1,!1)&&(c+=s+=e.dump));e.tag=u,e.dump="{"+c+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else if("[object Array]"===a)i&&0!==e.dump.length?(!function(e,t,n,i){var r,o,a="",s=e.tag;for(r=0,o=n.length;r<o;r+=1)Q(e,t+1,n[r],!0,!0)&&(i&&0===r||(a+=D(e,t)),e.dump&&h===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=s,e.dump=a||"[]"}(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(!function(e,t,n){var i,r,o="",a=e.tag;for(i=0,r=n.length;i<r;i+=1)Q(e,t,n[i],!1,!1)&&(0!==i&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=a,e.dump="["+o+"]"}(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else{if("[object String]"!==a){if(e.skipInvalid)return!1;throw new d("unacceptable kind of an object to dump "+a)}"?"!==e.tag&&G(e,e.dump,t,o)}null!==e.tag&&"?"!==e.tag&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function X(e,t){var n,i,r=[],o=[];for(function e(t,n,i){var r,o,a;if(null!==t&&"object"==typeof t)if(-1!==(o=n.indexOf(t)))-1===i.indexOf(o)&&i.push(o);else if(n.push(t),Array.isArray(t))for(o=0,a=t.length;o<a;o+=1)e(t[o],n,i);else for(r=Object.keys(t),o=0,a=r.length;o<a;o+=1)e(t[r[o]],n,i)}(e,r,o),n=0,i=o.length;n<i;n+=1)t.duplicates.push(r[o[n]]);t.usedDuplicates=new Array(i)}function ee(e,t){var n=new T(t=t||{});return n.noRefs||X(e,n),Q(n,0,e,!0,!0)?n.dump+"\n":""}t.exports.dump=ee,t.exports.safeDump=function(e,t){return ee(e,c.extend({schema:r},t))}},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(e,t,n){"use strict";function i(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}((i.prototype=Object.create(Error.prototype)).constructor=i).prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},t.exports=i},{}],5:[function(e,t,n){"use strict";var g=e("./common"),i=e("./exception"),r=e("./mark"),o=e("./schema/default_safe"),a=e("./schema/default_full"),y=Object.prototype.hasOwnProperty,x=1,v=2,A=3,b=4,w=1,C=2,k=3,c=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,s=/[\x85\u2028\u2029]/,u=/[,\[\]\{\}]/,l=/^(?:!|!!|![a-z\-]+!)$/i,p=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function j(e){return 10===e||13===e}function S(e){return 9===e||32===e}function I(e){return 9===e||32===e||10===e||13===e}function E(e){return 44===e||91===e||93===e||123===e||125===e}function f(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e?"\t":9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?" ":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}for(var O=new Array(256),F=new Array(256),d=0;d<256;d++)O[d]=f(d)?1:0,F[d]=f(d);function h(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||a,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function m(e,t){return new i(t,new r(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function _(e,t){throw m(e,t)}function N(e,t){e.onWarning&&e.onWarning.call(null,m(e,t))}var M={YAML:function(e,t,n){var i,r,o;null!==e.version&&_(e,"duplication of %YAML directive"),1!==n.length&&_(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&_(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&_(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&N(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&_(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],l.test(i)||_(e,"ill-formed tag handle (first argument) of the TAG directive"),y.call(e.tagMap,i)&&_(e,'there is a previously declared suffix for "'+i+'" tag handle'),p.test(r)||_(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[i]=r}};function T(e,t,n,i){var r,o,a,s;if(t<n){if(s=e.input.slice(t,n),i)for(r=0,o=s.length;r<o;r+=1)9===(a=s.charCodeAt(r))||32<=a&&a<=1114111||_(e,"expected valid JSON character");else c.test(s)&&_(e,"the stream contains non-printable characters");e.result+=s}}function L(e,t,n,i){var r,o,a,s;for(g.isObject(n)||_(e,"cannot merge mappings; the provided source object is unacceptable"),a=0,s=(r=Object.keys(n)).length;a<s;a+=1)o=r[a],y.call(t,o)||(t[o]=n[o],i[o]=!0)}function D(e,t,n,i,r,o,a,s){var c,u;if(r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(c=0,u=o.length;c<u;c+=1)L(e,t,o[c],n);else L(e,t,o,n);else e.json||y.call(n,r)||!y.call(t,r)||(e.line=a||e.line,e.position=s||e.position,_(e,"duplicated mapping key")),t[r]=o,delete n[r];return t}function U(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):_(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function q(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);0!==r;){for(;S(r);)r=e.input.charCodeAt(++e.position);if(t&&35===r)for(;10!==(r=e.input.charCodeAt(++e.position))&&13!==r&&0!==r;);if(!j(r))break;for(U(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return-1!==n&&0!==i&&e.lineIndent<n&&N(e,"deficient indentation"),i}function Y(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!I(t)))}function R(e,t){1===t?e.result+=" ":1<t&&(e.result+=g.repeat("\n",t-1))}function B(e,t){var n,i,r=e.tag,o=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&45===i&&I(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,q(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,K(e,t,A,!1,!0),a.push(e.result),q(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)_(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!s&&(e.tag=r,e.anchor=o,e.kind="sequence",e.result=a,!0)}function P(e){var t,n,i,r,o=!1,a=!1;if(33!==(r=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&_(e,"duplication of a tag property"),60===(r=e.input.charCodeAt(++e.position))?(o=!0,r=e.input.charCodeAt(++e.position)):33===r?(a=!0,n="!!",r=e.input.charCodeAt(++e.position)):n="!",t=e.position,o){for(;0!==(r=e.input.charCodeAt(++e.position))&&62!==r;);e.position<e.length?(i=e.input.slice(t,e.position),r=e.input.charCodeAt(++e.position)):_(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==r&&!I(r);)33===r&&(a?_(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),l.test(n)||_(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),r=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),u.test(i)&&_(e,"tag suffix cannot contain flow indicator characters")}return i&&!p.test(i)&&_(e,"tag name cannot contain such characters: "+i),o?e.tag=i:y.call(e.tagMap,n)?e.tag=e.tagMap[n]+i:"!"===n?e.tag="!"+i:"!!"===n?e.tag="tag:yaml.org,2002:"+i:_(e,'undeclared tag handle "'+n+'"'),!0}function W(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&_(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!I(n)&&!E(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&_(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function K(e,t,n,i,r){var o,a,s,c,u,l,p,f,d=1,h=!1,m=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=s=b===n||A===n,i&&q(e,!0,-1)&&(h=!0,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)),1===d)for(;P(e)||W(e);)q(e,!0,-1)?(h=!0,s=o,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)):s=!1;if(s&&(s=h||r),1!==d&&b!==n||(p=x===n||v===n?t:t+1,f=e.position-e.lineStart,1===d?s&&(B(e,f)||function(e,t,n){var i,r,o,a,s,c=e.tag,u=e.anchor,l={},p={},f=null,d=null,h=null,m=!1,g=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=l),s=e.input.charCodeAt(e.position);0!==s;){if(i=e.input.charCodeAt(e.position+1),o=e.line,a=e.position,63!==s&&58!==s||!I(i)){if(!K(e,n,v,!1,!0))break;if(e.line===o){for(s=e.input.charCodeAt(e.position);S(s);)s=e.input.charCodeAt(++e.position);if(58===s)I(s=e.input.charCodeAt(++e.position))||_(e,"a whitespace character is expected after the key-value separator within a block mapping"),m&&(D(e,l,p,f,d,null),f=d=h=null),r=m=!(g=!0),f=e.tag,d=e.result;else{if(!g)return e.tag=c,e.anchor=u,!0;_(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!g)return e.tag=c,e.anchor=u,!0;_(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===s?(m&&(D(e,l,p,f,d,null),f=d=h=null),r=m=g=!0):m?r=!(m=!1):_(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,s=i;if((e.line===o||e.lineIndent>t)&&(K(e,t,b,!0,r)&&(m?d=e.result:h=e.result),m||(D(e,l,p,f,d,h,o,a),f=d=h=null),q(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)_(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return m&&D(e,l,p,f,d,null),g&&(e.tag=c,e.anchor=u,e.kind="mapping",e.result=l),g}(e,f,p))||function(e,t){var n,i,r,o,a,s,c,u,l,p,f=!0,d=e.tag,h=e.anchor,m={};if(91===(p=e.input.charCodeAt(e.position)))s=!(r=93),i=[];else{if(123!==p)return!1;r=125,s=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),p=e.input.charCodeAt(++e.position);0!==p;){if(q(e,!0,t),(p=e.input.charCodeAt(e.position))===r)return e.position++,e.tag=d,e.anchor=h,e.kind=s?"mapping":"sequence",e.result=i,!0;f||_(e,"missed comma between flow collection entries"),l=null,o=a=!1,63===p&&I(e.input.charCodeAt(e.position+1))&&(o=a=!0,e.position++,q(e,!0,t)),n=e.line,K(e,t,x,!1,!0),u=e.tag,c=e.result,q(e,!0,t),p=e.input.charCodeAt(e.position),!a&&e.line!==n||58!==p||(o=!0,p=e.input.charCodeAt(++e.position),q(e,!0,t),K(e,t,x,!1,!0),l=e.result),s?D(e,i,m,u,c,l):o?i.push(D(e,null,m,u,c,l)):i.push(c),q(e,!0,t),44===(p=e.input.charCodeAt(e.position))?(f=!0,p=e.input.charCodeAt(++e.position)):f=!1}_(e,"unexpected end of the stream within a flow collection")}(e,p)?m=!0:(a&&function(e,t){var n,i,r,o,a,s=w,c=!1,u=!1,l=t,p=0,f=!1;if(124===(o=e.input.charCodeAt(e.position)))i=!1;else{if(62!==o)return!1;i=!0}for(e.kind="scalar",e.result="";0!==o;)if(43===(o=e.input.charCodeAt(++e.position))||45===o)w===s?s=43===o?k:C:_(e,"repeat of a chomping mode identifier");else{if(!(0<=(r=48<=(a=o)&&a<=57?a-48:-1)))break;0===r?_(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?_(e,"repeat of an indentation width identifier"):(l=t+r-1,u=!0)}if(S(o)){for(;S(o=e.input.charCodeAt(++e.position)););if(35===o)for(;!j(o=e.input.charCodeAt(++e.position))&&0!==o;);}for(;0!==o;){for(U(e),e.lineIndent=0,o=e.input.charCodeAt(e.position);(!u||e.lineIndent<l)&&32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position);if(!u&&e.lineIndent>l&&(l=e.lineIndent),j(o))p++;else{if(e.lineIndent<l){s===k?e.result+=g.repeat("\n",c?1+p:p):s===w&&c&&(e.result+="\n");break}for(i?S(o)?(f=!0,e.result+=g.repeat("\n",c?1+p:p)):f?(f=!1,e.result+=g.repeat("\n",p+1)):0===p?c&&(e.result+=" "):e.result+=g.repeat("\n",p):e.result+=g.repeat("\n",c?1+p:p),u=c=!0,p=0,n=e.position;!j(o)&&0!==o;)o=e.input.charCodeAt(++e.position);T(e,n,e.position,!1)}}return!0}(e,p)||function(e,t){var n,i,r;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(T(e,i,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;i=e.position,e.position++,r=e.position}else j(n)?(T(e,i,r,!0),R(e,q(e,!1,t)),i=r=e.position):e.position===e.lineStart&&Y(e)?_(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);_(e,"unexpected end of the stream within a single quoted scalar")}(e,p)||function(e,t){var n,i,r,o,a,s,c,u,l,p;if(34!==(s=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(s=e.input.charCodeAt(e.position));){if(34===s)return T(e,n,e.position,!0),e.position++,!0;if(92===s){if(T(e,n,e.position,!0),j(s=e.input.charCodeAt(++e.position)))q(e,!1,t);else if(s<256&&O[s])e.result+=F[s],e.position++;else if(0<(a=120===(p=s)?2:117===p?4:85===p?8:0)){for(r=a,o=0;0<r;r--)s=e.input.charCodeAt(++e.position),l=void 0,0<=(a=48<=(u=s)&&u<=57?u-48:97<=(l=32|u)&&l<=102?l-97+10:-1)?o=(o<<4)+a:_(e,"expected hexadecimal character");e.result+=(c=o)<=65535?String.fromCharCode(c):String.fromCharCode(55296+(c-65536>>10),56320+(c-65536&1023)),e.position++}else _(e,"unknown escape sequence");n=i=e.position}else j(s)?(T(e,n,i,!0),R(e,q(e,!1,t)),n=i=e.position):e.position===e.lineStart&&Y(e)?_(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}_(e,"unexpected end of the stream within a double quoted scalar")}(e,p)?m=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!I(i)&&!E(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&_(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||_(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],q(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,s,c,u,l,p=e.kind,f=e.result;if(I(l=e.input.charCodeAt(e.position))||E(l)||35===l||38===l||42===l||33===l||124===l||62===l||39===l||34===l||37===l||64===l||96===l)return!1;if((63===l||45===l)&&(I(i=e.input.charCodeAt(e.position+1))||n&&E(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==l;){if(58===l){if(I(i=e.input.charCodeAt(e.position+1))||n&&E(i))break}else if(35===l){if(I(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&Y(e)||n&&E(l))break;if(j(l)){if(s=e.line,c=e.lineStart,u=e.lineIndent,q(e,!1,-1),e.lineIndent>=t){a=!0,l=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=c,e.lineIndent=u;break}}a&&(T(e,r,o,!1),R(e,e.line-s),r=o=e.position,a=!1),S(l)||(o=e.position+1),l=e.input.charCodeAt(++e.position)}return T(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,p,x===n)&&(m=!0,null===e.tag&&(e.tag="?")):(m=!0,null===e.tag&&null===e.anchor||_(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===d&&(m=s&&B(e,f))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(c=0,u=e.implicitTypes.length;c<u;c+=1)if((l=e.implicitTypes[c]).resolve(e.result)){e.result=l.construct(e.result),e.tag=l.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else y.call(e.typeMap[e.kind||"fallback"],e.tag)?(l=e.typeMap[e.kind||"fallback"][e.tag],null!==e.result&&l.kind!==e.kind&&_(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+l.kind+'", not "'+e.kind+'"'),l.resolve(e.result)?(e.result=l.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):_(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):_(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||m}function $(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(r=e.input.charCodeAt(e.position))&&(q(e,!0,-1),r=e.input.charCodeAt(e.position),!(0<e.lineIndent||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!I(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&_(e,"directive name must not be less than one character in length");0!==r;){for(;S(r);)r=e.input.charCodeAt(++e.position);if(35===r){for(;0!==(r=e.input.charCodeAt(++e.position))&&!j(r););break}if(j(r))break;for(t=e.position;0!==r&&!I(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&U(e),y.call(M,n)?M[n](e,n,i):N(e,'unknown document directive "'+n+'"')}q(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,q(e,!0,-1)):a&&_(e,"directives end mark is expected"),K(e,e.lineIndent-1,b,!1,!0),q(e,!0,-1),e.checkLineBreaks&&s.test(e.input.slice(o,e.position))&&N(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Y(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,q(e,!0,-1)):e.position<e.length-1&&_(e,"end of the stream or a document separator is expected")}function H(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new h(e,t);for(n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)$(n);return n.documents}function G(e,t,n){var i,r,o=H(e,n);if("function"!=typeof t)return o;for(i=0,r=o.length;i<r;i+=1)t(o[i])}function V(e,t){var n=H(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new i("expected a single document in the stream, but found more")}}t.exports.loadAll=G,t.exports.load=V,t.exports.safeLoadAll=function(e,t,n){if("function"!=typeof t)return G(e,g.extend({schema:o},n));G(e,t,g.extend({schema:o},n))},t.exports.safeLoad=function(e,t){return V(e,g.extend({schema:o},t))}},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(e,t,n){"use strict";var s=e("./common");function i(e,t,n,i,r){this.name=e,this.buffer=t,this.position=n,this.line=i,this.column=r}i.prototype.getSnippet=function(e,t){var n,i,r,o,a;if(!this.buffer)return null;for(e=e||4,t=t||75,n="",i=this.position;0<i&&-1==="\0\r\n \u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>t/2-1){n=" ... ",i+=5;break}for(r="",o=this.position;o<this.buffer.length&&-1==="\0\r\n \u2028\u2029".indexOf(this.buffer.charAt(o));)if((o+=1)-this.position>t/2-1){r=" ... ",o-=5;break}return a=this.buffer.slice(i,o),s.repeat(" ",e)+n+a+r+"\n"+s.repeat(" ",e+this.position-i+n.length)+"^"},i.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},t.exports=i},{"./common":2}],7:[function(e,t,n){"use strict";var i=e("./common"),r=e("./exception"),o=e("./type");function a(e,t,i){var r=[];return e.include.forEach(function(e){i=a(e,t,i)}),e[t].forEach(function(n){i.forEach(function(e,t){e.tag===n.tag&&e.kind===n.kind&&r.push(t)}),i.push(n)}),i.filter(function(e,t){return-1===r.indexOf(t)})}function s(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=a(this,"implicit",[]),this.compiledExplicit=a(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{}};function i(e){n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i);return n}(this.compiledImplicit,this.compiledExplicit)}s.DEFAULT=null,s.create=function(){var e,t;switch(arguments.length){case 1:e=s.DEFAULT,t=arguments[0];break;case 2:e=arguments[0],t=arguments[1];break;default:throw new r("Wrong number of arguments for Schema.create function")}if(e=i.toArray(e),t=i.toArray(t),!e.every(function(e){return e instanceof s}))throw new r("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!t.every(function(e){return e instanceof o}))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new s({include:e,explicit:t})},t.exports=s},{"./common":2,"./exception":4,"./type":13}],8:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./json")]})},{"../schema":7,"./json":12}],9:[function(e,t,n){"use strict";var i=e("../schema");t.exports=i.DEFAULT=new i({include:[e("./default_safe")],explicit:[e("../type/js/undefined"),e("../type/js/regexp"),e("../type/js/function")]})},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./core")],implicit:[e("../type/timestamp"),e("../type/merge")],explicit:[e("../type/binary"),e("../type/omap"),e("../type/pairs"),e("../type/set")]})},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({explicit:[e("../type/str"),e("../type/seq"),e("../type/map")]})},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./failsafe")],implicit:[e("../type/null"),e("../type/bool"),e("../type/int"),e("../type/float")]})},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(e,t,n){"use strict";var r=e("./exception"),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],a=["scalar","sequence","mapping"];t.exports=function(t,e){var n,i;if(e=e||{},Object.keys(e).forEach(function(e){if(-1===o.indexOf(e))throw new r('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(e){return e},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(n=e.styleAliases||null,i={},null!==n&&Object.keys(n).forEach(function(t){n[t].forEach(function(e){i[String(e)]=t})}),i),-1===a.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}},{"./exception":4}],14:[function(e,t,n){"use strict";var c;try{c=e("buffer").Buffer}catch(e){}var i=e("../type"),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";t.exports=new i("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=u;for(n=0;n<r;n++)if(!(64<(t=o.indexOf(e.charAt(n))))){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=u,a=0,s=[];for(t=0;t<r;t++)t%4==0&&t&&(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0==(n=r%4*6)?(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)):18===n?(s.push(a>>10&255),s.push(a>>2&255)):12===n&&s.push(a>>4&255),c?c.from?c.from(s):new c(s):s},predicate:function(e){return c&&c.isBuffer(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=u;for(t=0;t<o;t++)t%3==0&&t&&(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0==(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}})},{"../type":13}],15:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":13}],16:[function(e,t,n){"use strict";var i=e("../common"),r=e("../type"),o=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var a=/^[-+]?[0-9]+e/;t.exports=new r("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!o.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,i,r;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,r=[],0<="+-".indexOf(t[0])&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:0<=t.indexOf(":")?(t.split(":").forEach(function(e){r.unshift(parseFloat(e,10))}),t=0,i=1,r.forEach(function(e){t+=e*i,i*=60}),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||i.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},{"../common":2,"../type":13}],17:[function(e,t,n){"use strict";var i=e("../common"),r=e("../type");t.exports=new r("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i,r,o=e.length,a=0,s=!1;if(!o)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===o)return!0;if("b"===(t=e[++a])){for(a++;a<o;a++)if("_"!==(t=e[a])){if("0"!==t&&"1"!==t)return!1;s=!0}return s&&"_"!==t}if("x"===t){for(a++;a<o;a++)if("_"!==(t=e[a])){if(!(48<=(i=e.charCodeAt(a))&&i<=57||65<=i&&i<=70||97<=i&&i<=102))return!1;s=!0}return s&&"_"!==t}for(;a<o;a++)if("_"!==(t=e[a])){if(!(48<=(n=e.charCodeAt(a))&&n<=55))return!1;s=!0}return s&&"_"!==t}if("_"===t)return!1;for(;a<o;a++)if("_"!==(t=e[a])){if(":"===t)break;if(!(48<=(r=e.charCodeAt(a))&&r<=57))return!1;s=!0}return!(!s||"_"===t)&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(a)))},construct:function(e){var t,n,i=e,r=1,o=[];return-1!==i.indexOf("_")&&(i=i.replace(/_/g,"")),"-"!==(t=i[0])&&"+"!==t||("-"===t&&(r=-1),t=(i=i.slice(1))[0]),"0"===i?0:"0"===t?"b"===i[1]?r*parseInt(i.slice(2),2):"x"===i[1]?r*parseInt(i,16):r*parseInt(i,8):-1!==i.indexOf(":")?(i.split(":").forEach(function(e){o.unshift(parseInt(e,10))}),i=0,n=1,o.forEach(function(e){i+=e*n,n*=60}),r*i):r*parseInt(i,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!i.isNegativeZero(e)},represent:{binary:function(e){return 0<=e?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return 0<=e?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return 0<=e?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},{"../common":2,"../type":13}],18:[function(e,t,n){"use strict";var o;try{o=e("esprima")}catch(e){"undefined"!=typeof window&&(o=window.esprima)}var i=e("../../type");t.exports=new i("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=o.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",i=o.parse(n,{range:!0}),r=[];if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"ArrowFunctionExpression"!==i.body[0].expression.type&&"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach(function(e){r.push(e.name)}),t=i.body[0].expression.body.range,"BlockStatement"===i.body[0].expression.body.type?new Function(r,n.slice(t[0]+1,t[1]-1)):new Function(r,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},{"../../type":13}],19:[function(e,t,n){"use strict";var i=e("../../type");t.exports=new i("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,n=/\/([gim]*)$/.exec(e),i="";if("/"===t[0]){if(n&&(i=n[1]),3<i.length)return!1;if("/"!==t[t.length-i.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),i="";return"/"===t[0]&&(n&&(i=n[1]),t=t.slice(1,t.length-i.length-1)),new RegExp(t,i)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},{"../../type":13}],20:[function(e,t,n){"use strict";var i=e("../../type");t.exports=new i("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})},{"../../type":13}],21:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},{"../type":13}],22:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},{"../type":13}],23:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},{"../type":13}],24:[function(e,t,n){"use strict";var i=e("../type"),c=Object.prototype.hasOwnProperty,u=Object.prototype.toString;t.exports=new i("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],s=e;for(t=0,n=s.length;t<n;t+=1){if(i=s[t],o=!1,"[object Object]"!==u.call(i))return!1;for(r in i)if(c.call(i,r)){if(o)return!1;o=!0}if(!o)return!1;if(-1!==a.indexOf(r))return!1;a.push(r)}return!0},construct:function(e){return null!==e?e:[]}})},{"../type":13}],25:[function(e,t,n){"use strict";var i=e("../type"),s=Object.prototype.toString;t.exports=new i("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(i=a[t],"[object Object]"!==s.call(i))return!1;if(1!==(r=Object.keys(i)).length)return!1;o[t]=[r[0],i[r[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1)i=a[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}})},{"../type":13}],26:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},{"../type":13}],27:[function(e,t,n){"use strict";var i=e("../type"),r=Object.prototype.hasOwnProperty;t.exports=new i("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(r.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}})},{"../type":13}],28:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},{"../type":13}],29:[function(e,t,n){"use strict";var i=e("../type"),p=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),f=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");t.exports=new i("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==p.exec(e)||null!==f.exec(e))},construct:function(e){var t,n,i,r,o,a,s,c,u=0,l=null;if(null===(t=p.exec(e))&&(t=f.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],s=+t[6],t[7]){for(u=t[7].slice(0,3);u.length<3;)u+="0";u=+u}return t[9]&&(l=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(l=-l)),c=new Date(Date.UTC(n,i,r,o,a,s,u)),l&&c.setTime(c.getTime()-l),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},{"../type":13}],"/":[function(e,t,n){"use strict";var i=e("./lib/js-yaml.js");t.exports=i},{"./lib/js-yaml.js":1}]},{},[])("/")}); \ No newline at end of file diff --git a/spyglass/utils/editor/templates/yaml.html b/spyglass/utils/editor/templates/yaml.html deleted file mode 100644 index 0fb3c4e..0000000 --- a/spyglass/utils/editor/templates/yaml.html +++ /dev/null @@ -1,38 +0,0 @@ -{% extends "bootstrap/base.html" %} -{% block title %}YAML Editor{% endblock %} - -{% block styles %} -{{super()}} - <link href="{{ url_for('static', filename='jquery-linedtextarea.css') }}" rel="stylesheet"> -{% endblock %} - -{% block scripts %} -{{super()}} - <script src="{{ url_for('static', filename='js-yaml.min.js') }}"></script> - <script src="{{ url_for('static', filename='jquery-linedtextarea.js') }}"></script> - <script type="text/javascript"> - var changeStr = '{{ change_str }}' - $(document).ready(function(){ - $("#yaml_data").val(jsyaml.dump(JSON.parse('{{ data|safe }}'))) - $("#yaml_data").linedtextarea(); - }); - </script> - <script src="{{ url_for('static', filename='app.js') }}"></script> -{% endblock %} - -{% block content %} - - <div class="container" style="margin-top:30px;"> - <div class="form-group"> - <pre>Edit your YAML (Update corresponding fields with {{ change_str }} text):</pre> - <div> - <textarea class="form-control linedtextarea" id='yaml_data' style="height: 500px;box-shadow: none;"></textarea> - </div> - </div> - <div class="form-group pull-right"> - <button type="button" onclick="saveSimple()" class="btn btn-lg btn-success ">Save</button> - <button type="button" onclick="saveExitSimple()" class="btn btn-lg btn-primary ">Save and Exit</button> - </div> - </div> - -{% endblock %}