1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-58e060ed"],{6014:function(e,t,i){},"603e":function(e,t,i){"use strict";i.r(t);var n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("a-card",{staticStyle:{height:"100%"},attrs:{bordered:!1}},[i("div",{staticStyle:{"padding-bottom":"2px"}},[i("a-alert",{attrs:{type:"warning","show-icon":""}},[i("div",{staticStyle:{width:"100%"},attrs:{slot:"message"},slot:"message"},[i("span",[e._v("路由配置请慎重")]),i("span",{staticStyle:{display:"inline-block",float:"right","padding-right":"5px"}},[i("a",{on:{click:e.clearRedis}},[i("a-icon",{attrs:{type:"reload"}}),e._v("清除缓存")],1)])])])],1),i("div",{style:{height:e.editorHeight+"px",width:"100%"},attrs:{id:e.eleId}}),i("div",{staticStyle:{"text-align":"center","padding-top":"10px"}},[i("a-button",{staticStyle:{width:"160px"},attrs:{type:"primary"},on:{click:e.submitForm}},[e._v("保存")])],1)])},r=[],s=i("dcf5"),o=i.n(s),a=(i("6014"),i("0fea")),l={name:"SysGatewayRouteList",data:function(){return{eleId:"jsoneditor",description:"gateway路由管理管理页面",editor:null,editorWidth:400,editorHeight:500,url:{list:"/sys/gatewayRoute/list",update:"/sys/gatewayRoute/updateAll",clear:"/sys/gatewayRoute/clearRedis"}}},created:function(){var e=window.innerWidth;this.editorWidth=e},mounted:function(){this.initJsonEditor()},methods:{initJsonEditor:function(){var e=document.getElementById(this.eleId),t={modes:["text","code","tree","form","view"],mode:"tree",ace:ace,sortObjectKeys:"code",mainMenuBar:["format"]};this.editor=new o.a(e,t),this.initRouteData()},initRouteData:function(){var e=this;Object(a["c"])(this.url.list).then((function(t){if(t.success){var i=t.result;e.editor.set(i)}}))},submitForm:function(){var e=this,t=this.editor.getText();!t||t.length<=0||"{}"==t||"[]"==t?this.$message.warning("未录入任何信息"):Object(a["i"])(this.url.update,{routes:t}).then((function(t){t.success?e.$message.success(t.message):e.$message.error(t.message)}))},clearRedis:function(){var e=this;Object(a["c"])(this.url.clear).then((function(t){t.success&&e.$message.success(t.message)}))}}},c=l,h=i("2877"),d=Object(h["a"])(c,n,r,!1,null,null,null);t["default"]=d.exports},be36:function(e,t,i){
| /*!
| * jsoneditor.js
| *
| * @brief
| * JSONEditor is a web-based tool to view, edit, format, and validate JSON.
| * It has various modes such as a tree editor, a code editor, and a plain text
| * editor.
| *
| * Supported browsers: Chrome, Firefox, Safari, Opera, Internet Explorer 8+
| *
| * @license
| * 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.
| *
| * Copyright (c) 2011-2020 Jos de Jong, http://jsoneditoronline.org
| *
| * @author Jos de Jong, <wjosdejong@gmail.com>
| * @version 9.0.3
| * @date 2020-07-02
| */
| (function(t,i){e.exports=i()})(window,(function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=36)}([function(e,t,i){"use strict";i.r(t),i.d(t,"parse",(function(){return g})),i.d(t,"repair",(function(){return p})),i.d(t,"escapeUnicodeChars",(function(){return m})),i.d(t,"validate",(function(){return f})),i.d(t,"extend",(function(){return C})),i.d(t,"clear",(function(){return I})),i.d(t,"getType",(function(){return A})),i.d(t,"isUrl",(function(){return b})),i.d(t,"isArray",(function(){return y})),i.d(t,"getAbsoluteLeft",(function(){return w})),i.d(t,"getAbsoluteTop",(function(){return S})),i.d(t,"addClassName",(function(){return x})),i.d(t,"removeAllClassNames",(function(){return k})),i.d(t,"removeClassName",(function(){return R})),i.d(t,"stripFormatting",(function(){return E})),i.d(t,"setEndOfContentEditable",(function(){return B})),i.d(t,"selectContentEditable",(function(){return Z})),i.d(t,"getSelection",(function(){return G})),i.d(t,"setSelection",(function(){return T})),i.d(t,"getSelectionOffset",(function(){return W})),i.d(t,"setSelectionOffset",(function(){return _})),i.d(t,"getInnerText",(function(){return H})),i.d(t,"hasParentNode",(function(){return $})),i.d(t,"getInternetExplorerVersion",(function(){return V})),i.d(t,"isFirefox",(function(){return L})),i.d(t,"addEventListener",(function(){return O})),i.d(t,"removeEventListener",(function(){return F})),i.d(t,"isChildOf",(function(){return P})),i.d(t,"parsePath",(function(){return K})),i.d(t,"stringifyPath",(function(){return M})),i.d(t,"improveSchemaError",(function(){return j})),i.d(t,"isPromise",(function(){return D})),i.d(t,"isValidValidationError",(function(){return X})),i.d(t,"insideRect",(function(){return Y})),i.d(t,"debounce",(function(){return z})),i.d(t,"textDiff",(function(){return J})),i.d(t,"getInputSelection",(function(){return U})),i.d(t,"getIndexForPosition",(function(){return Q})),i.d(t,"getPositionForPath",(function(){return q})),i.d(t,"compileJSONPointer",(function(){return ee})),i.d(t,"getColorCSS",(function(){return te})),i.d(t,"isValidColor",(function(){return ie})),i.d(t,"makeFieldTooltip",(function(){return ne})),i.d(t,"get",(function(){return re})),i.d(t,"findUniqueName",(function(){return se})),i.d(t,"getChildPaths",(function(){return oe})),i.d(t,"sort",(function(){return ae})),i.d(t,"sortObjectKeys",(function(){return le})),i.d(t,"parseString",(function(){return ce})),i.d(t,"isTimestamp",(function(){return he})),i.d(t,"formatSize",(function(){return de})),i.d(t,"limitCharacters",(function(){return ue})),i.d(t,"isObject",(function(){return ge})),i.d(t,"contains",(function(){return pe})),i.d(t,"isValidationErrorChanged",(function(){return me}));i(24);var n=i(11),r=i.n(n),s=i(22),o=i.n(s),a=i(33),l=i.n(a),c=i(1);function h(e){return h="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}var d=1e4,u=9466848e5;function g(e){try{return JSON.parse(e)}catch(t){throw f(e),t}}function p(e){var t=[],i=0,n=0,r=!1,s=e.match(/^\s*(\/\*(.|[\r\n])*?\*\/)?\s*[\da-zA-Z_$]+\s*\(([\s\S]*)\)\s*;?\s*$/);s&&(e=s[3]);var o={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},a="'",l='"',c="‘",h="’",d="“",u="”",g="`",p="´",m={None:"null",True:"true",False:"false"};function f(){return e.charAt(i)}function C(){return e.charAt(i+1)}function I(){return e.charAt(i-1)}function A(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function v(){var e=t.length-1;while(e>=0){var i=t[e];if(!A(i))return i;e--}return""}function b(){var t=i+1;while(t<e.length&&A(e[t]))t++;return e[t]}function y(){var t=i;while(t<e.length&&A(e[t]))t++;return e[t]}function w(){if("/"===f()&&"*"===C()){i+=2;while(i<e.length&&("*"!==f()||"/"!==C()))i++;i+=2,"\n"===f()&&i++}}function S(){if("/"===f()&&"/"===C()){i+=2;while(i<e.length&&"\n"!==f())i++}}function x(){var t="";while(i<e.length&&A(f()))t+=f(),i++;return t}function k(t){var n="";n+='"',i++;var r=f();while(i<e.length&&r!==t)'"'===r&&"\\"!==I()?n+='\\"':r in o?n+=o[r]:"\\"===r?(i++,r=f(),"'"!==r&&(n+="\\"),n+=r):n+=r,i++,r=f();return r===t&&(n+='"',i++),n}function R(){var e=["null","true","false"],t="",n=f(),r=/[a-zA-Z_$\d]/;while(r.test(n))t+=n,i++,n=f();return t in m?m[t]:-1===e.indexOf(t)?'"'+t+'"':t}function E(){var e=f(),t="";while(/\w/.test(e))t+=e,i++,e=f();if(t.length>0&&"("===e){var n;if(i++,e=f(),'"'===e)n=k(e),e=f();else{n="";while(")"!==e&&""!==e)n+=e,i++,e=f()}return")"===e?(i++,n):t+"("+n+e}return"string"===typeof m[t]?m[t]:t}function B(e){return" "===e||e>=" "&&e<=" "||" "===e||" "===e||" "===e}while(i<e.length){w(),S();var Z=f();if("{"===Z&&n++,"}"===Z&&n--,B(Z))t.push(" "),i++;else if(Z===a)t.push(k(Z));else if(Z===l)t.push(k(l));else if(Z===g)t.push(k(p));else if(Z===c)t.push(k(h));else if(Z===d)t.push(k(u));else if("}"===Z){t.push(Z),i++;var G=x();w(),"{"===y()&&(t.push(","),0===n&&(r=!0)),t.push(G)}else","===Z&&-1!==["]","}"].indexOf(b())?i++:/[a-zA-Z_$]/.test(Z)&&-1!==["{",","].indexOf(v())?t.push(R()):/\w/.test(Z)?t.push(E()):(t.push(Z),i++)}return r&&(t.unshift("[\n"),t.push("\n]")),t.join("")}function m(e){return e.replace(/[\u007F-\uFFFF]/g,(function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))}function f(e){"undefined"!==typeof o.a?o.a.parse(e):JSON.parse(e)}function C(e,t){for(var i in t)fe(t,i)&&(e[i]=t[i]);return e}function I(e){for(var t in e)fe(e,t)&&delete e[t];return e}function A(e){return null===e?"null":void 0===e?"undefined":e instanceof Number||"number"===typeof e?"number":e instanceof String||"string"===typeof e?"string":e instanceof Boolean||"boolean"===typeof e?"boolean":e instanceof RegExp?"regexp":y(e)?"array":"object"}var v=/^https?:\/\/\S+$/;function b(e){return("string"===typeof e||e instanceof String)&&v.test(e)}function y(e){return"[object Array]"===Object.prototype.toString.call(e)}function w(e){var t=e.getBoundingClientRect();return t.left+window.pageXOffset||document.scrollLeft||0}function S(e){var t=e.getBoundingClientRect();return t.top+window.pageYOffset||document.scrollTop||0}function x(e,t){var i=e.className.split(" ");-1===i.indexOf(t)&&(i.push(t),e.className=i.join(" "))}function k(e){e.className=""}function R(e,t){var i=e.className.split(" "),n=i.indexOf(t);-1!==n&&(i.splice(n,1),e.className=i.join(" "))}function E(e){for(var t=e.childNodes,i=0,n=t.length;i<n;i++){var r=t[i];r.style&&r.removeAttribute("style");var s=r.attributes;if(s)for(var o=s.length-1;o>=0;o--){var a=s[o];!0===a.specified&&r.removeAttribute(a.name)}E(r)}}function B(e){var t,i;document.createRange&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1),i=window.getSelection(),i.removeAllRanges(),i.addRange(t))}function Z(e){var t,i;e&&"DIV"===e.nodeName&&(window.getSelection&&document.createRange&&(i=document.createRange(),i.selectNodeContents(e),t=window.getSelection(),t.removeAllRanges(),t.addRange(i)))}function G(){if(window.getSelection){var e=window.getSelection();if(e.getRangeAt&&e.rangeCount)return e.getRangeAt(0)}return null}function T(e){if(e&&window.getSelection){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)}}function W(){var e=G();return e&&"startOffset"in e&&"endOffset"in e&&e.startContainer&&e.startContainer===e.endContainer?{startOffset:e.startOffset,endOffset:e.endOffset,container:e.startContainer.parentNode}:null}function _(e){if(document.createRange&&window.getSelection){var t=window.getSelection();if(t){var i=document.createRange();e.container.firstChild||e.container.appendChild(document.createTextNode("")),i.setStart(e.container.firstChild,e.startOffset),i.setEnd(e.container.firstChild,e.endOffset),T(i)}}}function H(e,t){var i=void 0===t;if(i&&(t={_text:"",flush:function(){var e=this._text;return this._text="",e},set:function(e){this._text=e}}),e.nodeValue){var n=e.nodeValue.replace(/\s*\n\s*/g,"");return""!==n?t.flush()+n:""}if(e.hasChildNodes()){for(var r=e.childNodes,s="",o=0,a=r.length;o<a;o++){var l=r[o];if("DIV"===l.nodeName||"P"===l.nodeName){var c=r[o-1],h=c?c.nodeName:void 0;h&&"DIV"!==h&&"P"!==h&&"BR"!==h&&(""!==s&&(s+="\n"),t.flush()),s+=H(l,t),t.set("\n")}else"BR"===l.nodeName?(s+=t.flush(),t.set("\n")):s+=H(l,t)}return s}return""}function $(e,t){var i=e?e.parentNode:void 0;while(i){if(i===t)return!0;i=i.parentNode}return!1}function V(){if(-1===N){var e=-1;if("undefined"!==typeof navigator&&"Microsoft Internet Explorer"===navigator.appName){var t=navigator.userAgent,i=new RegExp("MSIE ([0-9]+[.0-9]+)");null!=i.exec(t)&&(e=parseFloat(RegExp.$1))}N=e}return N}function L(){return"undefined"!==typeof navigator&&-1!==navigator.userAgent.indexOf("Firefox")}var N=-1;function O(e,t,i,n){if(e.addEventListener)return void 0===n&&(n=!1),"mousewheel"===t&&L()&&(t="DOMMouseScroll"),e.addEventListener(t,i,n),i;if(e.attachEvent){var r=function(){return i.call(e,window.event)};return e.attachEvent("on"+t,r),r}}function F(e,t,i,n){e.removeEventListener?(void 0===n&&(n=!1),"mousewheel"===t&&L()&&(t="DOMMouseScroll"),e.removeEventListener(t,i,n)):e.detachEvent&&e.detachEvent("on"+t,i)}function P(e,t){var i=e.parentNode;while(i){if(i===t)return!0;i=i.parentNode}return!1}function K(e){var t=[],i=0;function n(){var t="";while(void 0!==e[i]&&/[\w$]/.test(e[i]))t+=e[i],i++;if(""===t)throw new Error("Invalid JSON path: property name expected at index "+i);return t}function r(t){var n="";while(void 0!==e[i]&&e[i]!==t)n+=e[i],i++;if(e[i]!==t)throw new Error("Invalid JSON path: unexpected end, character "+t+" expected");return n}while(void 0!==e[i])if("."===e[i])i++,t.push(n());else{if("["!==e[i])throw new Error('Invalid JSON path: unexpected character "'+e[i]+'" at index '+i);if(i++,"'"===e[i]||'"'===e[i]){var s=e[i];if(i++,t.push(r(s)),e[i]!==s)throw new Error("Invalid JSON path: closing quote ' expected at index "+i);i++}else{var o=r("]").trim();if(0===o.length)throw new Error("Invalid JSON path: array value expected at index "+i);o="*"===o?o:JSON.parse(o),t.push(o)}if("]"!==e[i])throw new Error("Invalid JSON path: closing bracket ] expected at index "+i);i++}return t}function M(e){return e.map((function(e){return"number"===typeof e?"["+e+"]":"string"===typeof e&&e.match(/^[A-Za-z0-9_$]+$/)?"."+e:'["'+e+'"]'})).join("")}function j(e){if("enum"===e.keyword&&Array.isArray(e.schema)){var t=e.schema;if(t){if(t=t.map((function(e){return JSON.stringify(e)})),t.length>5){var i=["("+(t.length-5)+" more...)"];t=t.slice(0,5),t.push(i)}e.message="should be equal to one of: "+t.join(", ")}}return"additionalProperties"===e.keyword&&(e.message="should NOT have additional property: "+e.params.additionalProperty),e}function D(e){return e&&"function"===typeof e.then&&"function"===typeof e["catch"]}function X(e){return"object"===h(e)&&Array.isArray(e.path)&&"string"===typeof e.message}function Y(e,t,i){var n=void 0!==i?i:0;return t.left-n>=e.left&&t.right+n<=e.right&&t.top-n>=e.top&&t.bottom+n<=e.bottom}function z(e,t,i){var n;return function(){var r=this,s=arguments,o=function(){n=null,i||e.apply(r,s)},a=i&&!n;clearTimeout(n),n=setTimeout(o,t),a&&e.apply(r,s)}}function J(e,t){var i=t.length,n=0,r=e.length,s=t.length;while(t.charAt(n)===e.charAt(n)&&n<i)n++;while(t.charAt(s-1)===e.charAt(r-1)&&s>n&&r>0)s--,r--;return{start:n,end:s}}function U(e){var t,i,n,r,s,o=0,a=0;return"number"===typeof e.selectionStart&&"number"===typeof e.selectionEnd?(o=e.selectionStart,a=e.selectionEnd):(i=document.selection.createRange(),i&&i.parentElement()===e&&(r=e.value.length,t=e.value.replace(/\r\n/g,"\n"),n=e.createTextRange(),n.moveToBookmark(i.getBookmark()),s=e.createTextRange(),s.collapse(!1),n.compareEndPoints("StartToEnd",s)>-1?o=a=r:(o=-n.moveStart("character",-r),o+=t.slice(0,o).split("\n").length-1,n.compareEndPoints("EndToEnd",s)>-1?a=r:(a=-n.moveEnd("character",-r),a+=t.slice(0,a).split("\n").length-1)))),{startIndex:o,endIndex:a,start:l(o),end:l(a)};function l(t){var i=e.value.substring(0,t),n=(i.match(/\n/g)||[]).length+1,r=i.length-i.lastIndexOf("\n");return{row:n,column:r}}}function Q(e,t,i){var n=e.value||"";if(t>0&&i>0){var r=n.split("\n",t);t=Math.min(r.length,t),i=Math.min(r[t-1].length,i-1);var s=1===t?i:i+1;return r.slice(0,t-1).join("\n").length+s}return-1}function q(e,t){var i,n=[];if(!t||!t.length)return n;try{i=l.a.parse(e)}catch(r){return n}return t.forEach((function(e){var t=K(e),r=ee(t),s=i.pointers[r];s&&n.push({path:e,line:s.key?s.key.line:s.value?s.value.line:0,column:s.key?s.key.column:s.value?s.value.column:0})})),n}function ee(e){return e.map((function(e){return"/"+String(e).replace(/~/g,"~0").replace(/\//g,"~1")})).join("")}function te(e){var t=document.createElement("div");return t.style.color=e,t.style.color.split(/\s+/).join("").toLowerCase()||null}function ie(e){return!!te(e)}function ne(e,t){if(!e)return"";var i="";return e.title&&(i+=e.title),e.description&&(i.length>0&&(i+="\n"),i+=e.description),e["default"]&&(i.length>0&&(i+="\n\n"),i+=Object(c["c"])("default",void 0,t)+"\n",i+=JSON.stringify(e["default"],null,2)),Array.isArray(e.examples)&&e.examples.length>0&&(i.length>0&&(i+="\n\n"),i+=Object(c["c"])("examples",void 0,t)+"\n",e.examples.forEach((function(t,n){i+=JSON.stringify(t,null,2),n!==e.examples.length-1&&(i+="\n")}))),i}function re(e,t){for(var i=e,n=0;n<t.length&&void 0!==i&&null!==i;n++)i=i[t[n]];return i}function se(e,t){var i=e.replace(/ \(copy( \d+)?\)$/,""),n=i,r=1;while(-1!==t.indexOf(n)){var s="copy"+(r>1?" "+r:"");n=i+" ("+s+")",r++}return n}function oe(e,t){var i={};function n(e,t,i,r){var s=!Array.isArray(e)&&!ge(e);(s||r)&&(t[i||""]=!0),ge(e)&&Object.keys(e).forEach((function(s){n(e[s],t,i+"."+s,r)}))}if(Array.isArray(e))for(var r=Math.min(e.length,d),s=0;s<r;s++){var o=e[s];n(o,i,"",t)}else i[""]=!0;return Object.keys(i).sort()}function ae(e,t,i){var n=t&&"."!==t?K(t):[],r="desc"===i?-1:1,s=e.slice();return s.sort((function(e,t){var i=re(e,n),s=re(t,n);return r*(i>s?1:i<s?-1:0)})),s}function le(e,t){var i="desc"===t?-1:1,n=Object.keys(e).sort((function(e,t){return i*r()(e,t)})),s={};return n.forEach((function(t){s[t]=e[t]})),s}function ce(e){if(""===e)return"";var t=e.toLowerCase();if("null"===t)return null;if("true"===t)return!0;if("false"===t)return!1;var i=Number(e),n=parseFloat(e);return isNaN(i)||isNaN(n)?e:i}function he(e,t){return"number"===typeof t&&t>u&&isFinite(t)&&Math.floor(t)===t&&!isNaN(new Date(t).valueOf())}function de(e){if(e<900)return e.toFixed()+" B";var t=e/1e3;if(t<900)return t.toFixed(1)+" KB";var i=t/1e3;if(i<900)return i.toFixed(1)+" MB";var n=i/1e3;if(n<900)return n.toFixed(1)+" GB";var r=n/1e3;return r.toFixed(1)+" TB"}function ue(e,t){return e.length<=t?e:e.slice(0,t)+"..."}function ge(e){return"object"===h(e)&&null!==e&&!Array.isArray(e)}function pe(e,t){return-1!==e.indexOf(t)}function me(e,t){if(!t&&!e)return!1;if(t&&!e||!t&&e)return!0;if(t.length!==e.length)return!0;for(var i=function(i){var n=void 0;if(n="error"===e[i].type?t.find((function(t){return t.line===e[i].line})):t.find((function(t){return t.dataPath===e[i].dataPath&&t.schemaPath===e[i].schemaPath})),!n)return{v:!0}},n=0;n<e.length;++n){var r=i(n);if("object"===h(r))return r.v}return!1}function fe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,i){"use strict";i.d(t,"a",(function(){return l})),i.d(t,"b",(function(){return c})),i.d(t,"c",(function(){return h}));i(24);var n=["en","pt-BR","zh-CN","tr","ja","fr-FR"],r={en:{array:"Array",auto:"Auto",appendText:"Append",appendTitle:"Append a new field with type 'auto' after this field (Ctrl+Shift+Ins)",appendSubmenuTitle:"Select the type of the field to be appended",appendTitleAuto:"Append a new field with type 'auto' (Ctrl+Shift+Ins)",ascending:"Ascending",ascendingTitle:"Sort the childs of this ${type} in ascending order",actionsMenu:"Click to open the actions menu (Ctrl+M)",cannotParseFieldError:"Cannot parse field into JSON",cannotParseValueError:"Cannot parse value into JSON",collapseAll:"Collapse all fields",compactTitle:"Compact JSON data, remove all whitespaces (Ctrl+Shift+\\)",descending:"Descending",descendingTitle:"Sort the childs of this ${type} in descending order",drag:"Drag to move this field (Alt+Shift+Arrows)",duplicateKey:"duplicate key",duplicateText:"Duplicate",duplicateTitle:"Duplicate selected fields (Ctrl+D)",duplicateField:"Duplicate this field (Ctrl+D)",duplicateFieldError:"Duplicate field name",empty:"empty",expandAll:"Expand all fields",expandTitle:"Click to expand/collapse this field (Ctrl+E). \nCtrl+Click to expand/collapse including all childs.",formatTitle:"Format JSON data, with proper indentation and line feeds (Ctrl+\\)",insert:"Insert",insertTitle:"Insert a new field with type 'auto' before this field (Ctrl+Ins)",insertSub:"Select the type of the field to be inserted",object:"Object",ok:"Ok",redo:"Redo (Ctrl+Shift+Z)",removeText:"Remove",removeTitle:"Remove selected fields (Ctrl+Del)",removeField:"Remove this field (Ctrl+Del)",repairTitle:"Repair JSON: fix quotes and escape characters, remove comments and JSONP notation, turn JavaScript objects into JSON.",searchTitle:"Search fields and values",searchNextResultTitle:"Next result (Enter)",searchPreviousResultTitle:"Previous result (Shift + Enter)",selectNode:"Select a node...",showAll:"show all",showMore:"show more",showMoreStatus:"displaying ${visibleChilds} of ${totalChilds} items.",sort:"Sort",sortTitle:"Sort the childs of this ${type}",sortTitleShort:"Sort contents",sortFieldLabel:"Field:",sortDirectionLabel:"Direction:",sortFieldTitle:"Select the nested field by which to sort the array or object",sortAscending:"Ascending",sortAscendingTitle:"Sort the selected field in ascending order",sortDescending:"Descending",sortDescendingTitle:"Sort the selected field in descending order",string:"String",transform:"Transform",transformTitle:"Filter, sort, or transform the childs of this ${type}",transformTitleShort:"Filter, sort, or transform contents",extract:"Extract",extractTitle:"Extract this ${type}",transformQueryTitle:"Enter a JMESPath query",transformWizardLabel:"Wizard",transformWizardFilter:"Filter",transformWizardSortBy:"Sort by",transformWizardSelectFields:"Select fields",transformQueryLabel:"Query",transformPreviewLabel:"Preview",type:"Type",typeTitle:"Change the type of this field",openUrl:"Ctrl+Click or Ctrl+Enter to open url in new window",undo:"Undo last action (Ctrl+Z)",validationCannotMove:"Cannot move a field into a child of itself",autoType:'Field type "auto". The field type is automatically determined from the value and can be a string, number, boolean, or null.',objectType:'Field type "object". An object contains an unordered set of key/value pairs.',arrayType:'Field type "array". An array contains an ordered collection of values.',stringType:'Field type "string". Field type is not determined from the value, but always returned as string.',modeEditorTitle:"Switch Editor Mode",modeCodeText:"Code",modeCodeTitle:"Switch to code highlighter",modeFormText:"Form",modeFormTitle:"Switch to form editor",modeTextText:"Text",modeTextTitle:"Switch to plain text editor",modeTreeText:"Tree",modeTreeTitle:"Switch to tree editor",modeViewText:"View",modeViewTitle:"Switch to tree view",modePreviewText:"Preview",modePreviewTitle:"Switch to preview mode",examples:"Examples",default:"Default"},"zh-CN":{array:"数组",auto:"自动",appendText:"追加",appendTitle:"在此字段后追加一个类型为“auto”的新字段 (Ctrl+Shift+Ins)",appendSubmenuTitle:"选择要追加的字段类型",appendTitleAuto:"追加类型为“auto”的新字段 (Ctrl+Shift+Ins)",ascending:"升序",ascendingTitle:"升序排列${type}的子节点",actionsMenu:"点击打开动作菜单(Ctrl+M)",cannotParseFieldError:"无法将字段解析为JSON",cannotParseValueError:"无法将值解析为JSON",collapseAll:"缩进所有字段",compactTitle:"压缩JSON数据,删除所有空格 (Ctrl+Shift+\\)",descending:"降序",descendingTitle:"降序排列${type}的子节点",drag:"拖拽移动该节点(Alt+Shift+Arrows)",duplicateKey:"重复键",duplicateText:"复制",duplicateTitle:"复制选中字段(Ctrl+D)",duplicateField:"复制该字段(Ctrl+D)",duplicateFieldError:"重复的字段名称",empty:"清空",expandAll:"展开所有字段",expandTitle:"点击 展开/收缩 该字段(Ctrl+E). \nCtrl+Click 展开/收缩 包含所有子节点.",formatTitle:"使用适当的缩进和换行符格式化JSON数据 (Ctrl+\\)",insert:"插入",insertTitle:"在此字段前插入类型为“auto”的新字段 (Ctrl+Ins)",insertSub:"选择要插入的字段类型",object:"对象",ok:"Ok",redo:"重做 (Ctrl+Shift+Z)",removeText:"移除",removeTitle:"移除选中字段 (Ctrl+Del)",removeField:"移除该字段 (Ctrl+Del)",repairTitle:"修复JSON:修复引号和转义符,删除注释和JSONP表示法,将JavaScript对象转换为JSON。",selectNode:"选择一个节点...",showAll:"展示全部",showMore:"展示更多",showMoreStatus:"显示${totalChilds}的${visibleChilds}项目.",sort:"排序",sortTitle:"排序${type}的子节点",sortTitleShort:"内容排序",sortFieldLabel:"字段:",sortDirectionLabel:"方向:",sortFieldTitle:"选择用于对数组或对象排序的嵌套字段",sortAscending:"升序排序",sortAscendingTitle:"按照该字段升序排序",sortDescending:"降序排序",sortDescendingTitle:"按照该字段降序排序",string:"字符串",transform:"变换",transformTitle:"筛选,排序,或者转换${type}的子节点",transformTitleShort:"筛选,排序,或者转换内容",extract:"提取",extractTitle:"提取这个 ${type}",transformQueryTitle:"输入JMESPath查询",transformWizardLabel:"向导",transformWizardFilter:"筛选",transformWizardSortBy:"排序",transformWizardSelectFields:"选择字段",transformQueryLabel:"查询",transformPreviewLabel:"预览",type:"类型",typeTitle:"更改字段类型",openUrl:"Ctrl+Click 或者 Ctrl+Enter 在新窗口打开链接",undo:"撤销上次动作 (Ctrl+Z)",validationCannotMove:"无法将字段移入其子节点",autoType:'字段类型 "auto". 字段类型由值自动确定 可以为 string,number,boolean,或者 null.',objectType:'字段类型 "object". 对象包含一组无序的键/值对.',arrayType:'字段类型 "array". 数组包含值的有序集合.',stringType:'字段类型 "string". 字段类型由值自动确定,但始终作为字符串返回.',modeCodeText:"代码",modeCodeTitle:"切换至代码高亮",modeFormText:"表单",modeFormTitle:"切换至表单编辑",modeTextText:"文本",modeTextTitle:"切换至文本编辑",modeTreeText:"树",modeTreeTitle:"切换至树编辑",modeViewText:"视图",modeViewTitle:"切换至树视图",modePreviewText:"预览",modePreviewTitle:"切换至预览模式",examples:"例子",default:"缺省"},"pt-BR":{array:"Lista",auto:"Automatico",appendText:"Adicionar",appendTitle:"Adicionar novo campo com tipo 'auto' depois deste campo (Ctrl+Shift+Ins)",appendSubmenuTitle:"Selecione o tipo do campo a ser adicionado",appendTitleAuto:"Adicionar novo campo com tipo 'auto' (Ctrl+Shift+Ins)",ascending:"Ascendente",ascendingTitle:"Organizar filhor do tipo ${type} em crescente",actionsMenu:"Clique para abrir o menu de ações (Ctrl+M)",cannotParseFieldError:"Não é possível analisar o campo no JSON",cannotParseValueError:"Não é possível analisar o valor em JSON",collapseAll:"Fechar todos campos",compactTitle:"Dados JSON compactos, remova todos os espaços em branco (Ctrl+Shift+\\)",descending:"Descendente",descendingTitle:"Organizar o filhos do tipo ${type} em decrescente",duplicateKey:"chave duplicada",drag:"Arraste para mover este campo (Alt+Shift+Arrows)",duplicateText:"Duplicar",duplicateTitle:"Duplicar campos selecionados (Ctrl+D)",duplicateField:"Duplicar este campo (Ctrl+D)",duplicateFieldError:"Nome do campo duplicado",empty:"vazio",expandAll:"Expandir todos campos",expandTitle:"Clique para expandir/encolher este campo (Ctrl+E). \nCtrl+Click para expandir/encolher incluindo todos os filhos.",formatTitle:"Formate dados JSON, com recuo e feeds de linha adequados (Ctrl+\\)",insert:"Inserir",insertTitle:"Inserir um novo campo do tipo 'auto' antes deste campo (Ctrl+Ins)",insertSub:"Selecionar o tipo de campo a ser inserido",object:"Objeto",ok:"Ok",redo:"Refazer (Ctrl+Shift+Z)",removeText:"Remover",removeTitle:"Remover campos selecionados (Ctrl+Del)",removeField:"Remover este campo (Ctrl+Del)",repairTitle:"Repare JSON: corrija aspas e caracteres de escape, remova comentários e notação JSONP, transforme objetos JavaScript em JSON.",selectNode:"Selecione um nódulo...",showAll:"mostrar todos",showMore:"mostrar mais",showMoreStatus:"exibindo ${visibleChilds} de ${totalChilds} itens.",sort:"Organizar",sortTitle:"Organizar os filhos deste ${type}",sortTitleShort:"Organizar os filhos",sortFieldLabel:"Campo:",sortDirectionLabel:"Direção:",sortFieldTitle:"Selecione um campo filho pelo qual ordenar o array ou objeto",sortAscending:"Ascendente",sortAscendingTitle:"Ordenar o campo selecionado por ordem ascendente",sortDescending:"Descendente",sortDescendingTitle:"Ordenar o campo selecionado por ordem descendente",string:"Texto",transform:"Transformar",transformTitle:"Filtrar, ordenar ou transformar os filhos deste ${type}",transformTitleShort:"Filtrar, ordenar ou transformar conteúdos",transformQueryTitle:"Insira uma expressão JMESPath",transformWizardLabel:"Assistente",transformWizardFilter:"Filtro",transformWizardSortBy:"Ordenar por",transformWizardSelectFields:"Selecionar campos",transformQueryLabel:"Expressão",transformPreviewLabel:"Visualizar",type:"Tipo",typeTitle:"Mudar o tipo deste campo",openUrl:"Ctrl+Click ou Ctrl+Enter para abrir link em nova janela",undo:"Desfazer último ação (Ctrl+Z)",validationCannotMove:"Não pode mover um campo como filho dele mesmo",autoType:'Campo do tipo "auto". O tipo do campo é determinao automaticamente a partir do seu valor e pode ser texto, número, verdade/falso ou nulo.',objectType:'Campo do tipo "objeto". Um objeto contém uma lista de pares com chave e valor.',arrayType:'Campo do tipo "lista". Uma lista contem uma coleção de valores ordenados.',stringType:'Campo do tipo "string". Campo do tipo nao é determinado através do seu valor, mas sempre retornara um texto.',examples:"Exemplos",default:"Revelia"},tr:{array:"Dizin",auto:"Otomatik",appendText:"Ekle",appendTitle:"Bu alanın altına 'otomatik' tipinde yeni bir alan ekle (Ctrl+Shift+Ins)",appendSubmenuTitle:"Eklenecek alanın tipini seç",appendTitleAuto:"'Otomatik' tipinde yeni bir alan ekle (Ctrl+Shift+Ins)",ascending:"Artan",ascendingTitle:"${type}'ın alt tiplerini artan düzende sırala",actionsMenu:"Aksiyon menüsünü açmak için tıklayın (Ctrl+M)",collapseAll:"Tüm alanları kapat",descending:"Azalan",descendingTitle:"${type}'ın alt tiplerini azalan düzende sırala",drag:"Bu alanı taşımak için sürükleyin (Alt+Shift+Arrows)",duplicateKey:"Var olan anahtar",duplicateText:"Aşağıya kopyala",duplicateTitle:"Seçili alanlardan bir daha oluştur (Ctrl+D)",duplicateField:"Bu alandan bir daha oluştur (Ctrl+D)",duplicateFieldError:"Duplicate field name",cannotParseFieldError:"Alan JSON'a ayrıştırılamıyor",cannotParseValueError:"JSON'a değer ayrıştırılamıyor",empty:"boş",expandAll:"Tüm alanları aç",expandTitle:"Bu alanı açmak/kapatmak için tıkla (Ctrl+E). \nAlt alanlarda dahil tüm alanları açmak için Ctrl+Click ",insert:"Ekle",insertTitle:"Bu alanın üstüne 'otomatik' tipinde yeni bir alan ekle (Ctrl+Ins)",insertSub:"Araya eklenecek alanın tipini seç",object:"Nesne",ok:"Tamam",redo:"Yeniden yap (Ctrl+Shift+Z)",removeText:"Kaldır",removeTitle:"Seçilen alanları kaldır (Ctrl+Del)",removeField:"Bu alanı kaldır (Ctrl+Del)",selectNode:"Bir nesne seç...",showAll:"tümünü göster",showMore:"daha fazla göster",showMoreStatus:"${totalChilds} alanın ${visibleChilds} alt alanları gösteriliyor",sort:"Sırala",sortTitle:"${type}'ın alt alanlarını sırala",sortTitleShort:"İçerikleri sırala",sortFieldLabel:"Alan:",sortDirectionLabel:"Yön:",sortFieldTitle:"Diziyi veya nesneyi sıralamak için iç içe geçmiş alanı seçin",sortAscending:"Artan",sortAscendingTitle:"Seçili alanı artan düzende sırala",sortDescending:"Azalan",sortDescendingTitle:"Seçili alanı azalan düzende sırala",string:"Karakter Dizisi",transform:"Dönüştür",transformTitle:"${type}'ın alt alanlarını filtrele, sırala veya dönüştür",transformTitleShort:"İçerikleri filterele, sırala veya dönüştür",transformQueryTitle:"JMESPath sorgusu gir",transformWizardLabel:"Sihirbaz",transformWizardFilter:"Filtre",transformWizardSortBy:"Sırala",transformWizardSelectFields:"Alanları seç",transformQueryLabel:"Sorgu",transformPreviewLabel:"Önizleme",type:"Tip",typeTitle:"Bu alanın tipini değiştir",openUrl:"URL'i yeni bir pencerede açmak için Ctrl+Click veya Ctrl+Enter",undo:"Son değişikliği geri al (Ctrl+Z)",validationCannotMove:"Alt alan olarak taşınamıyor",autoType:'Alan tipi "otomatik". Alan türü otomatik olarak değerden belirlenirve bir dize, sayı, boolean veya null olabilir.',objectType:'Alan tipi "nesne". Bir nesne, sıralanmamış bir anahtar / değer çifti kümesi içerir.',arrayType:'Alan tipi "dizi". Bir dizi, düzenli değerler koleksiyonu içerir.',stringType:'Alan tipi "karakter dizisi". Alan türü değerden belirlenmez,ancak her zaman karakter dizisi olarak döndürülür.',modeCodeText:"Kod",modeCodeTitle:"Kod vurgulayıcıya geç",modeFormText:"Form",modeFormTitle:"Form düzenleyiciye geç",modeTextText:"Metin",modeTextTitle:"Düz metin düzenleyiciye geç",modeTreeText:"Ağaç",modeTreeTitle:"Ağaç düzenleyiciye geç",modeViewText:"Görünüm",modeViewTitle:"Ağaç görünümüne geç",examples:"Örnekler",default:"Varsayılan"},ja:{array:"配列",auto:"オート",appendText:"追加",appendTitle:'次のフィールドに"オート"のフィールドを追加 (Ctrl+Shift+Ins)',appendSubmenuTitle:"追加するフィールドの型を選択してください",appendTitleAuto:'"オート"のフィールドを追加 (Ctrl+Shift+Ins)',ascending:"昇順",ascendingTitle:"${type}の子要素を昇順に並べ替え",actionsMenu:"クリックしてアクションメニューを開く (Ctrl+M)",collapseAll:"すべてを折りたたむ",descending:"降順",descendingTitle:"${type}の子要素を降順に並べ替え",drag:"ドラッグして選択中のフィールドを移動 (Alt+Shift+Arrows)",duplicateKey:"複製キー",duplicateText:"複製",duplicateTitle:"選択中のフィールドを複製 (Ctrl+D)",duplicateField:"選択中のフィールドを複製 (Ctrl+D)",duplicateFieldError:"フィールド名が重複しています",cannotParseFieldError:"JSONのフィールドを解析できません",cannotParseValueError:"JSONの値を解析できません",empty:"空",expandAll:"すべてを展開",expandTitle:"クリックしてフィールドを展開/折りたたむ (Ctrl+E). \nCtrl+Click ですべての子要素を展開/折りたたむ",insert:"挿入",insertTitle:"選択中のフィールドの前に新しいフィールドを挿入 (Ctrl+Ins)",insertSub:"挿入するフィールドの型を選択",object:"オブジェクト",ok:"実行",redo:"やり直す (Ctrl+Shift+Z)",removeText:"削除",removeTitle:"選択中のフィールドを削除 (Ctrl+Del)",removeField:"選択中のフィールドを削除 (Ctrl+Del)",selectNode:"ノードを選択...",showAll:"すべてを表示",showMore:"もっと見る",showMoreStatus:"${totalChilds}個のアイテムのうち ${visibleChilds}個を表示しています。",sort:"並べ替え",sortTitle:"${type}の子要素を並べ替え",sortTitleShort:"並べ替え",sortFieldLabel:"フィールド:",sortDirectionLabel:"順序:",sortFieldTitle:"配列またはオブジェクトを並び替えるためのフィールドを選択",sortAscending:"昇順",sortAscendingTitle:"選択中のフィールドを昇順に並び替え",sortDescending:"降順",sortDescendingTitle:"選択中のフィールドを降順に並び替え",string:"文字列",transform:"変換",transformTitle:"${type}の子要素をフィルター・並び替え・変換する",transformTitleShort:"内容をフィルター・並び替え・変換する",extract:"抽出",extractTitle:"${type}を抽出",transformQueryTitle:"JMESPathクエリを入力",transformWizardLabel:"ウィザード",transformWizardFilter:"フィルター",transformWizardSortBy:"並び替え",transformWizardSelectFields:"フィールドを選択",transformQueryLabel:"クエリ",transformPreviewLabel:"プレビュー",type:"型",typeTitle:"選択中のフィールドの型を変更",openUrl:"Ctrl+Click または Ctrl+Enter で 新規ウィンドウでURLを開く",undo:"元に戻す (Ctrl+Z)",validationCannotMove:"子要素に移動できません ",autoType:"オート: フィールドの型は値から自動的に決定されます。 (文字列・数値・ブール・null)",objectType:"オブジェクト: オブジェクトは順序が決まっていないキーと値のペア組み合わせです。",arrayType:"配列: 配列は順序が決まっている値の集合体です。",stringType:"文字列: フィールド型は値から決定されませんが、常に文字列として返されます。",modeCodeText:"コードモード",modeCodeTitle:"ハイライトモードに切り替え",modeFormText:"フォームモード",modeFormTitle:"フォームモードに切り替え",modeTextText:"テキストモード",modeTextTitle:"テキストモードに切り替え",modeTreeText:"ツリーモード",modeTreeTitle:"ツリーモードに切り替え",modeViewText:"ビューモード",modeViewTitle:"ビューモードに切り替え",modePreviewText:"プレビュー",modePreviewTitle:"プレビューに切り替え",examples:"例",default:"デフォルト"},"fr-FR":{array:"Liste",auto:"Auto",appendText:"Ajouter",appendTitle:"Ajouter un champ de type 'auto' après ce champ (Ctrl+Shift+Ins)",appendSubmenuTitle:"Sélectionner le type du champ à ajouter",appendTitleAuto:"Ajouter un champ de type 'auto' (Ctrl+Shift+Ins)",ascending:"Ascendant",ascendingTitle:"Trier les enfants de ce ${type} par ordre ascendant",actionsMenu:"Ouvrir le menu des actions (Ctrl+M)",collapseAll:"Regrouper",descending:"Descendant",descendingTitle:"Trier les enfants de ce ${type} par ordre descendant",drag:"Déplacer (Alt+Shift+Arrows)",duplicateKey:"Dupliquer la clé",duplicateText:"Dupliquer",duplicateTitle:"Dupliquer les champs sélectionnés (Ctrl+D)",duplicateField:"Dupliquer ce champ (Ctrl+D)",duplicateFieldError:"Dupliquer le nom de champ",cannotParseFieldError:"Champ impossible à parser en JSON",cannotParseValueError:"Valeur impossible à parser en JSON",empty:"vide",expandAll:"Étendre",expandTitle:"Étendre/regrouper ce champ (Ctrl+E). \nCtrl+Click pour étendre/regrouper avec tous les champs.",insert:"Insérer",insertTitle:"Insérer un champ de type 'auto' avant ce champ (Ctrl+Ins)",insertSub:"Sélectionner le type de champ à insérer",object:"Objet",ok:"Ok",redo:"Rejouer (Ctrl+Shift+Z)",removeText:"Supprimer",removeTitle:"Supprimer les champs sélectionnés (Ctrl+Del)",removeField:"Supprimer ce champ (Ctrl+Del)",searchTitle:"Rechercher champs et valeurs",searchNextResultTitle:"Résultat suivant (Enter)",searchPreviousResultTitle:"Résultat précédent (Shift + Enter)",selectNode:"Sélectionner un nœud...",showAll:"voir tout",showMore:"voir plus",showMoreStatus:"${visibleChilds} éléments affichés de ${totalChilds}.",sort:"Trier",sortTitle:"Trier les champs de ce ${type}",sortTitleShort:"Trier",sortFieldLabel:"Champ:",sortDirectionLabel:"Direction:",sortFieldTitle:"Sélectionner les champs permettant de trier les listes et objet",sortAscending:"Ascendant",sortAscendingTitle:"Trier les champs sélectionnés par ordre ascendant",sortDescending:"Descendant",sortDescendingTitle:"Trier les champs sélectionnés par ordre descendant",string:"Chaîne",transform:"Transformer",transformTitle:"Filtrer, trier, or transformer les enfants de ce ${type}",transformTitleShort:"Filtrer, trier ou transformer le contenu",extract:"Extraire",extractTitle:"Extraire ce ${type}",transformQueryTitle:"Saisir une requête JMESPath",transformWizardLabel:"Assistant",transformWizardFilter:"Filtrer",transformWizardSortBy:"Trier par",transformWizardSelectFields:"Sélectionner les champs",transformQueryLabel:"Requête",transformPreviewLabel:"Prévisualisation",type:"Type",typeTitle:"Changer le type de ce champ",openUrl:"Ctrl+Click ou Ctrl+Enter pour ouvrir l'url dans une autre fenêtre",undo:"Annuler la dernière action (Ctrl+Z)",validationCannotMove:"Cannot move a field into a child of itself",autoType:'Champe de type "auto". Ce type de champ est automatiquement déterminé en fonction de la valeur et peut être de type "chaîne", "nombre", "booléen" ou null.',objectType:'Champ de type "objet". Un objet contient un ensemble non ordonné de paires clé/valeur.',arrayType:'Champ de type "liste". Une liste contient une collection ordonnée de valeurs.',stringType:'Champ de type "chaîne". Ce type de champ n\'est pas déterminé en fonction de la valeur, mais retourne systématiquement une chaîne de caractères.',modeEditorTitle:"Changer mode d'édition",modeCodeText:"Code",modeCodeTitle:"Activer surlignage code",modeFormText:"Formulaire",modeFormTitle:"Activer formulaire",modeTextText:"Texte",modeTextTitle:"Activer éditeur texte",modeTreeText:"Arbre",modeTreeTitle:"Activer éditeur arbre",modeViewText:"Lecture seule",modeViewTitle:"Activer vue arbre",modePreviewText:"Prévisualisation",modePreviewTitle:"Activer mode prévisualiser",examples:"Exemples",default:"Défaut"}},s="en",o="undefined"!==typeof navigator?navigator.language||navigator.userLanguage:void 0,a=n.find((function(e){return e===o}))||s;function l(e){if(e){var t=n.find((function(t){return t===e}));t&&(a=t)}}function c(e){if(e){var t=function(t){var i=n.find((function(e){return e===t}));i||n.push(t),r[t]=Object.assign({},r[s],r[t],e[t])};for(var i in e)t(i)}}function h(e,t,i){i||(i=a);var n=r[i][e]||r[s][e]||e;if(t)for(var o in t)n=n.replace("${"+o+"}",t[o]);return n}},function(e,t,i){"use strict";i.d(t,"a",(function(){return n})),i.d(t,"d",(function(){return r})),i.d(t,"b",(function(){return s})),i.d(t,"c",(function(){return o}));var n=document.body,r=10485760,s=2e4,o=2147483648},function(e,t,i){"use strict";i.d(t,"a",(function(){return c}));var n=i(12),r=i(0),s=i(1);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,i){return t&&a(e.prototype,t),i&&a(e,i),e}var c=function(){function e(t,i){o(this,e),this.dom={};var n=this,r=this.dom;this.anchor=void 0,this.items=t,this.eventListeners={},this.selection=void 0,this.onClose=i?i.close:void 0;var a=document.createElement("div");a.className="jsoneditor-contextmenu-root",r.root=a;var l=document.createElement("div");l.className="jsoneditor-contextmenu",r.menu=l,a.appendChild(l);var c=document.createElement("ul");c.className="jsoneditor-menu",l.appendChild(c),r.list=c,r.items=[];var h=document.createElement("button");h.type="button",r.focusButton=h;var d=document.createElement("li");function u(e,t,i){i.forEach((function(i){if("separator"===i.type){var r=document.createElement("div");r.className="jsoneditor-separator";var o=document.createElement("li");o.appendChild(r),e.appendChild(o)}else{var a={},l=document.createElement("li");e.appendChild(l);var c=document.createElement("button");if(c.type="button",c.className=i.className,a.button=c,i.title&&(c.title=i.title),i.click&&(c.onclick=function(e){e.preventDefault(),n.hide(),i.click()}),l.appendChild(c),i.submenu){var h=document.createElement("div");h.className="jsoneditor-icon",c.appendChild(h);var d,g=document.createElement("div");if(g.className="jsoneditor-text"+(i.click?"":" jsoneditor-right-margin"),g.appendChild(document.createTextNode(i.text)),c.appendChild(g),i.click){c.className+=" jsoneditor-default";var p=document.createElement("button");p.type="button",a.buttonExpand=p,p.className="jsoneditor-expand";var m=document.createElement("div");m.className="jsoneditor-expand",p.appendChild(m),l.appendChild(p),i.submenuTitle&&(p.title=i.submenuTitle),d=p}else{var f=document.createElement("div");f.className="jsoneditor-expand",c.appendChild(f),d=c}d.onclick=function(e){e.preventDefault(),n._onExpandItem(a),d.focus()};var C=[];a.subItems=C;var I=document.createElement("ul");a.ul=I,I.className="jsoneditor-menu",I.style.height="0",l.appendChild(I),u(I,C,i.submenu)}else{var A=document.createElement("div");A.className="jsoneditor-icon",c.appendChild(A);var v=document.createElement("div");v.className="jsoneditor-text",v.appendChild(document.createTextNode(Object(s["c"])(i.text))),c.appendChild(v)}t.push(a)}}))}d.style.overflow="hidden",d.style.height="0",d.appendChild(h),c.appendChild(d),u(c,this.dom.items,t),this.maxHeight=0,t.forEach((function(e){var i=24*(t.length+(e.submenu?e.submenu.length:0));n.maxHeight=Math.max(n.maxHeight,i)}))}return l(e,[{key:"_getVisibleButtons",value:function(){var e=[],t=this;return this.dom.items.forEach((function(i){e.push(i.button),i.buttonExpand&&e.push(i.buttonExpand),i.subItems&&i===t.expandedItem&&i.subItems.forEach((function(t){e.push(t.button),t.buttonExpand&&e.push(t.buttonExpand)}))})),e}},{key:"show",value:function(t,i,s){this.hide();var o=!0,a=t.parentNode,l=t.getBoundingClientRect(),c=a.getBoundingClientRect(),h=i.getBoundingClientRect(),d=this;this.dom.absoluteAnchor=Object(n["a"])(t,i,(function(){d.hide()})),l.bottom+this.maxHeight<h.bottom||l.top-this.maxHeight>h.top&&(o=!1);var u=s?0:l.top-c.top;if(o){var g=t.offsetHeight;this.dom.menu.style.left="0",this.dom.menu.style.top=u+g+"px",this.dom.menu.style.bottom=""}else this.dom.menu.style.left="0",this.dom.menu.style.top="",this.dom.menu.style.bottom="0px";this.dom.absoluteAnchor.appendChild(this.dom.root),this.selection=Object(r["getSelection"])(),this.anchor=t,setTimeout((function(){d.dom.focusButton.focus()}),0),e.visibleMenu&&e.visibleMenu.hide(),e.visibleMenu=this}},{key:"hide",value:function(){this.dom.absoluteAnchor&&(this.dom.absoluteAnchor.destroy(),delete this.dom.absoluteAnchor),this.dom.root.parentNode&&(this.dom.root.parentNode.removeChild(this.dom.root),this.onClose&&this.onClose()),e.visibleMenu===this&&(e.visibleMenu=void 0)}},{key:"_onExpandItem",value:function(e){var t=this,i=e===this.expandedItem,n=this.expandedItem;if(n&&(n.ul.style.height="0",n.ul.style.padding="",setTimeout((function(){t.expandedItem!==n&&(n.ul.style.display="",Object(r["removeClassName"])(n.ul.parentNode,"jsoneditor-selected"))}),300),this.expandedItem=void 0),!i){var s=e.ul;s.style.display="block",s.clientHeight,setTimeout((function(){if(t.expandedItem===e){for(var i=0,n=0;n<s.childNodes.length;n++)i+=s.childNodes[n].clientHeight;s.style.height=i+"px",s.style.padding="5px 10px"}}),0),Object(r["addClassName"])(s.parentNode,"jsoneditor-selected"),this.expandedItem=e}}},{key:"_onKeyDown",value:function(e){var t,i,n,s,o=e.target,a=e.which,l=!1;27===a?(this.selection&&Object(r["setSelection"])(this.selection),this.anchor&&this.anchor.focus(),this.hide(),l=!0):9===a?e.shiftKey?(t=this._getVisibleButtons(),i=t.indexOf(o),0===i&&(t[t.length-1].focus(),l=!0)):(t=this._getVisibleButtons(),i=t.indexOf(o),i===t.length-1&&(t[0].focus(),l=!0)):37===a?("jsoneditor-expand"===o.className&&(t=this._getVisibleButtons(),i=t.indexOf(o),n=t[i-1],n&&n.focus()),l=!0):38===a?(t=this._getVisibleButtons(),i=t.indexOf(o),n=t[i-1],n&&"jsoneditor-expand"===n.className&&(n=t[i-2]),n||(n=t[t.length-1]),n&&n.focus(),l=!0):39===a?(t=this._getVisibleButtons(),i=t.indexOf(o),s=t[i+1],s&&"jsoneditor-expand"===s.className&&s.focus(),l=!0):40===a&&(t=this._getVisibleButtons(),i=t.indexOf(o),s=t[i+1],s&&"jsoneditor-expand"===s.className&&(s=t[i+2]),s||(s=t[0]),s&&(s.focus(),l=!0),l=!0),l&&(e.stopPropagation(),e.preventDefault())}}]),e}();c.visibleMenu=void 0},function(e,t,i){"use strict";i.d(t,"a",(function(){return o})),i.d(t,"b",(function(){return a}));var n=i(34),r=i.n(n),s=i(0);function o(e,t){var i=t.sort,n=t.filter,r=t.projection,o="";if(n){var a="@"!==n.field?["0"].concat(Object(s["parsePath"])("."+n.field)):["0"],l=Object(s["get"])(e,a),c="string"===typeof l?n.value:Object(s["parseString"])(n.value);o+="[? "+n.field+" "+n.relation+" `"+JSON.stringify(c)+"`]"}else o+=Array.isArray(e)?"[*]":"@";return i&&("desc"===i.direction?o+=" | reverse(sort_by(@, &"+i.field+"))":o+=" | sort_by(@, &"+i.field+")"),r&&("]"!==o[o.length-1]&&(o+=" | [*]"),1===r.fields.length?o+="."+r.fields[0]:r.fields.length>1&&(o+=".{"+r.fields.map((function(e){var t=e.split("."),i=t[t.length-1];return i+": "+e})).join(", ")+"}")),o}function a(e,t){return r.a.search(e,t)}},function(e,t,i){"use strict";i.r(t),i.d(t,"showSortModal",(function(){return a}));var n=i(14),r=i.n(n),s=i(1),o=i(0);function a(e,t,i,n){var a=Array.isArray(t)?Object(o["getChildPaths"])(t):[""],l=n&&n.path&&Object(o["contains"])(a,n.path)?n.path:a[0],c=n&&n.direction||"asc",h='<div class="pico-modal-contents"><div class="pico-modal-header">'+Object(s["c"])("sort")+"</div><form><table><tbody><tr> <td>"+Object(s["c"])("sortFieldLabel")+' </td> <td class="jsoneditor-modal-input"> <div class="jsoneditor-select-wrapper"> <select id="field" title="'+Object(s["c"])("sortFieldTitle")+'"> </select> </div> </td></tr><tr> <td>'+Object(s["c"])("sortDirectionLabel")+' </td> <td class="jsoneditor-modal-input"> <div id="direction" class="jsoneditor-button-group"><input type="button" value="'+Object(s["c"])("sortAscending")+'" title="'+Object(s["c"])("sortAscendingTitle")+'" data-value="asc" class="jsoneditor-button-first jsoneditor-button-asc"/><input type="button" value="'+Object(s["c"])("sortDescending")+'" title="'+Object(s["c"])("sortDescendingTitle")+'" data-value="desc" class="jsoneditor-button-last jsoneditor-button-desc"/> </div> </td></tr><tr><td colspan="2" class="jsoneditor-modal-input jsoneditor-modal-actions"> <input type="submit" id="ok" value="'+Object(s["c"])("ok")+'" /></td></tr></tbody></table></form></div>';r()({parent:e,content:h,overlayClass:"jsoneditor-modal-overlay",overlayStyles:{backgroundColor:"rgb(1,1,1)",opacity:.3},modalClass:"jsoneditor-modal jsoneditor-modal-sort"}).afterCreate((function(e){var t=e.modalElem().querySelector("form"),n=e.modalElem().querySelector("#ok"),r=e.modalElem().querySelector("#field"),s=e.modalElem().querySelector("#direction");function o(e){return""===e?"@":"."===e[0]?e.slice(1):e}function h(e){s.value=e,s.className="jsoneditor-button-group jsoneditor-button-group-value-"+s.value}a.forEach((function(e){var t=document.createElement("option");t.text=o(e),t.value=e,r.appendChild(t)})),r.value=l||a[0],h(c||"asc"),s.onclick=function(e){h(e.target.getAttribute("data-value"))},n.onclick=function(t){t.preventDefault(),t.stopPropagation(),e.close(),i({path:r.value,direction:s.value})},t&&(t.onsubmit=n.onclick)})).afterClose((function(e){e.destroy()})).show()}},function(e,t,i){"use strict";i.r(t),i.d(t,"showTransformModal",(function(){return A}));var n=i(14),r=i.n(n),s=i(10),o=i.n(s),a=i(1);function l(e){return l="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(e,t,i){var n;"number"===typeof t?t>10?n=g(" ",10):t>=1&&(n=g(" ",t)):"string"===typeof t&&""!==t&&(n=t);var r=h(e,n,"",i);return r.length>i?p(r,i)+"...":r}function h(e,t,i,n){return"boolean"===typeof e||e instanceof Boolean||null===e||"number"===typeof e||e instanceof Number||"string"===typeof e||e instanceof String||e instanceof Date?JSON.stringify(e):Array.isArray(e)?d(e,t,i,n):e&&"object"===l(e)?u(e,t,i,n):void 0}function d(e,t,i,n){for(var r=t?i+t:void 0,s=t?"[\n":"[",o=0;o<e.length;o++){var a=e[o];if(t&&(s+=r),s+="undefined"!==typeof a&&"function"!==typeof a?h(a,t,r,n):"null",o<e.length-1&&(s+=t?",\n":","),s.length>n)return s+"..."}return s+=t?"\n"+i+"]":"]",s}function u(e,t,i,n){var r=t?i+t:void 0,s=!0,o=t?"{\n":"{";if("function"===typeof e.toJSON)return h(e.toJSON(),t,i,n);for(var a in e)if(m(e,a)){var l=e[a];if(s?s=!1:o+=t?",\n":",",o+=t?r+'"'+a+'": ':'"'+a+'":',o+=h(l,t,r,n),o.length>n)return o+"..."}return o+=t?"\n"+i+"}":"}",o}function g(e,t){var i="";while(t-- >0)i+=e;return i}function p(e,t){return"number"===typeof t?e.slice(0,t):e}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var f=i(0),C=i(2),I='Enter a <a href="http://jmespath.org" target="_blank">JMESPath</a> query to filter, sort, or transform the JSON data.<br/>To learn JMESPath, go to <a href="http://jmespath.org/tutorial.html" target="_blank">the interactive tutorial</a>.';function A(e){var t=e.container,i=e.json,n=e.queryDescription,s=void 0===n?I:n,l=e.createQuery,h=e.executeQuery,d=e.onTransform,u=i,g='<label class="pico-modal-contents"><div class="pico-modal-header">'+Object(a["c"])("transform")+"</div><p>"+s+'</p><div class="jsoneditor-jmespath-label">'+Object(a["c"])("transformWizardLabel")+' </div><div id="wizard" class="jsoneditor-jmespath-block jsoneditor-jmespath-wizard"> <table class="jsoneditor-jmespath-wizard-table"> <tbody> <tr> <th>'+Object(a["c"])("transformWizardFilter")+'</th> <td class="jsoneditor-jmespath-filter"> <div class="jsoneditor-inline jsoneditor-jmespath-filter-field" > <select id="filterField"> </select> </div> <div class="jsoneditor-inline jsoneditor-jmespath-filter-relation" > <select id="filterRelation"> <option value="==">==</option> <option value="!=">!=</option> <option value="<"><</option> <option value="<="><=</option> <option value=">">></option> <option value=">=">>=</option> </select> </div> <div class="jsoneditor-inline jsoneditor-jmespath-filter-value" > <input type="text" class="value" placeholder="value..." id="filterValue" /> </div> </td> </tr> <tr> <th>'+Object(a["c"])("transformWizardSortBy")+'</th> <td class="jsoneditor-jmespath-filter"> <div class="jsoneditor-inline jsoneditor-jmespath-sort-field"> <select id="sortField"> </select> </div> <div class="jsoneditor-inline jsoneditor-jmespath-sort-order" > <select id="sortOrder"> <option value="asc">Ascending</option> <option value="desc">Descending</option> </select> </div> </td> </tr> <tr id="selectFieldsPart"> <th>'+Object(a["c"])("transformWizardSelectFields")+'</th> <td class="jsoneditor-jmespath-filter"> <select class="jsoneditor-jmespath-select-fields" id="selectFields" multiple></select> </td> </tr> </tbody> </table></div><div class="jsoneditor-jmespath-label">'+Object(a["c"])("transformQueryLabel")+' </div><div class="jsoneditor-jmespath-block"> <textarea id="query" rows="4" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" title="'+Object(a["c"])("transformQueryTitle")+'">[*]</textarea></div><div class="jsoneditor-jmespath-label">'+Object(a["c"])("transformPreviewLabel")+' </div><div class="jsoneditor-jmespath-block"> <textarea id="preview" class="jsoneditor-transform-preview" readonly> </textarea></div><div class="jsoneditor-jmespath-block jsoneditor-modal-actions"> <input type="submit" id="ok" value="'+Object(a["c"])("ok")+'" autofocus /></div></div>';r()({parent:t,content:g,overlayClass:"jsoneditor-modal-overlay",overlayStyles:{backgroundColor:"rgb(1,1,1)",opacity:.3},modalClass:"jsoneditor-modal jsoneditor-modal-transform",focus:!1}).afterCreate((function(e){var t=e.modalElem(),n=t.querySelector("#wizard"),r=t.querySelector("#ok"),s=t.querySelector("#filterField"),a=t.querySelector("#filterRelation"),g=t.querySelector("#filterValue"),p=t.querySelector("#sortField"),m=t.querySelector("#sortOrder"),I=t.querySelector("#selectFields"),A=t.querySelector("#query"),v=t.querySelector("#preview");Array.isArray(u)||(n.style.fontStyle="italic",n.textContent="(wizard not available for objects, only for arrays)");var b=Object(f["getChildPaths"])(i);b.forEach((function(e){var t=B(e),i=document.createElement("option");i.text=t,i.value=t,s.appendChild(i);var n=document.createElement("option");n.text=t,n.value=t,p.appendChild(n)}));var y=Object(f["getChildPaths"])(i,!0).filter((function(e){return""!==e}));if(y.length>0)y.forEach((function(e){var t=B(e),i=document.createElement("option");i.text=t,i.value=t,I.appendChild(i)}));else{var w=t.querySelector("#selectFieldsPart");w&&(w.style.display="none")}var S=new o.a(s,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"field..."}),x=new o.a(a,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"compare..."}),k=new o.a(p,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"field..."}),R=new o.a(m,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"order..."}),E=new o.a(I,{multiple:!0,clearable:!0,defaultSelected:!1,placeholder:"select fields..."});function B(e){return""===e?"@":"."===e[0]?e.slice(1):e}function Z(){try{var e=h(u,A.value);v.className="jsoneditor-transform-preview",v.value=c(e,2,C["b"]),r.disabled=!1}catch(t){v.className="jsoneditor-transform-preview jsoneditor-error",v.value=t.toString(),r.disabled=!0}}S.on("selectr.change",W),x.on("selectr.change",W),g.oninput=W,k.on("selectr.change",W),R.on("selectr.change",W),E.on("selectr.change",W),t.querySelector(".pico-modal-contents").onclick=function(e){"A"!==e.target.nodeName&&e.preventDefault()};var G=Object(f["debounce"])(Z,300);function T(e,t){try{A.value=l(e,t),r.disabled=!1,G()}catch(n){var i='Error: an error happened when executing "createQuery": '+(n.message||n.toString());A.value="",r.disabled=!0,v.className="jsoneditor-transform-preview jsoneditor-error",v.value=i}}function W(){var e={};if(s.value&&a.value&&g.value&&(e.filter={field:s.value,relation:a.value,value:g.value}),p.value&&m.value&&(e.sort={field:p.value,direction:m.value}),I.value){for(var t=[],n=0;n<I.options.length;n++)if(I.options[n].selected){var r=I.options[n].value;t.push(r)}e.projection={fields:t}}T(i,e)}A.oninput=G,r.onclick=function(t){t.preventDefault(),t.stopPropagation(),e.close(),d(A.value)},T(i,{}),setTimeout((function(){A.select(),A.focus(),A.selectionStart=3,A.selectionEnd=3}))})).afterClose((function(e){e.destroy()})).show()}},function(e,t,i){"use strict";function n(e,t){for(var i in t=t||{},e)t[i]=e[i];return t}function r(e,t,i){var n=i?" !== ":" === ",r=i?" || ":" && ",s=i?"!":"",o=i?"":"!";switch(e){case"null":return t+n+"null";case"array":return s+"Array.isArray("+t+")";case"object":return"("+s+t+r+"typeof "+t+n+'"object"'+r+o+"Array.isArray("+t+"))";case"integer":return"(typeof "+t+n+'"number"'+r+o+"("+t+" % 1)"+r+t+n+t+")";default:return"typeof "+t+n+'"'+e+'"'}}function s(e,t){switch(e.length){case 1:return r(e[0],t,!0);default:var i="",n=l(e);for(var s in n.array&&n.object&&(i=n.null?"(":"(!"+t+" || ",i+="typeof "+t+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer,n)i+=(i?" && ":"")+r(s,t,!0);return i}}e.exports={copy:n,checkDataType:r,checkDataTypes:s,coerceToTypes:a,toHash:l,getProperty:d,escapeQuotes:u,equal:i(18),ucs2length:i(47),varOccurences:g,varReplace:p,cleanUpCode:I,finalCleanUpCode:E,schemaHasRules:B,schemaHasRulesExcept:Z,schemaUnknownRules:G,toQuotedString:T,getPathExpr:W,getPath:_,getData:V,unescapeFragment:N,unescapeJsonPointer:P,escapeFragment:O,escapeJsonPointer:F};var o=l(["string","number","integer","boolean","null"]);function a(e,t){if(Array.isArray(t)){for(var i=[],n=0;n<t.length;n++){var r=t[n];(o[r]||"array"===e&&"array"===r)&&(i[i.length]=r)}if(i.length)return i}else{if(o[t])return[t];if("array"===e&&"array"===t)return["array"]}}function l(e){for(var t={},i=0;i<e.length;i++)t[e[i]]=!0;return t}var c=/^[a-z$_][a-z$_0-9]*$/i,h=/'|\\/g;function d(e){return"number"==typeof e?"["+e+"]":c.test(e)?"."+e:"['"+u(e)+"']"}function u(e){return e.replace(h,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function g(e,t){t+="[^0-9]";var i=e.match(new RegExp(t,"g"));return i?i.length:0}function p(e,t,i){return t+="([^0-9])",i=i.replace(/\$/g,"$$$$"),e.replace(new RegExp(t,"g"),i+"$1")}var m=/else\s*{\s*}/g,f=/if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g,C=/if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;function I(e){return e.replace(m,"").replace(f,"").replace(C,"if (!($1))")}var A=/[^v.]errors/g,v=/var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g,b=/var errors = 0;|var vErrors = null;/g,y="return errors === 0;",w="validate.errors = null; return true;",S=/if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/,x="return data;",k=/[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g,R=/if \(rootData === undefined\) rootData = data;/;function E(e,t){var i=e.match(A);return i&&2==i.length&&(e=t?e.replace(b,"").replace(S,x):e.replace(v,"").replace(y,w)),i=e.match(k),i&&3===i.length?e.replace(R,""):e}function B(e,t){if("boolean"==typeof e)return!e;for(var i in e)if(t[i])return!0}function Z(e,t,i){if("boolean"==typeof e)return!e&&"not"!=i;for(var n in e)if(n!=i&&t[n])return!0}function G(e,t){if("boolean"!=typeof e)for(var i in e)if(!t[i])return i}function T(e){return"'"+u(e)+"'"}function W(e,t,i,n){var r=i?"'/' + "+t+(n?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):n?"'[' + "+t+" + ']'":"'[\\'' + "+t+" + '\\']'";return L(e,r)}function _(e,t,i){var n=T(i?"/"+F(t):d(t));return L(e,n)}var H=/^\/(?:[^~]|~0|~1)*$/,$=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function V(e,t,i){var n,r,s,o;if(""===e)return"rootData";if("/"==e[0]){if(!H.test(e))throw new Error("Invalid JSON-pointer: "+e);r=e,s="rootData"}else{if(o=e.match($),!o)throw new Error("Invalid JSON-pointer: "+e);if(n=+o[1],r=o[2],"#"==r){if(n>=t)throw new Error("Cannot access property/index "+n+" levels up, current level is "+t);return i[t-n]}if(n>t)throw new Error("Cannot access data "+n+" levels up, current level is "+t);if(s="data"+(t-n||""),!r)return s}for(var a=s,l=r.split("/"),c=0;c<l.length;c++){var h=l[c];h&&(s+=d(P(h)),a+=" && "+s)}return a}function L(e,t){return'""'==e?t:(e+" + "+t).replace(/' \+ '/g,"")}function N(e){return P(decodeURIComponent(e))}function O(e){return encodeURIComponent(F(e))}function F(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function P(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}},function(e,t,i){"use strict";i.d(t,"a",(function(){return l}));var n=i(3),r=i(1);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,i){return t&&o(e.prototype,t),i&&o(e,i),e}var l=function(){function e(t,i,o,a){s(this,e);for(var l={code:{text:Object(r["c"])("modeCodeText"),title:Object(r["c"])("modeCodeTitle"),click:function(){a("code")}},form:{text:Object(r["c"])("modeFormText"),title:Object(r["c"])("modeFormTitle"),click:function(){a("form")}},text:{text:Object(r["c"])("modeTextText"),title:Object(r["c"])("modeTextTitle"),click:function(){a("text")}},tree:{text:Object(r["c"])("modeTreeText"),title:Object(r["c"])("modeTreeTitle"),click:function(){a("tree")}},view:{text:Object(r["c"])("modeViewText"),title:Object(r["c"])("modeViewTitle"),click:function(){a("view")}},preview:{text:Object(r["c"])("modePreviewText"),title:Object(r["c"])("modePreviewTitle"),click:function(){a("preview")}}},c=[],h=0;h<i.length;h++){var d=i[h],u=l[d];if(!u)throw new Error('Unknown mode "'+d+'"');u.className="jsoneditor-type-modes"+(o===d?" jsoneditor-selected":""),c.push(u)}var g=l[o];if(!g)throw new Error('Unknown mode "'+o+'"');var p=g.text,m=document.createElement("button");m.type="button",m.className="jsoneditor-modes jsoneditor-separator",m.textContent=p+" ▾",m.title=Object(r["c"])("modeEditorTitle"),m.onclick=function(){var e=new n["a"](c);e.show(m,t)};var f=document.createElement("div");f.className="jsoneditor-modes",f.style.position="relative",f.appendChild(m),t.appendChild(f),this.dom={container:t,box:m,frame:f}}return a(e,[{key:"focus",value:function(){this.dom.box.focus()}},{key:"destroy",value:function(){this.dom&&this.dom.frame&&this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame),this.dom=null}}]),e}()},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,i){return t&&r(e.prototype,t),i&&r(e,i),e}i.d(t,"a",(function(){return o}));var o=function(){function e(t){if(n(this,e),this.target=t.target||null,!this.target)throw new Error('FocusTracker constructor called without a "target" to track.');this.onFocus="function"===typeof t.onFocus?t.onFocus:null,this.onBlur="function"===typeof t.onBlur?t.onBlur:null,this._onClick=this._onEvent.bind(this),this._onKeyUp=function(e){9!==e.which&&9!==e.keyCode||this._onEvent(e)}.bind(this),this.focusFlag=!1,this.firstEventFlag=!0,(this.onFocus||this.onBlur)&&(document.addEventListener("click",this._onClick),document.addEventListener("keyup",this._onKeyUp))}return s(e,[{key:"destroy",value:function(){document.removeEventListener("click",this._onClick),document.removeEventListener("keyup",this._onKeyUp),this._onEvent({target:document.body})}},{key:"_onEvent",value:function(e){var t,i=e.target;t=i===this.target||!(!this.target.contains(i)&&!this.target.contains(document.activeElement)),t?this.focusFlag||(this.onFocus&&this.onFocus({type:"focus",target:this.target}),this.focusFlag=!0):(this.focusFlag||this.firstEventFlag)&&(this.onBlur&&this.onBlur({type:"blur",target:this.target}),this.focusFlag=!1,this.firstEventFlag&&(this.firstEventFlag=!1))}}]),e}()},function(e,t,i){"use strict";
| /*!
| * Selectr 2.4.0
| * https://github.com/Mobius1/Selectr
| *
| * Released under the MIT license
| */var n={defaultSelected:!0,width:"auto",disabled:!1,searchable:!0,clearable:!1,sortSelected:!1,allowDeselect:!1,closeOnScroll:!1,nativeDropdown:!1,placeholder:"Select an option...",taggable:!1,tagPlaceholder:"Enter a tag..."},r=function(){};r.prototype={on:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},off:function(e,t){this._events=this._events||{},e in this._events!==!1&&this._events[e].splice(this._events[e].indexOf(t),1)},emit:function(e){if(this._events=this._events||{},e in this._events!==!1)for(var t=0;t<this._events[e].length;t++)this._events[e][t].apply(this,Array.prototype.slice.call(arguments,1))}},r.mixin=function(e){for(var t=["on","off","emit"],i=0;i<t.length;i++)"function"===typeof e?e.prototype[t[i]]=r.prototype[t[i]]:e[t[i]]=r.prototype[t[i]];return e};var s={extend:function(e,t){var i;for(i in t=t||{},e)e.hasOwnProperty(i)&&(t.hasOwnProperty(i)||(t[i]=e[i]));return t},each:function(e,t,i){if("[object Object]"===Object.prototype.toString.call(e))for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(i,n,e[n],e);else for(var r=0,s=e.length;r<s;r++)t.call(i,r,e[r],e)},createElement:function(e,t){var i,n=document,r=n.createElement(e);if(t&&"[object Object]"===Object.prototype.toString.call(t))for(i in t)if(i in r)r[i]=t[i];else if("html"===i)r.textContent=t[i];else if("text"===i){var s=n.createTextNode(t[i]);r.appendChild(s)}else r.setAttribute(i,t[i]);return r},hasClass:function(e,t){if(e)return e.classList?e.classList.contains(t):!!e.className&&!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))},addClass:function(e,t){s.hasClass(e,t)||(e.classList?e.classList.add(t):e.className=e.className.trim()+" "+t)},removeClass:function(e,t){s.hasClass(e,t)&&(e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s)"+t.split(" ").join("|")+"(\\s|$)","gi")," "))},closest:function(e,t){return e&&e!==document.body&&(t(e)?e:s.closest(e.parentNode,t))},isInt:function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},debounce:function(e,t,i){var n;return function(){var r=this,s=arguments,o=function(){n=null,i||e.apply(r,s)},a=i&&!n;clearTimeout(n),n=setTimeout(o,t),a&&e.apply(r,s)}},rect:function(e,t){var i=window,n=e.getBoundingClientRect(),r=t?i.pageXOffset:0,s=t?i.pageYOffset:0;return{bottom:n.bottom+s,height:n.height,left:n.left+r,right:n.right+r,top:n.top+s,width:n.width}},includes:function(e,t){return e.indexOf(t)>-1},truncate:function(e){while(e.firstChild)e.removeChild(e.firstChild)}};function o(e,t){return e.hasOwnProperty(t)&&(!0===e[t]||e[t].length)}function a(e,t,i){e.parentNode?e.parentNode.parentNode||t.appendChild(e.parentNode):t.appendChild(e),s.removeClass(e,"excluded"),i||(e.textContent=e.textContent+"")}var l=function(){if(this.items.length){var e=document.createDocumentFragment();if(this.config.pagination){var t=this.pages.slice(0,this.pageIndex);s.each(t,(function(t,i){s.each(i,(function(t,i){a(i,e,this.customOption)}),this)}),this)}else s.each(this.items,(function(t,i){a(i,e,this.customOption)}),this);e.childElementCount&&(s.removeClass(this.items[this.navIndex],"active"),this.navIndex=e.querySelector(".selectr-option").idx,s.addClass(this.items[this.navIndex],"active")),this.tree.appendChild(e)}},c=function(e){var t=e.target;this.container.contains(t)||!this.opened&&!s.hasClass(this.container,"notice")||this.close()},h=function(e,t){t=t||e;var i=this.customOption?this.config.renderOption(t):e.textContent,n=s.createElement("li",{class:"selectr-option",html:i,role:"treeitem","aria-selected":!1});return n.idx=e.idx,this.items.push(n),e.defaultSelected&&this.defaultSelected.push(e.idx),e.disabled&&(n.disabled=!0,s.addClass(n,"disabled")),n},d=function(){this.requiresPagination=this.config.pagination&&this.config.pagination>0,o(this.config,"width")&&(s.isInt(this.config.width)?this.width=this.config.width+"px":"auto"===this.config.width?this.width="100%":s.includes(this.config.width,"%")&&(this.width=this.config.width)),this.container=s.createElement("div",{class:"selectr-container"}),this.config.customClass&&s.addClass(this.container,this.config.customClass),this.mobileDevice?s.addClass(this.container,"selectr-mobile"):s.addClass(this.container,"selectr-desktop"),this.el.tabIndex=-1,this.config.nativeDropdown||this.mobileDevice?s.addClass(this.el,"selectr-visible"):s.addClass(this.el,"selectr-hidden"),this.selected=s.createElement("div",{class:"selectr-selected",disabled:this.disabled,tabIndex:1,"aria-expanded":!1}),this.label=s.createElement(this.el.multiple?"ul":"span",{class:"selectr-label"});var e=s.createElement("div",{class:"selectr-options-container"});if(this.tree=s.createElement("ul",{class:"selectr-options",role:"tree","aria-hidden":!0,"aria-expanded":!1}),this.notice=s.createElement("div",{class:"selectr-notice"}),this.el.setAttribute("aria-hidden",!0),this.disabled&&(this.el.disabled=!0),this.el.multiple&&(s.addClass(this.label,"selectr-tags"),s.addClass(this.container,"multiple"),this.tags=[],this.selectedValues=this.getSelectedProperties("value"),this.selectedIndexes=this.getSelectedProperties("idx")),this.selected.appendChild(this.label),this.config.clearable&&(this.selectClear=s.createElement("button",{class:"selectr-clear",type:"button"}),this.container.appendChild(this.selectClear),s.addClass(this.container,"clearable")),this.config.taggable){var t=s.createElement("li",{class:"input-tag"});this.input=s.createElement("input",{class:"selectr-tag-input",placeholder:this.config.tagPlaceholder,tagIndex:0,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"textbox",type:"search"}),t.appendChild(this.input),this.label.appendChild(t),s.addClass(this.container,"taggable"),this.tagSeperators=[","],this.config.tagSeperators&&(this.tagSeperators=this.tagSeperators.concat(this.config.tagSeperators))}this.config.searchable&&(this.input=s.createElement("input",{class:"selectr-input",tagIndex:-1,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"textbox",type:"search"}),this.inputClear=s.createElement("button",{class:"selectr-input-clear",type:"button"}),this.inputContainer=s.createElement("div",{class:"selectr-input-container"}),this.inputContainer.appendChild(this.input),this.inputContainer.appendChild(this.inputClear),e.appendChild(this.inputContainer)),e.appendChild(this.notice),e.appendChild(this.tree),this.items=[],this.options=[],this.el.options.length&&(this.options=[].slice.call(this.el.options));var i,n=!1,r=0;if(this.el.children.length&&s.each(this.el.children,(function(e,t){"OPTGROUP"===t.nodeName?(n=s.createElement("ul",{class:"selectr-optgroup",role:"group",html:"<li class='selectr-optgroup--label'>"+t.label+"</li>"}),s.each(t.children,(function(e,t){t.idx=r,n.appendChild(h.call(this,t,n)),r++}),this)):(t.idx=r,h.call(this,t),r++)}),this),this.config.data&&Array.isArray(this.config.data)){this.data=[];var a,l=!1;n=!1,r=0,s.each(this.config.data,(function(e,t){o(t,"children")?(l=s.createElement("optgroup",{label:t.text}),n=s.createElement("ul",{class:"selectr-optgroup",role:"group",html:"<li class='selectr-optgroup--label'>"+t.text+"</li>"}),s.each(t.children,(function(e,t){a=new Option(t.text,t.value,!1,t.hasOwnProperty("selected")&&!0===t.selected),a.disabled=o(t,"disabled"),this.options.push(a),l.appendChild(a),a.idx=r,n.appendChild(h.call(this,a,t)),this.data[r]=t,r++}),this)):(a=new Option(t.text,t.value,!1,t.hasOwnProperty("selected")&&!0===t.selected),a.disabled=o(t,"disabled"),this.options.push(a),a.idx=r,h.call(this,a,t),this.data[r]=t,r++)}),this)}this.setSelected(!0),this.navIndex=0;for(var c=0;c<this.items.length;c++)if(i=this.items[c],!s.hasClass(i,"disabled")){s.addClass(i,"active"),this.navIndex=c;break}this.requiresPagination&&(this.pageIndex=1,this.paginate()),this.container.appendChild(this.selected),this.container.appendChild(e),this.placeEl=s.createElement("div",{class:"selectr-placeholder"}),this.setPlaceholder(),this.selected.appendChild(this.placeEl),this.disabled&&this.disable(),this.el.parentNode.insertBefore(this.container,this.el),this.container.appendChild(this.el)},u=function(e){if(e=e||window.event,this.items.length&&this.opened&&s.includes([13,38,40],e.which)){if(e.preventDefault(),13===e.which)return!(this.config.taggable&&this.input.value.length>0)&&this.change(this.navIndex);var t,i=this.items[this.navIndex];switch(e.which){case 38:t=0,this.navIndex>0&&this.navIndex--;break;case 40:t=1,this.navIndex<this.items.length-1&&this.navIndex++}this.navigating=!0;while(s.hasClass(this.items[this.navIndex],"disabled")||s.hasClass(this.items[this.navIndex],"excluded"))if(t?this.navIndex++:this.navIndex--,this.searching){if(this.navIndex>this.tree.lastElementChild.idx){this.navIndex=this.tree.lastElementChild.idx;break}if(this.navIndex<this.tree.firstElementChild.idx){this.navIndex=this.tree.firstElementChild.idx;break}}var n=s.rect(this.items[this.navIndex]);t?(0===this.navIndex?this.tree.scrollTop=0:n.top+n.height>this.optsRect.top+this.optsRect.height&&(this.tree.scrollTop=this.tree.scrollTop+(n.top+n.height-(this.optsRect.top+this.optsRect.height))),this.navIndex===this.tree.childElementCount-1&&this.requiresPagination&&m.call(this)):0===this.navIndex?this.tree.scrollTop=0:n.top-this.optsRect.top<0&&(this.tree.scrollTop=this.tree.scrollTop+(n.top-this.optsRect.top)),i&&s.removeClass(i,"active"),s.addClass(this.items[this.navIndex],"active")}else this.navigating=!1},g=function(e){var t,i=this,n=document.createDocumentFragment(),r=this.options[e.idx],o=this.data?this.data[e.idx]:r,a=this.customSelected?this.config.renderSelection(o):r.textContent,l=s.createElement("li",{class:"selectr-tag",html:a}),c=s.createElement("button",{class:"selectr-tag-remove",type:"button"});if(l.appendChild(c),l.idx=e.idx,l.tag=r.value,this.tags.push(l),this.config.sortSelected){var h=this.tags.slice();t=function(e,t){e.replace(/(\d+)|(\D+)/g,(function(e,i,n){t.push([i||1/0,n||""])}))},h.sort((function(e,n){var r,s,o=[],a=[];!0===i.config.sortSelected?(r=e.tag,s=n.tag):"text"===i.config.sortSelected&&(r=e.textContent,s=n.textContent),t(r,o),t(s,a);while(o.length&&a.length){var l=o.shift(),c=a.shift(),h=l[0]-c[0]||l[1].localeCompare(c[1]);if(h)return h}return o.length-a.length})),s.each(h,(function(e,t){n.appendChild(t)})),this.label.textContent=""}else n.appendChild(l);this.config.taggable?this.label.insertBefore(n,this.input.parentNode):this.label.appendChild(n)},p=function(e){var t=!1;s.each(this.tags,(function(i,n){n.idx===e.idx&&(t=n)}),this),t&&(this.label.removeChild(t),this.tags.splice(this.tags.indexOf(t),1))},m=function(){var e=this.tree,t=e.scrollTop,i=e.scrollHeight,n=e.offsetHeight,r=t>=i-n;if(r&&this.pageIndex<this.pages.length){var o=document.createDocumentFragment();s.each(this.pages[this.pageIndex],(function(e,t){a(t,o,this.customOption)}),this),e.appendChild(o),this.pageIndex++,this.emit("selectr.paginate",{items:this.items.length,total:this.data.length,page:this.pageIndex,pages:this.pages.length})}},f=function(){(this.config.searchable||this.config.taggable)&&(this.input.value=null,this.searching=!1,this.config.searchable&&s.removeClass(this.inputContainer,"active"),s.hasClass(this.container,"notice")&&(s.removeClass(this.container,"notice"),s.addClass(this.container,"open"),this.input.focus()),s.each(this.items,(function(e,t){s.removeClass(t,"excluded"),this.customOption||(t.textContent=t.textContent+"")}),this))},C=function(e,t){var i=new RegExp(e,"i").exec(t);if(i){var n=i.index,r=i.index+i[0].length;return{before:t.substring(0,n),match:t.substring(n,r),after:t.substring(r)}}return null},I=function(e,t){if(t=t||{},!e)throw new Error("You must supply either a HTMLSelectElement or a CSS3 selector string.");if(this.el=e,"string"===typeof e&&(this.el=document.querySelector(e)),null===this.el)throw new Error("The element you passed to Selectr can not be found.");if("select"!==this.el.nodeName.toLowerCase())throw new Error("The element you passed to Selectr is not a HTMLSelectElement.");this.render(t)};I.prototype.render=function(e){if(!this.rendered){this.config=s.extend(n,e),this.originalType=this.el.type,this.originalIndex=this.el.tabIndex,this.defaultSelected=[],this.originalOptionCount=this.el.options.length,(this.config.multiple||this.config.taggable)&&(this.el.multiple=!0),this.disabled=o(this.config,"disabled"),this.opened=!1,this.config.taggable&&(this.config.searchable=!1),this.navigating=!1,this.mobileDevice=!1,/Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile/i.test(navigator.userAgent)&&(this.mobileDevice=!0),this.customOption=this.config.hasOwnProperty("renderOption")&&"function"===typeof this.config.renderOption,this.customSelected=this.config.hasOwnProperty("renderSelection")&&"function"===typeof this.config.renderSelection,r.mixin(this),d.call(this),this.bindEvents(),this.update(),this.optsRect=s.rect(this.tree),this.rendered=!0,this.el.multiple||(this.el.selectedIndex=this.selectedIndex);var t=this;setTimeout((function(){t.emit("selectr.init")}),20)}},I.prototype.getSelected=function(){var e=this.el.querySelectorAll("option:checked");return e},I.prototype.getSelectedProperties=function(e){var t=this.getSelected(),i=[].slice.call(t).map((function(t){return t[e]})).filter((function(e){return null!==e&&void 0!==e}));return i},I.prototype.bindEvents=function(){var e=this;if(this.events={},this.events.dismiss=c.bind(this),this.events.navigate=u.bind(this),this.events.reset=this.reset.bind(this),this.config.nativeDropdown||this.mobileDevice){this.container.addEventListener("touchstart",(function(t){t.changedTouches[0].target===e.el&&e.toggle()})),(this.config.nativeDropdown||this.mobileDevice)&&this.container.addEventListener("click",(function(t){t.preventDefault(),t.stopPropagation(),t.target===e.el&&e.toggle()}));var t=function(e,t){for(var i,n=[],r=e.slice(0),s=0;s<t.length;s++)i=r.indexOf(t[s]),i>-1?r.splice(i,1):n.push(t[s]);return[n,r]};this.el.addEventListener("change",(function(i){if(e.el.multiple){var n=e.getSelectedProperties("idx"),r=t(e.selectedIndexes,n);s.each(r[0],(function(t,i){e.select(i)}),e),s.each(r[1],(function(t,i){e.deselect(i)}),e)}else e.el.selectedIndex>-1&&e.select(e.el.selectedIndex)}))}this.config.nativeDropdown&&this.container.addEventListener("keydown",(function(t){"Enter"===t.key&&e.selected===document.activeElement&&(e.toggle(),setTimeout((function(){e.el.focus()}),200))})),this.selected.addEventListener("click",(function(t){e.disabled||e.toggle(),t.preventDefault(),t.stopPropagation()})),this.label.addEventListener("click",(function(t){s.hasClass(t.target,"selectr-tag-remove")&&e.deselect(t.target.parentNode.idx)})),this.selectClear&&this.selectClear.addEventListener("click",this.clear.bind(this)),this.tree.addEventListener("mousedown",(function(e){e.preventDefault()})),this.tree.addEventListener("click",(function(t){t.preventDefault(),t.stopPropagation();var i=s.closest(t.target,(function(e){return e&&s.hasClass(e,"selectr-option")}));i&&(s.hasClass(i,"disabled")||(s.hasClass(i,"selected")?(e.el.multiple||!e.el.multiple&&e.config.allowDeselect)&&e.deselect(i.idx):e.select(i.idx),e.opened&&!e.el.multiple&&e.close()))})),this.tree.addEventListener("mouseover",(function(t){s.hasClass(t.target,"selectr-option")&&(s.hasClass(t.target,"disabled")||(s.removeClass(e.items[e.navIndex],"active"),s.addClass(t.target,"active"),e.navIndex=[].slice.call(e.items).indexOf(t.target)))})),this.config.searchable&&(this.input.addEventListener("focus",(function(t){e.searching=!0})),this.input.addEventListener("blur",(function(t){e.searching=!1})),this.input.addEventListener("keyup",(function(t){e.search(),e.config.taggable||(this.value.length?s.addClass(this.parentNode,"active"):s.removeClass(this.parentNode,"active"))})),this.inputClear.addEventListener("click",(function(t){e.input.value=null,f.call(e),e.tree.childElementCount||l.call(e)}))),this.config.taggable&&this.input.addEventListener("keyup",(function(t){if(e.search(),e.config.taggable&&this.value.length){var i=this.value.trim();if(13===t.which||s.includes(e.tagSeperators,t.key)){s.each(e.tagSeperators,(function(e,t){i=i.replace(t,"")}));var n=e.add({value:i,text:i,selected:!0},!0);n?(e.close(),f.call(e)):(this.value="",e.setMessage("That tag is already in use."))}}})),this.update=s.debounce((function(){e.opened&&e.config.closeOnScroll&&e.close(),e.width&&(e.container.style.width=e.width),e.invert()}),50),this.requiresPagination&&(this.paginateItems=s.debounce((function(){m.call(this)}),50),this.tree.addEventListener("scroll",this.paginateItems.bind(this))),document.addEventListener("click",this.events.dismiss),window.addEventListener("keydown",this.events.navigate),window.addEventListener("resize",this.update),window.addEventListener("scroll",this.update),this.el.form&&this.el.form.addEventListener("reset",this.events.reset)},I.prototype.setSelected=function(e){if(this.config.data||this.el.multiple||!this.el.options.length||(0===this.el.selectedIndex&&(this.el.options[0].defaultSelected||this.config.defaultSelected||(this.el.selectedIndex=-1)),this.selectedIndex=this.el.selectedIndex,this.selectedIndex>-1&&this.select(this.selectedIndex)),this.config.multiple&&"select-one"===this.originalType&&!this.config.data&&this.el.options[0].selected&&!this.el.options[0].defaultSelected&&(this.el.options[0].selected=!1),s.each(this.options,(function(e,t){t.selected&&t.defaultSelected&&this.select(t.idx)}),this),this.config.selectedValue&&this.setValue(this.config.selectedValue),this.config.data){!this.el.multiple&&this.config.defaultSelected&&this.el.selectedIndex<0&&this.select(0);var t=0;s.each(this.config.data,(function(e,i){o(i,"children")?s.each(i.children,(function(e,i){i.hasOwnProperty("selected")&&!0===i.selected&&this.select(t),t++}),this):(i.hasOwnProperty("selected")&&!0===i.selected&&this.select(t),t++)}),this)}},I.prototype.destroy=function(){this.rendered&&(this.emit("selectr.destroy"),"select-one"===this.originalType&&(this.el.multiple=!1),this.config.data&&(this.el.textContent=""),s.removeClass(this.el,"selectr-hidden"),this.el.form&&s.off(this.el.form,"reset",this.events.reset),s.off(document,"click",this.events.dismiss),s.off(document,"keydown",this.events.navigate),s.off(window,"resize",this.update),s.off(window,"scroll",this.update),this.container.parentNode.replaceChild(this.el,this.container),this.rendered=!1)},I.prototype.change=function(e){var t=this.items[e],i=this.options[e];i.disabled||(i.selected&&s.hasClass(t,"selected")?this.deselect(e):this.select(e),this.opened&&!this.el.multiple&&this.close())},I.prototype.select=function(e){var t=this.items[e],i=[].slice.call(this.el.options),n=this.options[e];if(this.el.multiple){if(s.includes(this.selectedIndexes,e))return!1;if(this.config.maxSelections&&this.tags.length===this.config.maxSelections)return this.setMessage("A maximum of "+this.config.maxSelections+" items can be selected.",!0),!1;this.selectedValues.push(n.value),this.selectedIndexes.push(e),g.call(this,t)}else{var r=this.data?this.data[e]:n;this.label.textContent=this.customSelected?this.config.renderSelection(r):n.textContent,this.selectedValue=n.value,this.selectedIndex=e,s.each(this.options,(function(t,i){var n=this.items[t];t!==e&&(n&&s.removeClass(n,"selected"),i.selected=!1,i.removeAttribute("selected"))}),this)}s.includes(i,n)||this.el.add(n),t.setAttribute("aria-selected",!0),s.addClass(t,"selected"),s.addClass(this.container,"has-selected"),n.selected=!0,n.setAttribute("selected",""),this.emit("selectr.change",n),this.emit("selectr.select",n)},I.prototype.deselect=function(e,t){var i=this.items[e],n=this.options[e];if(this.el.multiple){var r=this.selectedIndexes.indexOf(e);this.selectedIndexes.splice(r,1);var o=this.selectedValues.indexOf(n.value);this.selectedValues.splice(o,1),p.call(this,i),this.tags.length||s.removeClass(this.container,"has-selected")}else{if(!t&&!this.config.clearable&&!this.config.allowDeselect)return!1;this.label.textContent="",this.selectedValue=null,this.el.selectedIndex=this.selectedIndex=-1,s.removeClass(this.container,"has-selected")}this.items[e].setAttribute("aria-selected",!1),s.removeClass(this.items[e],"selected"),n.selected=!1,n.removeAttribute("selected"),this.emit("selectr.change",null),this.emit("selectr.deselect",n)},I.prototype.setValue=function(e){var t=Array.isArray(e);if(t||(e=e.toString().trim()),!this.el.multiple&&t)return!1;s.each(this.options,(function(i,n){(t&&s.includes(e.toString(),n.value)||n.value===e)&&this.change(n.idx)}),this)},I.prototype.getValue=function(e,t){var i;if(this.el.multiple)e?this.selectedIndexes.length&&(i={},i.values=[],s.each(this.selectedIndexes,(function(e,t){var n=this.options[t];i.values[e]={value:n.value,text:n.textContent}}),this)):i=this.selectedValues.slice();else if(e){var n=this.options[this.selectedIndex];i={value:n.value,text:n.textContent}}else i=this.selectedValue;return e&&t&&(i=JSON.stringify(i)),i},I.prototype.add=function(e,t){if(e){if(this.data=this.data||[],this.items=this.items||[],this.options=this.options||[],Array.isArray(e))s.each(e,(function(e,i){this.add(i,t)}),this);else if("[object Object]"===Object.prototype.toString.call(e)){if(t){var i=!1;if(s.each(this.options,(function(t,n){n.value.toLowerCase()===e.value.toLowerCase()&&(i=!0)})),i)return!1}var n=s.createElement("option",e);return this.data.push(e),this.options.push(n),n.idx=this.options.length>0?this.options.length-1:0,h.call(this,n),e.selected&&this.select(n.idx),n}return this.setPlaceholder(),this.config.pagination&&this.paginate(),!0}},I.prototype.remove=function(e){var t,i=[];(Array.isArray(e)?s.each(e,(function(t,n){s.isInt(n)?i.push(this.getOptionByIndex(n)):"string"===typeof e&&i.push(this.getOptionByValue(n))}),this):s.isInt(e)?i.push(this.getOptionByIndex(e)):"string"===typeof e&&i.push(this.getOptionByValue(e)),i.length)&&(s.each(i,(function(e,i){t=i.idx,this.el.remove(i),this.options.splice(t,1);var n=this.items[t].parentNode;n&&n.removeChild(this.items[t]),this.items.splice(t,1),s.each(this.options,(function(e,t){t.idx=e,this.items[e].idx=e}),this)}),this),this.setPlaceholder(),this.config.pagination&&this.paginate())},I.prototype.removeAll=function(){this.clear(!0),s.each(this.el.options,(function(e,t){this.el.remove(t)}),this),s.truncate(this.tree),this.items=[],this.options=[],this.data=[],this.navIndex=0,this.requiresPagination&&(this.requiresPagination=!1,this.pageIndex=1,this.pages=[]),this.setPlaceholder()},I.prototype.search=function(e){if(!this.navigating){e=e||this.input.value;var t=document.createDocumentFragment();if(this.removeMessage(),s.truncate(this.tree),e.length>1)if(s.each(this.options,(function(i,n){var r=this.items[n.idx],o=s.includes(n.textContent.toLowerCase(),e.toLowerCase());if(o&&!n.disabled){if(a(r,t,this.customOption),s.removeClass(r,"excluded"),!this.customOption){r.textContent="";var l=C(e,n.textContent);if(l){r.appendChild(document.createTextNode(l.before));var c=document.createElement("span");c.className="selectr-match",c.appendChild(document.createTextNode(l.match)),r.appendChild(c),r.appendChild(document.createTextNode(l.after))}}}else s.addClass(r,"excluded")}),this),t.childElementCount){var i=this.items[this.navIndex],n=t.firstElementChild;s.removeClass(i,"active"),this.navIndex=n.idx,s.addClass(n,"active")}else this.config.taggable||this.setMessage("no results.");else l.call(this);this.tree.appendChild(t)}},I.prototype.toggle=function(){this.disabled||(this.opened?this.close():this.open())},I.prototype.open=function(){var e=this;return!!this.options.length&&(this.opened||this.emit("selectr.open"),this.opened=!0,this.mobileDevice||this.config.nativeDropdown?(s.addClass(this.container,"native-open"),void(this.config.data&&s.each(this.options,(function(e,t){this.el.add(t)}),this))):(s.addClass(this.container,"open"),l.call(this),this.invert(),this.tree.scrollTop=0,s.removeClass(this.container,"notice"),this.selected.setAttribute("aria-expanded",!0),this.tree.setAttribute("aria-hidden",!1),this.tree.setAttribute("aria-expanded",!0),void(this.config.searchable&&!this.config.taggable&&setTimeout((function(){e.input.focus(),e.input.tabIndex=0}),10))))},I.prototype.close=function(){if(this.opened&&this.emit("selectr.close"),this.opened=!1,this.mobileDevice||this.config.nativeDropdown)s.removeClass(this.container,"native-open");else{var e=s.hasClass(this.container,"notice");this.config.searchable&&!e&&(this.input.blur(),this.input.tabIndex=-1,this.searching=!1),e&&(s.removeClass(this.container,"notice"),this.notice.textContent=""),s.removeClass(this.container,"open"),s.removeClass(this.container,"native-open"),this.selected.setAttribute("aria-expanded",!1),this.tree.setAttribute("aria-hidden",!0),this.tree.setAttribute("aria-expanded",!1),s.truncate(this.tree),f.call(this)}},I.prototype.enable=function(){this.disabled=!1,this.el.disabled=!1,this.selected.tabIndex=this.originalIndex,this.el.multiple&&s.each(this.tags,(function(e,t){t.lastElementChild.tabIndex=0})),s.removeClass(this.container,"selectr-disabled")},I.prototype.disable=function(e){e||(this.el.disabled=!0),this.selected.tabIndex=-1,this.el.multiple&&s.each(this.tags,(function(e,t){t.lastElementChild.tabIndex=-1})),this.disabled=!0,s.addClass(this.container,"selectr-disabled")},I.prototype.reset=function(){this.disabled||(this.clear(),this.setSelected(!0),s.each(this.defaultSelected,(function(e,t){this.select(t)}),this),this.emit("selectr.reset"))},I.prototype.clear=function(e){if(this.el.multiple){if(this.selectedIndexes.length){var t=this.selectedIndexes.slice();s.each(t,(function(e,t){this.deselect(t)}),this)}}else this.selectedIndex>-1&&this.deselect(this.selectedIndex,e);this.emit("selectr.clear")},I.prototype.serialise=function(e){var t=[];return s.each(this.options,(function(e,i){var n={value:i.value,text:i.textContent};i.selected&&(n.selected=!0),i.disabled&&(n.disabled=!0),t[e]=n})),e?JSON.stringify(t):t},I.prototype.serialize=function(e){return this.serialise(e)},I.prototype.setPlaceholder=function(e){e=e||this.config.placeholder||this.el.getAttribute("placeholder"),this.options.length||(e="No options available"),this.placeEl.textContent=e},I.prototype.paginate=function(){if(this.items.length){var e=this;return this.pages=this.items.map((function(t,i){return i%e.config.pagination===0?e.items.slice(i,i+e.config.pagination):null})).filter((function(e){return e})),this.pages}},I.prototype.setMessage=function(e,t){t&&this.close(),s.addClass(this.container,"notice"),this.notice.textContent=e},I.prototype.removeMessage=function(){s.removeClass(this.container,"notice"),this.notice.textContent=""},I.prototype.invert=function(){var e=s.rect(this.selected),t=this.tree.parentNode.offsetHeight,i=window.innerHeight,n=e.top+e.height+t>i;n?(s.addClass(this.container,"inverted"),this.isInverted=!0):(s.removeClass(this.container,"inverted"),this.isInverted=!1),this.optsRect=s.rect(this.tree)},I.prototype.getOptionByIndex=function(e){return this.options[e]},I.prototype.getOptionByValue=function(e){for(var t=!1,i=0,n=this.options.length;i<n;i++)if(this.options[i].value.trim()===e.toString().trim()){t=this.options[i];break}return t},e.exports=I},function(e,t){e.exports=function e(t,i){"use strict";var n,r,s=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,o=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,l=/^0x[0-9a-f]+$/i,c=/^0/,h=function(t){return e.insensitive&&(""+t).toLowerCase()||""+t},d=h(t).replace(o,"")||"",u=h(i).replace(o,"")||"",g=d.replace(s,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=u.replace(s,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=parseInt(d.match(l),16)||1!==g.length&&d.match(a)&&Date.parse(d),f=parseInt(u.match(l),16)||m&&u.match(a)&&Date.parse(u)||null;if(f){if(m<f)return-1;if(m>f)return 1}for(var C=0,I=Math.max(g.length,p.length);C<I;C++){if(n=!(g[C]||"").match(c)&&parseFloat(g[C])||g[C]||0,r=!(p[C]||"").match(c)&&parseFloat(p[C])||p[C]||0,isNaN(n)!==isNaN(r))return isNaN(n)?1:-1;if(typeof n!==typeof r&&(n+="",r+=""),n<r)return-1;if(n>r)return 1}return 0}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=i(0);function r(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=s(e),l={},c=e.getBoundingClientRect(),h=t.getBoundingClientRect(),d=document.createElement("div");function u(){if(d&&d.parentNode){for(var t in d.parentNode.removeChild(d),l)if(o(l,t)){var r=l[t];r&&Object(n["removeEventListener"])(a,t,r),delete l[t]}"function"===typeof i&&i(e)}}function g(e){return e!==d&&!Object(n["isChildOf"])(e,d)}function p(e){g(e.target)&&u()}if(d.className="jsoneditor-anchor",d.style.position="absolute",d.style.left=c.left-h.left+"px",d.style.top=c.top-h.top+"px",d.style.width=c.width-2+"px",d.style.height=c.height-2+"px",d.style.boxSizing="border-box",t.appendChild(d),l.mousedown=Object(n["addEventListener"])(a,"mousedown",p),l.mousewheel=Object(n["addEventListener"])(a,"mousewheel",p),r){var m=null;d.onmouseover=function(){clearTimeout(m),m=null},d.onmouseout=function(){m||(m=setTimeout(u,200))}}return d.destroy=u,d}function s(e){return"function"===typeof e.getRootNode?e.getRootNode():window}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,i){var n;if(window.Picker)n=window.Picker;else try{n=i(41)}catch(r){}e.exports=n},function(e,t,i){var n,r,s;(function(i,o){"use strict";r=[],n=o,s="function"===typeof n?n.apply(t,r):n,void 0===s||(e.exports=s)})(0,(function(){"use strict";function e(e){return"object"===typeof Node?e instanceof Node:e&&"object"===typeof e&&"number"===typeof e.nodeType}function t(e){return"string"===typeof e}function i(){var e=[];return{watch:e.push.bind(e),trigger:function(t,i){for(var n=!0,r={detail:i,preventDefault:function(){n=!1}},s=0;s<e.length;s++)e[s](t,r);return n}}}function n(e){return"none"===window.getComputedStyle(e).display}function r(e){this.elem=e}function s(e,t){return r.make(e("parent")).clazz("pico-overlay").clazz(e("overlayClass","")).stylize({display:"none",position:"fixed",top:"0px",left:"0px",height:"100%",width:"100%",zIndex:1e4}).stylize(e("overlayStyles",{opacity:.5,background:"#000"})).onClick((function(){e("overlayClose",!0)&&t()}))}r.make=function(e,t){"string"===typeof e&&(e=document.querySelector(e));var i=document.createElement(t||"div");return(e||document.body).appendChild(i),new r(i)},r.prototype={child:function(e){return r.make(this.elem,e)},stylize:function(e){for(var t in e=e||{},"undefined"!==typeof e.opacity&&(e.filter="alpha(opacity="+100*e.opacity+")"),e)e.hasOwnProperty(t)&&(this.elem.style[t]=e[t]);return this},clazz:function(e){return this.elem.className+=" "+e,this},html:function(t){return e(t)?this.elem.appendChild(t):this.elem.innerHTML=t,this},onClick:function(e){return this.elem.addEventListener("click",e),this},destroy:function(){this.elem.parentNode.removeChild(this.elem)},hide:function(){this.elem.style.display="none"},show:function(){this.elem.style.display="block"},attr:function(e,t){return void 0!==t&&this.elem.setAttribute(e,t),this},anyAncestor:function(e){var t=this.elem;while(t){if(e(new r(t)))return!0;t=t.parentNode}return!1},isVisible:function(){return!n(this.elem)}};var o=1;function a(e,t){var i=e("width","auto");"number"===typeof i&&(i+="px");var n=e("modalId","pico-"+o++),s=r.make(e("parent")).clazz("pico-content").clazz(e("modalClass","")).stylize({display:"none",position:"fixed",zIndex:10001,left:"50%",top:"38.1966%",maxHeight:"90%",boxSizing:"border-box",width:i,"-ms-transform":"translate(-50%,-38.1966%)","-moz-transform":"translate(-50%,-38.1966%)","-webkit-transform":"translate(-50%,-38.1966%)","-o-transform":"translate(-50%,-38.1966%)",transform:"translate(-50%,-38.1966%)"}).stylize(e("modalStyles",{overflow:"auto",backgroundColor:"white",padding:"20px",borderRadius:"5px"})).html(e("content")).attr("id",n).attr("role","dialog").attr("aria-labelledby",e("ariaLabelledBy")).attr("aria-describedby",e("ariaDescribedBy",n)).onClick((function(e){var i=new r(e.target).anyAncestor((function(e){return/\bpico-close\b/.test(e.elem.className)}));i&&t()}));return s}function l(e,t){if(t("closeButton",!0))return e.child("button").html(t("closeHtml","×")).clazz("pico-close").clazz(t("closeClass","")).stylize(t("closeStyles",{borderRadius:"2px",border:0,padding:0,cursor:"pointer",height:"15px",width:"15px",position:"absolute",top:"5px",right:"5px",fontSize:"16px",textAlign:"center",lineHeight:"15px",background:"#CCC"})).attr("aria-label",t("close-label","Close"))}function c(e){return function(){return e().elem}}var h=i(),d=i();function u(e,t){function i(e,t){var i=e.msMatchesSelector||e.webkitMatchesSelector||e.matches;return i.call(e,t)}function r(e){return!(n(e)||i(e,":disabled")||e.hasAttribute("contenteditable"))&&(e.hasAttribute("tabindex")||i(e,"input,select,textarea,button,a[href],area[href],iframe"))}function s(e){for(var t=e.getElementsByTagName("*"),i=0;i<t.length;i++)if(r(t[i]))return t[i]}function o(e){for(var t=e.getElementsByTagName("*"),i=t.length;i--;)if(r(t[i]))return t[i]}var a;e.beforeShow((function(){a=document.activeElement})),e.afterShow((function(){if(t()){var i=s(e.modalElem());i&&i.focus()}})),e.afterClose((function(){t()&&a&&a.focus(),a=null})),d.watch((function(i){if(t()&&e.isVisible()){var n=s(e.modalElem()),r=o(e.modalElem()),a=i.shiftKey?n:r;a===document.activeElement&&((i.shiftKey?r:n).focus(),i.preventDefault())}}))}function g(e,t){var i,n=new r(document.body);e.beforeShow((function(){i=n.elem.style.overflow,t()&&n.stylize({overflow:"hidden"})})),e.afterClose((function(){n.stylize({overflow:i})}))}return document.documentElement.addEventListener("keydown",(function(e){var t=e.which||e.keyCode;27===t?h.trigger():9===t&&d.trigger(e)})),function(n){(t(n)||e(n))&&(n={content:n});var r=i(),o=i(),d=i(),p=i(),m=i();function f(e,t){var i=n[e];return"function"===typeof i&&(i=i(t)),void 0===i?t:i}var C,I,A=x.bind(window,"modal"),v=x.bind(window,"overlay"),b=x.bind(window,"close");function y(e){v().hide(),A().hide(),m.trigger(C,e)}function w(e){p.trigger(C,e)&&y(e)}function S(e){return function(){return e.apply(this,arguments),C}}function x(e,t){if(!I){var i=a(f,w);I={modal:i,overlay:s(f,w),close:l(i,f)},r.trigger(C,t)}return I[e]}return C={modalElem:c(A),closeElem:c(b),overlayElem:c(v),buildDom:S(x.bind(null,null)),isVisible:function(){return!!(I&&A&&A().isVisible())},show:function(e){return o.trigger(C,e)&&(v().show(),b(),A().show(),d.trigger(C,e)),this},close:S(w),forceClose:S(y),destroy:function(){A().destroy(),v().destroy(),v=A=b=void 0},options:function(e){Object.keys(e).map((function(t){n[t]=e[t]}))},afterCreate:S(r.watch),beforeShow:S(o.watch),afterShow:S(d.watch),beforeClose:S(p.watch),afterClose:S(m.watch)},u(C,f.bind(null,"focus",!0)),g(C,f.bind(null,"bodyOverflow",!0)),h.watch((function(){f("escCloses",!0)&&C.isVisible()&&C.close()})),C}}))},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,i){return t&&r(e.prototype,t),i&&r(e,i),e}i.d(t,"a",(function(){return o}));var o=function(){function e(t){n(this,e),this.errorTableVisible=t.errorTableVisible,this.onToggleVisibility=t.onToggleVisibility,this.onFocusLine=t.onFocusLine||function(){},this.onChangeHeight=t.onChangeHeight,this.dom={};var i=document.createElement("div");i.className="jsoneditor-validation-errors-container",this.dom.validationErrorsContainer=i;var r=document.createElement("div");r.style.display="none",r.className="jsoneditor-additional-errors fadein",r.textContent="Scroll for more ▿",this.dom.additionalErrorsIndication=r,i.appendChild(r);var s=document.createElement("span");s.className="jsoneditor-validation-error-icon",s.style.display="none",this.dom.validationErrorIcon=s;var o=document.createElement("span");o.className="jsoneditor-validation-error-count",o.style.display="none",this.dom.validationErrorCount=o,this.dom.parseErrorIndication=document.createElement("span"),this.dom.parseErrorIndication.className="jsoneditor-parse-error-icon",this.dom.parseErrorIndication.style.display="none"}return s(e,[{key:"getErrorTable",value:function(){return this.dom.validationErrorsContainer}},{key:"getErrorCounter",value:function(){return this.dom.validationErrorCount}},{key:"getWarningIcon",value:function(){return this.dom.validationErrorIcon}},{key:"getErrorIcon",value:function(){return this.dom.parseErrorIndication}},{key:"toggleTableVisibility",value:function(){this.errorTableVisible=!this.errorTableVisible,this.onToggleVisibility(this.errorTableVisible)}},{key:"setErrors",value:function(e,t){var i=this;if(this.dom.validationErrors&&(this.dom.validationErrors.parentNode.removeChild(this.dom.validationErrors),this.dom.validationErrors=null,this.dom.additionalErrorsIndication.style.display="none"),this.errorTableVisible&&e.length>0){var n=document.createElement("div");n.className="jsoneditor-validation-errors";var r=document.createElement("table");r.className="jsoneditor-text-errors",n.appendChild(r);var s=document.createElement("tbody");r.appendChild(s),e.forEach((function(e){var n;if(isNaN(e.line)){if(e.dataPath){var r=t.find((function(t){return t.path===e.dataPath}));r&&(n=r.line+1)}}else n=e.line;var o=document.createElement("tr");o.className=isNaN(n)?"":"jump-to-line","error"===e.type?o.className+=" parse-error":o.className+=" validation-error";var a=document.createElement("td"),l=document.createElement("button");l.className="jsoneditor-schema-error",a.appendChild(l),o.appendChild(a);var c=document.createElement("td");if(c.style="white-space: nowrap;",c.textContent=isNaN(n)?"":"Ln "+n,o.appendChild(c),"string"===typeof e){var h=document.createElement("td");h.colSpan=2;var d=document.createElement("pre");d.appendChild(document.createTextNode(e)),h.appendChild(d),o.appendChild(h)}else{var u=document.createElement("td");u.appendChild(document.createTextNode(e.dataPath||"")),o.appendChild(u);var g=document.createElement("td"),p=document.createElement("pre");p.appendChild(document.createTextNode(e.message)),g.appendChild(p),o.appendChild(g)}o.onclick=function(){i.onFocusLine(n)},s.appendChild(o)})),this.dom.validationErrors=n,this.dom.validationErrorsContainer.appendChild(n),this.dom.additionalErrorsIndication.title=e.length+" errors total",this.dom.validationErrorsContainer.clientHeight<this.dom.validationErrorsContainer.scrollHeight?(this.dom.additionalErrorsIndication.style.display="block",this.dom.validationErrorsContainer.onscroll=function(){i.dom.additionalErrorsIndication.style.display=i.dom.validationErrorsContainer.clientHeight>0&&0===i.dom.validationErrorsContainer.scrollTop?"block":"none"}):this.dom.validationErrorsContainer.onscroll=void 0;var o=this.dom.validationErrorsContainer.clientHeight+(this.dom.statusBar?this.dom.statusBar.clientHeight:0);this.onChangeHeight(o)}else this.onChangeHeight(0);var a=e.filter((function(e){return"error"!==e.type})).length;a>0?(this.dom.validationErrorCount.style.display="inline",this.dom.validationErrorCount.innerText=a,this.dom.validationErrorCount.onclick=this.toggleTableVisibility.bind(this),this.dom.validationErrorIcon.style.display="inline",this.dom.validationErrorIcon.title=a+" schema validation error(s) found",this.dom.validationErrorIcon.onclick=this.toggleTableVisibility.bind(this)):(this.dom.validationErrorCount.style.display="none",this.dom.validationErrorIcon.style.display="none");var l=e.some((function(e){return"error"===e.type}));if(l){var c=e[0].line;this.dom.parseErrorIndication.style.display="block",this.dom.parseErrorIndication.title=isNaN(c)?"parse error - check that the json is valid":"parse error on line "+c,this.dom.parseErrorIndication.onclick=this.toggleTableVisibility.bind(this)}else this.dom.parseErrorIndication.style.display="none"}}]),e}()},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,i){"use strict";var n=i(46),r=i(18),s=i(7),o=i(25),a=i(48);function l(e,t,i){var n=this._refs[i];if("string"==typeof n){if(!this._refs[n])return l.call(this,e,t,n);n=this._refs[n]}if(n=n||this._schemas[i],n instanceof o)return p(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var r,s,a,h=c.call(this,t,i);return h&&(r=h.schema,t=h.root,a=h.baseId),r instanceof o?s=r.validate||e.call(this,r.schema,t,void 0,a):void 0!==r&&(s=p(r,this._opts.inlineRefs)?r:e.call(this,r,t,void 0,a)),s}function c(e,t){var i=n.parse(t),r=I(i),s=C(this._getId(e.schema));if(0===Object.keys(e.schema).length||r!==s){var a=v(r),l=this._refs[a];if("string"==typeof l)return h.call(this,e,l,i);if(l instanceof o)l.validate||this._compile(l),e=l;else{if(l=this._schemas[a],!(l instanceof o))return;if(l.validate||this._compile(l),a==v(t))return{schema:l,root:e,baseId:s};e=l}if(!e.schema)return;s=C(this._getId(e.schema))}return u.call(this,i,s,e.schema,e)}function h(e,t,i){var n=c.call(this,e,t);if(n){var r=n.schema,s=n.baseId;e=n.root;var o=this._getId(r);return o&&(s=b(s,o)),u.call(this,i,s,r,e)}}e.exports=l,l.normalizeId=v,l.fullPath=C,l.url=b,l.ids=y,l.inlineRef=p,l.schema=c;var d=s.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function u(e,t,i,n){if(e.fragment=e.fragment||"","/"==e.fragment.slice(0,1)){for(var r=e.fragment.split("/"),o=1;o<r.length;o++){var a=r[o];if(a){if(a=s.unescapeFragment(a),i=i[a],void 0===i)break;var l;if(!d[a]&&(l=this._getId(i),l&&(t=b(t,l)),i.$ref)){var h=b(t,i.$ref),u=c.call(this,n,h);u&&(i=u.schema,n=u.root,t=u.baseId)}}}return void 0!==i&&i!==n.schema?{schema:i,root:n,baseId:t}:void 0}}var g=s.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function p(e,t){return!1!==t&&(void 0===t||!0===t?m(e):t?f(e)<=t:void 0)}function m(e){var t;if(Array.isArray(e)){for(var i=0;i<e.length;i++)if(t=e[i],"object"==typeof t&&!m(t))return!1}else for(var n in e){if("$ref"==n)return!1;if(t=e[n],"object"==typeof t&&!m(t))return!1}return!0}function f(e){var t,i=0;if(Array.isArray(e)){for(var n=0;n<e.length;n++)if(t=e[n],"object"==typeof t&&(i+=f(t)),i==1/0)return 1/0}else for(var r in e){if("$ref"==r)return 1/0;if(g[r])i++;else if(t=e[r],"object"==typeof t&&(i+=f(t)+1),i==1/0)return 1/0}return i}function C(e,t){!1!==t&&(e=v(e));var i=n.parse(e);return I(i)}function I(e){return n.serialize(e).split("#")[0]+"#"}var A=/#\/?$/;function v(e){return e?e.replace(A,""):""}function b(e,t){return t=v(t),n.resolve(e,t)}function y(e){var t=v(this._getId(e)),i={"":t},o={"":C(t,!1)},l={},c=this;return a(e,{allKeys:!0},(function(e,t,a,h,d,u,g){if(""!==t){var p=c._getId(e),m=i[h],f=o[h]+"/"+d;if(void 0!==g&&(f+="/"+("number"==typeof g?g:s.escapeFragment(g))),"string"==typeof p){p=m=v(m?n.resolve(m,p):p);var C=c._refs[p];if("string"==typeof C&&(C=c._refs[C]),C&&C.schema){if(!r(e,C.schema))throw new Error('id "'+p+'" resolves to more than one schema')}else if(p!=v(f))if("#"==p[0]){if(l[p]&&!r(e,l[p]))throw new Error('id "'+p+'" resolves to more than one schema');l[p]=e}else c._refs[p]=f}i[t]=m,o[t]=f}})),l}},function(e,t,i){"use strict";e.exports=function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var n,r,s;if(Array.isArray(t)){if(n=t.length,n!=i.length)return!1;for(r=n;0!==r--;)if(!e(t[r],i[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if(s=Object.keys(t),n=s.length,n!==Object.keys(i).length)return!1;for(r=n;0!==r--;)if(!Object.prototype.hasOwnProperty.call(i,s[r]))return!1;for(r=n;0!==r--;){var o=s[r];if(!e(t[o],i[o]))return!1}return!0}return t!==t&&i!==i}},function(e,t,i){"use strict";var n=i(17);function r(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0}function s(e,t,i){this.message=i||s.message(e,t),this.missingRef=n.url(e,t),this.missingSchema=n.normalizeId(n.fullPath(this.missingRef))}function o(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}e.exports={Validation:o(r),MissingRef:o(s)},s.message=function(e,t){return"can't resolve reference "+t+" from id "+e}},function(e,t,i){var n;if(window.ace)n=window.ace;else try{n=i(37),i(38),i(39);var r=i(40);n.config.setModuleUrl("ace/mode/json_worker",r)}catch(s){}e.exports=n},function(e,t,i){"use strict";i.r(t),i.d(t,"textModeMixins",(function(){return v}));var n=i(20),r=i.n(n),s=i(1),o=i(8),a=i(15),l=i(0);function c(e,t){if(!t)return Promise.resolve([]);try{var i=t(e),n=Object(l["isPromise"])(i)?i:Promise.resolve(i);return n.then((function(e){return Array.isArray(e)?e.filter((function(e){var t=Object(l["isValidValidationError"])(e);return t})).map((function(e){return{dataPath:Object(l["stringifyPath"])(e.path),message:e.message,type:"customValidation"}})):[]}))}catch(r){return Promise.reject(r)}}var h=i(5),d=i(6),u=i(9),g=i(2),p=i(35),m=i(4);function f(e){return f="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}var C={},I="ace/theme/jsoneditor";function A(){try{this.format()}catch(e){}}C.create=function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"undefined"===typeof i.statusBar&&(i.statusBar=!0),i.mainMenuBar=!1!==i.mainMenuBar,i.enableSort=!1!==i.enableSort,i.enableTransform=!1!==i.enableTransform,i.createQuery=i.createQuery||m["a"],i.executeQuery=i.executeQuery||m["b"],this.options=i,"number"===typeof i.indentation?this.indentation=Number(i.indentation):this.indentation=2,Object(s["b"])(this.options.languages),Object(s["a"])(this.options.language);var n=i.ace?i.ace:r.a;this.mode="code"===i.mode?"code":"text","code"===this.mode&&"undefined"===typeof n&&(this.mode="text"),this.theme=i.theme||I,this.theme===I&&n&&Object(p["tryRequireThemeJsonEditor"])(),i.onTextSelectionChange&&this.onTextSelectionChange(i.onTextSelectionChange);var c=this;this.container=e,this.dom={},this.aceEditor=void 0,this.textarea=void 0,this.validateSchema=null,this.annotations=[],this.lastSchemaErrors=void 0,this._debouncedValidate=Object(l["debounce"])(this.validate.bind(this),this.DEBOUNCE_INTERVAL),this.width=e.clientWidth,this.height=e.clientHeight,this.frame=document.createElement("div"),this.frame.className="jsoneditor jsoneditor-mode-"+this.options.mode,this.frame.onclick=function(e){e.preventDefault()},this.frame.onkeydown=function(e){c._onKeyDown(e)};var h={target:this.frame,onFocus:this.options.onFocus||null,onBlur:this.options.onBlur||null};if(this.frameFocusTracker=new u["a"](h),this.content=document.createElement("div"),this.content.className="jsoneditor-outer",this.options.mainMenuBar){Object(l["addClassName"])(this.content,"has-main-menu-bar"),this.menu=document.createElement("div"),this.menu.className="jsoneditor-menu",this.frame.appendChild(this.menu);var d=document.createElement("button");d.type="button",d.className="jsoneditor-format",d.title=Object(s["c"])("formatTitle"),this.menu.appendChild(d),d.onclick=function(){try{c.format(),c._onChange()}catch(e){c._onError(e)}};var g=document.createElement("button");if(g.type="button",g.className="jsoneditor-compact",g.title=Object(s["c"])("compactTitle"),this.menu.appendChild(g),g.onclick=function(){try{c.compact(),c._onChange()}catch(e){c._onError(e)}},this.options.enableSort){var C=document.createElement("button");C.type="button",C.className="jsoneditor-sort",C.title=Object(s["c"])("sortTitleShort"),C.onclick=function(){c._showSortModal()},this.menu.appendChild(C)}if(this.options.enableTransform){var A=document.createElement("button");A.type="button",A.title=Object(s["c"])("transformTitleShort"),A.className="jsoneditor-transform",A.onclick=function(){c._showTransformModal()},this.menu.appendChild(A)}var v=document.createElement("button");if(v.type="button",v.className="jsoneditor-repair",v.title=Object(s["c"])("repairTitle"),this.menu.appendChild(v),v.onclick=function(){try{c.repair(),c._onChange()}catch(e){c._onError(e)}},"code"===this.mode){var b=document.createElement("button");b.type="button",b.className="jsoneditor-undo jsoneditor-separator",b.title=Object(s["c"])("undo"),b.onclick=function(){t.aceEditor.getSession().getUndoManager().undo()},this.menu.appendChild(b),this.dom.undo=b;var y=document.createElement("button");y.type="button",y.className="jsoneditor-redo",y.title=Object(s["c"])("redo"),y.onclick=function(){t.aceEditor.getSession().getUndoManager().redo()},this.menu.appendChild(y),this.dom.redo=y}if(this.options&&this.options.modes&&this.options.modes.length&&(this.modeSwitcher=new o["a"](this.menu,this.options.modes,this.options.mode,(function(e){c.setMode(e),c.modeSwitcher.focus()}))),"code"===this.mode){var w=document.createElement("a");w.appendChild(document.createTextNode("powered by ace")),w.href="https://ace.c9.io/",w.target="_blank",w.className="jsoneditor-poweredBy",w.onclick=function(){window.open(w.href,w.target)},this.menu.appendChild(w)}}var S={},x=this.options.onEditable&&f("function"===this.options.onEditable)&&!this.options.onEditable(S);if(this.frame.appendChild(this.content),this.container.appendChild(this.frame),"code"===this.mode){this.editorDom=document.createElement("div"),this.editorDom.style.height="100%",this.editorDom.style.width="100%",this.content.appendChild(this.editorDom);var k=n.edit(this.editorDom),R=k.getSession();k.$blockScrolling=1/0,k.setTheme(this.theme),k.setOptions({readOnly:x}),k.setShowPrintMargin(!1),k.setFontSize("13px"),R.setMode("ace/mode/json"),R.setTabSize(this.indentation),R.setUseSoftTabs(!0),R.setUseWrapMode(!0);var E=R.setAnnotations;R.setAnnotations=function(e){E.call(this,e&&e.length?e:c.annotations)},k.commands.bindKey("Ctrl-L",null),k.commands.bindKey("Command-L",null),this.aceEditor=k,k.on("change",this._onChange.bind(this)),k.on("changeSelection",this._onSelect.bind(this))}else{var B=document.createElement("textarea");B.className="jsoneditor-text",B.spellcheck=!1,this.content.appendChild(B),this.textarea=B,this.textarea.readOnly=x,null===this.textarea.oninput?this.textarea.oninput=this._onChange.bind(this):this.textarea.onchange=this._onChange.bind(this),B.onselect=this._onSelect.bind(this),B.onmousedown=this._onMouseDown.bind(this),B.onblur=this._onBlur.bind(this)}if(this._updateHistoryButtons(),this.errorTable=new a["a"]({errorTableVisible:"text"===this.mode,onToggleVisibility:function(){c.validate()},onFocusLine:function(e){c.isFocused=!0,isNaN(e)||c.setTextSelection({row:e,column:1},{row:e,column:1e3})},onChangeHeight:function(e){var t=c.dom.statusBar?c.dom.statusBar.clientHeight:0,i=e+t+1;c.content.style.marginBottom=-i+"px",c.content.style.paddingBottom=i+"px"}}),this.frame.appendChild(this.errorTable.getErrorTable()),i.statusBar){Object(l["addClassName"])(this.content,"has-status-bar"),this.curserInfoElements={};var Z=document.createElement("div");this.dom.statusBar=Z,Z.className="jsoneditor-statusbar",this.frame.appendChild(Z);var G=document.createElement("span");G.className="jsoneditor-curserinfo-label",G.innerText="Ln:";var T=document.createElement("span");T.className="jsoneditor-curserinfo-val",T.innerText="1",Z.appendChild(G),Z.appendChild(T);var W=document.createElement("span");W.className="jsoneditor-curserinfo-label",W.innerText="Col:";var _=document.createElement("span");_.className="jsoneditor-curserinfo-val",_.innerText="1",Z.appendChild(W),Z.appendChild(_),this.curserInfoElements.colVal=_,this.curserInfoElements.lnVal=T;var H=document.createElement("span");H.className="jsoneditor-curserinfo-label",H.innerText="characters selected",H.style.display="none";var $=document.createElement("span");$.className="jsoneditor-curserinfo-count",$.innerText="0",$.style.display="none",this.curserInfoElements.countLabel=H,this.curserInfoElements.countVal=$,Z.appendChild($),Z.appendChild(H),Z.appendChild(this.errorTable.getErrorCounter()),Z.appendChild(this.errorTable.getWarningIcon()),Z.appendChild(this.errorTable.getErrorIcon())}this.setSchema(this.options.schema,this.options.schemaRefs)},C._onChange=function(){var e=this;if(!this.onChangeDisabled){if(setTimeout((function(){return e._updateHistoryButtons()})),this._debouncedValidate(),this.options.onChange)try{this.options.onChange()}catch(t){}if(this.options.onChangeText)try{this.options.onChangeText(this.getText())}catch(t){}}},C._updateHistoryButtons=function(){if(this.aceEditor&&this.dom.undo&&this.dom.redo){var e=this.aceEditor.getSession().getUndoManager();e&&e.hasUndo&&e.hasRedo&&(this.dom.undo.disabled=!e.hasUndo(),this.dom.redo.disabled=!e.hasRedo())}},C._showSortModal=function(){var e=this,t=this.options.modalAnchor||g["a"],i=this.get();function n(t){if(Array.isArray(i)){var n=Object(l["sort"])(i,t.path,t.direction);e.sortedBy=t,e.update(n)}if(Object(l["isObject"])(i)){var r=Object(l["sortObjectKeys"])(i,t.direction);e.sortedBy=t,e.update(r)}}Object(h["showSortModal"])(t,i,n,e.sortedBy)},C._showTransformModal=function(){var e=this,t=this.options,i=t.modalAnchor,n=t.createQuery,r=t.executeQuery,s=t.queryDescription,o=this.get();Object(d["showTransformModal"])({anchor:i||g["a"],json:o,queryDescription:s,createQuery:n,executeQuery:r,onTransform:function(t){var i=r(o,t);e.update(i)}})},C._onSelect=function(){this._updateCursorInfo(),this._emitSelectionChange()},C._onKeyDown=function(e){var t=e.which||e.keyCode,i=!1;220===t&&e.ctrlKey&&(e.shiftKey?(this.compact(),this._onChange()):(this.format(),this._onChange()),i=!0),i&&(e.preventDefault(),e.stopPropagation()),this._updateCursorInfo(),this._emitSelectionChange()},C._onMouseDown=function(){this._updateCursorInfo(),this._emitSelectionChange()},C._onBlur=function(){var e=this;setTimeout((function(){e.isFocused||(e._updateCursorInfo(),e._emitSelectionChange()),e.isFocused=!1}))},C._updateCursorInfo=function(){var e,t,i,n=this;if(this.textarea)setTimeout((function(){var r=Object(l["getInputSelection"])(n.textarea);r.startIndex!==r.endIndex&&(i=r.endIndex-r.startIndex),i&&n.cursorInfo&&n.cursorInfo.line===r.end.row&&n.cursorInfo.column===r.end.column?(e=r.start.row,t=r.start.column):(e=r.end.row,t=r.end.column),n.cursorInfo={line:e,column:t,count:i},n.options.statusBar&&o()}),0);else if(this.aceEditor&&this.curserInfoElements){var r=this.aceEditor.getCursorPosition(),s=this.aceEditor.getSelectedText();e=r.row+1,t=r.column+1,i=s.length,n.cursorInfo={line:e,column:t,count:i},this.options.statusBar&&o()}function o(){n.curserInfoElements.countVal.innerText!==i&&(n.curserInfoElements.countVal.innerText=i,n.curserInfoElements.countVal.style.display=i?"inline":"none",n.curserInfoElements.countLabel.style.display=i?"inline":"none"),n.curserInfoElements.lnVal.innerText=e,n.curserInfoElements.colVal.innerText=t}},C._emitSelectionChange=function(){if(this._selectionChangedHandler){var e=this.getTextSelection();this._selectionChangedHandler(e.start,e.end,e.text)}},C._refreshAnnotations=function(){var e=this.aceEditor&&this.aceEditor.getSession();if(e){var t=e.getAnnotations().filter((function(e){return"error"===e.type}));e.setAnnotations(t)}},C.destroy=function(){this.aceEditor&&(this.aceEditor.destroy(),this.aceEditor=null),this.frame&&this.container&&this.frame.parentNode===this.container&&this.container.removeChild(this.frame),this.modeSwitcher&&(this.modeSwitcher.destroy(),this.modeSwitcher=null),this.textarea=null,this._debouncedValidate=null,this.frameFocusTracker.destroy()},C.compact=function(){var e=this.get(),t=JSON.stringify(e);this.updateText(t)},C.format=function(){var e=this.get(),t=JSON.stringify(e,null,this.indentation);this.updateText(t)},C.repair=function(){var e=this.getText(),t=Object(l["repair"])(e);this.updateText(t)},C.focus=function(){this.textarea&&this.textarea.focus(),this.aceEditor&&this.aceEditor.focus()},C.resize=function(){if(this.aceEditor){var e=!1;this.aceEditor.resize(e)}},C.set=function(e){this.setText(JSON.stringify(e,null,this.indentation))},C.update=function(e){this.updateText(JSON.stringify(e,null,this.indentation))},C.get=function(){var e=this.getText();return Object(l["parse"])(e)},C.getText=function(){return this.textarea?this.textarea.value:this.aceEditor?this.aceEditor.getValue():""},C._setText=function(e,t){var i=this,n=!0===this.options.escapeUnicode?Object(l["escapeUnicodeChars"])(e):e;if(this.textarea&&(this.textarea.value=n),this.aceEditor){if(this.onChangeDisabled=!0,this.aceEditor.setValue(n,-1),this.onChangeDisabled=!1,t){var r=this;setTimeout((function(){r.aceEditor&&r.aceEditor.session.getUndoManager().reset()}))}setTimeout((function(){return i._updateHistoryButtons()}))}this._debouncedValidate()},C.setText=function(e){this._setText(e,!0)},C.updateText=function(e){this.getText()!==e&&this._setText(e,!1)},C.validate=function(){var e,t=this,i=[],n=[];try{if(e=this.get(),this.validateSchema){var r=this.validateSchema(e);r||(i=this.validateSchema.errors.map((function(e){return e.type="validation",Object(l["improveSchemaError"])(e)})))}this.validationSequence=(this.validationSequence||0)+1;var s=this,o=this.validationSequence;c(e,this.options.onValidate).then((function(e){if(o===s.validationSequence){var r=i.concat(n).concat(e);s._renderErrors(r),"function"===typeof t.options.onValidationError&&(Object(l["isValidationErrorChanged"])(r,t.lastSchemaErrors)&&t.options.onValidationError.call(t,r),t.lastSchemaErrors=r)}}))["catch"]((function(e){}))}catch(d){if(this.getText()){var a,h=/\w*line\s*(\d+)\w*/g.exec(d.message);h&&(a=+h[1]),n=[{type:"error",message:d.message.replace(/\n/g,"<br>"),line:a}]}this._renderErrors(n),"function"===typeof this.options.onValidationError&&(Object(l["isValidationErrorChanged"])(n,this.lastSchemaErrors)&&this.options.onValidationError.call(this,n),this.lastSchemaErrors=n)}},C._renderErrors=function(e){var t=this.getText(),i=[];e.reduce((function(e,t){return"string"===typeof t.dataPath&&-1===e.indexOf(t.dataPath)&&e.push(t.dataPath),e}),i);var n=Object(l["getPositionForPath"])(t,i);if(this.aceEditor&&(this.annotations=n.map((function(t){var i=e.filter((function(e){return e.dataPath===t.path})),n=i.map((function(e){return e.message})).join("\n");return n?{row:t.line,column:t.column,text:"Schema validation error"+(1!==i.length?"s":"")+": \n"+n,type:"warning",source:"jsoneditor"}:{}})),this._refreshAnnotations()),this.errorTable.setErrors(e,n),this.aceEditor){var r=!1;this.aceEditor.resize(r)}},C.getTextSelection=function(){var e={};if(this.textarea){var t=Object(l["getInputSelection"])(this.textarea);return this.cursorInfo&&this.cursorInfo.line===t.end.row&&this.cursorInfo.column===t.end.column?(e.start=t.end,e.end=t.start):e=t,{start:e.start,end:e.end,text:this.textarea.value.substring(t.startIndex,t.endIndex)}}if(this.aceEditor){var i=this.aceEditor.getSelection(),n=this.aceEditor.getSelectedText(),r=i.getRange(),s=i.getSelectionLead();return s.row===r.end.row&&s.column===r.end.column?e=r:(e.start=r.end,e.end=r.start),{start:{row:e.start.row+1,column:e.start.column+1},end:{row:e.end.row+1,column:e.end.column+1},text:n}}},C.onTextSelectionChange=function(e){"function"===typeof e&&(this._selectionChangedHandler=Object(l["debounce"])(e,this.DEBOUNCE_INTERVAL))},C.setTextSelection=function(e,t){if(e&&t)if(this.textarea){var i=Object(l["getIndexForPosition"])(this.textarea,e.row,e.column),n=Object(l["getIndexForPosition"])(this.textarea,t.row,t.column);if(i>-1&&n>-1){if(this.textarea.setSelectionRange)this.textarea.focus(),this.textarea.setSelectionRange(i,n);else if(this.textarea.createTextRange){var r=this.textarea.createTextRange();r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",i),r.select()}var s=(this.textarea.value.match(/\n/g)||[]).length+1,o=this.textarea.scrollHeight/s,a=e.row*o;this.textarea.scrollTop=a>this.textarea.clientHeight?a-this.textarea.clientHeight/2:0}}else if(this.aceEditor){var c={start:{row:e.row-1,column:e.column-1},end:{row:t.row-1,column:t.column-1}};this.aceEditor.selection.setRange(c),this.aceEditor.scrollToLine(e.row-1,!0)}};var v=[{mode:"text",mixin:C,data:"text",load:A},{mode:"code",mixin:C,data:"text",load:A}]},function(e,t,i){var n=function(){var e={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(e,t,i,n,r,s,o){var a=s.length-1;switch(r){case 1:this.$=e.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(e);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=s[a-1];case 13:this.$={};break;case 14:this.$=s[a-1];break;case 15:this.$=[s[a-2],s[a]];break;case 16:this.$={},this.$[s[a][0]]=s[a][1];break;case 17:this.$=s[a-2],s[a-2][s[a][0]]=s[a][1];break;case 18:this.$=[];break;case 19:this.$=s[a-1];break;case 20:this.$=[s[a]];break;case 21:this.$=s[a-2],s[a-2].push(s[a]);break}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(e,t){throw new Error(e)},parse:function(e){var t=this,i=[0],n=[null],r=[],s=this.table,o="",a=0,l=0,c=0,h=2,d=1;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var u=this.lexer.yylloc;function g(e){i.length=i.length-2*e,n.length=n.length-e,r.length=r.length-e}function p(){var e;return e=t.lexer.lex()||1,"number"!==typeof e&&(e=t.symbols_[e]||e),e}r.push(u),"function"===typeof this.yy.parseError&&(this.parseError=this.yy.parseError);var m,f,C,I,A,v,b,y,w,S={};while(1){if(C=i[i.length-1],this.defaultActions[C]?I=this.defaultActions[C]:(null==m&&(m=p()),I=s[C]&&s[C][m]),"undefined"===typeof I||!I.length||!I[0]){if(!c){for(v in w=[],s[C])this.terminals_[v]&&v>2&&w.push("'"+this.terminals_[v]+"'");var x="";x=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+w.join(", ")+", got '"+this.terminals_[m]+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[m]||m,line:this.lexer.yylineno,loc:u,expected:w})}if(3==c){if(m==d)throw new Error(x||"Parsing halted.");l=this.lexer.yyleng,o=this.lexer.yytext,a=this.lexer.yylineno,u=this.lexer.yylloc,m=p()}while(1){if(h.toString()in s[C])break;if(0==C)throw new Error(x||"Parsing halted.");g(1),C=i[i.length-1]}f=m,m=h,C=i[i.length-1],I=s[C]&&s[C][h],c=3}if(I[0]instanceof Array&&I.length>1)throw new Error("Parse Error: multiple actions possible at state: "+C+", token: "+m);switch(I[0]){case 1:i.push(m),n.push(this.lexer.yytext),r.push(this.lexer.yylloc),i.push(I[1]),m=null,f?(m=f,f=null):(l=this.lexer.yyleng,o=this.lexer.yytext,a=this.lexer.yylineno,u=this.lexer.yylloc,c>0&&c--);break;case 2:if(b=this.productions_[I[1]][1],S.$=n[n.length-b],S._$={first_line:r[r.length-(b||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(b||1)].first_column,last_column:r[r.length-1].last_column},A=this.performAction.call(S,o,l,a,this.yy,I[1],n,r),"undefined"!==typeof A)return A;b&&(i=i.slice(0,-1*b*2),n=n.slice(0,-1*b),r=r.slice(0,-1*b)),i.push(this.productions_[I[1]][0]),n.push(S.$),r.push(S._$),y=s[i[i.length-2]][i[i.length-1]],i.push(y);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parseError)throw new Error(e);this.yy.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e;var t=e.match(/\n/);return t&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},less:function(e){this._input=this.match.slice(e)+this._input},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;var e,t,i,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),o=0;o<s.length;o++)if(i=this._input.match(this.rules[s[o]]),i&&(!t||i[0].length>t[0].length)&&(t=i,n=o,!this.options.flex))break;return t?(r=t[0].match(/\n.*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-1:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,s[n],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e||void 0):""===this._input?this.EOF:void this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return"undefined"!==typeof e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)},options:{},performAction:function(e,t,i,n){switch(i){case 0:break;case 1:return 6;case 2:return t.yytext=t.yytext.substr(1,t.yyleng-2),4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}}};return e}();return e.lexer=t,e}();t.parser=n,t.parse=n.parse.bind(n)},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t){"undefined"!==typeof Element&&function(){function e(e){"remove"in e||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){void 0!==this.parentNode&&this.parentNode.removeChild(this)}})}"undefined"!==typeof window.Element&&e(window.Element.prototype),"undefined"!==typeof window.CharacterData&&e(window.CharacterData.prototype),"undefined"!==typeof window.DocumentType&&e(window.DocumentType.prototype)}(),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(e){for(var t=0;t<this.length;t++){var i=this[t];if(e.call(this,i,t,this))return t}return-1},configurable:!0,writable:!0}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){var t=this.findIndex(e);return this[t]},configurable:!0,writable:!0}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")})},function(e,t,i){"use strict";var n=i(7);function r(e){n.copy(e,this)}e.exports=r},function(e,t,i){"use strict";e.exports=function(e,t){t||(t={}),"function"===typeof t&&(t={cmp:t});var i="boolean"===typeof t.cycles&&t.cycles,n=t.cmp&&function(e){return function(t){return function(i,n){var r={key:i,value:t[i]},s={key:n,value:t[n]};return e(r,s)}}}(t.cmp),r=[];return function e(t){if(t&&t.toJSON&&"function"===typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!==typeof t)return JSON.stringify(t);var s,o;if(Array.isArray(t)){for(o="[",s=0;s<t.length;s++)s&&(o+=","),o+=e(t[s])||"null";return o+"]"}if(null===t)return"null";if(-1!==r.indexOf(t)){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var a=r.push(t)-1,l=Object.keys(t).sort(n&&n(t));for(o="",s=0;s<l.length;s++){var c=l[s],h=e(t[c]);h&&(o&&(o+=","),o+=JSON.stringify(c)+":"+h)}return r.splice(a,1),"{"+o+"}"}}(e)}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n="",r=!0===e.schema.$async,s=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var a=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(a){var l="unknown keyword: "+a;if("log"!==e.opts.strictKeywords)throw new Error(l);e.logger.warn(l)}}if(e.isTop&&(n+=" var validate = ",r&&(e.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(n+=" /*# sourceURL="+o+" */ ")),"boolean"==typeof e.schema||!s&&!e.schema.$ref){t="false schema";var c=e.level,h=e.dataLevel,d=e.schema[t],u=e.schemaPath+e.util.getProperty(t),g=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(h||""),f="valid"+c;if(!1===e.schema){e.isTop?p=!0:n+=" var "+f+" = false; ";var C=C||[];C.push(n),n="",!1!==e.createErrors?(n+=" { keyword: '"+(b||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",!1!==e.opts.messages&&(n+=" , message: 'boolean schema is false' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var I=n;n=C.pop(),!e.compositeRule&&p?e.async?n+=" throw new ValidationError(["+I+"]); ":n+=" validate.errors = ["+I+"]; return false; ":n+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n+=r?" return data; ":" validate.errors = null; return true; ":n+=" var "+f+" = true; ";return e.isTop&&(n+=" }; return validate; "),n}if(e.isTop){var A=e.isTop;c=e.level=0,h=e.dataLevel=0,m="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[void 0],void 0!==e.schema.default&&e.opts.useDefaults&&e.opts.strictDefaults){var v="default is ignored in the schema root";if("log"!==e.opts.strictDefaults)throw new Error(v);e.logger.warn(v)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{c=e.level,h=e.dataLevel,m="data"+(h||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),r&&!e.async)throw new Error("async schema in sync schema");n+=" var errs_"+c+" = errors;"}f="valid"+c,p=!e.opts.allErrors;var b,y="",w="",S=e.schema.type,x=Array.isArray(S);if(S&&e.opts.nullable&&!0===e.schema.nullable&&(x?-1==S.indexOf("null")&&(S=S.concat("null")):"null"!=S&&(S=[S,"null"],x=!0)),x&&1==S.length&&(S=S[0],x=!1),e.schema.$ref&&s){if("fail"==e.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');!0!==e.opts.extendRefs&&(s=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(n+=" "+e.RULES.all.$comment.code(e,"$comment")),S){if(e.opts.coerceTypes)var k=e.util.coerceToTypes(e.opts.coerceTypes,S);var R=e.RULES.types[S];if(k||x||!0===R||R&&!te(R)){u=e.schemaPath+".type",g=e.errSchemaPath+"/type",u=e.schemaPath+".type",g=e.errSchemaPath+"/type";var E=x?"checkDataTypes":"checkDataType";if(n+=" if ("+e.util[E](S,m,!0)+") { ",k){var B="dataType"+c,Z="coerced"+c;n+=" var "+B+" = typeof "+m+"; ","array"==e.opts.coerceTypes&&(n+=" if ("+B+" == 'object' && Array.isArray("+m+")) "+B+" = 'array'; "),n+=" var "+Z+" = undefined; ";var G="",T=k;if(T){var W,_=-1,H=T.length-1;while(_<H)W=T[_+=1],_&&(n+=" if ("+Z+" === undefined) { ",G+="}"),"array"==e.opts.coerceTypes&&"array"!=W&&(n+=" if ("+B+" == 'array' && "+m+".length == 1) { "+Z+" = "+m+" = "+m+"[0]; "+B+" = typeof "+m+"; } "),"string"==W?n+=" if ("+B+" == 'number' || "+B+" == 'boolean') "+Z+" = '' + "+m+"; else if ("+m+" === null) "+Z+" = ''; ":"number"==W||"integer"==W?(n+=" if ("+B+" == 'boolean' || "+m+" === null || ("+B+" == 'string' && "+m+" && "+m+" == +"+m+" ","integer"==W&&(n+=" && !("+m+" % 1)"),n+=")) "+Z+" = +"+m+"; "):"boolean"==W?n+=" if ("+m+" === 'false' || "+m+" === 0 || "+m+" === null) "+Z+" = false; else if ("+m+" === 'true' || "+m+" === 1) "+Z+" = true; ":"null"==W?n+=" if ("+m+" === '' || "+m+" === 0 || "+m+" === false) "+Z+" = null; ":"array"==e.opts.coerceTypes&&"array"==W&&(n+=" if ("+B+" == 'string' || "+B+" == 'number' || "+B+" == 'boolean' || "+m+" == null) "+Z+" = ["+m+"]; ")}n+=" "+G+" if ("+Z+" === undefined) { ";C=C||[];C.push(n),n="",!1!==e.createErrors?(n+=" { keyword: '"+(b||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",n+=x?""+S.join(","):""+S,n+="' } ",!1!==e.opts.messages&&(n+=" , message: 'should be ",n+=x?""+S.join(","):""+S,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";I=n;n=C.pop(),!e.compositeRule&&p?e.async?n+=" throw new ValidationError(["+I+"]); ":n+=" validate.errors = ["+I+"]; return false; ":n+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ";var $=h?"data"+(h-1||""):"parentData",V=h?e.dataPathArr[h]:"parentDataProperty";n+=" "+m+" = "+Z+"; ",h||(n+="if ("+$+" !== undefined)"),n+=" "+$+"["+V+"] = "+Z+"; } "}else{C=C||[];C.push(n),n="",!1!==e.createErrors?(n+=" { keyword: '"+(b||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",n+=x?""+S.join(","):""+S,n+="' } ",!1!==e.opts.messages&&(n+=" , message: 'should be ",n+=x?""+S.join(","):""+S,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";I=n;n=C.pop(),!e.compositeRule&&p?e.async?n+=" throw new ValidationError(["+I+"]); ":n+=" validate.errors = ["+I+"]; return false; ":n+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}n+=" } "}}if(e.schema.$ref&&!s)n+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",p&&(n+=" } if (errors === ",n+=A?"0":"errs_"+c,n+=") { ",w+="}");else{var L=e.RULES;if(L){var N=-1,O=L.length-1;while(N<O)if(R=L[N+=1],te(R)){if(R.type&&(n+=" if ("+e.util.checkDataType(R.type,m)+") { "),e.opts.useDefaults)if("object"==R.type&&e.schema.properties){d=e.schema.properties;var F=Object.keys(d),P=F;if(P){var K,M=-1,j=P.length-1;while(M<j){K=P[M+=1];var D=d[K];if(void 0!==D.default){var X=m+e.util.getProperty(K);if(e.compositeRule){if(e.opts.strictDefaults){v="default is ignored for: "+X;if("log"!==e.opts.strictDefaults)throw new Error(v);e.logger.warn(v)}}else n+=" if ("+X+" === undefined ","empty"==e.opts.useDefaults&&(n+=" || "+X+" === null || "+X+" === '' "),n+=" ) "+X+" = ","shared"==e.opts.useDefaults?n+=" "+e.useDefault(D.default)+" ":n+=" "+JSON.stringify(D.default)+" ",n+="; "}}}}else if("array"==R.type&&Array.isArray(e.schema.items)){var Y=e.schema.items;if(Y){_=-1;var z=Y.length-1;while(_<z)if(D=Y[_+=1],void 0!==D.default){X=m+"["+_+"]";if(e.compositeRule){if(e.opts.strictDefaults){v="default is ignored for: "+X;if("log"!==e.opts.strictDefaults)throw new Error(v);e.logger.warn(v)}}else n+=" if ("+X+" === undefined ","empty"==e.opts.useDefaults&&(n+=" || "+X+" === null || "+X+" === '' "),n+=" ) "+X+" = ","shared"==e.opts.useDefaults?n+=" "+e.useDefault(D.default)+" ":n+=" "+JSON.stringify(D.default)+" ",n+="; "}}}var J=R.rules;if(J){var U,Q=-1,q=J.length-1;while(Q<q)if(U=J[Q+=1],ie(U)){var ee=U.code(e,U.keyword,R.type);ee&&(n+=" "+ee+" ",p&&(y+="}"))}}if(p&&(n+=" "+y+" ",y=""),R.type&&(n+=" } ",S&&S===R.type&&!k)){n+=" else { ";u=e.schemaPath+".type",g=e.errSchemaPath+"/type",C=C||[];C.push(n),n="",!1!==e.createErrors?(n+=" { keyword: '"+(b||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",n+=x?""+S.join(","):""+S,n+="' } ",!1!==e.opts.messages&&(n+=" , message: 'should be ",n+=x?""+S.join(","):""+S,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";I=n;n=C.pop(),!e.compositeRule&&p?e.async?n+=" throw new ValidationError(["+I+"]); ":n+=" validate.errors = ["+I+"]; return false; ":n+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } "}p&&(n+=" if (errors === ",n+=A?"0":"errs_"+c,n+=") { ",w+="}")}}}function te(e){for(var t=e.rules,i=0;i<t.length;i++)if(ie(t[i]))return!0}function ie(t){return void 0!==e.schema[t.keyword]||t.implements&&ne(t)}function ne(t){for(var i=t.implements,n=0;n<i.length;n++)if(void 0!==e.schema[i[n]])return!0}return p&&(n+=" "+w+" "),A?(r?(n+=" if (errors === 0) return data; ",n+=" else throw new ValidationError(vErrors); "):(n+=" validate.errors = vErrors; ",n+=" return errors === 0; "),n+=" }; return validate;"):n+=" var "+f+" = errors === errs_"+c+";",n=e.util.cleanUpCode(n),A&&(n=e.util.finalCleanUpCode(n,r)),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n,r=" ",s=e.level,o=e.dataLevel,a=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,d="data"+(o||""),u=e.opts.$data&&a&&a.$data;u?(r+=" var schema"+s+" = "+e.util.getData(a.$data,o,e.dataPathArr)+"; ",n="schema"+s):n=a;var g="maximum"==t,p=g?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[p],f=e.opts.$data&&m&&m.$data,C=g?"<":">",I=g?">":"<",A=void 0;if(f){var v=e.util.getData(m.$data,o,e.dataPathArr),b="exclusive"+s,y="exclType"+s,w="exclIsNumber"+s,S="op"+s,x="' + "+S+" + '";r+=" var schemaExcl"+s+" = "+v+"; ",v="schemaExcl"+s,r+=" var "+b+"; var "+y+" = typeof "+v+"; if ("+y+" != 'boolean' && "+y+" != 'undefined' && "+y+" != 'number') { ";A=p;var k=k||[];k.push(r),r="",!1!==e.createErrors?(r+=" { keyword: '"+(A||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",!1!==e.opts.messages&&(r+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var R=r;r=k.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+R+"]); ":r+=" validate.errors = ["+R+"]; return false; ":r+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",u&&(r+=" ("+n+" !== undefined && typeof "+n+" != 'number') || "),r+=" "+y+" == 'number' ? ( ("+b+" = "+n+" === undefined || "+v+" "+C+"= "+n+") ? "+d+" "+I+"= "+v+" : "+d+" "+I+" "+n+" ) : ( ("+b+" = "+v+" === true) ? "+d+" "+I+"= "+n+" : "+d+" "+I+" "+n+" ) || "+d+" !== "+d+") { var op"+s+" = "+b+" ? '"+C+"' : '"+C+"='; ",void 0===a&&(A=p,c=e.errSchemaPath+"/"+p,n=v,u=f)}else{w="number"==typeof m,x=C;if(w&&u){S="'"+x+"'";r+=" if ( ",u&&(r+=" ("+n+" !== undefined && typeof "+n+" != 'number') || "),r+=" ( "+n+" === undefined || "+m+" "+C+"= "+n+" ? "+d+" "+I+"= "+m+" : "+d+" "+I+" "+n+" ) || "+d+" !== "+d+") { "}else{w&&void 0===a?(b=!0,A=p,c=e.errSchemaPath+"/"+p,n=m,I+="="):(w&&(n=Math[g?"min":"max"](m,a)),m===(!w||n)?(b=!0,A=p,c=e.errSchemaPath+"/"+p,I+="="):(b=!1,x+="="));S="'"+x+"'";r+=" if ( ",u&&(r+=" ("+n+" !== undefined && typeof "+n+" != 'number') || "),r+=" "+d+" "+I+" "+n+" || "+d+" !== "+d+") { "}}A=A||t;k=k||[];k.push(r),r="",!1!==e.createErrors?(r+=" { keyword: '"+(A||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+S+", limit: "+n+", exclusive: "+b+" } ",!1!==e.opts.messages&&(r+=" , message: 'should be "+x+" ",r+=u?"' + "+n:n+"'"),e.opts.verbose&&(r+=" , schema: ",r+=u?"validate.schema"+l:""+a,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";R=r;return r=k.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+R+"]); ":r+=" validate.errors = ["+R+"]; return false; ":r+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { "),r}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n,r=" ",s=e.level,o=e.dataLevel,a=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,d="data"+(o||""),u=e.opts.$data&&a&&a.$data;u?(r+=" var schema"+s+" = "+e.util.getData(a.$data,o,e.dataPathArr)+"; ",n="schema"+s):n=a;var g="maxItems"==t?">":"<";r+="if ( ",u&&(r+=" ("+n+" !== undefined && typeof "+n+" != 'number') || "),r+=" "+d+".length "+g+" "+n+") { ";var p=t,m=m||[];m.push(r),r="",!1!==e.createErrors?(r+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+n+" } ",!1!==e.opts.messages&&(r+=" , message: 'should NOT have ",r+="maxItems"==t?"more":"fewer",r+=" than ",r+=u?"' + "+n+" + '":""+a,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",r+=u?"validate.schema"+l:""+a,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var f=r;return r=m.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+f+"]); ":r+=" validate.errors = ["+f+"]; return false; ":r+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n,r=" ",s=e.level,o=e.dataLevel,a=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,d="data"+(o||""),u=e.opts.$data&&a&&a.$data;u?(r+=" var schema"+s+" = "+e.util.getData(a.$data,o,e.dataPathArr)+"; ",n="schema"+s):n=a;var g="maxLength"==t?">":"<";r+="if ( ",u&&(r+=" ("+n+" !== undefined && typeof "+n+" != 'number') || "),!1===e.opts.unicode?r+=" "+d+".length ":r+=" ucs2length("+d+") ",r+=" "+g+" "+n+") { ";var p=t,m=m||[];m.push(r),r="",!1!==e.createErrors?(r+=" { keyword: '"+(p||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+n+" } ",!1!==e.opts.messages&&(r+=" , message: 'should NOT be ",r+="maxLength"==t?"longer":"shorter",r+=" than ",r+=u?"' + "+n+" + '":""+a,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",r+=u?"validate.schema"+l:""+a,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var f=r;return r=m.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+f+"]); ":r+=" validate.errors = ["+f+"]; return false; ":r+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n,r=" ",s=e.level,o=e.dataLevel,a=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,d="data"+(o||""),u=e.opts.$data&&a&&a.$data;u?(r+=" var schema"+s+" = "+e.util.getData(a.$data,o,e.dataPathArr)+"; ",n="schema"+s):n=a;var g="maxProperties"==t?">":"<";r+="if ( ",u&&(r+=" ("+n+" !== undefined && typeof "+n+" != 'number') || "),r+=" Object.keys("+d+").length "+g+" "+n+") { ";var p=t,m=m||[];m.push(r),r="",!1!==e.createErrors?(r+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+n+" } ",!1!==e.opts.messages&&(r+=" , message: 'should NOT have ",r+="maxProperties"==t?"more":"fewer",r+=" than ",r+=u?"' + "+n+" + '":""+a,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",r+=u?"validate.schema"+l:""+a,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var f=r;return r=m.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+f+"]); ":r+=" validate.errors = ["+f+"]; return false; ":r+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}},function(e){e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},function(e,t,i){"use strict";var n={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",'"':'"',"/":"/","\\":"\\"},r="a".charCodeAt();t.parse=function(e,t,i){var s={},o=0,a=0,l=0,c=i&&i.bigint&&"undefined"!=typeof BigInt;return{data:h("",!0),pointers:s};function h(t,i){var n;d(),y(t,"value");var r=I();switch(r){case"t":C("rue"),n=!0;break;case"f":C("alse"),n=!1;break;case"n":C("ull"),n=null;break;case'"':n=u();break;case"[":n=p(t);break;case"{":n=m(t);break;default:A(),"-0123456789".indexOf(r)>=0?n=g():x()}return y(t,"valueEnd"),d(),i&&l<e.length&&x(),n}function d(){e:while(l<e.length){switch(e[l]){case" ":a++;break;case"\t":a+=4;break;case"\r":a=0;break;case"\n":a=0,o++;break;default:break e}l++}}function u(){var e,t="";while(1){if(e=I(),'"'==e)break;"\\"==e?(e=I(),e in n?t+=n[e]:"u"==e?t+=v():k()):t+=e}return t}function g(){var t="",i=!0;"-"==e[l]&&(t+=I()),t+="0"==e[l]?I():b(),"."==e[l]&&(t+=I()+b(),i=!1),"e"!=e[l]&&"E"!=e[l]||(t+=I(),"+"!=e[l]&&"-"!=e[l]||(t+=I()),t+=b(),i=!1);var n=+t;return c&&i&&(n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER)?BigInt(t):n}function p(e){d();var t=[],i=0;if("]"==I())return t;A();while(1){var n=e+"/"+i;t.push(h(n)),d();var r=I();if("]"==r)break;","!=r&&k(),d(),i++}return t}function m(e){d();var t={};if("}"==I())return t;A();while(1){var i=S();'"'!=I()&&k();var n=u(),r=e+"/"+f(n);w(r,"key",i),y(r,"keyEnd"),d(),":"!=I()&&k(),d(),t[n]=h(r),d();var s=I();if("}"==s)break;","!=s&&k(),d()}return t}function C(e){for(var t=0;t<e.length;t++)I()!==e[t]&&k()}function I(){R();var t=e[l];return l++,a++,t}function A(){l--,a--}function v(){var e=4,t=0;while(e--){t<<=4;var i=I().toLowerCase();i>="a"&&i<="f"?t+=i.charCodeAt()-r+10:i>="0"&&i<="9"?t+=+i:k()}return String.fromCharCode(t)}function b(){var t="";while(e[l]>="0"&&e[l]<="9")t+=I();if(t.length)return t;R(),x()}function y(e,t){w(e,t,S())}function w(e,t,i){s[e]=s[e]||{},s[e][t]=i}function S(){return{line:o,column:a,pos:l}}function x(){throw new SyntaxError("Unexpected token "+e[l]+" in JSON at position "+l)}function k(){A(),x()}function R(){if(l>=e.length)throw new SyntaxError("Unexpected end of JSON input")}},t.stringify=function(e,t,i){if(o(e)){var n,r,s=0,a="object"==typeof i?i.space:i;switch(typeof a){case"number":var l=a>10?10:a<0?0:Math.floor(a);a=l&&w(l," "),n=l,r=l;break;case"string":a=a.slice(0,10),n=0,r=0;for(var c=0;c<a.length;c++){var h=a[c];switch(h){case" ":r++;break;case"\t":r+=4;break;case"\r":r=0;break;case"\n":r=0,s++;break;default:throw new Error("whitespace characters not allowed in JSON")}n++}break;default:a=void 0}var d="",u={},p=0,m=0,C=0,I=i&&i.es6&&"function"==typeof Map;return A(e,0,""),{json:d,pointers:u}}function A(e,t,i){switch(y(i,"value"),typeof e){case"number":case"bigint":case"boolean":v(""+e);break;case"string":v(g(e));break;case"object":null===e?v("null"):"function"==typeof e.toJSON?v(g(e.toJSON())):Array.isArray(e)?n():I?e.constructor.BYTES_PER_ELEMENT?n():e instanceof Map?s():e instanceof Set?s(!0):r():r()}function n(){if(e.length){v("[");for(var n=t+1,r=0;r<e.length;r++){r&&v(","),b(n);var s=o(e[r])?e[r]:null,a=i+"/"+r;A(s,n,a)}b(t),v("]")}else v("[]")}function r(){var n=Object.keys(e);if(n.length){v("{");for(var r=t+1,s=0;s<n.length;s++){var l=n[s],c=e[l];if(o(c)){s&&v(",");var h=i+"/"+f(l);b(r),y(h,"key"),v(g(l)),y(h,"keyEnd"),v(":"),a&&v(" "),A(c,r,h)}}b(t),v("}")}else v("{}")}function s(n){if(e.size){v("{");var r=t+1,s=!0,l=e.entries(),c=l.next();while(!c.done){var h=c.value,d=h[0],u=!!n||h[1];if(o(u)){s||v(","),s=!1;var p=i+"/"+f(d);b(r),y(p,"key"),v(g(d)),y(p,"keyEnd"),v(":"),a&&v(" "),A(u,r,p)}c=l.next()}b(t),v("}")}else v("{}")}y(i,"valueEnd")}function v(e){m+=e.length,C+=e.length,d+=e}function b(e){if(a){d+="\n"+w(e,a),p++,m=0;while(e--)s?(p+=s,m=r):m+=r,C+=n;C+=1}}function y(e,t){u[e]=u[e]||{},u[e][t]={line:p,column:m,pos:C}}function w(e,t){return Array(e+1).join(t)}};var s=["number","bigint","boolean","string","object"];function o(e){return s.indexOf(typeof e)>=0}var a=/"|\\/g,l=/[\b]/g,c=/\f/g,h=/\n/g,d=/\r/g,u=/\t/g;function g(e){return e=e.replace(a,"\\$&").replace(c,"\\f").replace(l,"\\b").replace(h,"\\n").replace(d,"\\r").replace(u,"\\t"),'"'+e+'"'}var p=/~/g,m=/\//g;function f(e){return e.replace(p,"~0").replace(m,"~1")}},function(e,t,i){(function(e){"use strict";function t(e){return null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function n(e,r){if(e===r)return!0;var s=Object.prototype.toString.call(e);if(s!==Object.prototype.toString.call(r))return!1;if(!0===t(e)){if(e.length!==r.length)return!1;for(var o=0;o<e.length;o++)if(!1===n(e[o],r[o]))return!1;return!0}if(!0===i(e)){var a={};for(var l in e)if(hasOwnProperty.call(e,l)){if(!1===n(e[l],r[l]))return!1;a[l]=!0}for(var c in r)if(hasOwnProperty.call(r,c)&&!0!==a[c])return!1;return!0}return!1}function r(e){if(""===e||!1===e||null===e)return!0;if(t(e)&&0===e.length)return!0;if(i(e)){for(var n in e)if(e.hasOwnProperty(n))return!1;return!0}return!1}function s(e){for(var t=Object.keys(e),i=[],n=0;n<t.length;n++)i.push(e[t[n]]);return i}var o;o="function"===typeof String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.match(/^\s*(.*)/)[1]};var a=0,l=1,c=2,h=3,d=4,u=5,g=6,p=7,m=8,f=9,C="EOF",I="UnquotedIdentifier",A="QuotedIdentifier",v="Rbracket",b="Rparen",y="Comma",w="Colon",S="Rbrace",x="Number",k="Current",R="Expref",E="Pipe",B="Or",Z="And",G="EQ",T="GT",W="LT",_="GTE",H="LTE",$="NE",V="Flatten",L="Star",N="Filter",O="Dot",F="Not",P="Lbrace",K="Lbracket",M="Lparen",j="Literal",D={".":O,"*":L,",":y,":":w,"{":P,"}":S,"]":v,"(":M,")":b,"@":k},X={"<":!0,">":!0,"=":!0,"!":!0},Y={" ":!0,"\t":!0,"\n":!0};function z(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e}function J(e){return e>="0"&&e<="9"||"-"===e}function U(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"_"===e}function Q(){}Q.prototype={tokenize:function(e){var t,i,n,r=[];this._current=0;while(this._current<e.length)if(z(e[this._current]))t=this._current,i=this._consumeUnquotedIdentifier(e),r.push({type:I,value:i,start:t});else if(void 0!==D[e[this._current]])r.push({type:D[e[this._current]],value:e[this._current],start:this._current}),this._current++;else if(J(e[this._current]))n=this._consumeNumber(e),r.push(n);else if("["===e[this._current])n=this._consumeLBracket(e),r.push(n);else if('"'===e[this._current])t=this._current,i=this._consumeQuotedIdentifier(e),r.push({type:A,value:i,start:t});else if("'"===e[this._current])t=this._current,i=this._consumeRawStringLiteral(e),r.push({type:j,value:i,start:t});else if("`"===e[this._current]){t=this._current;var s=this._consumeLiteral(e);r.push({type:j,value:s,start:t})}else if(void 0!==X[e[this._current]])r.push(this._consumeOperator(e));else if(void 0!==Y[e[this._current]])this._current++;else if("&"===e[this._current])t=this._current,this._current++,"&"===e[this._current]?(this._current++,r.push({type:Z,value:"&&",start:t})):r.push({type:R,value:"&",start:t});else{if("|"!==e[this._current]){var o=new Error("Unknown character:"+e[this._current]);throw o.name="LexerError",o}t=this._current,this._current++,"|"===e[this._current]?(this._current++,r.push({type:B,value:"||",start:t})):r.push({type:E,value:"|",start:t})}return r},_consumeUnquotedIdentifier:function(e){var t=this._current;this._current++;while(this._current<e.length&&U(e[this._current]))this._current++;return e.slice(t,this._current)},_consumeQuotedIdentifier:function(e){var t=this._current;this._current++;var i=e.length;while('"'!==e[this._current]&&this._current<i){var n=this._current;"\\"!==e[n]||"\\"!==e[n+1]&&'"'!==e[n+1]?n++:n+=2,this._current=n}return this._current++,JSON.parse(e.slice(t,this._current))},_consumeRawStringLiteral:function(e){var t=this._current;this._current++;var i=e.length;while("'"!==e[this._current]&&this._current<i){var n=this._current;"\\"!==e[n]||"\\"!==e[n+1]&&"'"!==e[n+1]?n++:n+=2,this._current=n}this._current++;var r=e.slice(t+1,this._current-1);return r.replace("\\'","'")},_consumeNumber:function(e){var t=this._current;this._current++;var i=e.length;while(J(e[this._current])&&this._current<i)this._current++;var n=parseInt(e.slice(t,this._current));return{type:x,value:n,start:t}},_consumeLBracket:function(e){var t=this._current;return this._current++,"?"===e[this._current]?(this._current++,{type:N,value:"[?",start:t}):"]"===e[this._current]?(this._current++,{type:V,value:"[]",start:t}):{type:K,value:"[",start:t}},_consumeOperator:function(e){var t=this._current,i=e[t];return this._current++,"!"===i?"="===e[this._current]?(this._current++,{type:$,value:"!=",start:t}):{type:F,value:"!",start:t}:"<"===i?"="===e[this._current]?(this._current++,{type:H,value:"<=",start:t}):{type:W,value:"<",start:t}:">"===i?"="===e[this._current]?(this._current++,{type:_,value:">=",start:t}):{type:T,value:">",start:t}:"="===i&&"="===e[this._current]?(this._current++,{type:G,value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;var t,i=this._current,n=e.length;while("`"!==e[this._current]&&this._current<n){var r=this._current;"\\"!==e[r]||"\\"!==e[r+1]&&"`"!==e[r+1]?r++:r+=2,this._current=r}var s=o(e.slice(i,this._current));return s=s.replace("\\`","`"),t=this._looksLikeJSON(s)?JSON.parse(s):JSON.parse('"'+s+'"'),this._current++,t},_looksLikeJSON:function(e){var t='[{"',i=["true","false","null"],n="-0123456789";if(""===e)return!1;if(t.indexOf(e[0])>=0)return!0;if(i.indexOf(e)>=0)return!0;if(!(n.indexOf(e[0])>=0))return!1;try{return JSON.parse(e),!0}catch(r){return!1}}};var q={};function ee(){}function te(e){this.runtime=e}function ie(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[a]}]},avg:{_func:this._functionAvg,_signature:[{types:[m]}]},ceil:{_func:this._functionCeil,_signature:[{types:[a]}]},contains:{_func:this._functionContains,_signature:[{types:[c,h]},{types:[l]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[c]},{types:[c]}]},floor:{_func:this._functionFloor,_signature:[{types:[a]}]},length:{_func:this._functionLength,_signature:[{types:[c,h,d]}]},map:{_func:this._functionMap,_signature:[{types:[g]},{types:[h]}]},max:{_func:this._functionMax,_signature:[{types:[m,f]}]},merge:{_func:this._functionMerge,_signature:[{types:[d],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[h]},{types:[g]}]},sum:{_func:this._functionSum,_signature:[{types:[m]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[c]},{types:[c]}]},min:{_func:this._functionMin,_signature:[{types:[m,f]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[h]},{types:[g]}]},type:{_func:this._functionType,_signature:[{types:[l]}]},keys:{_func:this._functionKeys,_signature:[{types:[d]}]},values:{_func:this._functionValues,_signature:[{types:[d]}]},sort:{_func:this._functionSort,_signature:[{types:[f,m]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[h]},{types:[g]}]},join:{_func:this._functionJoin,_signature:[{types:[c]},{types:[f]}]},reverse:{_func:this._functionReverse,_signature:[{types:[c,h]}]},to_array:{_func:this._functionToArray,_signature:[{types:[l]}]},to_string:{_func:this._functionToString,_signature:[{types:[l]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[l]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[l],variadic:!0}]}}}function ne(e){var t=new ee,i=t.parse(e);return i}function re(e){var t=new Q;return t.tokenize(e)}function se(e,t){var i=new ee,n=new ie,r=new te(n);n._interpreter=r;var s=i.parse(t);return r.search(s,e)}q[C]=0,q[I]=0,q[A]=0,q[v]=0,q[b]=0,q[y]=0,q[S]=0,q[x]=0,q[k]=0,q[R]=0,q[E]=1,q[B]=2,q[Z]=3,q[G]=5,q[T]=5,q[W]=5,q[_]=5,q[H]=5,q[$]=5,q[V]=9,q[L]=20,q[N]=21,q[O]=40,q[F]=45,q[P]=50,q[K]=55,q[M]=60,ee.prototype={parse:function(e){this._loadTokens(e),this.index=0;var t=this.expression(0);if(this._lookahead(0)!==C){var i=this._lookaheadToken(0),n=new Error("Unexpected token type: "+i.type+", value: "+i.value);throw n.name="ParserError",n}return t},_loadTokens:function(e){var t=new Q,i=t.tokenize(e);i.push({type:C,value:"",start:e.length}),this.tokens=i},expression:function(e){var t=this._lookaheadToken(0);this._advance();var i=this.nud(t),n=this._lookahead(0);while(e<q[n])this._advance(),i=this.led(n,i),n=this._lookahead(0);return i},_lookahead:function(e){return this.tokens[this.index+e].type},_lookaheadToken:function(e){return this.tokens[this.index+e]},_advance:function(){this.index++},nud:function(e){var t,i,n;switch(e.type){case j:return{type:"Literal",value:e.value};case I:return{type:"Field",name:e.value};case A:var r={type:"Field",name:e.value};if(this._lookahead(0)===M)throw new Error("Quoted identifier not allowed for function names.");return r;case F:return i=this.expression(q.Not),{type:"NotExpression",children:[i]};case L:return t={type:"Identity"},i=null,i=this._lookahead(0)===v?{type:"Identity"}:this._parseProjectionRHS(q.Star),{type:"ValueProjection",children:[t,i]};case N:return this.led(e.type,{type:"Identity"});case P:return this._parseMultiselectHash();case V:return t={type:V,children:[{type:"Identity"}]},i=this._parseProjectionRHS(q.Flatten),{type:"Projection",children:[t,i]};case K:return this._lookahead(0)===x||this._lookahead(0)===w?(i=this._parseIndexExpression(),this._projectIfSlice({type:"Identity"},i)):this._lookahead(0)===L&&this._lookahead(1)===v?(this._advance(),this._advance(),i=this._parseProjectionRHS(q.Star),{type:"Projection",children:[{type:"Identity"},i]}):this._parseMultiselectList();case k:return{type:k};case R:return n=this.expression(q.Expref),{type:"ExpressionReference",children:[n]};case M:var s=[];while(this._lookahead(0)!==b)this._lookahead(0)===k?(n={type:k},this._advance()):n=this.expression(0),s.push(n);return this._match(b),s[0];default:this._errorToken(e)}},led:function(e,t){var i;switch(e){case O:var n=q.Dot;return this._lookahead(0)!==L?(i=this._parseDotRHS(n),{type:"Subexpression",children:[t,i]}):(this._advance(),i=this._parseProjectionRHS(n),{type:"ValueProjection",children:[t,i]});case E:return i=this.expression(q.Pipe),{type:E,children:[t,i]};case B:return i=this.expression(q.Or),{type:"OrExpression",children:[t,i]};case Z:return i=this.expression(q.And),{type:"AndExpression",children:[t,i]};case M:var r,s,o=t.name,a=[];while(this._lookahead(0)!==b)this._lookahead(0)===k?(r={type:k},this._advance()):r=this.expression(0),this._lookahead(0)===y&&this._match(y),a.push(r);return this._match(b),s={type:"Function",name:o,children:a},s;case N:var l=this.expression(0);return this._match(v),i=this._lookahead(0)===V?{type:"Identity"}:this._parseProjectionRHS(q.Filter),{type:"FilterProjection",children:[t,i,l]};case V:var c={type:V,children:[t]},h=this._parseProjectionRHS(q.Flatten);return{type:"Projection",children:[c,h]};case G:case $:case T:case _:case W:case H:return this._parseComparator(t,e);case K:var d=this._lookaheadToken(0);return d.type===x||d.type===w?(i=this._parseIndexExpression(),this._projectIfSlice(t,i)):(this._match(L),this._match(v),i=this._parseProjectionRHS(q.Star),{type:"Projection",children:[t,i]});default:this._errorToken(this._lookaheadToken(0))}},_match:function(e){if(this._lookahead(0)!==e){var t=this._lookaheadToken(0),i=new Error("Expected "+e+", got: "+t.type);throw i.name="ParserError",i}this._advance()},_errorToken:function(e){var t=new Error("Invalid token ("+e.type+'): "'+e.value+'"');throw t.name="ParserError",t},_parseIndexExpression:function(){if(this._lookahead(0)===w||this._lookahead(1)===w)return this._parseSliceExpression();var e={type:"Index",value:this._lookaheadToken(0).value};return this._advance(),this._match(v),e},_projectIfSlice:function(e,t){var i={type:"IndexExpression",children:[e,t]};return"Slice"===t.type?{type:"Projection",children:[i,this._parseProjectionRHS(q.Star)]}:i},_parseSliceExpression:function(){var e=[null,null,null],t=0,i=this._lookahead(0);while(i!==v&&t<3){if(i===w)t++,this._advance();else{if(i!==x){var n=this._lookahead(0),r=new Error("Syntax error, unexpected token: "+n.value+"("+n.type+")");throw r.name="Parsererror",r}e[t]=this._lookaheadToken(0).value,this._advance()}i=this._lookahead(0)}return this._match(v),{type:"Slice",children:e}},_parseComparator:function(e,t){var i=this.expression(q[t]);return{type:"Comparator",name:t,children:[e,i]}},_parseDotRHS:function(e){var t=this._lookahead(0),i=[I,A,L];return i.indexOf(t)>=0?this.expression(e):t===K?(this._match(K),this._parseMultiselectList()):t===P?(this._match(P),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(q[this._lookahead(0)]<10)t={type:"Identity"};else if(this._lookahead(0)===K)t=this.expression(e);else if(this._lookahead(0)===N)t=this.expression(e);else{if(this._lookahead(0)!==O){var i=this._lookaheadToken(0),n=new Error("Sytanx error, unexpected token: "+i.value+"("+i.type+")");throw n.name="ParserError",n}this._match(O),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){var e=[];while(this._lookahead(0)!==v){var t=this.expression(0);if(e.push(t),this._lookahead(0)===y&&(this._match(y),this._lookahead(0)===v))throw new Error("Unexpected token Rbracket")}return this._match(v),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t,i,n,r=[],s=[I,A];;){if(e=this._lookaheadToken(0),s.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(t=e.value,this._advance(),this._match(w),i=this.expression(0),n={type:"KeyValuePair",name:t,value:i},r.push(n),this._lookahead(0)===y)this._match(y);else if(this._lookahead(0)===S){this._match(S);break}}return{type:"MultiSelectHash",children:r}}},te.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,o){var a,l,c,h,d,u,g,p,m,f;switch(e.type){case"Field":return null===o?null:i(o)?(u=o[e.name],void 0===u?null:u):null;case"Subexpression":for(c=this.visit(e.children[0],o),f=1;f<e.children.length;f++)if(c=this.visit(e.children[1],c),null===c)return null;return c;case"IndexExpression":return g=this.visit(e.children[0],o),p=this.visit(e.children[1],g),p;case"Index":if(!t(o))return null;var C=e.value;return C<0&&(C=o.length+C),c=o[C],void 0===c&&(c=null),c;case"Slice":if(!t(o))return null;var I=e.children.slice(0),A=this.computeSliceParams(o.length,I),v=A[0],b=A[1],y=A[2];if(c=[],y>0)for(f=v;f<b;f+=y)c.push(o[f]);else for(f=v;f>b;f+=y)c.push(o[f]);return c;case"Projection":var w=this.visit(e.children[0],o);if(!t(w))return null;for(m=[],f=0;f<w.length;f++)l=this.visit(e.children[1],w[f]),null!==l&&m.push(l);return m;case"ValueProjection":if(w=this.visit(e.children[0],o),!i(w))return null;m=[];var S=s(w);for(f=0;f<S.length;f++)l=this.visit(e.children[1],S[f]),null!==l&&m.push(l);return m;case"FilterProjection":if(w=this.visit(e.children[0],o),!t(w))return null;var x=[],B=[];for(f=0;f<w.length;f++)a=this.visit(e.children[2],w[f]),r(a)||x.push(w[f]);for(var Z=0;Z<x.length;Z++)l=this.visit(e.children[1],x[Z]),null!==l&&B.push(l);return B;case"Comparator":switch(h=this.visit(e.children[0],o),d=this.visit(e.children[1],o),e.name){case G:c=n(h,d);break;case $:c=!n(h,d);break;case T:c=h>d;break;case _:c=h>=d;break;case W:c=h<d;break;case H:c=h<=d;break;default:throw new Error("Unknown comparator: "+e.name)}return c;case V:var L=this.visit(e.children[0],o);if(!t(L))return null;var N=[];for(f=0;f<L.length;f++)l=L[f],t(l)?N.push.apply(N,l):N.push(l);return N;case"Identity":return o;case"MultiSelectList":if(null===o)return null;for(m=[],f=0;f<e.children.length;f++)m.push(this.visit(e.children[f],o));return m;case"MultiSelectHash":if(null===o)return null;var O;for(m={},f=0;f<e.children.length;f++)O=e.children[f],m[O.name]=this.visit(O.value,o);return m;case"OrExpression":return a=this.visit(e.children[0],o),r(a)&&(a=this.visit(e.children[1],o)),a;case"AndExpression":return h=this.visit(e.children[0],o),!0===r(h)?h:this.visit(e.children[1],o);case"NotExpression":return h=this.visit(e.children[0],o),r(h);case"Literal":return e.value;case E:return g=this.visit(e.children[0],o),this.visit(e.children[1],g);case k:return o;case"Function":var F=[];for(f=0;f<e.children.length;f++)F.push(this.visit(e.children[f],o));return this.runtime.callFunction(e.name,F);case"ExpressionReference":var P=e.children[0];return P.jmespathType=R,P;default:throw new Error("Unknown node type: "+e.type)}},computeSliceParams:function(e,t){var i=t[0],n=t[1],r=t[2],s=[null,null,null];if(null===r)r=1;else if(0===r){var o=new Error("Invalid slice, step cannot be 0");throw o.name="RuntimeError",o}var a=r<0;return i=null===i?a?e-1:0:this.capSliceRange(e,i,r),n=null===n?a?-1:e:this.capSliceRange(e,n,r),s[0]=i,s[1]=n,s[2]=r,s},capSliceRange:function(e,t,i){return t<0?(t+=e,t<0&&(t=i<0?-1:0)):t>=e&&(t=i<0?e-1:e),t}},ie.prototype={callFunction:function(e,t){var i=this.functionTable[e];if(void 0===i)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,i._signature),i._func.call(this,t)},_validateArgs:function(e,t,i){var n,r,s,o;if(i[i.length-1].variadic){if(t.length<i.length)throw n=1===i.length?" argument":" arguments",new Error("ArgumentError: "+e+"() takes at least"+i.length+n+" but received "+t.length)}else if(t.length!==i.length)throw n=1===i.length?" argument":" arguments",new Error("ArgumentError: "+e+"() takes "+i.length+n+" but received "+t.length);for(var a=0;a<i.length;a++){o=!1,r=i[a].types,s=this._getTypeName(t[a]);for(var l=0;l<r.length;l++)if(this._typeMatches(s,r[l],t[a])){o=!0;break}if(!o)throw new Error("TypeError: "+e+"() expected argument "+(a+1)+" to be type "+r+" but received type "+s+" instead.")}},_typeMatches:function(e,t,i){if(t===l)return!0;if(t!==f&&t!==m&&t!==h)return e===t;if(t===h)return e===h;if(e===h){var n;t===m?n=a:t===f&&(n=c);for(var r=0;r<i.length;r++)if(!this._typeMatches(this._getTypeName(i[r]),n,i[r]))return!1;return!0}},_getTypeName:function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return c;case"[object Number]":return a;case"[object Array]":return h;case"[object Boolean]":return u;case"[object Null]":return p;case"[object Object]":return e.jmespathType===R?g:d}},_functionStartsWith:function(e){return 0===e[0].lastIndexOf(e[1])},_functionEndsWith:function(e){var t=e[0],i=e[1];return-1!==t.indexOf(i,t.length-i.length)},_functionReverse:function(e){var t=this._getTypeName(e[0]);if(t===c){for(var i=e[0],n="",r=i.length-1;r>=0;r--)n+=i[r];return n}var s=e[0].slice(0);return s.reverse(),s},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,i=e[0],n=0;n<i.length;n++)t+=i[n];return t/i.length},_functionContains:function(e){return e[0].indexOf(e[1])>=0},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return i(e[0])?Object.keys(e[0]).length:e[0].length},_functionMap:function(e){for(var t=[],i=this._interpreter,n=e[0],r=e[1],s=0;s<r.length;s++)t.push(i.visit(n,r[s]));return t},_functionMerge:function(e){for(var t={},i=0;i<e.length;i++){var n=e[i];for(var r in n)t[r]=n[r]}return t},_functionMax:function(e){if(e[0].length>0){var t=this._getTypeName(e[0][0]);if(t===a)return Math.max.apply(Math,e[0]);for(var i=e[0],n=i[0],r=1;r<i.length;r++)n.localeCompare(i[r])<0&&(n=i[r]);return n}return null},_functionMin:function(e){if(e[0].length>0){var t=this._getTypeName(e[0][0]);if(t===a)return Math.min.apply(Math,e[0]);for(var i=e[0],n=i[0],r=1;r<i.length;r++)i[r].localeCompare(n)<0&&(n=i[r]);return n}return null},_functionSum:function(e){for(var t=0,i=e[0],n=0;n<i.length;n++)t+=i[n];return t},_functionType:function(e){switch(this._getTypeName(e[0])){case a:return"number";case c:return"string";case h:return"array";case d:return"object";case u:return"boolean";case g:return"expref";case p:return"null"}},_functionKeys:function(e){return Object.keys(e[0])},_functionValues:function(e){for(var t=e[0],i=Object.keys(t),n=[],r=0;r<i.length;r++)n.push(t[i[r]]);return n},_functionJoin:function(e){var t=e[0],i=e[1];return i.join(t)},_functionToArray:function(e){return this._getTypeName(e[0])===h?e[0]:[e[0]]},_functionToString:function(e){return this._getTypeName(e[0])===c?e[0]:JSON.stringify(e[0])},_functionToNumber:function(e){var t,i=this._getTypeName(e[0]);return i===a?e[0]:i!==c||(t=+e[0],isNaN(t))?null:t},_functionNotNull:function(e){for(var t=0;t<e.length;t++)if(this._getTypeName(e[t])!==p)return e[t];return null},_functionSort:function(e){var t=e[0].slice(0);return t.sort(),t},_functionSortBy:function(e){var t=e[0].slice(0);if(0===t.length)return t;var i=this._interpreter,n=e[1],r=this._getTypeName(i.visit(n,t[0]));if([a,c].indexOf(r)<0)throw new Error("TypeError");for(var s=this,o=[],l=0;l<t.length;l++)o.push([l,t[l]]);o.sort((function(e,t){var o=i.visit(n,e[1]),a=i.visit(n,t[1]);if(s._getTypeName(o)!==r)throw new Error("TypeError: expected "+r+", received "+s._getTypeName(o));if(s._getTypeName(a)!==r)throw new Error("TypeError: expected "+r+", received "+s._getTypeName(a));return o>a?1:o<a?-1:e[0]-t[0]}));for(var h=0;h<o.length;h++)t[h]=o[h][1];return t},_functionMaxBy:function(e){for(var t,i,n=e[1],r=e[0],s=this.createKeyFunction(n,[a,c]),o=-1/0,l=0;l<r.length;l++)i=s(r[l]),i>o&&(o=i,t=r[l]);return t},_functionMinBy:function(e){for(var t,i,n=e[1],r=e[0],s=this.createKeyFunction(n,[a,c]),o=1/0,l=0;l<r.length;l++)i=s(r[l]),i<o&&(o=i,t=r[l]);return t},createKeyFunction:function(e,t){var i=this,n=this._interpreter,r=function(r){var s=n.visit(e,r);if(t.indexOf(i._getTypeName(s))<0){var o="TypeError: expected one of "+t+", received "+i._getTypeName(s);throw new Error(o)}return s};return r}},e.tokenize=re,e.compile=ne,e.search=se,e.strictDeepEqual=n})(t)},function(e,t,i){t.tryRequireThemeJsonEditor=function(){try{i(42)}catch(e){}}},function(e,t,i){"use strict";var n=i(20),r=i(13),s=i(80),o=s.treeModeMixins,a=i(21),l=a.textModeMixins,c=i(81),h=c.previewModeMixins,d=i(0),u=d.clear,g=d.extend,p=d.getInnerText,m=d.getInternetExplorerVersion,f=d.parse,C=i(43),I=C.tryRequireAjv,A=i(6),v=A.showTransformModal,b=i(5),y=b.showSortModal,w=I();function S(e,t,i){if(!(this instanceof S))throw new Error('JSONEditor constructor called without "new".');var n=m();if(-1!==n&&n<9)throw new Error("Unsupported browser, IE9 or newer required. Please install the newest version of your browser.");t&&(t.error&&(t.onError=t.error,delete t.error),t.change&&(t.onChange=t.change,delete t.change),t.editable&&(t.onEditable=t.editable,delete t.editable),t.onChangeJSON&&("text"===t.mode||"code"===t.mode||t.modes&&(-1!==t.modes.indexOf("text")||t.modes.indexOf("code"))),t&&Object.keys(t).forEach((function(e){S.VALID_OPTIONS.indexOf(e)}))),arguments.length&&this._create(e,t,i)}S.modes={},S.prototype.DEBOUNCE_INTERVAL=150,S.VALID_OPTIONS=["ajv","schema","schemaRefs","templates","ace","theme","autocomplete","onChange","onChangeJSON","onChangeText","onEditable","onError","onEvent","onModeChange","onNodeName","onValidate","onCreateMenu","onSelectionChange","onTextSelectionChange","onClassName","onFocus","onBlur","colorPicker","onColorPicker","timestampTag","timestampFormat","escapeUnicode","history","search","mode","modes","name","indentation","sortObjectKeys","navigationBar","statusBar","mainMenuBar","languages","language","enableSort","enableTransform","limitDragging","maxVisibleChilds","onValidationError","modalAnchor","popupAnchor","createQuery","executeQuery","queryDescription"],S.prototype._create=function(e,t,i){this.container=e,this.options=t||{},this.json=i||{};var n=this.options.mode||this.options.modes&&this.options.modes[0]||"tree";this.setMode(n)},S.prototype.destroy=function(){},S.prototype.set=function(e){this.json=e},S.prototype.get=function(){return this.json},S.prototype.setText=function(e){this.json=f(e)},S.prototype.getText=function(){return JSON.stringify(this.json)},S.prototype.setName=function(e){this.options||(this.options={}),this.options.name=e},S.prototype.getName=function(){return this.options&&this.options.name},S.prototype.setMode=function(e){if(e!==this.options.mode||!this.create){var t,i,n=this.container,r=g({},this.options),s=r.mode;r.mode=e;var o=S.modes[e];if(!o)throw new Error('Unknown mode "'+r.mode+'"');try{var a="text"===o.data;if(i=this.getName(),t=this[a?"getText":"get"](),this.destroy(),u(this),g(this,o.mixin),this.create(n,r),this.setName(i),this[a?"setText":"set"](t),"function"===typeof o.load)try{o.load.call(this)}catch(l){}if("function"===typeof r.onModeChange&&e!==s)try{r.onModeChange(e,s)}catch(l){}}catch(l){this._onError(l)}}},S.prototype.getMode=function(){return this.options.mode},S.prototype._onError=function(e){if(!this.options||"function"!==typeof this.options.onError)throw e;this.options.onError(e)},S.prototype.setSchema=function(e,t){if(e){var n;try{this.options.ajv?n=this.options.ajv:(n=w({allErrors:!0,verbose:!0,schemaId:"auto",$data:!0}),n.addMetaSchema(i(78)),n.addMetaSchema(i(79)))}catch(s){}if(n){if(t){for(var r in t)n.removeSchema(r),t[r]&&n.addSchema(t[r],r);this.options.schemaRefs=t}this.validateSchema=n.compile(e),this.options.schema=e,this.validate()}this.refresh()}else this.validateSchema=null,this.options.schema=null,this.options.schemaRefs=null,this.validate(),this.refresh()},S.prototype.validate=function(){},S.prototype.refresh=function(){},S.registerMode=function(e){var t,i;if(Array.isArray(e))for(t=0;t<e.length;t++)S.registerMode(e[t]);else{if(!("mode"in e))throw new Error('Property "mode" missing');if(!("mixin"in e))throw new Error('Property "mixin" missing');if(!("data"in e))throw new Error('Property "data" missing');var n=e.mode;if(n in S.modes)throw new Error('Mode "'+n+'" already registered');if("function"!==typeof e.mixin.create)throw new Error('Required function "create" missing on mixin');var r=["setMode","registerMode","modes"];for(t=0;t<r.length;t++)if(i=r[t],i in e.mixin)throw new Error('Reserved property "'+i+'" not allowed in mixin');S.modes[n]=e}},S.registerMode(o),S.registerMode(l),S.registerMode(h),S.ace=n,S.Ajv=w,S.VanillaPicker=r,S.showTransformModal=v,S.showSortModal=y,S.getInnerText=p,S["default"]=S,e.exports=S},function(e,t,i){(function(e){(function(){var e="ace",t=function(){return this}();if(t||"undefined"==typeof window||(t=window),e||"undefined"===typeof requirejs){var i=function(e,t,n){"string"===typeof e?(2==arguments.length&&(n=t),i.modules[e]||(i.payloads[e]=n,i.modules[e]=null)):i.original&&i.original.apply(this,arguments)};i.modules={},i.payloads={};var n=function(e,t,i){if("string"===typeof t){var n=o(e,t);if(void 0!=n)return i&&i(),n}else if("[object Array]"===Object.prototype.toString.call(t)){for(var s=[],a=0,l=t.length;a<l;++a){var c=o(e,t[a]);if(void 0==c&&r.original)return;s.push(c)}return i&&i.apply(null,s)||!0}},r=function(e,t){var i=n("",e,t);return void 0==i&&r.original?r.original.apply(this,arguments):i},s=function(e,t){if(-1!==t.indexOf("!")){var i=t.split("!");return s(e,i[0])+"!"+s(e,i[1])}if("."==t.charAt(0)){var n=e.split("/").slice(0,-1).join("/");t=n+"/"+t;while(-1!==t.indexOf(".")&&r!=t){var r=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},o=function(e,t){t=s(e,t);var r=i.modules[t];if(!r){if(r=i.payloads[t],"function"===typeof r){var o={},a={id:t,uri:"",exports:o,packaged:!0},l=function(e,i){return n(t,e,i)},c=r(l,o,a);o=c||a.exports,i.modules[t]=o,delete i.payloads[t]}r=i.modules[t]=o||r}return r};a(e)}function a(e){var n=t;e&&(t[e]||(t[e]={}),n=t[e]),n.define&&n.define.packaged||(i.original=n.define,n.define=i,n.define.packaged=!0),n.require&&n.require.packaged||(r.original=n.require,n.require=r,n.require.packaged=!0)}})(),ace.define("ace/lib/regexp",["require","exports","module"],(function(e,t,i){"use strict";var n={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},r=void 0===n.exec.call(/()??/,"")[1],s=function(){var e=/^/g;return n.test.call(e,""),!e.lastIndex}();function o(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function a(e,t,i){if(Array.prototype.indexOf)return e.indexOf(t,i);for(var n=i||0;n<e.length;n++)if(e[n]===t)return n;return-1}s&&r||(RegExp.prototype.exec=function(e){var t,i,l=n.exec.apply(this,arguments);if("string"==typeof e&&l){if(!r&&l.length>1&&a(l,"")>-1&&(i=RegExp(this.source,n.replace.call(o(this),"g","")),n.replace.call(e.slice(l.index),i,(function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(l[e]=void 0)}))),this._xregexp&&this._xregexp.captureNames)for(var c=1;c<l.length;c++)t=this._xregexp.captureNames[c-1],t&&(l[t]=l[c]);!s&&this.global&&!l[0].length&&this.lastIndex>l.index&&this.lastIndex--}return l},s||(RegExp.prototype.test=function(e){var t=n.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t}))})),ace.define("ace/lib/es5-shim",["require","exports","module"],(function(e,t,i){function n(){}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError("Function.prototype.bind called on incompatible "+t);var i=u.call(arguments,1),r=function(){if(this instanceof r){var n=t.apply(this,i.concat(u.call(arguments)));return Object(n)===n?n:this}return t.apply(e,i.concat(u.call(arguments)))};return t.prototype&&(n.prototype=t.prototype,r.prototype=new n,n.prototype=null),r});var r,s,o,a,l,c=Function.prototype.call,h=Array.prototype,d=Object.prototype,u=h.slice,g=c.bind(d.toString),p=c.bind(d.hasOwnProperty);if((l=p(d,"__defineGetter__"))&&(r=c.bind(d.__defineGetter__),s=c.bind(d.__defineSetter__),o=c.bind(d.__lookupGetter__),a=c.bind(d.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t,i=[];if(i.splice.apply(i,e(20)),i.splice.apply(i,e(26)),t=i.length,i.splice(5,0,"XXX"),i.length,t+1==i.length)return!0}()){var m=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?m.apply(this,[void 0===e?0:e,void 0===t?this.length-e:t].concat(u.call(arguments,2))):[]}}else Array.prototype.splice=function(e,t){var i=this.length;e>0?e>i&&(e=i):void 0==e?e=0:e<0&&(e=Math.max(i+e,0)),e+t<i||(t=i-e);var n=this.slice(e,e+t),r=u.call(arguments,2),s=r.length;if(e===i)s&&this.push.apply(this,r);else{var o=Math.min(t,i-e),a=e+o,l=a+s-o,c=i-a,h=i-o;if(l<a)for(var d=0;d<c;++d)this[l+d]=this[a+d];else if(l>a)for(d=c;d--;)this[l+d]=this[a+d];if(s&&e===h)this.length=h,this.push.apply(this,r);else for(this.length=h+s,d=0;d<s;++d)this[e+d]=r[d]}return n};Array.isArray||(Array.isArray=function(e){return"[object Array]"==g(e)});var f,C=Object("a"),I="a"!=C[0]||!(0 in C);if(Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=H(this),i=I&&"[object String]"==g(this)?this.split(""):t,n=arguments[1],r=-1,s=i.length>>>0;if("[object Function]"!=g(e))throw new TypeError;while(++r<s)r in i&&e.call(n,i[r],r,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=H(this),i=I&&"[object String]"==g(this)?this.split(""):t,n=i.length>>>0,r=Array(n),s=arguments[1];if("[object Function]"!=g(e))throw new TypeError(e+" is not a function");for(var o=0;o<n;o++)o in i&&(r[o]=e.call(s,i[o],o,t));return r}),Array.prototype.filter||(Array.prototype.filter=function(e){var t,i=H(this),n=I&&"[object String]"==g(this)?this.split(""):i,r=n.length>>>0,s=[],o=arguments[1];if("[object Function]"!=g(e))throw new TypeError(e+" is not a function");for(var a=0;a<r;a++)a in n&&(t=n[a],e.call(o,t,a,i)&&s.push(t));return s}),Array.prototype.every||(Array.prototype.every=function(e){var t=H(this),i=I&&"[object String]"==g(this)?this.split(""):t,n=i.length>>>0,r=arguments[1];if("[object Function]"!=g(e))throw new TypeError(e+" is not a function");for(var s=0;s<n;s++)if(s in i&&!e.call(r,i[s],s,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=H(this),i=I&&"[object String]"==g(this)?this.split(""):t,n=i.length>>>0,r=arguments[1];if("[object Function]"!=g(e))throw new TypeError(e+" is not a function");for(var s=0;s<n;s++)if(s in i&&e.call(r,i[s],s,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=H(this),i=I&&"[object String]"==g(this)?this.split(""):t,n=i.length>>>0;if("[object Function]"!=g(e))throw new TypeError(e+" is not a function");if(!n&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var r,s=0;if(arguments.length>=2)r=arguments[1];else do{if(s in i){r=i[s++];break}if(++s>=n)throw new TypeError("reduce of empty array with no initial value")}while(1);for(;s<n;s++)s in i&&(r=e.call(void 0,r,i[s],s,t));return r}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=H(this),i=I&&"[object String]"==g(this)?this.split(""):t,n=i.length>>>0;if("[object Function]"!=g(e))throw new TypeError(e+" is not a function");if(!n&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var r,s=n-1;if(arguments.length>=2)r=arguments[1];else do{if(s in i){r=i[s--];break}if(--s<0)throw new TypeError("reduceRight of empty array with no initial value")}while(1);do{s in this&&(r=e.call(void 0,r,i[s],s,t))}while(s--);return r}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(e){var t=I&&"[object String]"==g(this)?this.split(""):H(this),i=t.length>>>0;if(!i)return-1;var n=0;for(arguments.length>1&&(n=_(arguments[1])),n=n>=0?n:Math.max(0,i+n);n<i;n++)if(n in t&&t[n]===e)return n;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(e){var t=I&&"[object String]"==g(this)?this.split(""):H(this),i=t.length>>>0;if(!i)return-1;var n=i-1;for(arguments.length>1&&(n=Math.min(n,_(arguments[1]))),n=n>=0?n:i-Math.abs(n);n>=0;n--)if(n in t&&e===t[n])return n;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:d)}),!Object.getOwnPropertyDescriptor){var A="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(e,t){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError(A+e);if(p(e,t)){var i;if(i={enumerable:!0,configurable:!0},l){var n=e.__proto__;e.__proto__=d;var r=o(e,t),s=a(e,t);if(e.__proto__=n,r||s)return r&&(i.get=r),s&&(i.set=s),i}return i.value=e[t],i}}}(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)}),Object.create)||(f=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var i;if(null===e)i=f();else{if("object"!=typeof e)throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var n=function(){};n.prototype=e,i=new n,i.__proto__=e}return void 0!==t&&Object.defineProperties(i,t),i});function v(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}if(Object.defineProperty){var b=v({}),y="undefined"==typeof document||v(document.createElement("div"));if(!b||!y)var w=Object.defineProperty}if(!Object.defineProperty||w){var S="Property description must be an object: ",x="Object.defineProperty called on non-object: ",k="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(e,t,i){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError(x+e);if("object"!=typeof i&&"function"!=typeof i||null===i)throw new TypeError(S+i);if(w)try{return w.call(Object,e,t,i)}catch(c){}if(p(i,"value"))if(l&&(o(e,t)||a(e,t))){var n=e.__proto__;e.__proto__=d,delete e[t],e[t]=i.value,e.__proto__=n}else e[t]=i.value;else{if(!l)throw new TypeError(k);p(i,"get")&&r(e,t,i.get),p(i,"set")&&s(e,t,i.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var i in t)p(t,i)&&Object.defineProperty(e,i,t[i]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze((function(){}))}catch($){Object.freeze=function(e){return function(t){return"function"==typeof t?t:e(t)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;var t="";while(p(e,t))t+="?";e[t]=!0;var i=p(e,t);return delete e[t],i}),!Object.keys){var R=!0,E=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],B=E.length;for(var Z in{toString:null})R=!1;Object.keys=function(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.keys called on a non-object");var t=[];for(var i in e)p(e,i)&&t.push(i);if(R)for(var n=0,r=B;n<r;n++){var s=E[n];p(e,s)&&t.push(s)}return t}}Date.now||(Date.now=function(){return(new Date).getTime()});var G="\t\n\v\f\r \u2028\u2029\ufeff";if(!String.prototype.trim){G="["+G+"]";var T=new RegExp("^"+G+G+"*"),W=new RegExp(G+G+"*$");String.prototype.trim=function(){return String(this).replace(T,"").replace(W,"")}}function _(e){return e=+e,e!==e?e=0:0!==e&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}var H=function(e){if(null==e)throw new TypeError("can't convert "+e+" to object");return Object(e)}})),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],(function(e,t,i){"use strict";e("./regexp"),e("./es5-shim"),"undefined"==typeof Element||Element.prototype.remove||Object.defineProperty(Element.prototype,"remove",{enumerable:!1,writable:!0,configurable:!0,value:function(){this.parentNode&&this.parentNode.removeChild(this)}})})),ace.define("ace/lib/useragent",["require","exports","module"],(function(e,t,i){"use strict";t.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},t.getOS=function(){return t.isMac?t.OS.MAC:t.isLinux?t.OS.LINUX:t.OS.WINDOWS};var n="object"==typeof navigator?navigator:{},r=(/mac|win|linux/i.exec(n.platform)||["other"])[0].toLowerCase(),s=n.userAgent||"",o=n.appName||"";t.isWin="win"==r,t.isMac="mac"==r,t.isLinux="linux"==r,t.isIE="Microsoft Internet Explorer"==o||o.indexOf("MSAppHost")>=0?parseFloat((s.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((s.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=s.match(/ Gecko\/\d+/),t.isOpera="object"==typeof opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),t.isWebKit=parseFloat(s.split("WebKit/")[1])||void 0,t.isChrome=parseFloat(s.split(" Chrome/")[1])||void 0,t.isEdge=parseFloat(s.split(" Edge/")[1])||void 0,t.isAIR=s.indexOf("AdobeAIR")>=0,t.isAndroid=s.indexOf("Android")>=0,t.isChromeOS=s.indexOf(" CrOS ")>=0,t.isIOS=/iPad|iPhone|iPod/.test(s)&&!window.MSStream,t.isIOS&&(t.isMac=!0),t.isMobile=t.isIOS||t.isAndroid})),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],(function(e,t,i){"use strict";var n=e("./useragent"),r="http://www.w3.org/1999/xhtml";if(t.buildDom=function e(t,i,n){if("string"==typeof t&&t){var r=document.createTextNode(t);return i&&i.appendChild(r),r}if(!Array.isArray(t))return t&&t.appendChild&&i&&i.appendChild(t),t;if("string"!=typeof t[0]||!t[0]){for(var s=[],o=0;o<t.length;o++){var a=e(t[o],i,n);a&&s.push(a)}return s}var l=document.createElement(t[0]),c=t[1],h=1;c&&"object"==typeof c&&!Array.isArray(c)&&(h=2);for(o=h;o<t.length;o++)e(t[o],l,n);return 2==h&&Object.keys(c).forEach((function(e){var t=c[e];"class"===e?l.className=Array.isArray(t)?t.join(" "):t:"function"==typeof t||"value"==e||"$"==e[0]?l[e]=t:"ref"===e?n&&(n[t]=l):null!=t&&l.setAttribute(e,t)})),i&&i.appendChild(l),l},t.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},t.createElement=function(e,t){return document.createElementNS?document.createElementNS(t||r,e):document.createElement(e)},t.removeChildren=function(e){e.innerHTML=""},t.createTextNode=function(e,t){var i=t?t.ownerDocument:document;return i.createTextNode(e)},t.createFragment=function(e){var t=e?e.ownerDocument:document;return t.createDocumentFragment()},t.hasCssClass=function(e,t){var i=(e.className+"").split(/\s+/g);return-1!==i.indexOf(t)},t.addCssClass=function(e,i){t.hasCssClass(e,i)||(e.className+=" "+i)},t.removeCssClass=function(e,t){var i=e.className.split(/\s+/g);while(1){var n=i.indexOf(t);if(-1==n)break;i.splice(n,1)}e.className=i.join(" ")},t.toggleCssClass=function(e,t){var i=e.className.split(/\s+/g),n=!0;while(1){var r=i.indexOf(t);if(-1==r)break;n=!1,i.splice(r,1)}return n&&i.push(t),e.className=i.join(" "),n},t.setCssClass=function(e,i,n){n?t.addCssClass(e,i):t.removeCssClass(e,i)},t.hasCssString=function(e,t){var i,n=0;if(t=t||document,i=t.querySelectorAll("style"))while(n<i.length)if(i[n++].id===e)return!0},t.importCssString=function(e,i,n){var r=n;n&&n.getRootNode?(r=n.getRootNode(),r&&r!=n||(r=document)):r=document;var s=r.ownerDocument||r;if(i&&t.hasCssString(i,r))return null;i&&(e+="\n/*# sourceURL=ace/css/"+i+" */");var o=t.createElement("style");o.appendChild(s.createTextNode(e)),i&&(o.id=i),r==s&&(r=t.getDocumentHead(s)),r.insertBefore(o,r.firstChild)},t.importCssStylsheet=function(e,i){t.buildDom(["link",{rel:"stylesheet",href:e}],t.getDocumentHead(i))},t.scrollbarWidth=function(e){var i=t.createElement("ace_inner");i.style.width="100%",i.style.minWidth="0px",i.style.height="200px",i.style.display="block";var n=t.createElement("ace_outer"),r=n.style;r.position="absolute",r.left="-10000px",r.overflow="hidden",r.width="200px",r.minWidth="0px",r.height="150px",r.display="block",n.appendChild(i);var s=e.documentElement;s.appendChild(n);var o=i.offsetWidth;r.overflow="scroll";var a=i.offsetWidth;return o==a&&(a=n.clientWidth),s.removeChild(n),o-a},"undefined"==typeof document&&(t.importCssString=function(){}),t.computedStyle=function(e,t){return window.getComputedStyle(e,"")||{}},t.setStyle=function(e,t,i){e[t]!==i&&(e[t]=i)},t.HAS_CSS_ANIMATION=!1,t.HAS_CSS_TRANSFORMS=!1,t.HI_DPI=!n.isWin||"undefined"!==typeof window&&window.devicePixelRatio>=1.5,"undefined"!==typeof document){var s=document.createElement("div");t.HI_DPI&&void 0!==s.style.transform&&(t.HAS_CSS_TRANSFORMS=!0),n.isEdge||"undefined"===typeof s.style.animationName||(t.HAS_CSS_ANIMATION=!0),s=null}t.HAS_CSS_TRANSFORMS?t.translate=function(e,t,i){e.style.transform="translate("+Math.round(t)+"px, "+Math.round(i)+"px)"}:t.translate=function(e,t,i){e.style.top=Math.round(i)+"px",e.style.left=Math.round(t)+"px"}})),ace.define("ace/lib/oop",["require","exports","module"],(function(e,t,i){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var i in t)e[i]=t[i];return e},t.implement=function(e,i){t.mixin(e,i)}})),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],(function(e,t,i){"use strict";var n=e("./oop"),r=function(){var e,t,i={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta",91:"MetaLeft",92:"MetaRight",93:"ContextMenu"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,super:8,meta:8,command:8,cmd:8,control:1},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}};for(t in i.FUNCTION_KEYS)e=i.FUNCTION_KEYS[t].toLowerCase(),i[e]=parseInt(t,10);for(t in i.PRINTABLE_KEYS)e=i.PRINTABLE_KEYS[t].toLowerCase(),i[e]=parseInt(t,10);return n.mixin(i,i.MODIFIER_KEYS),n.mixin(i,i.PRINTABLE_KEYS),n.mixin(i,i.FUNCTION_KEYS),i.enter=i["return"],i.escape=i.esc,i.del=i["delete"],i[173]="-",function(){for(var e=["cmd","ctrl","alt","shift"],t=Math.pow(2,e.length);t--;)i.KEY_MODS[t]=e.filter((function(e){return t&i.KEY_MODS[e]})).join("-")+"-"}(),i.KEY_MODS[0]="",i.KEY_MODS[-1]="input-",i}();n.mixin(t,r),t.keyCodeToString=function(e){var t=r[e];return"string"!=typeof t&&(t=String.fromCharCode(e)),t.toLowerCase()}})),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],(function(e,t,i){"use strict";var n,r=e("./keys"),s=e("./useragent"),o=null,a=0;function l(){n=!1;try{document.createComment("").addEventListener("test",(function(){}),{get passive(){n={passive:!1}}})}catch(e){}}function c(){return void 0==n&&l(),n}function h(e,t,i){this.elem=e,this.type=t,this.callback=i}h.prototype.destroy=function(){u(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var d=t.addListener=function(e,t,i,n){e.addEventListener(t,i,c()),n&&n.$toDestroy.push(new h(e,t,i))},u=t.removeListener=function(e,t,i){e.removeEventListener(t,i,c())};t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation&&e.stopPropagation()},t.preventDefault=function(e){e.preventDefault&&e.preventDefault()},t.getButton=function(e){return"dblclick"==e.type?0:"contextmenu"==e.type||s.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.button},t.capture=function(e,t,i){function n(e){t&&t(e),i&&i(e),u(document,"mousemove",t),u(document,"mouseup",n),u(document,"dragstart",n)}return d(document,"mousemove",t),d(document,"mouseup",n),d(document,"dragstart",n),n},t.addMouseWheelListener=function(e,t,i){"onmousewheel"in e?d(e,"mousewheel",(function(e){var i=8;void 0!==e.wheelDeltaX?(e.wheelX=-e.wheelDeltaX/i,e.wheelY=-e.wheelDeltaY/i):(e.wheelX=0,e.wheelY=-e.wheelDelta/i),t(e)}),i):"onwheel"in e?d(e,"wheel",(function(e){var i=.35;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=e.deltaX*i||0,e.wheelY=e.deltaY*i||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=5*(e.deltaX||0),e.wheelY=5*(e.deltaY||0);break}t(e)}),i):d(e,"DOMMouseScroll",(function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=5*(e.detail||0),e.wheelY=0):(e.wheelX=0,e.wheelY=5*(e.detail||0)),t(e)}),i)},t.addMultiMouseDownListener=function(e,i,n,r,o){var a,l,c,h=0,u={2:"dblclick",3:"tripleclick",4:"quadclick"};function g(e){if(0!==t.getButton(e)?h=0:e.detail>1?(h++,h>4&&(h=1)):h=1,s.isIE){var o=Math.abs(e.clientX-a)>5||Math.abs(e.clientY-l)>5;c&&!o||(h=1),c&&clearTimeout(c),c=setTimeout((function(){c=null}),i[h-1]||600),1==h&&(a=e.clientX,l=e.clientY)}if(e._clicks=h,n[r]("mousedown",e),h>4)h=0;else if(h>1)return n[r](u[h],e)}Array.isArray(e)||(e=[e]),e.forEach((function(e){d(e,"mousedown",g,o)}))};var g=function(e){return 0|(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0)};function p(e,t,i){var n=g(t);if(!s.isMac&&o){if(t.getModifierState&&(t.getModifierState("OS")||t.getModifierState("Win"))&&(n|=8),o.altGr){if(3==(3&n))return;o.altGr=0}if(18===i||17===i){var l="location"in t?t.location:t.keyLocation;if(17===i&&1===l)1==o[i]&&(a=t.timeStamp);else if(18===i&&3===n&&2===l){var c=t.timeStamp-a;c<50&&(o.altGr=!0)}}}if(i in r.MODIFIER_KEYS&&(i=-1),!n&&13===i){l="location"in t?t.location:t.keyLocation;if(3===l&&(e(t,n,-i),t.defaultPrevented))return}if(s.isChromeOS&&8&n){if(e(t,n,i),t.defaultPrevented)return;n&=-9}return!!(n||i in r.FUNCTION_KEYS||i in r.PRINTABLE_KEYS)&&e(t,n,i)}function m(){o=Object.create(null)}if(t.getModifierString=function(e){return r.KEY_MODS[g(e)]},t.addCommandKeyListener=function(e,i,n){if(s.isOldGecko||s.isOpera&&!("KeyboardEvent"in window)){var r=null;d(e,"keydown",(function(e){r=e.keyCode}),n),d(e,"keypress",(function(e){return p(i,e,r)}),n)}else{var a=null;d(e,"keydown",(function(e){o[e.keyCode]=(o[e.keyCode]||0)+1;var t=p(i,e,e.keyCode);return a=e.defaultPrevented,t}),n),d(e,"keypress",(function(e){a&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),a=null)}),n),d(e,"keyup",(function(e){o[e.keyCode]=null}),n),o||(m(),d(window,"focus",m))}},"object"==typeof window&&window.postMessage&&!s.isOldIE){var f=1;t.nextTick=function(e,i){i=i||window;var n="zero-timeout-message-"+f++,r=function(s){s.data==n&&(t.stopPropagation(s),u(i,"message",r),e())};d(i,"message",r),i.postMessage(n,"*")}}t.$idleBlocked=!1,t.onIdle=function(e,i){return setTimeout((function i(){t.$idleBlocked?setTimeout(i,100):e()}),i)},t.$idleBlockId=null,t.blockIdle=function(e){t.$idleBlockId&&clearTimeout(t.$idleBlockId),t.$idleBlocked=!0,t.$idleBlockId=setTimeout((function(){t.$idleBlocked=!1}),e||100)},t.nextFrame="object"==typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}})),ace.define("ace/range",["require","exports","module"],(function(e,t,i){"use strict";var n=function(e,t){return e.row-t.row||e.column-t.column},r=function(e,t,i,n){this.start={row:e,column:t},this.end={row:i,column:n}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return 0==this.compare(e,t)},this.compareRange=function(e){var t,i=e.end,n=e.start;return t=this.compare(i.row,i.column),1==t?(t=this.compare(n.row,n.column),1==t?2:0==t?1:0):-1==t?-2:(t=this.compare(n.row,n.column),-1==t?-1:1==t?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return 0==this.comparePoint(e.start)&&0==this.comparePoint(e.end)},this.intersects=function(e){var t=this.compareRange(e);return-1==t||0==t||1==t},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){"object"==typeof e?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){"object"==typeof e?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return 0==this.compare(e,t)&&(!this.isEnd(e,t)&&!this.isStart(e,t))},this.insideStart=function(e,t){return 0==this.compare(e,t)&&!this.isEnd(e,t)},this.insideEnd=function(e,t){return 0==this.compare(e,t)&&!this.isStart(e,t)},this.compare=function(e,t){return this.isMultiLine()||e!==this.start.row?e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0:t<this.start.column?-1:t>this.end.column?1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var i={row:t+1,column:0};else if(this.end.row<e)i={row:e,column:0};if(this.start.row>t)var n={row:t+1,column:0};else if(this.start.row<e)n={row:e,column:0};return r.fromPoints(n||this.start,i||this.end)},this.extend=function(e,t){var i=this.compare(e,t);if(0==i)return this;if(-1==i)var n={row:e,column:t};else var s={row:e,column:t};return r.fromPoints(n||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return r.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new r(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new r(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),i=e.documentToScreenPosition(this.end);return new r(t.row,t.column,i.row,i.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(r.prototype),r.fromPoints=function(e,t){return new r(e.row,e.column,t.row,t.column)},r.comparePoints=n,r.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=r})),ace.define("ace/lib/lang",["require","exports","module"],(function(e,t,i){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var i="";while(t>0)1&t&&(i+=e),(t>>=1)&&(e+=e);return i};var n=/^\s\s*/,r=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(n,"")},t.stringTrimRight=function(e){return e.replace(r,"")},t.copyObject=function(e){var t={};for(var i in e)t[i]=e[i];return t},t.copyArray=function(e){for(var t=[],i=0,n=e.length;i<n;i++)e[i]&&"object"==typeof e[i]?t[i]=this.copyObject(e[i]):t[i]=e[i];return t},t.deepCopy=function e(t){if("object"!==typeof t||!t)return t;var i;if(Array.isArray(t)){i=[];for(var n=0;n<t.length;n++)i[n]=e(t[n]);return i}if("[object Object]"!==Object.prototype.toString.call(t))return t;for(var n in i={},t)i[n]=e(t[n]);return i},t.arrayToMap=function(e){for(var t={},i=0;i<e.length;i++)t[e[i]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var i in e)t[i]=e[i];return t},t.arrayRemove=function(e,t){for(var i=0;i<=e.length;i++)t===e[i]&&e.splice(i,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return(""+e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},t.getMatchOffsets=function(e,t){var i=[];return e.replace(t,(function(e){i.push({offset:arguments[arguments.length-2],length:e.length})})),i},t.deferredCall=function(e){var t=null,i=function(){t=null,e()},n=function(e){return n.cancel(),t=setTimeout(i,e||0),n};return n.schedule=n,n.call=function(){return this.cancel(),e(),n},n.cancel=function(){return clearTimeout(t),t=null,n},n.isPending=function(){return t},n},t.delayedCall=function(e,t){var i=null,n=function(){i=null,e()},r=function(e){null==i&&(i=setTimeout(n,e||t))};return r.delay=function(e){i&&clearTimeout(i),i=setTimeout(n,e||t)},r.schedule=r,r.call=function(){this.cancel(),e()},r.cancel=function(){i&&clearTimeout(i),i=null},r.isPending=function(){return i},r}})),ace.define("ace/clipboard",["require","exports","module"],(function(e,t,i){"use strict";var n;i.exports={lineMode:!1,pasteCancelled:function(){return!!(n&&n>Date.now()-50)||(n=!1)},cancel:function(){n=Date.now()}}})),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],(function(e,t,i){"use strict";var n=e("../lib/event"),r=e("../lib/useragent"),s=e("../lib/dom"),o=e("../lib/lang"),a=e("../clipboard"),l=r.isChrome<18,c=r.isIE,h=r.isChrome>63,d=400,u=e("../lib/keys"),g=u.KEY_MODS,p=r.isIOS,m=p?/\s/:/\n/,f=r.isMobile,C=function(e,t){var i=s.createElement("textarea");i.className="ace_text-input",i.setAttribute("wrap","off"),i.setAttribute("autocorrect","off"),i.setAttribute("autocapitalize","off"),i.setAttribute("spellcheck",!1),i.style.opacity="0",e.insertBefore(i,e.firstChild);var C=!1,I=!1,A=!1,v=!1,b="";f||(i.style.fontSize="1px");var y=!1,w=!1,S="",x=0,k=0,R=0;try{var E=document.activeElement===i}catch(U){}n.addListener(i,"blur",(function(e){w||(t.onBlur(e),E=!1)}),t),n.addListener(i,"focus",(function(e){if(!w){if(E=!0,r.isEdge)try{if(!document.hasFocus())return}catch(e){}t.onFocus(e),r.isEdge?setTimeout(B):B()}}),t),this.$focusScroll=!1,this.focus=function(){if(b||h||"browser"==this.$focusScroll)return i.focus({preventScroll:!0});var e=i.style.top;i.style.position="fixed",i.style.top="0px";try{var t=0!=i.getBoundingClientRect().top}catch(U){return}var n=[];if(t){var r=i.parentElement;while(r&&1==r.nodeType)n.push(r),r.setAttribute("ace_nocontext",!0),r=!r.parentElement&&r.getRootNode?r.getRootNode().host:r.parentElement}i.focus({preventScroll:!0}),t&&n.forEach((function(e){e.removeAttribute("ace_nocontext")})),setTimeout((function(){i.style.position="","0px"==i.style.top&&(i.style.top=e)}),0)},this.blur=function(){i.blur()},this.isFocused=function(){return E},t.on("beforeEndOperation",(function(){var e=t.curOp,n=e&&e.command&&e.command.name;if("insertstring"!=n){var r=n&&(e.docChanged||e.selectionChanged);A&&r&&(S=i.value="",K()),B()}}));var B=p?function(e){if(E&&(!C||e)&&!v){e||(e="");var n="\n ab"+e+"cde fg\n";n!=i.value&&(i.value=S=n);var r=4,s=4+(e.length||(t.selection.isEmpty()?0:1));x==r&&k==s||i.setSelectionRange(r,s),x=r,k=s}}:function(){if(!A&&!v&&(E||W)){A=!0;var e=0,n=0,r="";if(t.session){var s=t.selection,o=s.getRange(),a=s.cursor.row;if(e=o.start.column,n=o.end.column,r=t.session.getLine(a),o.start.row!=a){var l=t.session.getLine(a-1);e=o.start.row<a-1?0:e,n+=l.length+1,r=l+"\n"+r}else if(o.end.row!=a){var c=t.session.getLine(a+1);n=o.end.row>a+1?c.length:n,n+=r.length+1,r=r+"\n"+c}else f&&a>0&&(r="\n"+r,n+=1,e+=1);r.length>d&&(e<d&&n<d?r=r.slice(0,d):(r="\n",e=0,n=1))}var h=r+"\n\n";if(h!=S&&(i.value=S=h,x=k=h.length),W&&(x=i.selectionStart,k=i.selectionEnd),k!=n||x!=e||i.selectionEnd!=k)try{i.setSelectionRange(e,n),x=e,k=n}catch(U){}A=!1}};this.resetSelection=B,E&&t.onFocus();var Z=function(e){return 0===e.selectionStart&&e.selectionEnd>=S.length&&e.value===S&&S&&e.selectionEnd!==k},G=function(e){A||(C?C=!1:Z(i)?(t.selectAll(),B()):f&&i.selectionStart!=x&&B())},T=null;this.setInputHandler=function(e){T=e},this.getInputHandler=function(){return T};var W=!1,_=function(e,n){if(W&&(W=!1),I)return B(),e&&t.onPaste(e),I=!1,"";var r=i.selectionStart,s=i.selectionEnd,o=x,a=S.length-k,l=e,c=e.length-r,h=e.length-s,d=0;while(o>0&&S[d]==e[d])d++,o--;l=l.slice(d),d=1;while(a>0&&S.length-d>x-1&&S[S.length-d]==e[e.length-d])d++,a--;c-=d-1,h-=d-1;var u=l.length-d+1;return u<0&&(o=-u,u=0),l=l.slice(0,u),n||l||c||o||a||h?(v=!0,l&&!o&&!a&&!c&&!h||y?t.onTextInput(l):t.onTextInput(l,{extendLeft:o,extendRight:a,restoreStart:c,restoreEnd:h}),v=!1,S=e,x=r,k=s,R=h,l):""},H=function(e){if(A)return P();if(e&&e.inputType){if("historyUndo"==e.inputType)return t.execCommand("undo");if("historyRedo"==e.inputType)return t.execCommand("redo")}var n=i.value,r=_(n,!0);(n.length>d+100||m.test(r)||f&&x<1&&x==k)&&B()},$=function(e,t,i){var n=e.clipboardData||window.clipboardData;if(n&&!l){var r=c||i?"Text":"text/plain";try{return t?!1!==n.setData(r,t):n.getData(r)}catch(e){if(!i)return $(e,t,!0)}}},V=function(e,r){var s=t.getCopyText();if(!s)return n.preventDefault(e);$(e,s)?(p&&(B(s),C=s,setTimeout((function(){C=!1}),10)),r?t.onCut():t.onCopy(),n.preventDefault(e)):(C=!0,i.value=s,i.select(),setTimeout((function(){C=!1,B(),r?t.onCut():t.onCopy()})))},L=function(e){V(e,!0)},N=function(e){V(e,!1)},O=function(e){var s=$(e);a.pasteCancelled()||("string"==typeof s?(s&&t.onPaste(s,e),r.isIE&&setTimeout(B),n.preventDefault(e)):(i.value="",I=!0))};n.addCommandKeyListener(i,t.onCommandKey.bind(t),t),n.addListener(i,"select",G,t),n.addListener(i,"input",H,t),n.addListener(i,"cut",L,t),n.addListener(i,"copy",N,t),n.addListener(i,"paste",O,t),"oncut"in i&&"oncopy"in i&&"onpaste"in i||n.addListener(e,"keydown",(function(e){if((!r.isMac||e.metaKey)&&e.ctrlKey)switch(e.keyCode){case 67:N(e);break;case 86:O(e);break;case 88:L(e);break}}),t);var F=function(e){if(!A&&t.onCompositionStart&&!t.$readOnly&&(A={},!y)){e.data&&(A.useTextareaForIME=!1),setTimeout(P,0),t._signal("compositionStart"),t.on("mousedown",M);var n=t.getSelectionRange();n.end.row=n.start.row,n.end.column=n.start.column,A.markerRange=n,A.selectionStart=x,t.onCompositionStart(A),A.useTextareaForIME?(S=i.value="",x=0,k=0):(i.msGetInputContext&&(A.context=i.msGetInputContext()),i.getInputContext&&(A.context=i.getInputContext()))}},P=function(){if(A&&t.onCompositionUpdate&&!t.$readOnly){if(y)return M();if(A.useTextareaForIME)t.onCompositionUpdate(i.value);else{var e=i.value;_(e),A.markerRange&&(A.context&&(A.markerRange.start.column=A.selectionStart=A.context.compositionStartOffset),A.markerRange.end.column=A.markerRange.start.column+k-A.selectionStart+R)}}},K=function(e){t.onCompositionEnd&&!t.$readOnly&&(A=!1,t.onCompositionEnd(),t.off("mousedown",M),e&&H())};function M(){w=!0,i.blur(),i.focus(),w=!1}var j,D=o.delayedCall(P,50).schedule.bind(null,null);function X(e){27==e.keyCode&&i.value.length<i.selectionStart&&(A||(S=i.value),x=k=-1,B()),D()}function Y(){clearTimeout(j),j=setTimeout((function(){b&&(i.style.cssText=b,b=""),t.renderer.$isMousePressed=!1,t.renderer.$keepTextAreaAtCursor&&t.renderer.$moveTextAreaToCursor()}),0)}n.addListener(i,"compositionstart",F,t),n.addListener(i,"compositionupdate",P,t),n.addListener(i,"keyup",X,t),n.addListener(i,"keydown",D,t),n.addListener(i,"compositionend",K,t),this.getElement=function(){return i},this.setCommandMode=function(e){y=e,i.readOnly=!1},this.setReadOnly=function(e){y||(i.readOnly=e)},this.setCopyWithEmptySelection=function(e){},this.onContextMenu=function(e){W=!0,B(),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,o){b||(b=i.style.cssText),i.style.cssText=(o?"z-index:100000;":"")+(r.isIE?"opacity:0.1;":"")+"text-indent: -"+(x+k)*t.renderer.characterWidth*.5+"px;";var a=t.container.getBoundingClientRect(),l=s.computedStyle(t.container),c=a.top+(parseInt(l.borderTopWidth)||0),h=a.left+(parseInt(a.borderLeftWidth)||0),d=a.bottom-c-i.clientHeight-2,u=function(e){s.translate(i,e.clientX-h-2,Math.min(e.clientY-c-2,d))};u(e),"mousedown"==e.type&&(t.renderer.$isMousePressed=!0,clearTimeout(j),r.isWin&&n.capture(t.container,u,Y))},this.onContextMenuClose=Y;var z=function(e){t.textInput.onContextMenu(e),Y()};function J(e,t,i){var n=null,r=!1;i.addEventListener("keydown",(function(e){n&&clearTimeout(n),r=!0}),!0),i.addEventListener("keyup",(function(e){n=setTimeout((function(){r=!1}),100)}),!0);var s=function(e){if(document.activeElement===i&&!(r||A||t.$mouseHandler.isMousePressed)&&!C){var n=i.selectionStart,s=i.selectionEnd,o=null,a=0;if(0==n?o=u.up:1==n?o=u.home:s>k&&"\n"==S[s]?o=u.end:n<x&&" "==S[n-1]?(o=u.left,a=g.option):n<x||n==x&&k!=x&&n==s?o=u.left:s>k&&S.slice(0,s).split("\n").length>2?o=u.down:s>k&&" "==S[s-1]?(o=u.right,a=g.option):(s>k||s==k&&k!=x&&n==s)&&(o=u.right),n!==s&&(a|=g.shift),o){var l=t.onCommandKey({},a,o);if(!l&&t.commands){o=u.keyCodeToString(o);var c=t.commands.findKeyCommand(a,o);c&&t.execCommand(c)}x=n,k=s,B("")}}};document.addEventListener("selectionchange",s),t.on("destroy",(function(){document.removeEventListener("selectionchange",s)}))}n.addListener(i,"mouseup",z,t),n.addListener(i,"mousedown",(function(e){e.preventDefault(),Y()}),t),n.addListener(t.renderer.scroller,"contextmenu",z,t),n.addListener(i,"contextmenu",z,t),p&&J(e,t,i)};t.TextInput=C,t.$setUserAgentForTests=function(e,t){f=e,p=t}})),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],(function(e,t,i){"use strict";var n=e("../lib/useragent"),r=0,s=550;function o(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),t.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),t.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),t.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),t.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e));var i=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];i.forEach((function(t){e[t]=this[t]}),this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}function a(e,t,i,n){return Math.sqrt(Math.pow(i-e,2)+Math.pow(n-t,2))}function l(e,t){if(e.start.row==e.end.row)var i=2*t.column-e.start.column-e.end.column;else if(e.start.row!=e.end.row-1||e.start.column||e.end.column)i=2*t.row-e.start.row-e.end.row;else var i=t.column-4;return i<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}(function(){this.onMouseDown=function(e){var t=e.inSelection(),i=e.getDocumentPosition();this.mousedownEvent=e;var r=this.editor,s=e.getButton();if(0!==s){var o=r.getSelectionRange(),a=o.isEmpty();return(a||1==s)&&r.selection.moveToPosition(i),void(2==s&&(r.textInput.onContextMenu(e.domEvent),n.isMozilla||e.preventDefault()))}return this.mousedownEvent.time=Date.now(),!t||r.isFocused()||(r.focus(),!this.$focusTimeout||this.$clickSelection||r.inMultiSelectMode)?(this.captureMouse(e),this.startSelect(i,e.domEvent._clicks>1),e.preventDefault()):(this.setState("focusWait"),void this.captureMouse(e))},this.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var i=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?i.selection.selectToPosition(e):t||i.selection.moveToPosition(e),t||this.select(),i.renderer.scroller.setCapture&&i.renderer.scroller.setCapture(),i.setStyle("ace_selecting"),this.setState("select"))},this.select=function(){var e,t=this.editor,i=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var n=this.$clickSelection.comparePoint(i);if(-1==n)e=this.$clickSelection.end;else if(1==n)e=this.$clickSelection.start;else{var r=l(this.$clickSelection,i);i=r.cursor,e=r.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(i),t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,i=this.editor,n=i.renderer.screenToTextCoordinates(this.x,this.y),r=i.selection[e](n.row,n.column);if(this.$clickSelection){var s=this.$clickSelection.comparePoint(r.start),o=this.$clickSelection.comparePoint(r.end);if(-1==s&&o<=0)t=this.$clickSelection.end,r.end.row==n.row&&r.end.column==n.column||(n=r.start);else if(1==o&&s>=0)t=this.$clickSelection.start,r.start.row==n.row&&r.start.column==n.column||(n=r.end);else if(-1==s&&1==o)n=r.end,t=r.start;else{var a=l(this.$clickSelection,n);n=a.cursor,t=a.anchor}i.selection.setSelectionAnchor(t.row,t.column)}i.selection.selectToPosition(n),i.renderer.scrollCursorIntoView()},this.selectEnd=this.selectAllEnd=this.selectByWordsEnd=this.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting"),this.editor.renderer.scroller.releaseCapture&&this.editor.renderer.scroller.releaseCapture()},this.focusWait=function(){var e=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>r||t-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),i=this.editor,n=i.session,r=n.getBracketRange(t);r?(r.isEmpty()&&(r.start.column--,r.end.column++),this.setState("select")):(r=i.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=r,this.select()},this.onTripleClick=function(e){var t=e.getDocumentPosition(),i=this.editor;this.setState("selectByLines");var n=i.getSelectionRange();n.isMultiLine()&&n.contains(t.row,t.column)?(this.$clickSelection=i.selection.getLineRange(n.start.row),this.$clickSelection.end=i.selection.getLineRange(n.end.row).end):this.$clickSelection=i.selection.getLineRange(t.row),this.select()},this.onQuadClick=function(e){var t=this.editor;t.selectAll(),this.$clickSelection=t.getSelectionRange(),this.setState("selectAll")},this.onMouseWheel=function(e){if(!e.getAccelKey()){e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var i=this.$lastScroll,n=e.domEvent.timeStamp,r=n-i.t,o=r?e.wheelX/r:i.vx,a=r?e.wheelY/r:i.vy;r<s&&(o=(o+i.vx)/2,a=(a+i.vy)/2);var l=Math.abs(o/a),c=!1;if(l>=1&&t.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(c=!0),l<=1&&t.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(c=!0),c)i.allowed=n;else if(n-i.allowed<s){var h=Math.abs(o)<=1.5*Math.abs(i.vx)&&Math.abs(a)<=1.5*Math.abs(i.vy);h?(c=!0,i.allowed=n):i.allowed=0}return i.t=n,i.vx=o,i.vy=a,c?(t.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()):void 0}}}).call(o.prototype),t.DefaultHandlers=o})),ace.define("ace/tooltip",["require","exports","module","ace/lib/oop","ace/lib/dom"],(function(e,t,i){"use strict";e("./lib/oop");var n=e("./lib/dom");function r(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}(function(){this.$init=function(){return this.$element=n.createElement("div"),this.$element.className="ace_tooltip",this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},this.getElement=function(){return this.$element||this.$init()},this.setText=function(e){this.getElement().textContent=e},this.setHtml=function(e){this.getElement().innerHTML=e},this.setPosition=function(e,t){this.getElement().style.left=e+"px",this.getElement().style.top=t+"px"},this.setClassName=function(e){n.addCssClass(this.getElement(),e)},this.show=function(e,t,i){null!=e&&this.setText(e),null!=t&&null!=i&&this.setPosition(t,i),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},this.hide=function(){this.isOpen&&(this.getElement().style.display="none",this.isOpen=!1)},this.getHeight=function(){return this.getElement().offsetHeight},this.getWidth=function(){return this.getElement().offsetWidth},this.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)}}).call(r.prototype),t.Tooltip=r})),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event","ace/tooltip"],(function(e,t,i){"use strict";var n=e("../lib/dom"),r=e("../lib/oop"),s=e("../lib/event"),o=e("../tooltip").Tooltip;function a(e){var t,i,r,o=e.editor,a=o.renderer.$gutterLayer,c=new l(o.container);function h(){var t=i.getDocumentPosition().row,n=a.$annotations[t];if(!n)return d();var s=o.session.getLength();if(t==s){var l=o.renderer.pixelToScreenCoordinates(0,i.y).row,h=i.$pos;if(l>o.session.documentToScreenRow(h.row,h.column))return d()}if(r!=n)if(r=n.text.join("<br/>"),c.setHtml(r),c.show(),o._signal("showGutterTooltip",c),o.on("mousewheel",d),e.$tooltipFollowsMouse)u(i);else{var g=i.domEvent.target,p=g.getBoundingClientRect(),m=c.getElement().style;m.left=p.right+"px",m.top=p.bottom+"px"}}function d(){t&&(t=clearTimeout(t)),r&&(c.hide(),r=null,o._signal("hideGutterTooltip",c),o.off("mousewheel",d))}function u(e){c.setPosition(e.x,e.y)}e.editor.setDefaultHandler("guttermousedown",(function(t){if(o.isFocused()&&0==t.getButton()){var i=a.getRegion(t);if("foldWidgets"!=i){var n=t.getDocumentPosition().row,r=o.session.selection;if(t.getShiftKey())r.selectTo(n,0);else{if(2==t.domEvent.detail)return o.selectAll(),t.preventDefault();e.$clickSelection=o.selection.getLineRange(n)}return e.setState("selectByLines"),e.captureMouse(t),t.preventDefault()}}})),e.editor.setDefaultHandler("guttermousemove",(function(s){var o=s.domEvent.target||s.domEvent.srcElement;if(n.hasCssClass(o,"ace_fold-widget"))return d();r&&e.$tooltipFollowsMouse&&u(s),i=s,t||(t=setTimeout((function(){t=null,i&&!e.isMousePressed?h():d()}),50))})),s.addListener(o.renderer.$gutter,"mouseout",(function(e){i=null,r&&!t&&(t=setTimeout((function(){t=null,d()}),50))}),o),o.on("changeSession",d)}function l(e){o.call(this,e)}r.inherits(l,o),function(){this.setPosition=function(e,t){var i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,r=this.getWidth(),s=this.getHeight();e+=15,t+=15,e+r>i&&(e-=e+r-i),t+s>n&&(t-=20+s),o.prototype.setPosition.call(this,e,t)}}.call(l.prototype),t.GutterHandler=a})),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],(function(e,t,i){"use strict";var n=e("../lib/event"),r=e("../lib/useragent"),s=t.MouseEvent=function(e,t){this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){n.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){n.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos||(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY)),this.$pos},this.inSelection=function(){if(null!==this.$inSelection)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var i=this.getDocumentPosition();this.$inSelection=t.contains(i.row,i.column)}return this.$inSelection},this.getButton=function(){return n.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=r.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(s.prototype)})),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],(function(e,t,i){"use strict";var n=e("../lib/dom"),r=e("../lib/event"),s=e("../lib/useragent"),o=200,a=200,l=5;function c(e){var t=e.editor,i=n.createElement("img");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",s.isOpera&&(i.style.cssText="width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;");var c=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];c.forEach((function(t){e[t]=this[t]}),this),t.on("mousedown",this.onMouseDown.bind(e));var d,u,g,p,m,f,C,I,A,v,b,y=t.container,w=0;function S(e,i){var n=Date.now(),r=!i||e.row!=i.row,s=!i||e.column!=i.column;if(!v||r||s)t.moveCursorToPosition(e),v=n,b={x:u,y:g};else{var o=h(b.x,b.y,u,g);o>l?v=null:n-v>=a&&(t.renderer.scrollCursorIntoView(),v=null)}}function x(e,i){var n=Date.now(),r=t.renderer.layerConfig.lineHeight,s=t.renderer.layerConfig.characterWidth,a=t.renderer.scroller.getBoundingClientRect(),l={x:{left:u-a.left,right:a.right-u},y:{top:g-a.top,bottom:a.bottom-g}},c=Math.min(l.x.left,l.x.right),h=Math.min(l.y.top,l.y.bottom),d={row:e.row,column:e.column};c/s<=2&&(d.column+=l.x.left<l.x.right?-3:2),h/r<=1&&(d.row+=l.y.top<l.y.bottom?-1:1);var p=e.row!=d.row,m=e.column!=d.column,f=!i||e.row!=i.row;p||m&&!f?A?n-A>=o&&t.renderer.scrollCursorIntoView(d):A=n:A=null}function k(){var e=f;f=t.renderer.screenToTextCoordinates(u,g),S(f,e),x(f,e)}function R(){m=t.selection.toOrientedRange(),d=t.session.addMarker(m,"ace_selection",t.getSelectionStyle()),t.clearSelection(),t.isFocused()&&t.renderer.$cursorLayer.setBlinking(!1),clearInterval(p),k(),p=setInterval(k,20),w=0,r.addListener(document,"mousemove",Z)}function E(){clearInterval(p),t.session.removeMarker(d),d=null,t.selection.fromOrientedRange(m),t.isFocused()&&!I&&t.$resetCursorStyle(),m=null,f=null,w=0,A=null,v=null,r.removeListener(document,"mousemove",Z)}this.onDragStart=function(e){if(this.cancelDrag||!y.draggable){var n=this;return setTimeout((function(){n.startSelect(),n.captureMouse(e)}),0),e.preventDefault()}m=t.getSelectionRange();var r=e.dataTransfer;r.effectAllowed=t.getReadOnly()?"copy":"copyMove",s.isOpera&&(t.container.appendChild(i),i.scrollTop=0),r.setDragImage&&r.setDragImage(i,0,0),s.isOpera&&t.container.removeChild(i),r.clearData(),r.setData("Text",t.session.getTextRange()),I=!0,this.setState("drag")},this.onDragEnd=function(e){if(y.draggable=!1,I=!1,this.setState(null),!t.getReadOnly()){var i=e.dataTransfer.dropEffect;C||"move"!=i||t.session.remove(t.getSelectionRange()),t.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(!t.getReadOnly()&&G(e.dataTransfer))return u=e.clientX,g=e.clientY,d||R(),w++,e.dataTransfer.dropEffect=C=T(e),r.preventDefault(e)},this.onDragOver=function(e){if(!t.getReadOnly()&&G(e.dataTransfer))return u=e.clientX,g=e.clientY,d||(R(),w++),null!==B&&(B=null),e.dataTransfer.dropEffect=C=T(e),r.preventDefault(e)},this.onDragLeave=function(e){if(w--,w<=0&&d)return E(),C=null,r.preventDefault(e)},this.onDrop=function(e){if(f){var i=e.dataTransfer;if(I)switch(C){case"move":m=m.contains(f.row,f.column)?{start:f,end:f}:t.moveText(m,f);break;case"copy":m=t.moveText(m,f,!0);break}else{var n=i.getData("Text");m={start:f,end:t.session.insert(f,n)},t.focus(),C=null}return E(),r.preventDefault(e)}},r.addListener(y,"dragstart",this.onDragStart.bind(e),t),r.addListener(y,"dragend",this.onDragEnd.bind(e),t),r.addListener(y,"dragenter",this.onDragEnter.bind(e),t),r.addListener(y,"dragover",this.onDragOver.bind(e),t),r.addListener(y,"dragleave",this.onDragLeave.bind(e),t),r.addListener(y,"drop",this.onDrop.bind(e),t);var B=null;function Z(){null==B&&(B=setTimeout((function(){null!=B&&d&&E()}),20))}function G(e){var t=e.types;return!t||Array.prototype.some.call(t,(function(e){return"text/plain"==e||"Text"==e}))}function T(e){var t=["copy","copymove","all","uninitialized"],i=["move","copymove","linkmove","all","uninitialized"],n=s.isMac?e.altKey:e.ctrlKey,r="uninitialized";try{r=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var o="none";return n&&t.indexOf(r)>=0?o="copy":i.indexOf(r)>=0?o="move":t.indexOf(r)>=0&&(o="copy"),o}}function h(e,t,i,n){return Math.sqrt(Math.pow(i-e,2)+Math.pow(n-t,2))}(function(){this.dragWait=function(){var e=Date.now()-this.mousedownEvent.time;e>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var e=this.editor.container;e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor,t=e.container;t.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var i=s.isWin?"default":"move";e.renderer.setCursorStyle(i),this.setState("dragReady")},this.onMouseDrag=function(e){var t=this.editor.container;if(s.isIE&&"dragReady"==this.state){var i=h(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);i>3&&t.dragDrop()}if("dragWait"===this.state){i=h(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);i>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(this.$dragEnabled){this.mousedownEvent=e;var t=this.editor,i=e.inSelection(),n=e.getButton(),r=e.domEvent.detail||1;if(1===r&&0===n&&i){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var o=e.domEvent.target||e.domEvent.srcElement;if("unselectable"in o&&(o.unselectable="on"),t.getDragDelay()){if(s.isWebKit){this.cancelDrag=!0;var a=t.container;a.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}}).call(c.prototype),t.DragdropHandler=c})),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],(function(e,t,i){"use strict";var n=e("./mouse_event").MouseEvent,r=e("../lib/event"),s=e("../lib/dom");t.addTouchListeners=function(e,t){var i,o,a,l,c,h,d,u,g,p="scroll",m=0,f=0,C=0,I=0;function A(){var e=window.navigator&&window.navigator.clipboard,i=!1,n=function(){var n=t.getCopyText(),r=t.session.getUndoManager().hasUndo();g.replaceChild(s.buildDom(i?["span",!n&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],n&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],n&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],e&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],r&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],["span",{class:"ace_mobile-button",action:"find"},"Find"],["span",{class:"ace_mobile-button",action:"openCommandPallete"},"Pallete"]]:["span"]),g.firstChild)},r=function(r){var s=r.target.getAttribute("action");if("more"==s||!i)return i=!i,n();"paste"==s?e.readText().then((function(e){t.execCommand(s,e)})):s&&("cut"!=s&&"copy"!=s||(e?e.writeText(t.getCopyText()):document.execCommand("copy")),t.execCommand(s)),g.firstChild.style.display="none",i=!1,"openCommandPallete"!=s&&t.focus()};g=s.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(e){p="menu",e.stopPropagation(),e.preventDefault(),t.textInput.focus()},ontouchend:function(e){e.stopPropagation(),e.preventDefault(),r(e)},onclick:r},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],t.container)}function v(){g||A();var e=t.selection.cursor,i=t.renderer.textToScreenCoordinates(e.row,e.column),n=t.container.getBoundingClientRect();g.style.top=i.pageY-n.top-3+"px",g.style.right="10px",g.style.display="",g.firstChild.style.display="none",t.on("input",b)}function b(e){g&&(g.style.display="none"),t.off("input",b)}function y(){c=null,clearTimeout(c);var e=t.selection.getRange(),i=e.contains(d.row,d.column);!e.isEmpty()&&i||(t.selection.moveToPosition(d),t.selection.selectWord()),p="wait",v()}function w(){c=null,clearTimeout(c),t.selection.moveToPosition(d);var e=f>=2?t.selection.getLineRange(d.row):t.session.getBracketRange(d);e&&!e.isEmpty()?t.selection.setRange(e):t.selection.selectWord(),p="wait"}function S(){m+=60,h=setInterval((function(){m--<=0&&(clearInterval(h),h=null),Math.abs(C)<.01&&(C=0),Math.abs(I)<.01&&(I=0),m<20&&(C*=.9),m<20&&(I*=.9);var e=t.session.getScrollTop();t.renderer.scrollBy(10*C,10*I),e==t.session.getScrollTop()&&(m=0)}),10)}r.addListener(e,"contextmenu",(function(e){if(u){var i=t.textInput.getElement();i.focus()}}),t),r.addListener(e,"touchstart",(function(e){var r=e.touches;if(c||r.length>1)return clearTimeout(c),c=null,a=-1,void(p="zoom");u=t.$mouseHandler.isMousePressed=!0;var s=t.renderer.layerConfig.lineHeight,h=t.renderer.layerConfig.lineHeight,g=e.timeStamp;l=g;var A=r[0],v=A.clientX,b=A.clientY;Math.abs(i-v)+Math.abs(o-b)>s&&(a=-1),i=e.clientX=v,o=e.clientY=b,C=I=0;var S=new n(e,t);if(d=S.getDocumentPosition(),g-a<500&&1==r.length&&!m)f++,e.preventDefault(),e.button=0,w();else{f=0;var x=t.selection.cursor,k=t.selection.isEmpty()?x:t.selection.anchor,R=t.renderer.$cursorLayer.getPixelPosition(x,!0),E=t.renderer.$cursorLayer.getPixelPosition(k,!0),B=t.renderer.scroller.getBoundingClientRect(),Z=function(e,t){return e/=h,t=t/s-.75,e*e+t*t};if(e.clientX<B.left)return void(p="zoom");var G=Z(e.clientX-B.left-R.left,e.clientY-B.top-R.top),T=Z(e.clientX-B.left-E.left,e.clientY-B.top-E.top);G<3.5&&T<3.5&&(p=G>T?"cursor":"anchor"),p=T<3.5?"anchor":G<3.5?"cursor":"scroll",c=setTimeout(y,450)}a=g}),t),r.addListener(e,"touchend",(function(e){u=t.$mouseHandler.isMousePressed=!1,h&&clearInterval(h),"zoom"==p?(p="",m=0):c?(t.selection.moveToPosition(d),m=0,v()):"scroll"==p?(S(),b()):v(),clearTimeout(c),c=null}),t),r.addListener(e,"touchmove",(function(e){c&&(clearTimeout(c),c=null);var r=e.touches;if(!(r.length>1||"zoom"==p)){var s=r[0],a=i-s.clientX,h=o-s.clientY;if("wait"==p){if(!(a*a+h*h>4))return e.preventDefault();p="cursor"}i=s.clientX,o=s.clientY,e.clientX=s.clientX,e.clientY=s.clientY;var d=e.timeStamp,u=d-l;if(l=d,"scroll"==p){var g=new n(e,t);g.speed=1,g.wheelX=a,g.wheelY=h,10*Math.abs(a)<Math.abs(h)&&(a=0),10*Math.abs(h)<Math.abs(a)&&(h=0),0!=u&&(C=a/u,I=h/u),t._emit("mousewheel",g),g.propagationStopped||(C=I=0)}else{var m=new n(e,t),f=m.getDocumentPosition();"cursor"==p?t.selection.moveCursorToPosition(f):"anchor"==p&&t.selection.setSelectionAnchor(f.row,f.column),t.renderer.scrollCursorIntoView(f),e.preventDefault()}}}),t)}})),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],(function(e,t,i){"use strict";var n=e("./dom");t.get=function(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.onreadystatechange=function(){4===i.readyState&&t(i.responseText)},i.send(null)},t.loadScript=function(e,t){var i=n.getDocumentHead(),r=document.createElement("script");r.src=e,i.appendChild(r),r.onload=r.onreadystatechange=function(e,i){!i&&r.readyState&&"loaded"!=r.readyState&&"complete"!=r.readyState||(r=r.onload=r.onreadystatechange=null,i||t())}},t.qualifyURL=function(e){var t=document.createElement("a");return t.href=e,t.href}})),ace.define("ace/lib/event_emitter",["require","exports","module"],(function(e,t,i){"use strict";var n={},r=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};n._emit=n._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var i=this._eventRegistry[e]||[],n=this._defaultHandlers[e];if(i.length||n){"object"==typeof t&&t||(t={}),t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=r),t.preventDefault||(t.preventDefault=s),i=i.slice();for(var o=0;o<i.length;o++)if(i[o](t,this),t.propagationStopped)break;return n&&!t.defaultPrevented?n(t,this):void 0}},n._signal=function(e,t){var i=(this._eventRegistry||{})[e];if(i){i=i.slice();for(var n=0;n<i.length;n++)i[n](t,this)}},n.once=function(e,t){var i=this;if(this.on(e,(function n(){i.off(e,n),t.apply(null,arguments)})),!t)return new Promise((function(e){t=e}))},n.setDefaultHandler=function(e,t){var i=this._defaultHandlers;if(i||(i=this._defaultHandlers={_disabled_:{}}),i[e]){var n=i[e],r=i._disabled_[e];r||(i._disabled_[e]=r=[]),r.push(n);var s=r.indexOf(t);-1!=s&&r.splice(s,1)}i[e]=t},n.removeDefaultHandler=function(e,t){var i=this._defaultHandlers;if(i){var n=i._disabled_[e];if(i[e]==t)n&&this.setDefaultHandler(e,n.pop());else if(n){var r=n.indexOf(t);-1!=r&&n.splice(r,1)}}},n.on=n.addEventListener=function(e,t,i){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];return n||(n=this._eventRegistry[e]=[]),-1==n.indexOf(t)&&n[i?"unshift":"push"](t),t},n.off=n.removeListener=n.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var i=this._eventRegistry[e];if(i){var n=i.indexOf(t);-1!==n&&i.splice(n,1)}},n.removeAllListeners=function(e){e||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[e]=void 0),this._defaultHandlers&&(this._defaultHandlers[e]=void 0)},t.EventEmitter=n})),ace.define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],(function(e,t,i){var n=e("./oop"),r=e("./event_emitter").EventEmitter,s={setOptions:function(e){Object.keys(e).forEach((function(t){this.setOption(t,e[t])}),this)},getOptions:function(e){var t={};if(e)Array.isArray(e)||(t=e,e=Object.keys(t));else{var i=this.$options;e=Object.keys(i).filter((function(e){return!i[e].hidden}))}return e.forEach((function(e){t[e]=this.getOption(e)}),this),t},setOption:function(e,t){if(this["$"+e]!==t){var i=this.$options[e];if(!i)return o('misspelled option "'+e+'"');if(i.forwardTo)return this[i.forwardTo]&&this[i.forwardTo].setOption(e,t);i.handlesSet||(this["$"+e]=t),i&&i.set&&i.set.call(this,t)}},getOption:function(e){var t=this.$options[e];return t?t.forwardTo?this[t.forwardTo]&&this[t.forwardTo].getOption(e):t&&t.get?t.get.call(this):this["$"+e]:o('misspelled option "'+e+'"')}};function o(e){"undefined"!=typeof console&&console.warn}function a(e,t){var i=new Error(e);i.data=t,"object"==typeof console&&console.error,setTimeout((function(){throw i}))}var l=function(){this.$defaultOptions={}};(function(){n.implement(this,r),this.defineOptions=function(e,t,i){return e.$options||(this.$defaultOptions[t]=e.$options={}),Object.keys(i).forEach((function(t){var n=i[t];"string"==typeof n&&(n={forwardTo:n}),n.name||(n.name=t),e.$options[n.name]=n,"initialValue"in n&&(e["$"+n.name]=n.initialValue)})),n.implement(e,s),this},this.resetOptions=function(e){Object.keys(e.$options).forEach((function(t){var i=e.$options[t];"value"in i&&e.setOption(t,i.value)}))},this.setDefaultValue=function(e,t,i){if(!e){for(e in this.$defaultOptions)if(this.$defaultOptions[e][t])break;if(!this.$defaultOptions[e][t])return!1}var n=this.$defaultOptions[e]||(this.$defaultOptions[e]={});n[t]&&(n.forwardTo?this.setDefaultValue(n.forwardTo,t,i):n[t].value=i)},this.setDefaultValues=function(e,t){Object.keys(t).forEach((function(i){this.setDefaultValue(e,i,t[i])}),this)},this.warn=o,this.reportError=a}).call(l.prototype),t.AppConfig=l})),ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/app_config"],(function(e,t,n){var r=e("./lib/lang"),s=(e("./lib/oop"),e("./lib/net")),o=e("./lib/app_config").AppConfig;n.exports=t=new o;var a=function(){return this||"undefined"!=typeof window&&window}(),l={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1};t.get=function(e){if(!l.hasOwnProperty(e))throw new Error("Unknown config key: "+e);return l[e]},t.set=function(e,t){if(l.hasOwnProperty(e))l[e]=t;else if(0==this.setDefaultValue("",e,t))throw new Error("Unknown config key: "+e)},t.all=function(){return r.copyObject(l)},t.$modes={},t.moduleUrl=function(e,t){if(l.$moduleUrls[e])return l.$moduleUrls[e];var i=e.split("/");t=t||i[i.length-2]||"";var n="snippets"==t?"/":"-",r=i[i.length-1];if("worker"==t&&"-"==n){var s=new RegExp("^"+t+"[\\-_]|[\\-_]"+t+"$","g");r=r.replace(s,"")}(!r||r==t)&&i.length>1&&(r=i[i.length-2]);var o=l[t+"Path"];return null==o?o=l.basePath:"/"==n&&(t=n=""),o&&"/"!=o.slice(-1)&&(o+="/"),o+t+n+r+this.get("suffix")},t.setModuleUrl=function(e,t){return l.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(i,n){var r,o;Array.isArray(i)&&(o=i[0],i=i[1]);try{r=e(i)}catch(l){}if(r&&!t.$loading[i])return n&&n(r);if(t.$loading[i]||(t.$loading[i]=[]),t.$loading[i].push(n),!(t.$loading[i].length>1)){var a=function(){e([i],(function(e){t._emit("load.module",{name:i,module:e});var n=t.$loading[i];t.$loading[i]=null,n.forEach((function(t){t&&t(e)}))}))};if(!t.get("packaged"))return a();s.loadScript(t.moduleUrl(i,o),a),c()}};var c=function(){l.basePath||l.workerPath||l.modePath||l.themePath||Object.keys(l.$moduleUrls).length||(c=function(){})};function h(r){if(a&&a.document){l.packaged=r||e.packaged||n.packaged||a.define&&i(23).packaged;for(var s={},o="",c=document.currentScript||document._currentScript,h=c&&c.ownerDocument||document,u=h.getElementsByTagName("script"),g=0;g<u.length;g++){var p=u[g],m=p.src||p.getAttribute("src");if(m){for(var f=p.attributes,C=0,I=f.length;C<I;C++){var A=f[C];0===A.name.indexOf("data-ace-")&&(s[d(A.name.replace(/^data-ace-/,""))]=A.value)}var v=m.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);v&&(o=v[1])}}for(var b in o&&(s.base=s.base||o,s.packaged=!0),s.basePath=s.base,s.workerPath=s.workerPath||s.base,s.modePath=s.modePath||s.base,s.themePath=s.themePath||s.base,delete s.base,s)"undefined"!==typeof s[b]&&t.set(b,s[b])}}function d(e){return e.replace(/-(.)/g,(function(e,t){return t.toUpperCase()}))}h(!0),t.init=h,t.version="1.4.10"})),ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/mouse/touch_handler","ace/config"],(function(e,t,i){"use strict";var n=e("../lib/event"),r=e("../lib/useragent"),s=e("./default_handlers").DefaultHandlers,o=e("./default_gutter_handler").GutterHandler,a=e("./mouse_event").MouseEvent,l=e("./dragdrop_handler").DragdropHandler,c=e("./touch_handler").addTouchListeners,h=e("../config"),d=function(e){var t=this;this.editor=e,new s(this),new o(this),new l(this);var i=function(t){var i=!document.hasFocus||!document.hasFocus()||!e.isFocused()&&document.activeElement==(e.textInput&&e.textInput.getElement());i&&window.focus(),e.focus()},a=e.renderer.getMouseEventTarget();n.addListener(a,"click",this.onMouseEvent.bind(this,"click"),e),n.addListener(a,"mousemove",this.onMouseMove.bind(this,"mousemove"),e),n.addMultiMouseDownListener([a,e.renderer.scrollBarV&&e.renderer.scrollBarV.inner,e.renderer.scrollBarH&&e.renderer.scrollBarH.inner,e.textInput&&e.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",e),n.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel"),e),c(e.container,e);var h=e.renderer.$gutter;n.addListener(h,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),e),n.addListener(h,"click",this.onMouseEvent.bind(this,"gutterclick"),e),n.addListener(h,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),e),n.addListener(h,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),e),n.addListener(a,"mousedown",i,e),n.addListener(h,"mousedown",i,e),r.isIE&&e.renderer.scrollBarV&&(n.addListener(e.renderer.scrollBarV.element,"mousedown",i,e),n.addListener(e.renderer.scrollBarH.element,"mousedown",i,e)),e.on("mousemove",(function(i){if(!t.state&&!t.$dragDelay&&t.$dragEnabled){var n=e.renderer.screenToTextCoordinates(i.x,i.y),r=e.session.selection.getRange(),s=e.renderer;!r.isEmpty()&&r.insideStart(n.row,n.column)?s.setCursorStyle("default"):s.setCursorStyle("")}}),e)};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new a(t,this.editor))},this.onMouseMove=function(e,t){var i=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;i&&i.length&&this.editor._emit(e,new a(t,this.editor))},this.onMouseWheel=function(e,t){var i=new a(t,this.editor);i.speed=2*this.$scrollSpeed,i.wheelX=t.wheelX,i.wheelY=t.wheelY,this.editor._emit(e,i)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var i=this.editor,s=this.editor.renderer;s.$isMousePressed=!0;var o=this,l=function(e){if(e){if(r.isWebKit&&!e.which&&o.releaseMouse)return o.releaseMouse();o.x=e.clientX,o.y=e.clientY,t&&t(e),o.mouseEvent=new a(e,o.editor),o.$mouseMoved=!0}},c=function(e){i.off("beforeEndOperation",d),clearInterval(u),h(),o[o.state+"End"]&&o[o.state+"End"](e),o.state="",o.isMousePressed=s.$isMousePressed=!1,s.$keepTextAreaAtCursor&&s.$moveTextAreaToCursor(),o.$onCaptureMouseMove=o.releaseMouse=null,e&&o.onMouseEvent("mouseup",e),i.endOperation()},h=function(){o[o.state]&&o[o.state](),o.$mouseMoved=!1};if(r.isOldIE&&"dblclick"==e.domEvent.type)return setTimeout((function(){c(e)}));var d=function(e){o.releaseMouse&&i.curOp.command.name&&i.curOp.selectionChanged&&(o[o.state+"End"]&&o[o.state+"End"](),o.state="",o.releaseMouse())};i.on("beforeEndOperation",d),i.startOperation({command:{name:"mouse"}}),o.$onCaptureMouseMove=l,o.releaseMouse=n.capture(this.editor.container,l,c);var u=setInterval(h,20)},this.releaseMouse=null,this.cancelContextMenu=function(){var e=function(t){t&&t.domEvent&&"contextmenu"!=t.domEvent.type||(this.editor.off("nativecontextmenu",e),t&&t.domEvent&&n.stopEvent(t.domEvent))}.bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)}}).call(d.prototype),h.defineOptions(d.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:r.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=d})),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],(function(e,t,i){"use strict";var n=e("../lib/dom");function r(e){e.on("click",(function(t){var i=t.getDocumentPosition(),r=e.session,s=r.getFoldAt(i.row,i.column,1);s&&(t.getAccelKey()?r.removeFold(s):r.expandFold(s),t.stop());var o=t.domEvent&&t.domEvent.target;o&&n.hasCssClass(o,"ace_inline_button")&&n.hasCssClass(o,"ace_toggle_wrap")&&(r.setOption("wrap",!r.getUseWrapMode()),e.renderer.scrollCursorIntoView())})),e.on("gutterclick",(function(t){var i=e.renderer.$gutterLayer.getRegion(t);if("foldWidgets"==i){var n=t.getDocumentPosition().row,r=e.session;r.foldWidgets&&r.foldWidgets[n]&&e.session.onFoldWidgetClick(n,t),e.isFocused()||e.focus(),t.stop()}})),e.on("gutterdblclick",(function(t){var i=e.renderer.$gutterLayer.getRegion(t);if("foldWidgets"==i){var n=t.getDocumentPosition().row,r=e.session,s=r.getParentFoldRangeData(n,!0),o=s.range||s.firstRange;if(o){n=o.start.row;var a=r.getFoldAt(n,r.getLine(n).length,1);a?r.removeFold(a):(r.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}}))}t.FoldHandler=r})),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],(function(e,t,i){"use strict";var n=e("../lib/keys"),r=e("../lib/event"),s=function(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)};(function(){this.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},this.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]!=e){while(t[t.length-1]&&t[t.length-1]!=this.$defaultHandler)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)}},this.addKeyboardHandler=function(e,t){if(e){"function"!=typeof e||e.handleKeyboard||(e.handleKeyboard=e);var i=this.$handlers.indexOf(e);-1!=i&&this.$handlers.splice(i,1),void 0==t?this.$handlers.push(e):this.$handlers.splice(t,0,e),-1==i&&e.attach&&e.attach(this.$editor)}},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return-1!=t&&(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.getStatusText=function(){var e=this.$data,t=e.editor;return this.$handlers.map((function(i){return i.getStatusText&&i.getStatusText(t,e)||""})).filter(Boolean).join(" ")},this.$callKeyboardHandlers=function(e,t,i,n){for(var s,o=!1,a=this.$editor.commands,l=this.$handlers.length;l--;)if(s=this.$handlers[l].handleKeyboard(this.$data,e,t,i,n),s&&s.command&&(o="null"==s.command||a.exec(s.command,this.$editor,s.args,n),o&&n&&-1!=e&&1!=s.passEvent&&1!=s.command.passEvent&&r.stopEvent(n),o))break;return o||-1!=e||(s={command:"insertstring"},o=a.exec("insertstring",this.$editor,t)),o&&this.$editor._signal&&this.$editor._signal("keyboardActivity",s),o},this.onCommandKey=function(e,t,i){var r=n.keyCodeToString(i);return this.$callKeyboardHandlers(t,r,i,e)},this.onTextInput=function(e){return this.$callKeyboardHandlers(-1,e)}}).call(s.prototype),t.KeyBinding=s})),ace.define("ace/lib/bidiutil",["require","exports","module"],(function(e,t,i){"use strict";var n=0,r=0,s=!1,o=!1,a=!1,l=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],c=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],h=0,d=1,u=0,g=1,p=2,m=3,f=4,C=5,I=6,A=7,v=8,b=9,y=10,w=11,S=12,x=13,k=14,R=15,E=16,B=17,Z=18,G=[Z,Z,Z,Z,Z,Z,Z,Z,Z,I,C,I,v,C,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,C,C,C,I,v,f,f,w,w,w,f,f,f,f,f,y,b,y,b,b,p,p,p,p,p,p,p,p,p,p,b,f,f,f,f,f,f,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,f,f,f,f,f,f,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,f,f,f,f,Z,Z,Z,Z,Z,Z,C,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,b,f,w,w,w,w,f,f,f,f,u,f,f,Z,f,f,w,w,p,p,f,u,f,f,f,p,u,f,f,f,f,f],T=[v,v,v,v,v,v,v,v,v,v,v,Z,Z,Z,u,g,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,v,C,x,k,R,E,B,b,w,w,w,w,w,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,b,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,v];function W(e,t,i,h){var d=n?c:l,u=null,g=null,p=null,m=0,f=null,A=null,b=-1,y=null,w=null,S=[];if(!h)for(y=0,h=[];y<i;y++)h[y]=$(e[y]);for(r=n,s=!1,!1,o=!1,a=!1,w=0;w<i;w++){if(u=m,S[w]=g=H(e,h,S,w),m=d[u][g],f=240&m,m&=15,t[w]=p=d[m][5],f>0)if(16==f){for(y=b;y<w;y++)t[y]=1;b=-1}else b=-1;if(A=d[m][6],A)-1==b&&(b=w);else if(b>-1){for(y=b;y<w;y++)t[y]=p;b=-1}h[w]==C&&(t[w]=0),r|=p}if(a)for(y=0;y<i;y++)if(h[y]==I){t[y]=n;for(var x=y-1;x>=0;x--){if(h[x]!=v)break;t[x]=n}}}function _(e,t,i){if(!(r<e))if(1!=e||n!=d||o){var s,a,l,c,h=i.length,u=0;while(u<h){if(t[u]>=e){s=u+1;while(s<h&&t[s]>=e)s++;for(a=u,l=s-1;a<l;a++,l--)c=i[a],i[a]=i[l],i[l]=c;u=s}u++}}else i.reverse()}function H(e,t,i,r){var l,c,h,d,G=t[r];switch(G){case u:case g:s=!1;case f:case m:return G;case p:return s?m:p;case A:return s=!0,!0,g;case v:return f;case b:return r<1||r+1>=t.length||(l=i[r-1])!=p&&l!=m||(c=t[r+1])!=p&&c!=m?f:(s&&(c=m),c==l?c:f);case y:return l=r>0?i[r-1]:C,l==p&&r+1<t.length&&t[r+1]==p?p:f;case w:if(r>0&&i[r-1]==p)return p;if(s)return f;d=r+1,h=t.length;while(d<h&&t[d]==w)d++;return d<h&&t[d]==p?p:f;case S:h=t.length,d=r+1;while(d<h&&t[d]==S)d++;if(d<h){var T=e[r],W=T>=1425&&T<=2303||64286==T;if(l=t[d],W&&(l==g||l==A))return g}return r<1||(l=t[r-1])==C?f:i[r-1];case C:return s=!1,o=!0,n;case I:return a=!0,f;case x:case k:case E:case B:case R:s=!1;case Z:return f}}function $(e){var t=e.charCodeAt(0),i=t>>8;return 0==i?t>191?u:G[t]:5==i?/[\u0591-\u05f4]/.test(e)?g:u:6==i?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e)?S:/[\u0660-\u0669\u066b-\u066c]/.test(e)?m:1642==t?w:/[\u06f0-\u06f9]/.test(e)?p:A:32==i&&t<=8287?T[255&t]:254==i&&t>=65136?A:f}t.L=u,t.R=g,t.EN=p,t.ON_R=3,t.AN=4,t.R_H=5,t.B=6,t.RLE=7,t.DOT="·",t.doBidiReorder=function(e,i,r){if(e.length<2)return{};var s=e.split(""),o=new Array(s.length),a=new Array(s.length),l=[];n=r?d:h,W(s,l,s.length,i);for(var c=0;c<o.length;o[c]=c,c++);_(2,l,o),_(1,l,o);for(c=0;c<o.length-1;c++)i[c]===m?l[c]=t.AN:l[c]===g&&(i[c]>A&&i[c]<x||i[c]===f||i[c]===Z)?l[c]=t.ON_R:c>0&&"ل"===s[c-1]&&/\u0622|\u0623|\u0625|\u0627/.test(s[c])&&(l[c-1]=l[c]=t.R_H,c++);s[s.length-1]===t.DOT&&(l[s.length-1]=t.B),""===s[0]&&(l[0]=t.RLE);for(c=0;c<o.length;c++)a[c]=l[o[c]];return{logicalFromVisual:o,bidiLevels:a}},t.hasBidiCharacters=function(e,t){for(var i=!1,n=0;n<e.length;n++)t[n]=$(e.charAt(n)),i||t[n]!=g&&t[n]!=A&&t[n]!=m||(i=!0);return i},t.getVisualFromLogicalIdx=function(e,t){for(var i=0;i<t.logicalFromVisual.length;i++)if(t.logicalFromVisual[i]==e)return i;return 0}})),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],(function(e,t,i){"use strict";var n=e("./lib/bidiutil"),r=e("./lib/lang"),s=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/,o=function(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=n,this.charWidths=[],this.EOL="¬",this.showInvisibles=!0,this.isRtlDir=!1,this.$isRtl=!1,this.line="",this.wrapIndent=0,this.EOF="¶",this.RLE="",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=s.test(e.getValue())};(function(){this.isBidiRow=function(e,t,i){return!!this.seenBidi&&(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(t,i),this.updateBidiMap()),this.bidiMap.bidiLevels)},this.onChange=function(e){this.seenBidi?this.currentRow=null:"insert"==e.action&&s.test(e.lines.join("\n"))&&(this.seenBidi=!0,this.currentRow=null)},this.getDocumentRow=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var i=this.session.$getRowCacheIndex(t,this.currentRow);i>=0&&(e=this.session.$docRowCache[i])}return e},this.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var i,n=this.session.$getRowCacheIndex(t,this.currentRow);while(this.currentRow-e>0){if(i=this.session.$getRowCacheIndex(t,this.currentRow-e-1),i!==n)break;n=i,e++}}else e=this.currentRow;return e},this.updateRowLine=function(e,t){void 0===e&&(e=this.getDocumentRow());var i=e===this.session.getLength()-1,s=i?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var o=this.session.$wrapData[e];o&&(void 0===t&&(t=this.getSplitIndex()),t>0&&o.length?(this.wrapIndent=o.indent,this.wrapOffset=this.wrapIndent*this.charWidths[n.L],this.line=t<o.length?this.line.substring(o[t-1],o[t]):this.line.substring(o[o.length-1])):this.line=this.line.substring(0,o[t])),t==o.length&&(this.line+=this.showInvisibles?s:n.DOT)}else this.line+=this.showInvisibles?s:n.DOT;var a,l=this.session,c=0;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,(function(e,t){return"\t"===e||l.isFullWidth(e.charCodeAt(0))?(a="\t"===e?l.getScreenTabSize(t+c):2,c+=a-1,r.stringRepeat(n.DOT,a)):e})),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==n.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},this.updateBidiMap=function(){var e=[];n.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=n.doBidiReorder(this.line,e,this.isRtlDir):this.bidiMap={}},this.markAsDirty=function(){this.currentRow=null},this.updateCharacterWidths=function(e){if(this.characterWidth!==e.$characterSize.width){this.fontMetrics=e;var t=this.characterWidth=e.$characterSize.width,i=e.$measureCharWidth("ה");this.charWidths[n.L]=this.charWidths[n.EN]=this.charWidths[n.ON_R]=t,this.charWidths[n.R]=this.charWidths[n.AN]=i,this.charWidths[n.R_H]=.45*i,this.charWidths[n.B]=this.charWidths[n.RLE]=0,this.currentRow=null}},this.setShowInvisibles=function(e){this.showInvisibles=e,this.currentRow=null},this.setEolChar=function(e){this.EOL=e},this.setContentWidth=function(e){this.contentWidth=e},this.isRtlLine=function(e){return!!this.$isRtl||(void 0!=e?this.session.getLine(e).charAt(0)==this.RLE:this.isRtlDir)},this.setRtlDirection=function(e,t){for(var i=e.getCursorPosition(),n=e.selection.getSelectionAnchor().row;n<=i.row;n++)t||e.session.getLine(n).charAt(0)!==e.session.$bidiHandler.RLE?t&&e.session.getLine(n).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:n},e.session.$bidiHandler.RLE):e.session.doc.removeInLine(n,0,1)},this.getPosLeft=function(e){e-=this.wrapIndent;var t=this.line.charAt(0)===this.RLE?1:0,i=e>t?this.session.getOverwrite()?e:e-1:t,r=n.getVisualFromLogicalIdx(i,this.bidiMap),s=this.bidiMap.bidiLevels,o=0;!this.session.getOverwrite()&&e<=t&&s[r]%2!==0&&r++;for(var a=0;a<r;a++)o+=this.charWidths[s[a]];return!this.session.getOverwrite()&&e>t&&s[r]%2===0&&(o+=this.charWidths[s[r]]),this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(o+=this.rtlLineOffset),o},this.getSelections=function(e,t){var i,n=this.bidiMap,r=n.bidiLevels,s=[],o=0,a=Math.min(e,t)-this.wrapIndent,l=Math.max(e,t)-this.wrapIndent,c=!1,h=!1,d=0;this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var u,g=0;g<r.length;g++)u=n.logicalFromVisual[g],i=r[g],c=u>=a&&u<l,c&&!h?d=o:!c&&h&&s.push({left:d,width:o-d}),o+=this.charWidths[i],h=c;if(c&&g===r.length&&s.push({left:d,width:o-d}),this.isRtlDir)for(var p=0;p<s.length;p++)s[p].left+=this.rtlLineOffset;return s},this.offsetToCol=function(e){this.isRtlDir&&(e-=this.rtlLineOffset);var t=0,i=(e=Math.max(e,0),0),n=0,r=this.bidiMap.bidiLevels,s=this.charWidths[r[n]];this.wrapIndent&&(e-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);while(e>i+s/2){if(i+=s,n===r.length-1){s=0;break}s=this.charWidths[r[++n]]}return n>0&&r[n-1]%2!==0&&r[n]%2===0?(e<i&&n--,t=this.bidiMap.logicalFromVisual[n]):n>0&&r[n-1]%2===0&&r[n]%2!==0?t=1+(e>i?this.bidiMap.logicalFromVisual[n]:this.bidiMap.logicalFromVisual[n-1]):this.isRtlDir&&n===r.length-1&&0===s&&r[n-1]%2===0||!this.isRtlDir&&0===n&&r[n]%2!==0?t=1+this.bidiMap.logicalFromVisual[n]:(n>0&&r[n-1]%2!==0&&0!==s&&n--,t=this.bidiMap.logicalFromVisual[n]),0===t&&this.isRtlDir&&t++,t+this.wrapIndent}}).call(o.prototype),t.BidiHandler=o})),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],(function(e,t,i){"use strict";var n=e("./lib/oop"),r=e("./lib/lang"),s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,a=function(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var t=this;this.cursor.on("change",(function(e){t.$cursorChanged=!0,t.$silent||t._emit("changeCursor"),t.$isEmpty||t.$silent||t._emit("changeSelection"),t.$keepDesiredColumnOnChange||e.old.column==e.value.column||(t.$desiredColumn=null)})),this.anchor.on("change",(function(){t.$anchorChanged=!0,t.$isEmpty||t.$silent||t._emit("changeSelection")}))};(function(){n.implement(this,s),this.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},this.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},this.getCursor=function(){return this.lead.getPosition()},this.setSelectionAnchor=function(e,t){this.$isEmpty=!1,this.anchor.setPosition(e,t)},this.getAnchor=this.getSelectionAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},this.getSelectionLead=function(){return this.lead.getPosition()},this.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},this.getRange=function(){var e=this.anchor,t=this.lead;return this.$isEmpty?o.fromPoints(t,t):this.isBackwards()?o.fromPoints(t,e):o.fromPoints(e,t)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},this.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},this.setRange=this.setSelectionRange=function(e,t){var i=t?e.end:e.start,n=t?e.start:e.end;this.$setSelection(i.row,i.column,n.row,n.column)},this.$setSelection=function(e,t,i,n){if(!this.$silent){var r=this.$isEmpty,s=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,t),this.cursor.setPosition(i,n),this.$isEmpty=!o.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||r!=this.$isEmpty||s)&&this._emit("changeSelection")}},this.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},this.selectTo=function(e,t){this.$moveSelection((function(){this.moveCursorTo(e,t)}))},this.selectToPosition=function(e){this.$moveSelection((function(){this.moveCursorToPosition(e)}))},this.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},this.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.getWordRange=function(e,t){if("undefined"==typeof t){var i=e||this.lead;e=i.row,t=i.column}return this.session.getWordRange(e,t)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},this.getLineRange=function(e,t){var i,n="number"==typeof e?e:this.lead.row,r=this.session.getFoldLine(n);return r?(n=r.start.row,i=r.end.row):i=n,!0===t?new o(n,0,i,this.session.getLine(i).length):new o(n,0,i+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.wouldMoveIntoSoftTab=function(e,t,i){var n=e.column,r=e.column+t;return i<0&&(n=e.column-t,r=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(n,r).split(" ").length-1==t},this.moveCursorLeft=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,-1))this.moveCursorTo(e.start.row,e.start.column);else if(0===t.column)t.row>0&&this.moveCursorTo(t.row-1,this.doc.getLine(t.row-1).length);else{var i=this.session.getTabSize();this.wouldMoveIntoSoftTab(t,i,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-i):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,1))this.moveCursorTo(e.end.row,e.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var i=this.session.getTabSize();t=this.lead;this.wouldMoveIntoSoftTab(t,i,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,i):this.moveCursorBy(0,1)}},this.moveCursorLineStart=function(){var e=this.lead.row,t=this.lead.column,i=this.session.documentToScreenRow(e,t),n=this.session.screenToDocumentPosition(i,0),r=this.session.getDisplayLine(e,null,n.row,n.column),s=r.match(/^\s*/);s[0].length==t||this.session.$useEmacsStyleLineStart||(n.column+=s[0].length),this.moveCursorToPosition(n)},this.moveCursorLineEnd=function(){var e=this.lead,t=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==t.column){var i=this.session.getLine(t.row);if(t.column==i.length){var n=i.search(/\s+$/);n>0&&(t.column=n)}}this.moveCursorTo(t.row,t.column)},this.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var e=this.lead.row,t=this.lead.column,i=this.doc.getLine(e),n=i.substring(t);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var r=this.session.getFoldAt(e,t,1);if(r)this.moveCursorTo(r.end.row,r.end.column);else{if(this.session.nonTokenRe.exec(n)&&(t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,n=i.substring(t)),t>=i.length)return this.moveCursorTo(e,i.length),this.moveCursorRight(),void(e<this.doc.getLength()-1&&this.moveCursorWordRight());this.session.tokenRe.exec(n)&&(t+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)}},this.moveCursorLongWordLeft=function(){var e,t=this.lead.row,i=this.lead.column;if(e=this.session.getFoldAt(t,i,-1))this.moveCursorTo(e.start.row,e.start.column);else{var n=this.session.getFoldStringAt(t,i,-1);null==n&&(n=this.doc.getLine(t).substring(0,i));var s=r.stringReverse(n);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(s)&&(i-=this.session.nonTokenRe.lastIndex,s=s.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),i<=0)return this.moveCursorTo(t,0),this.moveCursorLeft(),void(t>0&&this.moveCursorWordLeft());this.session.tokenRe.exec(s)&&(i-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,i)}},this.$shortWordEndIndex=function(e){var t,i=0,n=/\s/,r=this.session.tokenRe;if(r.lastIndex=0,this.session.tokenRe.exec(e))i=this.session.tokenRe.lastIndex;else{while((t=e[i])&&n.test(t))i++;if(i<1){r.lastIndex=0;while((t=e[i])&&!r.test(t))if(r.lastIndex=0,i++,n.test(t)){if(i>2){i--;break}while((t=e[i])&&n.test(t))i++;if(i>2)break}}}return r.lastIndex=0,i},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,i=this.doc.getLine(e),n=i.substring(t),r=this.session.getFoldAt(e,t,1);if(r)return this.moveCursorTo(r.end.row,r.end.column);if(t==i.length){var s=this.doc.getLength();do{e++,n=this.doc.getLine(e)}while(e<s&&/^\s*$/.test(n));/^\s+/.test(n)||(n=""),t=0}var o=this.$shortWordEndIndex(n);this.moveCursorTo(e,t+o)},this.moveCursorShortWordLeft=function(){var e,t=this.lead.row,i=this.lead.column;if(e=this.session.getFoldAt(t,i,-1))return this.moveCursorTo(e.start.row,e.start.column);var n=this.session.getLine(t).substring(0,i);if(0===i){do{t--,n=this.doc.getLine(t)}while(t>0&&/^\s*$/.test(n));i=n.length,/\s+$/.test(n)||(n="")}var s=r.stringReverse(n),o=this.$shortWordEndIndex(s);return this.moveCursorTo(t,i-o)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(e,t){var i,n=this.session.documentToScreenPosition(this.lead.row,this.lead.column);if(0===t&&(0!==e&&(this.session.$bidiHandler.isBidiRow(n.row,this.lead.row)?(i=this.session.$bidiHandler.getPosLeft(n.column),n.column=Math.round(i/this.session.$bidiHandler.charWidths[0])):i=n.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?n.column=this.$desiredColumn:this.$desiredColumn=n.column),0!=e&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var r=this.session.lineWidgets[this.lead.row];e<0?e-=r.rowsAbove||0:e>0&&(e+=r.rowCount-(r.rowsAbove||0))}var s=this.session.screenToDocumentPosition(n.row+e,n.column,i);0!==e&&0===t&&s.row===this.lead.row&&(s.column,this.lead.column),this.moveCursorTo(s.row,s.column+t,0===t)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,i){var n=this.session.getFoldAt(e,t,1);n&&(e=n.start.row,t=n.start.column),this.$keepDesiredColumnOnChange=!0;var r=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(r.charAt(t))&&r.charAt(t-1)&&(this.lead.row==e&&this.lead.column==t+1?t-=1:t+=1),this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,i||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,i){var n=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(n.row,n.column,i)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},this.getRangeOfMovements=function(e){var t=this.getCursor();try{e(this);var i=this.getCursor();return o.fromPoints(t,i)}catch(n){return o.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},this.toJSON=function(){if(this.rangeCount)var e=this.ranges.map((function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t}));else{e=this.getRange();e.isBackwards=this.isBackwards()}return e},this.fromJSON=function(e){if(void 0==e.start){if(this.rangeList&&e.length>1){this.toSingleRange(e[0]);for(var t=e.length;t--;){var i=o.fromPoints(e[t].start,e[t].end);e[t].isBackwards&&(i.cursor=i.start),this.addRange(i,!0)}return}e=e[0]}this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},this.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0}}).call(a.prototype),t.Selection=a})),ace.define("ace/tokenizer",["require","exports","module","ace/config"],(function(e,t,i){"use strict";var n=e("./config"),r=2e3,s=function(e){for(var t in this.states=e,this.regExps={},this.matchMappings={},this.states){for(var i=this.states[t],n=[],r=0,s=this.matchMappings[t]={defaultToken:"text"},o="g",a=[],l=0;l<i.length;l++){var c=i[l];if(c.defaultToken&&(s.defaultToken=c.defaultToken),c.caseInsensitive&&(o="gi"),null!=c.regex){c.regex instanceof RegExp&&(c.regex=c.regex.toString().slice(1,-1));var h=c.regex,d=new RegExp("(?:("+h+")|(.))").exec("a").length-2;Array.isArray(c.token)?1==c.token.length||1==d?c.token=c.token[0]:d-1!=c.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:c,groupCount:d-1}),c.token=c.token[0]):(c.tokenArray=c.token,c.token=null,c.onMatch=this.$arrayTokens):"function"!=typeof c.token||c.onMatch||(c.onMatch=d>1?this.$applyToken:c.token),d>1&&(/\\\d/.test(c.regex)?h=c.regex.replace(/\\([0-9]+)/g,(function(e,t){return"\\"+(parseInt(t,10)+r+1)})):(d=1,h=this.removeCapturingGroups(c.regex)),c.splitRegex||"string"==typeof c.token||a.push(c)),s[r]=l,r+=d,n.push(h),c.onMatch||(c.onMatch=null)}}n.length||(s[0]=0,n.push("$")),a.forEach((function(e){e.splitRegex=this.createSplitterRegexp(e.regex,o)}),this),this.regExps[t]=new RegExp("("+n.join(")|(")+")|($)",o)}};(function(){this.$setMaxTokenCount=function(e){r=0|e},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),i=this.token.apply(this,t);if("string"===typeof i)return[{type:i,value:e}];for(var n=[],r=0,s=i.length;r<s;r++)t[r]&&(n[n.length]={type:i[r],value:t[r]});return n},this.$arrayTokens=function(e){if(!e)return[];var t=this.splitRegex.exec(e);if(!t)return"text";for(var i=[],n=this.tokenArray,r=0,s=n.length;r<s;r++)t[r+1]&&(i[i.length]={type:n[r],value:t[r+1]});return i},this.removeCapturingGroups=function(e){var t=e.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!]|(\()/g,(function(e,t){return t?"(?:":e}));return t},this.createSplitterRegexp=function(e,t){if(-1!=e.indexOf("(?=")){var i=0,n=!1,r={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,(function(e,t,s,o,a,l){return n?n="]"!=a:a?n=!0:o?(i==r.stack&&(r.end=l+1,r.stack=-1),i--):s&&(i++,1!=s.length&&(r.stack=i,r.start=l)),e})),null!=r.end&&/^\)*$/.test(e.substr(r.end))&&(e=e.substring(0,r.start)+e.substr(r.end))}return"^"!=e.charAt(0)&&(e="^"+e),"$"!=e.charAt(e.length-1)&&(e+="$"),new RegExp(e,(t||"").replace("g",""))},this.getLineTokens=function(e,t){if(t&&"string"!=typeof t){var i=t.slice(0);t=i[0],"#tmp"===t&&(i.shift(),t=i.shift())}else i=[];var n=t||"start",s=this.states[n];s||(n="start",s=this.states[n]);var o=this.matchMappings[n],a=this.regExps[n];a.lastIndex=0;var l,c=[],h=0,d=0,u={type:null,value:""};while(l=a.exec(e)){var g=o.defaultToken,p=null,m=l[0],f=a.lastIndex;if(f-m.length>h){var C=e.substring(h,f-m.length);u.type==g?u.value+=C:(u.type&&c.push(u),u={type:g,value:C})}for(var I=0;I<l.length-2;I++)if(void 0!==l[I+1]){p=s[o[I]],g=p.onMatch?p.onMatch(m,n,i,e):p.token,p.next&&(n="string"==typeof p.next?p.next:p.next(n,i),s=this.states[n],s||(this.reportError("state doesn't exist",n),n="start",s=this.states[n]),o=this.matchMappings[n],h=f,a=this.regExps[n],a.lastIndex=f),p.consumeLineEnd&&(h=f);break}if(m)if("string"===typeof g)p&&!1===p.merge||u.type!==g?(u.type&&c.push(u),u={type:g,value:m}):u.value+=m;else if(g){u.type&&c.push(u),u={type:null,value:""};for(I=0;I<g.length;I++)c.push(g[I])}if(h==e.length)break;if(h=f,d++>r){d>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});while(h<e.length)u.type&&c.push(u),u={value:e.substring(h,h+=500),type:"overflow"};n="start",i=[];break}}return u.type&&c.push(u),i.length>1&&i[0]!==n&&i.unshift("#tmp",n),{tokens:c,state:i.length?i:n}},this.reportError=n.reportError}).call(s.prototype),t.Tokenizer=s})),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],(function(e,t,i){"use strict";var n=e("../lib/lang"),r=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(e,t){if(t)for(var i in e){for(var n=e[i],r=0;r<n.length;r++){var s=n[r];(s.next||s.onMatch)&&("string"==typeof s.next&&0!==s.next.indexOf(t)&&(s.next=t+s.next),s.nextState&&0!==s.nextState.indexOf(t)&&(s.nextState=t+s.nextState))}this.$rules[t+i]=n}else for(var i in e)this.$rules[i]=e[i]},this.getRules=function(){return this.$rules},this.embedRules=function(e,t,i,r,s){var o="function"==typeof e?(new e).getRules():e;if(r)for(var a=0;a<r.length;a++)r[a]=t+r[a];else for(var l in r=[],o)r.push(t+l);if(this.addRules(o,t),i){var c=Array.prototype[s?"push":"unshift"];for(a=0;a<r.length;a++)c.apply(this.$rules[r[a]],n.deepCopy(i))}this.$embeds||(this.$embeds=[]),this.$embeds.push(t)},this.getEmbeds=function(){return this.$embeds};var e=function(e,t){return("start"!=e||t.length)&&t.unshift(this.nextState,e),this.nextState},t=function(e,t){return t.shift(),t.shift()||"start"};this.normalizeRules=function(){var i=0,n=this.$rules;function r(s){var o=n[s];o.processed=!0;for(var a=0;a<o.length;a++){var l=o[a],c=null;Array.isArray(l)&&(c=l,l={}),!l.regex&&l.start&&(l.regex=l.start,l.next||(l.next=[]),l.next.push({defaultToken:l.token},{token:l.token+".end",regex:l.end||l.start,next:"pop"}),l.token=l.token+".start",l.push=!0);var h=l.next||l.push;if(h&&Array.isArray(h)){var d=l.stateName;d||(d=l.token,"string"!=typeof d&&(d=d[0]||""),n[d]&&(d+=i++)),n[d]=h,l.next=d,r(d)}else"pop"==h&&(l.next=t);if(l.push&&(l.nextState=l.next||l.push,l.next=e,delete l.push),l.rules)for(var u in l.rules)n[u]?n[u].push&&n[u].push.apply(n[u],l.rules[u]):n[u]=l.rules[u];var g="string"==typeof l?l:l.include;if(g&&(c=Array.isArray(g)?g.map((function(e){return n[e]})):n[g]),c){var p=[a,1].concat(c);l.noEscape&&(p=p.filter((function(e){return!e.next}))),o.splice.apply(o,p),a--}l.keywordMap&&(l.token=this.createKeywordMapper(l.keywordMap,l.defaultToken||"text",l.caseInsensitive),delete l.defaultToken)}}Object.keys(n).forEach(r,this)},this.createKeywordMapper=function(e,t,i,n){var r=Object.create(null);return Object.keys(e).forEach((function(t){var s=e[t];i&&(s=s.toLowerCase());for(var o=s.split(n||"|"),a=o.length;a--;)r[o[a]]=t})),Object.getPrototypeOf(r)&&(r.__proto__=null),this.$keywordList=Object.keys(r),e=null,i?function(e){return r[e.toLowerCase()]||t}:function(e){return r[e]||t}},this.getKeywords=function(){return this.$keywords}}).call(r.prototype),t.TextHighlightRules=r})),ace.define("ace/mode/behaviour",["require","exports","module"],(function(e,t,i){"use strict";var n=function(){this.$behaviours={}};(function(){this.add=function(e,t,i){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][t]=i},this.addBehaviours=function(e){for(var t in e)for(var i in e[t])this.add(t,i,e[t][i])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,t){if("function"===typeof e)var i=(new e).getBehaviours(t);else i=e.getBehaviours(t);this.addBehaviours(i)},this.getBehaviours=function(e){if(e){for(var t={},i=0;i<e.length;i++)this.$behaviours[e[i]]&&(t[e[i]]=this.$behaviours[e[i]]);return t}return this.$behaviours}}).call(n.prototype),t.Behaviour=n})),ace.define("ace/token_iterator",["require","exports","module","ace/range"],(function(e,t,i){"use strict";var n=e("./range").Range,r=function(e,t,i){this.$session=e,this.$row=t,this.$rowTokens=e.getTokens(t);var n=e.getTokenAt(t,i);this.$tokenIndex=n?n.index:-1};(function(){this.stepBackward=function(){this.$tokenIndex-=1;while(this.$tokenIndex<0){if(this.$row-=1,this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},this.stepForward=function(){var e;this.$tokenIndex+=1;while(this.$tokenIndex>=this.$rowTokens.length){if(this.$row+=1,e||(e=this.$session.getLength()),this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,i=e[t].start;if(void 0!==i)return i;i=0;while(t>0)t-=1,i+=e[t].value.length;return i},this.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},this.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],t=this.getCurrentTokenColumn();return new n(this.$row,t,this.$row,t+e.value.length)}}).call(r.prototype),t.TokenIterator=r})),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],(function(e,t,i){"use strict";var n,r=e("../../lib/oop"),s=e("../behaviour").Behaviour,o=e("../../token_iterator").TokenIterator,a=e("../../lib/lang"),l=["text","paren.rparen","rparen","paren","punctuation.operator"],c=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],h={},d={'"':'"',"'":"'"},u=function(e){var t=-1;if(e.multiSelect&&(t=e.selection.index,h.rangeCount!=e.multiSelect.rangeCount&&(h={rangeCount:e.multiSelect.rangeCount})),h[t])return n=h[t];n=h[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},g=function(e,t,i,n){var r=e.end.row-e.start.row;return{text:i+t+n,selection:[0,e.start.column+1,r,e.end.column+(r?0:1)]}},p=function(e){this.add("braces","insertion",(function(t,i,r,s,o){var l=r.getCursorPosition(),c=s.doc.getLine(l.row);if("{"==o){u(r);var h=r.getSelectionRange(),d=s.doc.getTextRange(h);if(""!==d&&"{"!==d&&r.getWrapBehavioursEnabled())return g(h,d,"{","}");if(p.isSaneInsertion(r,s))return/[\]\}\)]/.test(c[l.column])||r.inMultiSelectMode||e&&e.braces?(p.recordAutoInsert(r,s,"}"),{text:"{}",selection:[1,1]}):(p.recordMaybeInsert(r,s,"{"),{text:"{",selection:[1,1]})}else if("}"==o){u(r);var m=c.substring(l.column,l.column+1);if("}"==m){var f=s.$findOpeningBracket("}",{column:l.column+1,row:l.row});if(null!==f&&p.isAutoInsertedClosing(l,c,o))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else{if("\n"==o||"\r\n"==o){u(r);var C="";p.isMaybeInsertedClosing(l,c)&&(C=a.stringRepeat("}",n.maybeInsertedBrackets),p.clearMaybeInsertedClosing());m=c.substring(l.column,l.column+1);if("}"===m){var I=s.findMatchingBracket({row:l.row,column:l.column+1},"}");if(!I)return null;var A=this.$getIndent(s.getLine(I.row))}else{if(!C)return void p.clearMaybeInsertedClosing();A=this.$getIndent(c)}var v=A+s.getTabString();return{text:"\n"+v+"\n"+A+C,selection:[1,v.length,1,v.length]}}p.clearMaybeInsertedClosing()}})),this.add("braces","deletion",(function(e,t,i,r,s){var o=r.doc.getTextRange(s);if(!s.isMultiLine()&&"{"==o){u(i);var a=r.doc.getLine(s.start.row),l=a.substring(s.end.column,s.end.column+1);if("}"==l)return s.end.column++,s;n.maybeInsertedBrackets--}})),this.add("parens","insertion",(function(e,t,i,n,r){if("("==r){u(i);var s=i.getSelectionRange(),o=n.doc.getTextRange(s);if(""!==o&&i.getWrapBehavioursEnabled())return g(s,o,"(",")");if(p.isSaneInsertion(i,n))return p.recordAutoInsert(i,n,")"),{text:"()",selection:[1,1]}}else if(")"==r){u(i);var a=i.getCursorPosition(),l=n.doc.getLine(a.row),c=l.substring(a.column,a.column+1);if(")"==c){var h=n.$findOpeningBracket(")",{column:a.column+1,row:a.row});if(null!==h&&p.isAutoInsertedClosing(a,l,r))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}})),this.add("parens","deletion",(function(e,t,i,n,r){var s=n.doc.getTextRange(r);if(!r.isMultiLine()&&"("==s){u(i);var o=n.doc.getLine(r.start.row),a=o.substring(r.start.column+1,r.start.column+2);if(")"==a)return r.end.column++,r}})),this.add("brackets","insertion",(function(e,t,i,n,r){if("["==r){u(i);var s=i.getSelectionRange(),o=n.doc.getTextRange(s);if(""!==o&&i.getWrapBehavioursEnabled())return g(s,o,"[","]");if(p.isSaneInsertion(i,n))return p.recordAutoInsert(i,n,"]"),{text:"[]",selection:[1,1]}}else if("]"==r){u(i);var a=i.getCursorPosition(),l=n.doc.getLine(a.row),c=l.substring(a.column,a.column+1);if("]"==c){var h=n.$findOpeningBracket("]",{column:a.column+1,row:a.row});if(null!==h&&p.isAutoInsertedClosing(a,l,r))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}})),this.add("brackets","deletion",(function(e,t,i,n,r){var s=n.doc.getTextRange(r);if(!r.isMultiLine()&&"["==s){u(i);var o=n.doc.getLine(r.start.row),a=o.substring(r.start.column+1,r.start.column+2);if("]"==a)return r.end.column++,r}})),this.add("string_dquotes","insertion",(function(e,t,i,n,r){var s=n.$mode.$quotes||d;if(1==r.length&&s[r]){if(this.lineCommentStart&&-1!=this.lineCommentStart.indexOf(r))return;u(i);var o=r,a=i.getSelectionRange(),l=n.doc.getTextRange(a);if(!(""===l||1==l.length&&s[l])&&i.getWrapBehavioursEnabled())return g(a,l,o,o);if(!l){var c=i.getCursorPosition(),h=n.doc.getLine(c.row),p=h.substring(c.column-1,c.column),m=h.substring(c.column,c.column+1),f=n.getTokenAt(c.row,c.column),C=n.getTokenAt(c.row,c.column+1);if("\\"==p&&f&&/escape/.test(f.type))return null;var I,A=f&&/string|escape/.test(f.type),v=!C||/string|escape/.test(C.type);if(m==o)I=A!==v,I&&/string\.end/.test(C.type)&&(I=!1);else{if(A&&!v)return null;if(A&&v)return null;var b=n.$mode.tokenRe;b.lastIndex=0;var y=b.test(p);b.lastIndex=0;var w=b.test(p);if(y||w)return null;if(m&&!/[\s;,.})\]\\]/.test(m))return null;var S=h[c.column-2];if(p==o&&(S==o||b.test(S)))return null;I=!0}return{text:I?o+o:"",selection:[1,1]}}}})),this.add("string_dquotes","deletion",(function(e,t,i,n,r){var s=n.$mode.$quotes||d,o=n.doc.getTextRange(r);if(!r.isMultiLine()&&s.hasOwnProperty(o)){u(i);var a=n.doc.getLine(r.start.row),l=a.substring(r.start.column+1,r.start.column+2);if(l==o)return r.end.column++,r}}))};p.isSaneInsertion=function(e,t){var i=e.getCursorPosition(),n=new o(t,i.row,i.column);if(!this.$matchTokenType(n.getCurrentToken()||"text",l)){if(/[)}\]]/.test(e.session.getLine(i.row)[i.column]))return!0;var r=new o(t,i.row,i.column+1);if(!this.$matchTokenType(r.getCurrentToken()||"text",l))return!1}return n.stepForward(),n.getCurrentTokenRow()!==i.row||this.$matchTokenType(n.getCurrentToken()||"text",c)},p.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},p.recordAutoInsert=function(e,t,i){var r=e.getCursorPosition(),s=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,s,n.autoInsertedLineEnd[0])||(n.autoInsertedBrackets=0),n.autoInsertedRow=r.row,n.autoInsertedLineEnd=i+s.substr(r.column),n.autoInsertedBrackets++},p.recordMaybeInsert=function(e,t,i){var r=e.getCursorPosition(),s=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,s)||(n.maybeInsertedBrackets=0),n.maybeInsertedRow=r.row,n.maybeInsertedLineStart=s.substr(0,r.column)+i,n.maybeInsertedLineEnd=s.substr(r.column),n.maybeInsertedBrackets++},p.isAutoInsertedClosing=function(e,t,i){return n.autoInsertedBrackets>0&&e.row===n.autoInsertedRow&&i===n.autoInsertedLineEnd[0]&&t.substr(e.column)===n.autoInsertedLineEnd},p.isMaybeInsertedClosing=function(e,t){return n.maybeInsertedBrackets>0&&e.row===n.maybeInsertedRow&&t.substr(e.column)===n.maybeInsertedLineEnd&&t.substr(0,e.column)==n.maybeInsertedLineStart},p.popAutoInsertedClosing=function(){n.autoInsertedLineEnd=n.autoInsertedLineEnd.substr(1),n.autoInsertedBrackets--},p.clearMaybeInsertedClosing=function(){n&&(n.maybeInsertedBrackets=0,n.maybeInsertedRow=-1)},r.inherits(p,s),t.CstyleBehaviour=p})),ace.define("ace/unicode",["require","exports","module"],(function(e,t,i){"use strict";for(var n=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],r=0,s=[],o=0;o<n.length;o+=2)s.push(r+=n[o]),n[o+1]&&s.push(45,r+=n[o+1]);t.wordChars=String.fromCharCode.apply(null,s)})),ace.define("ace/mode/text",["require","exports","module","ace/config","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],(function(e,t,i){"use strict";var n=e("../config"),r=e("../tokenizer").Tokenizer,s=e("./text_highlight_rules").TextHighlightRules,o=e("./behaviour/cstyle").CstyleBehaviour,a=e("../unicode"),l=e("../lib/lang"),c=e("../token_iterator").TokenIterator,h=e("../range").Range,d=function(){this.HighlightRules=s};(function(){this.$defaultBehaviour=new o,this.tokenRe=new RegExp("^["+a.wordChars+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+a.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new r(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,t,i,n){var r=t.doc,s=!0,o=!0,a=1/0,c=t.getTabSize(),h=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))m=this.lineCommentStart.map(l.escapeRegExp).join("|"),g=this.lineCommentStart[0];else m=l.escapeRegExp(this.lineCommentStart),g=this.lineCommentStart;m=new RegExp("^(\\s*)(?:"+m+") ?"),h=t.getUseSoftTabs();I=function(e,t){var i=e.match(m);if(i){var n=i[1].length,s=i[0].length;u(e,n,s)||" "!=i[0][s-1]||s--,r.removeInLine(t,n,s)}};var d=g+" ",u=(C=function(e,t){s&&!/\S/.test(e)||(u(e,a,a)?r.insertInLine({row:t,column:a},d):r.insertInLine({row:t,column:a},g))},A=function(e,t){return m.test(e)},function(e,t,i){var n=0;while(t--&&" "==e.charAt(t))n++;if(n%c!=0)return!1;n=0;while(" "==e.charAt(i++))n++;return c>2?n%c!=c-1:n%c==0})}else{if(!this.blockComment)return!1;var g=this.blockComment.start,p=this.blockComment.end,m=new RegExp("^(\\s*)(?:"+l.escapeRegExp(g)+")"),f=new RegExp("(?:"+l.escapeRegExp(p)+")\\s*$"),C=function(e,t){A(e,t)||s&&!/\S/.test(e)||(r.insertInLine({row:t,column:e.length},p),r.insertInLine({row:t,column:a},g))},I=function(e,t){var i;(i=e.match(f))&&r.removeInLine(t,e.length-i[0].length,e.length),(i=e.match(m))&&r.removeInLine(t,i[1].length,i[0].length)},A=function(e,i){if(m.test(e))return!0;for(var n=t.getTokens(i),r=0;r<n.length;r++)if("comment"===n[r].type)return!0}}function v(e){for(var t=i;t<=n;t++)e(r.getLine(t),t)}var b=1/0;v((function(e,t){var i=e.search(/\S/);-1!==i?(i<a&&(a=i),o&&!A(e,t)&&(o=!1)):b>e.length&&(b=e.length)})),a==1/0&&(a=b,s=!1,o=!1),h&&a%c!=0&&(a=Math.floor(a/c)*c),v(o?I:C)},this.toggleBlockComment=function(e,t,i,n){var r=this.blockComment;if(r){!r.start&&r[0]&&(r=r[0]);var s,o,a=new c(t,n.row,n.column),l=a.getCurrentToken(),d=(t.selection,t.selection.toOrientedRange());if(l&&/comment/.test(l.type)){var u,g;while(l&&/comment/.test(l.type)){var p=l.value.indexOf(r.start);if(-1!=p){var m=a.getCurrentTokenRow(),f=a.getCurrentTokenColumn()+p;u=new h(m,f,m,f+r.start.length);break}l=a.stepBackward()}a=new c(t,n.row,n.column),l=a.getCurrentToken();while(l&&/comment/.test(l.type)){p=l.value.indexOf(r.end);if(-1!=p){m=a.getCurrentTokenRow(),f=a.getCurrentTokenColumn()+p;g=new h(m,f,m,f+r.end.length);break}l=a.stepForward()}g&&t.remove(g),u&&(t.remove(u),s=u.start.row,o=-r.start.length)}else o=r.start.length,s=i.start.row,t.insert(i.end,r.end),t.insert(i.start,r.start);d.start.row==s&&(d.start.column+=o),d.end.row==s&&(d.end.column+=o),t.selection.fromOrientedRange(d)}},this.getNextLineIndent=function(e,t,i){return this.$getIndent(t)},this.checkOutdent=function(e,t,i){return!1},this.autoOutdent=function(e,t,i){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){for(var t in this.$embeds=[],this.$modes={},e)if(e[t]){var i=e[t],r=i.prototype.$id,s=n.$modes[r];s||(n.$modes[r]=s=new i),n.$modes[t]||(n.$modes[t]=s),this.$embeds.push(t),this.$modes[t]=s}var o=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"];for(t=0;t<o.length;t++)(function(e){var i=o[t],n=e[i];e[o[t]]=function(){return this.$delegator(i,arguments,n)}})(this)},this.$delegator=function(e,t,i){var n=t[0]||"start";if("string"!=typeof n){if(Array.isArray(n[2])){var r=n[2][n[2].length-1],s=this.$modes[r];if(s)return s[e].apply(s,[n[1]].concat([].slice.call(t,1)))}n=n[0]||"start"}for(var o=0;o<this.$embeds.length;o++)if(this.$modes[this.$embeds[o]]){var a=n.split(this.$embeds[o]);if(!a[0]&&a[1]){t[0]=a[1];s=this.$modes[this.$embeds[o]];return s[e].apply(s,t)}}var l=i.apply(this,t);return i?l:void 0},this.transformAction=function(e,t,i,n,r){if(this.$behaviour){var s=this.$behaviour.getBehaviours();for(var o in s)if(s[o][t]){var a=s[o][t].apply(this,arguments);if(a)return a}}},this.getKeywords=function(e){if(!this.completionKeywords){var t=this.$tokenizer.rules,i=[];for(var n in t)for(var r=t[n],s=0,o=r.length;s<o;s++)if("string"===typeof r[s].token)/keyword|support|storage/.test(r[s].token)&&i.push(r[s].regex);else if("object"===typeof r[s].token)for(var a=0,l=r[s].token.length;a<l;a++)if(/keyword|support|storage/.test(r[s].token[a])){n=r[s].regex.match(/\(.+?\)/g)[a];i.push(n.substr(1,n.length-2))}this.completionKeywords=i}return e?i.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,t,i,n){var r=this.$keywordList||this.$createKeywordList();return r.map((function(e){return{name:e,value:e,score:0,meta:"keyword"}}))},this.$id="ace/mode/text"}).call(d.prototype),t.Mode=d})),ace.define("ace/apply_delta",["require","exports","module"],(function(e,t,i){"use strict";t.applyDelta=function(e,t,i){var n=t.start.row,r=t.start.column,s=e[n]||"";switch(t.action){case"insert":var o=t.lines;if(1===o.length)e[n]=s.substring(0,r)+t.lines[0]+s.substring(r);else{var a=[n,1].concat(t.lines);e.splice.apply(e,a),e[n]=s.substring(0,r)+e[n],e[n+t.lines.length-1]+=s.substring(r)}break;case"remove":var l=t.end.column,c=t.end.row;n===c?e[n]=s.substring(0,r)+s.substring(l):e.splice(n,c-n+1,s.substring(0,r)+e[c].substring(l));break}}})),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],(function(e,t,i){"use strict";var n=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,i){this.$onChange=this.onChange.bind(this),this.attach(e),"undefined"==typeof i?this.setPosition(t.row,t.column):this.setPosition(t,i)};(function(){function e(e,t,i){var n=i?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&n}function t(t,i,n){var r="insert"==t.action,s=(r?1:-1)*(t.end.row-t.start.row),o=(r?1:-1)*(t.end.column-t.start.column),a=t.start,l=r?a:t.end;return e(i,a,n)?{row:i.row,column:i.column}:e(l,i,!n)?{row:i.row+s,column:i.column+(i.row==l.row?o:0)}:{row:a.row,column:a.column}}n.implement(this,r),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){if((e.start.row!=e.end.row||e.start.row==this.row)&&!(e.start.row>this.row)){var i=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(i.row,i.column,!0)}},this.setPosition=function(e,t,i){var n;if(n=i?{row:e,column:t}:this.$clipPositionToDocument(e,t),this.row!=n.row||this.column!=n.column){var r={row:this.row,column:this.column};this.row=n.row,this.column=n.column,this._signal("change",{old:r,value:n})}},this.detach=function(){this.document.off("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var i={};return e>=this.document.getLength()?(i.row=Math.max(0,this.document.getLength()-1),i.column=this.document.getLine(i.row).length):e<0?(i.row=0,i.column=0):(i.row=e,i.column=Math.min(this.document.getLine(i.row).length,Math.max(0,t))),t<0&&(i.column=0),i}}).call(s.prototype)})),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],(function(e,t,i){"use strict";var n=e("./lib/oop"),r=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,a=e("./anchor").Anchor,l=function(e){this.$lines=[""],0===e.length?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){n.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new a(this,e,t)},0==="aaa".split(/a/).length?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){this.$newLineMode!==e&&(this.$newLineMode=e,this._signal("changeNewLineMode"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return"\r\n"==e||"\r"==e||"\n"==e},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var i=t.length-1;e.end.row-e.start.row==i&&(t[i]=t[i].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return this.insertFullLines(e,t)},this.removeLines=function(e,t){return this.removeFullLines(e,t)},this.insertNewLine=function(e){return this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var i=this.clippedPos(e.row,e.column),n=this.pos(e.row,e.column+t.length);return this.applyDelta({start:i,end:n,action:"insert",lines:[t]},!0),this.clonePos(n)},this.clippedPos=function(e,t){var i=this.getLength();void 0===e?e=i:e<0?e=0:e>=i&&(e=i-1,t=void 0);var n=this.getLine(e);return void 0==t&&(t=n.length),t=Math.min(Math.max(t,0),n.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var i=0;e<this.getLength()?(t=t.concat([""]),i=0):(t=[""].concat(t),e--,i=this.$lines[e].length),this.insertMergedLines({row:e,column:i},t)},this.insertMergedLines=function(e,t){var i=this.clippedPos(e.row,e.column),n={row:i.row+t.length-1,column:(1==t.length?i.column:0)+t[t.length-1].length};return this.applyDelta({start:i,end:n,action:"insert",lines:t}),this.clonePos(n)},this.remove=function(e){var t=this.clippedPos(e.start.row,e.start.column),i=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:t,end:i,action:"remove",lines:this.getLinesForRange({start:t,end:i})}),this.clonePos(t)},this.removeInLine=function(e,t,i){var n=this.clippedPos(e,t),r=this.clippedPos(e,i);return this.applyDelta({start:n,end:r,action:"remove",lines:this.getLinesForRange({start:n,end:r})},!0),this.clonePos(n)},this.removeFullLines=function(e,t){e=Math.min(Math.max(0,e),this.getLength()-1),t=Math.min(Math.max(0,t),this.getLength()-1);var i=t==this.getLength()-1&&e>0,n=t<this.getLength()-1,r=i?e-1:e,s=i?this.getLine(r).length:0,a=n?t+1:t,l=n?0:this.getLine(a).length,c=new o(r,s,a,l),h=this.$lines.slice(e,t+1);return this.applyDelta({start:c.start,end:c.end,action:"remove",lines:this.getLinesForRange(c)}),h},this.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){return e instanceof o||(e=o.fromPoints(e.start,e.end)),0===t.length&&e.isEmpty()?e.start:t==this.getTextRange(e)?e.end:(this.remove(e),i=t?this.insert(e.start,t):e.start,i);var i},this.applyDeltas=function(e){for(var t=0;t<e.length;t++)this.applyDelta(e[t])},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var i="insert"==e.action;(i?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))||(i&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(r(this.$lines,e,t),this._signal("change",e)))},this.$safeApplyDelta=function(e){var t=this.$lines.length;("remove"==e.action&&e.start.row<t&&e.end.row<t||"insert"==e.action&&e.start.row<=t)&&this.applyDelta(e)},this.$splitAndapplyLargeDelta=function(e,t){for(var i=e.lines,n=i.length-t+1,r=e.start.row,s=e.start.column,o=0,a=0;o<n;o=a){a+=t-1;var l=i.slice(o,a);l.push(""),this.applyDelta({start:this.pos(r+o,s),end:this.pos(r+a,s=0),action:e.action,lines:l},!0)}e.lines=i.slice(o),e.start.row=r+o,e.start.column=s,this.applyDelta(e,!0)},this.revertDelta=function(e){this.$safeApplyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:"insert"==e.action?"remove":"insert",lines:e.lines.slice()})},this.indexToPosition=function(e,t){for(var i=this.$lines||this.getAllLines(),n=this.getNewLineCharacter().length,r=t||0,s=i.length;r<s;r++)if(e-=i[r].length+n,e<0)return{row:r,column:e+i[r].length+n};return{row:s-1,column:e+i[s-1].length+n}},this.positionToIndex=function(e,t){for(var i=this.$lines||this.getAllLines(),n=this.getNewLineCharacter().length,r=0,s=Math.min(e.row,i.length),o=t||0;o<s;++o)r+=i[o].length+n;return r+e.column}}).call(l.prototype),t.Document=l})),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],(function(e,t,i){"use strict";var n=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,s=function(e,t){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var i=this;this.$worker=function(){if(i.running){var e=new Date,t=i.currentLine,n=-1,r=i.doc,s=t;while(i.lines[t])t++;var o=r.getLength(),a=0;i.running=!1;while(t<o){i.$tokenizeRow(t),n=t;do{t++}while(i.lines[t]);if(a++,a%5===0&&new Date-e>20){i.running=setTimeout(i.$worker,20);break}}i.currentLine=t,-1==n&&(n=t),s<=n&&i.fireUpdateEvent(s,n)}}};(function(){n.implement(this,r),this.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(e,t){var i={first:e,last:t};this._signal("update",{data:i})},this.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},this.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},this.$updateOnChange=function(e){var t=e.start.row,i=e.end.row-t;if(0===i)this.lines[t]=null;else if("remove"==e.action)this.lines.splice(t,i+1,null),this.states.splice(t,i+1,null);else{var n=Array(i+1);n.unshift(t,1),this.lines.splice.apply(this.lines,n),this.states.splice.apply(this.states,n)}this.currentLine=Math.min(t,this.currentLine,this.doc.getLength()),this.stop()},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},this.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},this.$tokenizeRow=function(e){var t=this.doc.getLine(e),i=this.states[e-1],n=this.tokenizer.getLineTokens(t,i,e);return this.states[e]+""!==n.state+""?(this.states[e]=n.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=n.tokens}}).call(s.prototype),t.BackgroundTokenizer=s})),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],(function(e,t,i){"use strict";var n=e("./lib/lang"),r=(e("./lib/oop"),e("./range").Range),s=function(e,t,i){this.setRegexp(e),this.clazz=t,this.type=i||"text"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){this.regExp+""!=e+""&&(this.regExp=e,this.cache=[])},this.update=function(e,t,i,s){if(this.regExp)for(var o=s.firstRow,a=s.lastRow,l=o;l<=a;l++){var c=this.cache[l];null==c&&(c=n.getMatchOffsets(i.getLine(l),this.regExp),c.length>this.MAX_RANGES&&(c=c.slice(0,this.MAX_RANGES)),c=c.map((function(e){return new r(l,e.offset,l,e.offset+e.length)})),this.cache[l]=c.length?c:"");for(var h=c.length;h--;)t.drawSingleLineMarker(e,c[h].toScreenRange(i),this.clazz,s)}}}).call(s.prototype),t.SearchHighlight=s})),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],(function(e,t,i){"use strict";var n=e("../range").Range;function r(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var i=t[t.length-1];this.range=new n(t[0].start.row,t[0].start.column,i.end.row,i.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach((function(e){e.setFoldLine(this)}),this)}(function(){this.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach((function(t){t.start.row+=e,t.end.row+=e}))},this.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort((function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)})),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):this.range.compareStart(e.end.row,e.end.column)<0&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else{if(e.end.row!=this.start.row)throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column}e.foldLine=this},this.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},this.walk=function(e,t,i){var n,r,s,o=0,a=this.folds,l=!0;null==t&&(t=this.end.row,i=this.end.column);for(var c=0;c<a.length;c++){if(n=a[c],r=n.range.compareStart(t,i),-1==r)return void e(null,t,i,o,l);if(s=e(null,n.start.row,n.start.column,o,l),s=!s&&e(n.placeholder,n.start.row,n.start.column,o),s||0===r)return;l=!n.sameRow,o=n.end.column}e(null,t,i,o,l)},this.getNextFoldTo=function(e,t){for(var i,n,r=0;r<this.folds.length;r++){if(i=this.folds[r],n=i.range.compareEnd(e,t),-1==n)return{fold:i,kind:"after"};if(0===n)return{fold:i,kind:"inside"}}return null},this.addRemoveChars=function(e,t,i){var n,r,s=this.getNextFoldTo(e,t);if(s)if(n=s.fold,"inside"==s.kind&&n.start.column!=t&&n.start.row!=e)window.console&&window.console.log(e,t,n);else if(n.start.row==e){r=this.folds;var o=r.indexOf(n);for(0===o&&(this.start.column+=i),o;o<r.length;o++){if(n=r[o],n.start.column+=i,!n.sameRow)return;n.end.column+=i}this.end.column+=i}},this.split=function(e,t){var i=this.getNextFoldTo(e,t);if(!i||"inside"==i.kind)return null;var n=i.fold,s=this.folds,o=this.foldData,a=s.indexOf(n),l=s[a-1];this.end.row=l.end.row,this.end.column=l.end.column,s=s.splice(a,s.length-a);var c=new r(o,s);return o.splice(o.indexOf(this)+1,0,c),c},this.merge=function(e){for(var t=e.folds,i=0;i<t.length;i++)this.addFold(t[i]);var n=this.foldData;n.splice(n.indexOf(e),1)},this.toString=function(){var e=[this.range.toString()+": ["];return this.folds.forEach((function(t){e.push(" "+t.toString())})),e.push("]"),e.join("\n")},this.idxToPosition=function(e){for(var t=0,i=0;i<this.folds.length;i++){var n=this.folds[i];if(e-=n.start.column-t,e<0)return{row:n.start.row,column:n.start.column+e};if(e-=n.placeholder.length,e<0)return n.start;t=n.end.column}return{row:this.end.row,column:this.end.column+e}}}).call(r.prototype),t.FoldLine=r})),ace.define("ace/range_list",["require","exports","module","ace/range"],(function(e,t,i){"use strict";var n=e("./range").Range,r=n.comparePoints,s=function(){this.ranges=[],this.$bias=1};(function(){this.comparePoints=r,this.pointIndex=function(e,t,i){for(var n=this.ranges,s=i||0;s<n.length;s++){var o=n[s],a=r(e,o.end);if(!(a>0)){var l=r(e,o.start);return 0===a?t&&0!==l?-s-2:s:l>0||0===l&&!t?s:-s-1}}return-s-1},this.add=function(e){var t=!e.isEmpty(),i=this.pointIndex(e.start,t);i<0&&(i=-i-1);var n=this.pointIndex(e.end,t,i);return n<0?n=-n-1:n++,this.ranges.splice(i,n-i,e)},this.addList=function(e){for(var t=[],i=e.length;i--;)t.push.apply(t,this.add(e[i]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},this.merge=function(){var e=[],t=this.ranges;t=t.sort((function(e,t){return r(e.start,t.start)}));for(var i,n=t[0],s=1;s<t.length;s++){i=n,n=t[s];var o=r(i.end,n.start);o<0||(0!=o||i.isEmpty()||n.isEmpty())&&(r(i.end,n.end)<0&&(i.end.row=n.end.row,i.end.column=n.end.column),t.splice(s,1),e.push(n),n=i,s--)}return this.ranges=t,e},this.contains=function(e,t){return this.pointIndex({row:e,column:t})>=0},this.containsPoint=function(e){return this.pointIndex(e)>=0},this.rangeAtPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges[t]},this.clipRows=function(e,t){var i=this.ranges;if(i[0].start.row>t||i[i.length-1].start.row<e)return[];var n=this.pointIndex({row:e,column:0});n<0&&(n=-n-1);var r=this.pointIndex({row:t,column:0},n);r<0&&(r=-r-1);for(var s=[],o=n;o<r;o++)s.push(i[o]);return s},this.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},this.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},this.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},this.$onChange=function(e){for(var t=e.start,i=e.end,n=t.row,r=i.row,s=this.ranges,o=0,a=s.length;o<a;o++){var l=s[o];if(l.end.row>=n)break}if("insert"==e.action)for(var c=r-n,h=-t.column+i.column;o<a;o++){l=s[o];if(l.start.row>n)break;if(l.start.row==n&&l.start.column>=t.column&&(l.start.column==t.column&&this.$bias<=0||(l.start.column+=h,l.start.row+=c)),l.end.row==n&&l.end.column>=t.column){if(l.end.column==t.column&&this.$bias<0)continue;l.end.column==t.column&&h>0&&o<a-1&&l.end.column>l.start.column&&l.end.column==s[o+1].start.column&&(l.end.column-=h),l.end.column+=h,l.end.row+=c}}else for(c=n-r,h=t.column-i.column;o<a;o++){l=s[o];if(l.start.row>r)break;l.end.row<r&&(n<l.end.row||n==l.end.row&&t.column<l.end.column)?(l.end.row=n,l.end.column=t.column):l.end.row==r?l.end.column<=i.column?(c||l.end.column>t.column)&&(l.end.column=t.column,l.end.row=t.row):(l.end.column+=h,l.end.row+=c):l.end.row>r&&(l.end.row+=c),l.start.row<r&&(n<l.start.row||n==l.start.row&&t.column<l.start.column)?(l.start.row=n,l.start.column=t.column):l.start.row==r?l.start.column<=i.column?(c||l.start.column>t.column)&&(l.start.column=t.column,l.start.row=t.row):(l.start.column+=h,l.start.row+=c):l.start.row>r&&(l.start.row+=c)}if(0!=c&&o<a)for(;o<a;o++){l=s[o];l.start.row+=c,l.end.row+=c}}}).call(s.prototype),t.RangeList=s})),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list","ace/lib/oop"],(function(e,t,i){"use strict";var n=e("../range_list").RangeList,r=e("../lib/oop"),s=t.Fold=function(e,t){this.foldLine=null,this.placeholder=t,this.range=e,this.start=e.start,this.end=e.end,this.sameRow=e.start.row==e.end.row,this.subFolds=this.ranges=[]};function o(e,t){e.row-=t.row,0==e.row&&(e.column-=t.column)}function a(e,t){o(e.start,t),o(e.end,t)}function l(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row}function c(e,t){l(e.start,t),l(e.end,t)}r.inherits(s,n),function(){this.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},this.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach((function(t){t.setFoldLine(e)}))},this.clone=function(){var e=this.range.clone(),t=new s(e,this.placeholder);return this.subFolds.forEach((function(e){t.subFolds.push(e.clone())})),t.collapseChildren=this.collapseChildren,t},this.addSubFold=function(e){if(!this.range.isEqual(e)){a(e,this.start);for(var t=e.start.row,i=e.start.column,n=0,r=-1;n<this.subFolds.length;n++)if(r=this.subFolds[n].range.compare(t,i),1!=r)break;var s=this.subFolds[n],o=0;if(0==r){if(s.range.containsRange(e))return s.addSubFold(e);o=1}t=e.range.end.row,i=e.range.end.column;var l=n;for(r=-1;l<this.subFolds.length;l++)if(r=this.subFolds[l].range.compare(t,i),1!=r)break;0==r&&l++;for(var c=this.subFolds.splice(n,l-n,e),h=0==r?c.length-1:c.length,d=o;d<h;d++)e.addSubFold(c[d]);return e.setFoldLine(this.foldLine),e}},this.restoreRange=function(e){return c(e,this.start)}}.call(s.prototype)})),ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator"],(function(e,t,i){"use strict";var n=e("../range").Range,r=e("./fold_line").FoldLine,s=e("./fold").Fold,o=e("../token_iterator").TokenIterator;function a(){this.getFoldAt=function(e,t,i){var n=this.getFoldLine(e);if(!n)return null;for(var r=n.folds,s=0;s<r.length;s++){var o=r[s].range;if(o.contains(e,t)){if(1==i&&o.isEnd(e,t)&&!o.isEmpty())continue;if(-1==i&&o.isStart(e,t)&&!o.isEmpty())continue;return r[s]}}},this.getFoldsInRange=function(e){var t=e.start,i=e.end,n=this.$foldData,r=[];t.column+=1,i.column-=1;for(var s=0;s<n.length;s++){var o=n[s].range.compareRange(e);if(2!=o){if(-2==o)break;for(var a=n[s].folds,l=0;l<a.length;l++){var c=a[l];if(o=c.range.compareRange(e),-2==o)break;if(2!=o){if(42==o)break;r.push(c)}}}}return t.column-=1,i.column+=1,r},this.getFoldsInRangeList=function(e){if(Array.isArray(e)){var t=[];e.forEach((function(e){t=t.concat(this.getFoldsInRange(e))}),this)}else t=this.getFoldsInRange(e);return t},this.getAllFolds=function(){for(var e=[],t=this.$foldData,i=0;i<t.length;i++)for(var n=0;n<t[i].folds.length;n++)e.push(t[i].folds[n]);return e},this.getFoldStringAt=function(e,t,i,n){if(n=n||this.getFoldLine(e),!n)return null;for(var r,s,o={end:{column:0}},a=0;a<n.folds.length;a++){s=n.folds[a];var l=s.range.compareEnd(e,t);if(-1==l){r=this.getLine(s.start.row).substring(o.end.column,s.start.column);break}if(0===l)return null;o=s}return r||(r=this.getLine(s.start.row).substring(o.end.column)),-1==i?r.substring(0,t-o.end.column):1==i?r.substring(t-o.end.column):r},this.getFoldLine=function(e,t){var i=this.$foldData,n=0;for(t&&(n=i.indexOf(t)),-1==n&&(n=0),n;n<i.length;n++){var r=i[n];if(r.start.row<=e&&r.end.row>=e)return r;if(r.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var i=this.$foldData,n=0;for(t&&(n=i.indexOf(t)),-1==n&&(n=0),n;n<i.length;n++){var r=i[n];if(r.end.row>=e)return r}return null},this.getFoldedRowCount=function(e,t){for(var i=this.$foldData,n=t-e+1,r=0;r<i.length;r++){var s=i[r],o=s.end.row,a=s.start.row;if(o>=t){a<t&&(a>=e?n-=t-a:n=0);break}o>=e&&(n-=a>=e?o-a:o-e+1)}return n},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort((function(e,t){return e.start.row-t.start.row})),e},this.addFold=function(e,t){var i,n=this.$foldData,o=!1;e instanceof s?i=e:(i=new s(t,e),i.collapseChildren=t.collapseChildren),this.$clipRangeToDocument(i.range);var a=i.start.row,l=i.start.column,c=i.end.row,h=i.end.column,d=this.getFoldAt(a,l,1),u=this.getFoldAt(c,h,-1);if(d&&u==d)return d.addSubFold(i);d&&!d.range.isStart(a,l)&&this.removeFold(d),u&&!u.range.isEnd(c,h)&&this.removeFold(u);var g=this.getFoldsInRange(i.range);g.length>0&&(this.removeFolds(g),g.forEach((function(e){i.addSubFold(e)})));for(var p=0;p<n.length;p++){var m=n[p];if(c==m.start.row){m.addFold(i),o=!0;break}if(a==m.end.row){if(m.addFold(i),o=!0,!i.sameRow){var f=n[p+1];if(f&&f.start.row==c){m.merge(f);break}}break}if(c<=m.start.row)break}return o||(m=this.$addFoldLine(new r(this.$foldData,i))),this.$useWrapMode?this.$updateWrapData(m.start.row,m.start.row):this.$updateRowLengthCache(m.start.row,m.start.row),this.$modified=!0,this._signal("changeFold",{data:i,action:"add"}),i},this.addFolds=function(e){e.forEach((function(e){this.addFold(e)}),this)},this.removeFold=function(e){var t=e.foldLine,i=t.start.row,n=t.end.row,r=this.$foldData,s=t.folds;if(1==s.length)r.splice(r.indexOf(t),1);else if(t.range.isEnd(e.end.row,e.end.column))s.pop(),t.end.row=s[s.length-1].end.row,t.end.column=s[s.length-1].end.column;else if(t.range.isStart(e.start.row,e.start.column))s.shift(),t.start.row=s[0].start.row,t.start.column=s[0].start.column;else if(e.sameRow)s.splice(s.indexOf(e),1);else{var o=t.split(e.start.row,e.start.column);s=o.folds,s.shift(),o.start.row=s[0].start.row,o.start.column=s[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(i,n):this.$updateRowLengthCache(i,n)),this.$modified=!0,this._signal("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i]);t.forEach((function(e){this.removeFold(e)}),this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach((function(t){e.restoreRange(t),this.addFold(t)}),this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach((function(e){this.expandFold(e)}),this)},this.unfold=function(e,t){var i,r;if(null==e?(i=new n(0,0,this.getLength(),0),t=!0):i="number"==typeof e?new n(e,0,e,this.getLine(e).length):"row"in e?n.fromPoints(e,e):e,r=this.getFoldsInRangeList(i),t)this.removeFolds(r);else{var s=r;while(s.length)this.expandFolds(s),s=this.getFoldsInRangeList(i)}if(r.length)return r},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var i=this.getFoldLine(e,t);return i?i.end.row:e},this.getRowFoldStart=function(e,t){var i=this.getFoldLine(e,t);return i?i.start.row:e},this.getFoldDisplayLine=function(e,t,i,n,r){null==n&&(n=e.start.row),null==r&&(r=0),null==t&&(t=e.end.row),null==i&&(i=this.getLine(t).length);var s=this.doc,o="";return e.walk((function(e,t,i,a){if(!(t<n)){if(t==n){if(i<r)return;a=Math.max(r,a)}o+=null!=e?e:s.getLine(t).substring(a,i)}}),t,i),o},this.getDisplayLine=function(e,t,i,n){var r,s=this.getFoldLine(e);return s?this.getFoldDisplayLine(s,e,t,i,n):(r=this.doc.getLine(e),r.substring(n||0,t||r.length))},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map((function(t){var i=t.folds.map((function(e){return e.clone()}));return new r(e,i)})),e},this.toggleFold=function(e){var t,i,n=this.selection,r=n.getRange();if(r.isEmpty()){var s=r.start;if(t=this.getFoldAt(s.row,s.column),t)return void this.expandFold(t);(i=this.findMatchingBracket(s))?1==r.comparePoint(i)?r.end=i:(r.start=i,r.start.column++,r.end.column--):(i=this.findMatchingBracket({row:s.row,column:s.column+1}))?(1==r.comparePoint(i)?r.end=i:r.start=i,r.start.column++):r=this.getCommentFoldRange(s.row,s.column)||r}else{var o=this.getFoldsInRange(r);if(e&&o.length)return void this.expandFolds(o);1==o.length&&(t=o[0])}if(t||(t=this.getFoldAt(r.start.row,r.start.column)),t&&t.range.toString()==r.toString())this.expandFold(t);else{var a="...";if(!r.isMultiLine()){if(a=this.getTextRange(r),a.length<4)return;a=a.trim().substring(0,2)+".."}this.addFold(a,r)}},this.getCommentFoldRange=function(e,t,i){var r=new o(this,e,t),s=r.getCurrentToken(),a=s.type;if(s&&/^comment|string/.test(a)){a=a.match(/comment|string/)[0],"comment"==a&&(a+="|doc-start");var l=new RegExp(a),c=new n;if(1!=i){do{s=r.stepBackward()}while(s&&l.test(s.type));r.stepForward()}if(c.start.row=r.getCurrentTokenRow(),c.start.column=r.getCurrentTokenColumn()+2,r=new o(this,e,t),-1!=i){var h=-1;do{if(s=r.stepForward(),-1==h){var d=this.getState(r.$row);l.test(d)||(h=r.$row)}else if(r.$row>h)break}while(s&&l.test(s.type));s=r.stepBackward()}else s=r.getCurrentToken();return c.end.row=r.getCurrentTokenRow(),c.end.column=r.getCurrentTokenColumn()+s.value.length-2,c}},this.foldAll=function(e,t,i){void 0==i&&(i=1e5);var n=this.foldWidgets;if(n){t=t||this.getLength(),e=e||0;for(var r=e;r<t;r++)if(null==n[r]&&(n[r]=this.getFoldWidget(r)),"start"==n[r]){var s=this.getFoldWidgetRange(r);if(s&&s.isMultiLine()&&s.end.row<=t&&s.start.row>=e){r=s.end.row;try{var o=this.addFold("...",s);o&&(o.collapseChildren=i)}catch(a){}}}}},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw new Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=e){this.$foldStyle=e,"manual"==e&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)}},this.$setFolding=function(e){this.$foldMode!=e&&(this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation"),e&&"manual"!=this.$foldStyle?(this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)):this.foldWidgets=null)},this.getParentFoldRangeData=function(e,t){var i=this.foldWidgets;if(!i||t&&i[e])return{};var n,r=e-1;while(r>=0){var s=i[r];if(null==s&&(s=i[r]=this.getFoldWidget(r)),"start"==s){var o=this.getFoldWidgetRange(r);if(n||(n=o),o&&o.end.row>=e)break}r--}return{range:-1!==r&&o,firstRange:n}},this.onFoldWidgetClick=function(e,t){t=t.domEvent;var i={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey},n=this.$toggleFoldWidget(e,i);if(!n){var r=t.target||t.srcElement;r&&/ace_fold-widget/.test(r.className)&&(r.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(this.getFoldWidget){var i=this.getFoldWidget(e),n=this.getLine(e),r="end"===i?-1:1,s=this.getFoldAt(e,-1===r?0:n.length,r);if(s)return t.children||t.all?this.removeFold(s):this.expandFold(s),s;var o=this.getFoldWidgetRange(e,!0);if(o&&!o.isMultiLine()&&(s=this.getFoldAt(o.start.row,o.start.column,1),s&&o.isEqual(s.range)))return this.removeFold(s),s;if(t.siblings){var a=this.getParentFoldRangeData(e);if(a.range)var l=a.range.start.row+1,c=a.range.end.row;this.foldAll(l,c,t.all?1e4:0)}else t.children?(c=o?o.end.row:this.getLength(),this.foldAll(e+1,c,t.all?1e4:0)):o&&(t.all&&(o.collapseChildren=1e4),this.addFold("...",o));return o}},this.toggleFoldWidget=function(e){var t=this.selection.getCursor().row;t=this.getRowFoldStart(t);var i=this.$toggleFoldWidget(t,{});if(!i){var n=this.getParentFoldRangeData(t,!0);if(i=n.range||n.firstRange,i){t=i.start.row;var r=this.getFoldAt(t,this.getLine(t).length,1);r?this.removeFold(r):this.addFold("...",i)}}},this.updateFoldWidgets=function(e){var t=e.start.row,i=e.end.row-t;if(0===i)this.foldWidgets[t]=null;else if("remove"==e.action)this.foldWidgets.splice(t,i+1,null);else{var n=Array(i+1);n.unshift(t,1),this.foldWidgets.splice.apply(this.foldWidgets,n)}},this.tokenizerUpdateFoldWidgets=function(e){var t=e.data;t.first!=t.last&&this.foldWidgets.length>t.first&&this.foldWidgets.splice(t.first,this.foldWidgets.length)}}t.Folding=a})),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],(function(e,t,i){"use strict";var n=e("../token_iterator").TokenIterator,r=e("../range").Range;function s(){this.findMatchingBracket=function(e,t){if(0==e.column)return null;var i=t||this.getLine(e.row).charAt(e.column-1);if(""==i)return null;var n=i.match(/([\(\[\{])|([\)\]\}])/);return n?n[1]?this.$findClosingBracket(n[1],e):this.$findOpeningBracket(n[2],e):null},this.getBracketRange=function(e){var t,i=this.getLine(e.row),n=!0,s=i.charAt(e.column-1),o=s&&s.match(/([\(\[\{])|([\)\]\}])/);if(o||(s=i.charAt(e.column),e={row:e.row,column:e.column+1},o=s&&s.match(/([\(\[\{])|([\)\]\}])/),n=!1),!o)return null;if(o[1]){var a=this.$findClosingBracket(o[1],e);if(!a)return null;t=r.fromPoints(e,a),n||(t.end.column++,t.start.column--),t.cursor=t.end}else{a=this.$findOpeningBracket(o[2],e);if(!a)return null;t=r.fromPoints(a,e),n||(t.start.column++,t.end.column--),t.cursor=t.start}return t},this.getMatchingBracketRanges=function(e){var t=this.getLine(e.row),i=t.charAt(e.column-1),n=i&&i.match(/([\(\[\{])|([\)\]\}])/);if(n||(i=t.charAt(e.column),e={row:e.row,column:e.column+1},n=i&&i.match(/([\(\[\{])|([\)\]\}])/)),!n)return null;var s=new r(e.row,e.column-1,e.row,e.column),o=n[1]?this.$findClosingBracket(n[1],e):this.$findOpeningBracket(n[2],e);if(!o)return[s];var a=new r(o.row,o.column,o.row,o.column+1);return[s,a]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(e,t,i){var r=this.$brackets[e],s=1,o=new n(this,t.row,t.column),a=o.getCurrentToken();if(a||(a=o.stepForward()),a){i||(i=new RegExp("(\\.?"+a.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)")+")+"));var l=t.column-o.getCurrentTokenColumn()-2,c=a.value;while(1){while(l>=0){var h=c.charAt(l);if(h==r){if(s-=1,0==s)return{row:o.getCurrentTokenRow(),column:l+o.getCurrentTokenColumn()}}else h==e&&(s+=1);l-=1}do{a=o.stepBackward()}while(a&&!i.test(a.type));if(null==a)break;c=a.value,l=c.length-1}return null}},this.$findClosingBracket=function(e,t,i){var r=this.$brackets[e],s=1,o=new n(this,t.row,t.column),a=o.getCurrentToken();if(a||(a=o.stepForward()),a){i||(i=new RegExp("(\\.?"+a.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)")+")+"));var l=t.column-o.getCurrentTokenColumn();while(1){var c=a.value,h=c.length;while(l<h){var d=c.charAt(l);if(d==r){if(s-=1,0==s)return{row:o.getCurrentTokenRow(),column:l+o.getCurrentTokenColumn()}}else d==e&&(s+=1);l+=1}do{a=o.stepForward()}while(a&&!i.test(a.type));if(null==a)break;l=0}return null}}}t.BracketMatch=s})),ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/edit_session/folding","ace/edit_session/bracket_match"],(function(e,t,i){"use strict";var n=e("./lib/oop"),r=e("./lib/lang"),s=e("./bidihandler").BidiHandler,o=e("./config"),a=e("./lib/event_emitter").EventEmitter,l=e("./selection").Selection,c=e("./mode/text").Mode,h=e("./range").Range,d=e("./document").Document,u=e("./background_tokenizer").BackgroundTokenizer,g=e("./search_highlight").SearchHighlight,p=function(e,t){this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$foldData=[],this.id="session"+ ++p.$uid,this.$foldData.toString=function(){return this.join("\n")},this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),"object"==typeof e&&e.getLine||(e=new d(e)),this.setDocument(e),this.selection=new l(this),this.$bidiHandler=new s(this),o.resetOptions(this),this.setMode(t),o._signal("session",this)};p.$uid=0,function(){n.implement(this,a),this.setDocument=function(e){this.doc&&this.doc.removeListener("change",this.$onChange),this.doc=e,e.on("change",this.$onChange),this.bgTokenizer&&this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},this.getDocument=function(){return this.doc},this.$resetRowCache=function(e){if(!e)return this.$docRowCache=[],void(this.$screenRowCache=[]);var t=this.$docRowCache.length,i=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>i&&(this.$docRowCache.splice(i,t),this.$screenRowCache.splice(i,t))},this.$getRowCacheIndex=function(e,t){var i=0,n=e.length-1;while(i<=n){var r=i+n>>1,s=e[r];if(t>s)i=r+1;else{if(!(t<s))return r;n=r-1}}return i-1},this.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.bgTokenizer&&this.bgTokenizer.start(0)},this.onChangeFold=function(e){var t=e.data;this.$resetRowCache(t.start.row)},this.onChange=function(e){this.$modified=!0,this.$bidiHandler.onChange(e),this.$resetRowCache(e.start.row);var t=this.$updateInternalDataOnChange(e);!this.$fromUndo&&this.$undoManager&&(t&&t.length&&(this.$undoManager.add({action:"removeFolds",folds:t},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add(e,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer&&this.bgTokenizer.$updateOnChange(e),this._signal("change",e)},this.setValue=function(e){this.doc.setValue(e),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},this.getValue=this.toString=function(){return this.doc.getValue()},this.getSelection=function(){return this.selection},this.getState=function(e){return this.bgTokenizer.getState(e)},this.getTokens=function(e){return this.bgTokenizer.getTokens(e)},this.getTokenAt=function(e,t){var i,n=this.bgTokenizer.getTokens(e),r=0;if(null==t){var s=n.length-1;r=this.getLine(e).length}else for(s=0;s<n.length;s++)if(r+=n[s].value.length,r>=t)break;return i=n[s],i?(i.index=s,i.start=r-i.value.length,i):null},this.setUndoManager=function(e){if(this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel(),e){var t=this;e.addSession(this),this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.mergeUndoDeltas=!1},this.$informUndoManager=r.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},this.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},this.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?r.stringRepeat(" ",this.getTabSize()):"\t"},this.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},this.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},this.setTabSize=function(e){this.setOption("tabSize",e)},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize===0},this.setNavigateWithinSoftTabs=function(e){this.setOption("navigateWithinSoftTabs",e)},this.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},this.$overwrite=!1,this.setOverwrite=function(e){this.setOption("overwrite",e)},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._signal("changeBreakpoint",{})},this.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._signal("changeBreakpoint",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t<e.length;t++)this.$breakpoints[e[t]]="ace_breakpoint";this._signal("changeBreakpoint",{})},this.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},this.setBreakpoint=function(e,t){void 0===t&&(t="ace_breakpoint"),t?this.$breakpoints[e]=t:delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},this.clearBreakpoint=function(e){delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},this.addMarker=function(e,t,i,n){var r=this.$markerId++,s={range:e,type:i||"line",renderer:"function"==typeof i?i:null,clazz:t,inFront:!!n,id:r};return n?(this.$frontMarkers[r]=s,this._signal("changeFrontMarker")):(this.$backMarkers[r]=s,this._signal("changeBackMarker")),r},this.addDynamicMarker=function(e,t){if(e.update){var i=this.$markerId++;return e.id=i,e.inFront=!!t,t?(this.$frontMarkers[i]=e,this._signal("changeFrontMarker")):(this.$backMarkers[i]=e,this._signal("changeBackMarker")),e}},this.removeMarker=function(e){var t=this.$frontMarkers[e]||this.$backMarkers[e];if(t){var i=t.inFront?this.$frontMarkers:this.$backMarkers;delete i[e],this._signal(t.inFront?"changeFrontMarker":"changeBackMarker")}},this.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},this.highlight=function(e){if(!this.$searchHighlight){var t=new g(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(t)}this.$searchHighlight.setRegexp(e)},this.highlightLines=function(e,t,i,n){"number"!=typeof t&&(i=t,t=e),i||(i="ace_step");var r=new h(e,0,t,1/0);return r.id=this.addMarker(r,i,"fullLine",n),r},this.setAnnotations=function(e){this.$annotations=e,this._signal("changeAnnotation",{})},this.getAnnotations=function(){return this.$annotations||[]},this.clearAnnotations=function(){this.setAnnotations([])},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r?\n)/m);this.$autoNewLine=t?t[1]:"\n"},this.getWordRange=function(e,t){var i=this.getLine(e),n=!1;if(t>0&&(n=!!i.charAt(t-1).match(this.tokenRe)),n||(n=!!i.charAt(t).match(this.tokenRe)),n)var r=this.tokenRe;else if(/^\s+$/.test(i.slice(t-1,t+1)))r=/\s/;else r=this.nonTokenRe;var s=t;if(s>0){do{s--}while(s>=0&&i.charAt(s).match(r));s++}var o=t;while(o<i.length&&i.charAt(o).match(r))o++;return new h(e,s,e,o)},this.getAWordRange=function(e,t){var i=this.getWordRange(e,t),n=this.getLine(i.end.row);while(n.charAt(i.end.column).match(/[ \t]/))i.end.column+=1;return i},this.setNewLineMode=function(e){this.doc.setNewLineMode(e)},this.getNewLineMode=function(){return this.doc.getNewLineMode()},this.setUseWorker=function(e){this.setOption("useWorker",e)},this.getUseWorker=function(){return this.$useWorker},this.onReloadTokenizer=function(e){var t=e.data;this.bgTokenizer.start(t.first),this._signal("tokenizerUpdate",e)},this.$modes=o.$modes,this.$mode=null,this.$modeId=null,this.setMode=function(e,t){if(e&&"object"===typeof e){if(e.getTokenizer)return this.$onChangeMode(e);var i=e,n=i.path}else n=e||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new c),this.$modes[n]&&!i)return this.$onChangeMode(this.$modes[n]),void(t&&t());this.$modeId=n,o.loadModule(["mode",n],function(e){if(this.$modeId!==n)return t&&t();this.$modes[n]&&!i?this.$onChangeMode(this.$modes[n]):e&&e.Mode&&(e=new e.Mode(i),i||(this.$modes[n]=e,e.$id=n),this.$onChangeMode(e)),t&&t()}.bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},this.$onChangeMode=function(e,t){if(t||(this.$modeId=e.$id),this.$mode!==e){var i=this.$mode;this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var n=e.getTokenizer();if(void 0!==n.on){var r=this.onReloadTokenizer.bind(this);n.on("update",r)}if(this.bgTokenizer)this.bgTokenizer.setTokenizer(n);else{this.bgTokenizer=new u(n);var s=this;this.bgTokenizer.on("update",(function(e){s._signal("tokenizerUpdate",e)}))}this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,t||(e.attachToSession&&e.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(e.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode",{oldMode:i,mode:e}))}},this.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},this.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(e){o.warn("Could not load worker",e),this.$worker=null}},this.getMode=function(){return this.$mode},this.$scrollTop=0,this.setScrollTop=function(e){this.$scrollTop===e||isNaN(e)||(this.$scrollTop=e,this._signal("changeScrollTop",e))},this.getScrollTop=function(){return this.$scrollTop},this.$scrollLeft=0,this.setScrollLeft=function(e){this.$scrollLeft===e||isNaN(e)||(this.$scrollLeft=e,this._signal("changeScrollLeft",e))},this.getScrollLeft=function(){return this.$scrollLeft},this.getScreenWidth=function(){return this.$computeWidth(),this.lineWidgets?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},this.getLineWidgetMaxWidth=function(){if(null!=this.lineWidgetsWidth)return this.lineWidgetsWidth;var e=0;return this.lineWidgets.forEach((function(t){t&&t.screenWidth>e&&(e=t.screenWidth)})),this.lineWidgetWidth=e},this.$computeWidth=function(e){if(this.$modified||e){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var t=this.doc.getAllLines(),i=this.$rowLengthCache,n=0,r=0,s=this.$foldData[r],o=s?s.start.row:1/0,a=t.length,l=0;l<a;l++){if(l>o){if(l=s.end.row+1,l>=a)break;s=this.$foldData[r++],o=s?s.start.row:1/0}null==i[l]&&(i[l]=this.$getStringScreenWidth(t[l])[0]),i[l]>n&&(n=i[l])}this.screenWidth=n}},this.getLine=function(e){return this.doc.getLine(e)},this.getLines=function(e,t){return this.doc.getLines(e,t)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},this.insert=function(e,t){return this.doc.insert(e,t)},this.remove=function(e){return this.doc.remove(e)},this.removeFullLines=function(e,t){return this.doc.removeFullLines(e,t)},this.undoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var i=e.length-1;-1!=i;i--){var n=e[i];"insert"==n.action||"remove"==n.action?this.doc.revertDelta(n):n.folds&&this.addFolds(n.folds)}!t&&this.$undoSelect&&(e.selectionBefore?this.selection.fromJSON(e.selectionBefore):this.selection.setRange(this.$getUndoSelection(e,!0))),this.$fromUndo=!1}},this.redoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var i=0;i<e.length;i++){var n=e[i];"insert"!=n.action&&"remove"!=n.action||this.doc.$safeApplyDelta(n)}!t&&this.$undoSelect&&(e.selectionAfter?this.selection.fromJSON(e.selectionAfter):this.selection.setRange(this.$getUndoSelection(e,!1))),this.$fromUndo=!1}},this.setUndoSelect=function(e){this.$undoSelect=e},this.$getUndoSelection=function(e,t){function i(e){return t?"insert"!==e.action:"insert"===e.action}for(var n,r,s=0;s<e.length;s++){var o=e[s];o.start&&(n?i(o)?(r=o.start,-1==n.compare(r.row,r.column)&&n.setStart(r),r=o.end,1==n.compare(r.row,r.column)&&n.setEnd(r)):(r=o.start,-1==n.compare(r.row,r.column)&&(n=h.fromPoints(o.start,o.start))):n=i(o)?h.fromPoints(o.start,o.end):h.fromPoints(o.start,o.start))}return n},this.replace=function(e,t){return this.doc.replace(e,t)},this.moveText=function(e,t,i){var n=this.getTextRange(e),r=this.getFoldsInRange(e),s=h.fromPoints(t,t);if(!i){this.remove(e);var o=e.start.row-e.end.row,a=o?-e.end.column:e.start.column-e.end.column;a&&(s.start.row==e.end.row&&s.start.column>e.end.column&&(s.start.column+=a),s.end.row==e.end.row&&s.end.column>e.end.column&&(s.end.column+=a)),o&&s.start.row>=e.end.row&&(s.start.row+=o,s.end.row+=o)}if(s.end=this.insert(s.start,n),r.length){var l=e.start,c=s.start;o=c.row-l.row,a=c.column-l.column;this.addFolds(r.map((function(e){return e=e.clone(),e.start.row==l.row&&(e.start.column+=a),e.end.row==l.row&&(e.end.column+=a),e.start.row+=o,e.end.row+=o,e})))}return s},this.indentRows=function(e,t,i){i=i.replace(/\t/g,this.getTabString());for(var n=e;n<=t;n++)this.doc.insertInLine({row:n,column:0},i)},this.outdentRows=function(e){for(var t=e.collapseRows(),i=new h(0,0,0,0),n=this.getTabSize(),r=t.start.row;r<=t.end.row;++r){var s=this.getLine(r);i.start.row=r,i.end.row=r;for(var o=0;o<n;++o)if(" "!=s.charAt(o))break;o<n&&"\t"==s.charAt(o)?(i.start.column=o,i.end.column=o+1):(i.start.column=0,i.end.column=o),this.remove(i)}},this.$moveLines=function(e,t,i){if(e=this.getRowFoldStart(e),t=this.getRowFoldEnd(t),i<0){var n=this.getRowFoldStart(e+i);if(n<0)return 0;var r=n-e}else if(i>0){n=this.getRowFoldEnd(t+i);if(n>this.doc.getLength()-1)return 0;r=n-t}else{e=this.$clipRowToDocument(e),t=this.$clipRowToDocument(t);r=t-e+1}var s=new h(e,0,t,Number.MAX_VALUE),o=this.getFoldsInRange(s).map((function(e){return e=e.clone(),e.start.row+=r,e.end.row+=r,e})),a=0==i?this.doc.getLines(e,t):this.doc.removeFullLines(e,t);return this.doc.insertFullLines(e+r,a),o.length&&this.addFolds(o),r},this.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},this.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},this.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},this.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},this.$clipColumnToRow=function(e,t){return t<0?0:Math.min(this.doc.getLine(e).length,t)},this.$clipPositionToDocument=function(e,t){if(t=Math.max(0,t),e<0)e=0,t=0;else{var i=this.doc.getLength();e>=i?(e=i-1,t=this.doc.getLine(i-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},this.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(e){if(e!=this.$useWrapMode){if(this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0),e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal("changeWrapMode")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(e,t){this.$wrapLimitRange.min===e&&this.$wrapLimitRange.max===t||(this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},this.adjustWrapLimit=function(e,t){var i=this.$wrapLimitRange;i.max<0&&(i={min:t,max:t});var n=this.$constrainWrapLimit(e,i.min,i.max);return n!=this.$wrapLimit&&n>1&&(this.$wrapLimit=n,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0)},this.$constrainWrapLimit=function(e,t,i){return t&&(e=Math.max(t,e)),i&&(e=Math.min(i,e)),e},this.getWrapLimit=function(){return this.$wrapLimit},this.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(e){var t=this.$useWrapMode,i=e.action,n=e.start,r=e.end,s=n.row,o=r.row,a=o-s,l=null;if(this.$updating=!0,0!=a)if("remove"===i){this[t?"$wrapData":"$rowLengthCache"].splice(s,a);var c=this.$foldData;l=this.getFoldsInRange(e),this.removeFolds(l);var h=this.getFoldLine(r.row),d=0;if(h){h.addRemoveChars(r.row,r.column,n.column-r.column),h.shiftRow(-a);var u=this.getFoldLine(s);u&&u!==h&&(u.merge(h),h=u),d=c.indexOf(h)+1}for(d;d<c.length;d++){h=c[d];h.start.row>=r.row&&h.shiftRow(-a)}o=s}else{var g=Array(a);g.unshift(s,0);var p=t?this.$wrapData:this.$rowLengthCache;p.splice.apply(p,g);c=this.$foldData,h=this.getFoldLine(s),d=0;if(h){var m=h.range.compareInside(n.row,n.column);0==m?(h=h.split(n.row,n.column),h&&(h.shiftRow(a),h.addRemoveChars(o,0,r.column-n.column))):-1==m&&(h.addRemoveChars(s,0,r.column-n.column),h.shiftRow(a)),d=c.indexOf(h)+1}for(d;d<c.length;d++){h=c[d];h.start.row>=s&&h.shiftRow(a)}}else{a=Math.abs(e.start.column-e.end.column),"remove"===i&&(l=this.getFoldsInRange(e),this.removeFolds(l),a=-a);h=this.getFoldLine(s);h&&h.addRemoveChars(s,n.column,a)}return t&&(this.$wrapData.length,this.doc.getLength()),this.$updating=!1,t?this.$updateWrapData(s,o):this.$updateRowLengthCache(s,o),l},this.$updateRowLengthCache=function(e,t,i){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,t){var n,r,o=this.doc.getAllLines(),a=this.getTabSize(),l=this.$wrapData,c=this.$wrapLimit,h=e;t=Math.min(t,o.length-1);while(h<=t)r=this.getFoldLine(h,r),r?(n=[],r.walk(function(e,t,r,a){var l;if(null!=e){l=this.$getDisplayTokens(e,n.length),l[0]=i;for(var c=1;c<l.length;c++)l[c]=s}else l=this.$getDisplayTokens(o[t].substring(a,r),n.length);n=n.concat(l)}.bind(this),r.end.row,o[r.end.row].length+1),l[r.start.row]=this.$computeWrapSplits(n,c,a),h=r.end.row+1):(n=this.$getDisplayTokens(o[h]),l[h]=this.$computeWrapSplits(n,c,a),h++)};var e=1,t=2,i=3,s=4,l=9,d=10,p=11,m=12;function f(e){return!(e<4352)&&(e>=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510)}this.$computeWrapSplits=function(e,n,r){if(0==e.length)return[];var o=[],a=e.length,c=0,h=0,u=this.$wrapAsCode,g=this.$indentedSoftWrap,f=n<=Math.max(2*r,8)||!1===g?0:Math.floor(n/2);function C(){var t=0;if(0===f)return t;if(g)for(var i=0;i<e.length;i++){var n=e[i];if(n==d)t+=1;else{if(n!=p){if(n==m)continue;break}t+=r}}return u&&!1!==g&&(t+=r),Math.min(t,f)}function I(t){for(var i=t-c,n=c;n<t;n++){var r=e[n];12!==r&&2!==r||(i-=1)}o.length||(A=C(),o.indent=A),h+=i,o.push(h),c=t}var A=0;while(a-c>n-A){var v=c+n-A;if(e[v-1]>=d&&e[v]>=d)I(v);else if(e[v]!=i&&e[v]!=s){var b=Math.max(v-(n-(n>>2)),c-1);while(v>b&&e[v]<i)v--;if(u){while(v>b&&e[v]<i)v--;while(v>b&&e[v]==l)v--}else while(v>b&&e[v]<d)v--;v>b?I(++v):(v=c+n,e[v]==t&&v--,I(v-A))}else{for(v;v!=c-1;v--)if(e[v]==i)break;if(v>c){I(v);continue}for(v=c+n,v;v<e.length;v++)if(e[v]!=s)break;if(v==e.length)break;I(v)}}return o},this.$getDisplayTokens=function(i,n){var r,s=[];n=n||0;for(var o=0;o<i.length;o++){var a=i.charCodeAt(o);if(9==a){r=this.getScreenTabSize(s.length+n),s.push(p);for(var c=1;c<r;c++)s.push(m)}else 32==a?s.push(d):a>39&&a<48||a>57&&a<64?s.push(l):a>=4352&&f(a)?s.push(e,t):s.push(e)}return s},this.$getStringScreenWidth=function(e,t,i){if(0==t)return[0,0];var n,r;for(null==t&&(t=1/0),i=i||0,r=0;r<e.length;r++)if(n=e.charCodeAt(r),9==n?i+=this.getScreenTabSize(i):n>=4352&&f(n)?i+=2:i+=1,i>t)break;return[i,r]},this.lineWidgets=null,this.getRowLength=function(e){var t=1;return this.lineWidgets&&(t+=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0),this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+t:t},this.getRowLineCount=function(e){return this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1:1},this.getRowWrapIndent=function(e){if(this.$useWrapMode){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE),i=this.$wrapData[t.row];return i.length&&i[0]<t.column?i.indent:0}return 0},this.getScreenLastRowColumn=function(e){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(t.row,t.column)},this.getDocumentLastRowColumn=function(e,t){var i=this.documentToScreenRow(e,t);return this.getScreenLastRowColumn(i)},this.getDocumentLastRowColumnPosition=function(e,t){var i=this.documentToScreenRow(e,t);return this.screenToDocumentPosition(i,Number.MAX_VALUE/10)},this.getRowSplitData=function(e){return this.$useWrapMode?this.$wrapData[e]:void 0},this.getScreenTabSize=function(e){return this.$tabSize-(e%this.$tabSize|0)},this.screenToDocumentRow=function(e,t){return this.screenToDocumentPosition(e,t).row},this.screenToDocumentColumn=function(e,t){return this.screenToDocumentPosition(e,t).column},this.screenToDocumentPosition=function(e,t,i){if(e<0)return{row:0,column:0};var n,r,s=0,o=0,a=0,l=0,c=this.$screenRowCache,h=this.$getRowCacheIndex(c,e),d=c.length;if(d&&h>=0){a=c[h],s=this.$docRowCache[h];var u=e>c[d-1]}else u=!d;var g=this.getLength()-1,p=this.getNextFoldLine(s),m=p?p.start.row:1/0;while(a<=e){if(l=this.getRowLength(s),a+l>e||s>=g)break;a+=l,s++,s>m&&(s=p.end.row+1,p=this.getNextFoldLine(s,p),m=p?p.start.row:1/0),u&&(this.$docRowCache.push(s),this.$screenRowCache.push(a))}if(p&&p.start.row<=s)n=this.getFoldDisplayLine(p),s=p.start.row;else{if(a+l<=e||s>g)return{row:g,column:this.getLine(g).length};n=this.getLine(s),p=null}var f=0,C=Math.floor(e-a);if(this.$useWrapMode){var I=this.$wrapData[s];I&&(r=I[C],C>0&&I.length&&(f=I.indent,o=I[C-1]||I[I.length-1],n=n.substring(o)))}return void 0!==i&&this.$bidiHandler.isBidiRow(a+C,s,C)&&(t=this.$bidiHandler.offsetToCol(i)),o+=this.$getStringScreenWidth(n,t-f)[1],this.$useWrapMode&&o>=r&&(o=r-1),p?p.idxToPosition(o):{row:s,column:o}},this.documentToScreenPosition=function(e,t){if("undefined"===typeof t)var i=this.$clipPositionToDocument(e.row,e.column);else i=this.$clipPositionToDocument(e,t);e=i.row,t=i.column;var n=0,r=null,s=null;s=this.getFoldAt(e,t,1),s&&(e=s.start.row,t=s.start.column);var o,a=0,l=this.$docRowCache,c=this.$getRowCacheIndex(l,e),h=l.length;if(h&&c>=0){a=l[c],n=this.$screenRowCache[c];var d=e>l[h-1]}else d=!h;var u=this.getNextFoldLine(a),g=u?u.start.row:1/0;while(a<e){if(a>=g){if(o=u.end.row+1,o>e)break;u=this.getNextFoldLine(o,u),g=u?u.start.row:1/0}else o=a+1;n+=this.getRowLength(a),a=o,d&&(this.$docRowCache.push(a),this.$screenRowCache.push(n))}var p="";u&&a>=g?(p=this.getFoldDisplayLine(u,e,t),r=u.start.row):(p=this.getLine(e).substring(0,t),r=e);var m=0;if(this.$useWrapMode){var f=this.$wrapData[r];if(f){var C=0;while(p.length>=f[C])n++,C++;p=p.substring(f[C-1]||0,p.length),m=C>0?f.indent:0}}return this.lineWidgets&&this.lineWidgets[a]&&this.lineWidgets[a].rowsAbove&&(n+=this.lineWidgets[a].rowsAbove),{row:n,column:m+this.$getStringScreenWidth(p)[0]}},this.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},this.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},this.getScreenLength=function(){var e=0,t=null;if(this.$useWrapMode){var i=this.$wrapData.length,n=0,r=(a=0,t=this.$foldData[a++],t?t.start.row:1/0);while(n<i){var s=this.$wrapData[n];e+=s?s.length+1:1,n++,n>r&&(n=t.end.row+1,t=this.$foldData[a++],r=t?t.start.row:1/0)}}else{e=this.getLength();for(var o=this.$foldData,a=0;a<o.length;a++)t=o[a],e-=t.end.row-t.start.row}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},this.$setFontMetrics=function(e){this.$enableVarChar&&(this.$getStringScreenWidth=function(t,i,n){if(0===i)return[0,0];var r,s;for(i||(i=1/0),n=n||0,s=0;s<t.length;s++)if(r=t.charAt(s),n+="\t"===r?this.getScreenTabSize(n):e.getCharacterWidth(r),n>i)break;return[n,s]})},this.destroy=function(){this.bgTokenizer&&(this.bgTokenizer.setDocument(null),this.bgTokenizer=null),this.$stopWorker(),this.removeAllListeners(),this.selection.detach()},this.isFullWidth=f}.call(p.prototype),e("./edit_session/folding").Folding.call(p.prototype),e("./edit_session/bracket_match").BracketMatch.call(p.prototype),o.defineOptions(p.prototype,"session",{wrap:{set:function(e){if(e&&"off"!=e?"free"==e?e=!0:"printMargin"==e?e=-1:"string"==typeof e&&(e=parseInt(e,10)||!1):e=!1,this.$wrap!=e)if(this.$wrap=e,e){var t="number"==typeof e?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}else this.setUseWrapMode(!1)},get:function(){return this.getUseWrapMode()?-1==this.$wrap?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){e="auto"==e?"text"!=this.$mode.type:"text"!=e,e!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){e=parseInt(e),e>0&&this.$tabSize!==e&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(e){this.setFoldStyle(e)},handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId},handlesSet:!0}}),t.EditSession=p})),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],(function(e,t,i){"use strict";var n=e("./lib/lang"),r=e("./lib/oop"),s=e("./range").Range,o=function(){this.$options={}};function a(e,t){function i(e){return/\w/.test(e)||t.regExp?"\\b":""}return i(e[0])+e+i(e[e.length-1])}(function(){this.set=function(e){return r.mixin(this.$options,e),this},this.getOptions=function(){return n.copyObject(this.$options)},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$options,i=this.$matchIterator(e,t);if(!i)return!1;var n=null;return i.forEach((function(e,i,r,o){return n=new s(e,i,r,o),!(i==o&&t.start&&t.start.start&&0!=t.skipCurrent&&n.isEqual(t.start))||(n=null,!1)})),n},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var i=t.range,r=i?e.getLines(i.start.row,i.end.row):e.doc.getAllLines(),o=[],a=t.re;if(t.$isMultiLine){var l,c=a.length,h=r.length-c;e:for(var d=a.offset||0;d<=h;d++){for(var u=0;u<c;u++)if(-1==r[d+u].search(a[u]))continue e;var g=r[d],p=r[d+c-1],m=g.length-g.match(a[0])[0].length,f=p.match(a[c-1])[0].length;l&&l.end.row===d&&l.end.column>m||(o.push(l=new s(d,m,d+c-1,f)),c>2&&(d=d+c-2))}}else for(var C=0;C<r.length;C++){var I=n.getMatchOffsets(r[C],a);for(u=0;u<I.length;u++){var A=I[u];o.push(new s(C,A.offset,C,A.offset+A.length))}}if(i){var v=i.start.column,b=i.start.column;C=0,u=o.length-1;while(C<u&&o[C].start.column<v&&o[C].start.row==i.start.row)C++;while(C<u&&o[u].end.column>b&&o[u].end.row==i.end.row)u--;for(o=o.slice(C,u+1),C=0,u=o.length;C<u;C++)o[C].start.row+=i.start.row,o[C].end.row+=i.start.row}return o},this.replace=function(e,t){var i=this.$options,n=this.$assembleRegExp(i);if(i.$isMultiLine)return t;if(n){var r=n.exec(e);if(!r||r[0].length!=e.length)return null;if(t=e.replace(n,t),i.preserveCase){t=t.split("");for(var s=Math.min(e.length,e.length);s--;){var o=e[s];o&&o.toLowerCase()!=o?t[s]=t[s].toUpperCase():t[s]=t[s].toLowerCase()}t=t.join("")}return t}},this.$assembleRegExp=function(e,t){if(e.needle instanceof RegExp)return e.re=e.needle;var i=e.needle;if(!e.needle)return e.re=!1;e.regExp||(i=n.escapeRegExp(i)),e.wholeWord&&(i=a(i,e));var r=e.caseSensitive?"gm":"gmi";if(e.$isMultiLine=!t&&/[\n\r]/.test(i),e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(i,r);try{var s=new RegExp(i,r)}catch(o){s=!1}return e.re=s},this.$assembleMultilineRegExp=function(e,t){for(var i=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),n=[],r=0;r<i.length;r++)try{n.push(new RegExp(i[r],t))}catch(s){return!1}return n},this.$matchIterator=function(e,t){var i=this.$assembleRegExp(t);if(!i)return!1;var n=1==t.backwards,r=0!=t.skipCurrent,s=t.range,o=t.start;o||(o=s?s[n?"end":"start"]:e.selection.getRange()),o.start&&(o=o[r!=n?"end":"start"]);var a=s?s.start.row:0,l=s?s.end.row:e.getLength()-1;if(n)var c=function(e){var i=o.row;if(!d(i,o.column,e)){for(i--;i>=a;i--)if(d(i,Number.MAX_VALUE,e))return;if(0!=t.wrap)for(i=l,a=o.row;i>=a;i--)if(d(i,Number.MAX_VALUE,e))return}};else c=function(e){var i=o.row;if(!d(i,o.column,e)){for(i+=1;i<=l;i++)if(d(i,0,e))return;if(0!=t.wrap)for(i=a,l=o.row;i<=l;i++)if(d(i,0,e))return}};if(t.$isMultiLine)var h=i.length,d=function(t,r,s){var o=n?t-h+1:t;if(!(o<0)){var a=e.getLine(o),l=a.search(i[0]);if(!(!n&&l<r||-1===l)){for(var c=1;c<h;c++)if(a=e.getLine(o+c),-1==a.search(i[c]))return;var d=a.match(i[h-1])[0].length;if(!(n&&d>r))return!!s(o,l,o+h-1,d)||void 0}}};else if(n)d=function(t,n,r){var s,o=e.getLine(t),a=[],l=0;i.lastIndex=0;while(s=i.exec(o)){var c=s[0].length;if(l=s.index,!c){if(l>=o.length)break;i.lastIndex=l+=1}if(s.index+c>n)break;a.push(s.index,c)}for(var h=a.length-1;h>=0;h-=2){var d=a[h-1];c=a[h];if(r(t,d,t,d+c))return!0}};else d=function(t,n,r){var s,o,a=e.getLine(t);i.lastIndex=n;while(o=i.exec(a)){var l=o[0].length;if(s=o.index,r(t,s,t,s+l))return!0;if(!l&&(i.lastIndex=s+=1,s>=a.length))return!1}};return{forEach:c}}}).call(o.prototype),t.Search=o})),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],(function(e,t,i){"use strict";var n=e("../lib/keys"),r=e("../lib/useragent"),s=n.KEY_MODS;function o(e,t){this.platform=t||(r.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=!0}function a(e,t){o.call(this,e,t),this.$singleCommand=!1}a.prototype=o.prototype,function(){function e(e){return"object"==typeof e&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}this.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},this.removeCommand=function(e,t){var i=e&&("string"===typeof e?e:e.name);e=this.commands[i],t||delete this.commands[i];var n=this.commandKeyBinding;for(var r in n){var s=n[r];if(s==e)delete n[r];else if(Array.isArray(s)){var o=s.indexOf(e);-1!=o&&(s.splice(o,1),1==s.length&&(n[r]=s[0]))}}},this.bindKey=function(e,t,i){if("object"==typeof e&&e&&(void 0==i&&(i=e.position),e=e[this.platform]),e)return"function"==typeof t?this.addCommand({exec:t,bindKey:e,name:t.name||e}):void e.split("|").forEach((function(e){var n="";if(-1!=e.indexOf(" ")){var r=e.split(/\s+/);e=r.pop(),r.forEach((function(e){var t=this.parseKeys(e),i=s[t.hashId]+t.key;n+=(n?" ":"")+i,this._addCommandToBinding(n,"chainKeys")}),this),n+=" "}var o=this.parseKeys(e),a=s[o.hashId]+o.key;this._addCommandToBinding(n+a,t,i)}),this)},this._addCommandToBinding=function(t,i,n){var r,s=this.commandKeyBinding;if(i)if(!s[t]||this.$singleCommand)s[t]=i;else{Array.isArray(s[t])?-1!=(r=s[t].indexOf(i))&&s[t].splice(r,1):s[t]=[s[t]],"number"!=typeof n&&(n=e(i));var o=s[t];for(r=0;r<o.length;r++){var a=o[r],l=e(a);if(l>n)break}o.splice(r,0,i)}else delete s[t]},this.addCommands=function(e){e&&Object.keys(e).forEach((function(t){var i=e[t];if(i){if("string"===typeof i)return this.bindKey(i,t);"function"===typeof i&&(i={exec:i}),"object"===typeof i&&(i.name||(i.name=t),this.addCommand(i))}}),this)},this.removeCommands=function(e){Object.keys(e).forEach((function(t){this.removeCommand(e[t])}),this)},this.bindKeys=function(e){Object.keys(e).forEach((function(t){this.bindKey(t,e[t])}),this)},this._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},this.parseKeys=function(e){var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter((function(e){return e})),i=t.pop(),r=n[i];if(n.FUNCTION_KEYS[r])i=n.FUNCTION_KEYS[r].toLowerCase();else{if(!t.length)return{key:i,hashId:-1};if(1==t.length&&"shift"==t[0])return{key:i.toUpperCase(),hashId:-1}}for(var s=0,o=t.length;o--;){var a=n.KEY_MODS[t[o]];if(null==a)return!1;s|=a}return{key:i,hashId:s}},this.findKeyCommand=function(e,t){var i=s[e]+t;return this.commandKeyBinding[i]},this.handleKeyboard=function(e,t,i,n){if(!(n<0)){var r=s[t]+i,o=this.commandKeyBinding[r];return e.$keyChain&&(e.$keyChain+=" "+r,o=this.commandKeyBinding[e.$keyChain]||o),!o||"chainKeys"!=o&&"chainKeys"!=o[o.length-1]?(e.$keyChain&&(t&&4!=t||1!=i.length?(-1==t||n>0)&&(e.$keyChain=""):e.$keyChain=e.$keyChain.slice(0,-r.length-1)),{command:o}):(e.$keyChain=e.$keyChain||r,{command:"null"})}},this.getStatusText=function(e,t){return t.$keyChain||""}}.call(o.prototype),t.HashHandler=o,t.MultiHashHandler=a})),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],(function(e,t,i){"use strict";var n=e("../lib/oop"),r=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,o=function(e,t){r.call(this,t,e),this.byName=this.commands,this.setDefaultHandler("exec",(function(e){return e.command.exec(e.editor,e.args||{})}))};n.inherits(o,r),function(){n.implement(this,s),this.exec=function(e,t,i){if(Array.isArray(e)){for(var n=e.length;n--;)if(this.exec(e[n],t,i))return!0;return!1}if("string"===typeof e&&(e=this.commands[e]),!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;if(0!=this.$checkCommandState&&e.isAvailable&&!e.isAvailable(t))return!1;var r={editor:t,command:e,args:i};return r.returnValue=this._emit("exec",r),this._signal("afterExec",r),!1!==r.returnValue},this.toggleRecording=function(e){if(!this.$inReplay)return e&&e._emit("changeStatus"),this.recording?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(e){this.macro.push([e.command,e.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},this.replay=function(e){if(!this.$inReplay&&this.macro){if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach((function(t){"string"==typeof t?this.exec(t,e):this.exec(t[0],e,t[1])}),this)}finally{this.$inReplay=!1}}},this.trimMacro=function(e){return e.map((function(e){return"string"!=typeof e[0]&&(e[0]=e[0].name),e[1]||(e=e[0]),e}))}}.call(o.prototype),t.CommandManager=o})),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],(function(e,t,i){"use strict";var n=e("../lib/lang"),r=e("../config"),s=e("../range").Range;function o(e,t){return{win:e,mac:t}}t.commands=[{name:"showSettingsMenu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){r.loadModule("ace/ext/settings_menu",(function(t){t.init(e),e.showSettingsMenu()}))},readOnly:!0},{name:"goToNextError",bindKey:o("Alt-E","F4"),exec:function(e){r.loadModule("./ext/error_marker",(function(t){t.showErrorMarker(e,1)}))},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",bindKey:o("Alt-Shift-E","Shift-F4"),exec:function(e){r.loadModule("./ext/error_marker",(function(t){t.showErrorMarker(e,-1)}))},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:o("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:o(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:o("Ctrl-L","Command-L"),exec:function(e,t){"number"!==typeof t||isNaN(t)||e.gotoLine(t),e.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:o("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:o("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",bindKey:o("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",bindKey:o("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:o("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:o("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:o("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:o("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:o("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:o("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:o("Ctrl-F","Command-F"),exec:function(e){r.loadModule("ace/ext/searchbox",(function(t){t.Search(e)}))},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:o("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:o("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:o("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:o("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:o("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:o("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:o("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:o("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:o("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:o("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:o("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:o("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:o("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:o("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:o("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:o("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:o("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:o("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:o("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:o("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:o(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:o("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:o(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:o("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:o("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:o("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:o("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:o("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:o("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:o("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:o(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(e){},readOnly:!0},{name:"cut",description:"Cut",exec:function(e){var t=e.$copyWithEmptySelection&&e.selection.isEmpty(),i=t?e.selection.getLineRange():e.selection.getRange();e._emit("cut",i),i.isEmpty()||e.session.remove(i),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:o("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:o("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:o("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:o("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:o("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:o("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:o("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:o("Ctrl-H","Command-Option-F"),exec:function(e){r.loadModule("ace/ext/searchbox",(function(t){t.Search(e,!0)}))}},{name:"undo",description:"Undo",bindKey:o("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",description:"Redo",bindKey:o("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:o("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:o("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:o("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:o("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:o("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:o("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:o("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:o("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:o("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:o("Ctrl-Shift-Backspace",null),exec:function(e){var t=e.selection.getRange();t.start.column=0,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:o("Ctrl-Shift-Delete",null),exec:function(e){var t=e.selection.getRange();t.end.column=Number.MAX_VALUE,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:o("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:o("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:o("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:o("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:o("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:o("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(e,t){e.insert(n.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:o(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:o("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:o("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:o("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:o(null,null),exec:function(e){e.autoIndent()},multiSelectAction:"forEachLine",scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:o("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"joinlines",description:"Join lines",bindKey:o(null,null),exec:function(e){for(var t=e.selection.isBackwards(),i=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),r=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),o=e.session.doc.getLine(i.row).length,a=e.session.doc.getTextRange(e.selection.getRange()),l=a.replace(/\n\s*/," ").length,c=e.session.doc.getLine(i.row),h=i.row+1;h<=r.row+1;h++){var d=n.stringTrimLeft(n.stringTrimRight(e.session.doc.getLine(h)));0!==d.length&&(d=" "+d),c+=d}r.row+1<e.session.doc.getLength()-1&&(c+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new s(i.row,0,r.row+2,0),c),l>0?(e.selection.moveCursorTo(i.row,i.column),e.selection.selectTo(i.row,i.column+l)):(o=e.session.doc.getLine(i.row).length>o?o+1:o,e.selection.moveCursorTo(i.row,o))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,i=e.session.doc.getLine(t).length,n=e.selection.rangeList.ranges,r=[];n.length<1&&(n=[e.selection.getRange()]);for(var o=0;o<n.length;o++)o==n.length-1&&(n[o].end.row===t&&n[o].end.column===i||r.push(new s(n[o].end.row,n[o].end.column,t,i))),0===o?0===n[o].start.row&&0===n[o].start.column||r.push(new s(0,0,n[o].start.row,n[o].start.column)):r.push(new s(n[o-1].end.row,n[o-1].end.column,n[o].start.row,n[o].start.column));e.exitMultiSelectMode(),e.clearSelection();for(o=0;o<r.length;o++)e.selection.addRange(r[o],!1)},readOnly:!0,scrollIntoView:"none"},{name:"addLineAfter",exec:function(e){e.selection.clearSelection(),e.navigateLineEnd(),e.insert("\n")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"addLineBefore",exec:function(e){e.selection.clearSelection();var t=e.getCursorPosition();e.selection.moveTo(t.row-1,Number.MAX_VALUE),e.insert("\n"),0===t.row&&e.navigateUp()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"openCommandPallete",description:"Open command pallete",bindKey:o("F1","F1"),exec:function(e){e.prompt({$type:"commands"})},readOnly:!0},{name:"modeSelect",description:"Change language mode...",bindKey:o(null,null),exec:function(e){e.prompt({$type:"modes"})},readOnly:!0}]})),ace.define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/clipboard"],(function(e,t,i){"use strict";e("./lib/fixoldbrowsers");var n=e("./lib/oop"),r=e("./lib/dom"),s=e("./lib/lang"),o=e("./lib/useragent"),a=e("./keyboard/textinput").TextInput,l=e("./mouse/mouse_handler").MouseHandler,c=e("./mouse/fold_handler").FoldHandler,h=e("./keyboard/keybinding").KeyBinding,d=e("./edit_session").EditSession,u=e("./search").Search,g=e("./range").Range,p=e("./lib/event_emitter").EventEmitter,m=e("./commands/command_manager").CommandManager,f=e("./commands/default_commands").commands,C=e("./config"),I=e("./token_iterator").TokenIterator,A=e("./clipboard"),v=function(e,t,i){this.$toDestroy=[];var n=e.getContainerElement();this.container=n,this.renderer=e,this.id="editor"+ ++v.$uid,this.commands=new m(o.isMac?"mac":"win",f),"object"==typeof document&&(this.textInput=new a(e.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new l(this),new c(this)),this.keyBinding=new h(this),this.$search=(new u).set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=s.delayedCall(function(){this._signal("input",{}),this.session&&this.session.bgTokenizer&&this.session.bgTokenizer.scheduleStart()}.bind(this)),this.on("change",(function(e,t){t._$emitInputEvent.schedule(31)})),this.setSession(t||i&&i.session||new d("")),C.resetOptions(this),i&&this.setOptions(i),C._signal("editor",this)};v.$uid=0,function(){n.implement(this,p),this.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0),this.$opResetTimer=s.delayedCall(this.endOperation.bind(this,!0)),this.on("change",function(){this.curOp||(this.startOperation(),this.curOp.selectionBefore=this.$lastSel),this.curOp.docChanged=!0}.bind(this),!0),this.on("changeSelection",function(){this.curOp||(this.startOperation(),this.curOp.selectionBefore=this.$lastSel),this.curOp.selectionChanged=!0}.bind(this),!0)},this.curOp=null,this.prevOp={},this.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(this.previousCommand=null,e={}),this.$opResetTimer.schedule(),this.curOp=this.session.curOp={command:e.command||{},args:e.args,scrollTop:this.renderer.scrollTop},this.curOp.selectionBefore=this.selection.toJSON()},this.endOperation=function(e){if(this.curOp&&this.session){if(e&&!1===e.returnValue||!this.session)return this.curOp=null;if(1==e&&this.curOp.command&&"mouse"==this.curOp.command.name)return;if(this._signal("beforeEndOperation"),!this.curOp)return;var t=this.curOp.command,i=t&&t.scrollIntoView;if(i){switch(i){case"center-animate":i="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var n=this.selection.getRange(),r=this.renderer.layerConfig;(n.start.row>=r.lastRow||n.end.row<=r.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break;default:break}"animate"==i&&this.renderer.animateScrolling(this.curOp.scrollTop)}var s=this.selection.toJSON();this.curOp.selectionAfter=s,this.$lastSel=this.selection.toJSON(),this.session.getUndoManager().addSelection(s),this.prevOp=this.curOp,this.curOp=null}},this.$mergeableCommands=["backspace","del","insertstring"],this.$historyTracker=function(e){if(this.$mergeUndoDeltas){var t=this.prevOp,i=this.$mergeableCommands,n=t.command&&e.command.name==t.command.name;if("insertstring"==e.command.name){var r=e.args;void 0===this.mergeNextCommand&&(this.mergeNextCommand=!0),n=n&&this.mergeNextCommand&&(!/\s/.test(r)||/\s/.test(t.args)),this.mergeNextCommand=!0}else n=n&&-1!==i.indexOf(e.command.name);"always"!=this.$mergeUndoDeltas&&Date.now()-this.sequenceStartTime>2e3&&(n=!1),n?this.session.mergeUndoDeltas=!0:-1!==i.indexOf(e.command.name)&&(this.sequenceStartTime=Date.now())}},this.setKeyboardHandler=function(e,t){if(e&&"string"===typeof e&&"ace"!=e){this.$keybindingId=e;var i=this;C.loadModule(["keybinding",e],(function(n){i.$keybindingId==e&&i.keyBinding.setKeyboardHandler(n&&n.handler),t&&t()}))}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),t&&t()},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(e){if(this.session!=e){this.curOp&&this.endOperation(),this.curOp={};var t=this.session;if(t){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange);var i=this.session.getSelection();i.off("changeCursor",this.$onCursorChange),i.off("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.on("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(e)),this._signal("changeSession",{session:e,oldSession:t}),this.curOp=null,t&&t._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this}),e&&e.bgTokenizer&&e.bgTokenizer.scheduleStart()}},this.getSession=function(){return this.session},this.setValue=function(e,t){return this.session.doc.setValue(e),t?1==t?this.navigateFileEnd():-1==t&&this.navigateFileStart():this.selectAll(),e},this.getValue=function(){return this.session.getValue()},this.getSelection=function(){return this.selection},this.resize=function(e){this.renderer.onResize(e)},this.setTheme=function(e,t){this.renderer.setTheme(e,t)},this.getTheme=function(){return this.renderer.getTheme()},this.setStyle=function(e){this.renderer.setStyle(e)},this.unsetStyle=function(e){this.renderer.unsetStyle(e)},this.getFontSize=function(){return this.getOption("fontSize")||r.computedStyle(this.container).fontSize},this.setFontSize=function(e){this.setOption("fontSize",e)},this.$highlightBrackets=function(){if(!this.$highlightPending){var e=this;this.$highlightPending=!0,setTimeout((function(){e.$highlightPending=!1;var t=e.session;if(t&&t.bgTokenizer){t.$bracketHighlight&&(t.$bracketHighlight.markerIds.forEach((function(e){t.removeMarker(e)})),t.$bracketHighlight=null);var i=t.getMatchingBracketRanges(e.getCursorPosition());if(!i&&t.$mode.getMatching&&(i=t.$mode.getMatching(e.session)),i){var n="ace_bracket";Array.isArray(i)?1==i.length&&(n="ace_error_bracket"):i=[i],2==i.length&&(0==g.comparePoints(i[0].end,i[1].start)?i=[g.fromPoints(i[0].start,i[1].end)]:0==g.comparePoints(i[0].start,i[1].end)&&(i=[g.fromPoints(i[1].start,i[0].end)])),t.$bracketHighlight={ranges:i,markerIds:i.map((function(e){return t.addMarker(e,n,"text")}))}}}}),50)}},this.$highlightTags=function(){if(!this.$highlightTagPending){var e=this;this.$highlightTagPending=!0,setTimeout((function(){e.$highlightTagPending=!1;var t=e.session;if(t&&t.bgTokenizer){var i=e.getCursorPosition(),n=new I(e.session,i.row,i.column),r=n.getCurrentToken();if(!r||!/\b(?:tag-open|tag-name)/.test(r.type))return t.removeMarker(t.$tagHighlight),void(t.$tagHighlight=null);if(-1==r.type.indexOf("tag-open")||(r=n.stepForward(),r)){var s=r.value,o=0,a=n.stepBackward();if("<"==a.value)do{a=r,r=n.stepForward(),r&&r.value===s&&-1!==r.type.indexOf("tag-name")&&("<"===a.value?o++:"</"===a.value&&o--)}while(r&&o>=0);else{do{r=a,a=n.stepBackward(),r&&r.value===s&&-1!==r.type.indexOf("tag-name")&&("<"===a.value?o++:"</"===a.value&&o--)}while(a&&o<=0);n.stepForward()}if(!r)return t.removeMarker(t.$tagHighlight),void(t.$tagHighlight=null);var l=n.getCurrentTokenRow(),c=n.getCurrentTokenColumn(),h=new g(l,c,l,c+r.value.length),d=t.$backMarkers[t.$tagHighlight];t.$tagHighlight&&void 0!=d&&0!==h.compareRange(d.range)&&(t.removeMarker(t.$tagHighlight),t.$tagHighlight=null),t.$tagHighlight||(t.$tagHighlight=t.addMarker(h,"ace_bracket","text"))}}}),50)}},this.focus=function(){var e=this;setTimeout((function(){e.isFocused()||e.textInput.focus()})),this.textInput.focus()},this.isFocused=function(){return this.textInput.isFocused()},this.blur=function(){this.textInput.blur()},this.onFocus=function(e){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",e))},this.onBlur=function(e){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",e))},this.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$highlightTags(),this.$updateHighlightActiveLine()},this.onDocumentChange=function(e){var t=this.session.$useWrapMode,i=e.start.row==e.end.row?e.end.row:1/0;this.renderer.updateLines(e.start.row,i,t),this._signal("change",e),this.$cursorChange()},this.onTokenizerUpdate=function(e){var t=e.data;this.renderer.updateLines(t.first,t.last)},this.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},this.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},this.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},this.$updateHighlightActiveLine=function(){var e,t=this.getSession();if(this.$highlightActiveLine&&("line"==this.$selectionStyle&&this.selection.isMultiLine()||(e=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(e=!1),!this.renderer.$maxLines||1!==this.session.getLength()||this.renderer.$minLines>1||(e=!1)),t.$highlightLineMarker&&!e)t.removeMarker(t.$highlightLineMarker.id),t.$highlightLineMarker=null;else if(!t.$highlightLineMarker&&e){var i=new g(e.row,e.column,e.row,1/0);i.id=t.addMarker(i,"ace_active-line","screenLine"),t.$highlightLineMarker=i}else e&&(t.$highlightLineMarker.start.row=e.row,t.$highlightLineMarker.end.row=e.row,t.$highlightLineMarker.start.column=e.column,t._signal("changeBackMarker"))},this.onSelectionChange=function(e){var t=this.session;if(t.$selectionMarker&&t.removeMarker(t.$selectionMarker),t.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var i=this.selection.getRange(),n=this.getSelectionStyle();t.$selectionMarker=t.addMarker(i,"ace_selection",n)}var r=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(r),this._signal("changeSelection")},this.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(!t.isEmpty()&&!t.isMultiLine()){var i=t.start.column,n=t.end.column,r=e.getLine(t.start.row),s=r.substring(i,n);if(!(s.length>5e3)&&/[\w\d]/.test(s)){var o=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:s}),a=r.substring(i-1,n+1);if(o.test(a))return o}}},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},this.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},this.onChangeWrapLimit=function(){this.renderer.updateFull()},this.onChangeWrapMode=function(){this.renderer.onResize(!0)},this.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},this.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},this.getCopyText=function(){var e=this.getSelectedText(),t=this.session.doc.getNewLineCharacter(),i=!1;if(!e&&this.$copyWithEmptySelection){i=!0;for(var n=this.selection.getAllRanges(),r=0;r<n.length;r++){var s=n[r];r&&n[r-1].start.row==s.start.row||(e+=this.session.getLine(s.start.row)+t)}}var o={text:e};return this._signal("copy",o),A.lineMode=i?o.text:"",o.text},this.onCopy=function(){this.commands.exec("copy",this)},this.onCut=function(){this.commands.exec("cut",this)},this.onPaste=function(e,t){var i={text:e,event:t};this.commands.exec("paste",this,i)},this.$handlePaste=function(e){"string"==typeof e&&(e={text:e}),this._signal("paste",e);var t=e.text,i=t==A.lineMode,n=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)i?n.insert({row:this.selection.lead.row,column:0},t):this.insert(t);else if(i)this.selection.rangeList.ranges.forEach((function(e){n.insert({row:e.start.row,column:0},t)}));else{var r=t.split(/\r\n|\r|\n/),s=this.selection.rangeList.ranges,o=2==r.length&&(!r[0]||!r[1]);if(r.length!=s.length||o)return this.commands.exec("insertstring",this,t);for(var a=s.length;a--;){var l=s[a];l.isEmpty()||n.remove(l),n.insert(l.start,r[a])}}},this.execCommand=function(e,t){return this.commands.exec(e,this,t)},this.insert=function(e,t){var i=this.session,n=i.getMode(),r=this.getCursorPosition();if(this.getBehavioursEnabled()&&!t){var s=n.transformAction(i.getState(r.row),"insertion",this,i,e);s&&(e!==s.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),e=s.text)}if("\t"==e&&(e=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&-1==e.indexOf("\n")){o=new g.fromPoints(r,r);o.end.column+=e.length,this.session.remove(o)}}else{var o=this.getSelectionRange();r=this.session.remove(o),this.clearSelection()}if("\n"==e||"\r\n"==e){var a=i.getLine(r.row);if(r.column>a.search(/\S|$/)){var l=a.substr(r.column).search(/\S|$/);i.doc.removeInLine(r.row,r.column,r.column+l)}}this.clearSelection();var c=r.column,h=i.getState(r.row),d=(a=i.getLine(r.row),n.checkOutdent(h,a,e));if(i.insert(r,e),s&&s.selection&&(2==s.selection.length?this.selection.setSelectionRange(new g(r.row,c+s.selection[0],r.row,c+s.selection[1])):this.selection.setSelectionRange(new g(r.row+s.selection[0],s.selection[1],r.row+s.selection[2],s.selection[3]))),this.$enableAutoIndent){if(i.getDocument().isNewLine(e)){var u=n.getNextLineIndent(h,a.slice(0,r.column),i.getTabString());i.insert({row:r.row+1,column:0},u)}d&&n.autoOutdent(h,i,r.row)}},this.autoIndent=function(){var e,t,i=this.session,n=i.getMode();if(this.selection.isEmpty())e=0,t=i.doc.getLength()-1;else{var r=this.getSelectionRange();e=r.start.row,t=r.end.row}for(var s,o,a,l="",c="",h="",d=i.getTabString(),u=e;u<=t;u++)u>0&&(l=i.getState(u-1),c=i.getLine(u-1),h=n.getNextLineIndent(l,c,d)),s=i.getLine(u),o=n.$getIndent(s),h!==o&&(o.length>0&&(a=new g(u,0,u,o.length),i.remove(a)),h.length>0&&i.insert({row:u,column:0},h)),n.autoOutdent(l,i,u)},this.onTextInput=function(e,t){if(!t)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var i=this.applyComposition.bind(this,e,t);this.selection.rangeCount?this.forEachSelection(i):i(),this.endOperation()},this.applyComposition=function(e,t){if(t.extendLeft||t.extendRight){var i=this.selection.getRange();i.start.column-=t.extendLeft,i.end.column+=t.extendRight,i.start.column<0&&(i.start.row--,i.start.column+=this.session.getLine(i.start.row).length+1),this.selection.setRange(i),e||i.isEmpty()||this.remove()}if(!e&&this.selection.isEmpty()||this.insert(e,!0),t.restoreStart||t.restoreEnd){i=this.selection.getRange();i.start.column-=t.restoreStart,i.end.column-=t.restoreEnd,this.selection.setRange(i)}},this.onCommandKey=function(e,t,i){return this.keyBinding.onCommandKey(e,t,i)},this.setOverwrite=function(e){this.session.setOverwrite(e)},this.getOverwrite=function(){return this.session.getOverwrite()},this.toggleOverwrite=function(){this.session.toggleOverwrite()},this.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},this.getScrollSpeed=function(){return this.getOption("scrollSpeed")},this.setDragDelay=function(e){this.setOption("dragDelay",e)},this.getDragDelay=function(){return this.getOption("dragDelay")},this.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},this.getSelectionStyle=function(){return this.getOption("selectionStyle")},this.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},this.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},this.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},this.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},this.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},this.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},this.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},this.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.setReadOnly=function(e){this.setOption("readOnly",e)},this.getReadOnly=function(){return this.getOption("readOnly")},this.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},this.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},this.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},this.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},this.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},this.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.remove=function(e){this.selection.isEmpty()&&("left"==e?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var i=this.session,n=i.getState(t.start.row),r=i.getMode().transformAction(n,"deletion",this,i,t);if(0===t.end.column){var s=i.getTextRange(t);if("\n"==s[s.length-1]){var o=i.getLine(t.end.row);/^\s+$/.test(o)&&(t.end.column=o.length)}}r&&(t=r)}this.session.remove(t),this.clearSelection()},this.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},this.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},this.transposeLetters=function(){if(this.selection.isEmpty()){var e=this.getCursorPosition(),t=e.column;if(0!==t){var i,n,r=this.session.getLine(e.row);t<r.length?(i=r.charAt(t)+r.charAt(t-1),n=new g(e.row,t-1,e.row,t+1)):(i=r.charAt(t-1)+r.charAt(t-2),n=new g(e.row,t-2,e.row,t)),this.session.replace(n,i),this.session.selection.moveToPosition(n.end)}}},this.toLowerCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),i=this.session.getTextRange(t);this.session.replace(t,i.toLowerCase()),this.selection.setSelectionRange(e)},this.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),i=this.session.getTextRange(t);this.session.replace(t,i.toUpperCase()),this.selection.setSelectionRange(e)},this.indent=function(){var e=this.session,t=this.getSelectionRange();if(!(t.start.row<t.end.row)){if(t.start.column<t.end.column){var i=e.getTextRange(t);if(!/^\s+$/.test(i)){h=this.$getSelectedRows();return void e.indentRows(h.first,h.last,"\t")}}var n=e.getLine(t.start.row),r=t.start,o=e.getTabSize(),a=e.documentToScreenColumn(r.row,r.column);if(this.session.getUseSoftTabs())var l=o-a%o,c=s.stringRepeat(" ",l);else{l=a%o;while(" "==n[t.start.column-1]&&l)t.start.column--,l--;this.selection.setSelectionRange(t),c="\t"}return this.insert(c)}var h=this.$getSelectedRows();e.indentRows(h.first,h.last,"\t")},this.blockIndent=function(){var e=this.$getSelectedRows();this.session.indentRows(e.first,e.last,"\t")},this.blockOutdent=function(){var e=this.session.getSelection();this.session.outdentRows(e.getRange())},this.sortLines=function(){for(var e=this.$getSelectedRows(),t=this.session,i=[],n=e.first;n<=e.last;n++)i.push(t.getLine(n));i.sort((function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:e.toLowerCase()>t.toLowerCase()?1:0}));var r=new g(0,0,0,0);for(n=e.first;n<=e.last;n++){var s=t.getLine(n);r.start.row=n,r.end.row=n,r.end.column=s.length,t.replace(r,i[n-e.first])}},this.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},this.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),i=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,i,e)},this.getNumberAt=function(e,t){var i=/[\-]?[0-9]+(?:\.[0-9]+)?/g;i.lastIndex=0;var n=this.session.getLine(e);while(i.lastIndex<t){var r=i.exec(n);if(r.index<=t&&r.index+r[0].length>=t){var s={value:r[0],start:r.index,end:r.index+r[0].length};return s}}return null},this.modifyNumber=function(e){var t=this.selection.getCursor().row,i=this.selection.getCursor().column,n=new g(t,i-1,t,i),r=this.session.getTextRange(n);if(!isNaN(parseFloat(r))&&isFinite(r)){var s=this.getNumberAt(t,i);if(s){var o=s.value.indexOf(".")>=0?s.start+s.value.indexOf(".")+1:s.end,a=s.start+s.value.length-o,l=parseFloat(s.value);l*=Math.pow(10,a),o!==s.end&&i<o?e*=Math.pow(10,s.end-i-1):e*=Math.pow(10,s.end-i),l+=e,l/=Math.pow(10,a);var c=l.toFixed(a),h=new g(t,s.start,t,s.end);this.session.replace(h,c),this.moveCursorTo(t,Math.max(s.start+1,i+c.length-s.value.length))}}else this.toggleWord()},this.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["in","out"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],this.toggleWord=function(){var e=this.selection.getCursor().row,t=this.selection.getCursor().column;this.selection.selectWord();var i=this.getSelectedText(),n=this.selection.getWordRange().start.column,r=i.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),o=t-n-1;o<0&&(o=0);var a=0,l=0,c=this;i.match(/[A-Za-z0-9_]+/)&&r.forEach((function(t,r){l=a+t.length,o>=a&&o<=l&&(i=t,c.selection.clearSelection(),c.moveCursorTo(e,a+n),c.selection.selectTo(e,l+n)),a=l}));for(var h,d=this.$toggleWordPairs,u=0;u<d.length;u++)for(var g=d[u],p=0;p<=1;p++){var m=+!p,f=i.match(new RegExp("^\\s?_?("+s.escapeRegExp(g[p])+")\\s?$","i"));if(f){var C=i.match(new RegExp("([_]|^|\\s)("+s.escapeRegExp(f[1])+")($|\\s)","g"));C&&(h=i.replace(new RegExp(s.escapeRegExp(g[p]),"i"),(function(e){var t=g[m];return e.toUpperCase()==e?t=t.toUpperCase():e.charAt(0).toUpperCase()==e.charAt(0)&&(t=t.substr(0,0)+g[m].charAt(0).toUpperCase()+t.substr(1)),t})),this.insert(h),h="")}}},this.removeLines=function(){var e=this.$getSelectedRows();this.session.removeFullLines(e.first,e.last),this.clearSelection()},this.duplicateSelection=function(){var e=this.selection,t=this.session,i=e.getRange(),n=e.isBackwards();if(i.isEmpty()){var r=i.start.row;t.duplicateLines(r,r)}else{var s=n?i.start:i.end,o=t.insert(s,t.getTextRange(i),!1);i.start=s,i.end=o,e.setSelectionRange(i,n)}},this.moveLinesDown=function(){this.$moveLines(1,!1)},this.moveLinesUp=function(){this.$moveLines(-1,!1)},this.moveText=function(e,t,i){return this.session.moveText(e,t,i)},this.copyLinesUp=function(){this.$moveLines(-1,!0)},this.copyLinesDown=function(){this.$moveLines(1,!0)},this.$moveLines=function(e,t){var i,n,r=this.selection;if(!r.inMultiSelectMode||this.inVirtualSelectionMode){var s=r.toOrientedRange();i=this.$getSelectedRows(s),n=this.session.$moveLines(i.first,i.last,t?0:e),t&&-1==e&&(n=0),s.moveBy(n,0),r.fromOrientedRange(s)}else{var o=r.rangeList.ranges;r.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var a=0,l=0,c=o.length,h=0;h<c;h++){var d=h;o[h].moveBy(a,0),i=this.$getSelectedRows(o[h]);var u=i.first,g=i.last;while(++h<c){l&&o[h].moveBy(l,0);var p=this.$getSelectedRows(o[h]);if(t&&p.first!=g)break;if(!t&&p.first>g+1)break;g=p.last}h--,a=this.session.$moveLines(u,g,t?0:e),t&&-1==e&&(d=h+1);while(d<=h)o[d].moveBy(a,0),d++;t||(a=0),l+=a}r.fromOrientedRange(r.ranges[0]),r.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},this.$getSelectedRows=function(e){return e=(e||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},this.onCompositionStart=function(e){this.renderer.showComposition(e)},this.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},this.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},this.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},this.$moveByPage=function(e,t){var i=this.renderer,n=this.renderer.layerConfig,r=e*Math.floor(n.height/n.lineHeight);!0===t?this.selection.$moveSelection((function(){this.moveCursorBy(r,0)})):!1===t&&(this.selection.moveCursorBy(r,0),this.selection.clearSelection());var s=i.scrollTop;i.scrollBy(0,r*n.lineHeight),null!=t&&i.scrollCursorIntoView(null,.5),i.animateScrolling(s)},this.selectPageDown=function(){this.$moveByPage(1,!0)},this.selectPageUp=function(){this.$moveByPage(-1,!0)},this.gotoPageDown=function(){this.$moveByPage(1,!1)},this.gotoPageUp=function(){this.$moveByPage(-1,!1)},this.scrollPageDown=function(){this.$moveByPage(1)},this.scrollPageUp=function(){this.$moveByPage(-1)},this.scrollToRow=function(e){this.renderer.scrollToRow(e)},this.scrollToLine=function(e,t,i,n){this.renderer.scrollToLine(e,t,i,n)},this.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},this.getSelectionRange=function(){return this.selection.getRange()},this.selectAll=function(){this.selection.selectAll()},this.clearSelection=function(){this.selection.clearSelection()},this.moveCursorTo=function(e,t){this.selection.moveCursorTo(e,t)},this.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},this.jumpToMatching=function(e,t){var i=this.getCursorPosition(),n=new I(this.session,i.row,i.column),r=n.getCurrentToken(),s=r||n.stepForward();if(s){var o,a,l=!1,c={},h=i.column-s.start,d={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(s.value.match(/[{}()\[\]]/g)){for(;h<s.value.length&&!l;h++)if(d[s.value[h]])switch(a=d[s.value[h]]+"."+s.type.replace("rparen","lparen"),isNaN(c[a])&&(c[a]=0),s.value[h]){case"(":case"[":case"{":c[a]++;break;case")":case"]":case"}":c[a]--,-1===c[a]&&(o="bracket",l=!0);break}}else-1!==s.type.indexOf("tag-name")&&(isNaN(c[s.value])&&(c[s.value]=0),"<"===r.value?c[s.value]++:"</"===r.value&&c[s.value]--,-1===c[s.value]&&(o="tag",l=!0));l||(r=s,s=n.stepForward(),h=0)}while(s&&!l);if(o){var u,p;if("bracket"===o)u=this.session.getBracketRange(i),u||(u=new g(n.getCurrentTokenRow(),n.getCurrentTokenColumn()+h-1,n.getCurrentTokenRow(),n.getCurrentTokenColumn()+h-1),p=u.start,(t||p.row===i.row&&Math.abs(p.column-i.column)<2)&&(u=this.session.getBracketRange(p)));else if("tag"===o){if(!s||-1===s.type.indexOf("tag-name"))return;var m=s.value;if(u=new g(n.getCurrentTokenRow(),n.getCurrentTokenColumn()-2,n.getCurrentTokenRow(),n.getCurrentTokenColumn()-2),0===u.compare(i.row,i.column)){l=!1;do{s=r,r=n.stepBackward(),r&&(-1!==r.type.indexOf("tag-close")&&u.setEnd(n.getCurrentTokenRow(),n.getCurrentTokenColumn()+1),s.value===m&&-1!==s.type.indexOf("tag-name")&&("<"===r.value?c[m]++:"</"===r.value&&c[m]--,0===c[m]&&(l=!0)))}while(r&&!l)}s&&s.type.indexOf("tag-name")&&(p=u.start,p.row==i.row&&Math.abs(p.column-i.column)<2&&(p=u.end))}p=u&&u.cursor||p,p&&(e?u&&t?this.selection.setRange(u):u&&u.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(p.row,p.column):this.selection.moveTo(p.row,p.column))}}},this.gotoLine=function(e,t,i){this.selection.clearSelection(),this.session.unfold({row:e-1,column:t||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(e-1,t||0),this.isRowFullyVisible(e-1)||this.scrollToLine(e-1,!0,i)},this.navigateTo=function(e,t){this.selection.moveTo(e,t)},this.navigateUp=function(e){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(-e||-1,0)},this.navigateDown=function(e){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(e||1,0)},this.navigateLeft=function(e){if(this.selection.isEmpty()){e=e||1;while(e--)this.selection.moveCursorLeft()}else{var t=this.getSelectionRange().start;this.moveCursorToPosition(t)}this.clearSelection()},this.navigateRight=function(e){if(this.selection.isEmpty()){e=e||1;while(e--)this.selection.moveCursorRight()}else{var t=this.getSelectionRange().end;this.moveCursorToPosition(t)}this.clearSelection()},this.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},this.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},this.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},this.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},this.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},this.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},this.replace=function(e,t){t&&this.$search.set(t);var i=this.$search.find(this.session),n=0;return i?(this.$tryReplace(i,e)&&(n=1),this.selection.setSelectionRange(i),this.renderer.scrollSelectionIntoView(i.start,i.end),n):n},this.replaceAll=function(e,t){t&&this.$search.set(t);var i=this.$search.findAll(this.session),n=0;if(!i.length)return n;var r=this.getSelectionRange();this.selection.moveTo(0,0);for(var s=i.length-1;s>=0;--s)this.$tryReplace(i[s],e)&&n++;return this.selection.setSelectionRange(r),n},this.$tryReplace=function(e,t){var i=this.session.getTextRange(e);return t=this.$search.replace(i,t),null!==t?(e.end=this.session.replace(e,t),e):null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(e,t,i){t||(t={}),"string"==typeof e||e instanceof RegExp?t.needle=e:"object"==typeof e&&n.mixin(t,e);var r=this.selection.getRange();null==t.needle&&(e=this.session.getTextRange(r)||this.$search.$options.needle,e||(r=this.session.getWordRange(r.start.row,r.start.column),e=this.session.getTextRange(r)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:r});var s=this.$search.find(this.session);return t.preventScroll?s:s?(this.revealRange(s,i),s):(t.backwards?r.start=r.end:r.end=r.start,void this.selection.setRange(r))},this.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},this.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},this.revealRange=function(e,t){this.session.unfold(e),this.selection.setSelectionRange(e);var i=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),!1!==t&&this.renderer.animateScrolling(i)},this.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.$toDestroy&&(this.$toDestroy.forEach((function(e){e.destroy()})),this.$toDestroy=null),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},this.setAutoScrollEditorIntoView=function(e){if(e){var t,i=this,n=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var r=this.$scrollAnchor;r.style.cssText="position:absolute",this.container.insertBefore(r,this.container.firstChild);var s=this.on("changeSelection",(function(){n=!0})),o=this.renderer.on("beforeRender",(function(){n&&(t=i.renderer.container.getBoundingClientRect())})),a=this.renderer.on("afterRender",(function(){if(n&&t&&(i.isFocused()||i.searchBox&&i.searchBox.isFocused())){var e=i.renderer,s=e.$cursorLayer.$pixelPos,o=e.layerConfig,a=s.top-o.offset;n=s.top>=0&&a+t.top<0||!(s.top<o.height&&s.top+t.top+o.lineHeight>window.innerHeight)&&null,null!=n&&(r.style.top=a+"px",r.style.left=s.left+"px",r.style.height=o.lineHeight+"px",r.scrollIntoView(n)),n=t=null}}));this.setAutoScrollEditorIntoView=function(e){e||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",s),this.renderer.off("afterRender",a),this.renderer.off("beforeRender",o))}}},this.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;t&&(t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&"wide"!=e,r.setCssClass(t.element,"ace_slim-cursors",/slim/.test(e)))},this.prompt=function(e,t,i){var n=this;C.loadModule("./ext/prompt",(function(r){r.prompt(n,e,t,i)}))}}.call(v.prototype),C.defineOptions(v.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.textInput.setReadOnly(e),this.$resetCursorStyle()},initialValue:!1},copyWithEmptySelection:{set:function(e){this.textInput.setCopyWithEmptySelection(e)},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},keyboardHandler:{set:function(e){this.setKeyboardHandler(e)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(e){this.session.setValue(e)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(e){this.setSession(e)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(e){this.renderer.$gutterLayer.setShowLineNumbers(e),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),e&&this.$relativeLineNumbers?b.attach(this):b.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?b.attach(this):b.detach(this)}},placeholder:{set:function(e){this.$updatePlaceholder||(this.$updatePlaceholder=function(){var e=this.session&&(this.renderer.$composition||this.getValue());if(e&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),r.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(e||this.renderer.placeholderNode)!e&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"");else{this.renderer.on("afterRender",this.$updatePlaceholder),r.addCssClass(this.container,"ace_hasPlaceholder");var t=r.createElement("div");t.className="ace_placeholder",t.textContent=this.$placeholder||"",this.renderer.placeholderNode=t,this.renderer.content.appendChild(this.renderer.placeholderNode)}}.bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var b={getText:function(e,t){return(Math.abs(e.selection.lead.row-t)||t+1+(t<9?"·":""))+""},getWidth:function(e,t,i){return Math.max(t.toString().length,(i.lastRow+1).toString().length,2)*i.characterWidth},update:function(e,t){t.renderer.$loop.schedule(t.renderer.CHANGE_GUTTER)},attach:function(e){e.renderer.$gutterLayer.$renderer=this,e.on("changeSelection",this.update),this.update(null,e)},detach:function(e){e.renderer.$gutterLayer.$renderer==this&&(e.renderer.$gutterLayer.$renderer=null),e.off("changeSelection",this.update),this.update(null,e)}};t.Editor=v})),ace.define("ace/undomanager",["require","exports","module","ace/range"],(function(e,t,i){"use strict";var n=function(){this.$maxRev=0,this.$fromUndo=!1,this.reset()};function r(e,t){for(var i=t;i--;){var n=e[i];if(n&&!n[0].ignore){while(i<t-1){var r=u(e[i],e[i+1]);e[i]=r[0],e[i+1]=r[1],i++}return!0}}}(function(){this.addSession=function(e){this.$session=e},this.add=function(e,t,i){this.$fromUndo||e!=this.$lastDelta&&(this.$keepRedoStack||(this.$redoStack.length=0),!1!==t&&this.lastDeltas||(this.lastDeltas=[],this.$undoStack.push(this.lastDeltas),e.id=this.$rev=++this.$maxRev),"remove"!=e.action&&"insert"!=e.action||(this.$lastDelta=e),this.lastDeltas.push(e))},this.addSelection=function(e,t){this.selections.push({value:e,rev:t||this.$rev})},this.startNewGroup=function(){return this.lastDeltas=null,this.$rev},this.markIgnored=function(e,t){null==t&&(t=this.$rev+1);for(var i=this.$undoStack,n=i.length;n--;){var r=i[n][0];if(r.id<=e)break;r.id<t&&(r.ignore=!0)}this.lastDeltas=null},this.getSelection=function(e,t){for(var i=this.selections,n=i.length;n--;){var r=i[n];if(r.rev<e)return t&&(r=i[n+1]),r}},this.getRevision=function(){return this.$rev},this.getDeltas=function(e,t){null==t&&(t=this.$rev+1);for(var i=this.$undoStack,n=null,r=0,s=i.length;s--;){var o=i[s][0];if(o.id<t&&!n&&(n=s+1),o.id<=e){r=s+1;break}}return i.slice(r,n)},this.getChangedRanges=function(e,t){null==t&&(t=this.$rev+1)},this.getChangedLines=function(e,t){null==t&&(t=this.$rev+1)},this.undo=function(e,t){this.lastDeltas=null;var i=this.$undoStack;if(r(i,i.length)){e||(e=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var n=i.pop(),s=null;return n&&(s=e.undoChanges(n,t),this.$redoStack.push(n),this.$syncRev()),this.$fromUndo=!1,s}},this.redo=function(e,t){if(this.lastDeltas=null,e||(e=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var i=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);I(this.$redoStack,i),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach((function(e){e[0].id=++this.$maxRev}),this)}var n=this.$redoStack.pop(),r=null;return n&&(r=e.redoChanges(n,t),this.$undoStack.push(n),this.$syncRev()),this.$fromUndo=!1,r},this.$syncRev=function(){var e=this.$undoStack,t=e[e.length-1],i=t&&t[0].id||0;this.$redoStackBaseRev=i,this.$rev=i},this.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},this.canUndo=function(){return this.$undoStack.length>0},this.canRedo=function(){return this.$redoStack.length>0},this.bookmark=function(e){void 0==e&&(e=this.$rev),this.mark=e},this.isAtBookmark=function(){return this.$rev===this.mark},this.toJSON=function(){},this.fromJSON=function(){},this.hasUndo=this.canUndo,this.hasRedo=this.canRedo,this.isClean=this.isAtBookmark,this.markClean=this.bookmark,this.$prettyPrint=function(e){return e?c(e):c(this.$undoStack)+"\n---\n"+c(this.$redoStack)}}).call(n.prototype);var s=e("./range").Range,o=s.comparePoints;s.comparePoints;function a(e){return{row:e.row,column:e.column}}function l(e){return{start:a(e.start),end:a(e.end),action:e.action,lines:e.lines.slice()}}function c(e){if(e=e||this,Array.isArray(e))return e.map(c).join("\n");var t="";return e.action?(t="insert"==e.action?"+":"-",t+="["+e.lines+"]"):e.value&&(t=Array.isArray(e.value)?e.value.map(h).join("\n"):h(e.value)),e.start&&(t+=h(e)),(e.id||e.rev)&&(t+="\t("+(e.id||e.rev)+")"),t}function h(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function d(e,t){var i="insert"==e.action,n="insert"==t.action;if(i&&n)if(o(t.start,e.end)>=0)p(t,e,-1);else{if(!(o(t.start,e.start)<=0))return null;p(e,t,1)}else if(i&&!n)if(o(t.start,e.end)>=0)p(t,e,-1);else{if(!(o(t.end,e.start)<=0))return null;p(e,t,-1)}else if(!i&&n)if(o(t.start,e.start)>=0)p(t,e,1);else{if(!(o(t.start,e.start)<=0))return null;p(e,t,1)}else if(!i&&!n)if(o(t.start,e.start)>=0)p(t,e,1);else{if(!(o(t.end,e.start)<=0))return null;p(e,t,-1)}return[t,e]}function u(e,t){for(var i=e.length;i--;)for(var n=0;n<t.length;n++)if(!d(e[i],t[n])){while(i<e.length){while(n--)d(t[n],e[i]);n=t.length,i++}return[e,t]}return e.selectionBefore=t.selectionBefore=e.selectionAfter=t.selectionAfter=null,[t,e]}function g(e,t){var i="insert"==e.action,n="insert"==t.action;if(i&&n)o(e.start,t.start)<0?p(t,e,1):p(e,t,1);else if(i&&!n)o(e.start,t.end)>=0?p(e,t,-1):(o(e.start,t.start)<=0||p(e,s.fromPoints(t.start,e.start),-1),p(t,e,1));else if(!i&&n)o(t.start,e.end)>=0?p(t,e,-1):(o(t.start,e.start)<=0||p(t,s.fromPoints(e.start,t.start),-1),p(e,t,1));else if(!i&&!n)if(o(t.start,e.end)>=0)p(t,e,-1);else{var r,a;if(!(o(t.end,e.start)<=0))return o(e.start,t.start)<0&&(r=e,e=f(e,t.start)),o(e.end,t.end)>0&&(a=f(e,t.end)),m(t.end,e.start,e.end,-1),a&&!r&&(e.lines=a.lines,e.start=a.start,e.end=a.end,a=e),[t,r,a].filter(Boolean);p(e,t,-1)}return[t,e]}function p(e,t,i){m(e.start,t.start,t.end,i),m(e.end,t.start,t.end,i)}function m(e,t,i,n){e.row==(1==n?t:i).row&&(e.column+=n*(i.column-t.column)),e.row+=n*(i.row-t.row)}function f(e,t){var i=e.lines,n=e.end;e.end=a(t);var r=e.end.row-e.start.row,s=i.splice(r,i.length),o=r?t.column:t.column-e.start.column;i.push(s[0].substring(0,o)),s[0]=s[0].substr(o);var l={start:a(t),end:n,lines:s,action:e.action};return l}function C(e,t){t=l(t);for(var i=e.length;i--;){for(var n=e[i],r=0;r<n.length;r++){var s=n[r],o=g(s,t);t=o[0],2!=o.length&&(o[2]?(n.splice(r+1,1,o[1],o[2]),r++):o[1]||(n.splice(r,1),r--))}n.length||e.splice(i,1)}return e}function I(e,t){for(var i=0;i<t.length;i++)for(var n=t[i],r=0;r<n.length;r++)C(e,n[r])}t.UndoManager=n})),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],(function(e,t,i){"use strict";var n=e("../lib/dom"),r=function(e,t){this.element=e,this.canvasHeight=t||5e5,this.element.style.height=2*this.canvasHeight+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0};(function(){this.moveContainer=function(e){n.translate(this.element,0,-e.firstRowScreen*e.lineHeight%this.canvasHeight-e.offset*this.$offsetCoefficient)},this.pageChanged=function(e,t){return Math.floor(e.firstRowScreen*e.lineHeight/this.canvasHeight)!==Math.floor(t.firstRowScreen*t.lineHeight/this.canvasHeight)},this.computeLineTop=function(e,t,i){var n=t.firstRowScreen*t.lineHeight,r=Math.floor(n/this.canvasHeight),s=i.documentToScreenRow(e,0)*t.lineHeight;return s-r*this.canvasHeight},this.computeLineHeight=function(e,t,i){return t.lineHeight*i.getRowLineCount(e)},this.getLength=function(){return this.cells.length},this.get=function(e){return this.cells[e]},this.shift=function(){this.$cacheCell(this.cells.shift())},this.pop=function(){this.$cacheCell(this.cells.pop())},this.push=function(e){if(Array.isArray(e)){this.cells.push.apply(this.cells,e);for(var t=n.createFragment(this.element),i=0;i<e.length;i++)t.appendChild(e[i].element);this.element.appendChild(t)}else this.cells.push(e),this.element.appendChild(e.element)},this.unshift=function(e){if(Array.isArray(e)){this.cells.unshift.apply(this.cells,e);for(var t=n.createFragment(this.element),i=0;i<e.length;i++)t.appendChild(e[i].element);this.element.firstChild?this.element.insertBefore(t,this.element.firstChild):this.element.appendChild(t)}else this.cells.unshift(e),this.element.insertAdjacentElement("afterbegin",e.element)},this.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},this.$cacheCell=function(e){e&&(e.element.remove(),this.cellCache.push(e))},this.createCell=function(e,t,i,r){var s=this.cellCache.pop();if(!s){var o=n.createElement("div");r&&r(o),this.element.appendChild(o),s={element:o,text:"",row:e}}return s.row=e,s}}).call(r.prototype),t.Lines=r})),ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/layer/lines"],(function(e,t,i){"use strict";var n=e("../lib/dom"),r=e("../lib/oop"),s=e("../lib/lang"),o=e("../lib/event_emitter").EventEmitter,a=e("./lines").Lines,l=function(e){this.element=n.createElement("div"),this.element.className="ace_layer ace_gutter-layer",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new a(this.element),this.$lines.$offsetCoefficient=1};function c(e){var t=document.createTextNode("");e.appendChild(t);var i=n.createElement("span");return e.appendChild(i),e}(function(){r.implement(this,o),this.setSession=function(e){this.session&&this.session.off("change",this.$updateAnnotations),this.session=e,e&&e.on("change",this.$updateAnnotations)},this.addGutterDecoration=function(e,t){window.console&&console.warn,this.session.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){window.console&&console.warn,this.session.removeGutterDecoration(e,t)},this.setAnnotations=function(e){this.$annotations=[];for(var t=0;t<e.length;t++){var i=e[t],n=i.row,r=this.$annotations[n];r||(r=this.$annotations[n]={text:[]});var o=i.text;o=o?s.escapeHTML(o):i.html||"",-1===r.text.indexOf(o)&&r.text.push(o);var a=i.type;"error"==a?r.className=" ace_error":"warning"==a&&" ace_error"!=r.className?r.className=" ace_warning":"info"!=a||r.className||(r.className=" ace_info")}},this.$updateAnnotations=function(e){if(this.$annotations.length){var t=e.start.row,i=e.end.row-t;if(0===i);else if("remove"==e.action)this.$annotations.splice(t,i+1,null);else{var n=new Array(i+1);n.unshift(t,1),this.$annotations.splice.apply(this.$annotations,n)}}},this.update=function(e){this.config=e;var t=this.session,i=e.firstRow,n=Math.min(e.lastRow+e.gutterOffset,t.getLength()-1);this.oldLastRow=n,this.config=e,this.$lines.moveContainer(e),this.$updateCursorRow();var r=t.getNextFoldLine(i),s=r?r.start.row:1/0,o=null,a=-1,l=i;while(1){if(l>s&&(l=r.end.row+1,r=t.getNextFoldLine(l,r),s=r?r.start.row:1/0),l>n){while(this.$lines.getLength()>a+1)this.$lines.pop();break}o=this.$lines.get(++a),o?o.row=l:(o=this.$lines.createCell(l,e,this.session,c),this.$lines.push(o)),this.$renderCell(o,e,r,l),l++}this._signal("afterRender"),this.$updateGutterWidth(e)},this.$updateGutterWidth=function(e){var t=this.session,i=t.gutterRenderer||this.$renderer,n=t.$firstLineNumber,r=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||t.$useWrapMode)&&(r=t.getLength()+n-1);var s=i?i.getWidth(t,r,e):r.toString().length*e.characterWidth,o=this.$padding||this.$computePadding();s+=o.left+o.right,s===this.gutterWidth||isNaN(s)||(this.gutterWidth=s,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",s))},this.$updateCursorRow=function(){if(this.$highlightGutterLine){var e=this.session.selection.getCursor();this.$cursorRow!==e.row&&(this.$cursorRow=e.row)}},this.updateLineHighlight=function(){if(this.$highlightGutterLine){var e=this.session.selection.cursor.row;if(this.$cursorRow=e,!this.$cursorCell||this.$cursorCell.row!=e){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var t=this.$lines.cells;this.$cursorCell=null;for(var i=0;i<t.length;i++){var n=t[i];if(n.row>=this.$cursorRow){if(n.row>this.$cursorRow){var r=this.session.getFoldLine(this.$cursorRow);if(!(i>0&&r&&r.start.row==t[i-1].row))break;n=t[i-1]}n.element.className="ace_gutter-active-line "+n.element.className,this.$cursorCell=n;break}}}}},this.scrollLines=function(e){var t=this.config;if(this.config=e,this.$updateCursorRow(),this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var i=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),n=this.oldLastRow;if(this.oldLastRow=i,!t||n<e.firstRow)return this.update(e);if(i<t.firstRow)return this.update(e);if(t.firstRow<e.firstRow)for(var r=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);r>0;r--)this.$lines.shift();if(n>i)for(r=this.session.getFoldedRowCount(i+1,n);r>0;r--)this.$lines.pop();e.firstRow<t.firstRow&&this.$lines.unshift(this.$renderLines(e,e.firstRow,t.firstRow-1)),i>n&&this.$lines.push(this.$renderLines(e,n+1,i)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},this.$renderLines=function(e,t,i){var n=[],r=t,s=this.session.getNextFoldLine(r),o=s?s.start.row:1/0;while(1){if(r>o&&(r=s.end.row+1,s=this.session.getNextFoldLine(r,s),o=s?s.start.row:1/0),r>i)break;var a=this.$lines.createCell(r,e,this.session,c);this.$renderCell(a,e,s,r),n.push(a),r++}return n},this.$renderCell=function(e,t,i,r){var s=e.element,o=this.session,a=s.childNodes[0],l=s.childNodes[1],c=o.$firstLineNumber,h=o.$breakpoints,d=o.$decorations,u=o.gutterRenderer||this.$renderer,g=this.$showFoldWidgets&&o.foldWidgets,p=i?i.start.row:Number.MAX_VALUE,m="ace_gutter-cell ";if(this.$highlightGutterLine&&(r==this.$cursorRow||i&&r<this.$cursorRow&&r>=p&&this.$cursorRow<=i.end.row)&&(m+="ace_gutter-active-line ",this.$cursorCell!=e&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=e)),h[r]&&(m+=h[r]),d[r]&&(m+=d[r]),this.$annotations[r]&&(m+=this.$annotations[r].className),s.className!=m&&(s.className=m),g){var f=g[r];null==f&&(f=g[r]=o.getFoldWidget(r))}if(f){m="ace_fold-widget ace_"+f;"start"==f&&r==p&&r<i.end.row?m+=" ace_closed":m+=" ace_open",l.className!=m&&(l.className=m);var C=t.lineHeight+"px";n.setStyle(l.style,"height",C),n.setStyle(l.style,"display","inline-block")}else l&&n.setStyle(l.style,"display","none");var I=(u?u.getText(o,r):r+c).toString();return I!==a.data&&(a.data=I),n.setStyle(e.element.style,"height",this.$lines.computeLineHeight(r,t,o)+"px"),n.setStyle(e.element.style,"top",this.$lines.computeLineTop(r,t,o)+"px"),e.text=I,e},this.$fixedWidth=!1,this.$highlightGutterLine=!0,this.$renderer="",this.setHighlightGutterLine=function(e){this.$highlightGutterLine=e},this.$showLineNumbers=!0,this.$renderer="",this.setShowLineNumbers=function(e){this.$renderer=!e&&{getWidth:function(){return 0},getText:function(){return""}}},this.getShowLineNumbers=function(){return this.$showLineNumbers},this.$showFoldWidgets=!0,this.setShowFoldWidgets=function(e){e?n.addCssClass(this.element,"ace_folding-enabled"):n.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=e,this.$padding=null},this.getShowFoldWidgets=function(){return this.$showFoldWidgets},this.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var e=n.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(e.borderLeftWidth)||0)+(parseInt(e.paddingLeft)||0)+1,this.$padding.right=(parseInt(e.borderRightWidth)||0)+(parseInt(e.paddingRight)||0),this.$padding},this.getRegion=function(e){var t=this.$padding||this.$computePadding(),i=this.element.getBoundingClientRect();return e.x<t.left+i.left?"markers":this.$showFoldWidgets&&e.x>i.right-t.right?"foldWidgets":void 0}}).call(l.prototype),t.Gutter=l})),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],(function(e,t,i){"use strict";var n=e("../range").Range,r=e("../lib/dom"),s=function(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)};(function(){function e(e,t,i,n){return(e?1:0)|(t?2:0)|(i?4:0)|(n?8:0)}this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setMarkers=function(e){this.markers=e},this.elt=function(e,t){var i=-1!=this.i&&this.element.childNodes[this.i];i?this.i++:(i=document.createElement("div"),this.element.appendChild(i),this.i=-1),i.style.cssText=t,i.className=e},this.update=function(e){if(e){var t;for(var i in this.config=e,this.i=0,this.markers){var n=this.markers[i];if(n.range){var r=n.range.clipRows(e.firstRow,e.lastRow);if(!r.isEmpty())if(r=r.toScreenRange(this.session),n.renderer){var s=this.$getTop(r.start.row,e),o=this.$padding+r.start.column*e.characterWidth;n.renderer(t,r,o,s,e)}else"fullLine"==n.type?this.drawFullLineMarker(t,r,n.clazz,e):"screenLine"==n.type?this.drawScreenLineMarker(t,r,n.clazz,e):r.isMultiLine()?"text"==n.type?this.drawTextMarker(t,r,n.clazz,e):this.drawMultiLineMarker(t,r,n.clazz,e):this.drawSingleLineMarker(t,r,n.clazz+" ace_start ace_br15",e)}else n.update(t,this,this.session,e)}if(-1!=this.i)while(this.i<this.element.childElementCount)this.element.removeChild(this.element.lastChild)}},this.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},this.drawTextMarker=function(t,i,r,s,o){for(var a=this.session,l=i.start.row,c=i.end.row,h=l,d=0,u=0,g=a.getScreenLastRowColumn(h),p=new n(h,i.start.column,h,u);h<=c;h++)p.start.row=p.end.row=h,p.start.column=h==l?i.start.column:a.getRowWrapIndent(h),p.end.column=g,d=u,u=g,g=h+1<c?a.getScreenLastRowColumn(h+1):h==c?0:i.end.column,this.drawSingleLineMarker(t,p,r+(h==l?" ace_start":"")+" ace_br"+e(h==l||h==l+1&&i.start.column,d<u,u>g,h==c),s,h==c?0:1,o)},this.drawMultiLineMarker=function(e,t,i,n,r){var s=this.$padding,o=n.lineHeight,a=this.$getTop(t.start.row,n),l=s+t.start.column*n.characterWidth;if(r=r||"",this.session.$bidiHandler.isBidiRow(t.start.row)){var c=t.clone();c.end.row=c.start.row,c.end.column=this.session.getLine(c.start.row).length,this.drawBidiSingleLineMarker(e,c,i+" ace_br1 ace_start",n,null,r)}else this.elt(i+" ace_br1 ace_start","height:"+o+"px;right:0;top:"+a+"px;left:"+l+"px;"+(r||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){c=t.clone();c.start.row=c.end.row,c.start.column=0,this.drawBidiSingleLineMarker(e,c,i+" ace_br12",n,null,r)}else{a=this.$getTop(t.end.row,n);var h=t.end.column*n.characterWidth;this.elt(i+" ace_br12","height:"+o+"px;width:"+h+"px;top:"+a+"px;left:"+s+"px;"+(r||""))}if(o=(t.end.row-t.start.row-1)*n.lineHeight,!(o<=0)){a=this.$getTop(t.start.row+1,n);var d=(t.start.column?1:0)|(t.end.column?0:8);this.elt(i+(d?" ace_br"+d:""),"height:"+o+"px;right:0;top:"+a+"px;left:"+s+"px;"+(r||""))}},this.drawSingleLineMarker=function(e,t,i,n,r,s){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,i,n,r,s);var o=n.lineHeight,a=(t.end.column+(r||0)-t.start.column)*n.characterWidth,l=this.$getTop(t.start.row,n),c=this.$padding+t.start.column*n.characterWidth;this.elt(i,"height:"+o+"px;width:"+a+"px;top:"+l+"px;left:"+c+"px;"+(s||""))},this.drawBidiSingleLineMarker=function(e,t,i,n,r,s){var o=n.lineHeight,a=this.$getTop(t.start.row,n),l=this.$padding,c=this.session.$bidiHandler.getSelections(t.start.column,t.end.column);c.forEach((function(e){this.elt(i,"height:"+o+"px;width:"+e.width+(r||0)+"px;top:"+a+"px;left:"+(l+e.left)+"px;"+(s||""))}),this)},this.drawFullLineMarker=function(e,t,i,n,r){var s=this.$getTop(t.start.row,n),o=n.lineHeight;t.start.row!=t.end.row&&(o+=this.$getTop(t.end.row,n)-s),this.elt(i,"height:"+o+"px;top:"+s+"px;left:0;right:0;"+(r||""))},this.drawScreenLineMarker=function(e,t,i,n,r){var s=this.$getTop(t.start.row,n),o=n.lineHeight;this.elt(i,"height:"+o+"px;top:"+s+"px;left:0;right:0;"+(r||""))}}).call(s.prototype),t.Marker=s})),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter"],(function(e,t,i){"use strict";var n=e("../lib/oop"),r=e("../lib/dom"),s=e("../lib/lang"),o=e("./lines").Lines,a=e("../lib/event_emitter").EventEmitter,l=function(e){this.dom=r,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new o(this.element)};(function(){n.implement(this,a),this.EOF_CHAR="¶",this.EOL_CHAR_LF="¬",this.EOL_CHAR_CRLF="¤",this.EOL_CHAR=this.EOL_CHAR_LF,this.TAB_CHAR="—",this.SPACE_CHAR="·",this.$padding=0,this.MAX_LINE_LENGTH=1e4,this.$updateEolChar=function(){var e=this.session.doc,t="\n"==e.getNewLineCharacter()&&"windows"!=e.getNewLineMode(),i=t?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=i)return this.EOL_CHAR=i,!0},this.setPadding=function(e){this.$padding=e,this.element.style.margin="0 "+e+"px"},this.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},this.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},this.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",function(e){this._signal("changeCharacterSize",e)}.bind(this)),this.$pollSizeChanges()},this.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},this.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},this.setSession=function(e){this.session=e,e&&this.$computeTabString()},this.showInvisibles=!1,this.showSpaces=!1,this.showTabs=!1,this.showEOL=!1,this.setShowInvisibles=function(e){return this.showInvisibles!=e&&(this.showInvisibles=e,"string"==typeof e?(this.showSpaces=/tab/i.test(e),this.showTabs=/space/i.test(e),this.showEOL=/eol/i.test(e)):this.showSpaces=this.showTabs=this.showEOL=e,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(e){return this.displayIndentGuides!=e&&(this.displayIndentGuides=e,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;for(var t=this.$tabStrings=[0],i=1;i<e+1;i++)if(this.showTabs){var n=this.dom.createElement("span");n.className="ace_invisible ace_invisible_tab",n.textContent=s.stringRepeat(this.TAB_CHAR,i),t.push(n)}else t.push(this.dom.createTextNode(s.stringRepeat(" ",i),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var r="ace_indent-guide",o=this.showSpaces?" ace_invisible ace_invisible_space":"",a=this.showSpaces?s.stringRepeat(this.SPACE_CHAR,this.tabSize):s.stringRepeat(" ",this.tabSize),l=this.showTabs?" ace_invisible ace_invisible_tab":"",c=this.showTabs?s.stringRepeat(this.TAB_CHAR,this.tabSize):a;n=this.dom.createElement("span");n.className=r+o,n.textContent=a,this.$tabStrings[" "]=n;n=this.dom.createElement("span");n.className=r+l,n.textContent=c,this.$tabStrings["\t"]=n}},this.updateLines=function(e,t,i){if(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)return this.update(e);this.config=e;for(var n=Math.max(t,e.firstRow),r=Math.min(i,e.lastRow),s=this.element.childNodes,o=0,a=e.firstRow;a<n;a++){var l=this.session.getFoldLine(a);if(l){if(l.containsRow(n)){n=l.start.row;break}a=l.end.row}o++}var c=!1,h=(a=n,l=this.session.getNextFoldLine(a),l?l.start.row:1/0);while(1){if(a>h&&(a=l.end.row+1,l=this.session.getNextFoldLine(a,l),h=l?l.start.row:1/0),a>r)break;var d=s[o++];if(d){this.dom.removeChildren(d),this.$renderLine(d,a,a==h&&l),c&&(d.style.top=this.$lines.computeLineTop(a,e,this.session)+"px");var u=e.lineHeight*this.session.getRowLength(a)+"px";d.style.height!=u&&(c=!0,d.style.height=u)}a++}if(c)while(o<this.$lines.cells.length){var g=this.$lines.cells[o++];g.element.style.top=this.$lines.computeLineTop(g.row,e,this.session)+"px"}},this.scrollLines=function(e){var t=this.config;if(this.config=e,this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var i=e.lastRow,n=t?t.lastRow:-1;if(!t||n<e.firstRow)return this.update(e);if(i<t.firstRow)return this.update(e);if(!t||t.lastRow<e.firstRow)return this.update(e);if(e.lastRow<t.firstRow)return this.update(e);if(t.firstRow<e.firstRow)for(var r=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);r>0;r--)this.$lines.shift();if(t.lastRow>e.lastRow)for(r=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);r>0;r--)this.$lines.pop();e.firstRow<t.firstRow&&this.$lines.unshift(this.$renderLinesFragment(e,e.firstRow,t.firstRow-1)),e.lastRow>t.lastRow&&this.$lines.push(this.$renderLinesFragment(e,t.lastRow+1,e.lastRow))},this.$renderLinesFragment=function(e,t,i){var n=[],s=t,o=this.session.getNextFoldLine(s),a=o?o.start.row:1/0;while(1){if(s>a&&(s=o.end.row+1,o=this.session.getNextFoldLine(s,o),a=o?o.start.row:1/0),s>i)break;var l=this.$lines.createCell(s,e,this.session),c=l.element;this.dom.removeChildren(c),r.setStyle(c.style,"height",this.$lines.computeLineHeight(s,e,this.session)+"px"),r.setStyle(c.style,"top",this.$lines.computeLineTop(s,e,this.session)+"px"),this.$renderLine(c,s,s==a&&o),this.$useLineGroups()?c.className="ace_line_group":c.className="ace_line",n.push(l),s++}return n},this.update=function(e){this.$lines.moveContainer(e),this.config=e;var t=e.firstRow,i=e.lastRow,n=this.$lines;while(n.getLength())n.pop();n.push(this.$renderLinesFragment(e,t,i))},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(e,t,i,n){var r,o=this,a=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,l=this.dom.createFragment(this.element),c=0;while(r=a.exec(n)){var h=r[1],d=r[2],u=r[3],g=r[4],p=r[5];if(o.showSpaces||!d){var m=c!=r.index?n.slice(c,r.index):"";if(c=r.index+r[0].length,m&&l.appendChild(this.dom.createTextNode(m,this.element)),h){var f=o.session.getScreenTabSize(t+r.index);l.appendChild(o.$tabStrings[f].cloneNode(!0)),t+=f-1}else if(d)if(o.showSpaces){var C=this.dom.createElement("span");C.className="ace_invisible ace_invisible_space",C.textContent=s.stringRepeat(o.SPACE_CHAR,d.length),l.appendChild(C)}else l.appendChild(this.com.createTextNode(d,this.element));else if(u){C=this.dom.createElement("span");C.className="ace_invisible ace_invisible_space ace_invalid",C.textContent=s.stringRepeat(o.SPACE_CHAR,u.length),l.appendChild(C)}else if(g){t+=1;C=this.dom.createElement("span");C.style.width=2*o.config.characterWidth+"px",C.className=o.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",C.textContent=o.showSpaces?o.SPACE_CHAR:g,l.appendChild(C)}else if(p){t+=1;C=this.dom.createElement("span");C.style.width=2*o.config.characterWidth+"px",C.className="ace_cjk",C.textContent=p,l.appendChild(C)}}}if(l.appendChild(this.dom.createTextNode(c?n.slice(c):n,this.element)),this.$textToken[i.type])e.appendChild(l);else{var I="ace_"+i.type.replace(/\./g," ace_");C=this.dom.createElement("span");"fold"==i.type&&(C.style.width=i.value.length*this.config.characterWidth+"px"),C.className=I,C.appendChild(l),e.appendChild(C)}return t+n.length},this.renderIndentGuide=function(e,t,i){var n=t.search(this.$indentGuideRe);if(n<=0||n>=i)return t;if(" "==t[0]){n-=n%this.tabSize;for(var r=n/this.tabSize,s=0;s<r;s++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return t.substr(n)}if("\t"==t[0]){for(s=0;s<n;s++)e.appendChild(this.$tabStrings["\t"].cloneNode(!0));return t.substr(n)}return t},this.$createLineElement=function(e){var t=this.dom.createElement("div");return t.className="ace_line",t.style.height=this.config.lineHeight+"px",t},this.$renderWrappedLine=function(e,t,i){var n=0,r=0,o=i[0],a=0,l=this.$createLineElement();e.appendChild(l);for(var c=0;c<t.length;c++){var h=t[c],d=h.value;if(0==c&&this.displayIndentGuides){if(n=d.length,d=this.renderIndentGuide(l,d,o),!d)continue;n-=d.length}if(n+d.length<o)a=this.$renderToken(l,a,h,d),n+=d.length;else{while(n+d.length>=o)a=this.$renderToken(l,a,h,d.substring(0,o-n)),d=d.substring(o-n),n=o,l=this.$createLineElement(),e.appendChild(l),l.appendChild(this.dom.createTextNode(s.stringRepeat(" ",i.indent),this.element)),r++,a=0,o=i[r]||Number.MAX_VALUE;0!=d.length&&(n+=d.length,a=this.$renderToken(l,a,h,d))}}i[i.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(l,a,null,"",!0)},this.$renderSimpleLine=function(e,t){var i=0,n=t[0],r=n.value;this.displayIndentGuides&&(r=this.renderIndentGuide(e,r)),r&&(i=this.$renderToken(e,i,n,r));for(var s=1;s<t.length;s++){if(n=t[s],r=n.value,i+r.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,i,n,r);i=this.$renderToken(e,i,n,r)}},this.$renderOverflowMessage=function(e,t,i,n,r){i&&this.$renderToken(e,t,i,n.slice(0,this.MAX_LINE_LENGTH-t));var s=this.dom.createElement("span");s.className="ace_inline_button ace_keyword ace_toggle_wrap",s.textContent=r?"<hide>":"<click to see more...>",e.appendChild(s)},this.$renderLine=function(e,t,i){if(i||0==i||(i=this.session.getFoldLine(t)),i)var n=this.$getFoldLineTokens(t,i);else n=this.session.getTokens(t);var r=e;if(n.length){var s=this.session.getRowSplitData(t);if(s&&s.length){this.$renderWrappedLine(e,n,s);r=e.lastChild}else{r=e;this.$useLineGroups()&&(r=this.$createLineElement(),e.appendChild(r)),this.$renderSimpleLine(r,n)}}else this.$useLineGroups()&&(r=this.$createLineElement(),e.appendChild(r));if(this.showEOL&&r){i&&(t=i.end.row);var o=this.dom.createElement("span");o.className="ace_invisible ace_invisible_eol",o.textContent=t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,r.appendChild(o)}},this.$getFoldLineTokens=function(e,t){var i=this.session,n=[];function r(e,t,i){var r=0,s=0;while(s+e[r].value.length<t)if(s+=e[r].value.length,r++,r==e.length)return;if(s!=t){var o=e[r].value.substring(t-s);o.length>i-t&&(o=o.substring(0,i-t)),n.push({type:e[r].type,value:o}),s=t+o.length,r+=1}while(s<i&&r<e.length){o=e[r].value;o.length+s>i?n.push({type:e[r].type,value:o.substring(0,i-s)}):n.push(e[r]),s+=o.length,r+=1}}var s=i.getTokens(e);return t.walk((function(e,t,o,a,l){null!=e?n.push({type:"fold",value:e}):(l&&(s=i.getTokens(t)),s.length&&r(s,a,o))}),t.end.row,this.session.getLine(t.end.row).length),n},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){}}).call(l.prototype),t.Text=l})),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],(function(e,t,i){"use strict";var n=e("../lib/dom"),r=function(e){this.element=n.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),n.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)};(function(){this.$updateOpacity=function(e){for(var t=this.cursors,i=t.length;i--;)n.setStyle(t[i].style,"opacity",e?"":"0")},this.$startCssAnimation=function(){for(var e=this.cursors,t=e.length;t--;)e[t].style.animationDuration=this.blinkInterval+"ms";setTimeout(function(){n.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},this.$stopCssAnimation=function(){n.removeCssClass(this.element,"ace_animate-blinking")},this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},this.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},this.setSmoothBlinking=function(e){e!=this.smoothBlinking&&(this.smoothBlinking=e,n.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},this.addCursor=function(){var e=n.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},this.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},this.hideCursor=function(){this.isVisible=!1,n.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,n.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.restartTimer=function(){var e=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&n.removeCssClass(this.element,"ace_smooth-blinking"),e(!0),this.isBlinking&&this.blinkInterval&&this.isVisible)if(this.smoothBlinking&&setTimeout(function(){n.addCssClass(this.element,"ace_smooth-blinking")}.bind(this)),n.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var t=function(){this.timeoutId=setTimeout((function(){e(!1)}),.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval((function(){e(!0),t()}),this.blinkInterval),t()}else this.$stopCssAnimation()},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var i=this.session.documentToScreenPosition(e),n=this.$padding+(this.session.$bidiHandler.isBidiRow(i.row,e.row)?this.session.$bidiHandler.getPosLeft(i.column):i.column*this.config.characterWidth),r=(i.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:n,top:r}},this.isCursorInView=function(e,t){return e.top>=0&&e.top<t.maxHeight},this.update=function(e){this.config=e;var t=this.session.$selectionMarkers,i=0,r=0;void 0!==t&&0!==t.length||(t=[{cursor:null}]);i=0;for(var s=t.length;i<s;i++){var o=this.getPixelPosition(t[i].cursor,!0);if(!((o.top>e.height+e.offset||o.top<0)&&i>1)){var a=this.cursors[r++]||this.addCursor(),l=a.style;this.drawCursor?this.drawCursor(a,o,e,t[i],this.session):this.isCursorInView(o,e)?(n.setStyle(l,"display","block"),n.translate(a,o.left,o.top),n.setStyle(l,"width",Math.round(e.characterWidth)+"px"),n.setStyle(l,"height",e.lineHeight+"px")):n.setStyle(l,"display","none")}}while(this.cursors.length>r)this.removeCursor();var c=this.session.getOverwrite();this.$setOverwrite(c),this.$pixelPos=o,this.restartTimer()},this.drawCursor=null,this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?n.addCssClass(this.element,"ace_overwrite-cursors"):n.removeCssClass(this.element,"ace_overwrite-cursors"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(r.prototype),t.Cursor=r})),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],(function(e,t,i){"use strict";var n=e("./lib/oop"),r=e("./lib/dom"),s=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,a=32768,l=function(e){this.element=r.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+this.classSuffix,this.inner=r.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent=" ",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addListener(this.element,"scroll",this.onScroll.bind(this)),s.addListener(this.element,"mousedown",s.preventDefault)};(function(){n.implement(this,o),this.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1}}).call(l.prototype);var c=function(e,t){l.call(this,e),this.scrollTop=0,this.scrollHeight=0,t.$scrollbarWidth=this.width=r.scrollbarWidth(e.ownerDocument),this.inner.style.width=this.element.style.width=(this.width||15)+5+"px",this.$minWidth=0};n.inherits(c,l),function(){this.classSuffix="-v",this.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,1!=this.coeff){var e=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-e)/(this.coeff-e)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},this.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},this.setHeight=function(e){this.element.style.height=e+"px"},this.setInnerHeight=this.setScrollHeight=function(e){this.scrollHeight=e,e>a?(this.coeff=a/e,e=a):1!=this.coeff&&(this.coeff=1),this.inner.style.height=e+"px"},this.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=e,this.element.scrollTop=e*this.coeff)}}.call(c.prototype);var h=function(e,t){l.call(this,e),this.scrollLeft=0,this.height=t.$scrollbarWidth,this.inner.style.height=this.element.style.height=(this.height||15)+5+"px"};n.inherits(h,l),function(){this.classSuffix="-h",this.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},this.getHeight=function(){return this.isVisible?this.height:0},this.setWidth=function(e){this.element.style.width=e+"px"},this.setInnerWidth=function(e){this.inner.style.width=e+"px"},this.setScrollWidth=function(e){this.inner.style.width=e+"px"},this.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)}}.call(h.prototype),t.ScrollBar=c,t.ScrollBarV=c,t.ScrollBarH=h,t.VScrollBar=c,t.HScrollBar=h})),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],(function(e,t,i){"use strict";var n=e("./lib/event"),r=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=t||window;var i=this;this._flush=function(e){i.pending=!1;var t=i.changes;if(t&&(n.blockIdle(100),i.changes=0,i.onRender(t)),i.changes){if(i.$recursionLimit--<0)return;i.schedule()}else i.$recursionLimit=2}};(function(){this.schedule=function(e){this.changes=this.changes|e,this.changes&&!this.pending&&(n.nextFrame(this._flush),this.pending=!0)},this.clear=function(e){var t=this.changes;return this.changes=0,t}}).call(r.prototype),t.RenderLoop=r})),ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],(function(e,t,i){var n=e("../lib/oop"),r=e("../lib/dom"),s=e("../lib/lang"),o=e("../lib/event"),a=e("../lib/useragent"),l=e("../lib/event_emitter").EventEmitter,c=256,h="function"==typeof ResizeObserver,d=200,u=t.FontMetrics=function(e){this.el=r.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=r.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=r.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),this.$measureNode.textContent=s.stringRepeat("X",c),this.$characterSize={width:0,height:0},h?this.$addObserver():this.checkForSizeChanges()};(function(){n.implement(this,l),this.$characterSize={width:0,height:0},this.$setMeasureNodeStyles=function(e,t){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",a.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},this.checkForSizeChanges=function(e){if(void 0===e&&(e=this.$measureSizes()),e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},this.$addObserver=function(){var e=this;this.$observer=new window.ResizeObserver((function(t){e.checkForSizeChanges()})),this.$observer.observe(this.$measureNode)},this.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=o.onIdle((function t(){e.checkForSizeChanges(),o.onIdle(t,500)}),500)},this.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},this.$measureSizes=function(e){var t={height:(e||this.$measureNode).clientHeight,width:(e||this.$measureNode).clientWidth/c};return 0===t.width||0===t.height?null:t},this.$measureCharWidth=function(e){this.$main.textContent=s.stringRepeat(e,c);var t=this.$main.getBoundingClientRect();return t.width/c},this.getCharacterWidth=function(e){var t=this.charSizes[e];return void 0===t&&(t=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},this.$getZoom=function e(t){return t?(window.getComputedStyle(t).zoom||1)*e(t.parentElement):1},this.$initTransformMeasureNodes=function(){var e=function(e,t){return["div",{style:"position: absolute;top:"+e+"px;left:"+t+"px;"}]};this.els=r.buildDom([e(0,0),e(d,0),e(0,d),e(d,d)],this.el)},this.transformCoordinates=function(e,t){if(e){var i=this.$getZoom(this.el);e=o(1/i,e)}function n(e,t,i){var n=e[1]*t[0]-e[0]*t[1];return[(-t[1]*i[0]+t[0]*i[1])/n,(+e[1]*i[0]-e[0]*i[1])/n]}function r(e,t){return[e[0]-t[0],e[1]-t[1]]}function s(e,t){return[e[0]+t[0],e[1]+t[1]]}function o(e,t){return[e*t[0],e*t[1]]}function a(e){var t=e.getBoundingClientRect();return[t.left,t.top]}this.els||this.$initTransformMeasureNodes();var l=a(this.els[0]),c=a(this.els[1]),h=a(this.els[2]),u=a(this.els[3]),g=n(r(u,c),r(u,h),r(s(c,h),s(u,l))),p=o(1+g[0],r(c,l)),m=o(1+g[1],r(h,l));if(t){var f=t,C=g[0]*f[0]/d+g[1]*f[1]/d+1,I=s(o(f[0],p),o(f[1],m));return s(o(1/C/d,I),l)}var A=r(e,l),v=n(r(p,o(g[0],A)),r(m,o(g[1],A)),A);return o(d,v)}}).call(u.prototype)})),ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/lib/useragent"],(function(e,t,i){"use strict";var n=e("./lib/oop"),r=e("./lib/dom"),s=e("./config"),o=e("./layer/gutter").Gutter,a=e("./layer/marker").Marker,l=e("./layer/text").Text,c=e("./layer/cursor").Cursor,h=e("./scrollbar").HScrollBar,d=e("./scrollbar").VScrollBar,u=e("./renderloop").RenderLoop,g=e("./layer/font_metrics").FontMetrics,p=e("./lib/event_emitter").EventEmitter,m='.ace_br1 {border-top-left-radius : 3px;}.ace_br2 {border-top-right-radius : 3px;}.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}.ace_br4 {border-bottom-right-radius: 3px;}.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}.ace_br8 {border-bottom-left-radius : 3px;}.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_editor {position: relative;overflow: hidden;padding: 0;font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;direction: ltr;text-align: left;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.ace_scroller {position: absolute;overflow: hidden;top: 0;bottom: 0;background-color: inherit;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;cursor: text;}.ace_content {position: absolute;box-sizing: border-box;min-width: 100%;contain: style size layout;font-variant-ligatures: no-common-ligatures;}.ace_dragging .ace_scroller:before{position: absolute;top: 0;left: 0;right: 0;bottom: 0;content: \'\';background: rgba(250, 250, 250, 0.01);z-index: 1000;}.ace_dragging.ace_dark .ace_scroller:before{background: rgba(0, 0, 0, 0.01);}.ace_selecting, .ace_selecting * {cursor: text !important;}.ace_gutter {position: absolute;overflow : hidden;width: auto;top: 0;bottom: 0;left: 0;cursor: default;z-index: 4;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;contain: style size layout;}.ace_gutter-active-line {position: absolute;left: 0;right: 0;}.ace_scroller.ace_scroll-left {box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;}.ace_gutter-cell {position: absolute;top: 0;left: 0;right: 0;padding-left: 19px;padding-right: 6px;background-repeat: no-repeat;}.ace_gutter-cell.ace_error {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: 2px center;}.ace_gutter-cell.ace_warning {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");background-position: 2px center;}.ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");background-position: 2px center;}.ace_dark .ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");}.ace_scrollbar {contain: strict;position: absolute;right: 0;bottom: 0;z-index: 6;}.ace_scrollbar-inner {position: absolute;cursor: text;left: 0;top: 0;}.ace_scrollbar-v{overflow-x: hidden;overflow-y: scroll;top: 0;}.ace_scrollbar-h {overflow-x: scroll;overflow-y: hidden;left: 0;}.ace_print-margin {position: absolute;height: 100%;}.ace_text-input {position: absolute;z-index: 0;width: 0.5em;height: 1em;opacity: 0;background: transparent;-moz-appearance: none;appearance: none;border: none;resize: none;outline: none;overflow: hidden;font: inherit;padding: 0 1px;margin: 0 -1px;contain: strict;-ms-user-select: text;-moz-user-select: text;-webkit-user-select: text;user-select: text;white-space: pre!important;}.ace_text-input.ace_composition {background: transparent;color: inherit;z-index: 1000;opacity: 1;}.ace_composition_placeholder { color: transparent }.ace_composition_marker { border-bottom: 1px solid;position: absolute;border-radius: 0;margin-top: 1px;}[ace_nocontext=true] {transform: none!important;filter: none!important;clip-path: none!important;mask : none!important;contain: none!important;perspective: none!important;mix-blend-mode: initial!important;z-index: auto;}.ace_layer {z-index: 1;position: absolute;overflow: hidden;word-wrap: normal;white-space: pre;height: 100%;width: 100%;box-sizing: border-box;pointer-events: none;}.ace_gutter-layer {position: relative;width: auto;text-align: right;pointer-events: auto;height: 1000000px;contain: style size layout;}.ace_text-layer {font: inherit !important;position: absolute;height: 1000000px;width: 1000000px;contain: style size layout;}.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {contain: style size layout;position: absolute;top: 0;left: 0;right: 0;}.ace_hidpi .ace_text-layer,.ace_hidpi .ace_gutter-layer,.ace_hidpi .ace_content,.ace_hidpi .ace_gutter {contain: strict;will-change: transform;}.ace_hidpi .ace_text-layer > .ace_line, .ace_hidpi .ace_text-layer > .ace_line_group {contain: strict;}.ace_cjk {display: inline-block;text-align: center;}.ace_cursor-layer {z-index: 4;}.ace_cursor {z-index: 4;position: absolute;box-sizing: border-box;border-left: 2px solid;transform: translatez(0);}.ace_multiselect .ace_cursor {border-left-width: 1px;}.ace_slim-cursors .ace_cursor {border-left-width: 1px;}.ace_overwrite-cursors .ace_cursor {border-left-width: 0;border-bottom: 1px solid;}.ace_hidden-cursors .ace_cursor {opacity: 0.2;}.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {opacity: 0;}.ace_smooth-blinking .ace_cursor {transition: opacity 0.18s;}.ace_animate-blinking .ace_cursor {animation-duration: 1000ms;animation-timing-function: step-end;animation-name: blink-ace-animate;animation-iteration-count: infinite;}.ace_animate-blinking.ace_smooth-blinking .ace_cursor {animation-duration: 1000ms;animation-timing-function: ease-in-out;animation-name: blink-ace-animate-smooth;}@keyframes blink-ace-animate {from, to { opacity: 1; }60% { opacity: 0; }}@keyframes blink-ace-animate-smooth {from, to { opacity: 1; }45% { opacity: 1; }60% { opacity: 0; }85% { opacity: 0; }}.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {position: absolute;z-index: 3;}.ace_marker-layer .ace_selection {position: absolute;z-index: 5;}.ace_marker-layer .ace_bracket {position: absolute;z-index: 6;}.ace_marker-layer .ace_error_bracket {position: absolute;border-bottom: 1px solid #DE5555;border-radius: 0;}.ace_marker-layer .ace_active-line {position: absolute;z-index: 2;}.ace_marker-layer .ace_selected-word {position: absolute;z-index: 4;box-sizing: border-box;}.ace_line .ace_fold {box-sizing: border-box;display: inline-block;height: 11px;margin-top: -2px;vertical-align: middle;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");background-repeat: no-repeat, repeat-x;background-position: center center, top left;color: transparent;border: 1px solid black;border-radius: 2px;cursor: pointer;pointer-events: auto;}.ace_dark .ace_fold {}.ace_fold:hover{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");}.ace_tooltip {background-color: #FFF;background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));border: 1px solid gray;border-radius: 1px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);color: black;max-width: 100%;padding: 3px 4px;position: fixed;z-index: 999999;box-sizing: border-box;cursor: default;white-space: pre;word-wrap: break-word;line-height: normal;font-style: normal;font-weight: normal;letter-spacing: normal;pointer-events: none;}.ace_folding-enabled > .ace_gutter-cell {padding-right: 13px;}.ace_fold-widget {box-sizing: border-box;margin: 0 -12px 0 1px;display: none;width: 11px;vertical-align: top;background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: center;border-radius: 3px;border: 1px solid transparent;cursor: pointer;}.ace_folding-enabled .ace_fold-widget {display: inline-block; }.ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");}.ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");}.ace_fold-widget:hover {border: 1px solid rgba(0, 0, 0, 0.3);background-color: rgba(255, 255, 255, 0.2);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);}.ace_fold-widget:active {border: 1px solid rgba(0, 0, 0, 0.4);background-color: rgba(0, 0, 0, 0.05);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);}.ace_dark .ace_fold-widget {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");}.ace_dark .ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget:hover {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);background-color: rgba(255, 255, 255, 0.1);}.ace_dark .ace_fold-widget:active {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);}.ace_inline_button {border: 1px solid lightgray;display: inline-block;margin: -1px 8px;padding: 0 5px;pointer-events: auto;cursor: pointer;}.ace_inline_button:hover {border-color: gray;background: rgba(200,200,200,0.2);display: inline-block;pointer-events: auto;}.ace_fold-widget.ace_invalid {background-color: #FFB4B4;border-color: #DE5555;}.ace_fade-fold-widgets .ace_fold-widget {transition: opacity 0.4s ease 0.05s;opacity: 0;}.ace_fade-fold-widgets:hover .ace_fold-widget {transition: opacity 0.05s ease 0.05s;opacity:1;}.ace_underline {text-decoration: underline;}.ace_bold {font-weight: bold;}.ace_nobold .ace_bold {font-weight: normal;}.ace_italic {font-style: italic;}.ace_error-marker {background-color: rgba(255, 0, 0,0.2);position: absolute;z-index: 9;}.ace_highlight-marker {background-color: rgba(255, 255, 0,0.2);position: absolute;z-index: 8;}.ace_mobile-menu {position: absolute;line-height: 1.5;border-radius: 4px;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;background: white;box-shadow: 1px 3px 2px grey;border: 1px solid #dcdcdc;color: black;}.ace_dark > .ace_mobile-menu {background: #333;color: #ccc;box-shadow: 1px 3px 2px grey;border: 1px solid #444;}.ace_mobile-button {padding: 2px;cursor: pointer;overflow: hidden;}.ace_mobile-button:hover {background-color: #eee;opacity:1;}.ace_mobile-button:active {background-color: #ddd;}.ace_placeholder {font-family: arial;transform: scale(0.9);transform-origin: left;white-space: pre;opacity: 0.7;margin: 0 10px;}',f=e("./lib/useragent"),C=f.isIE;r.importCssString(m,"ace_editor.css");var I=function(e,t){var i=this;this.container=e||r.createElement("div"),r.addCssClass(this.container,"ace_editor"),r.HI_DPI&&r.addCssClass(this.container,"ace_hidpi"),this.setTheme(t),this.$gutter=r.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden",!0),this.scroller=r.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=r.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new o(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new a(this.content);var n=this.$textLayer=new l(this.content);this.canvas=n.element,this.$markerFront=new a(this.content),this.$cursorLayer=new c(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new d(this.container,this),this.scrollBarH=new h(this.container,this),this.scrollBarV.on("scroll",(function(e){i.$scrollAnimation||i.session.setScrollTop(e.data-i.scrollMargin.top)})),this.scrollBarH.on("scroll",(function(e){i.$scrollAnimation||i.session.setScrollLeft(e.data-i.scrollMargin.left)})),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new g(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",(function(e){i.updateCharacterSize(),i.onResize(!0,i.gutterWidth,i.$size.width,i.$size.height),i._signal("changeCharacterSize",e)})),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!f.isIOS,this.$loop=new u(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),s.resetOptions(this),s._signal("renderer",this)};(function(){this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,n.implement(this,p),this.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin(),r.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},this.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&e.getScrollTop()<=0&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e),e&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},this.updateLines=function(e,t,i){if(void 0===t&&(t=1/0),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRow<t&&(this.$changedLines.lastRow=t)):this.$changedLines={firstRow:e,lastRow:t},this.$changedLines.lastRow<this.layerConfig.firstRow){if(!i)return;this.$changedLines.lastRow=this.layerConfig.lastRow}this.$changedLines.firstRow>this.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},this.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},this.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.$changes=0,this.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},this.onResize=function(e,t,i,n){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=e?1:0;var r=this.container;n||(n=r.clientHeight||r.scrollHeight),i||(i=r.clientWidth||r.scrollWidth);var s=this.$updateCachedSize(e,t,i,n);if(!this.$size.scrollerHeight||!i&&!n)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(s|this.$changes,!0):this.$loop.schedule(s|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarV.scrollLeft=this.scrollBarV.scrollTop=null}},this.$updateCachedSize=function(e,t,i,n){n-=this.$extraHeight||0;var s=0,o=this.$size,a={width:o.width,height:o.height,scrollerHeight:o.scrollerHeight,scrollerWidth:o.scrollerWidth};if(n&&(e||o.height!=n)&&(o.height=n,s|=this.CHANGE_SIZE,o.scrollerHeight=o.height,this.$horizScroll&&(o.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",s|=this.CHANGE_SCROLL),i&&(e||o.width!=i)){s|=this.CHANGE_SIZE,o.width=i,null==t&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,r.setStyle(this.scrollBarH.element.style,"left",t+"px"),r.setStyle(this.scroller.style,"left",t+this.margin.left+"px"),o.scrollerWidth=Math.max(0,i-t-this.scrollBarV.getWidth()-this.margin.h),r.setStyle(this.$gutter.style,"left",this.margin.left+"px");var l=this.scrollBarV.getWidth()+"px";r.setStyle(this.scrollBarH.element.style,"right",l),r.setStyle(this.scroller.style,"right",l),r.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)&&(s|=this.CHANGE_FULL)}return o.$dirty=!i||!n,s&&this._signal("resize",a),s},this.onGutterResize=function(e){var t=this.$showGutter?e:0;t!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,t,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()||this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},this.adjustWrapLimit=function(){var e=this.$size.scrollerWidth-2*this.$padding,t=Math.floor(e/this.characterWidth);return this.session.adjustWrapLimit(t,this.$showPrintMargin&&this.$printMarginColumn)},this.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},this.getAnimatedScroll=function(){return this.$animatedScroll},this.setShowInvisibles=function(e){this.setOption("showInvisibles",e),this.session.$bidiHandler.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.getOption("showInvisibles")},this.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},this.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},this.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},this.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},this.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},this.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},this.getShowGutter=function(){return this.getOption("showGutter")},this.setShowGutter=function(e){return this.setOption("showGutter",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.$updatePrintMargin=function(){if(this.$showPrintMargin||this.$printMarginEl){if(!this.$printMarginEl){var e=r.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=r.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",t.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&-1==this.session.$wrap&&this.adjustWrapLimit()}},this.getContainerElement=function(){return this.container},this.getMouseEventTarget=function(){return this.scroller},this.getTextAreaContainer=function(){return this.container},this.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var e=this.textarea.style,t=this.$composition;if(this.$keepTextAreaAtCursor||t){var i=this.$cursorLayer.$pixelPos;if(i){t&&t.markerRange&&(i=this.$cursorLayer.getPixelPosition(t.markerRange.start,!0));var n=this.layerConfig,s=i.top,o=i.left;s-=n.offset;var a=t&&t.useTextareaForIME?this.lineHeight:C?0:1;if(s<0||s>n.height-a)r.translate(this.textarea,0,0);else{var l=1,c=this.$size.height-a;if(t)if(t.useTextareaForIME){var h=this.textarea.value;l=this.characterWidth*this.session.$getStringScreenWidth(h)[0]}else s+=this.lineHeight+2;else s+=this.lineHeight;o-=this.scrollLeft,o>this.$size.scrollerWidth-l&&(o=this.$size.scrollerWidth-l),o+=this.gutterWidth+this.margin.left,r.setStyle(e,"height",a+"px"),r.setStyle(e,"width",l+"px"),r.translate(this.textarea,Math.min(o,this.$size.scrollerWidth-l),Math.min(s,c))}}}else r.translate(this.textarea,-100,0)}},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(0===this.layerConfig.offset?0:1)},this.getLastFullyVisibleRow=function(){var e=this.layerConfig,t=e.lastRow,i=this.session.documentToScreenRow(t,0)*e.lineHeight;return i-this.session.getScrollTop()>e.height-e.lineHeight?t-1:t},this.getLastVisibleRow=function(){return this.layerConfig.lastRow},this.$padding=null,this.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},this.setScrollMargin=function(e,t,i,n){var r=this.scrollMargin;r.top=0|e,r.bottom=0|t,r.right=0|n,r.left=0|i,r.v=r.top+r.bottom,r.h=r.left+r.right,r.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-r.top),this.updateFull()},this.setMargin=function(e,t,i,n){var r=this.margin;r.top=0|e,r.bottom=0|t,r.right=0|n,r.left=0|i,r.v=r.top+r.bottom,r.h=r.left+r.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},this.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},this.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},this.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},this.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,t=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(t-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-t&&(e=this.scrollTop+t,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},this.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},this.$frozen=!1,this.freeze=function(){this.$frozen=!0},this.unfreeze=function(){this.$frozen=!1},this.$renderChanges=function(e,t){if(this.$changes&&(e|=this.$changes,this.$changes=0),this.session&&this.container.offsetWidth&&!this.$frozen&&(e||t)){if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",e),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var i=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){if(e|=this.$computeLayerConfig()|this.$loop.clear(),i.firstRow!=this.layerConfig.firstRow&&i.firstRowScreen==this.layerConfig.firstRowScreen){var n=this.scrollTop+(i.firstRow-this.layerConfig.firstRow)*this.lineHeight;n>0&&(this.scrollTop=n,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig()|this.$loop.clear())}i=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),r.translate(this.content,-this.scrollLeft,-i.offset);var s=i.width+2*this.$padding+"px",o=i.minHeight+"px";r.setStyle(this.content.style,"width",s),r.setStyle(this.content.style,"height",o)}if(e&this.CHANGE_H_SCROLL&&(r.translate(this.content,-this.scrollLeft,-i.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller":"ace_scroller ace_scroll-left"),e&this.CHANGE_FULL)return this.$changedLines=null,this.$textLayer.update(i),this.$showGutter&&this.$gutterLayer.update(i),this.$markerBack.update(i),this.$markerFront.update(i),this.$cursorLayer.update(i),this.$moveTextAreaToCursor(),void this._signal("afterRender",e);if(e&this.CHANGE_SCROLL)return this.$changedLines=null,e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(i):this.$textLayer.scrollLines(i),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(i):this.$gutterLayer.scrollLines(i)),this.$markerBack.update(i),this.$markerFront.update(i),this.$cursorLayer.update(i),this.$moveTextAreaToCursor(),void this._signal("afterRender",e);e&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(i),this.$showGutter&&this.$gutterLayer.update(i)):e&this.CHANGE_LINES?(this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(i):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?this.$showGutter&&this.$gutterLayer.update(i):e&this.CHANGE_CURSOR&&this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(i),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(i),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(i),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(i),this._signal("afterRender",e)}else this.$changes|=e},this.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,i=Math.min(t,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(i+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&i>this.$maxPixelHeight&&(i=this.$maxPixelHeight);var n=i<=2*this.lineHeight,r=!n&&e>t;if(i!=this.desiredHeight||this.$size.height!=this.desiredHeight||r!=this.$vScroll){r!=this.$vScroll&&(this.$vScroll=r,this.scrollBarV.setVisible(r));var s=this.container.clientWidth;this.container.style.height=i+"px",this.$updateCachedSize(!0,this.$gutterWidth,s,i),this.desiredHeight=i,this._signal("autosize")}},this.$computeLayerConfig=function(){var e=this.session,t=this.$size,i=t.height<=2*this.lineHeight,n=this.session.getScreenLength(),r=n*this.lineHeight,s=this.$getLongestLine(),o=!i&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-s-2*this.$padding<0),a=this.$horizScroll!==o;a&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var l=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var c=t.scrollerHeight+this.lineHeight,h=!this.$maxLines&&this.$scrollPastEnd?(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;r+=h;var d=this.scrollMargin;this.session.setScrollTop(Math.max(-d.top,Math.min(this.scrollTop,r-t.scrollerHeight+d.bottom))),this.session.setScrollLeft(Math.max(-d.left,Math.min(this.scrollLeft,s+2*this.$padding-t.scrollerWidth+d.right)));var u=!i&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-r+h<0||this.scrollTop>d.top),g=l!==u;g&&(this.$vScroll=u,this.scrollBarV.setVisible(u));var p,m,f=this.scrollTop%this.lineHeight,C=Math.ceil(c/this.lineHeight)-1,I=Math.max(0,Math.round((this.scrollTop-f)/this.lineHeight)),A=I+C,v=this.lineHeight;I=e.screenToDocumentRow(I,0);var b=e.getFoldLine(I);b&&(I=b.start.row),p=e.documentToScreenRow(I,0),m=e.getRowLength(I)*v,A=Math.min(e.screenToDocumentRow(A,0),e.getLength()-1),c=t.scrollerHeight+e.getRowLength(A)*v+m,f=this.scrollTop-p*v;var y=0;return(this.layerConfig.width!=s||a)&&(y=this.CHANGE_H_SCROLL),(a||g)&&(y|=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal("scrollbarVisibilityChanged"),g&&(s=this.$getLongestLine())),this.layerConfig={width:s,padding:this.$padding,firstRow:I,firstRowScreen:p,lastRow:A,lineHeight:v,characterWidth:this.characterWidth,minHeight:c,maxHeight:r,offset:f,gutterOffset:v?Math.max(0,Math.ceil((f+t.height-t.scrollerHeight)/v)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(s-this.$padding),y},this.$updateLines=function(){if(this.$changedLines){var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var i=this.layerConfig;if(!(e>i.lastRow+1)&&!(t<i.firstRow))return t===1/0?(this.$showGutter&&this.$gutterLayer.update(i),void this.$textLayer.update(i)):(this.$textLayer.updateLines(i,e,t),!0)}},this.$getLongestLine=function(){var e=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(e+=1),this.$textLayer&&e>this.$textLayer.MAX_LINE_LENGTH&&(e=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},this.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},this.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},this.addGutterDecoration=function(e,t){this.$gutterLayer.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){this.$gutterLayer.removeGutterDecoration(e,t)},this.updateBreakpoints=function(e){this.$loop.schedule(this.CHANGE_GUTTER)},this.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},this.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},this.hideCursor=function(){this.$cursorLayer.hideCursor()},this.showCursor=function(){this.$cursorLayer.showCursor()},this.scrollSelectionIntoView=function(e,t,i){this.scrollCursorIntoView(e,i),this.scrollCursorIntoView(t,i)},this.scrollCursorIntoView=function(e,t,i){if(0!==this.$size.scrollerHeight){var n=this.$cursorLayer.getPixelPosition(e),r=n.left,s=n.top,o=i&&i.top||0,a=i&&i.bottom||0,l=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;l+o>s?(t&&l+o>s+this.lineHeight&&(s-=t*this.$size.scrollerHeight),0===s&&(s=-this.scrollMargin.top),this.session.setScrollTop(s)):l+this.$size.scrollerHeight-a<s+this.lineHeight&&(t&&l+this.$size.scrollerHeight-a<s-this.lineHeight&&(s+=t*this.$size.scrollerHeight),this.session.setScrollTop(s+this.lineHeight+a-this.$size.scrollerHeight));var c=this.scrollLeft;c>r?(r<this.$padding+2*this.layerConfig.characterWidth&&(r=-this.scrollMargin.left),this.session.setScrollLeft(r)):c+this.$size.scrollerWidth<r+this.characterWidth?this.session.setScrollLeft(Math.round(r+this.characterWidth-this.$size.scrollerWidth)):c<=this.$padding&&r-c<this.characterWidth&&this.session.setScrollLeft(0)}},this.getScrollTop=function(){return this.session.getScrollTop()},this.getScrollLeft=function(){return this.session.getScrollLeft()},this.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},this.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},this.scrollToRow=function(e){this.session.setScrollTop(e*this.lineHeight)},this.alignCursor=function(e,t){"number"==typeof e&&(e={row:e,column:0});var i=this.$cursorLayer.getPixelPosition(e),n=this.$size.scrollerHeight-this.lineHeight,r=i.top-n*(t||0);return this.session.setScrollTop(r),r},this.STEPS=8,this.$calcSteps=function(e,t){var i=0,n=this.STEPS,r=[],s=function(e,t,i){return i*(Math.pow(e-1,3)+1)+t};for(i=0;i<n;++i)r.push(s(i/this.STEPS,e,t-e));return r},this.scrollToLine=function(e,t,i,n){var r=this.$cursorLayer.getPixelPosition({row:e,column:0}),s=r.top;t&&(s-=this.$size.scrollerHeight/2);var o=this.scrollTop;this.session.setScrollTop(s),!1!==i&&this.animateScrolling(o,n)},this.animateScrolling=function(e,t){var i=this.scrollTop;if(this.$animatedScroll){var n=this;if(e!=i){if(this.$scrollAnimation){var r=this.$scrollAnimation.steps;if(r.length&&(e=r[0],e==i))return}var s=n.$calcSteps(e,i);this.$scrollAnimation={from:e,to:i,steps:s},clearInterval(this.$timer),n.session.setScrollTop(s.shift()),n.session.$scrollTop=i,this.$timer=setInterval((function(){if(!n.session)return clearInterval(n.$timer);s.length?(n.session.setScrollTop(s.shift()),n.session.$scrollTop=i):null!=i?(n.session.$scrollTop=-1,n.session.setScrollTop(i),i=null):(n.$timer=clearInterval(n.$timer),n.$scrollAnimation=null,t&&t())}),10)}}},this.scrollToY=function(e){this.scrollTop!==e&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=e)},this.scrollToX=function(e){this.scrollLeft!==e&&(this.scrollLeft=e),this.$loop.schedule(this.CHANGE_H_SCROLL)},this.scrollTo=function(e,t){this.session.setScrollTop(t),this.session.setScrollLeft(t)},this.scrollBy=function(e,t){t&&this.session.setScrollTop(this.session.getScrollTop()+t),e&&this.session.setScrollLeft(this.session.getScrollLeft()+e)},this.isScrollableBy=function(e,t){return t<0&&this.session.getScrollTop()>=1-this.scrollMargin.top||(t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||(e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||(e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right||void 0)))},this.pixelToScreenCoordinates=function(e,t){var i;if(this.$hasCssTransforms){i={top:0,left:0};var n=this.$fontMetrics.transformCoordinates([e,t]);e=n[1]-this.gutterWidth-this.margin.left,t=n[0]}else i=this.scroller.getBoundingClientRect();var r=e+this.scrollLeft-i.left-this.$padding,s=r/this.characterWidth,o=Math.floor((t+this.scrollTop-i.top)/this.lineHeight),a=this.$blockCursor?Math.floor(s):Math.round(s);return{row:o,column:a,side:s-a>0?1:-1,offsetX:r}},this.screenToTextCoordinates=function(e,t){var i;if(this.$hasCssTransforms){i={top:0,left:0};var n=this.$fontMetrics.transformCoordinates([e,t]);e=n[1]-this.gutterWidth-this.margin.left,t=n[0]}else i=this.scroller.getBoundingClientRect();var r=e+this.scrollLeft-i.left-this.$padding,s=r/this.characterWidth,o=this.$blockCursor?Math.floor(s):Math.round(s),a=Math.floor((t+this.scrollTop-i.top)/this.lineHeight);return this.session.screenToDocumentPosition(a,Math.max(o,0),r)},this.textToScreenCoordinates=function(e,t){var i=this.scroller.getBoundingClientRect(),n=this.session.documentToScreenPosition(e,t),r=this.$padding+(this.session.$bidiHandler.isBidiRow(n.row,e)?this.session.$bidiHandler.getPosLeft(n.column):Math.round(n.column*this.characterWidth)),s=n.row*this.lineHeight;return{pageX:i.left+r-this.scrollLeft,pageY:i.top+s-this.scrollTop}},this.visualizeFocus=function(){r.addCssClass(this.container,"ace_focus")},this.visualizeBlur=function(){r.removeCssClass(this.container,"ace_focus")},this.showComposition=function(e){this.$composition=e,e.cssText||(e.cssText=this.textarea.style.cssText),void 0==e.useTextareaForIME&&(e.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(r.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):e.markerId=this.session.addMarker(e.markerRange,"ace_composition_marker","text")},this.setCompositionText=function(e){var t=this.session.selection.cursor;this.addToken(e,"composition_placeholder",t.row,t.column),this.$moveTextAreaToCursor()},this.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),r.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var e=this.session.selection.cursor;this.removeExtraToken(e.row,e.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},this.addToken=function(e,t,i,n){var r=this.session;r.bgTokenizer.lines[i]=null;var s={type:t,value:e},o=r.getTokens(i);if(null==n)o.push(s);else for(var a=0,l=0;l<o.length;l++){var c=o[l];if(a+=c.value.length,n<=a){var h=c.value.length-(a-n),d=c.value.slice(0,h),u=c.value.slice(h);o.splice(l,1,{type:c.type,value:d},s,{type:c.type,value:u});break}}this.updateLines(i,i)},this.removeExtraToken=function(e,t){this.updateLines(e,e)},this.setTheme=function(e,t){var i=this;if(this.$themeId=e,i._dispatchEvent("themeChange",{theme:e}),e&&"string"!=typeof e)o(e);else{var n=e||this.$options.theme.initialValue;s.loadModule(["theme",n],o)}function o(n){if(i.$themeId!=e)return t&&t();if(!n||!n.cssClass)throw new Error("couldn't load module "+e+" or it didn't call define");n.$id&&(i.$themeId=n.$id),r.importCssString(n.cssText,n.cssClass,i.container),i.theme&&r.removeCssClass(i.container,i.theme.cssClass);var s="padding"in n?n.padding:"padding"in(i.theme||{})?4:i.$padding;i.$padding&&s!=i.$padding&&i.setPadding(s),i.$theme=n.cssClass,i.theme=n,r.addCssClass(i.container,n.cssClass),r.setCssClass(i.container,"ace_dark",n.isDark),i.$size&&(i.$size.width=0,i.$updateSizeAsync()),i._dispatchEvent("themeLoaded",{theme:n}),t&&t()}},this.getTheme=function(){return this.$themeId},this.setStyle=function(e,t){r.setCssClass(this.container,e,!1!==t)},this.unsetStyle=function(e){r.removeCssClass(this.container,e)},this.setCursorStyle=function(e){r.setStyle(this.scroller.style,"cursor",e)},this.setMouseCursor=function(e){r.setStyle(this.scroller.style,"cursor",e)},this.attachToShadowRoot=function(){r.importCssString(m,"ace_editor.css",this.container)},this.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent=""}}).call(I.prototype),s.defineOptions(I.prototype,"renderer",{animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){"number"==typeof e&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},fadeFoldWidgets:{set:function(e){r.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightGutterLine:{set:function(e){this.$gutterLayer.setHighlightGutterLine(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(e){this.$hScrollBarAlwaysVisible&&this.$horizScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(e){this.$vScrollBarAlwaysVisible&&this.$vScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){"number"==typeof e&&(e+="px"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(e){this.updateFull()}},minLines:{set:function(e){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(e){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(e){e=+e||0,this.$scrollPastEnd!=e&&(this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}},theme:{set:function(e){this.setTheme(e)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!f.isMobile&&!f.isIE}}),t.VirtualRenderer=I})),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],(function(e,t,i){"use strict";var n=e("../lib/oop"),r=e("../lib/net"),s=e("../lib/event_emitter").EventEmitter,o=e("../config");function a(e){var t="importScripts('"+r.qualifyURL(e)+"');";try{return new Blob([t],{type:"application/javascript"})}catch(s){var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,n=new i;return n.append(t),n.getBlob("application/javascript")}}function l(e){if("undefined"==typeof Worker)return{postMessage:function(){},terminate:function(){}};if(o.get("loadWorkerFromBlob")){var t=a(e),i=window.URL||window.webkitURL,n=i.createObjectURL(t);return new Worker(n)}return new Worker(e)}var c=function(e){e.postMessage||(e=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=e,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){n.implement(this,s),this.$createWorkerFromOldConfig=function(t,i,n,r,s){if(e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl),o.get("packaged")||!e.toUrl)r=r||o.moduleUrl(i,"worker");else{var a=this.$normalizePath;r=r||a(e.toUrl("ace/worker/worker.js",null,"_"));var c={};t.forEach((function(t){c[t]=a(e.toUrl(t,null,"_").replace(/(\.js)?(\?.*)?$/,""))}))}return this.$worker=l(r),s&&this.send("importScripts",s),this.$worker.postMessage({init:!0,tlns:c,module:i,classname:n}),this.$worker},this.onMessage=function(e){var t=e.data;switch(t.type){case"event":this._signal(t.name,{data:t.data});break;case"call":var i=this.callbacks[t.id];i&&(i(t.data),delete this.callbacks[t.id]);break;case"error":this.reportError(t.data);break;case"log":window.console&&console.log;break}},this.reportError=function(e){window.console&&console.error},this.$normalizePath=function(e){return r.qualifyURL(e)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(e,t){this.$worker.postMessage({command:e,args:t})},this.call=function(e,t,i){if(i){var n=this.callbackId++;this.callbacks[n]=i,t.push(n)}this.send(e,t)},this.emit=function(e,t){try{t.data&&t.data.err&&(t.data.err={message:t.data.err.message,stack:t.data.err.stack,code:t.data.err.code}),this.$worker.postMessage({event:e,data:{data:t.data}})}catch(i){}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call("setValue",[e.getValue()]),e.on("change",this.changeListener)},this.changeListener=function(e){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),"insert"==e.action?this.deltaQueue.push(e.start,e.lines):this.deltaQueue.push(e.start,e.end)},this.$sendDeltaQueue=function(){var e=this.deltaQueue;e&&(this.deltaQueue=null,e.length>50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e}))}}).call(c.prototype);var h=function(e,t,i){var n=null,r=!1,a=Object.create(s),l=[],h=new c({messageBuffer:l,terminate:function(){},postMessage:function(e){l.push(e),n&&(r?setTimeout(d):d())}});h.setEmitSync=function(e){r=e};var d=function(){var e=l.shift();e.command?n[e.command].apply(n,e.args):e.event&&a._signal(e.event,e.data)};return a.postMessage=function(e){h.onMessage({data:e})},a.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},a.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},o.loadModule(["worker",t],(function(e){n=new e[i](a);while(l.length)d()})),h};t.UIWorkerClient=h,t.WorkerClient=c,t.createWorker=l})),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],(function(e,t,i){"use strict";var n=e("./range").Range,r=e("./lib/event_emitter").EventEmitter,s=e("./lib/oop"),o=function(e,t,i,n,r,s){var o=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=r,this.othersClass=s,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate),this.$others=n,this.$onCursorChange=function(){setTimeout((function(){o.onCursorChange()}))},this.$pos=i;var a=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=a.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)};(function(){s.implement(this,r),this.setup=function(){var e=this,t=this.doc,i=this.session;this.selectionBefore=i.selection.toJSON(),i.selection.inMultiSelectMode&&i.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var r=this.pos;r.$insertRight=!0,r.detach(),r.markerId=i.addMarker(new n(r.row,r.column,r.row,r.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach((function(i){var n=t.createAnchor(i.row,i.column);n.$insertRight=!0,n.detach(),e.others.push(n)})),i.setUndoSelect(!1)},this.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,t=this;this.othersActive=!0,this.others.forEach((function(i){i.markerId=e.addMarker(new n(i.row,i.column,i.row,i.column+t.length),t.othersClass,null,!1)}))}},this.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)}},this.onUpdate=function(e){if(this.$updating)return this.updateAnchors(e);var t=e;if(t.start.row===t.end.row&&t.start.row===this.pos.row){this.$updating=!0;var i="insert"===e.action?t.end.column-t.start.column:t.start.column-t.end.column,r=t.start.column>=this.pos.column&&t.start.column<=this.pos.column+this.length+1,s=t.start.column-this.pos.column;if(this.updateAnchors(e),r&&(this.length+=i),r&&!this.session.$fromUndo)if("insert"===e.action)for(var o=this.others.length-1;o>=0;o--){var a=this.others[o],l={row:a.row,column:a.column+s};this.doc.insertMergedLines(l,e.lines)}else if("remove"===e.action)for(o=this.others.length-1;o>=0;o--){a=this.others[o],l={row:a.row,column:a.column+s};this.doc.remove(new n(l.row,l.column,l.row,l.column-i))}this.$updating=!1,this.updateMarkers()}},this.updateAnchors=function(e){this.pos.onChange(e);for(var t=this.others.length;t--;)this.others[t].onChange(e);this.updateMarkers()},this.updateMarkers=function(){if(!this.$updating){var e=this,t=this.session,i=function(i,r){t.removeMarker(i.markerId),i.markerId=t.addMarker(new n(i.row,i.column,i.row,i.column+e.length),r,null,!1)};i(this.pos,this.mainClass);for(var r=this.others.length;r--;)i(this.others[r],this.othersClass)}},this.onCursorChange=function(e){if(!this.$updating&&this.session){var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))}},this.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},this.cancel=function(){if(-1!==this.$undoStackDepth){for(var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth,i=0;i<t;i++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}}}).call(o.prototype),t.PlaceHolder=o})),ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],(function(e,t,i){var n=e("../lib/event"),r=e("../lib/useragent");function s(e,t){return e.row==t.row&&e.column==t.column}function o(e){var t=e.domEvent,i=t.altKey,o=t.shiftKey,a=t.ctrlKey,l=e.getAccelKey(),c=e.getButton();if(a&&r.isMac&&(c=t.button),e.editor.inMultiSelectMode&&2==c)e.editor.textInput.onContextMenu(e.domEvent);else if(a||i||l){if(0===c){var h,d=e.editor,u=d.selection,g=d.inMultiSelectMode,p=e.getDocumentPosition(),m=u.getCursor(),f=e.inSelection()||u.isEmpty()&&s(p,m),C=e.x,I=e.y,A=function(e){C=e.clientX,I=e.clientY},v=d.session,b=d.renderer.pixelToScreenCoordinates(C,I),y=b;if(d.$mouseHandler.$enableJumpToDef)a&&i||l&&i?h=o?"block":"add":i&&d.$blockSelectEnabled&&(h="block");else if(l&&!i){if(h="add",!g&&o)return}else i&&d.$blockSelectEnabled&&(h="block");if(h&&r.isMac&&t.ctrlKey&&d.$mouseHandler.cancelContextMenu(),"add"==h){if(!g&&f)return;if(!g){var w=u.toOrientedRange();d.addSelectionMarker(w)}var S=u.rangeList.rangeAtPoint(p);d.inVirtualSelectionMode=!0,o&&(S=null,w=u.ranges[0]||w,d.removeSelectionMarker(w)),d.once("mouseup",(function(){var e=u.toOrientedRange();S&&e.isEmpty()&&s(S.cursor,e.cursor)?u.substractPoint(e.cursor):(o?u.substractPoint(w.cursor):w&&(d.removeSelectionMarker(w),u.addRange(w)),u.addRange(e)),d.inVirtualSelectionMode=!1}))}else if("block"==h){var x;e.stop(),d.inVirtualSelectionMode=!0;var k=[],R=function(){var e=d.renderer.pixelToScreenCoordinates(C,I),t=v.screenToDocumentPosition(e.row,e.column,e.offsetX);s(y,e)&&s(t,u.lead)||(y=e,d.selection.moveToPosition(t),d.renderer.scrollCursorIntoView(),d.removeSelectionMarkers(k),k=u.rectangularRangeBlock(y,b),d.$mouseHandler.$clickSelection&&1==k.length&&k[0].isEmpty()&&(k[0]=d.$mouseHandler.$clickSelection.clone()),k.forEach(d.addSelectionMarker,d),d.updateSelectionMarkers())};g&&!l?u.toSingleRange():!g&&l&&(x=u.toOrientedRange(),d.addSelectionMarker(x)),o?b=v.documentToScreenPosition(u.lead):u.moveToPosition(p),y={row:-1,column:-1};var E=function(e){R(),clearInterval(Z),d.removeSelectionMarkers(k),k.length||(k=[u.toOrientedRange()]),x&&(d.removeSelectionMarker(x),u.toSingleRange(x));for(var t=0;t<k.length;t++)u.addRange(k[t]);d.inVirtualSelectionMode=!1,d.$mouseHandler.$clickSelection=null},B=R;n.capture(d.container,A,E);var Z=setInterval((function(){B()}),20);return e.preventDefault()}}}else 0===c&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode()}t.onMouseDown=o})),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],(function(e,t,i){t.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(e){e.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(e){e.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorAboveSkipCurrent",description:"Add cursor above (skip current)",exec:function(e){e.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelowSkipCurrent",description:"Add cursor below (skip current)",exec:function(e){e.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreBefore",description:"Select more before",exec:function(e){e.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(e){e.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(e){e.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextAfter",description:"Select next after",exec:function(e){e.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"toggleSplitSelectionIntoLines",description:"Split into lines",exec:function(e){e.multiSelect.rangeCount>1?e.multiSelect.joinSelections():e.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(e){e.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(e){e.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(e){e.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],t.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(e){e.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(e){return e&&e.inMultiSelectMode}}];var n=e("../keyboard/hash_handler").HashHandler;t.keyboardHandler=new n(t.multiSelectCommands)})),ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],(function(e,t,i){var n=e("./range_list").RangeList,r=e("./range").Range,s=e("./selection").Selection,o=e("./mouse/multi_select_handler").onMouseDown,a=e("./lib/event"),l=e("./lib/lang"),c=e("./commands/multi_select_commands");t.commands=c.defaultCommands.concat(c.multiSelectCommands);var h=e("./search").Search,d=new h;function u(e,t,i){return d.$options.wrap=!0,d.$options.needle=t,d.$options.backwards=-1==i,d.find(e)}var g=e("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(g.prototype),function(){this.ranges=null,this.rangeList=null,this.addRange=function(e,t){if(e){if(!this.inMultiSelectMode&&0===this.rangeCount){var i=this.toOrientedRange();if(this.rangeList.add(i),this.rangeList.add(e),2!=this.rangeList.ranges.length)return this.rangeList.removeAll(),t||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(i),this.$onAddRange(i)}e.cursor||(e.cursor=e.end);var n=this.rangeList.add(e);return this.$onAddRange(e),n.length&&this.$onRemoveRange(n),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)}},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);if(t)return this.$onRemoveRange(t),t[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length&&this.$onRemoveRange(e)},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){if(this.rangeCount=this.rangeList.ranges.length,1==this.rangeCount&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var i=e.length;i--;){var n=this.ranges.indexOf(e[i]);this.ranges.splice(n,1)}this._signal("removeRange",{ranges:e}),0===this.rangeCount&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),t=t||this.ranges[0],t&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new n,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var e=this.ranges.length?this.ranges:[this.getRange()],t=[],i=0;i<e.length;i++){var n=e[i],s=n.start.row,o=n.end.row;if(s===o)t.push(n.clone());else{t.push(new r(s,n.start.column,s,this.session.getLine(s).length));while(++s<o)t.push(this.getLineRange(s,!0));t.push(new r(o,0,o,n.end.column))}0!=i||this.isBackwards()||(t=t.reverse())}this.toSingleRange();for(i=t.length;i--;)this.addRange(t[i])},this.joinSelections=function(){var e=this.rangeList.ranges,t=e[e.length-1],i=r.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(i,t.cursor==t.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],i=r.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(i,t.cursor==t.start)}else{var n=this.session.documentToScreenPosition(this.cursor),s=this.session.documentToScreenPosition(this.anchor),o=this.rectangularRangeBlock(n,s);o.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,i){var n=[],s=e.column<t.column;if(s)var o=e.column,a=t.column,l=e.offsetX,c=t.offsetX;else o=t.column,a=e.column,l=t.offsetX,c=e.offsetX;var h,d=e.row<t.row;if(d)var u=e.row,g=t.row;else u=t.row,g=e.row;o<0&&(o=0),u<0&&(u=0),u==g&&(i=!0);for(var p=u;p<=g;p++){var f=r.fromPoints(this.session.screenToDocumentPosition(p,o,l),this.session.screenToDocumentPosition(p,a,c));if(f.isEmpty()){if(h&&m(f.end,h))break;h=f.end}f.cursor=s?f.start:f.end,n.push(f)}if(d&&n.reverse(),!i){var C=n.length-1;while(n[C].isEmpty()&&C>0)C--;if(C>0){var I=0;while(n[I].isEmpty())I++}for(var A=C;A>=I;A--)n[A].isEmpty()&&n.splice(A,1)}return n}}.call(s.prototype);var p=e("./editor").Editor;function m(e,t){return e.row==t.row&&e.column==t.column}function f(e){e.$multiselectOnSessionChange||(e.$onAddRange=e.$onAddRange.bind(e),e.$onRemoveRange=e.$onRemoveRange.bind(e),e.$onMultiSelect=e.$onMultiSelect.bind(e),e.$onSingleSelect=e.$onSingleSelect.bind(e),e.$multiselectOnSessionChange=t.onSessionChange.bind(e),e.$checkMultiselectChange=e.$checkMultiselectChange.bind(e),e.$multiselectOnSessionChange(e),e.on("changeSession",e.$multiselectOnSessionChange),e.on("mousedown",o),e.commands.addCommands(c.defaultCommands),C(e))}function C(e){if(e.textInput){var t=e.textInput.getElement(),i=!1;a.addListener(t,"keydown",(function(t){var r=18==t.keyCode&&!(t.ctrlKey||t.shiftKey||t.metaKey);e.$blockSelectEnabled&&r?i||(e.renderer.setMouseCursor("crosshair"),i=!0):i&&n()}),e),a.addListener(t,"keyup",n,e),a.addListener(t,"blur",n,e)}function n(t){i&&(e.renderer.setMouseCursor(""),i=!1)}}(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(e.marker){this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);-1!=t&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(e){for(var t=this.session.$selectionMarkers,i=e.length;i--;){var n=e[i];if(n.marker){this.session.removeMarker(n.marker);var r=t.indexOf(n);-1!=r&&t.splice(r,1)}}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(c.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(e){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(c.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(e){var t=e.command,i=e.editor;if(i.multiSelect){if(t.multiSelectAction)"forEach"==t.multiSelectAction?n=i.forEachSelection(t,e.args):"forEachLine"==t.multiSelectAction?n=i.forEachSelection(t,e.args,!0):"single"==t.multiSelectAction?(i.exitMultiSelectMode(),n=t.exec(i,e.args||{})):n=t.multiSelectAction(i,e.args||{});else{var n=t.exec(i,e.args||{});i.multiSelect.addRange(i.multiSelect.toOrientedRange()),i.multiSelect.mergeOverlappingRanges()}return n}},this.forEachSelection=function(e,t,i){if(!this.inVirtualSelectionMode){var n,r=i&&i.keepOrder,o=1==i||i&&i.$byLines,a=this.session,l=this.selection,c=l.rangeList,h=(r?l:c).ranges;if(!h.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var d=l._eventRegistry;l._eventRegistry={};var u=new s(a);this.inVirtualSelectionMode=!0;for(var g=h.length;g--;){if(o)while(g>0&&h[g].start.row==h[g-1].end.row)g--;u.fromOrientedRange(h[g]),u.index=g,this.selection=a.selection=u;var p=e.exec?e.exec(this,t||{}):e(this,t||{});n||void 0===p||(n=p),u.toOrientedRange(h[g])}u.detach(),this.selection=a.selection=l,this.inVirtualSelectionMode=!1,l._eventRegistry=d,l.mergeOverlappingRanges(),l.ranges[0]&&l.fromOrientedRange(l.ranges[0]);var m=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),m&&m.from==m.to&&this.renderer.animateScrolling(m.from),n}},this.exitMultiSelectMode=function(){this.inMultiSelectMode&&!this.inVirtualSelectionMode&&this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var t=this.multiSelect.rangeList.ranges,i=[],n=0;n<t.length;n++)i.push(this.session.getTextRange(t[n]));var r=this.session.getDocument().getNewLineCharacter();e=i.join(r),e.length==(i.length-1)*r.length&&(e="")}else this.selection.isEmpty()||(e=this.session.getTextRange(this.getSelectionRange()));return e},this.$checkMultiselectChange=function(e,t){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var i=this.multiSelect.ranges[0];if(this.multiSelect.isEmpty()&&t==this.multiSelect.anchor)return;var n=t==this.multiSelect.anchor?i.cursor==i.start?i.end:i.start:i.cursor;n.row!=t.row||this.session.$clipPositionToDocument(n.row,n.column).column!=t.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}},this.findAll=function(e,t,i){if(t=t||{},t.needle=e||t.needle,void 0==t.needle){var n=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();t.needle=this.session.getTextRange(n)}this.$search.set(t);var r=this.$search.findAll(this.session);if(!r.length)return 0;var s=this.multiSelect;i||s.toSingleRange(r[0]);for(var o=r.length;o--;)s.addRange(r[o],!0);return n&&s.rangeList.rangeAtPoint(n.start)&&s.addRange(n,!0),r.length},this.selectMoreLines=function(e,t){var i=this.selection.toOrientedRange(),n=i.cursor==i.end,s=this.session.documentToScreenPosition(i.cursor);this.selection.$desiredColumn&&(s.column=this.selection.$desiredColumn);var o=this.session.screenToDocumentPosition(s.row+e,s.column);if(i.isEmpty())l=o;else var a=this.session.documentToScreenPosition(n?i.end:i.start),l=this.session.screenToDocumentPosition(a.row+e,a.column);if(n){var c=r.fromPoints(o,l);c.cursor=c.start}else{c=r.fromPoints(l,o);c.cursor=c.end}if(c.desiredColumn=s.column,this.selection.inMultiSelectMode){if(t)var h=i.cursor}else this.selection.addRange(i);this.selection.addRange(c),h&&this.selection.substractPoint(h)},this.transposeSelections=function(e){for(var t=this.session,i=t.multiSelect,n=i.ranges,r=n.length;r--;){var s=n[r];if(s.isEmpty()){var o=t.getWordRange(s.start.row,s.start.column);s.start.row=o.start.row,s.start.column=o.start.column,s.end.row=o.end.row,s.end.column=o.end.column}}i.mergeOverlappingRanges();var a=[];for(r=n.length;r--;){s=n[r];a.unshift(t.getTextRange(s))}e<0?a.unshift(a.pop()):a.push(a.shift());for(r=n.length;r--;){s=n[r],o=s.clone();t.replace(s,a[r]),s.start.row=o.start.row,s.start.column=o.start.column}i.fromOrientedRange(i.ranges[0])},this.selectMore=function(e,t,i){var n=this.session,r=n.multiSelect,s=r.toOrientedRange();if(!s.isEmpty()||(s=n.getWordRange(s.start.row,s.start.column),s.cursor=-1==e?s.start:s.end,this.multiSelect.addRange(s),!i)){var o=n.getTextRange(s),a=u(n,o,e);a&&(a.cursor=-1==e?a.start:a.end,this.session.unfold(a),this.multiSelect.addRange(a),this.renderer.scrollCursorIntoView(null,.5)),t&&this.multiSelect.substractPoint(s.cursor)}},this.alignCursors=function(){var e=this.session,t=e.multiSelect,i=t.ranges,n=-1,s=i.filter((function(e){if(e.cursor.row==n)return!0;n=e.cursor.row}));if(i.length&&s.length!=i.length-1){s.forEach((function(e){t.substractPoint(e.cursor)}));var o=0,a=1/0,c=i.map((function(t){var i=t.cursor,n=e.getLine(i.row),r=n.substr(i.column).search(/\S/g);return-1==r&&(r=0),i.column>o&&(o=i.column),r<a&&(a=r),r}));i.forEach((function(t,i){var n=t.cursor,s=o-n.column,h=c[i]-a;s>h?e.insert(n,l.stringRepeat(" ",s-h)):e.remove(new r(n.row,n.column,n.row,n.column-s+h)),t.start.column=t.end.column=o,t.start.row=t.end.row=n.row,t.cursor=t.end})),t.fromOrientedRange(i[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var h=this.selection.getRange(),d=h.start.row,u=h.end.row,g=d==u;if(g){var p,m=this.session.getLength();do{p=this.session.getLine(u)}while(/[=:]/.test(p)&&++u<m);do{p=this.session.getLine(d)}while(/[=:]/.test(p)&&--d>0);d<0&&(d=0),u>=m&&(u=m-1)}var f=this.session.removeFullLines(d,u);f=this.$reAlignText(f,g),this.session.insert({row:d,column:0},f.join("\n")+"\n"),g||(h.start.column=0,h.end.column=f[f.length-1].length),this.selection.setRange(h)}},this.$reAlignText=function(e,t){var i,n,r,s=!0,o=!0;return e.map((function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?null==i?(i=t[1].length,n=t[2].length,r=t[3].length,t):(i+n+r!=t[1].length+t[2].length+t[3].length&&(o=!1),i!=t[1].length&&(s=!1),i>t[1].length&&(i=t[1].length),n<t[2].length&&(n=t[2].length),r>t[3].length&&(r=t[3].length),t):[e]})).map(t?c:s?o?h:c:d);function a(e){return l.stringRepeat(" ",e)}function c(e){return e[2]?a(i)+e[2]+a(n-e[2].length+r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function h(e){return e[2]?a(i+n-e[2].length)+e[2]+a(r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function d(e){return e[2]?a(i)+e[2]+a(r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}}}).call(p.prototype),t.onSessionChange=function(e){var t=e.session;t&&!t.multiSelect&&(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t&&t.multiSelect;var i=e.oldSession;i&&(i.multiSelect.off("addRange",this.$onAddRange),i.multiSelect.off("removeRange",this.$onRemoveRange),i.multiSelect.off("multiSelect",this.$onMultiSelect),i.multiSelect.off("singleSelect",this.$onSingleSelect),i.multiSelect.lead.off("change",this.$checkMultiselectChange),i.multiSelect.anchor.off("change",this.$checkMultiselectChange)),t&&(t.multiSelect.on("addRange",this.$onAddRange),t.multiSelect.on("removeRange",this.$onRemoveRange),t.multiSelect.on("multiSelect",this.$onMultiSelect),t.multiSelect.on("singleSelect",this.$onSingleSelect),t.multiSelect.lead.on("change",this.$checkMultiselectChange),t.multiSelect.anchor.on("change",this.$checkMultiselectChange)),t&&this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=f,e("./config").defineOptions(p.prototype,"editor",{enableMultiselect:{set:function(e){f(this),e?(this.on("changeSession",this.$multiselectOnSessionChange),this.on("mousedown",o)):(this.off("changeSession",this.$multiselectOnSessionChange),this.off("mousedown",o))},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})})),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],(function(e,t,i){"use strict";var n=e("../../range").Range,r=t.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,i){var n=e.getLine(i);return this.foldingStartMarker.test(n)?"start":"markbeginend"==t&&this.foldingStopMarker&&this.foldingStopMarker.test(n)?"end":""},this.getFoldWidgetRange=function(e,t,i){return null},this.indentationBlock=function(e,t,i){var r=/\S/,s=e.getLine(t),o=s.search(r);if(-1!=o){var a=i||s.length,l=e.getLength(),c=t,h=t;while(++t<l){var d=e.getLine(t).search(r);if(-1!=d){if(d<=o){var u=e.getTokenAt(t,0);if(!u||"string"!==u.type)break}h=t}}if(h>c){var g=e.getLine(h).length;return new n(c,a,h,g)}}},this.openingBracketBlock=function(e,t,i,r,s){var o={row:i,column:r+1},a=e.$findClosingBracket(t,o,s);if(a){var l=e.foldWidgets[a.row];return null==l&&(l=e.getFoldWidget(a.row)),"start"==l&&a.row>o.row&&(a.row--,a.column=e.getLine(a.row).length),n.fromPoints(o,a)}},this.closingBracketBlock=function(e,t,i,r,s){var o={row:i,column:r},a=e.$findOpeningBracket(t,o);if(a)return a.column++,o.column--,n.fromPoints(a,o)}}).call(r.prototype)})),ace.define("ace/theme/textmate",["require","exports","module","ace/lib/dom"],(function(e,t,i){"use strict";t.isDark=!1,t.cssClass="ace-tm",t.cssText='.ace-tm .ace_gutter {background: #f0f0f0;color: #333;}.ace-tm .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-tm .ace_fold {background-color: #6B72E6;}.ace-tm {background-color: #FFFFFF;color: black;}.ace-tm .ace_cursor {color: black;}.ace-tm .ace_invisible {color: rgb(191, 191, 191);}.ace-tm .ace_storage,.ace-tm .ace_keyword {color: blue;}.ace-tm .ace_constant {color: rgb(197, 6, 11);}.ace-tm .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-tm .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-tm .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-tm .ace_invalid {background-color: rgba(255, 0, 0, 0.1);color: red;}.ace-tm .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-tm .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-tm .ace_support.ace_type,.ace-tm .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-tm .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-tm .ace_string {color: rgb(3, 106, 7);}.ace-tm .ace_comment {color: rgb(76, 136, 107);}.ace-tm .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-tm .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-tm .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-tm .ace_variable {color: rgb(49, 132, 149);}.ace-tm .ace_xml-pe {color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-tm .ace_heading {color: rgb(12, 7, 255);}.ace-tm .ace_list {color:rgb(185, 6, 144);}.ace-tm .ace_meta.ace_tag {color:rgb(0, 22, 142);}.ace-tm .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-tm .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-tm.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;}.ace-tm .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_gutter-active-line {background-color : #dcdcdc;}.ace-tm .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}',t.$id="ace/theme/textmate";var n=e("../lib/dom");n.importCssString(t.cssText,t.cssClass)})),ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],(function(e,t,i){"use strict";var n=e("./lib/dom");function r(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}(function(){this.getRowLength=function(e){var t;return t=this.lineWidgets&&this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0,this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1+t:1+t},this.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach((function(t){t&&t.rowCount&&!t.hidden&&(e+=t.rowCount)})),e},this.$onChangeEditor=function(e){this.attach(e.editor)},this.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach(),this.editor!=e&&(this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets)))},this.detach=function(e){var t=this.editor;if(t){this.editor=null,t.widgetManager=null,t.renderer.off("beforeRender",this.measureWidgets),t.renderer.off("afterRender",this.renderWidgets);var i=this.session.lineWidgets;i&&i.forEach((function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))}))}},this.updateOnFold=function(e,t){var i=t.lineWidgets;if(i&&e.action){for(var n=e.data,r=n.start.row,s=n.end.row,o="add"==e.action,a=r+1;a<s;a++)i[a]&&(i[a].hidden=o);i[s]&&(o?i[r]?i[s].hidden=o:i[r]=i[s]:(i[r]==i[s]&&(i[r]=void 0),i[s].hidden=o))}},this.updateOnChange=function(e){var t=this.session.lineWidgets;if(t){var i=e.start.row,n=e.end.row-i;if(0===n);else if("remove"==e.action){var r=t.splice(i+1,n);!t[i]&&r[r.length-1]&&(t[i]=r.pop()),r.forEach((function(e){e&&this.removeLineWidget(e)}),this),this.$updateRows()}else{var s=new Array(n);t[i]&&null!=t[i].column&&e.start.column>t[i].column&&i++,s.unshift(i,0),t.splice.apply(t,s),this.$updateRows()}}},this.$updateRows=function(){var e=this.session.lineWidgets;if(e){var t=!0;e.forEach((function(e,i){if(e){t=!1,e.row=i;while(e.$oldWidget)e.$oldWidget.row=i,e=e.$oldWidget}})),t&&(this.session.lineWidgets=null)}},this.$registerLineWidget=function(e){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var t=this.session.lineWidgets[e.row];return t&&(e.$oldWidget=t,t.el&&t.el.parentNode&&(t.el.parentNode.removeChild(t.el),t._inDocument=!1)),this.session.lineWidgets[e.row]=e,e},this.addLineWidget=function(e){if(this.$registerLineWidget(e),e.session=this.session,!this.editor)return e;var t=this.editor.renderer;e.html&&!e.el&&(e.el=n.createElement("div"),e.el.innerHTML=e.html),e.el&&(n.addCssClass(e.el,"ace_lineWidgetContainer"),e.el.style.position="absolute",e.el.style.zIndex=5,t.container.appendChild(e.el),e._inDocument=!0,e.coverGutter||(e.el.style.zIndex=3),null==e.pixelHeight&&(e.pixelHeight=e.el.offsetHeight)),null==e.rowCount&&(e.rowCount=e.pixelHeight/t.layerConfig.lineHeight);var i=this.session.getFoldAt(e.row,0);if(e.$fold=i,i){var r=this.session.lineWidgets;e.row!=i.end.row||r[i.start.row]?e.hidden=!0:r[i.start.row]=e}return this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows(),this.renderWidgets(null,t),this.onWidgetChanged(e),e},this.removeLineWidget=function(e){if(e._inDocument=!1,e.session=null,e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el),e.editor&&e.editor.destroy)try{e.editor.destroy()}catch(i){}if(this.session.lineWidgets){var t=this.session.lineWidgets[e.row];if(t==e)this.session.lineWidgets[e.row]=e.$oldWidget,e.$oldWidget&&this.onWidgetChanged(e.$oldWidget);else while(t){if(t.$oldWidget==e){t.$oldWidget=e.$oldWidget;break}t=t.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows()},this.getWidgetsAtRow=function(e){var t=this.session.lineWidgets,i=t&&t[e],n=[];while(i)n.push(i),i=i.$oldWidget;return n},this.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},this.measureWidgets=function(e,t){var i=this.session._changedWidgets,n=t.layerConfig;if(i&&i.length){for(var r=1/0,s=0;s<i.length;s++){var o=i[s];if(o&&o.el&&o.session==this.session){if(!o._inDocument){if(this.session.lineWidgets[o.row]!=o)continue;o._inDocument=!0,t.container.appendChild(o.el)}o.h=o.el.offsetHeight,o.fixedWidth||(o.w=o.el.offsetWidth,o.screenWidth=Math.ceil(o.w/n.characterWidth));var a=o.h/n.lineHeight;o.coverLine&&(a-=this.session.getRowLineCount(o.row),a<0&&(a=0)),o.rowCount!=a&&(o.rowCount=a,o.row<r&&(r=o.row))}}r!=1/0&&(this.session._emit("changeFold",{data:{start:{row:r}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]}},this.renderWidgets=function(e,t){var i=t.layerConfig,n=this.session.lineWidgets;if(n){var r=Math.min(this.firstRow,i.firstRow),s=Math.max(this.lastRow,i.lastRow,n.length);while(r>0&&!n[r])r--;this.firstRow=i.firstRow,this.lastRow=i.lastRow,t.$cursorLayer.config=i;for(var o=r;o<=s;o++){var a=n[o];if(a&&a.el)if(a.hidden)a.el.style.top=-100-(a.pixelHeight||0)+"px";else{a._inDocument||(a._inDocument=!0,t.container.appendChild(a.el));var l=t.$cursorLayer.getPixelPosition({row:o,column:0},!0).top;a.coverLine||(l+=i.lineHeight*this.session.getRowLineCount(a.row)),a.el.style.top=l-i.offset+"px";var c=a.coverGutter?0:t.gutterWidth;a.fixedWidth||(c-=t.scrollLeft),a.el.style.left=c+"px",a.fullWidth&&a.screenWidth&&(a.el.style.minWidth=i.width+2*i.padding+"px"),a.fixedWidth?a.el.style.right=t.scrollBar.getWidth()+"px":a.el.style.right=""}}}}}).call(r.prototype),t.LineWidgets=r})),ace.define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range"],(function(e,t,i){"use strict";var n=e("../line_widgets").LineWidgets,r=e("../lib/dom"),s=e("../range").Range;function o(e,t,i){var n=0,r=e.length-1;while(n<=r){var s=n+r>>1,o=i(t,e[s]);if(o>0)n=s+1;else{if(!(o<0))return s;r=s-1}}return-(n+1)}function a(e,t,i){var n=e.getAnnotations().sort(s.comparePoints);if(n.length){var r=o(n,{row:t,column:-1},s.comparePoints);r<0&&(r=-r-1),r>=n.length?r=i>0?0:n.length-1:0===r&&i<0&&(r=n.length-1);var a=n[r];if(a&&i){if(a.row===t){do{a=n[r+=i]}while(a&&a.row===t);if(!a)return n.slice()}var l=[];t=a.row;do{l[i<0?"unshift":"push"](a),a=n[r+=i]}while(a&&a.row==t);return l.length&&l}}}t.showErrorMarker=function(e,t){var i=e.session;i.widgetManager||(i.widgetManager=new n(i),i.widgetManager.attach(e));var s=e.getCursorPosition(),o=s.row,l=i.widgetManager.getWidgetsAtRow(o).filter((function(e){return"errorMarker"==e.type}))[0];l?l.destroy():o-=t;var c,h=a(i,o,t);if(h){var d=h[0];s.column=(d.pos&&"number"!=typeof d.column?d.pos.sc:d.column)||0,s.row=d.row,c=e.renderer.$gutterLayer.$annotations[s.row]}else{if(l)return;c={text:["Looks good!"],className:"ace_ok"}}e.session.unfold(s.row),e.selection.moveToPosition(s);var u={row:s.row,fixedWidth:!0,coverGutter:!0,el:r.createElement("div"),type:"errorMarker"},g=u.el.appendChild(r.createElement("div")),p=u.el.appendChild(r.createElement("div"));p.className="error_widget_arrow "+c.className;var m=e.renderer.$cursorLayer.getPixelPosition(s).left;p.style.left=m+e.renderer.gutterWidth-5+"px",u.el.className="error_widget_wrapper",g.className="error_widget "+c.className,g.innerHTML=c.text.join("<br>"),g.appendChild(r.createElement("div"));var f=function(e,t,i){if(0===t&&("esc"===i||"return"===i))return u.destroy(),{command:"null"}};u.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(f),i.widgetManager.removeLineWidget(u),e.off("changeSelection",u.destroy),e.off("changeSession",u.destroy),e.off("mouseup",u.destroy),e.off("change",u.destroy))},e.keyBinding.addKeyboardHandler(f),e.on("changeSelection",u.destroy),e.on("changeSession",u.destroy),e.on("mouseup",u.destroy),e.on("change",u.destroy),e.session.widgetManager.addLineWidget(u),u.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:u.el.offsetHeight})},r.importCssString(" .error_widget_wrapper { background: inherit; color: inherit; border:none } .error_widget { border-top: solid 2px; border-bottom: solid 2px; margin: 5px 0; padding: 10px 40px; white-space: pre-wrap; } .error_widget.ace_error, .error_widget_arrow.ace_error{ border-color: #ff5a5a } .error_widget.ace_warning, .error_widget_arrow.ace_warning{ border-color: #F1D817 } .error_widget.ace_info, .error_widget_arrow.ace_info{ border-color: #5a5a5a } .error_widget.ace_ok, .error_widget_arrow.ace_ok{ border-color: #5aaa5a } .error_widget_arrow { position: absolute; border: solid 5px; border-top-color: transparent!important; border-right-color: transparent!important; border-left-color: transparent!important; top: -5px; }","")})),ace.define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"],(function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var r=e("./lib/dom"),s=e("./lib/event"),o=e("./range").Range,a=e("./editor").Editor,l=e("./edit_session").EditSession,c=e("./undomanager").UndoManager,h=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),t.config=e("./config"),t.require=e,t.define=i(23),t.edit=function(e,i){if("string"==typeof e){var n=e;if(e=document.getElementById(n),!e)throw new Error("ace.edit can't find div #"+n)}if(e&&e.env&&e.env.editor instanceof a)return e.env.editor;var o="";if(e&&/input|textarea/i.test(e.tagName)){var l=e;o=l.value,e=r.createElement("pre"),l.parentNode.replaceChild(e,l)}else e&&(o=e.textContent,e.innerHTML="");var c=t.createEditSession(o),d=new a(new h(e),c,i),u={document:c,editor:d,onResize:d.resize.bind(d,null)};return l&&(u.textarea=l),s.addListener(window,"resize",u.onResize),d.on("destroy",(function(){s.removeListener(window,"resize",u.onResize),u.editor.container.env=null})),d.container.env=d.env=u,d},t.createEditSession=function(e,t){var i=new l(e,t);return i.setUndoManager(new c),i},t.Range=o,t.Editor=a,t.EditSession=l,t.UndoManager=c,t.VirtualRenderer=h,t.version=t.config.version})),function(){ace.require(["ace/ace"],(function(t){for(var i in t&&(t.config.init(!0),t.define=ace.define),window.ace||(window.ace=t),t)t.hasOwnProperty(i)&&(window.ace[i]=t[i]);window.ace["default"]=window.ace,e&&(e.exports=window.ace)}))}()}).call(this,i(16)(e))},function(e,t,i){(function(e){ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],(function(e,t,i){"use strict";var n=e("../lib/oop"),r=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};n.inherits(s,r),t.JsonHighlightRules=s})),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],(function(e,t,i){"use strict";var n=e("../range").Range,r=function(){};(function(){this.checkOutdent=function(e,t){return!!/^\s+$/.test(e)&&/^\s*\}/.test(t)},this.autoOutdent=function(e,t){var i=e.getLine(t),r=i.match(/^(\s*\})/);if(!r)return 0;var s=r[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var a=this.$getIndent(e.getLine(o.row));e.replace(new n(t,0,t,s-1),a)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(r.prototype),t.MatchingBraceOutdent=r})),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],(function(e,t,i){"use strict";var n=e("../../lib/oop"),r=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};n.inherits(o,s),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,i){var n=e.getLine(i);if(this.singleLineBlockCommentRe.test(n)&&!this.startRegionRe.test(n)&&!this.tripleStarBlockCommentRe.test(n))return"";var r=this._getFoldWidgetBase(e,t,i);return!r&&this.startRegionRe.test(n)?"start":r},this.getFoldWidgetRange=function(e,t,i,n){var r=e.getLine(i);if(this.startRegionRe.test(r))return this.getCommentRegionBlock(e,r,i);var s=r.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],i,o);var a=e.getCommentFoldRange(i,o+s[0].length,1);return a&&!a.isMultiLine()&&(n?a=this.getSectionRange(e,i):"all"!=t&&(a=null)),a}if("markbegin"!==t){s=r.match(this.foldingStopMarker);if(s){o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],i,o):e.getCommentFoldRange(i,o,-1)}}},this.getSectionRange=function(e,t){var i=e.getLine(t),n=i.search(/\S/),s=t,o=i.length;t+=1;var a=t,l=e.getLength();while(++t<l){i=e.getLine(t);var c=i.search(/\S/);if(-1!==c){if(n>c)break;var h=this.getFoldWidgetRange(e,"all",t);if(h){if(h.start.row<=s)break;if(h.isMultiLine())t=h.end.row;else if(n==c)break}a=t}}return new r(s,o,a,e.getLine(a).length)},this.getCommentRegionBlock=function(e,t,i){var n=t.search(/\s*$/),s=e.getLength(),o=i,a=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,l=1;while(++i<s){t=e.getLine(i);var c=a.exec(t);if(c&&(c[1]?l--:l++,!l))break}var h=i;if(h>o)return new r(o,n,h,t.length)}}.call(o.prototype)})),ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/worker/worker_client"],(function(e,t,i){"use strict";var n=e("../lib/oop"),r=e("./text").Mode,s=e("./json_highlight_rules").JsonHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,a=e("./behaviour/cstyle").CstyleBehaviour,l=e("./folding/cstyle").FoldMode,c=e("../worker/worker_client").WorkerClient,h=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new l};n.inherits(h,r),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(e,t,i){var n=this.$getIndent(t);if("start"==e){var r=t.match(/^.*[\{\(\[]\s*$/);r&&(n+=i)}return n},this.checkOutdent=function(e,t,i){return this.$outdent.checkOutdent(t,i)},this.autoOutdent=function(e,t,i){this.$outdent.autoOutdent(t,i)},this.createWorker=function(e){var t=new c(["ace"],"ace/mode/json_worker","JsonWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",(function(t){e.setAnnotations(t.data)})),t.on("terminate",(function(){e.clearAnnotations()})),t},this.$id="ace/mode/json"}.call(h.prototype),t.Mode=h})),function(){ace.require(["ace/mode/json"],(function(t){e&&(e.exports=t)}))}()}).call(this,i(16)(e))},function(e,t,i){(function(e){ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"],(function(e,t,i){"use strict";var n=e("../lib/dom"),r=e("../lib/lang"),s=e("../lib/event"),o='.ace_search {background-color: #ddd;color: #666;border: 1px solid #cbcbcb;border-top: 0 none;overflow: hidden;margin: 0;padding: 4px 6px 0 4px;position: absolute;top: 0;z-index: 99;white-space: normal;}.ace_search.left {border-left: 0 none;border-radius: 0px 0px 5px 0px;left: 0;}.ace_search.right {border-radius: 0px 0px 0px 5px;border-right: 0 none;right: 0;}.ace_search_form, .ace_replace_form {margin: 0 20px 4px 0;overflow: hidden;line-height: 1.9;}.ace_replace_form {margin-right: 0;}.ace_search_form.ace_nomatch {outline: 1px solid red;}.ace_search_field {border-radius: 3px 0 0 3px;background-color: white;color: black;border: 1px solid #cbcbcb;border-right: 0 none;outline: 0;padding: 0;font-size: inherit;margin: 0;line-height: inherit;padding: 0 6px;min-width: 17em;vertical-align: top;min-height: 1.8em;box-sizing: content-box;}.ace_searchbtn {border: 1px solid #cbcbcb;line-height: inherit;display: inline-block;padding: 0 6px;background: #fff;border-right: 0 none;border-left: 1px solid #dcdcdc;cursor: pointer;margin: 0;position: relative;color: #666;}.ace_searchbtn:last-child {border-radius: 0 3px 3px 0;border-right: 1px solid #cbcbcb;}.ace_searchbtn:disabled {background: none;cursor: default;}.ace_searchbtn:hover {background-color: #eef1f6;}.ace_searchbtn.prev, .ace_searchbtn.next {padding: 0px 0.7em}.ace_searchbtn.prev:after, .ace_searchbtn.next:after {content: "";border: solid 2px #888;width: 0.5em;height: 0.5em;border-width: 2px 0 0 2px;display:inline-block;transform: rotate(-45deg);}.ace_searchbtn.next:after {border-width: 0 2px 2px 0 ;}.ace_searchbtn_close {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;border-radius: 50%;border: 0 none;color: #656565;cursor: pointer;font: 16px/16px Arial;padding: 0;height: 14px;width: 14px;top: 9px;right: 7px;position: absolute;}.ace_searchbtn_close:hover {background-color: #656565;background-position: 50% 100%;color: white;}.ace_button {margin-left: 2px;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;overflow: hidden;opacity: 0.7;border: 1px solid rgba(100,100,100,0.23);padding: 1px;box-sizing: border-box!important;color: black;}.ace_button:hover {background-color: #eee;opacity:1;}.ace_button:active {background-color: #ddd;}.ace_button.checked {border-color: #3399ff;opacity:1;}.ace_search_options{margin-bottom: 3px;text-align: right;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;clear: both;}.ace_search_counter {float: left;font-family: arial;padding: 0 8px;}',a=e("../keyboard/hash_handler").HashHandler,l=e("../lib/keys"),c=999;n.importCssString(o,"ace_searchbox");var h=function(e,t,i){var r=n.createElement("div");n.buildDom(["div",{class:"ace_search right"},["span",{action:"hide",class:"ace_searchbtn_close"}],["div",{class:"ace_search_form"},["input",{class:"ace_search_field",placeholder:"Search for",spellcheck:"false"}],["span",{action:"findPrev",class:"ace_searchbtn prev"},""],["span",{action:"findNext",class:"ace_searchbtn next"},""],["span",{action:"findAll",class:"ace_searchbtn",title:"Alt-Enter"},"All"]],["div",{class:"ace_replace_form"},["input",{class:"ace_search_field",placeholder:"Replace with",spellcheck:"false"}],["span",{action:"replaceAndFindNext",class:"ace_searchbtn"},"Replace"],["span",{action:"replaceAll",class:"ace_searchbtn"},"All"]],["div",{class:"ace_search_options"},["span",{action:"toggleReplace",class:"ace_button",title:"Toggle Replace mode",style:"float:left;margin-top:-2px;padding:0 5px;"},"+"],["span",{class:"ace_search_counter"}],["span",{action:"toggleRegexpMode",class:"ace_button",title:"RegExp Search"},".*"],["span",{action:"toggleCaseSensitive",class:"ace_button",title:"CaseSensitive Search"},"Aa"],["span",{action:"toggleWholeWords",class:"ace_button",title:"Whole Word Search"},"\\b"],["span",{action:"searchInSelection",class:"ace_button",title:"Search In Selection"},"S"]]],r),this.element=r.firstChild,this.setSession=this.setSession.bind(this),this.$init(),this.setEditor(e),n.importCssString(o,"ace_searchbox",e.container)};(function(){this.setEditor=function(e){e.searchBox=this,e.renderer.scroller.appendChild(this.element),this.editor=e},this.setSession=function(e){this.searchRange=null,this.$syncOptions(!0)},this.$initElements=function(e){this.searchBox=e.querySelector(".ace_search_form"),this.replaceBox=e.querySelector(".ace_replace_form"),this.searchOption=e.querySelector("[action=searchInSelection]"),this.replaceOption=e.querySelector("[action=toggleReplace]"),this.regExpOption=e.querySelector("[action=toggleRegexpMode]"),this.caseSensitiveOption=e.querySelector("[action=toggleCaseSensitive]"),this.wholeWordOption=e.querySelector("[action=toggleWholeWords]"),this.searchInput=this.searchBox.querySelector(".ace_search_field"),this.replaceInput=this.replaceBox.querySelector(".ace_search_field"),this.searchCounter=e.querySelector(".ace_search_counter")},this.$init=function(){var e=this.element;this.$initElements(e);var t=this;s.addListener(e,"mousedown",(function(e){setTimeout((function(){t.activeInput.focus()}),0),s.stopPropagation(e)})),s.addListener(e,"click",(function(e){var i=e.target||e.srcElement,n=i.getAttribute("action");n&&t[n]?t[n]():t.$searchBarKb.commands[n]&&t.$searchBarKb.commands[n].exec(t),s.stopPropagation(e)})),s.addCommandKeyListener(e,(function(e,i,n){var r=l.keyCodeToString(n),o=t.$searchBarKb.findKeyCommand(i,r);o&&o.exec&&(o.exec(t),s.stopEvent(e))})),this.$onChange=r.delayedCall((function(){t.find(!1,!1)})),s.addListener(this.searchInput,"input",(function(){t.$onChange.schedule(20)})),s.addListener(this.searchInput,"focus",(function(){t.activeInput=t.searchInput,t.searchInput.value&&t.highlight()})),s.addListener(this.replaceInput,"focus",(function(){t.activeInput=t.replaceInput,t.searchInput.value&&t.highlight()}))},this.$closeSearchBarKb=new a([{bindKey:"Esc",name:"closeSearchBar",exec:function(e){e.searchBox.hide()}}]),this.$searchBarKb=new a,this.$searchBarKb.bindKeys({"Ctrl-f|Command-f":function(e){var t=e.isReplace=!e.isReplace;e.replaceBox.style.display=t?"":"none",e.replaceOption.checked=!1,e.$syncOptions(),e.searchInput.focus()},"Ctrl-H|Command-Option-F":function(e){e.editor.getReadOnly()||(e.replaceOption.checked=!0,e.$syncOptions(),e.replaceInput.focus())},"Ctrl-G|Command-G":function(e){e.findNext()},"Ctrl-Shift-G|Command-Shift-G":function(e){e.findPrev()},esc:function(e){setTimeout((function(){e.hide()}))},Return:function(e){e.activeInput==e.replaceInput&&e.replace(),e.findNext()},"Shift-Return":function(e){e.activeInput==e.replaceInput&&e.replace(),e.findPrev()},"Alt-Return":function(e){e.activeInput==e.replaceInput&&e.replaceAll(),e.findAll()},Tab:function(e){(e.activeInput==e.replaceInput?e.searchInput:e.replaceInput).focus()}}),this.$searchBarKb.addCommands([{name:"toggleRegexpMode",bindKey:{win:"Alt-R|Alt-/",mac:"Ctrl-Alt-R|Ctrl-Alt-/"},exec:function(e){e.regExpOption.checked=!e.regExpOption.checked,e.$syncOptions()}},{name:"toggleCaseSensitive",bindKey:{win:"Alt-C|Alt-I",mac:"Ctrl-Alt-R|Ctrl-Alt-I"},exec:function(e){e.caseSensitiveOption.checked=!e.caseSensitiveOption.checked,e.$syncOptions()}},{name:"toggleWholeWords",bindKey:{win:"Alt-B|Alt-W",mac:"Ctrl-Alt-B|Ctrl-Alt-W"},exec:function(e){e.wholeWordOption.checked=!e.wholeWordOption.checked,e.$syncOptions()}},{name:"toggleReplace",exec:function(e){e.replaceOption.checked=!e.replaceOption.checked,e.$syncOptions()}},{name:"searchInSelection",exec:function(e){e.searchOption.checked=!e.searchRange,e.setSearchRange(e.searchOption.checked&&e.editor.getSelectionRange()),e.$syncOptions()}}]),this.setSearchRange=function(e){this.searchRange=e,e?this.searchRangeMarker=this.editor.session.addMarker(e,"ace_active-line"):this.searchRangeMarker&&(this.editor.session.removeMarker(this.searchRangeMarker),this.searchRangeMarker=null)},this.$syncOptions=function(e){n.setCssClass(this.replaceOption,"checked",this.searchRange),n.setCssClass(this.searchOption,"checked",this.searchOption.checked),this.replaceOption.textContent=this.replaceOption.checked?"-":"+",n.setCssClass(this.regExpOption,"checked",this.regExpOption.checked),n.setCssClass(this.wholeWordOption,"checked",this.wholeWordOption.checked),n.setCssClass(this.caseSensitiveOption,"checked",this.caseSensitiveOption.checked);var t=this.editor.getReadOnly();this.replaceOption.style.display=t?"none":"",this.replaceBox.style.display=this.replaceOption.checked&&!t?"":"none",this.find(!1,!1,e)},this.highlight=function(e){this.editor.session.highlight(e||this.editor.$search.$options.re),this.editor.renderer.updateBackMarkers()},this.find=function(e,t,i){var r=this.editor.find(this.searchInput.value,{skipCurrent:e,backwards:t,wrap:!0,regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked,preventScroll:i,range:this.searchRange}),s=!r&&this.searchInput.value;n.setCssClass(this.searchBox,"ace_nomatch",s),this.editor._emit("findSearchBox",{match:!s}),this.highlight(),this.updateCounter()},this.updateCounter=function(){var e=this.editor,t=e.$search.$options.re,i=0,n=0;if(t){var r=this.searchRange?e.session.getTextRange(this.searchRange):e.getValue(),s=e.session.doc.positionToIndex(e.selection.anchor);this.searchRange&&(s-=e.session.doc.positionToIndex(this.searchRange.start));var o,a=t.lastIndex=0;while(o=t.exec(r)){if(i++,a=o.index,a<=s&&n++,i>c)break;if(!o[0]&&(t.lastIndex=a+=1,a>=r.length))break}}this.searchCounter.textContent=n+" of "+(i>c?c+"+":i)},this.findNext=function(){this.find(!0,!1)},this.findPrev=function(){this.find(!0,!0)},this.findAll=function(){var e=this.editor.findAll(this.searchInput.value,{regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked}),t=!e&&this.searchInput.value;n.setCssClass(this.searchBox,"ace_nomatch",t),this.editor._emit("findSearchBox",{match:!t}),this.highlight(),this.hide()},this.replace=function(){this.editor.getReadOnly()||this.editor.replace(this.replaceInput.value)},this.replaceAndFindNext=function(){this.editor.getReadOnly()||(this.editor.replace(this.replaceInput.value),this.findNext())},this.replaceAll=function(){this.editor.getReadOnly()||this.editor.replaceAll(this.replaceInput.value)},this.hide=function(){this.active=!1,this.setSearchRange(null),this.editor.off("changeSession",this.setSession),this.element.style.display="none",this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb),this.editor.focus()},this.show=function(e,t){this.active=!0,this.editor.on("changeSession",this.setSession),this.element.style.display="",this.replaceOption.checked=t,e&&(this.searchInput.value=e),this.searchInput.focus(),this.searchInput.select(),this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb),this.$syncOptions(!0)},this.isFocused=function(){var e=document.activeElement;return e==this.searchInput||e==this.replaceInput}}).call(h.prototype),t.SearchBox=h,t.Search=function(e,t){var i=e.searchBox||new h(e);i.show(e.session.getTextRange(),t)}})),function(){ace.require(["ace/ext/searchbox"],(function(t){e&&(e.exports=t)}))}()}).call(this,i(16)(e))},function(e,t){e.exports="data:application/javascript;base64,Im5vIHVzZSBzdHJpY3QiOwohKGZ1bmN0aW9uKHdpbmRvdykgewppZiAodHlwZW9mIHdpbmRvdy53aW5kb3cgIT0gInVuZGVmaW5lZCIgJiYgd2luZG93LmRvY3VtZW50KQogICAgcmV0dXJuOwppZiAod2luZG93LnJlcXVpcmUgJiYgd2luZG93LmRlZmluZSkKICAgIHJldHVybjsKCmlmICghd2luZG93LmNvbnNvbGUpIHsKICAgIHdpbmRvdy5jb25zb2xlID0gZnVuY3Rpb24oKSB7CiAgICAgICAgdmFyIG1zZ3MgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDApOwogICAgICAgIHBvc3RNZXNzYWdlKHt0eXBlOiAibG9nIiwgZGF0YTogbXNnc30pOwogICAgfTsKICAgIHdpbmRvdy5jb25zb2xlLmVycm9yID0KICAgIHdpbmRvdy5jb25zb2xlLndhcm4gPSAKICAgIHdpbmRvdy5jb25zb2xlLmxvZyA9CiAgICB3aW5kb3cuY29uc29sZS50cmFjZSA9IHdpbmRvdy5jb25zb2xlOwp9CndpbmRvdy53aW5kb3cgPSB3aW5kb3c7CndpbmRvdy5hY2UgPSB3aW5kb3c7Cgp3aW5kb3cub25lcnJvciA9IGZ1bmN0aW9uKG1lc3NhZ2UsIGZpbGUsIGxpbmUsIGNvbCwgZXJyKSB7CiAgICBwb3N0TWVzc2FnZSh7dHlwZTogImVycm9yIiwgZGF0YTogewogICAgICAgIG1lc3NhZ2U6IG1lc3NhZ2UsCiAgICAgICAgZGF0YTogZXJyLmRhdGEsCiAgICAgICAgZmlsZTogZmlsZSwKICAgICAgICBsaW5lOiBsaW5lLCAKICAgICAgICBjb2w6IGNvbCwKICAgICAgICBzdGFjazogZXJyLnN0YWNrCiAgICB9fSk7Cn07Cgp3aW5kb3cubm9ybWFsaXplTW9kdWxlID0gZnVuY3Rpb24ocGFyZW50SWQsIG1vZHVsZU5hbWUpIHsKICAgIC8vIG5vcm1hbGl6ZSBwbHVnaW4gcmVxdWlyZXMKICAgIGlmIChtb2R1bGVOYW1lLmluZGV4T2YoIiEiKSAhPT0gLTEpIHsKICAgICAgICB2YXIgY2h1bmtzID0gbW9kdWxlTmFtZS5zcGxpdCgiISIpOwogICAgICAgIHJldHVybiB3aW5kb3cubm9ybWFsaXplTW9kdWxlKHBhcmVudElkLCBjaHVua3NbMF0pICsgIiEiICsgd2luZG93Lm5vcm1hbGl6ZU1vZHVsZShwYXJlbnRJZCwgY2h1bmtzWzFdKTsKICAgIH0KICAgIC8vIG5vcm1hbGl6ZSByZWxhdGl2ZSByZXF1aXJlcwogICAgaWYgKG1vZHVsZU5hbWUuY2hhckF0KDApID09ICIuIikgewogICAgICAgIHZhciBiYXNlID0gcGFyZW50SWQuc3BsaXQoIi8iKS5zbGljZSgwLCAtMSkuam9pbigiLyIpOwogICAgICAgIG1vZHVsZU5hbWUgPSAoYmFzZSA/IGJhc2UgKyAiLyIgOiAiIikgKyBtb2R1bGVOYW1lOwogICAgICAgIAogICAgICAgIHdoaWxlIChtb2R1bGVOYW1lLmluZGV4T2YoIi4iKSAhPT0gLTEgJiYgcHJldmlvdXMgIT0gbW9kdWxlTmFtZSkgewogICAgICAgICAgICB2YXIgcHJldmlvdXMgPSBtb2R1bGVOYW1lOwogICAgICAgICAgICBtb2R1bGVOYW1lID0gbW9kdWxlTmFtZS5yZXBsYWNlKC9eXC5cLy8sICIiKS5yZXBsYWNlKC9cL1wuXC8vLCAiLyIpLnJlcGxhY2UoL1teXC9dK1wvXC5cLlwvLywgIiIpOwogICAgICAgIH0KICAgIH0KICAgIAogICAgcmV0dXJuIG1vZHVsZU5hbWU7Cn07Cgp3aW5kb3cucmVxdWlyZSA9IGZ1bmN0aW9uIHJlcXVpcmUocGFyZW50SWQsIGlkKSB7CiAgICBpZiAoIWlkKSB7CiAgICAgICAgaWQgPSBwYXJlbnRJZDsKICAgICAgICBwYXJlbnRJZCA9IG51bGw7CiAgICB9CiAgICBpZiAoIWlkLmNoYXJBdCkKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoIndvcmtlci5qcyByZXF1aXJlKCkgYWNjZXB0cyBvbmx5IChwYXJlbnRJZCwgaWQpIGFzIGFyZ3VtZW50cyIpOwoKICAgIGlkID0gd2luZG93Lm5vcm1hbGl6ZU1vZHVsZShwYXJlbnRJZCwgaWQpOwoKICAgIHZhciBtb2R1bGUgPSB3aW5kb3cucmVxdWlyZS5tb2R1bGVzW2lkXTsKICAgIGlmIChtb2R1bGUpIHsKICAgICAgICBpZiAoIW1vZHVsZS5pbml0aWFsaXplZCkgewogICAgICAgICAgICBtb2R1bGUuaW5pdGlhbGl6ZWQgPSB0cnVlOwogICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IG1vZHVsZS5mYWN0b3J5KCkuZXhwb3J0czsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG1vZHVsZS5leHBvcnRzOwogICAgfQogICAKICAgIGlmICghd2luZG93LnJlcXVpcmUudGxucykKICAgICAgICByZXR1cm4gY29uc29sZS5sb2coInVuYWJsZSB0byBsb2FkICIgKyBpZCk7CiAgICAKICAgIHZhciBwYXRoID0gcmVzb2x2ZU1vZHVsZUlkKGlkLCB3aW5kb3cucmVxdWlyZS50bG5zKTsKICAgIGlmIChwYXRoLnNsaWNlKC0zKSAhPSAiLmpzIikgcGF0aCArPSAiLmpzIjsKICAgIAogICAgd2luZG93LnJlcXVpcmUuaWQgPSBpZDsKICAgIHdpbmRvdy5yZXF1aXJlLm1vZHVsZXNbaWRdID0ge307IC8vIHByZXZlbnQgaW5maW5pdGUgbG9vcCBvbiBicm9rZW4gbW9kdWxlcwogICAgaW1wb3J0U2NyaXB0cyhwYXRoKTsKICAgIHJldHVybiB3aW5kb3cucmVxdWlyZShwYXJlbnRJZCwgaWQpOwp9OwpmdW5jdGlvbiByZXNvbHZlTW9kdWxlSWQoaWQsIHBhdGhzKSB7CiAgICB2YXIgdGVzdFBhdGggPSBpZCwgdGFpbCA9ICIiOwogICAgd2hpbGUgKHRlc3RQYXRoKSB7CiAgICAgICAgdmFyIGFsaWFzID0gcGF0aHNbdGVzdFBhdGhdOwogICAgICAgIGlmICh0eXBlb2YgYWxpYXMgPT0gInN0cmluZyIpIHsKICAgICAgICAgICAgcmV0dXJuIGFsaWFzICsgdGFpbDsKICAgICAgICB9IGVsc2UgaWYgKGFsaWFzKSB7CiAgICAgICAgICAgIHJldHVybiAgYWxpYXMubG9jYXRpb24ucmVwbGFjZSgvXC8qJC8sICIvIikgKyAodGFpbCB8fCBhbGlhcy5tYWluIHx8IGFsaWFzLm5hbWUpOwogICAgICAgIH0gZWxzZSBpZiAoYWxpYXMgPT09IGZhbHNlKSB7CiAgICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB9CiAgICAgICAgdmFyIGkgPSB0ZXN0UGF0aC5sYXN0SW5kZXhPZigiLyIpOwogICAgICAgIGlmIChpID09PSAtMSkgYnJlYWs7CiAgICAgICAgdGFpbCA9IHRlc3RQYXRoLnN1YnN0cihpKSArIHRhaWw7CiAgICAgICAgdGVzdFBhdGggPSB0ZXN0UGF0aC5zbGljZSgwLCBpKTsKICAgIH0KICAgIHJldHVybiBpZDsKfQp3aW5kb3cucmVxdWlyZS5tb2R1bGVzID0ge307CndpbmRvdy5yZXF1aXJlLnRsbnMgPSB7fTsKCndpbmRvdy5kZWZpbmUgPSBmdW5jdGlvbihpZCwgZGVwcywgZmFjdG9yeSkgewogICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPT0gMikgewogICAgICAgIGZhY3RvcnkgPSBkZXBzOwogICAgICAgIGlmICh0eXBlb2YgaWQgIT0gInN0cmluZyIpIHsKICAgICAgICAgICAgZGVwcyA9IGlkOwogICAgICAgICAgICBpZCA9IHdpbmRvdy5yZXF1aXJlLmlkOwogICAgICAgIH0KICAgIH0gZWxzZSBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PSAxKSB7CiAgICAgICAgZmFjdG9yeSA9IGlkOwogICAgICAgIGRlcHMgPSBbXTsKICAgICAgICBpZCA9IHdpbmRvdy5yZXF1aXJlLmlkOwogICAgfQogICAgCiAgICBpZiAodHlwZW9mIGZhY3RvcnkgIT0gImZ1bmN0aW9uIikgewogICAgICAgIHdpbmRvdy5yZXF1aXJlLm1vZHVsZXNbaWRdID0gewogICAgICAgICAgICBleHBvcnRzOiBmYWN0b3J5LAogICAgICAgICAgICBpbml0aWFsaXplZDogdHJ1ZQogICAgICAgIH07CiAgICAgICAgcmV0dXJuOwogICAgfQoKICAgIGlmICghZGVwcy5sZW5ndGgpCiAgICAgICAgLy8gSWYgdGhlcmUgaXMgbm8gZGVwZW5kZW5jaWVzLCB3ZSBpbmplY3QgInJlcXVpcmUiLCAiZXhwb3J0cyIgYW5kCiAgICAgICAgLy8gIm1vZHVsZSIgYXMgZGVwZW5kZW5jaWVzLCB0byBwcm92aWRlIENvbW1vbkpTIGNvbXBhdGliaWxpdHkuCiAgICAgICAgZGVwcyA9IFsicmVxdWlyZSIsICJleHBvcnRzIiwgIm1vZHVsZSJdOwoKICAgIHZhciByZXEgPSBmdW5jdGlvbihjaGlsZElkKSB7CiAgICAgICAgcmV0dXJuIHdpbmRvdy5yZXF1aXJlKGlkLCBjaGlsZElkKTsKICAgIH07CgogICAgd2luZG93LnJlcXVpcmUubW9kdWxlc1tpZF0gPSB7CiAgICAgICAgZXhwb3J0czoge30sCiAgICAgICAgZmFjdG9yeTogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIHZhciBtb2R1bGUgPSB0aGlzOwogICAgICAgICAgICB2YXIgcmV0dXJuRXhwb3J0cyA9IGZhY3RvcnkuYXBwbHkodGhpcywgZGVwcy5zbGljZSgwLCBmYWN0b3J5Lmxlbmd0aCkubWFwKGZ1bmN0aW9uKGRlcCkgewogICAgICAgICAgICAgICAgc3dpdGNoIChkZXApIHsKICAgICAgICAgICAgICAgICAgICAvLyBCZWNhdXNlICJyZXF1aXJlIiwgImV4cG9ydHMiIGFuZCAibW9kdWxlIiBhcmVuJ3QgYWN0dWFsCiAgICAgICAgICAgICAgICAgICAgLy8gZGVwZW5kZW5jaWVzLCB3ZSBtdXN0IGhhbmRsZSB0aGVtIHNlcGVyYXRlbHkuCiAgICAgICAgICAgICAgICAgICAgY2FzZSAicmVxdWlyZSI6IHJldHVybiByZXE7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAiZXhwb3J0cyI6IHJldHVybiBtb2R1bGUuZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICBjYXNlICJtb2R1bGUiOiAgcmV0dXJuIG1vZHVsZTsKICAgICAgICAgICAgICAgICAgICAvLyBCdXQgZm9yIGFsbCBvdGhlciBkZXBlbmRlbmNpZXMsIHdlIGNhbiBqdXN0IGdvIGFoZWFkIGFuZAogICAgICAgICAgICAgICAgICAgIC8vIHJlcXVpcmUgdGhlbS4KICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OiAgICAgICAgcmV0dXJuIHJlcShkZXApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSk7CiAgICAgICAgICAgIGlmIChyZXR1cm5FeHBvcnRzKQogICAgICAgICAgICAgICAgbW9kdWxlLmV4cG9ydHMgPSByZXR1cm5FeHBvcnRzOwogICAgICAgICAgICByZXR1cm4gbW9kdWxlOwogICAgICAgIH0KICAgIH07Cn07CndpbmRvdy5kZWZpbmUuYW1kID0ge307CnJlcXVpcmUudGxucyA9IHt9Owp3aW5kb3cuaW5pdEJhc2VVcmxzICA9IGZ1bmN0aW9uIGluaXRCYXNlVXJscyh0b3BMZXZlbE5hbWVzcGFjZXMpIHsKICAgIGZvciAodmFyIGkgaW4gdG9wTGV2ZWxOYW1lc3BhY2VzKQogICAgICAgIHJlcXVpcmUudGxuc1tpXSA9IHRvcExldmVsTmFtZXNwYWNlc1tpXTsKfTsKCndpbmRvdy5pbml0U2VuZGVyID0gZnVuY3Rpb24gaW5pdFNlbmRlcigpIHsKCiAgICB2YXIgRXZlbnRFbWl0dGVyID0gd2luZG93LnJlcXVpcmUoImFjZS9saWIvZXZlbnRfZW1pdHRlciIpLkV2ZW50RW1pdHRlcjsKICAgIHZhciBvb3AgPSB3aW5kb3cucmVxdWlyZSgiYWNlL2xpYi9vb3AiKTsKICAgIAogICAgdmFyIFNlbmRlciA9IGZ1bmN0aW9uKCkge307CiAgICAKICAgIChmdW5jdGlvbigpIHsKICAgICAgICAKICAgICAgICBvb3AuaW1wbGVtZW50KHRoaXMsIEV2ZW50RW1pdHRlcik7CiAgICAgICAgICAgICAgICAKICAgICAgICB0aGlzLmNhbGxiYWNrID0gZnVuY3Rpb24oZGF0YSwgY2FsbGJhY2tJZCkgewogICAgICAgICAgICBwb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICB0eXBlOiAiY2FsbCIsCiAgICAgICAgICAgICAgICBpZDogY2FsbGJhY2tJZCwKICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEKICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgIAogICAgICAgIHRoaXMuZW1pdCA9IGZ1bmN0aW9uKG5hbWUsIGRhdGEpIHsKICAgICAgICAgICAgcG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgdHlwZTogImV2ZW50IiwKICAgICAgICAgICAgICAgIG5hbWU6IG5hbWUsCiAgICAgICAgICAgICAgICBkYXRhOiBkYXRhCiAgICAgICAgICAgIH0pOwogICAgICAgIH07CiAgICAgICAgCiAgICB9KS5jYWxsKFNlbmRlci5wcm90b3R5cGUpOwogICAgCiAgICByZXR1cm4gbmV3IFNlbmRlcigpOwp9OwoKdmFyIG1haW4gPSB3aW5kb3cubWFpbiA9IG51bGw7CnZhciBzZW5kZXIgPSB3aW5kb3cuc2VuZGVyID0gbnVsbDsKCndpbmRvdy5vbm1lc3NhZ2UgPSBmdW5jdGlvbihlKSB7CiAgICB2YXIgbXNnID0gZS5kYXRhOwogICAgaWYgKG1zZy5ldmVudCAmJiBzZW5kZXIpIHsKICAgICAgICBzZW5kZXIuX3NpZ25hbChtc2cuZXZlbnQsIG1zZy5kYXRhKTsKICAgIH0KICAgIGVsc2UgaWYgKG1zZy5jb21tYW5kKSB7CiAgICAgICAgaWYgKG1haW5bbXNnLmNvbW1hbmRdKQogICAgICAgICAgICBtYWluW21zZy5jb21tYW5kXS5hcHBseShtYWluLCBtc2cuYXJncyk7CiAgICAgICAgZWxzZSBpZiAod2luZG93W21zZy5jb21tYW5kXSkKICAgICAgICAgICAgd2luZG93W21zZy5jb21tYW5kXS5hcHBseSh3aW5kb3csIG1zZy5hcmdzKTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigiVW5rbm93biBjb21tYW5kOiIgKyBtc2cuY29tbWFuZCk7CiAgICB9CiAgICBlbHNlIGlmIChtc2cuaW5pdCkgewogICAgICAgIHdpbmRvdy5pbml0QmFzZVVybHMobXNnLnRsbnMpOwogICAgICAgIHJlcXVpcmUoImFjZS9saWIvZXM1LXNoaW0iKTsKICAgICAgICBzZW5kZXIgPSB3aW5kb3cuc2VuZGVyID0gd2luZG93LmluaXRTZW5kZXIoKTsKICAgICAgICB2YXIgY2xhenogPSByZXF1aXJlKG1zZy5tb2R1bGUpW21zZy5jbGFzc25hbWVdOwogICAgICAgIG1haW4gPSB3aW5kb3cubWFpbiA9IG5ldyBjbGF6eihzZW5kZXIpOwogICAgfQp9Owp9KSh0aGlzKTsKCmFjZS5kZWZpbmUoImFjZS9saWIvb29wIixbXSwgZnVuY3Rpb24ocmVxdWlyZSwgZXhwb3J0cywgbW9kdWxlKSB7CiJ1c2Ugc3RyaWN0IjsKCmV4cG9ydHMuaW5oZXJpdHMgPSBmdW5jdGlvbihjdG9yLCBzdXBlckN0b3IpIHsKICAgIGN0b3Iuc3VwZXJfID0gc3VwZXJDdG9yOwogICAgY3Rvci5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKHN1cGVyQ3Rvci5wcm90b3R5cGUsIHsKICAgICAgICBjb25zdHJ1Y3RvcjogewogICAgICAgICAgICB2YWx1ZTogY3RvciwKICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlLAogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUKICAgICAgICB9CiAgICB9KTsKfTsKCmV4cG9ydHMubWl4aW4gPSBmdW5jdGlvbihvYmosIG1peGluKSB7CiAgICBmb3IgKHZhciBrZXkgaW4gbWl4aW4pIHsKICAgICAgICBvYmpba2V5XSA9IG1peGluW2tleV07CiAgICB9CiAgICByZXR1cm4gb2JqOwp9OwoKZXhwb3J0cy5pbXBsZW1lbnQgPSBmdW5jdGlvbihwcm90bywgbWl4aW4pIHsKICAgIGV4cG9ydHMubWl4aW4ocHJvdG8sIG1peGluKTsKfTsKCn0pOwoKYWNlLmRlZmluZSgiYWNlL3JhbmdlIixbXSwgZnVuY3Rpb24ocmVxdWlyZSwgZXhwb3J0cywgbW9kdWxlKSB7CiJ1c2Ugc3RyaWN0IjsKdmFyIGNvbXBhcmVQb2ludHMgPSBmdW5jdGlvbihwMSwgcDIpIHsKICAgIHJldHVybiBwMS5yb3cgLSBwMi5yb3cgfHwgcDEuY29sdW1uIC0gcDIuY29sdW1uOwp9Owp2YXIgUmFuZ2UgPSBmdW5jdGlvbihzdGFydFJvdywgc3RhcnRDb2x1bW4sIGVuZFJvdywgZW5kQ29sdW1uKSB7CiAgICB0aGlzLnN0YXJ0ID0gewogICAgICAgIHJvdzogc3RhcnRSb3csCiAgICAgICAgY29sdW1uOiBzdGFydENvbHVtbgogICAgfTsKCiAgICB0aGlzLmVuZCA9IHsKICAgICAgICByb3c6IGVuZFJvdywKICAgICAgICBjb2x1bW46IGVuZENvbHVtbgogICAgfTsKfTsKCihmdW5jdGlvbigpIHsKICAgIHRoaXMuaXNFcXVhbCA9IGZ1bmN0aW9uKHJhbmdlKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQucm93ID09PSByYW5nZS5zdGFydC5yb3cgJiYKICAgICAgICAgICAgdGhpcy5lbmQucm93ID09PSByYW5nZS5lbmQucm93ICYmCiAgICAgICAgICAgIHRoaXMuc3RhcnQuY29sdW1uID09PSByYW5nZS5zdGFydC5jb2x1bW4gJiYKICAgICAgICAgICAgdGhpcy5lbmQuY29sdW1uID09PSByYW5nZS5lbmQuY29sdW1uOwogICAgfTsKICAgIHRoaXMudG9TdHJpbmcgPSBmdW5jdGlvbigpIHsKICAgICAgICByZXR1cm4gKCJSYW5nZTogWyIgKyB0aGlzLnN0YXJ0LnJvdyArICIvIiArIHRoaXMuc3RhcnQuY29sdW1uICsKICAgICAgICAgICAgIl0gLT4gWyIgKyB0aGlzLmVuZC5yb3cgKyAiLyIgKyB0aGlzLmVuZC5jb2x1bW4gKyAiXSIpOwogICAgfTsKCiAgICB0aGlzLmNvbnRhaW5zID0gZnVuY3Rpb24ocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwOwogICAgfTsKICAgIHRoaXMuY29tcGFyZVJhbmdlID0gZnVuY3Rpb24ocmFuZ2UpIHsKICAgICAgICB2YXIgY21wLAogICAgICAgICAgICBlbmQgPSByYW5nZS5lbmQsCiAgICAgICAgICAgIHN0YXJ0ID0gcmFuZ2Uuc3RhcnQ7CgogICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShlbmQucm93LCBlbmQuY29sdW1uKTsKICAgICAgICBpZiAoY21wID09IDEpIHsKICAgICAgICAgICAgY21wID0gdGhpcy5jb21wYXJlKHN0YXJ0LnJvdywgc3RhcnQuY29sdW1uKTsKICAgICAgICAgICAgaWYgKGNtcCA9PSAxKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMjsKICAgICAgICAgICAgfSBlbHNlIGlmIChjbXAgPT0gMCkgewogICAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZSBpZiAoY21wID09IC0xKSB7CiAgICAgICAgICAgIHJldHVybiAtMjsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjbXAgPSB0aGlzLmNvbXBhcmUoc3RhcnQucm93LCBzdGFydC5jb2x1bW4pOwogICAgICAgICAgICBpZiAoY21wID09IC0xKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICAgIH0gZWxzZSBpZiAoY21wID09IDEpIHsKICAgICAgICAgICAgICAgIHJldHVybiA0MjsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY29tcGFyZVBvaW50ID0gZnVuY3Rpb24ocCkgewogICAgICAgIHJldHVybiB0aGlzLmNvbXBhcmUocC5yb3csIHAuY29sdW1uKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zUmFuZ2UgPSBmdW5jdGlvbihyYW5nZSkgewogICAgICAgIHJldHVybiB0aGlzLmNvbXBhcmVQb2ludChyYW5nZS5zdGFydCkgPT0gMCAmJiB0aGlzLmNvbXBhcmVQb2ludChyYW5nZS5lbmQpID09IDA7CiAgICB9OwogICAgdGhpcy5pbnRlcnNlY3RzID0gZnVuY3Rpb24ocmFuZ2UpIHsKICAgICAgICB2YXIgY21wID0gdGhpcy5jb21wYXJlUmFuZ2UocmFuZ2UpOwogICAgICAgIHJldHVybiAoY21wID09IC0xIHx8IGNtcCA9PSAwIHx8IGNtcCA9PSAxKTsKICAgIH07CiAgICB0aGlzLmlzRW5kID0gZnVuY3Rpb24ocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4gdGhpcy5lbmQucm93ID09IHJvdyAmJiB0aGlzLmVuZC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuaXNTdGFydCA9IGZ1bmN0aW9uKHJvdywgY29sdW1uKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQucm93ID09IHJvdyAmJiB0aGlzLnN0YXJ0LmNvbHVtbiA9PSBjb2x1bW47CiAgICB9OwogICAgdGhpcy5zZXRTdGFydCA9IGZ1bmN0aW9uKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHR5cGVvZiByb3cgPT0gIm9iamVjdCIpIHsKICAgICAgICAgICAgdGhpcy5zdGFydC5jb2x1bW4gPSByb3cuY29sdW1uOwogICAgICAgICAgICB0aGlzLnN0YXJ0LnJvdyA9IHJvdy5yb3c7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdGhpcy5zdGFydC5yb3cgPSByb3c7CiAgICAgICAgICAgIHRoaXMuc3RhcnQuY29sdW1uID0gY29sdW1uOwogICAgICAgIH0KICAgIH07CiAgICB0aGlzLnNldEVuZCA9IGZ1bmN0aW9uKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHR5cGVvZiByb3cgPT0gIm9iamVjdCIpIHsKICAgICAgICAgICAgdGhpcy5lbmQuY29sdW1uID0gcm93LmNvbHVtbjsKICAgICAgICAgICAgdGhpcy5lbmQucm93ID0gcm93LnJvdzsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLmVuZC5yb3cgPSByb3c7CiAgICAgICAgICAgIHRoaXMuZW5kLmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5pbnNpZGUgPSBmdW5jdGlvbihyb3csIGNvbHVtbikgewogICAgICAgIGlmICh0aGlzLmNvbXBhcmUocm93LCBjb2x1bW4pID09IDApIHsKICAgICAgICAgICAgaWYgKHRoaXMuaXNFbmQocm93LCBjb2x1bW4pIHx8IHRoaXMuaXNTdGFydChyb3csIGNvbHVtbikpIHsKICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBmYWxzZTsKICAgIH07CiAgICB0aGlzLmluc2lkZVN0YXJ0ID0gZnVuY3Rpb24ocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5kKHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlRW5kID0gZnVuY3Rpb24ocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmlzU3RhcnQocm93LCBjb2x1bW4pKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gZmFsc2U7CiAgICB9OwogICAgdGhpcy5jb21wYXJlID0gZnVuY3Rpb24ocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAoIXRoaXMuaXNNdWx0aUxpbmUoKSkgewogICAgICAgICAgICBpZiAocm93ID09PSB0aGlzLnN0YXJ0LnJvdykgewogICAgICAgICAgICAgICAgcmV0dXJuIGNvbHVtbiA8IHRoaXMuc3RhcnQuY29sdW1uID8gLTEgOiAoY29sdW1uID4gdGhpcy5lbmQuY29sdW1uID8gMSA6IDApOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAocm93IDwgdGhpcy5zdGFydC5yb3cpCiAgICAgICAgICAgIHJldHVybiAtMTsKCiAgICAgICAgaWYgKHJvdyA+IHRoaXMuZW5kLnJvdykKICAgICAgICAgICAgcmV0dXJuIDE7CgogICAgICAgIGlmICh0aGlzLnN0YXJ0LnJvdyA9PT0gcm93KQogICAgICAgICAgICByZXR1cm4gY29sdW1uID49IHRoaXMuc3RhcnQuY29sdW1uID8gMCA6IC0xOwoKICAgICAgICBpZiAodGhpcy5lbmQucm93ID09PSByb3cpCiAgICAgICAgICAgIHJldHVybiBjb2x1bW4gPD0gdGhpcy5lbmQuY29sdW1uID8gMCA6IDE7CgogICAgICAgIHJldHVybiAwOwogICAgfTsKICAgIHRoaXMuY29tcGFyZVN0YXJ0ID0gZnVuY3Rpb24ocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5zdGFydC5yb3cgPT0gcm93ICYmIHRoaXMuc3RhcnQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbik7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY29tcGFyZUVuZCA9IGZ1bmN0aW9uKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PSByb3cgJiYgdGhpcy5lbmQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlSW5zaWRlID0gZnVuY3Rpb24ocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5lbmQucm93ID09IHJvdyAmJiB0aGlzLmVuZC5jb2x1bW4gPT0gY29sdW1uKSB7CiAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgIH0gZWxzZSBpZiAodGhpcy5zdGFydC5yb3cgPT0gcm93ICYmIHRoaXMuc3RhcnQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbik7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY2xpcFJvd3MgPSBmdW5jdGlvbihmaXJzdFJvdywgbGFzdFJvdykgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPiBsYXN0Um93KQogICAgICAgICAgICB2YXIgZW5kID0ge3JvdzogbGFzdFJvdyArIDEsIGNvbHVtbjogMH07CiAgICAgICAgZWxzZSBpZiAodGhpcy5lbmQucm93IDwgZmlyc3RSb3cpCiAgICAgICAgICAgIHZhciBlbmQgPSB7cm93OiBmaXJzdFJvdywgY29sdW1uOiAwfTsKCiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID4gbGFzdFJvdykKICAgICAgICAgICAgdmFyIHN0YXJ0ID0ge3JvdzogbGFzdFJvdyArIDEsIGNvbHVtbjogMH07CiAgICAgICAgZWxzZSBpZiAodGhpcy5zdGFydC5yb3cgPCBmaXJzdFJvdykKICAgICAgICAgICAgdmFyIHN0YXJ0ID0ge3JvdzogZmlyc3RSb3csIGNvbHVtbjogMH07CgogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwogICAgdGhpcy5leHRlbmQgPSBmdW5jdGlvbihyb3csIGNvbHVtbikgewogICAgICAgIHZhciBjbXAgPSB0aGlzLmNvbXBhcmUocm93LCBjb2x1bW4pOwoKICAgICAgICBpZiAoY21wID09IDApCiAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKGNtcCA9PSAtMSkKICAgICAgICAgICAgdmFyIHN0YXJ0ID0ge3Jvdzogcm93LCBjb2x1bW46IGNvbHVtbn07CiAgICAgICAgZWxzZQogICAgICAgICAgICB2YXIgZW5kID0ge3Jvdzogcm93LCBjb2x1bW46IGNvbHVtbn07CgogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwoKICAgIHRoaXMuaXNFbXB0eSA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiAodGhpcy5zdGFydC5yb3cgPT09IHRoaXMuZW5kLnJvdyAmJiB0aGlzLnN0YXJ0LmNvbHVtbiA9PT0gdGhpcy5lbmQuY29sdW1uKTsKICAgIH07CiAgICB0aGlzLmlzTXVsdGlMaW5lID0gZnVuY3Rpb24oKSB7CiAgICAgICAgcmV0dXJuICh0aGlzLnN0YXJ0LnJvdyAhPT0gdGhpcy5lbmQucm93KTsKICAgIH07CiAgICB0aGlzLmNsb25lID0gZnVuY3Rpb24oKSB7CiAgICAgICAgcmV0dXJuIFJhbmdlLmZyb21Qb2ludHModGhpcy5zdGFydCwgdGhpcy5lbmQpOwogICAgfTsKICAgIHRoaXMuY29sbGFwc2VSb3dzID0gZnVuY3Rpb24oKSB7CiAgICAgICAgaWYgKHRoaXMuZW5kLmNvbHVtbiA9PSAwKQogICAgICAgICAgICByZXR1cm4gbmV3IFJhbmdlKHRoaXMuc3RhcnQucm93LCAwLCBNYXRoLm1heCh0aGlzLnN0YXJ0LnJvdywgdGhpcy5lbmQucm93LTEpLCAwKTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiBuZXcgUmFuZ2UodGhpcy5zdGFydC5yb3csIDAsIHRoaXMuZW5kLnJvdywgMCk7CiAgICB9OwogICAgdGhpcy50b1NjcmVlblJhbmdlID0gZnVuY3Rpb24oc2Vzc2lvbikgewogICAgICAgIHZhciBzY3JlZW5Qb3NTdGFydCA9IHNlc3Npb24uZG9jdW1lbnRUb1NjcmVlblBvc2l0aW9uKHRoaXMuc3RhcnQpOwogICAgICAgIHZhciBzY3JlZW5Qb3NFbmQgPSBzZXNzaW9uLmRvY3VtZW50VG9TY3JlZW5Qb3NpdGlvbih0aGlzLmVuZCk7CgogICAgICAgIHJldHVybiBuZXcgUmFuZ2UoCiAgICAgICAgICAgIHNjcmVlblBvc1N0YXJ0LnJvdywgc2NyZWVuUG9zU3RhcnQuY29sdW1uLAogICAgICAgICAgICBzY3JlZW5Qb3NFbmQucm93LCBzY3JlZW5Qb3NFbmQuY29sdW1uCiAgICAgICAgKTsKICAgIH07CiAgICB0aGlzLm1vdmVCeSA9IGZ1bmN0aW9uKHJvdywgY29sdW1uKSB7CiAgICAgICAgdGhpcy5zdGFydC5yb3cgKz0gcm93OwogICAgICAgIHRoaXMuc3RhcnQuY29sdW1uICs9IGNvbHVtbjsKICAgICAgICB0aGlzLmVuZC5yb3cgKz0gcm93OwogICAgICAgIHRoaXMuZW5kLmNvbHVtbiArPSBjb2x1bW47CiAgICB9OwoKfSkuY2FsbChSYW5nZS5wcm90b3R5cGUpOwpSYW5nZS5mcm9tUG9pbnRzID0gZnVuY3Rpb24oc3RhcnQsIGVuZCkgewogICAgcmV0dXJuIG5ldyBSYW5nZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbiwgZW5kLnJvdywgZW5kLmNvbHVtbik7Cn07ClJhbmdlLmNvbXBhcmVQb2ludHMgPSBjb21wYXJlUG9pbnRzOwoKUmFuZ2UuY29tcGFyZVBvaW50cyA9IGZ1bmN0aW9uKHAxLCBwMikgewogICAgcmV0dXJuIHAxLnJvdyAtIHAyLnJvdyB8fCBwMS5jb2x1bW4gLSBwMi5jb2x1bW47Cn07CgoKZXhwb3J0cy5SYW5nZSA9IFJhbmdlOwp9KTsKCmFjZS5kZWZpbmUoImFjZS9hcHBseV9kZWx0YSIsW10sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSkgewoidXNlIHN0cmljdCI7CgpmdW5jdGlvbiB0aHJvd0RlbHRhRXJyb3IoZGVsdGEsIGVycm9yVGV4dCl7CiAgICBjb25zb2xlLmxvZygiSW52YWxpZCBEZWx0YToiLCBkZWx0YSk7CiAgICB0aHJvdyAiSW52YWxpZCBEZWx0YTogIiArIGVycm9yVGV4dDsKfQoKZnVuY3Rpb24gcG9zaXRpb25JbkRvY3VtZW50KGRvY0xpbmVzLCBwb3NpdGlvbikgewogICAgcmV0dXJuIHBvc2l0aW9uLnJvdyAgICA+PSAwICYmIHBvc2l0aW9uLnJvdyAgICA8ICBkb2NMaW5lcy5sZW5ndGggJiYKICAgICAgICAgICBwb3NpdGlvbi5jb2x1bW4gPj0gMCAmJiBwb3NpdGlvbi5jb2x1bW4gPD0gZG9jTGluZXNbcG9zaXRpb24ucm93XS5sZW5ndGg7Cn0KCmZ1bmN0aW9uIHZhbGlkYXRlRGVsdGEoZG9jTGluZXMsIGRlbHRhKSB7CiAgICBpZiAoZGVsdGEuYWN0aW9uICE9ICJpbnNlcnQiICYmIGRlbHRhLmFjdGlvbiAhPSAicmVtb3ZlIikKICAgICAgICB0aHJvd0RlbHRhRXJyb3IoZGVsdGEsICJkZWx0YS5hY3Rpb24gbXVzdCBiZSAnaW5zZXJ0JyBvciAncmVtb3ZlJyIpOwogICAgaWYgKCEoZGVsdGEubGluZXMgaW5zdGFuY2VvZiBBcnJheSkpCiAgICAgICAgdGhyb3dEZWx0YUVycm9yKGRlbHRhLCAiZGVsdGEubGluZXMgbXVzdCBiZSBhbiBBcnJheSIpOwogICAgaWYgKCFkZWx0YS5zdGFydCB8fCAhZGVsdGEuZW5kKQogICAgICAgdGhyb3dEZWx0YUVycm9yKGRlbHRhLCAiZGVsdGEuc3RhcnQvZW5kIG11c3QgYmUgYW4gcHJlc2VudCIpOwogICAgdmFyIHN0YXJ0ID0gZGVsdGEuc3RhcnQ7CiAgICBpZiAoIXBvc2l0aW9uSW5Eb2N1bWVudChkb2NMaW5lcywgZGVsdGEuc3RhcnQpKQogICAgICAgIHRocm93RGVsdGFFcnJvcihkZWx0YSwgImRlbHRhLnN0YXJ0IG11c3QgYmUgY29udGFpbmVkIGluIGRvY3VtZW50Iik7CiAgICB2YXIgZW5kID0gZGVsdGEuZW5kOwogICAgaWYgKGRlbHRhLmFjdGlvbiA9PSAicmVtb3ZlIiAmJiAhcG9zaXRpb25JbkRvY3VtZW50KGRvY0xpbmVzLCBlbmQpKQogICAgICAgIHRocm93RGVsdGFFcnJvcihkZWx0YSwgImRlbHRhLmVuZCBtdXN0IGNvbnRhaW5lZCBpbiBkb2N1bWVudCBmb3IgJ3JlbW92ZScgYWN0aW9ucyIpOwogICAgdmFyIG51bVJhbmdlUm93cyA9IGVuZC5yb3cgLSBzdGFydC5yb3c7CiAgICB2YXIgbnVtUmFuZ2VMYXN0TGluZUNoYXJzID0gKGVuZC5jb2x1bW4gLSAobnVtUmFuZ2VSb3dzID09IDAgPyBzdGFydC5jb2x1bW4gOiAwKSk7CiAgICBpZiAobnVtUmFuZ2VSb3dzICE9IGRlbHRhLmxpbmVzLmxlbmd0aCAtIDEgfHwgZGVsdGEubGluZXNbbnVtUmFuZ2VSb3dzXS5sZW5ndGggIT0gbnVtUmFuZ2VMYXN0TGluZUNoYXJzKQogICAgICAgIHRocm93RGVsdGFFcnJvcihkZWx0YSwgImRlbHRhLnJhbmdlIG11c3QgbWF0Y2ggZGVsdGEgbGluZXMiKTsKfQoKZXhwb3J0cy5hcHBseURlbHRhID0gZnVuY3Rpb24oZG9jTGluZXMsIGRlbHRhLCBkb05vdFZhbGlkYXRlKSB7CiAgICAKICAgIHZhciByb3cgPSBkZWx0YS5zdGFydC5yb3c7CiAgICB2YXIgc3RhcnRDb2x1bW4gPSBkZWx0YS5zdGFydC5jb2x1bW47CiAgICB2YXIgbGluZSA9IGRvY0xpbmVzW3Jvd10gfHwgIiI7CiAgICBzd2l0Y2ggKGRlbHRhLmFjdGlvbikgewogICAgICAgIGNhc2UgImluc2VydCI6CiAgICAgICAgICAgIHZhciBsaW5lcyA9IGRlbHRhLmxpbmVzOwogICAgICAgICAgICBpZiAobGluZXMubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3ddID0gbGluZS5zdWJzdHJpbmcoMCwgc3RhcnRDb2x1bW4pICsgZGVsdGEubGluZXNbMF0gKyBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB2YXIgYXJncyA9IFtyb3csIDFdLmNvbmNhdChkZWx0YS5saW5lcyk7CiAgICAgICAgICAgICAgICBkb2NMaW5lcy5zcGxpY2UuYXBwbHkoZG9jTGluZXMsIGFyZ3MpOwogICAgICAgICAgICAgICAgZG9jTGluZXNbcm93XSA9IGxpbmUuc3Vic3RyaW5nKDAsIHN0YXJ0Q29sdW1uKSArIGRvY0xpbmVzW3Jvd107CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3cgKyBkZWx0YS5saW5lcy5sZW5ndGggLSAxXSArPSBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSAicmVtb3ZlIjoKICAgICAgICAgICAgdmFyIGVuZENvbHVtbiA9IGRlbHRhLmVuZC5jb2x1bW47CiAgICAgICAgICAgIHZhciBlbmRSb3cgPSBkZWx0YS5lbmQucm93OwogICAgICAgICAgICBpZiAocm93ID09PSBlbmRSb3cpIHsKICAgICAgICAgICAgICAgIGRvY0xpbmVzW3Jvd10gPSBsaW5lLnN1YnN0cmluZygwLCBzdGFydENvbHVtbikgKyBsaW5lLnN1YnN0cmluZyhlbmRDb2x1bW4pOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZG9jTGluZXMuc3BsaWNlKAogICAgICAgICAgICAgICAgICAgIHJvdywgZW5kUm93IC0gcm93ICsgMSwKICAgICAgICAgICAgICAgICAgICBsaW5lLnN1YnN0cmluZygwLCBzdGFydENvbHVtbikgKyBkb2NMaW5lc1tlbmRSb3ddLnN1YnN0cmluZyhlbmRDb2x1bW4pCiAgICAgICAgICAgICAgICApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGJyZWFrOwogICAgfQp9Owp9KTsKCmFjZS5kZWZpbmUoImFjZS9saWIvZXZlbnRfZW1pdHRlciIsW10sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSkgewoidXNlIHN0cmljdCI7Cgp2YXIgRXZlbnRFbWl0dGVyID0ge307CnZhciBzdG9wUHJvcGFnYXRpb24gPSBmdW5jdGlvbigpIHsgdGhpcy5wcm9wYWdhdGlvblN0b3BwZWQgPSB0cnVlOyB9Owp2YXIgcHJldmVudERlZmF1bHQgPSBmdW5jdGlvbigpIHsgdGhpcy5kZWZhdWx0UHJldmVudGVkID0gdHJ1ZTsgfTsKCkV2ZW50RW1pdHRlci5fZW1pdCA9CkV2ZW50RW1pdHRlci5fZGlzcGF0Y2hFdmVudCA9IGZ1bmN0aW9uKGV2ZW50TmFtZSwgZSkgewogICAgdGhpcy5fZXZlbnRSZWdpc3RyeSB8fCAodGhpcy5fZXZlbnRSZWdpc3RyeSA9IHt9KTsKICAgIHRoaXMuX2RlZmF1bHRIYW5kbGVycyB8fCAodGhpcy5fZGVmYXVsdEhhbmRsZXJzID0ge30pOwoKICAgIHZhciBsaXN0ZW5lcnMgPSB0aGlzLl9ldmVudFJlZ2lzdHJ5W2V2ZW50TmFtZV0gfHwgW107CiAgICB2YXIgZGVmYXVsdEhhbmRsZXIgPSB0aGlzLl9kZWZhdWx0SGFuZGxlcnNbZXZlbnROYW1lXTsKICAgIGlmICghbGlzdGVuZXJzLmxlbmd0aCAmJiAhZGVmYXVsdEhhbmRsZXIpCiAgICAgICAgcmV0dXJuOwoKICAgIGlmICh0eXBlb2YgZSAhPSAib2JqZWN0IiB8fCAhZSkKICAgICAgICBlID0ge307CgogICAgaWYgKCFlLnR5cGUpCiAgICAgICAgZS50eXBlID0gZXZlbnROYW1lOwogICAgaWYgKCFlLnN0b3BQcm9wYWdhdGlvbikKICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbiA9IHN0b3BQcm9wYWdhdGlvbjsKICAgIGlmICghZS5wcmV2ZW50RGVmYXVsdCkKICAgICAgICBlLnByZXZlbnREZWZhdWx0ID0gcHJldmVudERlZmF1bHQ7CgogICAgbGlzdGVuZXJzID0gbGlzdGVuZXJzLnNsaWNlKCk7CiAgICBmb3IgKHZhciBpPTA7IGk8bGlzdGVuZXJzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgbGlzdGVuZXJzW2ldKGUsIHRoaXMpOwogICAgICAgIGlmIChlLnByb3BhZ2F0aW9uU3RvcHBlZCkKICAgICAgICAgICAgYnJlYWs7CiAgICB9CiAgICAKICAgIGlmIChkZWZhdWx0SGFuZGxlciAmJiAhZS5kZWZhdWx0UHJldmVudGVkKQogICAgICAgIHJldHVybiBkZWZhdWx0SGFuZGxlcihlLCB0aGlzKTsKfTsKCgpFdmVudEVtaXR0ZXIuX3NpZ25hbCA9IGZ1bmN0aW9uKGV2ZW50TmFtZSwgZSkgewogICAgdmFyIGxpc3RlbmVycyA9ICh0aGlzLl9ldmVudFJlZ2lzdHJ5IHx8IHt9KVtldmVudE5hbWVdOwogICAgaWYgKCFsaXN0ZW5lcnMpCiAgICAgICAgcmV0dXJuOwogICAgbGlzdGVuZXJzID0gbGlzdGVuZXJzLnNsaWNlKCk7CiAgICBmb3IgKHZhciBpPTA7IGk8bGlzdGVuZXJzLmxlbmd0aDsgaSsrKQogICAgICAgIGxpc3RlbmVyc1tpXShlLCB0aGlzKTsKfTsKCkV2ZW50RW1pdHRlci5vbmNlID0gZnVuY3Rpb24oZXZlbnROYW1lLCBjYWxsYmFjaykgewogICAgdmFyIF9zZWxmID0gdGhpczsKICAgIHRoaXMub24oZXZlbnROYW1lLCBmdW5jdGlvbiBuZXdDYWxsYmFjaygpIHsKICAgICAgICBfc2VsZi5vZmYoZXZlbnROYW1lLCBuZXdDYWxsYmFjayk7CiAgICAgICAgY2FsbGJhY2suYXBwbHkobnVsbCwgYXJndW1lbnRzKTsKICAgIH0pOwogICAgaWYgKCFjYWxsYmFjaykgewogICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbihyZXNvbHZlKSB7CiAgICAgICAgICAgIGNhbGxiYWNrID0gcmVzb2x2ZTsKICAgICAgICB9KTsKICAgIH0KfTsKCgpFdmVudEVtaXR0ZXIuc2V0RGVmYXVsdEhhbmRsZXIgPSBmdW5jdGlvbihldmVudE5hbWUsIGNhbGxiYWNrKSB7CiAgICB2YXIgaGFuZGxlcnMgPSB0aGlzLl9kZWZhdWx0SGFuZGxlcnM7CiAgICBpZiAoIWhhbmRsZXJzKQogICAgICAgIGhhbmRsZXJzID0gdGhpcy5fZGVmYXVsdEhhbmRsZXJzID0ge19kaXNhYmxlZF86IHt9fTsKICAgIAogICAgaWYgKGhhbmRsZXJzW2V2ZW50TmFtZV0pIHsKICAgICAgICB2YXIgb2xkID0gaGFuZGxlcnNbZXZlbnROYW1lXTsKICAgICAgICB2YXIgZGlzYWJsZWQgPSBoYW5kbGVycy5fZGlzYWJsZWRfW2V2ZW50TmFtZV07CiAgICAgICAgaWYgKCFkaXNhYmxlZCkKICAgICAgICAgICAgaGFuZGxlcnMuX2Rpc2FibGVkX1tldmVudE5hbWVdID0gZGlzYWJsZWQgPSBbXTsKICAgICAgICBkaXNhYmxlZC5wdXNoKG9sZCk7CiAgICAgICAgdmFyIGkgPSBkaXNhYmxlZC5pbmRleE9mKGNhbGxiYWNrKTsKICAgICAgICBpZiAoaSAhPSAtMSkgCiAgICAgICAgICAgIGRpc2FibGVkLnNwbGljZShpLCAxKTsKICAgIH0KICAgIGhhbmRsZXJzW2V2ZW50TmFtZV0gPSBjYWxsYmFjazsKfTsKRXZlbnRFbWl0dGVyLnJlbW92ZURlZmF1bHRIYW5kbGVyID0gZnVuY3Rpb24oZXZlbnROYW1lLCBjYWxsYmFjaykgewogICAgdmFyIGhhbmRsZXJzID0gdGhpcy5fZGVmYXVsdEhhbmRsZXJzOwogICAgaWYgKCFoYW5kbGVycykKICAgICAgICByZXR1cm47CiAgICB2YXIgZGlzYWJsZWQgPSBoYW5kbGVycy5fZGlzYWJsZWRfW2V2ZW50TmFtZV07CiAgICAKICAgIGlmIChoYW5kbGVyc1tldmVudE5hbWVdID09IGNhbGxiYWNrKSB7CiAgICAgICAgaWYgKGRpc2FibGVkKQogICAgICAgICAgICB0aGlzLnNldERlZmF1bHRIYW5kbGVyKGV2ZW50TmFtZSwgZGlzYWJsZWQucG9wKCkpOwogICAgfSBlbHNlIGlmIChkaXNhYmxlZCkgewogICAgICAgIHZhciBpID0gZGlzYWJsZWQuaW5kZXhPZihjYWxsYmFjayk7CiAgICAgICAgaWYgKGkgIT0gLTEpCiAgICAgICAgICAgIGRpc2FibGVkLnNwbGljZShpLCAxKTsKICAgIH0KfTsKCkV2ZW50RW1pdHRlci5vbiA9CkV2ZW50RW1pdHRlci5hZGRFdmVudExpc3RlbmVyID0gZnVuY3Rpb24oZXZlbnROYW1lLCBjYWxsYmFjaywgY2FwdHVyaW5nKSB7CiAgICB0aGlzLl9ldmVudFJlZ2lzdHJ5ID0gdGhpcy5fZXZlbnRSZWdpc3RyeSB8fCB7fTsKCiAgICB2YXIgbGlzdGVuZXJzID0gdGhpcy5fZXZlbnRSZWdpc3RyeVtldmVudE5hbWVdOwogICAgaWYgKCFsaXN0ZW5lcnMpCiAgICAgICAgbGlzdGVuZXJzID0gdGhpcy5fZXZlbnRSZWdpc3RyeVtldmVudE5hbWVdID0gW107CgogICAgaWYgKGxpc3RlbmVycy5pbmRleE9mKGNhbGxiYWNrKSA9PSAtMSkKICAgICAgICBsaXN0ZW5lcnNbY2FwdHVyaW5nID8gInVuc2hpZnQiIDogInB1c2giXShjYWxsYmFjayk7CiAgICByZXR1cm4gY2FsbGJhY2s7Cn07CgpFdmVudEVtaXR0ZXIub2ZmID0KRXZlbnRFbWl0dGVyLnJlbW92ZUxpc3RlbmVyID0KRXZlbnRFbWl0dGVyLnJlbW92ZUV2ZW50TGlzdGVuZXIgPSBmdW5jdGlvbihldmVudE5hbWUsIGNhbGxiYWNrKSB7CiAgICB0aGlzLl9ldmVudFJlZ2lzdHJ5ID0gdGhpcy5fZXZlbnRSZWdpc3RyeSB8fCB7fTsKCiAgICB2YXIgbGlzdGVuZXJzID0gdGhpcy5fZXZlbnRSZWdpc3RyeVtldmVudE5hbWVdOwogICAgaWYgKCFsaXN0ZW5lcnMpCiAgICAgICAgcmV0dXJuOwoKICAgIHZhciBpbmRleCA9IGxpc3RlbmVycy5pbmRleE9mKGNhbGxiYWNrKTsKICAgIGlmIChpbmRleCAhPT0gLTEpCiAgICAgICAgbGlzdGVuZXJzLnNwbGljZShpbmRleCwgMSk7Cn07CgpFdmVudEVtaXR0ZXIucmVtb3ZlQWxsTGlzdGVuZXJzID0gZnVuY3Rpb24oZXZlbnROYW1lKSB7CiAgICBpZiAoIWV2ZW50TmFtZSkgdGhpcy5fZXZlbnRSZWdpc3RyeSA9IHRoaXMuX2RlZmF1bHRIYW5kbGVycyA9IHVuZGVmaW5lZDsKICAgIGlmICh0aGlzLl9ldmVudFJlZ2lzdHJ5KSB0aGlzLl9ldmVudFJlZ2lzdHJ5W2V2ZW50TmFtZV0gPSB1bmRlZmluZWQ7CiAgICBpZiAodGhpcy5fZGVmYXVsdEhhbmRsZXJzKSB0aGlzLl9kZWZhdWx0SGFuZGxlcnNbZXZlbnROYW1lXSA9IHVuZGVmaW5lZDsKfTsKCmV4cG9ydHMuRXZlbnRFbWl0dGVyID0gRXZlbnRFbWl0dGVyOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvYW5jaG9yIixbXSwgZnVuY3Rpb24ocmVxdWlyZSwgZXhwb3J0cywgbW9kdWxlKSB7CiJ1c2Ugc3RyaWN0IjsKCnZhciBvb3AgPSByZXF1aXJlKCIuL2xpYi9vb3AiKTsKdmFyIEV2ZW50RW1pdHRlciA9IHJlcXVpcmUoIi4vbGliL2V2ZW50X2VtaXR0ZXIiKS5FdmVudEVtaXR0ZXI7Cgp2YXIgQW5jaG9yID0gZXhwb3J0cy5BbmNob3IgPSBmdW5jdGlvbihkb2MsIHJvdywgY29sdW1uKSB7CiAgICB0aGlzLiRvbkNoYW5nZSA9IHRoaXMub25DaGFuZ2UuYmluZCh0aGlzKTsKICAgIHRoaXMuYXR0YWNoKGRvYyk7CiAgICAKICAgIGlmICh0eXBlb2YgY29sdW1uID09ICJ1bmRlZmluZWQiKQogICAgICAgIHRoaXMuc2V0UG9zaXRpb24ocm93LnJvdywgcm93LmNvbHVtbik7CiAgICBlbHNlCiAgICAgICAgdGhpcy5zZXRQb3NpdGlvbihyb3csIGNvbHVtbik7Cn07CgooZnVuY3Rpb24oKSB7CgogICAgb29wLmltcGxlbWVudCh0aGlzLCBFdmVudEVtaXR0ZXIpOwogICAgdGhpcy5nZXRQb3NpdGlvbiA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLiRjbGlwUG9zaXRpb25Ub0RvY3VtZW50KHRoaXMucm93LCB0aGlzLmNvbHVtbik7CiAgICB9OwogICAgdGhpcy5nZXREb2N1bWVudCA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLmRvY3VtZW50OwogICAgfTsKICAgIHRoaXMuJGluc2VydFJpZ2h0ID0gZmFsc2U7CiAgICB0aGlzLm9uQ2hhbmdlID0gZnVuY3Rpb24oZGVsdGEpIHsKICAgICAgICBpZiAoZGVsdGEuc3RhcnQucm93ID09IGRlbHRhLmVuZC5yb3cgJiYgZGVsdGEuc3RhcnQucm93ICE9IHRoaXMucm93KQogICAgICAgICAgICByZXR1cm47CgogICAgICAgIGlmIChkZWx0YS5zdGFydC5yb3cgPiB0aGlzLnJvdykKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAKICAgICAgICB2YXIgcG9pbnQgPSAkZ2V0VHJhbnNmb3JtZWRQb2ludChkZWx0YSwge3JvdzogdGhpcy5yb3csIGNvbHVtbjogdGhpcy5jb2x1bW59LCB0aGlzLiRpbnNlcnRSaWdodCk7CiAgICAgICAgdGhpcy5zZXRQb3NpdGlvbihwb2ludC5yb3csIHBvaW50LmNvbHVtbiwgdHJ1ZSk7CiAgICB9OwogICAgCiAgICBmdW5jdGlvbiAkcG9pbnRzSW5PcmRlcihwb2ludDEsIHBvaW50MiwgZXF1YWxQb2ludHNJbk9yZGVyKSB7CiAgICAgICAgdmFyIGJDb2xJc0FmdGVyID0gZXF1YWxQb2ludHNJbk9yZGVyID8gcG9pbnQxLmNvbHVtbiA8PSBwb2ludDIuY29sdW1uIDogcG9pbnQxLmNvbHVtbiA8IHBvaW50Mi5jb2x1bW47CiAgICAgICAgcmV0dXJuIChwb2ludDEucm93IDwgcG9pbnQyLnJvdykgfHwgKHBvaW50MS5yb3cgPT0gcG9pbnQyLnJvdyAmJiBiQ29sSXNBZnRlcik7CiAgICB9CiAgICAgICAgICAgIAogICAgZnVuY3Rpb24gJGdldFRyYW5zZm9ybWVkUG9pbnQoZGVsdGEsIHBvaW50LCBtb3ZlSWZFcXVhbCkgewogICAgICAgIHZhciBkZWx0YUlzSW5zZXJ0ID0gZGVsdGEuYWN0aW9uID09ICJpbnNlcnQiOwogICAgICAgIHZhciBkZWx0YVJvd1NoaWZ0ID0gKGRlbHRhSXNJbnNlcnQgPyAxIDogLTEpICogKGRlbHRhLmVuZC5yb3cgICAgLSBkZWx0YS5zdGFydC5yb3cpOwogICAgICAgIHZhciBkZWx0YUNvbFNoaWZ0ID0gKGRlbHRhSXNJbnNlcnQgPyAxIDogLTEpICogKGRlbHRhLmVuZC5jb2x1bW4gLSBkZWx0YS5zdGFydC5jb2x1bW4pOwogICAgICAgIHZhciBkZWx0YVN0YXJ0ID0gZGVsdGEuc3RhcnQ7CiAgICAgICAgdmFyIGRlbHRhRW5kID0gZGVsdGFJc0luc2VydCA/IGRlbHRhU3RhcnQgOiBkZWx0YS5lbmQ7IC8vIENvbGxhcHNlIGluc2VydCByYW5nZS4KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIocG9pbnQsIGRlbHRhU3RhcnQsIG1vdmVJZkVxdWFsKSkgewogICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgcm93OiBwb2ludC5yb3csCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbgogICAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIoZGVsdGFFbmQsIHBvaW50LCAhbW92ZUlmRXF1YWwpKSB7CiAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICByb3c6IHBvaW50LnJvdyArIGRlbHRhUm93U2hpZnQsCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbiArIChwb2ludC5yb3cgPT0gZGVsdGFFbmQucm93ID8gZGVsdGFDb2xTaGlmdCA6IDApCiAgICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIAogICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIHJvdzogZGVsdGFTdGFydC5yb3csCiAgICAgICAgICAgIGNvbHVtbjogZGVsdGFTdGFydC5jb2x1bW4KICAgICAgICB9OwogICAgfQogICAgdGhpcy5zZXRQb3NpdGlvbiA9IGZ1bmN0aW9uKHJvdywgY29sdW1uLCBub0NsaXApIHsKICAgICAgICB2YXIgcG9zOwogICAgICAgIGlmIChub0NsaXApIHsKICAgICAgICAgICAgcG9zID0gewogICAgICAgICAgICAgICAgcm93OiByb3csCiAgICAgICAgICAgICAgICBjb2x1bW46IGNvbHVtbgogICAgICAgICAgICB9OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHBvcyA9IHRoaXMuJGNsaXBQb3NpdGlvblRvRG9jdW1lbnQocm93LCBjb2x1bW4pOwogICAgICAgIH0KCiAgICAgICAgaWYgKHRoaXMucm93ID09IHBvcy5yb3cgJiYgdGhpcy5jb2x1bW4gPT0gcG9zLmNvbHVtbikKICAgICAgICAgICAgcmV0dXJuOwoKICAgICAgICB2YXIgb2xkID0gewogICAgICAgICAgICByb3c6IHRoaXMucm93LAogICAgICAgICAgICBjb2x1bW46IHRoaXMuY29sdW1uCiAgICAgICAgfTsKCiAgICAgICAgdGhpcy5yb3cgPSBwb3Mucm93OwogICAgICAgIHRoaXMuY29sdW1uID0gcG9zLmNvbHVtbjsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZSIsIHsKICAgICAgICAgICAgb2xkOiBvbGQsCiAgICAgICAgICAgIHZhbHVlOiBwb3MKICAgICAgICB9KTsKICAgIH07CiAgICB0aGlzLmRldGFjaCA9IGZ1bmN0aW9uKCkgewogICAgICAgIHRoaXMuZG9jdW1lbnQub2ZmKCJjaGFuZ2UiLCB0aGlzLiRvbkNoYW5nZSk7CiAgICB9OwogICAgdGhpcy5hdHRhY2ggPSBmdW5jdGlvbihkb2MpIHsKICAgICAgICB0aGlzLmRvY3VtZW50ID0gZG9jIHx8IHRoaXMuZG9jdW1lbnQ7CiAgICAgICAgdGhpcy5kb2N1bWVudC5vbigiY2hhbmdlIiwgdGhpcy4kb25DaGFuZ2UpOwogICAgfTsKICAgIHRoaXMuJGNsaXBQb3NpdGlvblRvRG9jdW1lbnQgPSBmdW5jdGlvbihyb3csIGNvbHVtbikgewogICAgICAgIHZhciBwb3MgPSB7fTsKCiAgICAgICAgaWYgKHJvdyA+PSB0aGlzLmRvY3VtZW50LmdldExlbmd0aCgpKSB7CiAgICAgICAgICAgIHBvcy5yb3cgPSBNYXRoLm1heCgwLCB0aGlzLmRvY3VtZW50LmdldExlbmd0aCgpIC0gMSk7CiAgICAgICAgICAgIHBvcy5jb2x1bW4gPSB0aGlzLmRvY3VtZW50LmdldExpbmUocG9zLnJvdykubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChyb3cgPCAwKSB7CiAgICAgICAgICAgIHBvcy5yb3cgPSAwOwogICAgICAgICAgICBwb3MuY29sdW1uID0gMDsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvcy5yb3cgPSByb3c7CiAgICAgICAgICAgIHBvcy5jb2x1bW4gPSBNYXRoLm1pbih0aGlzLmRvY3VtZW50LmdldExpbmUocG9zLnJvdykubGVuZ3RoLCBNYXRoLm1heCgwLCBjb2x1bW4pKTsKICAgICAgICB9CgogICAgICAgIGlmIChjb2x1bW4gPCAwKQogICAgICAgICAgICBwb3MuY29sdW1uID0gMDsKCiAgICAgICAgcmV0dXJuIHBvczsKICAgIH07Cgp9KS5jYWxsKEFuY2hvci5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvZG9jdW1lbnQiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKdmFyIG9vcCA9IHJlcXVpcmUoIi4vbGliL29vcCIpOwp2YXIgYXBwbHlEZWx0YSA9IHJlcXVpcmUoIi4vYXBwbHlfZGVsdGEiKS5hcHBseURlbHRhOwp2YXIgRXZlbnRFbWl0dGVyID0gcmVxdWlyZSgiLi9saWIvZXZlbnRfZW1pdHRlciIpLkV2ZW50RW1pdHRlcjsKdmFyIFJhbmdlID0gcmVxdWlyZSgiLi9yYW5nZSIpLlJhbmdlOwp2YXIgQW5jaG9yID0gcmVxdWlyZSgiLi9hbmNob3IiKS5BbmNob3I7Cgp2YXIgRG9jdW1lbnQgPSBmdW5jdGlvbih0ZXh0T3JMaW5lcykgewogICAgdGhpcy4kbGluZXMgPSBbIiJdOwogICAgaWYgKHRleHRPckxpbmVzLmxlbmd0aCA9PT0gMCkgewogICAgICAgIHRoaXMuJGxpbmVzID0gWyIiXTsKICAgIH0gZWxzZSBpZiAoQXJyYXkuaXNBcnJheSh0ZXh0T3JMaW5lcykpIHsKICAgICAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzKHtyb3c6IDAsIGNvbHVtbjogMH0sIHRleHRPckxpbmVzKTsKICAgIH0gZWxzZSB7CiAgICAgICAgdGhpcy5pbnNlcnQoe3JvdzogMCwgY29sdW1uOjB9LCB0ZXh0T3JMaW5lcyk7CiAgICB9Cn07CgooZnVuY3Rpb24oKSB7CgogICAgb29wLmltcGxlbWVudCh0aGlzLCBFdmVudEVtaXR0ZXIpOwogICAgdGhpcy5zZXRWYWx1ZSA9IGZ1bmN0aW9uKHRleHQpIHsKICAgICAgICB2YXIgbGVuID0gdGhpcy5nZXRMZW5ndGgoKSAtIDE7CiAgICAgICAgdGhpcy5yZW1vdmUobmV3IFJhbmdlKDAsIDAsIGxlbiwgdGhpcy5nZXRMaW5lKGxlbikubGVuZ3RoKSk7CiAgICAgICAgdGhpcy5pbnNlcnQoe3JvdzogMCwgY29sdW1uOiAwfSwgdGV4dCk7CiAgICB9OwogICAgdGhpcy5nZXRWYWx1ZSA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLmdldEFsbExpbmVzKCkuam9pbih0aGlzLmdldE5ld0xpbmVDaGFyYWN0ZXIoKSk7CiAgICB9OwogICAgdGhpcy5jcmVhdGVBbmNob3IgPSBmdW5jdGlvbihyb3csIGNvbHVtbikgewogICAgICAgIHJldHVybiBuZXcgQW5jaG9yKHRoaXMsIHJvdywgY29sdW1uKTsKICAgIH07CiAgICBpZiAoImFhYSIuc3BsaXQoL2EvKS5sZW5ndGggPT09IDApIHsKICAgICAgICB0aGlzLiRzcGxpdCA9IGZ1bmN0aW9uKHRleHQpIHsKICAgICAgICAgICAgcmV0dXJuIHRleHQucmVwbGFjZSgvXHJcbnxcci9nLCAiXG4iKS5zcGxpdCgiXG4iKTsKICAgICAgICB9OwogICAgfSBlbHNlIHsKICAgICAgICB0aGlzLiRzcGxpdCA9IGZ1bmN0aW9uKHRleHQpIHsKICAgICAgICAgICAgcmV0dXJuIHRleHQuc3BsaXQoL1xyXG58XHJ8XG4vKTsKICAgICAgICB9OwogICAgfQoKCiAgICB0aGlzLiRkZXRlY3ROZXdMaW5lID0gZnVuY3Rpb24odGV4dCkgewogICAgICAgIHZhciBtYXRjaCA9IHRleHQubWF0Y2goL14uKj8oXHJcbnxccnxcbikvbSk7CiAgICAgICAgdGhpcy4kYXV0b05ld0xpbmUgPSBtYXRjaCA/IG1hdGNoWzFdIDogIlxuIjsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lQ2hhcmFjdGVyID0gZnVuY3Rpb24oKSB7CiAgICAgICAgc3dpdGNoICh0aGlzLiRuZXdMaW5lTW9kZSkgewogICAgICAgICAgY2FzZSAid2luZG93cyI6CiAgICAgICAgICAgIHJldHVybiAiXHJcbiI7CiAgICAgICAgICBjYXNlICJ1bml4IjoKICAgICAgICAgICAgcmV0dXJuICJcbiI7CiAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICByZXR1cm4gdGhpcy4kYXV0b05ld0xpbmUgfHwgIlxuIjsKICAgICAgICB9CiAgICB9OwoKICAgIHRoaXMuJGF1dG9OZXdMaW5lID0gIiI7CiAgICB0aGlzLiRuZXdMaW5lTW9kZSA9ICJhdXRvIjsKICAgIHRoaXMuc2V0TmV3TGluZU1vZGUgPSBmdW5jdGlvbihuZXdMaW5lTW9kZSkgewogICAgICAgIGlmICh0aGlzLiRuZXdMaW5lTW9kZSA9PT0gbmV3TGluZU1vZGUpCiAgICAgICAgICAgIHJldHVybjsKCiAgICAgICAgdGhpcy4kbmV3TGluZU1vZGUgPSBuZXdMaW5lTW9kZTsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lTW9kZSA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLiRuZXdMaW5lTW9kZTsKICAgIH07CiAgICB0aGlzLmlzTmV3TGluZSA9IGZ1bmN0aW9uKHRleHQpIHsKICAgICAgICByZXR1cm4gKHRleHQgPT0gIlxyXG4iIHx8IHRleHQgPT0gIlxyIiB8fCB0ZXh0ID09ICJcbiIpOwogICAgfTsKICAgIHRoaXMuZ2V0TGluZSA9IGZ1bmN0aW9uKHJvdykgewogICAgICAgIHJldHVybiB0aGlzLiRsaW5lc1tyb3ddIHx8ICIiOwogICAgfTsKICAgIHRoaXMuZ2V0TGluZXMgPSBmdW5jdGlvbihmaXJzdFJvdywgbGFzdFJvdykgewogICAgICAgIHJldHVybiB0aGlzLiRsaW5lcy5zbGljZShmaXJzdFJvdywgbGFzdFJvdyArIDEpOwogICAgfTsKICAgIHRoaXMuZ2V0QWxsTGluZXMgPSBmdW5jdGlvbigpIHsKICAgICAgICByZXR1cm4gdGhpcy5nZXRMaW5lcygwLCB0aGlzLmdldExlbmd0aCgpKTsKICAgIH07CiAgICB0aGlzLmdldExlbmd0aCA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLiRsaW5lcy5sZW5ndGg7CiAgICB9OwogICAgdGhpcy5nZXRUZXh0UmFuZ2UgPSBmdW5jdGlvbihyYW5nZSkgewogICAgICAgIHJldHVybiB0aGlzLmdldExpbmVzRm9yUmFuZ2UocmFuZ2UpLmpvaW4odGhpcy5nZXROZXdMaW5lQ2hhcmFjdGVyKCkpOwogICAgfTsKICAgIHRoaXMuZ2V0TGluZXNGb3JSYW5nZSA9IGZ1bmN0aW9uKHJhbmdlKSB7CiAgICAgICAgdmFyIGxpbmVzOwogICAgICAgIGlmIChyYW5nZS5zdGFydC5yb3cgPT09IHJhbmdlLmVuZC5yb3cpIHsKICAgICAgICAgICAgbGluZXMgPSBbdGhpcy5nZXRMaW5lKHJhbmdlLnN0YXJ0LnJvdykuc3Vic3RyaW5nKHJhbmdlLnN0YXJ0LmNvbHVtbiwgcmFuZ2UuZW5kLmNvbHVtbildOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGxpbmVzID0gdGhpcy5nZXRMaW5lcyhyYW5nZS5zdGFydC5yb3csIHJhbmdlLmVuZC5yb3cpOwogICAgICAgICAgICBsaW5lc1swXSA9IChsaW5lc1swXSB8fCAiIikuc3Vic3RyaW5nKHJhbmdlLnN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIHZhciBsID0gbGluZXMubGVuZ3RoIC0gMTsKICAgICAgICAgICAgaWYgKHJhbmdlLmVuZC5yb3cgLSByYW5nZS5zdGFydC5yb3cgPT0gbCkKICAgICAgICAgICAgICAgIGxpbmVzW2xdID0gbGluZXNbbF0uc3Vic3RyaW5nKDAsIHJhbmdlLmVuZC5jb2x1bW4pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gbGluZXM7CiAgICB9OwogICAgdGhpcy5pbnNlcnRMaW5lcyA9IGZ1bmN0aW9uKHJvdywgbGluZXMpIHsKICAgICAgICBjb25zb2xlLndhcm4oIlVzZSBvZiBkb2N1bWVudC5pbnNlcnRMaW5lcyBpcyBkZXByZWNhdGVkLiBVc2UgdGhlIGluc2VydEZ1bGxMaW5lcyBtZXRob2QgaW5zdGVhZC4iKTsKICAgICAgICByZXR1cm4gdGhpcy5pbnNlcnRGdWxsTGluZXMocm93LCBsaW5lcyk7CiAgICB9OwogICAgdGhpcy5yZW1vdmVMaW5lcyA9IGZ1bmN0aW9uKGZpcnN0Um93LCBsYXN0Um93KSB7CiAgICAgICAgY29uc29sZS53YXJuKCJVc2Ugb2YgZG9jdW1lbnQucmVtb3ZlTGluZXMgaXMgZGVwcmVjYXRlZC4gVXNlIHRoZSByZW1vdmVGdWxsTGluZXMgbWV0aG9kIGluc3RlYWQuIik7CiAgICAgICAgcmV0dXJuIHRoaXMucmVtb3ZlRnVsbExpbmVzKGZpcnN0Um93LCBsYXN0Um93KTsKICAgIH07CiAgICB0aGlzLmluc2VydE5ld0xpbmUgPSBmdW5jdGlvbihwb3NpdGlvbikgewogICAgICAgIGNvbnNvbGUud2FybigiVXNlIG9mIGRvY3VtZW50Lmluc2VydE5ld0xpbmUgaXMgZGVwcmVjYXRlZC4gVXNlIGluc2VydE1lcmdlZExpbmVzKHBvc2l0aW9uLCBbJycsICcnXSkgaW5zdGVhZC4iKTsKICAgICAgICByZXR1cm4gdGhpcy5pbnNlcnRNZXJnZWRMaW5lcyhwb3NpdGlvbiwgWyIiLCAiIl0pOwogICAgfTsKICAgIHRoaXMuaW5zZXJ0ID0gZnVuY3Rpb24ocG9zaXRpb24sIHRleHQpIHsKICAgICAgICBpZiAodGhpcy5nZXRMZW5ndGgoKSA8PSAxKQogICAgICAgICAgICB0aGlzLiRkZXRlY3ROZXdMaW5lKHRleHQpOwogICAgICAgIAogICAgICAgIHJldHVybiB0aGlzLmluc2VydE1lcmdlZExpbmVzKHBvc2l0aW9uLCB0aGlzLiRzcGxpdCh0ZXh0KSk7CiAgICB9OwogICAgdGhpcy5pbnNlcnRJbkxpbmUgPSBmdW5jdGlvbihwb3NpdGlvbiwgdGV4dCkgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHRoaXMucG9zKHBvc2l0aW9uLnJvdywgcG9zaXRpb24uY29sdW1uICsgdGV4dC5sZW5ndGgpOwogICAgICAgIAogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogImluc2VydCIsCiAgICAgICAgICAgIGxpbmVzOiBbdGV4dF0KICAgICAgICB9LCB0cnVlKTsKICAgICAgICAKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIAogICAgdGhpcy5jbGlwcGVkUG9zID0gZnVuY3Rpb24ocm93LCBjb2x1bW4pIHsKICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5nZXRMZW5ndGgoKTsKICAgICAgICBpZiAocm93ID09PSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgcm93ID0gbGVuZ3RoOwogICAgICAgIH0gZWxzZSBpZiAocm93IDwgMCkgewogICAgICAgICAgICByb3cgPSAwOwogICAgICAgIH0gZWxzZSBpZiAocm93ID49IGxlbmd0aCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGggLSAxOwogICAgICAgICAgICBjb2x1bW4gPSB1bmRlZmluZWQ7CiAgICAgICAgfQogICAgICAgIHZhciBsaW5lID0gdGhpcy5nZXRMaW5lKHJvdyk7CiAgICAgICAgaWYgKGNvbHVtbiA9PSB1bmRlZmluZWQpCiAgICAgICAgICAgIGNvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIGNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KGNvbHVtbiwgMCksIGxpbmUubGVuZ3RoKTsKICAgICAgICByZXR1cm4ge3Jvdzogcm93LCBjb2x1bW46IGNvbHVtbn07CiAgICB9OwogICAgCiAgICB0aGlzLmNsb25lUG9zID0gZnVuY3Rpb24ocG9zKSB7CiAgICAgICAgcmV0dXJuIHtyb3c6IHBvcy5yb3csIGNvbHVtbjogcG9zLmNvbHVtbn07CiAgICB9OwogICAgCiAgICB0aGlzLnBvcyA9IGZ1bmN0aW9uKHJvdywgY29sdW1uKSB7CiAgICAgICAgcmV0dXJuIHtyb3c6IHJvdywgY29sdW1uOiBjb2x1bW59OwogICAgfTsKICAgIAogICAgdGhpcy4kY2xpcFBvc2l0aW9uID0gZnVuY3Rpb24ocG9zaXRpb24pIHsKICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5nZXRMZW5ndGgoKTsKICAgICAgICBpZiAocG9zaXRpb24ucm93ID49IGxlbmd0aCkgewogICAgICAgICAgICBwb3NpdGlvbi5yb3cgPSBNYXRoLm1heCgwLCBsZW5ndGggLSAxKTsKICAgICAgICAgICAgcG9zaXRpb24uY29sdW1uID0gdGhpcy5nZXRMaW5lKGxlbmd0aCAtIDEpLmxlbmd0aDsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBwb3NpdGlvbi5yb3cgPSBNYXRoLm1heCgwLCBwb3NpdGlvbi5yb3cpOwogICAgICAgICAgICBwb3NpdGlvbi5jb2x1bW4gPSBNYXRoLm1pbihNYXRoLm1heChwb3NpdGlvbi5jb2x1bW4sIDApLCB0aGlzLmdldExpbmUocG9zaXRpb24ucm93KS5sZW5ndGgpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcG9zaXRpb247CiAgICB9OwogICAgdGhpcy5pbnNlcnRGdWxsTGluZXMgPSBmdW5jdGlvbihyb3csIGxpbmVzKSB7CiAgICAgICAgcm93ID0gTWF0aC5taW4oTWF0aC5tYXgocm93LCAwKSwgdGhpcy5nZXRMZW5ndGgoKSk7CiAgICAgICAgdmFyIGNvbHVtbiA9IDA7CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuZ2V0TGVuZ3RoKCkpIHsKICAgICAgICAgICAgbGluZXMgPSBsaW5lcy5jb25jYXQoWyIiXSk7CiAgICAgICAgICAgIGNvbHVtbiA9IDA7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbGluZXMgPSBbIiJdLmNvbmNhdChsaW5lcyk7CiAgICAgICAgICAgIHJvdy0tOwogICAgICAgICAgICBjb2x1bW4gPSB0aGlzLiRsaW5lc1tyb3ddLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgdGhpcy5pbnNlcnRNZXJnZWRMaW5lcyh7cm93OiByb3csIGNvbHVtbjogY29sdW1ufSwgbGluZXMpOwogICAgfTsgICAgCiAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzID0gZnVuY3Rpb24ocG9zaXRpb24sIGxpbmVzKSB7CiAgICAgICAgdmFyIHN0YXJ0ID0gdGhpcy5jbGlwcGVkUG9zKHBvc2l0aW9uLnJvdywgcG9zaXRpb24uY29sdW1uKTsKICAgICAgICB2YXIgZW5kID0gewogICAgICAgICAgICByb3c6IHN0YXJ0LnJvdyArIGxpbmVzLmxlbmd0aCAtIDEsCiAgICAgICAgICAgIGNvbHVtbjogKGxpbmVzLmxlbmd0aCA9PSAxID8gc3RhcnQuY29sdW1uIDogMCkgKyBsaW5lc1tsaW5lcy5sZW5ndGggLSAxXS5sZW5ndGgKICAgICAgICB9OwogICAgICAgIAogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogImluc2VydCIsCiAgICAgICAgICAgIGxpbmVzOiBsaW5lcwogICAgICAgIH0pOwogICAgICAgIAogICAgICAgIHJldHVybiB0aGlzLmNsb25lUG9zKGVuZCk7CiAgICB9OwogICAgdGhpcy5yZW1vdmUgPSBmdW5jdGlvbihyYW5nZSkgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhyYW5nZS5zdGFydC5yb3csIHJhbmdlLnN0YXJ0LmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHRoaXMuY2xpcHBlZFBvcyhyYW5nZS5lbmQucm93LCByYW5nZS5lbmQuY29sdW1uKTsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoewogICAgICAgICAgICBzdGFydDogc3RhcnQsCiAgICAgICAgICAgIGVuZDogZW5kLAogICAgICAgICAgICBhY3Rpb246ICJyZW1vdmUiLAogICAgICAgICAgICBsaW5lczogdGhpcy5nZXRMaW5lc0ZvclJhbmdlKHtzdGFydDogc3RhcnQsIGVuZDogZW5kfSkKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhzdGFydCk7CiAgICB9OwogICAgdGhpcy5yZW1vdmVJbkxpbmUgPSBmdW5jdGlvbihyb3csIHN0YXJ0Q29sdW1uLCBlbmRDb2x1bW4pIHsKICAgICAgICB2YXIgc3RhcnQgPSB0aGlzLmNsaXBwZWRQb3Mocm93LCBzdGFydENvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHRoaXMuY2xpcHBlZFBvcyhyb3csIGVuZENvbHVtbik7CiAgICAgICAgCiAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgc3RhcnQ6IHN0YXJ0LAogICAgICAgICAgICBlbmQ6IGVuZCwKICAgICAgICAgICAgYWN0aW9uOiAicmVtb3ZlIiwKICAgICAgICAgICAgbGluZXM6IHRoaXMuZ2V0TGluZXNGb3JSYW5nZSh7c3RhcnQ6IHN0YXJ0LCBlbmQ6IGVuZH0pCiAgICAgICAgfSwgdHJ1ZSk7CiAgICAgICAgCiAgICAgICAgcmV0dXJuIHRoaXMuY2xvbmVQb3Moc3RhcnQpOwogICAgfTsKICAgIHRoaXMucmVtb3ZlRnVsbExpbmVzID0gZnVuY3Rpb24oZmlyc3RSb3csIGxhc3RSb3cpIHsKICAgICAgICBmaXJzdFJvdyA9IE1hdGgubWluKE1hdGgubWF4KDAsIGZpcnN0Um93KSwgdGhpcy5nZXRMZW5ndGgoKSAtIDEpOwogICAgICAgIGxhc3RSb3cgID0gTWF0aC5taW4oTWF0aC5tYXgoMCwgbGFzdFJvdyApLCB0aGlzLmdldExlbmd0aCgpIC0gMSk7CiAgICAgICAgdmFyIGRlbGV0ZUZpcnN0TmV3TGluZSA9IGxhc3RSb3cgPT0gdGhpcy5nZXRMZW5ndGgoKSAtIDEgJiYgZmlyc3RSb3cgPiAwOwogICAgICAgIHZhciBkZWxldGVMYXN0TmV3TGluZSAgPSBsYXN0Um93ICA8IHRoaXMuZ2V0TGVuZ3RoKCkgLSAxOwogICAgICAgIHZhciBzdGFydFJvdyA9ICggZGVsZXRlRmlyc3ROZXdMaW5lID8gZmlyc3RSb3cgLSAxICAgICAgICAgICAgICAgICAgOiBmaXJzdFJvdyAgICAgICAgICAgICAgICAgICAgKTsKICAgICAgICB2YXIgc3RhcnRDb2wgPSAoIGRlbGV0ZUZpcnN0TmV3TGluZSA/IHRoaXMuZ2V0TGluZShzdGFydFJvdykubGVuZ3RoIDogMCAgICAgICAgICAgICAgICAgICAgICAgICAgICk7CiAgICAgICAgdmFyIGVuZFJvdyAgID0gKCBkZWxldGVMYXN0TmV3TGluZSAgPyBsYXN0Um93ICsgMSAgICAgICAgICAgICAgICAgICA6IGxhc3RSb3cgICAgICAgICAgICAgICAgICAgICApOwogICAgICAgIHZhciBlbmRDb2wgICA9ICggZGVsZXRlTGFzdE5ld0xpbmUgID8gMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiB0aGlzLmdldExpbmUoZW5kUm93KS5sZW5ndGggKTsgCiAgICAgICAgdmFyIHJhbmdlID0gbmV3IFJhbmdlKHN0YXJ0Um93LCBzdGFydENvbCwgZW5kUm93LCBlbmRDb2wpOwogICAgICAgIHZhciBkZWxldGVkTGluZXMgPSB0aGlzLiRsaW5lcy5zbGljZShmaXJzdFJvdywgbGFzdFJvdyArIDEpOwogICAgICAgIAogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiByYW5nZS5zdGFydCwKICAgICAgICAgICAgZW5kOiByYW5nZS5lbmQsCiAgICAgICAgICAgIGFjdGlvbjogInJlbW92ZSIsCiAgICAgICAgICAgIGxpbmVzOiB0aGlzLmdldExpbmVzRm9yUmFuZ2UocmFuZ2UpCiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIGRlbGV0ZWRMaW5lczsKICAgIH07CiAgICB0aGlzLnJlbW92ZU5ld0xpbmUgPSBmdW5jdGlvbihyb3cpIHsKICAgICAgICBpZiAocm93IDwgdGhpcy5nZXRMZW5ndGgoKSAtIDEgJiYgcm93ID49IDApIHsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3csIHRoaXMuZ2V0TGluZShyb3cpLmxlbmd0aCksCiAgICAgICAgICAgICAgICBlbmQ6IHRoaXMucG9zKHJvdyArIDEsIDApLAogICAgICAgICAgICAgICAgYWN0aW9uOiAicmVtb3ZlIiwKICAgICAgICAgICAgICAgIGxpbmVzOiBbIiIsICIiXQogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5yZXBsYWNlID0gZnVuY3Rpb24ocmFuZ2UsIHRleHQpIHsKICAgICAgICBpZiAoIShyYW5nZSBpbnN0YW5jZW9mIFJhbmdlKSkKICAgICAgICAgICAgcmFuZ2UgPSBSYW5nZS5mcm9tUG9pbnRzKHJhbmdlLnN0YXJ0LCByYW5nZS5lbmQpOwogICAgICAgIGlmICh0ZXh0Lmxlbmd0aCA9PT0gMCAmJiByYW5nZS5pc0VtcHR5KCkpCiAgICAgICAgICAgIHJldHVybiByYW5nZS5zdGFydDsKICAgICAgICBpZiAodGV4dCA9PSB0aGlzLmdldFRleHRSYW5nZShyYW5nZSkpCiAgICAgICAgICAgIHJldHVybiByYW5nZS5lbmQ7CgogICAgICAgIHRoaXMucmVtb3ZlKHJhbmdlKTsKICAgICAgICB2YXIgZW5kOwogICAgICAgIGlmICh0ZXh0KSB7CiAgICAgICAgICAgIGVuZCA9IHRoaXMuaW5zZXJ0KHJhbmdlLnN0YXJ0LCB0ZXh0KTsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGVuZCA9IHJhbmdlLnN0YXJ0OwogICAgICAgIH0KICAgICAgICAKICAgICAgICByZXR1cm4gZW5kOwogICAgfTsKICAgIHRoaXMuYXBwbHlEZWx0YXMgPSBmdW5jdGlvbihkZWx0YXMpIHsKICAgICAgICBmb3IgKHZhciBpPTA7IGk8ZGVsdGFzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIHRoaXMuYXBwbHlEZWx0YShkZWx0YXNbaV0pOwogICAgICAgIH0KICAgIH07CiAgICB0aGlzLnJldmVydERlbHRhcyA9IGZ1bmN0aW9uKGRlbHRhcykgewogICAgICAgIGZvciAodmFyIGk9ZGVsdGFzLmxlbmd0aC0xOyBpPj0wOyBpLS0pIHsKICAgICAgICAgICAgdGhpcy5yZXZlcnREZWx0YShkZWx0YXNbaV0pOwogICAgICAgIH0KICAgIH07CiAgICB0aGlzLmFwcGx5RGVsdGEgPSBmdW5jdGlvbihkZWx0YSwgZG9Ob3RWYWxpZGF0ZSkgewogICAgICAgIHZhciBpc0luc2VydCA9IGRlbHRhLmFjdGlvbiA9PSAiaW5zZXJ0IjsKICAgICAgICBpZiAoaXNJbnNlcnQgPyBkZWx0YS5saW5lcy5sZW5ndGggPD0gMSAmJiAhZGVsdGEubGluZXNbMF0KICAgICAgICAgICAgOiAhUmFuZ2UuY29tcGFyZVBvaW50cyhkZWx0YS5zdGFydCwgZGVsdGEuZW5kKSkgewogICAgICAgICAgICByZXR1cm47CiAgICAgICAgfQogICAgICAgIAogICAgICAgIGlmIChpc0luc2VydCAmJiBkZWx0YS5saW5lcy5sZW5ndGggPiAyMDAwMCkgewogICAgICAgICAgICB0aGlzLiRzcGxpdEFuZGFwcGx5TGFyZ2VEZWx0YShkZWx0YSwgMjAwMDApOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgYXBwbHlEZWx0YSh0aGlzLiRsaW5lcywgZGVsdGEsIGRvTm90VmFsaWRhdGUpOwogICAgICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZSIsIGRlbHRhKTsKICAgICAgICB9CiAgICB9OwogICAgCiAgICB0aGlzLiRzYWZlQXBwbHlEZWx0YSA9IGZ1bmN0aW9uKGRlbHRhKSB7CiAgICAgICAgdmFyIGRvY0xlbmd0aCA9IHRoaXMuJGxpbmVzLmxlbmd0aDsKICAgICAgICBpZiAoCiAgICAgICAgICAgIGRlbHRhLmFjdGlvbiA9PSAicmVtb3ZlIiAmJiBkZWx0YS5zdGFydC5yb3cgPCBkb2NMZW5ndGggJiYgZGVsdGEuZW5kLnJvdyA8IGRvY0xlbmd0aAogICAgICAgICAgICB8fCBkZWx0YS5hY3Rpb24gPT0gImluc2VydCIgJiYgZGVsdGEuc3RhcnQucm93IDw9IGRvY0xlbmd0aAogICAgICAgICkgewogICAgICAgICAgICB0aGlzLmFwcGx5RGVsdGEoZGVsdGEpOwogICAgICAgIH0KICAgIH07CiAgICAKICAgIHRoaXMuJHNwbGl0QW5kYXBwbHlMYXJnZURlbHRhID0gZnVuY3Rpb24oZGVsdGEsIE1BWCkgewogICAgICAgIHZhciBsaW5lcyA9IGRlbHRhLmxpbmVzOwogICAgICAgIHZhciBsID0gbGluZXMubGVuZ3RoIC0gTUFYICsgMTsKICAgICAgICB2YXIgcm93ID0gZGVsdGEuc3RhcnQucm93OyAKICAgICAgICB2YXIgY29sdW1uID0gZGVsdGEuc3RhcnQuY29sdW1uOwogICAgICAgIGZvciAodmFyIGZyb20gPSAwLCB0byA9IDA7IGZyb20gPCBsOyBmcm9tID0gdG8pIHsKICAgICAgICAgICAgdG8gKz0gTUFYIC0gMTsKICAgICAgICAgICAgdmFyIGNodW5rID0gbGluZXMuc2xpY2UoZnJvbSwgdG8pOwogICAgICAgICAgICBjaHVuay5wdXNoKCIiKTsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3cgKyBmcm9tLCBjb2x1bW4pLAogICAgICAgICAgICAgICAgZW5kOiB0aGlzLnBvcyhyb3cgKyB0bywgY29sdW1uID0gMCksCiAgICAgICAgICAgICAgICBhY3Rpb246IGRlbHRhLmFjdGlvbiwKICAgICAgICAgICAgICAgIGxpbmVzOiBjaHVuawogICAgICAgICAgICB9LCB0cnVlKTsKICAgICAgICB9CiAgICAgICAgZGVsdGEubGluZXMgPSBsaW5lcy5zbGljZShmcm9tKTsKICAgICAgICBkZWx0YS5zdGFydC5yb3cgPSByb3cgKyBmcm9tOwogICAgICAgIGRlbHRhLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoZGVsdGEsIHRydWUpOwogICAgfTsKICAgIHRoaXMucmV2ZXJ0RGVsdGEgPSBmdW5jdGlvbihkZWx0YSkgewogICAgICAgIHRoaXMuJHNhZmVBcHBseURlbHRhKHsKICAgICAgICAgICAgc3RhcnQ6IHRoaXMuY2xvbmVQb3MoZGVsdGEuc3RhcnQpLAogICAgICAgICAgICBlbmQ6IHRoaXMuY2xvbmVQb3MoZGVsdGEuZW5kKSwKICAgICAgICAgICAgYWN0aW9uOiAoZGVsdGEuYWN0aW9uID09ICJpbnNlcnQiID8gInJlbW92ZSIgOiAiaW5zZXJ0IiksCiAgICAgICAgICAgIGxpbmVzOiBkZWx0YS5saW5lcy5zbGljZSgpCiAgICAgICAgfSk7CiAgICB9OwogICAgdGhpcy5pbmRleFRvUG9zaXRpb24gPSBmdW5jdGlvbihpbmRleCwgc3RhcnRSb3cpIHsKICAgICAgICB2YXIgbGluZXMgPSB0aGlzLiRsaW5lcyB8fCB0aGlzLmdldEFsbExpbmVzKCk7CiAgICAgICAgdmFyIG5ld2xpbmVMZW5ndGggPSB0aGlzLmdldE5ld0xpbmVDaGFyYWN0ZXIoKS5sZW5ndGg7CiAgICAgICAgZm9yICh2YXIgaSA9IHN0YXJ0Um93IHx8IDAsIGwgPSBsaW5lcy5sZW5ndGg7IGkgPCBsOyBpKyspIHsKICAgICAgICAgICAgaW5kZXggLT0gbGluZXNbaV0ubGVuZ3RoICsgbmV3bGluZUxlbmd0aDsKICAgICAgICAgICAgaWYgKGluZGV4IDwgMCkKICAgICAgICAgICAgICAgIHJldHVybiB7cm93OiBpLCBjb2x1bW46IGluZGV4ICsgbGluZXNbaV0ubGVuZ3RoICsgbmV3bGluZUxlbmd0aH07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7cm93OiBsLTEsIGNvbHVtbjogaW5kZXggKyBsaW5lc1tsLTFdLmxlbmd0aCArIG5ld2xpbmVMZW5ndGh9OwogICAgfTsKICAgIHRoaXMucG9zaXRpb25Ub0luZGV4ID0gZnVuY3Rpb24ocG9zLCBzdGFydFJvdykgewogICAgICAgIHZhciBsaW5lcyA9IHRoaXMuJGxpbmVzIHx8IHRoaXMuZ2V0QWxsTGluZXMoKTsKICAgICAgICB2YXIgbmV3bGluZUxlbmd0aCA9IHRoaXMuZ2V0TmV3TGluZUNoYXJhY3RlcigpLmxlbmd0aDsKICAgICAgICB2YXIgaW5kZXggPSAwOwogICAgICAgIHZhciByb3cgPSBNYXRoLm1pbihwb3Mucm93LCBsaW5lcy5sZW5ndGgpOwogICAgICAgIGZvciAodmFyIGkgPSBzdGFydFJvdyB8fCAwOyBpIDwgcm93OyArK2kpCiAgICAgICAgICAgIGluZGV4ICs9IGxpbmVzW2ldLmxlbmd0aCArIG5ld2xpbmVMZW5ndGg7CgogICAgICAgIHJldHVybiBpbmRleCArIHBvcy5jb2x1bW47CiAgICB9OwoKfSkuY2FsbChEb2N1bWVudC5wcm90b3R5cGUpOwoKZXhwb3J0cy5Eb2N1bWVudCA9IERvY3VtZW50Owp9KTsKCmFjZS5kZWZpbmUoImFjZS9saWIvbGFuZyIsW10sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSkgewoidXNlIHN0cmljdCI7CgpleHBvcnRzLmxhc3QgPSBmdW5jdGlvbihhKSB7CiAgICByZXR1cm4gYVthLmxlbmd0aCAtIDFdOwp9OwoKZXhwb3J0cy5zdHJpbmdSZXZlcnNlID0gZnVuY3Rpb24oc3RyaW5nKSB7CiAgICByZXR1cm4gc3RyaW5nLnNwbGl0KCIiKS5yZXZlcnNlKCkuam9pbigiIik7Cn07CgpleHBvcnRzLnN0cmluZ1JlcGVhdCA9IGZ1bmN0aW9uIChzdHJpbmcsIGNvdW50KSB7CiAgICB2YXIgcmVzdWx0ID0gJyc7CiAgICB3aGlsZSAoY291bnQgPiAwKSB7CiAgICAgICAgaWYgKGNvdW50ICYgMSkKICAgICAgICAgICAgcmVzdWx0ICs9IHN0cmluZzsKCiAgICAgICAgaWYgKGNvdW50ID4+PSAxKQogICAgICAgICAgICBzdHJpbmcgKz0gc3RyaW5nOwogICAgfQogICAgcmV0dXJuIHJlc3VsdDsKfTsKCnZhciB0cmltQmVnaW5SZWdleHAgPSAvXlxzXHMqLzsKdmFyIHRyaW1FbmRSZWdleHAgPSAvXHNccyokLzsKCmV4cG9ydHMuc3RyaW5nVHJpbUxlZnQgPSBmdW5jdGlvbiAoc3RyaW5nKSB7CiAgICByZXR1cm4gc3RyaW5nLnJlcGxhY2UodHJpbUJlZ2luUmVnZXhwLCAnJyk7Cn07CgpleHBvcnRzLnN0cmluZ1RyaW1SaWdodCA9IGZ1bmN0aW9uIChzdHJpbmcpIHsKICAgIHJldHVybiBzdHJpbmcucmVwbGFjZSh0cmltRW5kUmVnZXhwLCAnJyk7Cn07CgpleHBvcnRzLmNvcHlPYmplY3QgPSBmdW5jdGlvbihvYmopIHsKICAgIHZhciBjb3B5ID0ge307CiAgICBmb3IgKHZhciBrZXkgaW4gb2JqKSB7CiAgICAgICAgY29weVtrZXldID0gb2JqW2tleV07CiAgICB9CiAgICByZXR1cm4gY29weTsKfTsKCmV4cG9ydHMuY29weUFycmF5ID0gZnVuY3Rpb24oYXJyYXkpewogICAgdmFyIGNvcHkgPSBbXTsKICAgIGZvciAodmFyIGk9MCwgbD1hcnJheS5sZW5ndGg7IGk8bDsgaSsrKSB7CiAgICAgICAgaWYgKGFycmF5W2ldICYmIHR5cGVvZiBhcnJheVtpXSA9PSAib2JqZWN0IikKICAgICAgICAgICAgY29weVtpXSA9IHRoaXMuY29weU9iamVjdChhcnJheVtpXSk7CiAgICAgICAgZWxzZSAKICAgICAgICAgICAgY29weVtpXSA9IGFycmF5W2ldOwogICAgfQogICAgcmV0dXJuIGNvcHk7Cn07CgpleHBvcnRzLmRlZXBDb3B5ID0gZnVuY3Rpb24gZGVlcENvcHkob2JqKSB7CiAgICBpZiAodHlwZW9mIG9iaiAhPT0gIm9iamVjdCIgfHwgIW9iaikKICAgICAgICByZXR1cm4gb2JqOwogICAgdmFyIGNvcHk7CiAgICBpZiAoQXJyYXkuaXNBcnJheShvYmopKSB7CiAgICAgICAgY29weSA9IFtdOwogICAgICAgIGZvciAodmFyIGtleSA9IDA7IGtleSA8IG9iai5sZW5ndGg7IGtleSsrKSB7CiAgICAgICAgICAgIGNvcHlba2V5XSA9IGRlZXBDb3B5KG9ialtrZXldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGNvcHk7CiAgICB9CiAgICBpZiAoT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKG9iaikgIT09ICJbb2JqZWN0IE9iamVjdF0iKQogICAgICAgIHJldHVybiBvYmo7CiAgICAKICAgIGNvcHkgPSB7fTsKICAgIGZvciAodmFyIGtleSBpbiBvYmopCiAgICAgICAgY29weVtrZXldID0gZGVlcENvcHkob2JqW2tleV0pOwogICAgcmV0dXJuIGNvcHk7Cn07CgpleHBvcnRzLmFycmF5VG9NYXAgPSBmdW5jdGlvbihhcnIpIHsKICAgIHZhciBtYXAgPSB7fTsKICAgIGZvciAodmFyIGk9MDsgaTxhcnIubGVuZ3RoOyBpKyspIHsKICAgICAgICBtYXBbYXJyW2ldXSA9IDE7CiAgICB9CiAgICByZXR1cm4gbWFwOwoKfTsKCmV4cG9ydHMuY3JlYXRlTWFwID0gZnVuY3Rpb24ocHJvcHMpIHsKICAgIHZhciBtYXAgPSBPYmplY3QuY3JlYXRlKG51bGwpOwogICAgZm9yICh2YXIgaSBpbiBwcm9wcykgewogICAgICAgIG1hcFtpXSA9IHByb3BzW2ldOwogICAgfQogICAgcmV0dXJuIG1hcDsKfTsKZXhwb3J0cy5hcnJheVJlbW92ZSA9IGZ1bmN0aW9uKGFycmF5LCB2YWx1ZSkgewogIGZvciAodmFyIGkgPSAwOyBpIDw9IGFycmF5Lmxlbmd0aDsgaSsrKSB7CiAgICBpZiAodmFsdWUgPT09IGFycmF5W2ldKSB7CiAgICAgIGFycmF5LnNwbGljZShpLCAxKTsKICAgIH0KICB9Cn07CgpleHBvcnRzLmVzY2FwZVJlZ0V4cCA9IGZ1bmN0aW9uKHN0cikgewogICAgcmV0dXJuIHN0ci5yZXBsYWNlKC8oWy4qKz9eJHt9KCl8W1xdXC9cXF0pL2csICdcXCQxJyk7Cn07CgpleHBvcnRzLmVzY2FwZUhUTUwgPSBmdW5jdGlvbihzdHIpIHsKICAgIHJldHVybiAoIiIgKyBzdHIpLnJlcGxhY2UoLyYvZywgIiYjMzg7IikucmVwbGFjZSgvIi9nLCAiJiMzNDsiKS5yZXBsYWNlKC8nL2csICImIzM5OyIpLnJlcGxhY2UoLzwvZywgIiYjNjA7Iik7Cn07CgpleHBvcnRzLmdldE1hdGNoT2Zmc2V0cyA9IGZ1bmN0aW9uKHN0cmluZywgcmVnRXhwKSB7CiAgICB2YXIgbWF0Y2hlcyA9IFtdOwoKICAgIHN0cmluZy5yZXBsYWNlKHJlZ0V4cCwgZnVuY3Rpb24oc3RyKSB7CiAgICAgICAgbWF0Y2hlcy5wdXNoKHsKICAgICAgICAgICAgb2Zmc2V0OiBhcmd1bWVudHNbYXJndW1lbnRzLmxlbmd0aC0yXSwKICAgICAgICAgICAgbGVuZ3RoOiBzdHIubGVuZ3RoCiAgICAgICAgfSk7CiAgICB9KTsKCiAgICByZXR1cm4gbWF0Y2hlczsKfTsKZXhwb3J0cy5kZWZlcnJlZENhbGwgPSBmdW5jdGlvbihmY24pIHsKICAgIHZhciB0aW1lciA9IG51bGw7CiAgICB2YXIgY2FsbGJhY2sgPSBmdW5jdGlvbigpIHsKICAgICAgICB0aW1lciA9IG51bGw7CiAgICAgICAgZmNuKCk7CiAgICB9OwoKICAgIHZhciBkZWZlcnJlZCA9IGZ1bmN0aW9uKHRpbWVvdXQpIHsKICAgICAgICBkZWZlcnJlZC5jYW5jZWwoKTsKICAgICAgICB0aW1lciA9IHNldFRpbWVvdXQoY2FsbGJhY2ssIHRpbWVvdXQgfHwgMCk7CiAgICAgICAgcmV0dXJuIGRlZmVycmVkOwogICAgfTsKCiAgICBkZWZlcnJlZC5zY2hlZHVsZSA9IGRlZmVycmVkOwoKICAgIGRlZmVycmVkLmNhbGwgPSBmdW5jdGlvbigpIHsKICAgICAgICB0aGlzLmNhbmNlbCgpOwogICAgICAgIGZjbigpOwogICAgICAgIHJldHVybiBkZWZlcnJlZDsKICAgIH07CgogICAgZGVmZXJyZWQuY2FuY2VsID0gZnVuY3Rpb24oKSB7CiAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVyKTsKICAgICAgICB0aW1lciA9IG51bGw7CiAgICAgICAgcmV0dXJuIGRlZmVycmVkOwogICAgfTsKICAgIAogICAgZGVmZXJyZWQuaXNQZW5kaW5nID0gZnVuY3Rpb24oKSB7CiAgICAgICAgcmV0dXJuIHRpbWVyOwogICAgfTsKCiAgICByZXR1cm4gZGVmZXJyZWQ7Cn07CgoKZXhwb3J0cy5kZWxheWVkQ2FsbCA9IGZ1bmN0aW9uKGZjbiwgZGVmYXVsdFRpbWVvdXQpIHsKICAgIHZhciB0aW1lciA9IG51bGw7CiAgICB2YXIgY2FsbGJhY2sgPSBmdW5jdGlvbigpIHsKICAgICAgICB0aW1lciA9IG51bGw7CiAgICAgICAgZmNuKCk7CiAgICB9OwoKICAgIHZhciBfc2VsZiA9IGZ1bmN0aW9uKHRpbWVvdXQpIHsKICAgICAgICBpZiAodGltZXIgPT0gbnVsbCkKICAgICAgICAgICAgdGltZXIgPSBzZXRUaW1lb3V0KGNhbGxiYWNrLCB0aW1lb3V0IHx8IGRlZmF1bHRUaW1lb3V0KTsKICAgIH07CgogICAgX3NlbGYuZGVsYXkgPSBmdW5jdGlvbih0aW1lb3V0KSB7CiAgICAgICAgdGltZXIgJiYgY2xlYXJUaW1lb3V0KHRpbWVyKTsKICAgICAgICB0aW1lciA9IHNldFRpbWVvdXQoY2FsbGJhY2ssIHRpbWVvdXQgfHwgZGVmYXVsdFRpbWVvdXQpOwogICAgfTsKICAgIF9zZWxmLnNjaGVkdWxlID0gX3NlbGY7CgogICAgX3NlbGYuY2FsbCA9IGZ1bmN0aW9uKCkgewogICAgICAgIHRoaXMuY2FuY2VsKCk7CiAgICAgICAgZmNuKCk7CiAgICB9OwoKICAgIF9zZWxmLmNhbmNlbCA9IGZ1bmN0aW9uKCkgewogICAgICAgIHRpbWVyICYmIGNsZWFyVGltZW91dCh0aW1lcik7CiAgICAgICAgdGltZXIgPSBudWxsOwogICAgfTsKCiAgICBfc2VsZi5pc1BlbmRpbmcgPSBmdW5jdGlvbigpIHsKICAgICAgICByZXR1cm4gdGltZXI7CiAgICB9OwoKICAgIHJldHVybiBfc2VsZjsKfTsKfSk7CgphY2UuZGVmaW5lKCJhY2Uvd29ya2VyL21pcnJvciIsW10sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSkgewoidXNlIHN0cmljdCI7Cgp2YXIgUmFuZ2UgPSByZXF1aXJlKCIuLi9yYW5nZSIpLlJhbmdlOwp2YXIgRG9jdW1lbnQgPSByZXF1aXJlKCIuLi9kb2N1bWVudCIpLkRvY3VtZW50Owp2YXIgbGFuZyA9IHJlcXVpcmUoIi4uL2xpYi9sYW5nIik7CiAgICAKdmFyIE1pcnJvciA9IGV4cG9ydHMuTWlycm9yID0gZnVuY3Rpb24oc2VuZGVyKSB7CiAgICB0aGlzLnNlbmRlciA9IHNlbmRlcjsKICAgIHZhciBkb2MgPSB0aGlzLmRvYyA9IG5ldyBEb2N1bWVudCgiIik7CiAgICAKICAgIHZhciBkZWZlcnJlZFVwZGF0ZSA9IHRoaXMuZGVmZXJyZWRVcGRhdGUgPSBsYW5nLmRlbGF5ZWRDYWxsKHRoaXMub25VcGRhdGUuYmluZCh0aGlzKSk7CiAgICAKICAgIHZhciBfc2VsZiA9IHRoaXM7CiAgICBzZW5kZXIub24oImNoYW5nZSIsIGZ1bmN0aW9uKGUpIHsKICAgICAgICB2YXIgZGF0YSA9IGUuZGF0YTsKICAgICAgICBpZiAoZGF0YVswXS5zdGFydCkgewogICAgICAgICAgICBkb2MuYXBwbHlEZWx0YXMoZGF0YSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBkYXRhLmxlbmd0aDsgaSArPSAyKSB7CiAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShkYXRhW2krMV0pKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB7YWN0aW9uOiAiaW5zZXJ0Iiwgc3RhcnQ6IGRhdGFbaV0sIGxpbmVzOiBkYXRhW2krMV19OwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHthY3Rpb246ICJyZW1vdmUiLCBzdGFydDogZGF0YVtpXSwgZW5kOiBkYXRhW2krMV19OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZG9jLmFwcGx5RGVsdGEoZCwgdHJ1ZSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKF9zZWxmLiR0aW1lb3V0KQogICAgICAgICAgICByZXR1cm4gZGVmZXJyZWRVcGRhdGUuc2NoZWR1bGUoX3NlbGYuJHRpbWVvdXQpOwogICAgICAgIF9zZWxmLm9uVXBkYXRlKCk7CiAgICB9KTsKfTsKCihmdW5jdGlvbigpIHsKICAgIAogICAgdGhpcy4kdGltZW91dCA9IDUwMDsKICAgIAogICAgdGhpcy5zZXRUaW1lb3V0ID0gZnVuY3Rpb24odGltZW91dCkgewogICAgICAgIHRoaXMuJHRpbWVvdXQgPSB0aW1lb3V0OwogICAgfTsKICAgIAogICAgdGhpcy5zZXRWYWx1ZSA9IGZ1bmN0aW9uKHZhbHVlKSB7CiAgICAgICAgdGhpcy5kb2Muc2V0VmFsdWUodmFsdWUpOwogICAgICAgIHRoaXMuZGVmZXJyZWRVcGRhdGUuc2NoZWR1bGUodGhpcy4kdGltZW91dCk7CiAgICB9OwogICAgCiAgICB0aGlzLmdldFZhbHVlID0gZnVuY3Rpb24oY2FsbGJhY2tJZCkgewogICAgICAgIHRoaXMuc2VuZGVyLmNhbGxiYWNrKHRoaXMuZG9jLmdldFZhbHVlKCksIGNhbGxiYWNrSWQpOwogICAgfTsKICAgIAogICAgdGhpcy5vblVwZGF0ZSA9IGZ1bmN0aW9uKCkgewogICAgfTsKICAgIAogICAgdGhpcy5pc1BlbmRpbmcgPSBmdW5jdGlvbigpIHsKICAgICAgICByZXR1cm4gdGhpcy5kZWZlcnJlZFVwZGF0ZS5pc1BlbmRpbmcoKTsKICAgIH07CiAgICAKfSkuY2FsbChNaXJyb3IucHJvdG90eXBlKTsKCn0pOwoKYWNlLmRlZmluZSgiYWNlL21vZGUvanNvbi9qc29uX3BhcnNlIixbXSwgZnVuY3Rpb24ocmVxdWlyZSwgZXhwb3J0cywgbW9kdWxlKSB7CiJ1c2Ugc3RyaWN0IjsKCiAgICB2YXIgYXQsICAgICAvLyBUaGUgaW5kZXggb2YgdGhlIGN1cnJlbnQgY2hhcmFjdGVyCiAgICAgICAgY2gsICAgICAvLyBUaGUgY3VycmVudCBjaGFyYWN0ZXIKICAgICAgICBlc2NhcGVlID0gewogICAgICAgICAgICAnIic6ICAnIicsCiAgICAgICAgICAgICdcXCc6ICdcXCcsCiAgICAgICAgICAgICcvJzogICcvJywKICAgICAgICAgICAgYjogICAgJ1xiJywKICAgICAgICAgICAgZjogICAgJ1xmJywKICAgICAgICAgICAgbjogICAgJ1xuJywKICAgICAgICAgICAgcjogICAgJ1xyJywKICAgICAgICAgICAgdDogICAgJ1x0JwogICAgICAgIH0sCiAgICAgICAgdGV4dCwKCiAgICAgICAgZXJyb3IgPSBmdW5jdGlvbiAobSkgewoKICAgICAgICAgICAgdGhyb3cgewogICAgICAgICAgICAgICAgbmFtZTogICAgJ1N5bnRheEVycm9yJywKICAgICAgICAgICAgICAgIG1lc3NhZ2U6IG0sCiAgICAgICAgICAgICAgICBhdDogICAgICBhdCwKICAgICAgICAgICAgICAgIHRleHQ6ICAgIHRleHQKICAgICAgICAgICAgfTsKICAgICAgICB9LAoKICAgICAgICBuZXh0ID0gZnVuY3Rpb24gKGMpIHsKCiAgICAgICAgICAgIGlmIChjICYmIGMgIT09IGNoKSB7CiAgICAgICAgICAgICAgICBlcnJvcigiRXhwZWN0ZWQgJyIgKyBjICsgIicgaW5zdGVhZCBvZiAnIiArIGNoICsgIiciKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgY2ggPSB0ZXh0LmNoYXJBdChhdCk7CiAgICAgICAgICAgIGF0ICs9IDE7CiAgICAgICAgICAgIHJldHVybiBjaDsKICAgICAgICB9LAoKICAgICAgICBudW1iZXIgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICB2YXIgbnVtYmVyLAogICAgICAgICAgICAgICAgc3RyaW5nID0gJyc7CgogICAgICAgICAgICBpZiAoY2ggPT09ICctJykgewogICAgICAgICAgICAgICAgc3RyaW5nID0gJy0nOwogICAgICAgICAgICAgICAgbmV4dCgnLScpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHdoaWxlIChjaCA+PSAnMCcgJiYgY2ggPD0gJzknKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGNoID09PSAnLicpIHsKICAgICAgICAgICAgICAgIHN0cmluZyArPSAnLic7CiAgICAgICAgICAgICAgICB3aGlsZSAobmV4dCgpICYmIGNoID49ICcwJyAmJiBjaCA8PSAnOScpIHsKICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGNoID09PSAnZScgfHwgY2ggPT09ICdFJykgewogICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgbmV4dCgpOwogICAgICAgICAgICAgICAgaWYgKGNoID09PSAnLScgfHwgY2ggPT09ICcrJykgewogICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgewogICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbnVtYmVyID0gK3N0cmluZzsKICAgICAgICAgICAgaWYgKGlzTmFOKG51bWJlcikpIHsKICAgICAgICAgICAgICAgIGVycm9yKCJCYWQgbnVtYmVyIik7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVtYmVyOwogICAgICAgICAgICB9CiAgICAgICAgfSwKCiAgICAgICAgc3RyaW5nID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGhleCwKICAgICAgICAgICAgICAgIGksCiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnJywKICAgICAgICAgICAgICAgIHVmZmZmOwoKICAgICAgICAgICAgaWYgKGNoID09PSAnIicpIHsKICAgICAgICAgICAgICAgIHdoaWxlIChuZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICciJykgewogICAgICAgICAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzdHJpbmc7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1xcJykgewogICAgICAgICAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ3UnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ZmZmZiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgNDsgaSArPSAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGV4ID0gcGFyc2VJbnQobmV4dCgpLCAxNik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpc0Zpbml0ZShoZXgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ZmZmZiA9IHVmZmZmICogMTYgKyBoZXg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSh1ZmZmZik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIGVzY2FwZWVbY2hdID09PSAnc3RyaW5nJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGVzY2FwZWVbY2hdOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09ICJcbiIgfHwgY2ggPT0gIlxyIikgewogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVycm9yKCJCYWQgc3RyaW5nIik7CiAgICAgICAgfSwKCiAgICAgICAgd2hpdGUgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICB3aGlsZSAoY2ggJiYgY2ggPD0gJyAnKSB7CiAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgIH0KICAgICAgICB9LAoKICAgICAgICB3b3JkID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgc3dpdGNoIChjaCkgewogICAgICAgICAgICBjYXNlICd0JzoKICAgICAgICAgICAgICAgIG5leHQoJ3QnKTsKICAgICAgICAgICAgICAgIG5leHQoJ3InKTsKICAgICAgICAgICAgICAgIG5leHQoJ3UnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2UnKTsKICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICBjYXNlICdmJzoKICAgICAgICAgICAgICAgIG5leHQoJ2YnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2EnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIG5leHQoJ3MnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2UnKTsKICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgY2FzZSAnbic6CiAgICAgICAgICAgICAgICBuZXh0KCduJyk7CiAgICAgICAgICAgICAgICBuZXh0KCd1Jyk7CiAgICAgICAgICAgICAgICBuZXh0KCdsJyk7CiAgICAgICAgICAgICAgICBuZXh0KCdsJyk7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBlcnJvcigiVW5leHBlY3RlZCAnIiArIGNoICsgIiciKTsKICAgICAgICB9LAoKICAgICAgICB2YWx1ZSwgIC8vIFBsYWNlIGhvbGRlciBmb3IgdGhlIHZhbHVlIGZ1bmN0aW9uLgoKICAgICAgICBhcnJheSA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHZhciBhcnJheSA9IFtdOwoKICAgICAgICAgICAgaWYgKGNoID09PSAnWycpIHsKICAgICAgICAgICAgICAgIG5leHQoJ1snKTsKICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICddJykgewogICAgICAgICAgICAgICAgICAgIG5leHQoJ10nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXJyYXk7ICAgLy8gZW1wdHkgYXJyYXkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChjaCkgewogICAgICAgICAgICAgICAgICAgIGFycmF5LnB1c2godmFsdWUoKSk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICddJykgewogICAgICAgICAgICAgICAgICAgICAgICBuZXh0KCddJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhcnJheTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnLCcpOwogICAgICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBhcnJheSIpOwogICAgICAgIH0sCgogICAgICAgIG9iamVjdCA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHZhciBrZXksCiAgICAgICAgICAgICAgICBvYmplY3QgPSB7fTsKCiAgICAgICAgICAgIGlmIChjaCA9PT0gJ3snKSB7CiAgICAgICAgICAgICAgICBuZXh0KCd7Jyk7CiAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgaWYgKGNoID09PSAnfScpIHsKICAgICAgICAgICAgICAgICAgICBuZXh0KCd9Jyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdDsgICAvLyBlbXB0eSBvYmplY3QKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChjaCkgewogICAgICAgICAgICAgICAgICAgIGtleSA9IHN0cmluZygpOwogICAgICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnOicpOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuaGFzT3duUHJvcGVydHkuY2FsbChvYmplY3QsIGtleSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IoJ0R1cGxpY2F0ZSBrZXkgIicgKyBrZXkgKyAnIicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBvYmplY3Rba2V5XSA9IHZhbHVlKCk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd9JykgewogICAgICAgICAgICAgICAgICAgICAgICBuZXh0KCd9Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvYmplY3Q7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG5leHQoJywnKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVycm9yKCJCYWQgb2JqZWN0Iik7CiAgICAgICAgfTsKCiAgICB2YWx1ZSA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgd2hpdGUoKTsKICAgICAgICBzd2l0Y2ggKGNoKSB7CiAgICAgICAgY2FzZSAneyc6CiAgICAgICAgICAgIHJldHVybiBvYmplY3QoKTsKICAgICAgICBjYXNlICdbJzoKICAgICAgICAgICAgcmV0dXJuIGFycmF5KCk7CiAgICAgICAgY2FzZSAnIic6CiAgICAgICAgICAgIHJldHVybiBzdHJpbmcoKTsKICAgICAgICBjYXNlICctJzoKICAgICAgICAgICAgcmV0dXJuIG51bWJlcigpOwogICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgIHJldHVybiBjaCA+PSAnMCcgJiYgY2ggPD0gJzknID8gbnVtYmVyKCkgOiB3b3JkKCk7CiAgICAgICAgfQogICAgfTsKCiAgICByZXR1cm4gZnVuY3Rpb24gKHNvdXJjZSwgcmV2aXZlcikgewogICAgICAgIHZhciByZXN1bHQ7CgogICAgICAgIHRleHQgPSBzb3VyY2U7CiAgICAgICAgYXQgPSAwOwogICAgICAgIGNoID0gJyAnOwogICAgICAgIHJlc3VsdCA9IHZhbHVlKCk7CiAgICAgICAgd2hpdGUoKTsKICAgICAgICBpZiAoY2gpIHsKICAgICAgICAgICAgZXJyb3IoIlN5bnRheCBlcnJvciIpOwogICAgICAgIH0KCiAgICAgICAgcmV0dXJuIHR5cGVvZiByZXZpdmVyID09PSAnZnVuY3Rpb24nID8gZnVuY3Rpb24gd2Fsayhob2xkZXIsIGtleSkgewogICAgICAgICAgICB2YXIgaywgdiwgdmFsdWUgPSBob2xkZXJba2V5XTsKICAgICAgICAgICAgaWYgKHZhbHVlICYmIHR5cGVvZiB2YWx1ZSA9PT0gJ29iamVjdCcpIHsKICAgICAgICAgICAgICAgIGZvciAoayBpbiB2YWx1ZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuaGFzT3duUHJvcGVydHkuY2FsbCh2YWx1ZSwgaykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdiA9IHdhbGsodmFsdWUsIGspOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodiAhPT0gdW5kZWZpbmVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZVtrXSA9IHY7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgdmFsdWVba107CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJldml2ZXIuY2FsbChob2xkZXIsIGtleSwgdmFsdWUpOwogICAgICAgIH0oeycnOiByZXN1bHR9LCAnJykgOiByZXN1bHQ7CiAgICB9Owp9KTsKCmFjZS5kZWZpbmUoImFjZS9tb2RlL2pzb25fd29ya2VyIixbXSwgZnVuY3Rpb24ocmVxdWlyZSwgZXhwb3J0cywgbW9kdWxlKSB7CiJ1c2Ugc3RyaWN0IjsKCnZhciBvb3AgPSByZXF1aXJlKCIuLi9saWIvb29wIik7CnZhciBNaXJyb3IgPSByZXF1aXJlKCIuLi93b3JrZXIvbWlycm9yIikuTWlycm9yOwp2YXIgcGFyc2UgPSByZXF1aXJlKCIuL2pzb24vanNvbl9wYXJzZSIpOwoKdmFyIEpzb25Xb3JrZXIgPSBleHBvcnRzLkpzb25Xb3JrZXIgPSBmdW5jdGlvbihzZW5kZXIpIHsKICAgIE1pcnJvci5jYWxsKHRoaXMsIHNlbmRlcik7CiAgICB0aGlzLnNldFRpbWVvdXQoMjAwKTsKfTsKCm9vcC5pbmhlcml0cyhKc29uV29ya2VyLCBNaXJyb3IpOwoKKGZ1bmN0aW9uKCkgewoKICAgIHRoaXMub25VcGRhdGUgPSBmdW5jdGlvbigpIHsKICAgICAgICB2YXIgdmFsdWUgPSB0aGlzLmRvYy5nZXRWYWx1ZSgpOwogICAgICAgIHZhciBlcnJvcnMgPSBbXTsKICAgICAgICB0cnkgewogICAgICAgICAgICBpZiAodmFsdWUpCiAgICAgICAgICAgICAgICBwYXJzZSh2YWx1ZSk7CiAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICB2YXIgcG9zID0gdGhpcy5kb2MuaW5kZXhUb1Bvc2l0aW9uKGUuYXQtMSk7CiAgICAgICAgICAgIGVycm9ycy5wdXNoKHsKICAgICAgICAgICAgICAgIHJvdzogcG9zLnJvdywKICAgICAgICAgICAgICAgIGNvbHVtbjogcG9zLmNvbHVtbiwKICAgICAgICAgICAgICAgIHRleHQ6IGUubWVzc2FnZSwKICAgICAgICAgICAgICAgIHR5cGU6ICJlcnJvciIKICAgICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICAgIHRoaXMuc2VuZGVyLmVtaXQoImFubm90YXRlIiwgZXJyb3JzKTsKICAgIH07Cgp9KS5jYWxsKEpzb25Xb3JrZXIucHJvdG90eXBlKTsKCn0pOwoKYWNlLmRlZmluZSgiYWNlL2xpYi9lczUtc2hpbSIsW10sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSkgewoKZnVuY3Rpb24gRW1wdHkoKSB7fQoKaWYgKCFGdW5jdGlvbi5wcm90b3R5cGUuYmluZCkgewogICAgRnVuY3Rpb24ucHJvdG90eXBlLmJpbmQgPSBmdW5jdGlvbiBiaW5kKHRoYXQpIHsgLy8gLmxlbmd0aCBpcyAxCiAgICAgICAgdmFyIHRhcmdldCA9IHRoaXM7CiAgICAgICAgaWYgKHR5cGVvZiB0YXJnZXQgIT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJGdW5jdGlvbi5wcm90b3R5cGUuYmluZCBjYWxsZWQgb24gaW5jb21wYXRpYmxlICIgKyB0YXJnZXQpOwogICAgICAgIH0KICAgICAgICB2YXIgYXJncyA9IHNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTsgLy8gZm9yIG5vcm1hbCBjYWxsCiAgICAgICAgdmFyIGJvdW5kID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgaWYgKHRoaXMgaW5zdGFuY2VvZiBib3VuZCkgewoKICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSB0YXJnZXQuYXBwbHkoCiAgICAgICAgICAgICAgICAgICAgdGhpcywKICAgICAgICAgICAgICAgICAgICBhcmdzLmNvbmNhdChzbGljZS5jYWxsKGFyZ3VtZW50cykpCiAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgaWYgKE9iamVjdChyZXN1bHQpID09PSByZXN1bHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CgogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRhcmdldC5hcHBseSgKICAgICAgICAgICAgICAgICAgICB0aGF0LAogICAgICAgICAgICAgICAgICAgIGFyZ3MuY29uY2F0KHNsaWNlLmNhbGwoYXJndW1lbnRzKSkKICAgICAgICAgICAgICAgICk7CgogICAgICAgICAgICB9CgogICAgICAgIH07CiAgICAgICAgaWYodGFyZ2V0LnByb3RvdHlwZSkgewogICAgICAgICAgICBFbXB0eS5wcm90b3R5cGUgPSB0YXJnZXQucHJvdG90eXBlOwogICAgICAgICAgICBib3VuZC5wcm90b3R5cGUgPSBuZXcgRW1wdHkoKTsKICAgICAgICAgICAgRW1wdHkucHJvdG90eXBlID0gbnVsbDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJvdW5kOwogICAgfTsKfQp2YXIgY2FsbCA9IEZ1bmN0aW9uLnByb3RvdHlwZS5jYWxsOwp2YXIgcHJvdG90eXBlT2ZBcnJheSA9IEFycmF5LnByb3RvdHlwZTsKdmFyIHByb3RvdHlwZU9mT2JqZWN0ID0gT2JqZWN0LnByb3RvdHlwZTsKdmFyIHNsaWNlID0gcHJvdG90eXBlT2ZBcnJheS5zbGljZTsKdmFyIF90b1N0cmluZyA9IGNhbGwuYmluZChwcm90b3R5cGVPZk9iamVjdC50b1N0cmluZyk7CnZhciBvd25zID0gY2FsbC5iaW5kKHByb3RvdHlwZU9mT2JqZWN0Lmhhc093blByb3BlcnR5KTsKdmFyIGRlZmluZUdldHRlcjsKdmFyIGRlZmluZVNldHRlcjsKdmFyIGxvb2t1cEdldHRlcjsKdmFyIGxvb2t1cFNldHRlcjsKdmFyIHN1cHBvcnRzQWNjZXNzb3JzOwppZiAoKHN1cHBvcnRzQWNjZXNzb3JzID0gb3ducyhwcm90b3R5cGVPZk9iamVjdCwgIl9fZGVmaW5lR2V0dGVyX18iKSkpIHsKICAgIGRlZmluZUdldHRlciA9IGNhbGwuYmluZChwcm90b3R5cGVPZk9iamVjdC5fX2RlZmluZUdldHRlcl9fKTsKICAgIGRlZmluZVNldHRlciA9IGNhbGwuYmluZChwcm90b3R5cGVPZk9iamVjdC5fX2RlZmluZVNldHRlcl9fKTsKICAgIGxvb2t1cEdldHRlciA9IGNhbGwuYmluZChwcm90b3R5cGVPZk9iamVjdC5fX2xvb2t1cEdldHRlcl9fKTsKICAgIGxvb2t1cFNldHRlciA9IGNhbGwuYmluZChwcm90b3R5cGVPZk9iamVjdC5fX2xvb2t1cFNldHRlcl9fKTsKfQppZiAoWzEsMl0uc3BsaWNlKDApLmxlbmd0aCAhPSAyKSB7CiAgICBpZihmdW5jdGlvbigpIHsgLy8gdGVzdCBJRSA8IDkgdG8gc3BsaWNlIGJ1ZyAtIHNlZSBpc3N1ZSAjMTM4CiAgICAgICAgZnVuY3Rpb24gbWFrZUFycmF5KGwpIHsKICAgICAgICAgICAgdmFyIGEgPSBuZXcgQXJyYXkobCsyKTsKICAgICAgICAgICAgYVswXSA9IGFbMV0gPSAwOwogICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICB9CiAgICAgICAgdmFyIGFycmF5ID0gW10sIGxlbmd0aEJlZm9yZTsKICAgICAgICAKICAgICAgICBhcnJheS5zcGxpY2UuYXBwbHkoYXJyYXksIG1ha2VBcnJheSgyMCkpOwogICAgICAgIGFycmF5LnNwbGljZS5hcHBseShhcnJheSwgbWFrZUFycmF5KDI2KSk7CgogICAgICAgIGxlbmd0aEJlZm9yZSA9IGFycmF5Lmxlbmd0aDsgLy80NgogICAgICAgIGFycmF5LnNwbGljZSg1LCAwLCAiWFhYIik7IC8vIGFkZCBvbmUgZWxlbWVudAoKICAgICAgICBsZW5ndGhCZWZvcmUgKyAxID09IGFycmF5Lmxlbmd0aAoKICAgICAgICBpZiAobGVuZ3RoQmVmb3JlICsgMSA9PSBhcnJheS5sZW5ndGgpIHsKICAgICAgICAgICAgcmV0dXJuIHRydWU7Ly8gaGFzIHJpZ2h0IHNwbGljZSBpbXBsZW1lbnRhdGlvbiB3aXRob3V0IGJ1Z3MKICAgICAgICB9CiAgICB9KCkpIHsvL0lFIDYvNwogICAgICAgIHZhciBhcnJheV9zcGxpY2UgPSBBcnJheS5wcm90b3R5cGUuc3BsaWNlOwogICAgICAgIEFycmF5LnByb3RvdHlwZS5zcGxpY2UgPSBmdW5jdGlvbihzdGFydCwgZGVsZXRlQ291bnQpIHsKICAgICAgICAgICAgaWYgKCFhcmd1bWVudHMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYXJyYXlfc3BsaWNlLmFwcGx5KHRoaXMsIFsKICAgICAgICAgICAgICAgICAgICBzdGFydCA9PT0gdm9pZCAwID8gMCA6IHN0YXJ0LAogICAgICAgICAgICAgICAgICAgIGRlbGV0ZUNvdW50ID09PSB2b2lkIDAgPyAodGhpcy5sZW5ndGggLSBzdGFydCkgOiBkZWxldGVDb3VudAogICAgICAgICAgICAgICAgXS5jb25jYXQoc2xpY2UuY2FsbChhcmd1bWVudHMsIDIpKSkKICAgICAgICAgICAgfQogICAgICAgIH07CiAgICB9IGVsc2Ugey8vSUU4CiAgICAgICAgQXJyYXkucHJvdG90eXBlLnNwbGljZSA9IGZ1bmN0aW9uKHBvcywgcmVtb3ZlQ291bnQpewogICAgICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5sZW5ndGg7CiAgICAgICAgICAgIGlmIChwb3MgPiAwKSB7CiAgICAgICAgICAgICAgICBpZiAocG9zID4gbGVuZ3RoKQogICAgICAgICAgICAgICAgICAgIHBvcyA9IGxlbmd0aDsKICAgICAgICAgICAgfSBlbHNlIGlmIChwb3MgPT0gdm9pZCAwKSB7CiAgICAgICAgICAgICAgICBwb3MgPSAwOwogICAgICAgICAgICB9IGVsc2UgaWYgKHBvcyA8IDApIHsKICAgICAgICAgICAgICAgIHBvcyA9IE1hdGgubWF4KGxlbmd0aCArIHBvcywgMCk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGlmICghKHBvcytyZW1vdmVDb3VudCA8IGxlbmd0aCkpCiAgICAgICAgICAgICAgICByZW1vdmVDb3VudCA9IGxlbmd0aCAtIHBvczsKCiAgICAgICAgICAgIHZhciByZW1vdmVkID0gdGhpcy5zbGljZShwb3MsIHBvcytyZW1vdmVDb3VudCk7CiAgICAgICAgICAgIHZhciBpbnNlcnQgPSBzbGljZS5jYWxsKGFyZ3VtZW50cywgMik7CiAgICAgICAgICAgIHZhciBhZGQgPSBpbnNlcnQubGVuZ3RoOyAgICAgICAgICAgIAogICAgICAgICAgICBpZiAocG9zID09PSBsZW5ndGgpIHsKICAgICAgICAgICAgICAgIGlmIChhZGQpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLnB1c2guYXBwbHkodGhpcywgaW5zZXJ0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHZhciByZW1vdmUgPSBNYXRoLm1pbihyZW1vdmVDb3VudCwgbGVuZ3RoIC0gcG9zKTsKICAgICAgICAgICAgICAgIHZhciB0YWlsT2xkUG9zID0gcG9zICsgcmVtb3ZlOwogICAgICAgICAgICAgICAgdmFyIHRhaWxOZXdQb3MgPSB0YWlsT2xkUG9zICsgYWRkIC0gcmVtb3ZlOwogICAgICAgICAgICAgICAgdmFyIHRhaWxDb3VudCA9IGxlbmd0aCAtIHRhaWxPbGRQb3M7CiAgICAgICAgICAgICAgICB2YXIgbGVuZ3RoQWZ0ZXJSZW1vdmUgPSBsZW5ndGggLSByZW1vdmU7CgogICAgICAgICAgICAgICAgaWYgKHRhaWxOZXdQb3MgPCB0YWlsT2xkUG9zKSB7IC8vIGNhc2UgQQogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgdGFpbENvdW50OyArK2kpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t0YWlsTmV3UG9zK2ldID0gdGhpc1t0YWlsT2xkUG9zK2ldOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodGFpbE5ld1BvcyA+IHRhaWxPbGRQb3MpIHsgLy8gY2FzZSBCCiAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gdGFpbENvdW50OyBpLS07ICkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3RhaWxOZXdQb3MraV0gPSB0aGlzW3RhaWxPbGRQb3MraV07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSAvLyBlbHNlLCBhZGQgPT0gcmVtb3ZlIChub3RoaW5nIHRvIGRvKQoKICAgICAgICAgICAgICAgIGlmIChhZGQgJiYgcG9zID09PSBsZW5ndGhBZnRlclJlbW92ZSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMubGVuZ3RoID0gbGVuZ3RoQWZ0ZXJSZW1vdmU7IC8vIHRydW5jYXRlIGFycmF5CiAgICAgICAgICAgICAgICAgICAgdGhpcy5wdXNoLmFwcGx5KHRoaXMsIGluc2VydCk7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRoaXMubGVuZ3RoID0gbGVuZ3RoQWZ0ZXJSZW1vdmUgKyBhZGQ7IC8vIHJlc2VydmVzIHNwYWNlCiAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGFkZDsgKytpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbcG9zK2ldID0gaW5zZXJ0W2ldOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmVtb3ZlZDsKICAgICAgICB9OwogICAgfQp9CmlmICghQXJyYXkuaXNBcnJheSkgewogICAgQXJyYXkuaXNBcnJheSA9IGZ1bmN0aW9uIGlzQXJyYXkob2JqKSB7CiAgICAgICAgcmV0dXJuIF90b1N0cmluZyhvYmopID09ICJbb2JqZWN0IEFycmF5XSI7CiAgICB9Owp9CnZhciBib3hlZFN0cmluZyA9IE9iamVjdCgiYSIpLAogICAgc3BsaXRTdHJpbmcgPSBib3hlZFN0cmluZ1swXSAhPSAiYSIgfHwgISgwIGluIGJveGVkU3RyaW5nKTsKCmlmICghQXJyYXkucHJvdG90eXBlLmZvckVhY2gpIHsKICAgIEFycmF5LnByb3RvdHlwZS5mb3JFYWNoID0gZnVuY3Rpb24gZm9yRWFjaChmdW4gLyosIHRoaXNwKi8pIHsKICAgICAgICB2YXIgb2JqZWN0ID0gdG9PYmplY3QodGhpcyksCiAgICAgICAgICAgIHNlbGYgPSBzcGxpdFN0cmluZyAmJiBfdG9TdHJpbmcodGhpcykgPT0gIltvYmplY3QgU3RyaW5nXSIgPwogICAgICAgICAgICAgICAgdGhpcy5zcGxpdCgiIikgOgogICAgICAgICAgICAgICAgb2JqZWN0LAogICAgICAgICAgICB0aGlzcCA9IGFyZ3VtZW50c1sxXSwKICAgICAgICAgICAgaSA9IC0xLAogICAgICAgICAgICBsZW5ndGggPSBzZWxmLmxlbmd0aCA+Pj4gMDsKICAgICAgICBpZiAoX3RvU3RyaW5nKGZ1bikgIT0gIltvYmplY3QgRnVuY3Rpb25dIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCk7IC8vIFRPRE8gbWVzc2FnZQogICAgICAgIH0KCiAgICAgICAgd2hpbGUgKCsraSA8IGxlbmd0aCkgewogICAgICAgICAgICBpZiAoaSBpbiBzZWxmKSB7CiAgICAgICAgICAgICAgICBmdW4uY2FsbCh0aGlzcCwgc2VsZltpXSwgaSwgb2JqZWN0KTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH07Cn0KaWYgKCFBcnJheS5wcm90b3R5cGUubWFwKSB7CiAgICBBcnJheS5wcm90b3R5cGUubWFwID0gZnVuY3Rpb24gbWFwKGZ1biAvKiwgdGhpc3AqLykgewogICAgICAgIHZhciBvYmplY3QgPSB0b09iamVjdCh0aGlzKSwKICAgICAgICAgICAgc2VsZiA9IHNwbGl0U3RyaW5nICYmIF90b1N0cmluZyh0aGlzKSA9PSAiW29iamVjdCBTdHJpbmddIiA/CiAgICAgICAgICAgICAgICB0aGlzLnNwbGl0KCIiKSA6CiAgICAgICAgICAgICAgICBvYmplY3QsCiAgICAgICAgICAgIGxlbmd0aCA9IHNlbGYubGVuZ3RoID4+PiAwLAogICAgICAgICAgICByZXN1bHQgPSBBcnJheShsZW5ndGgpLAogICAgICAgICAgICB0aGlzcCA9IGFyZ3VtZW50c1sxXTsKICAgICAgICBpZiAoX3RvU3RyaW5nKGZ1bikgIT0gIltvYmplY3QgRnVuY3Rpb25dIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKGZ1biArICIgaXMgbm90IGEgZnVuY3Rpb24iKTsKICAgICAgICB9CgogICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgaWYgKGkgaW4gc2VsZikKICAgICAgICAgICAgICAgIHJlc3VsdFtpXSA9IGZ1bi5jYWxsKHRoaXNwLCBzZWxmW2ldLCBpLCBvYmplY3QpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgfTsKfQppZiAoIUFycmF5LnByb3RvdHlwZS5maWx0ZXIpIHsKICAgIEFycmF5LnByb3RvdHlwZS5maWx0ZXIgPSBmdW5jdGlvbiBmaWx0ZXIoZnVuIC8qLCB0aGlzcCAqLykgewogICAgICAgIHZhciBvYmplY3QgPSB0b09iamVjdCh0aGlzKSwKICAgICAgICAgICAgc2VsZiA9IHNwbGl0U3RyaW5nICYmIF90b1N0cmluZyh0aGlzKSA9PSAiW29iamVjdCBTdHJpbmddIiA/CiAgICAgICAgICAgICAgICB0aGlzLnNwbGl0KCIiKSA6CiAgICAgICAgICAgICAgICAgICAgb2JqZWN0LAogICAgICAgICAgICBsZW5ndGggPSBzZWxmLmxlbmd0aCA+Pj4gMCwKICAgICAgICAgICAgcmVzdWx0ID0gW10sCiAgICAgICAgICAgIHZhbHVlLAogICAgICAgICAgICB0aGlzcCA9IGFyZ3VtZW50c1sxXTsKICAgICAgICBpZiAoX3RvU3RyaW5nKGZ1bikgIT0gIltvYmplY3QgRnVuY3Rpb25dIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKGZ1biArICIgaXMgbm90IGEgZnVuY3Rpb24iKTsKICAgICAgICB9CgogICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgaWYgKGkgaW4gc2VsZikgewogICAgICAgICAgICAgICAgdmFsdWUgPSBzZWxmW2ldOwogICAgICAgICAgICAgICAgaWYgKGZ1bi5jYWxsKHRoaXNwLCB2YWx1ZSwgaSwgb2JqZWN0KSkgewogICAgICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKHZhbHVlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgfTsKfQppZiAoIUFycmF5LnByb3RvdHlwZS5ldmVyeSkgewogICAgQXJyYXkucHJvdG90eXBlLmV2ZXJ5ID0gZnVuY3Rpb24gZXZlcnkoZnVuIC8qLCB0aGlzcCAqLykgewogICAgICAgIHZhciBvYmplY3QgPSB0b09iamVjdCh0aGlzKSwKICAgICAgICAgICAgc2VsZiA9IHNwbGl0U3RyaW5nICYmIF90b1N0cmluZyh0aGlzKSA9PSAiW29iamVjdCBTdHJpbmddIiA/CiAgICAgICAgICAgICAgICB0aGlzLnNwbGl0KCIiKSA6CiAgICAgICAgICAgICAgICBvYmplY3QsCiAgICAgICAgICAgIGxlbmd0aCA9IHNlbGYubGVuZ3RoID4+PiAwLAogICAgICAgICAgICB0aGlzcCA9IGFyZ3VtZW50c1sxXTsKICAgICAgICBpZiAoX3RvU3RyaW5nKGZ1bikgIT0gIltvYmplY3QgRnVuY3Rpb25dIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKGZ1biArICIgaXMgbm90IGEgZnVuY3Rpb24iKTsKICAgICAgICB9CgogICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgaWYgKGkgaW4gc2VsZiAmJiAhZnVuLmNhbGwodGhpc3AsIHNlbGZbaV0sIGksIG9iamVjdCkpIHsKICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gdHJ1ZTsKICAgIH07Cn0KaWYgKCFBcnJheS5wcm90b3R5cGUuc29tZSkgewogICAgQXJyYXkucHJvdG90eXBlLnNvbWUgPSBmdW5jdGlvbiBzb21lKGZ1biAvKiwgdGhpc3AgKi8pIHsKICAgICAgICB2YXIgb2JqZWN0ID0gdG9PYmplY3QodGhpcyksCiAgICAgICAgICAgIHNlbGYgPSBzcGxpdFN0cmluZyAmJiBfdG9TdHJpbmcodGhpcykgPT0gIltvYmplY3QgU3RyaW5nXSIgPwogICAgICAgICAgICAgICAgdGhpcy5zcGxpdCgiIikgOgogICAgICAgICAgICAgICAgb2JqZWN0LAogICAgICAgICAgICBsZW5ndGggPSBzZWxmLmxlbmd0aCA+Pj4gMCwKICAgICAgICAgICAgdGhpc3AgPSBhcmd1bWVudHNbMV07CiAgICAgICAgaWYgKF90b1N0cmluZyhmdW4pICE9ICJbb2JqZWN0IEZ1bmN0aW9uXSIpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihmdW4gKyAiIGlzIG5vdCBhIGZ1bmN0aW9uIik7CiAgICAgICAgfQoKICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGlmIChpIGluIHNlbGYgJiYgZnVuLmNhbGwodGhpc3AsIHNlbGZbaV0sIGksIG9iamVjdCkpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBmYWxzZTsKICAgIH07Cn0KaWYgKCFBcnJheS5wcm90b3R5cGUucmVkdWNlKSB7CiAgICBBcnJheS5wcm90b3R5cGUucmVkdWNlID0gZnVuY3Rpb24gcmVkdWNlKGZ1biAvKiwgaW5pdGlhbCovKSB7CiAgICAgICAgdmFyIG9iamVjdCA9IHRvT2JqZWN0KHRoaXMpLAogICAgICAgICAgICBzZWxmID0gc3BsaXRTdHJpbmcgJiYgX3RvU3RyaW5nKHRoaXMpID09ICJbb2JqZWN0IFN0cmluZ10iID8KICAgICAgICAgICAgICAgIHRoaXMuc3BsaXQoIiIpIDoKICAgICAgICAgICAgICAgIG9iamVjdCwKICAgICAgICAgICAgbGVuZ3RoID0gc2VsZi5sZW5ndGggPj4+IDA7CiAgICAgICAgaWYgKF90b1N0cmluZyhmdW4pICE9ICJbb2JqZWN0IEZ1bmN0aW9uXSIpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihmdW4gKyAiIGlzIG5vdCBhIGZ1bmN0aW9uIik7CiAgICAgICAgfQogICAgICAgIGlmICghbGVuZ3RoICYmIGFyZ3VtZW50cy5sZW5ndGggPT0gMSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJyZWR1Y2Ugb2YgZW1wdHkgYXJyYXkgd2l0aCBubyBpbml0aWFsIHZhbHVlIik7CiAgICAgICAgfQoKICAgICAgICB2YXIgaSA9IDA7CiAgICAgICAgdmFyIHJlc3VsdDsKICAgICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA+PSAyKSB7CiAgICAgICAgICAgIHJlc3VsdCA9IGFyZ3VtZW50c1sxXTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICBpZiAoaSBpbiBzZWxmKSB7CiAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gc2VsZltpKytdOwogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCsraSA+PSBsZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJyZWR1Y2Ugb2YgZW1wdHkgYXJyYXkgd2l0aCBubyBpbml0aWFsIHZhbHVlIik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gd2hpbGUgKHRydWUpOwogICAgICAgIH0KCiAgICAgICAgZm9yICg7IGkgPCBsZW5ndGg7IGkrKykgewogICAgICAgICAgICBpZiAoaSBpbiBzZWxmKSB7CiAgICAgICAgICAgICAgICByZXN1bHQgPSBmdW4uY2FsbCh2b2lkIDAsIHJlc3VsdCwgc2VsZltpXSwgaSwgb2JqZWN0KTsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgIH07Cn0KaWYgKCFBcnJheS5wcm90b3R5cGUucmVkdWNlUmlnaHQpIHsKICAgIEFycmF5LnByb3RvdHlwZS5yZWR1Y2VSaWdodCA9IGZ1bmN0aW9uIHJlZHVjZVJpZ2h0KGZ1biAvKiwgaW5pdGlhbCovKSB7CiAgICAgICAgdmFyIG9iamVjdCA9IHRvT2JqZWN0KHRoaXMpLAogICAgICAgICAgICBzZWxmID0gc3BsaXRTdHJpbmcgJiYgX3RvU3RyaW5nKHRoaXMpID09ICJbb2JqZWN0IFN0cmluZ10iID8KICAgICAgICAgICAgICAgIHRoaXMuc3BsaXQoIiIpIDoKICAgICAgICAgICAgICAgIG9iamVjdCwKICAgICAgICAgICAgbGVuZ3RoID0gc2VsZi5sZW5ndGggPj4+IDA7CiAgICAgICAgaWYgKF90b1N0cmluZyhmdW4pICE9ICJbb2JqZWN0IEZ1bmN0aW9uXSIpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihmdW4gKyAiIGlzIG5vdCBhIGZ1bmN0aW9uIik7CiAgICAgICAgfQogICAgICAgIGlmICghbGVuZ3RoICYmIGFyZ3VtZW50cy5sZW5ndGggPT0gMSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJyZWR1Y2VSaWdodCBvZiBlbXB0eSBhcnJheSB3aXRoIG5vIGluaXRpYWwgdmFsdWUiKTsKICAgICAgICB9CgogICAgICAgIHZhciByZXN1bHQsIGkgPSBsZW5ndGggLSAxOwogICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID49IDIpIHsKICAgICAgICAgICAgcmVzdWx0ID0gYXJndW1lbnRzWzFdOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgIGlmIChpIGluIHNlbGYpIHsKICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBzZWxmW2ktLV07CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoLS1pIDwgMCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoInJlZHVjZVJpZ2h0IG9mIGVtcHR5IGFycmF5IHdpdGggbm8gaW5pdGlhbCB2YWx1ZSIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IHdoaWxlICh0cnVlKTsKICAgICAgICB9CgogICAgICAgIGRvIHsKICAgICAgICAgICAgaWYgKGkgaW4gdGhpcykgewogICAgICAgICAgICAgICAgcmVzdWx0ID0gZnVuLmNhbGwodm9pZCAwLCByZXN1bHQsIHNlbGZbaV0sIGksIG9iamVjdCk7CiAgICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlIChpLS0pOwoKICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgfTsKfQppZiAoIUFycmF5LnByb3RvdHlwZS5pbmRleE9mIHx8IChbMCwgMV0uaW5kZXhPZigxLCAyKSAhPSAtMSkpIHsKICAgIEFycmF5LnByb3RvdHlwZS5pbmRleE9mID0gZnVuY3Rpb24gaW5kZXhPZihzb3VnaHQgLyosIGZyb21JbmRleCAqLyApIHsKICAgICAgICB2YXIgc2VsZiA9IHNwbGl0U3RyaW5nICYmIF90b1N0cmluZyh0aGlzKSA9PSAiW29iamVjdCBTdHJpbmddIiA/CiAgICAgICAgICAgICAgICB0aGlzLnNwbGl0KCIiKSA6CiAgICAgICAgICAgICAgICB0b09iamVjdCh0aGlzKSwKICAgICAgICAgICAgbGVuZ3RoID0gc2VsZi5sZW5ndGggPj4+IDA7CgogICAgICAgIGlmICghbGVuZ3RoKSB7CiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CgogICAgICAgIHZhciBpID0gMDsKICAgICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA+IDEpIHsKICAgICAgICAgICAgaSA9IHRvSW50ZWdlcihhcmd1bWVudHNbMV0pOwogICAgICAgIH0KICAgICAgICBpID0gaSA+PSAwID8gaSA6IE1hdGgubWF4KDAsIGxlbmd0aCArIGkpOwogICAgICAgIGZvciAoOyBpIDwgbGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgaWYgKGkgaW4gc2VsZiAmJiBzZWxmW2ldID09PSBzb3VnaHQpIHsKICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiAtMTsKICAgIH07Cn0KaWYgKCFBcnJheS5wcm90b3R5cGUubGFzdEluZGV4T2YgfHwgKFswLCAxXS5sYXN0SW5kZXhPZigwLCAtMykgIT0gLTEpKSB7CiAgICBBcnJheS5wcm90b3R5cGUubGFzdEluZGV4T2YgPSBmdW5jdGlvbiBsYXN0SW5kZXhPZihzb3VnaHQgLyosIGZyb21JbmRleCAqLykgewogICAgICAgIHZhciBzZWxmID0gc3BsaXRTdHJpbmcgJiYgX3RvU3RyaW5nKHRoaXMpID09ICJbb2JqZWN0IFN0cmluZ10iID8KICAgICAgICAgICAgICAgIHRoaXMuc3BsaXQoIiIpIDoKICAgICAgICAgICAgICAgIHRvT2JqZWN0KHRoaXMpLAogICAgICAgICAgICBsZW5ndGggPSBzZWxmLmxlbmd0aCA+Pj4gMDsKCiAgICAgICAgaWYgKCFsZW5ndGgpIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICB2YXIgaSA9IGxlbmd0aCAtIDE7CiAgICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPiAxKSB7CiAgICAgICAgICAgIGkgPSBNYXRoLm1pbihpLCB0b0ludGVnZXIoYXJndW1lbnRzWzFdKSk7CiAgICAgICAgfQogICAgICAgIGkgPSBpID49IDAgPyBpIDogbGVuZ3RoIC0gTWF0aC5hYnMoaSk7CiAgICAgICAgZm9yICg7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgICAgIGlmIChpIGluIHNlbGYgJiYgc291Z2h0ID09PSBzZWxmW2ldKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gLTE7CiAgICB9Owp9CmlmICghT2JqZWN0LmdldFByb3RvdHlwZU9mKSB7CiAgICBPYmplY3QuZ2V0UHJvdG90eXBlT2YgPSBmdW5jdGlvbiBnZXRQcm90b3R5cGVPZihvYmplY3QpIHsKICAgICAgICByZXR1cm4gb2JqZWN0Ll9fcHJvdG9fXyB8fCAoCiAgICAgICAgICAgIG9iamVjdC5jb25zdHJ1Y3RvciA/CiAgICAgICAgICAgIG9iamVjdC5jb25zdHJ1Y3Rvci5wcm90b3R5cGUgOgogICAgICAgICAgICBwcm90b3R5cGVPZk9iamVjdAogICAgICAgICk7CiAgICB9Owp9CmlmICghT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcikgewogICAgdmFyIEVSUl9OT05fT0JKRUNUID0gIk9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IgY2FsbGVkIG9uIGEgIiArCiAgICAgICAgICAgICAgICAgICAgICAgICAibm9uLW9iamVjdDogIjsKICAgIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IgPSBmdW5jdGlvbiBnZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iob2JqZWN0LCBwcm9wZXJ0eSkgewogICAgICAgIGlmICgodHlwZW9mIG9iamVjdCAhPSAib2JqZWN0IiAmJiB0eXBlb2Ygb2JqZWN0ICE9ICJmdW5jdGlvbiIpIHx8IG9iamVjdCA9PT0gbnVsbCkKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihFUlJfTk9OX09CSkVDVCArIG9iamVjdCk7CiAgICAgICAgaWYgKCFvd25zKG9iamVjdCwgcHJvcGVydHkpKQogICAgICAgICAgICByZXR1cm47CgogICAgICAgIHZhciBkZXNjcmlwdG9yLCBnZXR0ZXIsIHNldHRlcjsKICAgICAgICBkZXNjcmlwdG9yID0gIHsgZW51bWVyYWJsZTogdHJ1ZSwgY29uZmlndXJhYmxlOiB0cnVlIH07CiAgICAgICAgaWYgKHN1cHBvcnRzQWNjZXNzb3JzKSB7CiAgICAgICAgICAgIHZhciBwcm90b3R5cGUgPSBvYmplY3QuX19wcm90b19fOwogICAgICAgICAgICBvYmplY3QuX19wcm90b19fID0gcHJvdG90eXBlT2ZPYmplY3Q7CgogICAgICAgICAgICB2YXIgZ2V0dGVyID0gbG9va3VwR2V0dGVyKG9iamVjdCwgcHJvcGVydHkpOwogICAgICAgICAgICB2YXIgc2V0dGVyID0gbG9va3VwU2V0dGVyKG9iamVjdCwgcHJvcGVydHkpOwogICAgICAgICAgICBvYmplY3QuX19wcm90b19fID0gcHJvdG90eXBlOwoKICAgICAgICAgICAgaWYgKGdldHRlciB8fCBzZXR0ZXIpIHsKICAgICAgICAgICAgICAgIGlmIChnZXR0ZXIpIGRlc2NyaXB0b3IuZ2V0ID0gZ2V0dGVyOwogICAgICAgICAgICAgICAgaWYgKHNldHRlcikgZGVzY3JpcHRvci5zZXQgPSBzZXR0ZXI7CiAgICAgICAgICAgICAgICByZXR1cm4gZGVzY3JpcHRvcjsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkZXNjcmlwdG9yLnZhbHVlID0gb2JqZWN0W3Byb3BlcnR5XTsKICAgICAgICByZXR1cm4gZGVzY3JpcHRvcjsKICAgIH07Cn0KaWYgKCFPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcykgewogICAgT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXMgPSBmdW5jdGlvbiBnZXRPd25Qcm9wZXJ0eU5hbWVzKG9iamVjdCkgewogICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhvYmplY3QpOwogICAgfTsKfQppZiAoIU9iamVjdC5jcmVhdGUpIHsKICAgIHZhciBjcmVhdGVFbXB0eTsKICAgIGlmIChPYmplY3QucHJvdG90eXBlLl9fcHJvdG9fXyA9PT0gbnVsbCkgewogICAgICAgIGNyZWF0ZUVtcHR5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICByZXR1cm4geyAiX19wcm90b19fIjogbnVsbCB9OwogICAgICAgIH07CiAgICB9IGVsc2UgewogICAgICAgIGNyZWF0ZUVtcHR5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICB2YXIgZW1wdHkgPSB7fTsKICAgICAgICAgICAgZm9yICh2YXIgaSBpbiBlbXB0eSkKICAgICAgICAgICAgICAgIGVtcHR5W2ldID0gbnVsbDsKICAgICAgICAgICAgZW1wdHkuY29uc3RydWN0b3IgPQogICAgICAgICAgICBlbXB0eS5oYXNPd25Qcm9wZXJ0eSA9CiAgICAgICAgICAgIGVtcHR5LnByb3BlcnR5SXNFbnVtZXJhYmxlID0KICAgICAgICAgICAgZW1wdHkuaXNQcm90b3R5cGVPZiA9CiAgICAgICAgICAgIGVtcHR5LnRvTG9jYWxlU3RyaW5nID0KICAgICAgICAgICAgZW1wdHkudG9TdHJpbmcgPQogICAgICAgICAgICBlbXB0eS52YWx1ZU9mID0KICAgICAgICAgICAgZW1wdHkuX19wcm90b19fID0gbnVsbDsKICAgICAgICAgICAgcmV0dXJuIGVtcHR5OwogICAgICAgIH0KICAgIH0KCiAgICBPYmplY3QuY3JlYXRlID0gZnVuY3Rpb24gY3JlYXRlKHByb3RvdHlwZSwgcHJvcGVydGllcykgewogICAgICAgIHZhciBvYmplY3Q7CiAgICAgICAgaWYgKHByb3RvdHlwZSA9PT0gbnVsbCkgewogICAgICAgICAgICBvYmplY3QgPSBjcmVhdGVFbXB0eSgpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICh0eXBlb2YgcHJvdG90eXBlICE9ICJvYmplY3QiKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigidHlwZW9mIHByb3RvdHlwZVsiKyh0eXBlb2YgcHJvdG90eXBlKSsiXSAhPSAnb2JqZWN0JyIpOwogICAgICAgICAgICB2YXIgVHlwZSA9IGZ1bmN0aW9uICgpIHt9OwogICAgICAgICAgICBUeXBlLnByb3RvdHlwZSA9IHByb3RvdHlwZTsKICAgICAgICAgICAgb2JqZWN0ID0gbmV3IFR5cGUoKTsKICAgICAgICAgICAgb2JqZWN0Ll9fcHJvdG9fXyA9IHByb3RvdHlwZTsKICAgICAgICB9CiAgICAgICAgaWYgKHByb3BlcnRpZXMgIT09IHZvaWQgMCkKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnRpZXMob2JqZWN0LCBwcm9wZXJ0aWVzKTsKICAgICAgICByZXR1cm4gb2JqZWN0OwogICAgfTsKfQoKZnVuY3Rpb24gZG9lc0RlZmluZVByb3BlcnR5V29yayhvYmplY3QpIHsKICAgIHRyeSB7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KG9iamVjdCwgInNlbnRpbmVsIiwge30pOwogICAgICAgIHJldHVybiAic2VudGluZWwiIGluIG9iamVjdDsKICAgIH0gY2F0Y2ggKGV4Y2VwdGlvbikgewogICAgfQp9CmlmIChPYmplY3QuZGVmaW5lUHJvcGVydHkpIHsKICAgIHZhciBkZWZpbmVQcm9wZXJ0eVdvcmtzT25PYmplY3QgPSBkb2VzRGVmaW5lUHJvcGVydHlXb3JrKHt9KTsKICAgIHZhciBkZWZpbmVQcm9wZXJ0eVdvcmtzT25Eb20gPSB0eXBlb2YgZG9jdW1lbnQgPT0gInVuZGVmaW5lZCIgfHwKICAgICAgICBkb2VzRGVmaW5lUHJvcGVydHlXb3JrKGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImRpdiIpKTsKICAgIGlmICghZGVmaW5lUHJvcGVydHlXb3Jrc09uT2JqZWN0IHx8ICFkZWZpbmVQcm9wZXJ0eVdvcmtzT25Eb20pIHsKICAgICAgICB2YXIgZGVmaW5lUHJvcGVydHlGYWxsYmFjayA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0eTsKICAgIH0KfQoKaWYgKCFPYmplY3QuZGVmaW5lUHJvcGVydHkgfHwgZGVmaW5lUHJvcGVydHlGYWxsYmFjaykgewogICAgdmFyIEVSUl9OT05fT0JKRUNUX0RFU0NSSVBUT1IgPSAiUHJvcGVydHkgZGVzY3JpcHRpb24gbXVzdCBiZSBhbiBvYmplY3Q6ICI7CiAgICB2YXIgRVJSX05PTl9PQkpFQ1RfVEFSR0VUID0gIk9iamVjdC5kZWZpbmVQcm9wZXJ0eSBjYWxsZWQgb24gbm9uLW9iamVjdDogIgogICAgdmFyIEVSUl9BQ0NFU1NPUlNfTk9UX1NVUFBPUlRFRCA9ICJnZXR0ZXJzICYgc2V0dGVycyBjYW4gbm90IGJlIGRlZmluZWQgIiArCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm9uIHRoaXMgamF2YXNjcmlwdCBlbmdpbmUiOwoKICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSA9IGZ1bmN0aW9uIGRlZmluZVByb3BlcnR5KG9iamVjdCwgcHJvcGVydHksIGRlc2NyaXB0b3IpIHsKICAgICAgICBpZiAoKHR5cGVvZiBvYmplY3QgIT0gIm9iamVjdCIgJiYgdHlwZW9mIG9iamVjdCAhPSAiZnVuY3Rpb24iKSB8fCBvYmplY3QgPT09IG51bGwpCiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoRVJSX05PTl9PQkpFQ1RfVEFSR0VUICsgb2JqZWN0KTsKICAgICAgICBpZiAoKHR5cGVvZiBkZXNjcmlwdG9yICE9ICJvYmplY3QiICYmIHR5cGVvZiBkZXNjcmlwdG9yICE9ICJmdW5jdGlvbiIpIHx8IGRlc2NyaXB0b3IgPT09IG51bGwpCiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoRVJSX05PTl9PQkpFQ1RfREVTQ1JJUFRPUiArIGRlc2NyaXB0b3IpOwogICAgICAgIGlmIChkZWZpbmVQcm9wZXJ0eUZhbGxiYWNrKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZGVmaW5lUHJvcGVydHlGYWxsYmFjay5jYWxsKE9iamVjdCwgb2JqZWN0LCBwcm9wZXJ0eSwgZGVzY3JpcHRvcik7CiAgICAgICAgICAgIH0gY2F0Y2ggKGV4Y2VwdGlvbikgewogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChvd25zKGRlc2NyaXB0b3IsICJ2YWx1ZSIpKSB7CgogICAgICAgICAgICBpZiAoc3VwcG9ydHNBY2Nlc3NvcnMgJiYgKGxvb2t1cEdldHRlcihvYmplY3QsIHByb3BlcnR5KSB8fAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvb2t1cFNldHRlcihvYmplY3QsIHByb3BlcnR5KSkpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBwcm90b3R5cGUgPSBvYmplY3QuX19wcm90b19fOwogICAgICAgICAgICAgICAgb2JqZWN0Ll9fcHJvdG9fXyA9IHByb3RvdHlwZU9mT2JqZWN0OwogICAgICAgICAgICAgICAgZGVsZXRlIG9iamVjdFtwcm9wZXJ0eV07CiAgICAgICAgICAgICAgICBvYmplY3RbcHJvcGVydHldID0gZGVzY3JpcHRvci52YWx1ZTsKICAgICAgICAgICAgICAgIG9iamVjdC5fX3Byb3RvX18gPSBwcm90b3R5cGU7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBvYmplY3RbcHJvcGVydHldID0gZGVzY3JpcHRvci52YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICghc3VwcG9ydHNBY2Nlc3NvcnMpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKEVSUl9BQ0NFU1NPUlNfTk9UX1NVUFBPUlRFRCk7CiAgICAgICAgICAgIGlmIChvd25zKGRlc2NyaXB0b3IsICJnZXQiKSkKICAgICAgICAgICAgICAgIGRlZmluZUdldHRlcihvYmplY3QsIHByb3BlcnR5LCBkZXNjcmlwdG9yLmdldCk7CiAgICAgICAgICAgIGlmIChvd25zKGRlc2NyaXB0b3IsICJzZXQiKSkKICAgICAgICAgICAgICAgIGRlZmluZVNldHRlcihvYmplY3QsIHByb3BlcnR5LCBkZXNjcmlwdG9yLnNldCk7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gb2JqZWN0OwogICAgfTsKfQppZiAoIU9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKSB7CiAgICBPYmplY3QuZGVmaW5lUHJvcGVydGllcyA9IGZ1bmN0aW9uIGRlZmluZVByb3BlcnRpZXMob2JqZWN0LCBwcm9wZXJ0aWVzKSB7CiAgICAgICAgZm9yICh2YXIgcHJvcGVydHkgaW4gcHJvcGVydGllcykgewogICAgICAgICAgICBpZiAob3ducyhwcm9wZXJ0aWVzLCBwcm9wZXJ0eSkpCiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkob2JqZWN0LCBwcm9wZXJ0eSwgcHJvcGVydGllc1twcm9wZXJ0eV0pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb2JqZWN0OwogICAgfTsKfQppZiAoIU9iamVjdC5zZWFsKSB7CiAgICBPYmplY3Quc2VhbCA9IGZ1bmN0aW9uIHNlYWwob2JqZWN0KSB7CiAgICAgICAgcmV0dXJuIG9iamVjdDsKICAgIH07Cn0KaWYgKCFPYmplY3QuZnJlZXplKSB7CiAgICBPYmplY3QuZnJlZXplID0gZnVuY3Rpb24gZnJlZXplKG9iamVjdCkgewogICAgICAgIHJldHVybiBvYmplY3Q7CiAgICB9Owp9CnRyeSB7CiAgICBPYmplY3QuZnJlZXplKGZ1bmN0aW9uICgpIHt9KTsKfSBjYXRjaCAoZXhjZXB0aW9uKSB7CiAgICBPYmplY3QuZnJlZXplID0gKGZ1bmN0aW9uIGZyZWV6ZShmcmVlemVPYmplY3QpIHsKICAgICAgICByZXR1cm4gZnVuY3Rpb24gZnJlZXplKG9iamVjdCkgewogICAgICAgICAgICBpZiAodHlwZW9mIG9iamVjdCA9PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0OwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIGZyZWV6ZU9iamVjdChvYmplY3QpOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgIH0pKE9iamVjdC5mcmVlemUpOwp9CmlmICghT2JqZWN0LnByZXZlbnRFeHRlbnNpb25zKSB7CiAgICBPYmplY3QucHJldmVudEV4dGVuc2lvbnMgPSBmdW5jdGlvbiBwcmV2ZW50RXh0ZW5zaW9ucyhvYmplY3QpIHsKICAgICAgICByZXR1cm4gb2JqZWN0OwogICAgfTsKfQppZiAoIU9iamVjdC5pc1NlYWxlZCkgewogICAgT2JqZWN0LmlzU2VhbGVkID0gZnVuY3Rpb24gaXNTZWFsZWQob2JqZWN0KSB7CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKfQppZiAoIU9iamVjdC5pc0Zyb3plbikgewogICAgT2JqZWN0LmlzRnJvemVuID0gZnVuY3Rpb24gaXNGcm96ZW4ob2JqZWN0KSB7CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKfQppZiAoIU9iamVjdC5pc0V4dGVuc2libGUpIHsKICAgIE9iamVjdC5pc0V4dGVuc2libGUgPSBmdW5jdGlvbiBpc0V4dGVuc2libGUob2JqZWN0KSB7CiAgICAgICAgaWYgKE9iamVjdChvYmplY3QpID09PSBvYmplY3QpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigpOyAvLyBUT0RPIG1lc3NhZ2UKICAgICAgICB9CiAgICAgICAgdmFyIG5hbWUgPSAnJzsKICAgICAgICB3aGlsZSAob3ducyhvYmplY3QsIG5hbWUpKSB7CiAgICAgICAgICAgIG5hbWUgKz0gJz8nOwogICAgICAgIH0KICAgICAgICBvYmplY3RbbmFtZV0gPSB0cnVlOwogICAgICAgIHZhciByZXR1cm5WYWx1ZSA9IG93bnMob2JqZWN0LCBuYW1lKTsKICAgICAgICBkZWxldGUgb2JqZWN0W25hbWVdOwogICAgICAgIHJldHVybiByZXR1cm5WYWx1ZTsKICAgIH07Cn0KaWYgKCFPYmplY3Qua2V5cykgewogICAgdmFyIGhhc0RvbnRFbnVtQnVnID0gdHJ1ZSwKICAgICAgICBkb250RW51bXMgPSBbCiAgICAgICAgICAgICJ0b1N0cmluZyIsCiAgICAgICAgICAgICJ0b0xvY2FsZVN0cmluZyIsCiAgICAgICAgICAgICJ2YWx1ZU9mIiwKICAgICAgICAgICAgImhhc093blByb3BlcnR5IiwKICAgICAgICAgICAgImlzUHJvdG90eXBlT2YiLAogICAgICAgICAgICAicHJvcGVydHlJc0VudW1lcmFibGUiLAogICAgICAgICAgICAiY29uc3RydWN0b3IiCiAgICAgICAgXSwKICAgICAgICBkb250RW51bXNMZW5ndGggPSBkb250RW51bXMubGVuZ3RoOwoKICAgIGZvciAodmFyIGtleSBpbiB7InRvU3RyaW5nIjogbnVsbH0pIHsKICAgICAgICBoYXNEb250RW51bUJ1ZyA9IGZhbHNlOwogICAgfQoKICAgIE9iamVjdC5rZXlzID0gZnVuY3Rpb24ga2V5cyhvYmplY3QpIHsKCiAgICAgICAgaWYgKAogICAgICAgICAgICAodHlwZW9mIG9iamVjdCAhPSAib2JqZWN0IiAmJiB0eXBlb2Ygb2JqZWN0ICE9ICJmdW5jdGlvbiIpIHx8CiAgICAgICAgICAgIG9iamVjdCA9PT0gbnVsbAogICAgICAgICkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJPYmplY3Qua2V5cyBjYWxsZWQgb24gYSBub24tb2JqZWN0Iik7CiAgICAgICAgfQoKICAgICAgICB2YXIga2V5cyA9IFtdOwogICAgICAgIGZvciAodmFyIG5hbWUgaW4gb2JqZWN0KSB7CiAgICAgICAgICAgIGlmIChvd25zKG9iamVjdCwgbmFtZSkpIHsKICAgICAgICAgICAgICAgIGtleXMucHVzaChuYW1lKTsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgaWYgKGhhc0RvbnRFbnVtQnVnKSB7CiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCBpaSA9IGRvbnRFbnVtc0xlbmd0aDsgaSA8IGlpOyBpKyspIHsKICAgICAgICAgICAgICAgIHZhciBkb250RW51bSA9IGRvbnRFbnVtc1tpXTsKICAgICAgICAgICAgICAgIGlmIChvd25zKG9iamVjdCwgZG9udEVudW0pKSB7CiAgICAgICAgICAgICAgICAgICAga2V5cy5wdXNoKGRvbnRFbnVtKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4ga2V5czsKICAgIH07Cgp9CmlmICghRGF0ZS5ub3cpIHsKICAgIERhdGUubm93ID0gZnVuY3Rpb24gbm93KCkgewogICAgICAgIHJldHVybiBuZXcgRGF0ZSgpLmdldFRpbWUoKTsKICAgIH07Cn0KdmFyIHdzID0gIlx4MDlceDBBXHgwQlx4MENceDBEXHgyMFx4QTBcdTE2ODBcdTIwMDBcdTIwMDFcdTIwMDJcdTIwMDMiICsKICAgICJcdTIwMDRcdTIwMDVcdTIwMDZcdTIwMDdcdTIwMDhcdTIwMDlcdTIwMEFcdTIwMkZcdTIwNUZcdTMwMDBcdTIwMjgiICsKICAgICJcdTIwMjlcdUZFRkYiOwppZiAoIVN0cmluZy5wcm90b3R5cGUudHJpbSkgewogICAgd3MgPSAiWyIgKyB3cyArICJdIjsKICAgIHZhciB0cmltQmVnaW5SZWdleHAgPSBuZXcgUmVnRXhwKCJeIiArIHdzICsgd3MgKyAiKiIpLAogICAgICAgIHRyaW1FbmRSZWdleHAgPSBuZXcgUmVnRXhwKHdzICsgd3MgKyAiKiQiKTsKICAgIFN0cmluZy5wcm90b3R5cGUudHJpbSA9IGZ1bmN0aW9uIHRyaW0oKSB7CiAgICAgICAgcmV0dXJuIFN0cmluZyh0aGlzKS5yZXBsYWNlKHRyaW1CZWdpblJlZ2V4cCwgIiIpLnJlcGxhY2UodHJpbUVuZFJlZ2V4cCwgIiIpOwogICAgfTsKfQoKZnVuY3Rpb24gdG9JbnRlZ2VyKG4pIHsKICAgIG4gPSArbjsKICAgIGlmIChuICE9PSBuKSB7IC8vIGlzTmFOCiAgICAgICAgbiA9IDA7CiAgICB9IGVsc2UgaWYgKG4gIT09IDAgJiYgbiAhPT0gKDEvMCkgJiYgbiAhPT0gLSgxLzApKSB7CiAgICAgICAgbiA9IChuID4gMCB8fCAtMSkgKiBNYXRoLmZsb29yKE1hdGguYWJzKG4pKTsKICAgIH0KICAgIHJldHVybiBuOwp9CgpmdW5jdGlvbiBpc1ByaW1pdGl2ZShpbnB1dCkgewogICAgdmFyIHR5cGUgPSB0eXBlb2YgaW5wdXQ7CiAgICByZXR1cm4gKAogICAgICAgIGlucHV0ID09PSBudWxsIHx8CiAgICAgICAgdHlwZSA9PT0gInVuZGVmaW5lZCIgfHwKICAgICAgICB0eXBlID09PSAiYm9vbGVhbiIgfHwKICAgICAgICB0eXBlID09PSAibnVtYmVyIiB8fAogICAgICAgIHR5cGUgPT09ICJzdHJpbmciCiAgICApOwp9CgpmdW5jdGlvbiB0b1ByaW1pdGl2ZShpbnB1dCkgewogICAgdmFyIHZhbCwgdmFsdWVPZiwgdG9TdHJpbmc7CiAgICBpZiAoaXNQcmltaXRpdmUoaW5wdXQpKSB7CiAgICAgICAgcmV0dXJuIGlucHV0OwogICAgfQogICAgdmFsdWVPZiA9IGlucHV0LnZhbHVlT2Y7CiAgICBpZiAodHlwZW9mIHZhbHVlT2YgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICB2YWwgPSB2YWx1ZU9mLmNhbGwoaW5wdXQpOwogICAgICAgIGlmIChpc1ByaW1pdGl2ZSh2YWwpKSB7CiAgICAgICAgICAgIHJldHVybiB2YWw7CiAgICAgICAgfQogICAgfQogICAgdG9TdHJpbmcgPSBpbnB1dC50b1N0cmluZzsKICAgIGlmICh0eXBlb2YgdG9TdHJpbmcgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICB2YWwgPSB0b1N0cmluZy5jYWxsKGlucHV0KTsKICAgICAgICBpZiAoaXNQcmltaXRpdmUodmFsKSkgewogICAgICAgICAgICByZXR1cm4gdmFsOwogICAgICAgIH0KICAgIH0KICAgIHRocm93IG5ldyBUeXBlRXJyb3IoKTsKfQp2YXIgdG9PYmplY3QgPSBmdW5jdGlvbiAobykgewogICAgaWYgKG8gPT0gbnVsbCkgeyAvLyB0aGlzIG1hdGNoZXMgYm90aCBudWxsIGFuZCB1bmRlZmluZWQKICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJjYW4ndCBjb252ZXJ0ICIrbysiIHRvIG9iamVjdCIpOwogICAgfQogICAgcmV0dXJuIE9iamVjdChvKTsKfTsKCn0pOwo="},function(e,t,i){
| /*!
| * vanilla-picker v2.10.1
| * https://vanilla-picker.js.org
| *
| * Copyright 2017-2019 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
| * Released under the ISC license.
| */
| (function(t,i){e.exports=i()})(0,(function(){"use strict";var e=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),i=function(){function e(e,t){var i=[],n=!0,r=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(n=(o=a.next()).done);n=!0)if(i.push(o.value),t&&i.length===t)break}catch(l){r=!0,s=l}finally{try{!n&&a["return"]&&a["return"]()}finally{if(r)throw s}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();String.prototype.startsWith=String.prototype.startsWith||function(e){return 0===this.indexOf(e)},String.prototype.padStart=String.prototype.padStart||function(e,t){var i=this;while(i.length<e)i=t+i;return i};var n={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=t>0?e.toFixed(t).replace(/0+$/,"").replace(/\.$/,""):e.toString();return i||"0"}var s=function(){function s(t,n,r,o){e(this,s);var a=this;function l(e){if(e.startsWith("hsl")){var t=e.match(/([\-\d\.e]+)/g).map(Number),n=i(t,4),r=n[0],o=n[1],l=n[2],c=n[3];void 0===c&&(c=1),r/=360,o/=100,l/=100,a.hsla=[r,o,l,c]}else if(e.startsWith("rgb")){var h=e.match(/([\-\d\.e]+)/g).map(Number),d=i(h,4),u=d[0],g=d[1],p=d[2],m=d[3];void 0===m&&(m=1),a.rgba=[u,g,p,m]}else e.startsWith("#")?a.rgba=s.hexToRgb(e):a.rgba=s.nameToRgb(e)||s.hexToRgb(e)}if(void 0===t);else if(Array.isArray(t))this.rgba=t;else if(void 0===r){var c=t&&""+t;c&&l(c.toLowerCase())}else this.rgba=[t,n,r,void 0===o?1:o]}return t(s,[{key:"printRGB",value:function(e){var t=e?this.rgba:this.rgba.slice(0,3),i=t.map((function(e,t){return r(e,3===t?3:0)}));return e?"rgba("+i+")":"rgb("+i+")"}},{key:"printHSL",value:function(e){var t=[360,100,100,1],i=["","%","%",""],n=e?this.hsla:this.hsla.slice(0,3),s=n.map((function(e,n){return r(e*t[n],3===n?3:1)+i[n]}));return e?"hsla("+s+")":"hsl("+s+")"}},{key:"printHex",value:function(e){var t=this.hex;return e?t:t.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=s.hslToRgb(this._hsla)},set:function(e){3===e.length&&(e[3]=1),this._rgba=e,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=s.rgbToHsl(this._rgba)},set:function(e){3===e.length&&(e[3]=1),this._hsla=e,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){var e=this.rgba,t=e.map((function(e,t){return t<3?e.toString(16):Math.round(255*e).toString(16)}));return"#"+t.map((function(e){return e.padStart(2,"0")})).join("")},set:function(e){this.rgba=s.hexToRgb(e)}}],[{key:"hexToRgb",value:function(e){var t=(e.startsWith("#")?e.slice(1):e).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!t.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+e);var i=t.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map((function(e){return parseInt(e,16)}));return i[3]=i[3]/255,i}},{key:"nameToRgb",value:function(e){var t=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),i=n[t];return void 0===i?i:s.hexToRgb(i.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var t=i(e,4),n=t[0],r=t[1],s=t[2],o=t[3];n/=255,r/=255,s/=255;var a=Math.max(n,r,s),l=Math.min(n,r,s),c=void 0,h=void 0,d=(a+l)/2;if(a===l)c=h=0;else{var u=a-l;switch(h=d>.5?u/(2-a-l):u/(a+l),a){case n:c=(r-s)/u+(r<s?6:0);break;case r:c=(s-n)/u+2;break;case s:c=(n-r)/u+4;break}c/=6}return[c,h,d,o]}},{key:"hslToRgb",value:function(e){var t=i(e,4),n=t[0],r=t[1],s=t[2],o=t[3],a=void 0,l=void 0,c=void 0;if(0===r)a=l=c=s;else{var h=function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},d=s<.5?s*(1+r):s+r-s*r,u=2*s-d;a=h(u,d,n+1/3),l=h(u,d,n),c=h(u,d,n-1/3)}var g=[255*a,255*l,255*c].map(Math.round);return g[3]=o,g}}]),s}(),o=function(){function i(){e(this,i),this._events=[]}return t(i,[{key:"add",value:function(e,t,i){e.addEventListener(t,i,!1),this._events.push({target:e,type:t,handler:i})}},{key:"remove",value:function(e,t,n){this._events=this._events.filter((function(r){var s=!0;return e&&e!==r.target&&(s=!1),t&&t!==r.type&&(s=!1),n&&n!==r.handler&&(s=!1),s&&i._doRemove(r.target,r.type,r.handler),!s}))}},{key:"destroy",value:function(){this._events.forEach((function(e){return i._doRemove(e.target,e.type,e.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(e,t,i){e.removeEventListener(t,i,!1)}}]),i}();function a(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild}function l(e,t,i){var n=!1;function r(e,t,i){return Math.max(t,Math.min(e,i))}function s(e,s,o){if(o&&(n=!0),n){e.preventDefault();var a=t.getBoundingClientRect(),l=a.width,c=a.height,h=s.clientX,d=s.clientY,u=r(h-a.left,0,l),g=r(d-a.top,0,c);i(u/l,g/c)}}function o(e,t){var i=void 0===e.buttons?e.which:e.buttons;1===i?s(e,e,t):n=!1}function a(e,t){1===e.touches.length?s(e,e.touches[0],t):n=!1}e.add(t,"mousedown",(function(e){o(e,!0)})),e.add(t,"touchstart",(function(e){a(e,!0)})),e.add(window,"mousemove",o),e.add(t,"touchmove",a),e.add(window,"mouseup",(function(e){n=!1})),e.add(t,"touchend",(function(e){n=!1})),e.add(t,"touchcancel",(function(e){n=!1}))}var c="url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3Cpath d='M1,0H0V1H2V2H1' fill='lightgrey'/%3E%3C/svg%3E\")",h=360,d="keydown",u="mousedown",g="focusin";function p(e,t){return(t||document).querySelector(e)}function m(e){e.preventDefault(),e.stopPropagation()}function f(e,t,i,n,r){e.add(t,d,(function(e){i.indexOf(e.key)>=0&&(r&&m(e),n(e))}))}var C=document.createElement("style");C.textContent=".picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-flow:row wrap;-webkit-box-pack:justify;justify-content:space-between;-webkit-box-align:stretch;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:'';display:block;width:100%;height:0;-webkit-box-ordinal-group:2;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{-webkit-box-flex:1;flex:1 1 auto}.layout_default .picker_sl::before{content:'';display:block;padding-bottom:100%}.layout_default .picker_editor{-webkit-box-ordinal-group:2;order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{-webkit-box-ordinal-group:2;order:1;-webkit-box-flex:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{-webkit-box-ordinal-group:2;order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px dodgerblue}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:whitesmoke;background-image:-webkit-gradient(linear, left bottom, left top, from(gainsboro), to(transparent));background-image:-webkit-linear-gradient(bottom, gainsboro, transparent);background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:-webkit-gradient(linear, left bottom, left top, from(transparent), to(gainsboro));background-image:-webkit-linear-gradient(bottom, transparent, gainsboro);background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:white}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid white;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:-webkit-gradient(linear, left top, right top, from(red), color-stop(yellow), color-stop(lime), color-stop(cyan), color-stop(blue), color-stop(magenta), to(red));background-image:-webkit-linear-gradient(left, red, yellow, lime, cyan, blue, magenta, red);background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:-webkit-gradient(linear, left top, left bottom, from(white), color-stop(50%, rgba(255,255,255,0))),-webkit-gradient(linear, left bottom, left top, from(black), color-stop(50%, rgba(0,0,0,0))),-webkit-gradient(linear, left top, right top, from(gray), to(rgba(128,128,128,0)));background-image:-webkit-linear-gradient(top, white, rgba(255,255,255,0) 50%),-webkit-linear-gradient(bottom, black, rgba(0,0,0,0) 50%),-webkit-linear-gradient(left, gray, rgba(128,128,128,0));background-image:linear-gradient(180deg, white, rgba(255,255,255,0) 50%),linear-gradient(0deg, black, rgba(0,0,0,0) 50%),linear-gradient(90deg, gray, rgba(128,128,128,0))}.picker_alpha,.picker_sample{position:relative;background:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3Cpath d='M1,0H0V1H2V2H1' fill='lightgrey'/%3E%3C/svg%3E\") left top/contain white;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:'';position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,0.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:\"\";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}",document.documentElement.firstElementChild.appendChild(C);var I=function(){function i(t){e(this,i),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new o,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return t(i,[{key:"setOptions",value:function(e){var t=this;if(e){var i=this.settings;if(e instanceof HTMLElement)i.parent=e;else{i.parent&&e.parent&&i.parent!==e.parent&&(this._events.remove(i.parent),this._popupInited=!1),o(e,i),e.onChange&&(this.onChange=e.onChange),e.onDone&&(this.onDone=e.onDone),e.onOpen&&(this.onOpen=e.onOpen),e.onClose&&(this.onClose=e.onClose);var n=e.color||e.colour;n&&this._setColor(n)}var r=i.parent;if(r&&i.popup&&!this._popupInited){var s=function(e){return t.openHandler(e)};this._events.add(r,"click",s),f(this._events,r,[" ","Spacebar","Enter"],s),this._popupInited=!0}else e.parent&&!i.popup&&this.show()}function o(e,t,i){for(var n in e)i&&i.indexOf(n)>=0||(t[n]=e[n])}}},{key:"openHandler",value:function(e){if(this.show()){e&&e.preventDefault(),this.settings.parent.style.pointerEvents="none";var t=e&&e.type===d?this._domEdit:this.domElement;setTimeout((function(){return t.focus()}),100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(e){var t=e&&e.type,i=!1;if(e)if(t===u||t===g){var n=(this.__containedEvent||0)+100;e.timeStamp>n&&(i=!0)}else m(e),i=!0;else i=!0;i&&this.hide()&&(this.settings.parent.style.pointerEvents="",t!==u&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(e,t){this.closeHandler(),this.setOptions(e),t&&this.openHandler()}},{key:"setColor",value:function(e,t){this._setColor(e,{silent:t})}},{key:"_setColor",value:function(e,t){if("string"===typeof e&&(e=e.trim()),e){t=t||{};var i=void 0;try{i=new s(e)}catch(r){if(t.failSilently)return;throw r}if(!this.settings.alpha){var n=i.hsla;n[3]=1,i.hsla=n}this.colour=this.color=i,this._setHSLA(null,null,null,null,t)}}},{key:"setColour",value:function(e,t){this.setColor(e,t)}},{key:"show",value:function(){var e=this.settings.parent;if(!e)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var i=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',n=a(i);return this.domElement=n,this._domH=p(".picker_hue",n),this._domSL=p(".picker_sl",n),this._domA=p(".picker_alpha",n),this._domEdit=p(".picker_editor input",n),this._domSample=p(".picker_sample",n),this._domOkay=p(".picker_done button",n),this._domCancel=p(".picker_cancel button",n),n.classList.add("layout_"+this.settings.layout),this.settings.alpha||n.classList.add("no_alpha"),this.settings.editor||n.classList.add("no_editor"),this.settings.cancelButton||n.classList.add("no_cancel"),this._ifPopup((function(){return n.classList.add("popup")})),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var e=this,t=this,i=this.domElement,n=this._events;function r(e,t,i){n.add(e,t,i)}r(i,"click",(function(e){return e.preventDefault()})),l(n,this._domH,(function(e,i){return t._setHSLA(e)})),l(n,this._domSL,(function(e,i){return t._setHSLA(null,e,1-i)})),this.settings.alpha&&l(n,this._domA,(function(e,i){return t._setHSLA(null,null,null,1-i)}));var s=this._domEdit;r(s,"input",(function(e){t._setColor(this.value,{fromEditor:!0,failSilently:!0})})),r(s,"focus",(function(e){var t=this;t.selectionStart===t.selectionEnd&&t.select()})),this._ifPopup((function(){var t=function(t){return e.closeHandler(t)};r(window,u,t),r(window,g,t),f(n,i,["Esc","Escape"],t);var s=function(t){e.__containedEvent=t.timeStamp};r(i,u,s),r(i,g,s),r(e._domCancel,"click",t)}));var o=function(t){e._ifPopup((function(){return e.closeHandler(t)})),e.onDone&&e.onDone(e.colour)};r(this._domOkay,"click",o),f(n,i,["Enter"],o)}},{key:"_setPosition",value:function(){var e=this.settings.parent,t=this.domElement;e!==t.parentNode&&e.appendChild(t),this._ifPopup((function(i){"static"===getComputedStyle(e).position&&(e.style.position="relative");var n=!0===i?"popup_right":"popup_"+i;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(e){e===n?t.classList.add(e):t.classList.remove(e)})),t.classList.add(n)}))}},{key:"_setHSLA",value:function(e,t,i,n,r){r=r||{};var s=this.colour,o=s.hsla;[e,t,i,n].forEach((function(e,t){(e||0===e)&&(o[t]=e)})),s.hsla=o,this._updateUI(r),this.onChange&&!r.silent&&this.onChange(s)}},{key:"_updateUI",value:function(e){if(this.domElement){e=e||{};var t=this.colour,i=t.hsla,n="hsl("+i[0]*h+", 100%, 50%)",r=t.hslString,s=t.hslaString,o=this._domH,a=this._domSL,l=this._domA,d=p(".picker_selector",o),u=p(".picker_selector",a),g=p(".picker_selector",l);b(o,d,i[0]),this._domSL.style.backgroundColor=this._domH.style.color=n,b(a,u,i[1]),y(a,u,1-i[2]),a.style.color=r,y(l,g,1-i[3]);var m=r,f=m.replace("hsl","hsla").replace(")",", 0)"),C="linear-gradient("+[m,f]+")";if(this._domA.style.backgroundImage=C+", "+c,!e.fromEditor){var I=this.settings.editorFormat,A=this.settings.alpha,v=void 0;switch(I){case"rgb":v=t.printRGB(A);break;case"hsl":v=t.printHSL(A);break;default:v=t.printHex(A)}this._domEdit.value=v}this._domSample.style.color=s}function b(e,t,i){t.style.left=100*i+"%"}function y(e,t,i){t.style.top=100*i+"%"}}},{key:"_ifPopup",value:function(e,t){this.settings.parent&&this.settings.popup?e&&e(this.settings.popup):t&&t()}},{key:"_toggleDOM",value:function(e){var t=this.domElement;if(!t)return!1;var i=e?"":"none",n=t.style.display!==i;return n&&(t.style.display=i),n}}],[{key:"StyleElement",get:function(){return C}}]),i}();return I}))},function(e,t){window.ace.define("ace/theme/jsoneditor",["require","exports","module","ace/lib/dom"],(function(e,t,i){t.isDark=!1,t.cssClass="ace-jsoneditor",t.cssText='.ace-jsoneditor .ace_gutter {\nbackground: #ebebeb;\ncolor: #333\n}\n\n.ace-jsoneditor.ace_editor {\nfont-family: "dejavu sans mono", "droid sans mono", consolas, monaco, "lucida console", "courier new", courier, monospace, sans-serif;\nline-height: 1.3;\nbackground-color: #fff;\n}\n.ace-jsoneditor .ace_print-margin {\nwidth: 1px;\nbackground: #e8e8e8\n}\n.ace-jsoneditor .ace_scroller {\nbackground-color: #FFFFFF\n}\n.ace-jsoneditor .ace_text-layer {\ncolor: gray\n}\n.ace-jsoneditor .ace_variable {\ncolor: #1a1a1a\n}\n.ace-jsoneditor .ace_cursor {\nborder-left: 2px solid #000000\n}\n.ace-jsoneditor .ace_overwrite-cursors .ace_cursor {\nborder-left: 0px;\nborder-bottom: 1px solid #000000\n}\n.ace-jsoneditor .ace_marker-layer .ace_selection {\nbackground: lightgray\n}\n.ace-jsoneditor.ace_multiselect .ace_selection.ace_start {\nbox-shadow: 0 0 3px 0px #FFFFFF;\nborder-radius: 2px\n}\n.ace-jsoneditor .ace_marker-layer .ace_step {\nbackground: rgb(255, 255, 0)\n}\n.ace-jsoneditor .ace_marker-layer .ace_bracket {\nmargin: -1px 0 0 -1px;\nborder: 1px solid #BFBFBF\n}\n.ace-jsoneditor .ace_marker-layer .ace_active-line {\nbackground: #FFFBD1\n}\n.ace-jsoneditor .ace_gutter-active-line {\nbackground-color : #dcdcdc\n}\n.ace-jsoneditor .ace_marker-layer .ace_selected-word {\nborder: 1px solid lightgray\n}\n.ace-jsoneditor .ace_invisible {\ncolor: #BFBFBF\n}\n.ace-jsoneditor .ace_keyword,\n.ace-jsoneditor .ace_meta,\n.ace-jsoneditor .ace_support.ace_constant.ace_property-value {\ncolor: #AF956F\n}\n.ace-jsoneditor .ace_keyword.ace_operator {\ncolor: #484848\n}\n.ace-jsoneditor .ace_keyword.ace_other.ace_unit {\ncolor: #96DC5F\n}\n.ace-jsoneditor .ace_constant.ace_language {\ncolor: darkorange\n}\n.ace-jsoneditor .ace_constant.ace_numeric {\ncolor: red\n}\n.ace-jsoneditor .ace_constant.ace_character.ace_entity {\ncolor: #BF78CC\n}\n.ace-jsoneditor .ace_invalid {\ncolor: #FFFFFF;\nbackground-color: #FF002A;\n}\n.ace-jsoneditor .ace_fold {\nbackground-color: #AF956F;\nborder-color: #000000\n}\n.ace-jsoneditor .ace_storage,\n.ace-jsoneditor .ace_support.ace_class,\n.ace-jsoneditor .ace_support.ace_function,\n.ace-jsoneditor .ace_support.ace_other,\n.ace-jsoneditor .ace_support.ace_type {\ncolor: #C52727\n}\n.ace-jsoneditor .ace_string {\ncolor: green\n}\n.ace-jsoneditor .ace_comment {\ncolor: #BCC8BA\n}\n.ace-jsoneditor .ace_entity.ace_name.ace_tag,\n.ace-jsoneditor .ace_entity.ace_other.ace_attribute-name {\ncolor: #606060\n}\n.ace-jsoneditor .ace_markup.ace_underline {\ntext-decoration: underline\n}\n.ace-jsoneditor .ace_indent-guide {\nbackground: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y\n}';var n=e("../lib/dom");n.importCssString(t.cssText,t.cssClass)}))},function(e,t,i){t.tryRequireAjv=function(){try{return i(44)}catch(e){}}},function(e,t,i){"use strict";var n=i(45),r=i(17),s=i(49),o=i(25),a=i(26),l=i(50),c=i(51),h=i(72),d=i(7);e.exports=C,C.prototype.validate=I,C.prototype.compile=A,C.prototype.addSchema=v,C.prototype.addMetaSchema=b,C.prototype.validateSchema=y,C.prototype.getSchema=S,C.prototype.removeSchema=R,C.prototype.addFormat=$,C.prototype.errorsText=H,C.prototype._addSchema=B,C.prototype._compile=Z,C.prototype.compileAsync=i(73);var u=i(74);C.prototype.addKeyword=u.add,C.prototype.getKeyword=u.get,C.prototype.removeKeyword=u.remove,C.prototype.validateKeyword=u.validate;var g=i(19);C.ValidationError=g.Validation,C.MissingRefError=g.MissingRef,C.$dataMetaSchema=h;var p="http://json-schema.org/draft-07/schema",m=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],f=["/properties"];function C(e){if(!(this instanceof C))return new C(e);e=this._opts=d.copy(e)||{},K(this),this._schemas={},this._refs={},this._fragments={},this._formats=l(e.format),this._cache=e.cache||new s,this._loadingSchemas={},this._compilations=[],this.RULES=c(),this._getId=G(e),e.loopRequired=e.loopRequired||1/0,"property"==e.errorDataPath&&(e._errorDataPathProperty=!0),void 0===e.serialize&&(e.serialize=a),this._metaOpts=P(this),e.formats&&N(this),e.keywords&&O(this),V(this),"object"==typeof e.meta&&this.addMetaSchema(e.meta),e.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),L(this)}function I(e,t){var i;if("string"==typeof e){if(i=this.getSchema(e),!i)throw new Error('no schema with key or ref "'+e+'"')}else{var n=this._addSchema(e);i=n.validate||this._compile(n)}var r=i(t);return!0!==i.$async&&(this.errors=i.errors),r}function A(e,t){var i=this._addSchema(e,void 0,t);return i.validate||this._compile(i)}function v(e,t,i,n){if(Array.isArray(e)){for(var s=0;s<e.length;s++)this.addSchema(e[s],void 0,i,n);return this}var o=this._getId(e);if(void 0!==o&&"string"!=typeof o)throw new Error("schema id must be string");return t=r.normalizeId(t||o),F(this,t),this._schemas[t]=this._addSchema(e,i,n,!0),this}function b(e,t,i){return this.addSchema(e,t,i,!0),this}function y(e,t){var i=e.$schema;if(void 0!==i&&"string"!=typeof i)throw new Error("$schema must be a string");if(i=i||this._opts.defaultMeta||w(this),!i)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var n=this.validate(i,e);if(!n&&t){var r="schema is invalid: "+this.errorsText();if("log"!=this._opts.validateSchema)throw new Error(r);this.logger.error(r)}return n}function w(e){var t=e._opts.meta;return e._opts.defaultMeta="object"==typeof t?e._getId(t)||t:e.getSchema(p)?p:void 0,e._opts.defaultMeta}function S(e){var t=k(this,e);switch(typeof t){case"object":return t.validate||this._compile(t);case"string":return this.getSchema(t);case"undefined":return x(this,e)}}function x(e,t){var i=r.schema.call(e,{schema:{}},t);if(i){var s=i.schema,a=i.root,l=i.baseId,c=n.call(e,s,a,void 0,l);return e._fragments[t]=new o({ref:t,fragment:!0,schema:s,root:a,baseId:l,validate:c}),c}}function k(e,t){return t=r.normalizeId(t),e._schemas[t]||e._refs[t]||e._fragments[t]}function R(e){if(e instanceof RegExp)return E(this,this._schemas,e),E(this,this._refs,e),this;switch(typeof e){case"undefined":return E(this,this._schemas),E(this,this._refs),this._cache.clear(),this;case"string":var t=k(this,e);return t&&this._cache.del(t.cacheKey),delete this._schemas[e],delete this._refs[e],this;case"object":var i=this._opts.serialize,n=i?i(e):e;this._cache.del(n);var s=this._getId(e);s&&(s=r.normalizeId(s),delete this._schemas[s],delete this._refs[s])}return this}function E(e,t,i){for(var n in t){var r=t[n];r.meta||i&&!i.test(n)||(e._cache.del(r.cacheKey),delete t[n])}}function B(e,t,i,n){if("object"!=typeof e&&"boolean"!=typeof e)throw new Error("schema should be object or boolean");var s=this._opts.serialize,a=s?s(e):e,l=this._cache.get(a);if(l)return l;n=n||!1!==this._opts.addUsedSchema;var c=r.normalizeId(this._getId(e));c&&n&&F(this,c);var h,d=!1!==this._opts.validateSchema&&!t;d&&!(h=c&&c==r.normalizeId(e.$schema))&&this.validateSchema(e,!0);var u=r.ids.call(this,e),g=new o({id:c,schema:e,localRefs:u,cacheKey:a,meta:i});return"#"!=c[0]&&n&&(this._refs[c]=g),this._cache.put(a,g),d&&h&&this.validateSchema(e,!0),g}function Z(e,t){if(e.compiling)return e.validate=s,s.schema=e.schema,s.errors=null,s.root=t||s,!0===e.schema.$async&&(s.$async=!0),s;var i,r;e.compiling=!0,e.meta&&(i=this._opts,this._opts=this._metaOpts);try{r=n.call(this,e.schema,t,e.localRefs)}catch(o){throw delete e.validate,o}finally{e.compiling=!1,e.meta&&(this._opts=i)}return e.validate=r,e.refs=r.refs,e.refVal=r.refVal,e.root=r.root,r;function s(){var t=e.validate,i=t.apply(this,arguments);return s.errors=t.errors,i}}function G(e){switch(e.schemaId){case"auto":return _;case"id":return T;default:return W}}function T(e){return e.$id&&this.logger.warn("schema $id ignored",e.$id),e.id}function W(e){return e.id&&this.logger.warn("schema id ignored",e.id),e.$id}function _(e){if(e.$id&&e.id&&e.$id!=e.id)throw new Error("schema $id is different from id");return e.$id||e.id}function H(e,t){if(e=e||this.errors,!e)return"No errors";t=t||{};for(var i=void 0===t.separator?", ":t.separator,n=void 0===t.dataVar?"data":t.dataVar,r="",s=0;s<e.length;s++){var o=e[s];o&&(r+=n+o.dataPath+" "+o.message+i)}return r.slice(0,-i.length)}function $(e,t){return"string"==typeof t&&(t=new RegExp(t)),this._formats[e]=t,this}function V(e){var t;if(e._opts.$data&&(t=i(77),e.addMetaSchema(t,t.$id,!0)),!1!==e._opts.meta){var n=i(32);e._opts.$data&&(n=h(n,f)),e.addMetaSchema(n,p,!0),e._refs["http://json-schema.org/schema"]=p}}function L(e){var t=e._opts.schemas;if(t)if(Array.isArray(t))e.addSchema(t);else for(var i in t)e.addSchema(t[i],i)}function N(e){for(var t in e._opts.formats){var i=e._opts.formats[t];e.addFormat(t,i)}}function O(e){for(var t in e._opts.keywords){var i=e._opts.keywords[t];e.addKeyword(t,i)}}function F(e,t){if(e._schemas[t]||e._refs[t])throw new Error('schema with key or id "'+t+'" already exists')}function P(e){for(var t=d.copy(e._opts),i=0;i<m.length;i++)delete t[m[i]];return t}function K(e){var t=e._opts.logger;if(!1===t)e.logger={log:M,warn:M,error:M};else{if(void 0===t&&(t=console),!("object"==typeof t&&t.log&&t.warn&&t.error))throw new Error("logger must implement log, warn and error methods");e.logger=t}}function M(){}},function(e,t,i){"use strict";var n=i(17),r=i(7),s=i(19),o=i(26),a=i(27),l=r.ucs2length,c=i(18),h=s.Validation;function d(e,t,i,p){var v=this,b=this._opts,y=[void 0],w={},S=[],x={},k=[],R={},E=[];t=t||{schema:e,refVal:y,refs:w};var B=u.call(this,e,t,p),Z=this._compilations[B.index];if(B.compiling)return Z.callValidate=H;var G=this._formats,T=this.RULES;try{var W=$(e,t,i,p);Z.validate=W;var _=Z.callValidate;return _&&(_.schema=W.schema,_.errors=null,_.refs=W.refs,_.refVal=W.refVal,_.root=W.root,_.$async=W.$async,b.sourceCode&&(_.source=W.source)),W}finally{g.call(this,e,t,p)}function H(){var e=Z.validate,t=e.apply(this,arguments);return H.errors=e.errors,t}function $(e,i,o,u){var g=!i||i&&i.schema==e;if(i.schema!=t.schema)return d.call(v,e,i,o,u);var p,x=!0===e.$async,R=a({isTop:!0,schema:e,isRoot:g,baseId:u,root:i,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:s.MissingRef,RULES:T,validate:a,util:r,resolve:n,resolveRef:V,usePattern:P,useDefault:K,useCustomRule:M,opts:b,formats:G,logger:v.logger,self:v});R=A(y,C)+A(S,m)+A(k,f)+A(E,I)+R,b.processCode&&(R=b.processCode(R));try{var B=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",R);p=B(v,T,G,t,y,k,E,c,l,h),y[0]=p}catch(Z){throw v.logger.error("Error compiling schema, function code:",R),Z}return p.schema=e,p.errors=null,p.refs=w,p.refVal=y,p.root=g?p:i,x&&(p.$async=!0),!0===b.sourceCode&&(p.source={code:R,patterns:S,defaults:k}),p}function V(e,r,s){r=n.url(e,r);var o,a,l=w[r];if(void 0!==l)return o=y[l],a="refVal["+l+"]",F(o,a);if(!s&&t.refs){var c=t.refs[r];if(void 0!==c)return o=t.refVal[c],a=L(r,o),F(o,a)}a=L(r);var h=n.call(v,$,t,r);if(void 0===h){var u=i&&i[r];u&&(h=n.inlineRef(u,b.inlineRefs)?u:d.call(v,u,t,i,e))}if(void 0!==h)return O(r,h),F(h,a);N(r)}function L(e,t){var i=y.length;return y[i]=t,w[e]=i,"refVal"+i}function N(e){delete w[e]}function O(e,t){var i=w[e];y[i]=t}function F(e,t){return"object"==typeof e||"boolean"==typeof e?{code:t,schema:e,inline:!0}:{code:t,$async:e&&!!e.$async}}function P(e){var t=x[e];return void 0===t&&(t=x[e]=S.length,S[t]=e),"pattern"+t}function K(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return r.toQuotedString(e);case"object":if(null===e)return"null";var t=o(e),i=R[t];return void 0===i&&(i=R[t]=k.length,k[i]=e),"default"+i}}function M(e,t,i,n){if(!1!==v._opts.validateSchema){var r=e.definition.dependencies;if(r&&!r.every((function(e){return Object.prototype.hasOwnProperty.call(i,e)})))throw new Error("parent schema must have all required keywords: "+r.join(","));var s=e.definition.validateSchema;if(s){var o=s(t);if(!o){var a="keyword schema is invalid: "+v.errorsText(s.errors);if("log"!=v._opts.validateSchema)throw new Error(a);v.logger.error(a)}}}var l,c=e.definition.compile,h=e.definition.inline,d=e.definition.macro;if(c)l=c.call(v,t,i,n);else if(d)l=d.call(v,t,i,n),!1!==b.validateSchema&&v.validateSchema(l,!0);else if(h)l=h.call(v,n,e.keyword,t,i);else if(l=e.definition.validate,!l)return;if(void 0===l)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var u=E.length;return E[u]=l,{code:"customRule"+u,validate:l}}}function u(e,t,i){var n=p.call(this,e,t,i);return n>=0?{index:n,compiling:!0}:(n=this._compilations.length,this._compilations[n]={schema:e,root:t,baseId:i},{index:n,compiling:!1})}function g(e,t,i){var n=p.call(this,e,t,i);n>=0&&this._compilations.splice(n,1)}function p(e,t,i){for(var n=0;n<this._compilations.length;n++){var r=this._compilations[n];if(r.schema==e&&r.root==t&&r.baseId==i)return n}return-1}function m(e,t){return"var pattern"+e+" = new RegExp("+r.toQuotedString(t[e])+");"}function f(e){return"var default"+e+" = defaults["+e+"];"}function C(e,t){return void 0===t[e]?"":"var refVal"+e+" = refVal["+e+"];"}function I(e){return"var customRule"+e+" = customRules["+e+"];"}function A(e,t){if(!e.length)return"";for(var i="",n=0;n<e.length;n++)i+=t(n,e);return i}e.exports=d},function(e,t,i){
| /** @license URI.js v4.2.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
| (function(e,i){i(t)})(0,(function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t.length>1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,r=1;r<n;++r)t[r]=t[r].slice(1,-1);return t[n]=t[n].slice(1),t.join("")}return t[0]}function i(e){return"(?:"+e+")"}function n(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function r(e){return e.toUpperCase()}function s(e){return void 0!==e&&null!==e?e instanceof Array?e:"number"!==typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function o(e,t){var i=e;if(t)for(var n in t)i[n]=t[n];return i}function a(e){var n="[A-Za-z]",r="[0-9]",s=t(r,"[A-Fa-f]"),o=i(i("%[EFef]"+s+"%"+s+s+"%"+s+s)+"|"+i("%[89A-Fa-f]"+s+"%"+s+s)+"|"+i("%"+s+s)),a="[\\:\\/\\?\\#\\[\\]\\@]",l="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",c=t(a,l),h=e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",d=e?"[\\uE000-\\uF8FF]":"[]",u=t(n,r,"[\\-\\.\\_\\~]",h),g=i(n+t(n,r,"[\\+\\-\\.]")+"*"),p=i(i(o+"|"+t(u,l,"[\\:]"))+"*"),m=(i(i("25[0-5]")+"|"+i("2[0-4]"+r)+"|"+i("1"+r+r)+"|"+i("[1-9]"+r)+"|"+r),i(i("25[0-5]")+"|"+i("2[0-4]"+r)+"|"+i("1"+r+r)+"|"+i("0?[1-9]"+r)+"|0?0?"+r)),f=i(m+"\\."+m+"\\."+m+"\\."+m),C=i(s+"{1,4}"),I=i(i(C+"\\:"+C)+"|"+f),A=i(i(C+"\\:")+"{6}"+I),v=i("\\:\\:"+i(C+"\\:")+"{5}"+I),b=i(i(C)+"?\\:\\:"+i(C+"\\:")+"{4}"+I),y=i(i(i(C+"\\:")+"{0,1}"+C)+"?\\:\\:"+i(C+"\\:")+"{3}"+I),w=i(i(i(C+"\\:")+"{0,2}"+C)+"?\\:\\:"+i(C+"\\:")+"{2}"+I),S=i(i(i(C+"\\:")+"{0,3}"+C)+"?\\:\\:"+C+"\\:"+I),x=i(i(i(C+"\\:")+"{0,4}"+C)+"?\\:\\:"+I),k=i(i(i(C+"\\:")+"{0,5}"+C)+"?\\:\\:"+C),R=i(i(i(C+"\\:")+"{0,6}"+C)+"?\\:\\:"),E=i([A,v,b,y,w,S,x,k,R].join("|")),B=i(i(u+"|"+o)+"+"),Z=(i(E+"\\%25"+B),i(E+i("\\%25|\\%(?!"+s+"{2})")+B)),G=i("[vV]"+s+"+\\."+t(u,l,"[\\:]")+"+"),T=i("\\["+i(Z+"|"+E+"|"+G)+"\\]"),W=i(i(o+"|"+t(u,l))+"*"),_=i(T+"|"+f+"(?!"+W+")|"+W),H=i(r+"*"),$=i(i(p+"@")+"?"+_+i("\\:"+H)+"?"),V=i(o+"|"+t(u,l,"[\\:\\@]")),L=i(V+"*"),N=i(V+"+"),O=i(i(o+"|"+t(u,l,"[\\@]"))+"+"),F=i(i("\\/"+L)+"*"),P=i("\\/"+i(N+F)+"?"),K=i(O+F),M=i(N+F),j="(?!"+V+")",D=(i(F+"|"+P+"|"+K+"|"+M+"|"+j),i(i(V+"|"+t("[\\/\\?]",d))+"*")),X=i(i(V+"|[\\/\\?]")+"*"),Y=i(i("\\/\\/"+$+F)+"|"+P+"|"+M+"|"+j),z=i(g+"\\:"+Y+i("\\?"+D)+"?"+i("\\#"+X)+"?"),J=i(i("\\/\\/"+$+F)+"|"+P+"|"+K+"|"+j),U=i(J+i("\\?"+D)+"?"+i("\\#"+X)+"?");i(z+"|"+U),i(g+"\\:"+Y+i("\\?"+D)+"?"),i(i("\\/\\/("+i("("+p+")@")+"?("+_+")"+i("\\:("+H+")")+"?)")+"?("+F+"|"+P+"|"+M+"|"+j+")"),i("\\?("+D+")"),i("\\#("+X+")"),i(i("\\/\\/("+i("("+p+")@")+"?("+_+")"+i("\\:("+H+")")+"?)")+"?("+F+"|"+P+"|"+K+"|"+j+")"),i("\\?("+D+")"),i("\\#("+X+")"),i(i("\\/\\/("+i("("+p+")@")+"?("+_+")"+i("\\:("+H+")")+"?)")+"?("+F+"|"+P+"|"+M+"|"+j+")"),i("\\?("+D+")"),i("\\#("+X+")"),i("("+p+")@"),i("\\:("+H+")");return{NOT_SCHEME:new RegExp(t("[^]",n,r,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",u,l),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",u,l),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",u,l),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",u,l),"g"),NOT_QUERY:new RegExp(t("[^\\%]",u,l,"[\\:\\@\\/\\?]",d),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",u,l,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",u,l),"g"),UNRESERVED:new RegExp(u,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",u,c),"g"),PCT_ENCODED:new RegExp(o,"g"),IPV4ADDRESS:new RegExp("^("+f+")$"),IPV6ADDRESS:new RegExp("^\\[?("+E+")"+i(i("\\%25|\\%(?!"+s+"{2})")+"("+B+")")+"?\\]?$")}}var l=a(!1),c=a(!0),h=function(){function e(e,t){var i=[],n=!0,r=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(n=(o=a.next()).done);n=!0)if(i.push(o.value),t&&i.length===t)break}catch(l){r=!0,s=l}finally{try{!n&&a["return"]&&a["return"]()}finally{if(r)throw s}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)},u=2147483647,g=36,p=1,m=26,f=38,C=700,I=72,A=128,v="-",b=/^xn--/,y=/[^\0-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=g-p,k=Math.floor,R=String.fromCharCode;function E(e){throw new RangeError(S[e])}function B(e,t){var i=[],n=e.length;while(n--)i[n]=t(e[n]);return i}function Z(e,t){var i=e.split("@"),n="";i.length>1&&(n=i[0]+"@",e=i[1]),e=e.replace(w,".");var r=e.split("."),s=B(r,t).join(".");return n+s}function G(e){var t=[],i=0,n=e.length;while(i<n){var r=e.charCodeAt(i++);if(r>=55296&&r<=56319&&i<n){var s=e.charCodeAt(i++);56320==(64512&s)?t.push(((1023&r)<<10)+(1023&s)+65536):(t.push(r),i--)}else t.push(r)}return t}var T=function(e){return String.fromCodePoint.apply(String,d(e))},W=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:g},_=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},H=function(e,t,i){var n=0;for(e=i?k(e/C):e>>1,e+=k(e/t);e>x*m>>1;n+=g)e=k(e/x);return k(n+(x+1)*e/(e+f))},$=function(e){var t=[],i=e.length,n=0,r=A,s=I,o=e.lastIndexOf(v);o<0&&(o=0);for(var a=0;a<o;++a)e.charCodeAt(a)>=128&&E("not-basic"),t.push(e.charCodeAt(a));for(var l=o>0?o+1:0;l<i;){for(var c=n,h=1,d=g;;d+=g){l>=i&&E("invalid-input");var f=W(e.charCodeAt(l++));(f>=g||f>k((u-n)/h))&&E("overflow"),n+=f*h;var C=d<=s?p:d>=s+m?m:d-s;if(f<C)break;var b=g-C;h>k(u/b)&&E("overflow"),h*=b}var y=t.length+1;s=H(n-c,y,0==c),k(n/y)>u-r&&E("overflow"),r+=k(n/y),n%=y,t.splice(n++,0,r)}return String.fromCodePoint.apply(String,t)},V=function(e){var t=[];e=G(e);var i=e.length,n=A,r=0,s=I,o=!0,a=!1,l=void 0;try{for(var c,h=e[Symbol.iterator]();!(o=(c=h.next()).done);o=!0){var d=c.value;d<128&&t.push(R(d))}}catch(D){a=!0,l=D}finally{try{!o&&h.return&&h.return()}finally{if(a)throw l}}var f=t.length,C=f;f&&t.push(v);while(C<i){var b=u,y=!0,w=!1,S=void 0;try{for(var x,B=e[Symbol.iterator]();!(y=(x=B.next()).done);y=!0){var Z=x.value;Z>=n&&Z<b&&(b=Z)}}catch(D){w=!0,S=D}finally{try{!y&&B.return&&B.return()}finally{if(w)throw S}}var T=C+1;b-n>k((u-r)/T)&&E("overflow"),r+=(b-n)*T,n=b;var W=!0,$=!1,V=void 0;try{for(var L,N=e[Symbol.iterator]();!(W=(L=N.next()).done);W=!0){var O=L.value;if(O<n&&++r>u&&E("overflow"),O==n){for(var F=r,P=g;;P+=g){var K=P<=s?p:P>=s+m?m:P-s;if(F<K)break;var M=F-K,j=g-K;t.push(R(_(K+M%j,0))),F=k(M/j)}t.push(R(_(F,0))),s=H(r,T,C==f),r=0,++C}}}catch(D){$=!0,V=D}finally{try{!W&&N.return&&N.return()}finally{if($)throw V}}++r,++n}return t.join("")},L=function(e){return Z(e,(function(e){return b.test(e)?$(e.slice(4).toLowerCase()):e}))},N=function(e){return Z(e,(function(e){return y.test(e)?"xn--"+V(e):e}))},O={version:"2.1.0",ucs2:{decode:G,encode:T},decode:$,encode:V,toASCII:N,toUnicode:L},F={};function P(e){var t=e.charCodeAt(0),i=void 0;return i=t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase(),i}function K(e){var t="",i=0,n=e.length;while(i<n){var r=parseInt(e.substr(i+1,2),16);if(r<128)t+=String.fromCharCode(r),i+=3;else if(r>=194&&r<224){if(n-i>=6){var s=parseInt(e.substr(i+4,2),16);t+=String.fromCharCode((31&r)<<6|63&s)}else t+=e.substr(i,6);i+=6}else if(r>=224){if(n-i>=9){var o=parseInt(e.substr(i+4,2),16),a=parseInt(e.substr(i+7,2),16);t+=String.fromCharCode((15&r)<<12|(63&o)<<6|63&a)}else t+=e.substr(i,9);i+=9}else t+=e.substr(i,3),i+=3}return t}function M(e,t){function i(e){var i=K(e);return i.match(t.UNRESERVED)?i:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,i).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,i).replace(t.NOT_USERINFO,P).replace(t.PCT_ENCODED,r)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,i).toLowerCase().replace(t.NOT_HOST,P).replace(t.PCT_ENCODED,r)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,i).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,P).replace(t.PCT_ENCODED,r)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,i).replace(t.NOT_QUERY,P).replace(t.PCT_ENCODED,r)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,i).replace(t.NOT_FRAGMENT,P).replace(t.PCT_ENCODED,r)),e}function j(e){return e.replace(/^0*(.*)/,"$1")||"0"}function D(e,t){var i=e.match(t.IPV4ADDRESS)||[],n=h(i,2),r=n[1];return r?r.split(".").map(j).join("."):e}function X(e,t){var i=e.match(t.IPV6ADDRESS)||[],n=h(i,3),r=n[1],s=n[2];if(r){for(var o=r.toLowerCase().split("::").reverse(),a=h(o,2),l=a[0],c=a[1],d=c?c.split(":").map(j):[],u=l.split(":").map(j),g=t.IPV4ADDRESS.test(u[u.length-1]),p=g?7:8,m=u.length-p,f=Array(p),C=0;C<p;++C)f[C]=d[C]||u[m+C]||"";g&&(f[p-1]=D(f[p-1],t));var I=f.reduce((function(e,t,i){if(!t||"0"===t){var n=e[e.length-1];n&&n.index+n.length===i?n.length++:e.push({index:i,length:1})}return e}),[]),A=I.sort((function(e,t){return t.length-e.length}))[0],v=void 0;if(A&&A.length>1){var b=f.slice(0,A.index),y=f.slice(A.index+A.length);v=b.join(":")+"::"+y.join(":")}else v=f.join(":");return s&&(v+="%"+s),v}return e}var Y=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,z=void 0==="".match(/(){0}/)[1];function J(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={},n=!1!==t.iri?c:l;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var r=e.match(Y);if(r){z?(i.scheme=r[1],i.userinfo=r[3],i.host=r[4],i.port=parseInt(r[5],10),i.path=r[6]||"",i.query=r[7],i.fragment=r[8],isNaN(i.port)&&(i.port=r[5])):(i.scheme=r[1]||void 0,i.userinfo=-1!==e.indexOf("@")?r[3]:void 0,i.host=-1!==e.indexOf("//")?r[4]:void 0,i.port=parseInt(r[5],10),i.path=r[6]||"",i.query=-1!==e.indexOf("?")?r[7]:void 0,i.fragment=-1!==e.indexOf("#")?r[8]:void 0,isNaN(i.port)&&(i.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?r[4]:void 0)),i.host&&(i.host=X(D(i.host,n),n)),void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||i.path||void 0!==i.query?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==i.reference&&(i.error=i.error||"URI is not a "+t.reference+" reference.");var s=F[(t.scheme||i.scheme||"").toLowerCase()];if(t.unicodeSupport||s&&s.unicodeSupport)M(i,n);else{if(i.host&&(t.domainHost||s&&s.domainHost))try{i.host=O.toASCII(i.host.replace(n.PCT_ENCODED,K).toLowerCase())}catch(o){i.error=i.error||"Host's domain name can not be converted to ASCII via punycode: "+o}M(i,l)}s&&s.parse&&s.parse(i,t)}else i.error=i.error||"URI can not be parsed.";return i}function U(e,t){var i=!1!==t.iri?c:l,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(X(D(String(e.host),i),i).replace(i.IPV6ADDRESS,(function(e,t,i){return"["+t+(i?"%25"+i:"")+"]"}))),"number"===typeof e.port&&(n.push(":"),n.push(e.port.toString(10))),n.length?n.join(""):void 0}var Q=/^\.\.?\//,q=/^\/\.(\/|$)/,ee=/^\/\.\.(\/|$)/,te=/^\/?(?:.|\n)*?(?=\/|$)/;function ie(e){var t=[];while(e.length)if(e.match(Q))e=e.replace(Q,"");else if(e.match(q))e=e.replace(q,"/");else if(e.match(ee))e=e.replace(ee,"/"),t.pop();else if("."===e||".."===e)e="";else{var i=e.match(te);if(!i)throw new Error("Unexpected dot segment condition");var n=i[0];e=e.slice(n.length),t.push(n)}return t.join("")}function ne(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.iri?c:l,n=[],r=F[(t.scheme||e.scheme||"").toLowerCase()];if(r&&r.serialize&&r.serialize(e,t),e.host)if(i.IPV6ADDRESS.test(e.host));else if(t.domainHost||r&&r.domainHost)try{e.host=t.iri?O.toUnicode(e.host):O.toASCII(e.host.replace(i.PCT_ENCODED,K).toLowerCase())}catch(a){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+a}M(e,i),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var s=U(e,t);if(void 0!==s&&("suffix"!==t.reference&&n.push("//"),n.push(s),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var o=e.path;t.absolutePath||r&&r.absolutePath||(o=ie(o)),void 0===s&&(o=o.replace(/^\/\//,"/%2F")),n.push(o)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function re(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments[3],r={};return n||(e=J(ne(e,i),i),t=J(ne(t,i),i)),i=i||{},!i.tolerant&&t.scheme?(r.scheme=t.scheme,r.userinfo=t.userinfo,r.host=t.host,r.port=t.port,r.path=ie(t.path||""),r.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(r.userinfo=t.userinfo,r.host=t.host,r.port=t.port,r.path=ie(t.path||""),r.query=t.query):(t.path?("/"===t.path.charAt(0)?r.path=ie(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?r.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:r.path=t.path:r.path="/"+t.path,r.path=ie(r.path)),r.query=t.query):(r.path=e.path,void 0!==t.query?r.query=t.query:r.query=e.query),r.userinfo=e.userinfo,r.host=e.host,r.port=e.port),r.scheme=e.scheme),r.fragment=t.fragment,r}function se(e,t,i){var n=o({scheme:"null"},i);return ne(re(J(e,n),J(t,n),n,!0),n)}function oe(e,t){return"string"===typeof e?e=ne(J(e,t),t):"object"===n(e)&&(e=J(ne(e,t),t)),e}function ae(e,t,i){return"string"===typeof e?e=ne(J(e,i),i):"object"===n(e)&&(e=ne(e,i)),"string"===typeof t?t=ne(J(t,i),i):"object"===n(t)&&(t=ne(t,i)),e===t}function le(e,t){return e&&e.toString().replace(t&&t.iri?c.ESCAPE:l.ESCAPE,P)}function ce(e,t){return e&&e.toString().replace(t&&t.iri?c.PCT_ENCODED:l.PCT_ENCODED,K)}var he={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){return e.port!==("https"!==String(e.scheme).toLowerCase()?80:443)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},de={scheme:"https",domainHost:he.domainHost,parse:he.parse,serialize:he.serialize},ue={},ge=!0,pe="[A-Za-z0-9\\-\\.\\_\\~"+(ge?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",me="[0-9A-Fa-f]",fe=i(i("%[EFef]"+me+"%"+me+me+"%"+me+me)+"|"+i("%[89A-Fa-f]"+me+"%"+me+me)+"|"+i("%"+me+me)),Ce="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ie="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Ae=t(Ie,'[\\"\\\\]'),ve="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",be=new RegExp(pe,"g"),ye=new RegExp(fe,"g"),we=new RegExp(t("[^]",Ce,"[\\.]",'[\\"]',Ae),"g"),Se=new RegExp(t("[^]",pe,ve),"g"),xe=Se;function ke(e){var t=K(e);return t.match(be)?t:e}var Re={scheme:"mailto",parse:function(e,t){var i=e,n=i.to=i.path?i.path.split(","):[];if(i.path=void 0,i.query){for(var r=!1,s={},o=i.query.split("&"),a=0,l=o.length;a<l;++a){var c=o[a].split("=");switch(c[0]){case"to":for(var h=c[1].split(","),d=0,u=h.length;d<u;++d)n.push(h[d]);break;case"subject":i.subject=ce(c[1],t);break;case"body":i.body=ce(c[1],t);break;default:r=!0,s[ce(c[0],t)]=ce(c[1],t);break}}r&&(i.headers=s)}i.query=void 0;for(var g=0,p=n.length;g<p;++g){var m=n[g].split("@");if(m[0]=ce(m[0]),t.unicodeSupport)m[1]=ce(m[1],t).toLowerCase();else try{m[1]=O.toASCII(ce(m[1],t).toLowerCase())}catch(f){i.error=i.error||"Email address's domain name can not be converted to ASCII via punycode: "+f}n[g]=m.join("@")}return i},serialize:function(e,t){var i=e,n=s(e.to);if(n){for(var o=0,a=n.length;o<a;++o){var l=String(n[o]),c=l.lastIndexOf("@"),h=l.slice(0,c).replace(ye,ke).replace(ye,r).replace(we,P),d=l.slice(c+1);try{d=t.iri?O.toUnicode(d):O.toASCII(ce(d,t).toLowerCase())}catch(m){i.error=i.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+m}n[o]=h+"@"+d}i.path=n.join(",")}var u=e.headers=e.headers||{};e.subject&&(u["subject"]=e.subject),e.body&&(u["body"]=e.body);var g=[];for(var p in u)u[p]!==ue[p]&&g.push(p.replace(ye,ke).replace(ye,r).replace(Se,P)+"="+u[p].replace(ye,ke).replace(ye,r).replace(xe,P));return g.length&&(i.query=g.join("&")),i}},Ee=/^([^\:]+)\:(.*)/,Be={scheme:"urn",parse:function(e,t){var i=e.path&&e.path.match(Ee),n=e;if(i){var r=t.scheme||n.scheme||"urn",s=i[1].toLowerCase(),o=i[2],a=r+":"+(t.nid||s),l=F[a];n.nid=s,n.nss=o,n.path=void 0,l&&(n=l.parse(n,t))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(e,t){var i=t.scheme||e.scheme||"urn",n=e.nid,r=i+":"+(t.nid||n),s=F[r];s&&(e=s.serialize(e,t));var o=e,a=e.nss;return o.path=(n||t.nid)+":"+a,o}},Ze=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ge={scheme:"urn:uuid",parse:function(e,t){var i=e;return i.uuid=i.nss,i.nss=void 0,t.tolerant||i.uuid&&i.uuid.match(Ze)||(i.error=i.error||"UUID is not valid."),i},serialize:function(e,t){var i=e;return i.nss=(e.uuid||"").toLowerCase(),i}};F[he.scheme]=he,F[de.scheme]=de,F[Re.scheme]=Re,F[Be.scheme]=Be,F[Ge.scheme]=Ge,e.SCHEMES=F,e.pctEncChar=P,e.pctDecChars=K,e.parse=J,e.removeDotSegments=ie,e.serialize=ne,e.resolveComponents=re,e.resolve=se,e.normalize=oe,e.equal=ae,e.escapeComponent=le,e.unescapeComponent=ce,Object.defineProperty(e,"__esModule",{value:!0})}))},function(e,t,i){"use strict";e.exports=function(e){var t,i=0,n=e.length,r=0;while(r<n)i++,t=e.charCodeAt(r++),t>=55296&&t<=56319&&r<n&&(t=e.charCodeAt(r),56320==(64512&t)&&r++);return i}},function(e,t,i){"use strict";var n=e.exports=function(e,t,i){"function"==typeof t&&(i=t,t={}),i=t.cb||i;var n="function"==typeof i?i:i.pre||function(){},s=i.post||function(){};r(t,n,s,e,"",e)};function r(e,t,i,o,a,l,c,h,d,u){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var g in t(o,a,l,c,h,d,u),o){var p=o[g];if(Array.isArray(p)){if(g in n.arrayKeywords)for(var m=0;m<p.length;m++)r(e,t,i,p[m],a+"/"+g+"/"+m,l,a,g,o,m)}else if(g in n.propsKeywords){if(p&&"object"==typeof p)for(var f in p)r(e,t,i,p[f],a+"/"+g+"/"+s(f),l,a,g,o,f)}else(g in n.keywords||e.allKeys&&!(g in n.skipKeywords))&&r(e,t,i,p,a+"/"+g,l,a,g,o)}i(o,a,l,c,h,d,u)}}function s(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},function(e,t,i){"use strict";var n=e.exports=function(){this._cache={}};n.prototype.put=function(e,t){this._cache[e]=t},n.prototype.get=function(e){return this._cache[e]},n.prototype.del=function(e){delete this._cache[e]},n.prototype.clear=function(){this._cache={}}},function(e,t,i){"use strict";var n=i(7),r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31],o=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,a=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,l=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,c=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,h=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,d=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,u=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,g=/^(?:\/(?:[^~/]|~0|~1)*)*$/,p=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,m=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function f(e){return e="full"==e?"full":"fast",n.copy(f[e])}function C(e){return e%4===0&&(e%100!==0||e%400===0)}function I(e){var t=e.match(r);if(!t)return!1;var i=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(2==n&&C(i)?29:s[n])}function A(e,t){var i=e.match(o);if(!i)return!1;var n=i[1],r=i[2],s=i[3],a=i[5];return(n<=23&&r<=59&&s<=59||23==n&&59==r&&60==s)&&(!t||a)}e.exports=f,f.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":h,url:d,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:a,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:x,uuid:u,"json-pointer":g,"json-pointer-uri-fragment":p,"relative-json-pointer":m},f.full={date:I,time:A,"date-time":b,uri:w,"uri-reference":c,"uri-template":h,url:d,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:a,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:x,uuid:u,"json-pointer":g,"json-pointer-uri-fragment":p,"relative-json-pointer":m};var v=/t|\s/i;function b(e){var t=e.split(v);return 2==t.length&&I(t[0])&&A(t[1],!0)}var y=/\/|:/;function w(e){return y.test(e)&&l.test(e)}var S=/[^\\]\\Z/;function x(e){if(S.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}},function(e,t,i){"use strict";var n=i(52),r=i(7).toHash;e.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],i=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],s=["number","integer","string","array","object","boolean","null"];return e.all=r(t),e.types=r(s),e.forEach((function(i){i.rules=i.rules.map((function(i){var r;if("object"==typeof i){var s=Object.keys(i)[0];r=i[s],i=s,r.forEach((function(i){t.push(i),e.all[i]=!0}))}t.push(i);var o=e.all[i]={keyword:i,code:n[i],implements:r};return o})),e.all.$comment={keyword:"$comment",code:n.$comment},i.type&&(e.types[i.type]=i)})),e.keywords=r(t.concat(i)),e.custom={},e}},function(e,t,i){"use strict";e.exports={$ref:i(53),allOf:i(54),anyOf:i(55),$comment:i(56),const:i(57),contains:i(58),dependencies:i(59),enum:i(60),format:i(61),if:i(62),items:i(63),maximum:i(28),minimum:i(28),maxItems:i(29),minItems:i(29),maxLength:i(30),minLength:i(30),maxProperties:i(31),minProperties:i(31),multipleOf:i(64),not:i(65),oneOf:i(66),pattern:i(67),properties:i(68),propertyNames:i(69),required:i(70),uniqueItems:i(71),validate:i(27)}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n,r,s=" ",o=e.level,a=e.dataLevel,l=e.schema[t],c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,d="data"+(a||""),u="valid"+o;if("#"==l||"#/"==l)e.isRoot?(n=e.async,r="validate"):(n=!0===e.root.schema.$async,r="root.refVal[0]");else{var g=e.resolveRef(e.baseId,l,e.isRoot);if(void 0===g){var p=e.MissingRefError.message(e.baseId,l);if("fail"==e.opts.missingRefs){e.logger.error(p);var m=m||[];m.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",!1!==e.opts.messages&&(s+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(s+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),s+=" } "):s+=" {} ";var f=s;s=m.pop(),!e.compositeRule&&h?e.async?s+=" throw new ValidationError(["+f+"]); ":s+=" validate.errors = ["+f+"]; return false; ":s+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(s+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs)throw new e.MissingRefError(e.baseId,l,p);e.logger.warn(p),h&&(s+=" if (true) { ")}}else if(g.inline){var C=e.util.copy(e);C.level++;var I="valid"+C.level;C.schema=g.schema,C.schemaPath="",C.errSchemaPath=l;var A=e.validate(C).replace(/validate\.schema/g,g.code);s+=" "+A+" ",h&&(s+=" if ("+I+") { ")}else n=!0===g.$async||e.async&&!1!==g.$async,r=g.code}if(r){m=m||[];m.push(s),s="",e.opts.passContext?s+=" "+r+".call(this, ":s+=" "+r+"( ",s+=" "+d+", (dataPath || '')",'""'!=e.errorPath&&(s+=" + "+e.errorPath);var v=a?"data"+(a-1||""):"parentData",b=a?e.dataPathArr[a]:"parentDataProperty";s+=" , "+v+" , "+b+", rootData) ";var y=s;if(s=m.pop(),n){if(!e.async)throw new Error("async schema referenced by sync schema");h&&(s+=" var "+u+"; "),s+=" try { await "+y+"; ",h&&(s+=" "+u+" = true; "),s+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",h&&(s+=" "+u+" = false; "),s+=" } ",h&&(s+=" if ("+u+") { ")}else s+=" if (!"+y+") { if (vErrors === null) vErrors = "+r+".errors; else vErrors = vErrors.concat("+r+".errors); errors = vErrors.length; } ",h&&(s+=" else { ")}return s}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.schema[t],s=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,a=!e.opts.allErrors,l=e.util.copy(e),c="";l.level++;var h="valid"+l.level,d=l.baseId,u=!0,g=r;if(g){var p,m=-1,f=g.length-1;while(m<f)p=g[m+=1],(e.opts.strictKeywords?"object"==typeof p&&Object.keys(p).length>0:e.util.schemaHasRules(p,e.RULES.all))&&(u=!1,l.schema=p,l.schemaPath=s+"["+m+"]",l.errSchemaPath=o+"/"+m,n+=" "+e.validate(l)+" ",l.baseId=d,a&&(n+=" if ("+h+") { ",c+="}"))}return a&&(n+=u?" if (true) { ":" "+c.slice(0,-1)+" "),n=e.util.cleanUpCode(n),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="valid"+r,u="errs__"+r,g=e.util.copy(e),p="";g.level++;var m="valid"+g.level,f=o.every((function(t){return e.opts.strictKeywords?"object"==typeof t&&Object.keys(t).length>0:e.util.schemaHasRules(t,e.RULES.all)}));if(f){var C=g.baseId;n+=" var "+u+" = errors; var "+d+" = false; ";var I=e.compositeRule;e.compositeRule=g.compositeRule=!0;var A=o;if(A){var v,b=-1,y=A.length-1;while(b<y)v=A[b+=1],g.schema=v,g.schemaPath=a+"["+b+"]",g.errSchemaPath=l+"/"+b,n+=" "+e.validate(g)+" ",g.baseId=C,n+=" "+d+" = "+d+" || "+m+"; if (!"+d+") { ",p+="}"}e.compositeRule=g.compositeRule=I,n+=" "+p+" if (!"+d+") { var err = ",!1!==e.createErrors?(n+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(n+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } "),n=e.util.cleanUpCode(n)}else c&&(n+=" if (true) { ");return n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.schema[t],s=e.errSchemaPath+"/"+t,o=(e.opts.allErrors,e.util.toQuotedString(r));return!0===e.opts.$comment?n+=" console.log("+o+");":"function"==typeof e.opts.$comment&&(n+=" self._opts.$comment("+o+", "+e.util.toQuotedString(s)+", validate.root.schema);"),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="valid"+r,u=e.opts.$data&&o&&o.$data;u&&(n+=" var schema"+r+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; "),u||(n+=" var schema"+r+" = validate.schema"+a+";"),n+="var "+d+" = equal("+h+", schema"+r+"); if (!"+d+") { ";var g=g||[];g.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValue: schema"+r+" } ",!1!==e.opts.messages&&(n+=" , message: 'should be equal to constant' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var p=n;return n=g.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+p+"]); ":n+=" validate.errors = ["+p+"]; return false; ":n+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",c&&(n+=" else { "),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="valid"+r,u="errs__"+r,g=e.util.copy(e),p="";g.level++;var m="valid"+g.level,f="i"+r,C=g.dataLevel=e.dataLevel+1,I="data"+C,A=e.baseId,v=e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0:e.util.schemaHasRules(o,e.RULES.all);if(n+="var "+u+" = errors;var "+d+";",v){var b=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=o,g.schemaPath=a,g.errSchemaPath=l,n+=" var "+m+" = false; for (var "+f+" = 0; "+f+" < "+h+".length; "+f+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers,!0);var y=h+"["+f+"]";g.dataPathArr[C]=f;var w=e.validate(g);g.baseId=A,e.util.varOccurences(w,I)<2?n+=" "+e.util.varReplace(w,I,y)+" ":n+=" var "+I+" = "+y+"; "+w+" ",n+=" if ("+m+") break; } ",e.compositeRule=g.compositeRule=b,n+=" "+p+" if (!"+m+") {"}else n+=" if ("+h+".length == 0) {";var S=S||[];S.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(n+=" , message: 'should contain a valid item' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var x=n;return n=S.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",v&&(n+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } "),e.opts.allErrors&&(n+=" } "),n=e.util.cleanUpCode(n),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="errs__"+r,u=e.util.copy(e),g="";u.level++;var p="valid"+u.level,m={},f={},C=e.opts.ownProperties;for(b in o){var I=o[b],A=Array.isArray(I)?f:m;A[b]=I}n+="var "+d+" = errors;";var v=e.errorPath;for(var b in n+="var missing"+r+";",f)if(A=f[b],A.length){if(n+=" if ( "+h+e.util.getProperty(b)+" !== undefined ",C&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(b)+"') "),c){n+=" && ( ";var y=A;if(y){var w=-1,S=y.length-1;while(w<S){T=y[w+=1],w&&(n+=" || ");var x=e.util.getProperty(T),k=h+x;n+=" ( ( "+k+" === undefined ",C&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(T)+"') "),n+=") && (missing"+r+" = "+e.util.toQuotedString(e.opts.jsonPointers?T:x)+") ) "}}n+=")) { ";var R="missing"+r,E="' + "+R+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(v,R,!0):v+" + "+R);var B=B||[];B.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(b)+"', missingProperty: '"+E+"', depsCount: "+A.length+", deps: '"+e.util.escapeQuotes(1==A.length?A[0]:A.join(", "))+"' } ",!1!==e.opts.messages&&(n+=" , message: 'should have ",1==A.length?n+="property "+e.util.escapeQuotes(A[0]):n+="properties "+e.util.escapeQuotes(A.join(", ")),n+=" when property "+e.util.escapeQuotes(b)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var Z=n;n=B.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+Z+"]); ":n+=" validate.errors = ["+Z+"]; return false; ":n+=" var err = "+Z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{n+=" ) { ";var G=A;if(G){var T,W=-1,_=G.length-1;while(W<_){T=G[W+=1];x=e.util.getProperty(T),E=e.util.escapeQuotes(T),k=h+x;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(v,T,e.opts.jsonPointers)),n+=" if ( "+k+" === undefined ",C&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(T)+"') "),n+=") { var err = ",!1!==e.createErrors?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(b)+"', missingProperty: '"+E+"', depsCount: "+A.length+", deps: '"+e.util.escapeQuotes(1==A.length?A[0]:A.join(", "))+"' } ",!1!==e.opts.messages&&(n+=" , message: 'should have ",1==A.length?n+="property "+e.util.escapeQuotes(A[0]):n+="properties "+e.util.escapeQuotes(A.join(", ")),n+=" when property "+e.util.escapeQuotes(b)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}n+=" } ",c&&(g+="}",n+=" else { ")}e.errorPath=v;var H=u.baseId;for(var b in m){I=m[b];(e.opts.strictKeywords?"object"==typeof I&&Object.keys(I).length>0:e.util.schemaHasRules(I,e.RULES.all))&&(n+=" "+p+" = true; if ( "+h+e.util.getProperty(b)+" !== undefined ",C&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(b)+"') "),n+=") { ",u.schema=I,u.schemaPath=a+e.util.getProperty(b),u.errSchemaPath=l+"/"+e.util.escapeFragment(b),n+=" "+e.validate(u)+" ",u.baseId=H,n+=" } ",c&&(n+=" if ("+p+") { ",g+="}"))}return c&&(n+=" "+g+" if ("+d+" == errors) {"),n=e.util.cleanUpCode(n),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="valid"+r,u=e.opts.$data&&o&&o.$data;u&&(n+=" var schema"+r+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ");var g="i"+r,p="schema"+r;u||(n+=" var "+p+" = validate.schema"+a+";"),n+="var "+d+";",u&&(n+=" if (schema"+r+" === undefined) "+d+" = true; else if (!Array.isArray(schema"+r+")) "+d+" = false; else {"),n+=d+" = false;for (var "+g+"=0; "+g+"<"+p+".length; "+g+"++) if (equal("+h+", "+p+"["+g+"])) { "+d+" = true; break; }",u&&(n+=" } "),n+=" if (!"+d+") { ";var m=m||[];m.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValues: schema"+r+" } ",!1!==e.opts.messages&&(n+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var f=n;return n=m.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+f+"]); ":n+=" validate.errors = ["+f+"]; return false; ":n+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",c&&(n+=" else { "),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||"");if(!1===e.opts.format)return c&&(n+=" if (true) { "),n;var d,u=e.opts.$data&&o&&o.$data;u?(n+=" var schema"+r+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+r):d=o;var g=e.opts.unknownFormats,p=Array.isArray(g);if(u){var m="format"+r,f="isObject"+r,C="formatType"+r;n+=" var "+m+" = formats["+d+"]; var "+f+" = typeof "+m+" == 'object' && !("+m+" instanceof RegExp) && "+m+".validate; var "+C+" = "+f+" && "+m+".type || 'string'; if ("+f+") { ",e.async&&(n+=" var async"+r+" = "+m+".async; "),n+=" "+m+" = "+m+".validate; } if ( ",u&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" (","ignore"!=g&&(n+=" ("+d+" && !"+m+" ",p&&(n+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),n+=") || "),n+=" ("+m+" && "+C+" == '"+i+"' && !(typeof "+m+" == 'function' ? ",e.async?n+=" (async"+r+" ? await "+m+"("+h+") : "+m+"("+h+")) ":n+=" "+m+"("+h+") ",n+=" : "+m+".test("+h+"))))) {"}else{m=e.formats[o];if(!m){if("ignore"==g)return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),c&&(n+=" if (true) { "),n;if(p&&g.indexOf(o)>=0)return c&&(n+=" if (true) { "),n;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}f="object"==typeof m&&!(m instanceof RegExp)&&m.validate,C=f&&m.type||"string";if(f){var I=!0===m.async;m=m.validate}if(C!=i)return c&&(n+=" if (true) { "),n;if(I){if(!e.async)throw new Error("async format in sync schema");var A="formats"+e.util.getProperty(o)+".validate";n+=" if (!(await "+A+"("+h+"))) { "}else{n+=" if (! ";A="formats"+e.util.getProperty(o);f&&(A+=".validate"),n+="function"==typeof m?" "+A+"("+h+") ":" "+A+".test("+h+") ",n+=") { "}}var v=v||[];v.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { format: ",n+=u?""+d:""+e.util.toQuotedString(o),n+=" } ",!1!==e.opts.messages&&(n+=" , message: 'should match format \"",n+=u?"' + "+d+" + '":""+e.util.escapeQuotes(o),n+="\"' "),e.opts.verbose&&(n+=" , schema: ",n+=u?"validate.schema"+a:""+e.util.toQuotedString(o),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var b=n;return n=v.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",c&&(n+=" else { "),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="valid"+r,u="errs__"+r,g=e.util.copy(e);g.level++;var p="valid"+g.level,m=e.schema["then"],f=e.schema["else"],C=void 0!==m&&(e.opts.strictKeywords?"object"==typeof m&&Object.keys(m).length>0:e.util.schemaHasRules(m,e.RULES.all)),I=void 0!==f&&(e.opts.strictKeywords?"object"==typeof f&&Object.keys(f).length>0:e.util.schemaHasRules(f,e.RULES.all)),A=g.baseId;if(C||I){var v;g.createErrors=!1,g.schema=o,g.schemaPath=a,g.errSchemaPath=l,n+=" var "+u+" = errors; var "+d+" = true; ";var b=e.compositeRule;e.compositeRule=g.compositeRule=!0,n+=" "+e.validate(g)+" ",g.baseId=A,g.createErrors=!0,n+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=b,C?(n+=" if ("+p+") { ",g.schema=e.schema["then"],g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",n+=" "+e.validate(g)+" ",g.baseId=A,n+=" "+d+" = "+p+"; ",C&&I?(v="ifClause"+r,n+=" var "+v+" = 'then'; "):v="'then'",n+=" } ",I&&(n+=" else { ")):n+=" if (!"+p+") { ",I&&(g.schema=e.schema["else"],g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",n+=" "+e.validate(g)+" ",g.baseId=A,n+=" "+d+" = "+p+"; ",C&&I?(v="ifClause"+r,n+=" var "+v+" = 'else'; "):v="'else'",n+=" } "),n+=" if (!"+d+") { var err = ",!1!==e.createErrors?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { failingKeyword: "+v+" } ",!1!==e.opts.messages&&(n+=" , message: 'should match \"' + "+v+" + '\" schema' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",c&&(n+=" else { "),n=e.util.cleanUpCode(n)}else c&&(n+=" if (true) { ");return n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="valid"+r,u="errs__"+r,g=e.util.copy(e),p="";g.level++;var m="valid"+g.level,f="i"+r,C=g.dataLevel=e.dataLevel+1,I="data"+C,A=e.baseId;if(n+="var "+u+" = errors;var "+d+";",Array.isArray(o)){var v=e.schema.additionalItems;if(!1===v){n+=" "+d+" = "+h+".length <= "+o.length+"; ";var b=l;l=e.errSchemaPath+"/additionalItems",n+=" if (!"+d+") { ";var y=y||[];y.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+o.length+" } ",!1!==e.opts.messages&&(n+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var w=n;n=y.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",l=b,c&&(p+="}",n+=" else { ")}var S=o;if(S){var x,k=-1,R=S.length-1;while(k<R)if(x=S[k+=1],e.opts.strictKeywords?"object"==typeof x&&Object.keys(x).length>0:e.util.schemaHasRules(x,e.RULES.all)){n+=" "+m+" = true; if ("+h+".length > "+k+") { ";var E=h+"["+k+"]";g.schema=x,g.schemaPath=a+"["+k+"]",g.errSchemaPath=l+"/"+k,g.errorPath=e.util.getPathExpr(e.errorPath,k,e.opts.jsonPointers,!0),g.dataPathArr[C]=k;var B=e.validate(g);g.baseId=A,e.util.varOccurences(B,I)<2?n+=" "+e.util.varReplace(B,I,E)+" ":n+=" var "+I+" = "+E+"; "+B+" ",n+=" } ",c&&(n+=" if ("+m+") { ",p+="}")}}if("object"==typeof v&&(e.opts.strictKeywords?"object"==typeof v&&Object.keys(v).length>0:e.util.schemaHasRules(v,e.RULES.all))){g.schema=v,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",n+=" "+m+" = true; if ("+h+".length > "+o.length+") { for (var "+f+" = "+o.length+"; "+f+" < "+h+".length; "+f+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers,!0);E=h+"["+f+"]";g.dataPathArr[C]=f;B=e.validate(g);g.baseId=A,e.util.varOccurences(B,I)<2?n+=" "+e.util.varReplace(B,I,E)+" ":n+=" var "+I+" = "+E+"; "+B+" ",c&&(n+=" if (!"+m+") break; "),n+=" } } ",c&&(n+=" if ("+m+") { ",p+="}")}}else if(e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0:e.util.schemaHasRules(o,e.RULES.all)){g.schema=o,g.schemaPath=a,g.errSchemaPath=l,n+=" for (var "+f+" = 0; "+f+" < "+h+".length; "+f+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers,!0);E=h+"["+f+"]";g.dataPathArr[C]=f;B=e.validate(g);g.baseId=A,e.util.varOccurences(B,I)<2?n+=" "+e.util.varReplace(B,I,E)+" ":n+=" var "+I+" = "+E+"; "+B+" ",c&&(n+=" if (!"+m+") break; "),n+=" }"}return c&&(n+=" "+p+" if ("+u+" == errors) {"),n=e.util.cleanUpCode(n),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n,r=" ",s=e.level,o=e.dataLevel,a=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,d="data"+(o||""),u=e.opts.$data&&a&&a.$data;u?(r+=" var schema"+s+" = "+e.util.getData(a.$data,o,e.dataPathArr)+"; ",n="schema"+s):n=a,r+="var division"+s+";if (",u&&(r+=" "+n+" !== undefined && ( typeof "+n+" != 'number' || "),r+=" (division"+s+" = "+d+" / "+n+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+s+" !== parseInt(division"+s+") ",r+=" ) ",u&&(r+=" ) "),r+=" ) { ";var g=g||[];g.push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+n+" } ",!1!==e.opts.messages&&(r+=" , message: 'should be multiple of ",r+=u?"' + "+n:n+"'"),e.opts.verbose&&(r+=" , schema: ",r+=u?"validate.schema"+l:""+a,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var p=r;return r=g.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+p+"]); ":r+=" validate.errors = ["+p+"]; return false; ":r+=" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="errs__"+r,u=e.util.copy(e);u.level++;var g="valid"+u.level;if(e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0:e.util.schemaHasRules(o,e.RULES.all)){u.schema=o,u.schemaPath=a,u.errSchemaPath=l,n+=" var "+d+" = errors; ";var p,m=e.compositeRule;e.compositeRule=u.compositeRule=!0,u.createErrors=!1,u.opts.allErrors&&(p=u.opts.allErrors,u.opts.allErrors=!1),n+=" "+e.validate(u)+" ",u.createErrors=!0,p&&(u.opts.allErrors=p),e.compositeRule=u.compositeRule=m,n+=" if ("+g+") { ";var f=f||[];f.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var C=n;n=f.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+C+"]); ":n+=" validate.errors = ["+C+"]; return false; ":n+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else n+=" var err = ",!1!==e.createErrors?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(n+=" if (false) { ");return n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="valid"+r,u="errs__"+r,g=e.util.copy(e),p="";g.level++;var m="valid"+g.level,f=g.baseId,C="prevValid"+r,I="passingSchemas"+r;n+="var "+u+" = errors , "+C+" = false , "+d+" = false , "+I+" = null; ";var A=e.compositeRule;e.compositeRule=g.compositeRule=!0;var v=o;if(v){var b,y=-1,w=v.length-1;while(y<w)b=v[y+=1],(e.opts.strictKeywords?"object"==typeof b&&Object.keys(b).length>0:e.util.schemaHasRules(b,e.RULES.all))?(g.schema=b,g.schemaPath=a+"["+y+"]",g.errSchemaPath=l+"/"+y,n+=" "+e.validate(g)+" ",g.baseId=f):n+=" var "+m+" = true; ",y&&(n+=" if ("+m+" && "+C+") { "+d+" = false; "+I+" = ["+I+", "+y+"]; } else { ",p+="}"),n+=" if ("+m+") { "+d+" = "+C+" = true; "+I+" = "+y+"; }"}return e.compositeRule=g.compositeRule=A,n+=p+"if (!"+d+") { var err = ",!1!==e.createErrors?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { passingSchemas: "+I+" } ",!1!==e.opts.messages&&(n+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; }",e.opts.allErrors&&(n+=" } "),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n,r=" ",s=e.level,o=e.dataLevel,a=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,d="data"+(o||""),u=e.opts.$data&&a&&a.$data;u?(r+=" var schema"+s+" = "+e.util.getData(a.$data,o,e.dataPathArr)+"; ",n="schema"+s):n=a;var g=u?"(new RegExp("+n+"))":e.usePattern(a);r+="if ( ",u&&(r+=" ("+n+" !== undefined && typeof "+n+" != 'string') || "),r+=" !"+g+".test("+d+") ) { ";var p=p||[];p.push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",r+=u?""+n:""+e.util.toQuotedString(a),r+=" } ",!1!==e.opts.messages&&(r+=" , message: 'should match pattern \"",r+=u?"' + "+n+" + '":""+e.util.escapeQuotes(a),r+="\"' "),e.opts.verbose&&(r+=" , schema: ",r+=u?"validate.schema"+l:""+e.util.toQuotedString(a),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var m=r;return r=p.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+m+"]); ":r+=" validate.errors = ["+m+"]; return false; ":r+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="errs__"+r,u=e.util.copy(e),g="";u.level++;var p="valid"+u.level,m="key"+r,f="idx"+r,C=u.dataLevel=e.dataLevel+1,I="data"+C,A="dataProperties"+r,v=Object.keys(o||{}),b=e.schema.patternProperties||{},y=Object.keys(b),w=e.schema.additionalProperties,S=v.length||y.length,x=!1===w,k="object"==typeof w&&Object.keys(w).length,R=e.opts.removeAdditional,E=x||k||R,B=e.opts.ownProperties,Z=e.baseId,G=e.schema.required;if(G&&(!e.opts.$data||!G.$data)&&G.length<e.opts.loopRequired)var T=e.util.toHash(G);if(n+="var "+d+" = errors;var "+p+" = true;",B&&(n+=" var "+A+" = undefined;"),E){if(n+=B?" "+A+" = "+A+" || Object.keys("+h+"); for (var "+f+"=0; "+f+"<"+A+".length; "+f+"++) { var "+m+" = "+A+"["+f+"]; ":" for (var "+m+" in "+h+") { ",S){if(n+=" var isAdditional"+r+" = !(false ",v.length)if(v.length>8)n+=" || validate.schema"+a+".hasOwnProperty("+m+") ";else{var W=v;if(W){var _=-1,H=W.length-1;while(_<H)z=W[_+=1],n+=" || "+m+" == "+e.util.toQuotedString(z)+" "}}if(y.length){var $=y;if($){var V=-1,L=$.length-1;while(V<L)re=$[V+=1],n+=" || "+e.usePattern(re)+".test("+m+") "}}n+=" ); if (isAdditional"+r+") { "}if("all"==R)n+=" delete "+h+"["+m+"]; ";else{var N=e.errorPath,O="' + "+m+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers)),x)if(R)n+=" delete "+h+"["+m+"]; ";else{n+=" "+p+" = false; ";var F=l;l=e.errSchemaPath+"/additionalProperties";var P=P||[];P.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { additionalProperty: '"+O+"' } ",!1!==e.opts.messages&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is an invalid additional property":n+="should NOT have additional properties",n+="' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var K=n;n=P.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+K+"]); ":n+=" validate.errors = ["+K+"]; return false; ":n+=" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=F,c&&(n+=" break; ")}else if(k)if("failing"==R){n+=" var "+d+" = errors; ";var M=e.compositeRule;e.compositeRule=u.compositeRule=!0,u.schema=w,u.schemaPath=e.schemaPath+".additionalProperties",u.errSchemaPath=e.errSchemaPath+"/additionalProperties",u.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers);var j=h+"["+m+"]";u.dataPathArr[C]=m;var D=e.validate(u);u.baseId=Z,e.util.varOccurences(D,I)<2?n+=" "+e.util.varReplace(D,I,j)+" ":n+=" var "+I+" = "+j+"; "+D+" ",n+=" if (!"+p+") { errors = "+d+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+h+"["+m+"]; } ",e.compositeRule=u.compositeRule=M}else{u.schema=w,u.schemaPath=e.schemaPath+".additionalProperties",u.errSchemaPath=e.errSchemaPath+"/additionalProperties",u.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers);j=h+"["+m+"]";u.dataPathArr[C]=m;D=e.validate(u);u.baseId=Z,e.util.varOccurences(D,I)<2?n+=" "+e.util.varReplace(D,I,j)+" ":n+=" var "+I+" = "+j+"; "+D+" ",c&&(n+=" if (!"+p+") break; ")}e.errorPath=N}S&&(n+=" } "),n+=" } ",c&&(n+=" if ("+p+") { ",g+="}")}var X=e.opts.useDefaults&&!e.compositeRule;if(v.length){var Y=v;if(Y){var z,J=-1,U=Y.length-1;while(J<U){z=Y[J+=1];var Q=o[z];if(e.opts.strictKeywords?"object"==typeof Q&&Object.keys(Q).length>0:e.util.schemaHasRules(Q,e.RULES.all)){var q=e.util.getProperty(z),ee=(j=h+q,X&&void 0!==Q.default);u.schema=Q,u.schemaPath=a+q,u.errSchemaPath=l+"/"+e.util.escapeFragment(z),u.errorPath=e.util.getPath(e.errorPath,z,e.opts.jsonPointers),u.dataPathArr[C]=e.util.toQuotedString(z);D=e.validate(u);if(u.baseId=Z,e.util.varOccurences(D,I)<2){D=e.util.varReplace(D,I,j);var te=j}else{te=I;n+=" var "+I+" = "+j+"; "}if(ee)n+=" "+D+" ";else{if(T&&T[z]){n+=" if ( "+te+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(z)+"') "),n+=") { "+p+" = false; ";N=e.errorPath,F=l;var ie=e.util.escapeQuotes(z);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(N,z,e.opts.jsonPointers)),l=e.errSchemaPath+"/required";P=P||[];P.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+ie+"' } ",!1!==e.opts.messages&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+ie+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";K=n;n=P.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+K+"]); ":n+=" validate.errors = ["+K+"]; return false; ":n+=" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=F,e.errorPath=N,n+=" } else { "}else c?(n+=" if ( "+te+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(z)+"') "),n+=") { "+p+" = true; } else { "):(n+=" if ("+te+" !== undefined ",B&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(z)+"') "),n+=" ) { ");n+=" "+D+" } "}}c&&(n+=" if ("+p+") { ",g+="}")}}}if(y.length){var ne=y;if(ne){var re,se=-1,oe=ne.length-1;while(se<oe){re=ne[se+=1];Q=b[re];if(e.opts.strictKeywords?"object"==typeof Q&&Object.keys(Q).length>0:e.util.schemaHasRules(Q,e.RULES.all)){u.schema=Q,u.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(re),u.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(re),n+=B?" "+A+" = "+A+" || Object.keys("+h+"); for (var "+f+"=0; "+f+"<"+A+".length; "+f+"++) { var "+m+" = "+A+"["+f+"]; ":" for (var "+m+" in "+h+") { ",n+=" if ("+e.usePattern(re)+".test("+m+")) { ",u.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers);j=h+"["+m+"]";u.dataPathArr[C]=m;D=e.validate(u);u.baseId=Z,e.util.varOccurences(D,I)<2?n+=" "+e.util.varReplace(D,I,j)+" ":n+=" var "+I+" = "+j+"; "+D+" ",c&&(n+=" if (!"+p+") break; "),n+=" } ",c&&(n+=" else "+p+" = true; "),n+=" } ",c&&(n+=" if ("+p+") { ",g+="}")}}}}return c&&(n+=" "+g+" if ("+d+" == errors) {"),n=e.util.cleanUpCode(n),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="errs__"+r,u=e.util.copy(e),g="";u.level++;var p="valid"+u.level;if(n+="var "+d+" = errors;",e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0:e.util.schemaHasRules(o,e.RULES.all)){u.schema=o,u.schemaPath=a,u.errSchemaPath=l;var m="key"+r,f="idx"+r,C="i"+r,I="' + "+m+" + '",A=u.dataLevel=e.dataLevel+1,v="data"+A,b="dataProperties"+r,y=e.opts.ownProperties,w=e.baseId;y&&(n+=" var "+b+" = undefined; "),n+=y?" "+b+" = "+b+" || Object.keys("+h+"); for (var "+f+"=0; "+f+"<"+b+".length; "+f+"++) { var "+m+" = "+b+"["+f+"]; ":" for (var "+m+" in "+h+") { ",n+=" var startErrs"+r+" = errors; ";var S=m,x=e.compositeRule;e.compositeRule=u.compositeRule=!0;var k=e.validate(u);u.baseId=w,e.util.varOccurences(k,v)<2?n+=" "+e.util.varReplace(k,v,S)+" ":n+=" var "+v+" = "+S+"; "+k+" ",e.compositeRule=u.compositeRule=x,n+=" if (!"+p+") { for (var "+C+"=startErrs"+r+"; "+C+"<errors; "+C+"++) { vErrors["+C+"].propertyName = "+m+"; } var err = ",!1!==e.createErrors?(n+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { propertyName: '"+I+"' } ",!1!==e.opts.messages&&(n+=" , message: 'property name \\'"+I+"\\' is invalid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),c&&(n+=" break; "),n+=" } }"}return c&&(n+=" "+g+" if ("+d+" == errors) {"),n=e.util.cleanUpCode(n),n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=" ",r=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(s||""),d="valid"+r,u=e.opts.$data&&o&&o.$data;u&&(n+=" var schema"+r+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ");var g="schema"+r;if(!u)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],m=o;if(m){var f,C=-1,I=m.length-1;while(C<I){f=m[C+=1];var A=e.schema.properties[f];A&&(e.opts.strictKeywords?"object"==typeof A&&Object.keys(A).length>0:e.util.schemaHasRules(A,e.RULES.all))||(p[p.length]=f)}}}else p=o;if(u||p.length){var v=e.errorPath,b=u||p.length>=e.opts.loopRequired,y=e.opts.ownProperties;if(c)if(n+=" var missing"+r+"; ",b){u||(n+=" var "+g+" = validate.schema"+a+"; ");var w="i"+r,S="schema"+r+"["+w+"]",x="' + "+S+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(v,S,e.opts.jsonPointers)),n+=" var "+d+" = true; ",u&&(n+=" if (schema"+r+" === undefined) "+d+" = true; else if (!Array.isArray(schema"+r+")) "+d+" = false; else {"),n+=" for (var "+w+" = 0; "+w+" < "+g+".length; "+w+"++) { "+d+" = "+h+"["+g+"["+w+"]] !== undefined ",y&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", "+g+"["+w+"]) "),n+="; if (!"+d+") break; } ",u&&(n+=" } "),n+=" if (!"+d+") { ";var k=k||[];k.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+x+"' } ",!1!==e.opts.messages&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+x+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var R=n;n=k.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+R+"]); ":n+=" validate.errors = ["+R+"]; return false; ":n+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var E=p;if(E){w=-1;var B=E.length-1;while(w<B){W=E[w+=1],w&&(n+=" || ");var Z=e.util.getProperty(W),G=h+Z;n+=" ( ( "+G+" === undefined ",y&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(W)+"') "),n+=") && (missing"+r+" = "+e.util.toQuotedString(e.opts.jsonPointers?W:Z)+") ) "}}n+=") { ";S="missing"+r,x="' + "+S+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(v,S,!0):v+" + "+S);k=k||[];k.push(n),n="",!1!==e.createErrors?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+x+"' } ",!1!==e.opts.messages&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+x+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";R=n;n=k.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+R+"]); ":n+=" validate.errors = ["+R+"]; return false; ":n+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else if(b){u||(n+=" var "+g+" = validate.schema"+a+"; ");w="i"+r,S="schema"+r+"["+w+"]",x="' + "+S+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(v,S,e.opts.jsonPointers)),u&&(n+=" if ("+g+" && !Array.isArray("+g+")) { var err = ",!1!==e.createErrors?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+x+"' } ",!1!==e.opts.messages&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+x+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+g+" !== undefined) { "),n+=" for (var "+w+" = 0; "+w+" < "+g+".length; "+w+"++) { if ("+h+"["+g+"["+w+"]] === undefined ",y&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", "+g+"["+w+"]) "),n+=") { var err = ",!1!==e.createErrors?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+x+"' } ",!1!==e.opts.messages&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+x+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",u&&(n+=" } ")}else{var T=p;if(T){var W,_=-1,H=T.length-1;while(_<H){W=T[_+=1];Z=e.util.getProperty(W),x=e.util.escapeQuotes(W),G=h+Z;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(v,W,e.opts.jsonPointers)),n+=" if ( "+G+" === undefined ",y&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(W)+"') "),n+=") { var err = ",!1!==e.createErrors?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+x+"' } ",!1!==e.opts.messages&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+x+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}e.errorPath=v}else c&&(n+=" if (true) {");return n}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n,r=" ",s=e.level,o=e.dataLevel,a=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,d="data"+(o||""),u="valid"+s,g=e.opts.$data&&a&&a.$data;if(g?(r+=" var schema"+s+" = "+e.util.getData(a.$data,o,e.dataPathArr)+"; ",n="schema"+s):n=a,(a||g)&&!1!==e.opts.uniqueItems){g&&(r+=" var "+u+"; if ("+n+" === false || "+n+" === undefined) "+u+" = true; else if (typeof "+n+" != 'boolean') "+u+" = false; else { "),r+=" var i = "+d+".length , "+u+" = true , j; if (i > 1) { ";var p=e.schema.items&&e.schema.items.type,m=Array.isArray(p);if(!p||"object"==p||"array"==p||m&&(p.indexOf("object")>=0||p.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+u+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var f="checkDataType"+(m?"s":"");r+=" if ("+e.util[f](p,"item",!0)+") continue; ",m&&(r+=" if (typeof item == 'string') item = '\"' + item; "),r+=" if (typeof itemIndices[item] == 'number') { "+u+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",g&&(r+=" } "),r+=" if (!"+u+") { ";var C=C||[];C.push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",r+=g?"validate.schema"+l:""+a,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),r+=" } "):r+=" {} ";var I=r;r=C.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { ")}else h&&(r+=" if (true) { ");return r}},function(e,t,i){"use strict";var n=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];e.exports=function(e,t){for(var i=0;i<t.length;i++){e=JSON.parse(JSON.stringify(e));var r,s=t[i].split("/"),o=e;for(r=1;r<s.length;r++)o=o[s[r]];for(r=0;r<n.length;r++){var a=n[r],l=o[a];l&&(o[a]={anyOf:[l,{$ref:"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#"}]})}}return e}},function(e,t,i){"use strict";var n=i(19).MissingRef;function r(e,t,i){var s=this;if("function"!=typeof this._opts.loadSchema)throw new Error("options.loadSchema should be a function");"function"==typeof t&&(i=t,t=void 0);var o=a(e).then((function(){var i=s._addSchema(e,void 0,t);return i.validate||l(i)}));return i&&o.then((function(e){i(null,e)}),i),o;function a(e){var t=e.$schema;return t&&!s.getSchema(t)?r.call(s,{$ref:t},!0):Promise.resolve()}function l(e){try{return s._compile(e)}catch(r){if(r instanceof n)return i(r);throw r}function i(i){var n=i.missingSchema;if(c(n))throw new Error("Schema "+n+" is loaded but "+i.missingRef+" cannot be resolved");var r=s._loadingSchemas[n];return r||(r=s._loadingSchemas[n]=s._opts.loadSchema(n),r.then(o,o)),r.then((function(e){if(!c(n))return a(e).then((function(){c(n)||s.addSchema(e,n,void 0,t)}))})).then((function(){return l(e)}));function o(){delete s._loadingSchemas[n]}function c(e){return s._refs[e]||s._schemas[e]}}}}e.exports=r},function(e,t,i){"use strict";var n=/^[a-z_$][a-z0-9_$-]*$/i,r=i(75),s=i(76);function o(e,t){var i=this.RULES;if(i.keywords[e])throw new Error("Keyword "+e+" is already defined");if(!n.test(e))throw new Error("Keyword "+e+" is not a valid identifier");if(t){this.validateKeyword(t,!0);var s=t.type;if(Array.isArray(s))for(var o=0;o<s.length;o++)l(e,s[o],t);else l(e,s,t);var a=t.metaSchema;a&&(t.$data&&this._opts.$data&&(a={anyOf:[a,{$ref:"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#"}]}),t.validateSchema=this.compile(a,!0))}function l(e,t,n){for(var s,o=0;o<i.length;o++){var a=i[o];if(a.type==t){s=a;break}}s||(s={type:t,rules:[]},i.push(s));var l={keyword:e,definition:n,custom:!0,code:r,implements:n.implements};s.rules.push(l),i.custom[e]=l}return i.keywords[e]=i.all[e]=!0,this}function a(e){var t=this.RULES.custom[e];return t?t.definition:this.RULES.keywords[e]||!1}function l(e){var t=this.RULES;delete t.keywords[e],delete t.all[e],delete t.custom[e];for(var i=0;i<t.length;i++)for(var n=t[i].rules,r=0;r<n.length;r++)if(n[r].keyword==e){n.splice(r,1);break}return this}function c(e,t){c.errors=null;var i=this._validateKeyword=this._validateKeyword||this.compile(s,!0);if(i(e))return!0;if(c.errors=i.errors,t)throw new Error("custom keyword definition is invalid: "+this.errorsText(i.errors));return!1}e.exports={add:o,get:a,remove:l,validate:c}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n,r,s=" ",o=e.level,a=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),h=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(a||""),g="valid"+o,p="errs__"+o,m=e.opts.$data&&l&&l.$data;m?(s+=" var schema"+o+" = "+e.util.getData(l.$data,a,e.dataPathArr)+"; ",r="schema"+o):r=l;var f,C,I,A,v,b=this,y="definition"+o,w=b.definition,S="";if(m&&w.$data){v="keywordValidate"+o;var x=w.validateSchema;s+=" var "+y+" = RULES.custom['"+t+"'].definition; var "+v+" = "+y+".validate;"}else{if(A=e.useCustomRule(b,l,e.schema,e),!A)return;r="validate.schema"+c,v=A.code,f=w.compile,C=w.inline,I=w.macro}var k=v+".errors",R="i"+o,E="ruleErr"+o,B=w.async;if(B&&!e.async)throw new Error("async keyword in sync schema");if(C||I||(s+=k+" = null;"),s+="var "+p+" = errors;var "+g+";",m&&w.$data&&(S+="}",s+=" if ("+r+" === undefined) { "+g+" = true; } else { ",x&&(S+="}",s+=" "+g+" = "+y+".validateSchema("+r+"); if ("+g+") { ")),C)w.statements?s+=" "+A.validate+" ":s+=" "+g+" = "+A.validate+"; ";else if(I){var Z=e.util.copy(e);S="";Z.level++;var G="valid"+Z.level;Z.schema=A.validate,Z.schemaPath="";var T=e.compositeRule;e.compositeRule=Z.compositeRule=!0;var W=e.validate(Z).replace(/validate\.schema/g,v);e.compositeRule=Z.compositeRule=T,s+=" "+W}else{var _=_||[];_.push(s),s="",s+=" "+v+".call( ",e.opts.passContext?s+="this":s+="self",f||!1===w.schema?s+=" , "+u+" ":s+=" , "+r+" , "+u+" , validate.schema"+e.schemaPath+" ",s+=" , (dataPath || '')",'""'!=e.errorPath&&(s+=" + "+e.errorPath);var H=a?"data"+(a-1||""):"parentData",$=a?e.dataPathArr[a]:"parentDataProperty";s+=" , "+H+" , "+$+" , rootData ) ";var V=s;s=_.pop(),!1===w.errors?(s+=" "+g+" = ",B&&(s+="await "),s+=V+"; "):B?(k="customErrors"+o,s+=" var "+k+" = null; try { "+g+" = await "+V+"; } catch (e) { "+g+" = false; if (e instanceof ValidationError) "+k+" = e.errors; else throw e; } "):s+=" "+k+" = null; "+g+" = "+V+"; "}if(w.modifying&&(s+=" if ("+H+") "+u+" = "+H+"["+$+"];"),s+=""+S,w.valid)d&&(s+=" if (true) { ");else{s+=" if ( ",void 0===w.valid?(s+=" !",s+=I?""+G:""+g):s+=" "+!w.valid+" ",s+=") { ",n=b.keyword;_=_||[];_.push(s),s="";_=_||[];_.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(n||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { keyword: '"+b.keyword+"' } ",!1!==e.opts.messages&&(s+=" , message: 'should pass \""+b.keyword+"\" keyword validation' "),e.opts.verbose&&(s+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var L=s;s=_.pop(),!e.compositeRule&&d?e.async?s+=" throw new ValidationError(["+L+"]); ":s+=" validate.errors = ["+L+"]; return false; ":s+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var N=s;s=_.pop(),C?w.errors?"full"!=w.errors&&(s+=" for (var "+R+"="+p+"; "+R+"<errors; "+R+"++) { var "+E+" = vErrors["+R+"]; if ("+E+".dataPath === undefined) "+E+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+E+".schemaPath === undefined) { "+E+'.schemaPath = "'+h+'"; } ',e.opts.verbose&&(s+=" "+E+".schema = "+r+"; "+E+".data = "+u+"; "),s+=" } "):!1===w.errors?s+=" "+N+" ":(s+=" if ("+p+" == errors) { "+N+" } else { for (var "+R+"="+p+"; "+R+"<errors; "+R+"++) { var "+E+" = vErrors["+R+"]; if ("+E+".dataPath === undefined) "+E+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+E+".schemaPath === undefined) { "+E+'.schemaPath = "'+h+'"; } ',e.opts.verbose&&(s+=" "+E+".schema = "+r+"; "+E+".data = "+u+"; "),s+=" } } "):I?(s+=" var err = ",!1!==e.createErrors?(s+=" { keyword: '"+(n||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { keyword: '"+b.keyword+"' } ",!1!==e.opts.messages&&(s+=" , message: 'should pass \""+b.keyword+"\" keyword validation' "),e.opts.verbose&&(s+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ",s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?s+=" throw new ValidationError(vErrors); ":s+=" validate.errors = vErrors; return false; ")):!1===w.errors?s+=" "+N+" ":(s+=" if (Array.isArray("+k+")) { if (vErrors === null) vErrors = "+k+"; else vErrors = vErrors.concat("+k+"); errors = vErrors.length; for (var "+R+"="+p+"; "+R+"<errors; "+R+"++) { var "+E+" = vErrors["+R+"]; if ("+E+".dataPath === undefined) "+E+".dataPath = (dataPath || '') + "+e.errorPath+"; "+E+'.schemaPath = "'+h+'"; ',e.opts.verbose&&(s+=" "+E+".schema = "+r+"; "+E+".data = "+u+"; "),s+=" } } else { "+N+" } "),s+=" } ",d&&(s+=" else { ")}return s}},function(e,t,i){"use strict";var n=i(32);e.exports={$id:"https://github.com/epoberezkin/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:n.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:n.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}},function(e){e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON Schema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},function(e){e.exports=JSON.parse('{"id":"http://json-schema.org/draft-04/schema#","$schema":"http://json-schema.org/draft-04/schema#","description":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"positiveInteger":{"type":"integer","minimum":0},"positiveIntegerDefault0":{"allOf":[{"$ref":"#/definitions/positiveInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"minItems":1,"uniqueItems":true}},"type":"object","properties":{"id":{"type":"string"},"$schema":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":{},"multipleOf":{"type":"number","minimum":0,"exclusiveMinimum":true},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"boolean","default":false},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"boolean","default":false},"maxLength":{"$ref":"#/definitions/positiveInteger"},"minLength":{"$ref":"#/definitions/positiveIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"anyOf":[{"type":"boolean"},{"$ref":"#"}],"default":{}},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":{}},"maxItems":{"$ref":"#/definitions/positiveInteger"},"minItems":{"$ref":"#/definitions/positiveIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxProperties":{"$ref":"#/definitions/positiveInteger"},"minProperties":{"$ref":"#/definitions/positiveIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"anyOf":[{"type":"boolean"},{"$ref":"#"}],"default":{}},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"enum":{"type":"array","minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"dependencies":{"exclusiveMaximum":["maximum"],"exclusiveMinimum":["minimum"]},"default":{}}')},function(e){e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-06/schema#","$id":"http://json-schema.org/draft-06/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"title":{"type":"string"},"description":{"type":"string"},"default":{},"examples":{"type":"array","items":{}},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":{}},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":{},"enum":{"type":"array","minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":{}}')},function(e,t,i){"use strict";i.r(t),i.d(t,"treeModeMixins",(function(){return J}));var n=i(13),r=i.n(n);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,i){return t&&o(e.prototype,t),i&&o(e,i),e}var l=function(){function e(){s(this,e),this.locked=!1}return a(e,[{key:"highlight",value:function(e){this.locked||(this.node!==e&&(this.node&&this.node.setHighlight(!1),this.node=e,this.node.setHighlight(!0)),this._cancelUnhighlight())}},{key:"unhighlight",value:function(){if(!this.locked){var e=this;this.node&&(this._cancelUnhighlight(),this.unhighlightTimer=setTimeout((function(){e.node.setHighlight(!1),e.node=void 0,e.unhighlightTimer=void 0}),0))}}},{key:"_cancelUnhighlight",value:function(){this.unhighlightTimer&&(clearTimeout(this.unhighlightTimer),this.unhighlightTimer=void 0)}},{key:"lock",value:function(){this.locked=!0}},{key:"unlock",value:function(){this.locked=!1}}]),e}(),c=i(0);function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,i){return t&&d(e.prototype,t),i&&d(e,i),e}var g=function(){function e(t){function i(e){return t.node.findNodeByInternalPath(e)}h(this,e),this.editor=t,this.history=[],this.index=-1,this.clear(),this.actions={editField:{undo:function(e){var t=i(e.parentPath),n=t.childs[e.index];n.updateField(e.oldValue)},redo:function(e){var t=i(e.parentPath),n=t.childs[e.index];n.updateField(e.newValue)}},editValue:{undo:function(e){i(e.path).updateValue(e.oldValue)},redo:function(e){i(e.path).updateValue(e.newValue)}},changeType:{undo:function(e){i(e.path).changeType(e.oldType)},redo:function(e){i(e.path).changeType(e.newType)}},appendNodes:{undo:function(e){var t=i(e.parentPath);e.paths.map(i).forEach((function(e){t.removeChild(e)}))},redo:function(e){var t=i(e.parentPath);e.nodes.forEach((function(e){t.appendChild(e)}))}},insertBeforeNodes:{undo:function(e){var t=i(e.parentPath);e.paths.map(i).forEach((function(e){t.removeChild(e)}))},redo:function(e){var t=i(e.parentPath),n=i(e.beforePath);e.nodes.forEach((function(e){t.insertBefore(e,n)}))}},insertAfterNodes:{undo:function(e){var t=i(e.parentPath);e.paths.map(i).forEach((function(e){t.removeChild(e)}))},redo:function(e){var t=i(e.parentPath),n=i(e.afterPath);e.nodes.forEach((function(e){t.insertAfter(e,n),n=e}))}},removeNodes:{undo:function(e){var t=i(e.parentPath),n=t.childs[e.index]||t.append;e.nodes.forEach((function(e){t.insertBefore(e,n)}))},redo:function(e){var t=i(e.parentPath);e.paths.map(i).forEach((function(e){t.removeChild(e)}))}},duplicateNodes:{undo:function(e){var t=i(e.parentPath);e.clonePaths.map(i).forEach((function(e){t.removeChild(e)}))},redo:function(e){var t=i(e.parentPath),n=i(e.afterPath),r=e.paths.map(i);r.forEach((function(e){var i=e.clone();if("object"===t.type){var r=t.getFieldNames();i.field=Object(c["findUniqueName"])(e.field,r)}t.insertAfter(i,n),n=i}))}},moveNodes:{undo:function(e){var t=i(e.oldParentPath),n=i(e.newParentPath),r=t.childs[e.oldIndex]||t.append,s=n.childs.slice(e.newIndex,e.newIndex+e.count);s.forEach((function(i,n){i.field=e.fieldNames[n],t.moveBefore(i,r)})),null===e.newParentPathRedo&&(e.newParentPathRedo=n.getInternalPath())},redo:function(e){var t=i(e.oldParentPathRedo),n=i(e.newParentPathRedo),r=n.childs[e.newIndexRedo]||n.append,s=t.childs.slice(e.oldIndexRedo,e.oldIndexRedo+e.count);s.forEach((function(t,i){t.field=e.fieldNames[i],n.moveBefore(t,r)}))}},sort:{undo:function(e){var t=i(e.path);t.hideChilds(),t.childs=e.oldChilds,t.updateDom({updateIndexes:!0}),t.showChilds()},redo:function(e){var t=i(e.path);t.hideChilds(),t.childs=e.newChilds,t.updateDom({updateIndexes:!0}),t.showChilds()}},transform:{undo:function(e){i(e.path).setInternalValue(e.oldValue)},redo:function(e){i(e.path).setInternalValue(e.newValue)}}}}return u(e,[{key:"onChange",value:function(){}},{key:"add",value:function(e,t){this.index++,this.history[this.index]={action:e,params:t,timestamp:new Date},this.index<this.history.length-1&&this.history.splice(this.index+1,this.history.length-this.index-1),this.onChange()}},{key:"clear",value:function(){this.history=[],this.index=-1,this.onChange()}},{key:"canUndo",value:function(){return this.index>=0}},{key:"canRedo",value:function(){return this.index<this.history.length-1}},{key:"undo",value:function(){if(this.canUndo()){var e=this.history[this.index];if(e){var t=this.actions[e.action];if(t&&t.undo&&(t.undo(e.params),e.params.oldSelection))try{this.editor.setDomSelection(e.params.oldSelection)}catch(i){}}this.index--,this.onChange()}}},{key:"redo",value:function(){if(this.canRedo()){this.index++;var e=this.history[this.index];if(e){var t=this.actions[e.action];if(t&&t.redo&&(t.redo(e.params),e.params.newSelection))try{this.editor.setDomSelection(e.params.newSelection)}catch(i){}}this.onChange()}}},{key:"destroy",value:function(){this.editor=null,this.history=[],this.index=-1}}]),e}(),p=i(1);function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,i){return t&&f(e.prototype,t),i&&f(e,i),e}var I=function(){function e(t,i){m(this,e);var n=this;this.editor=t,this.timeout=void 0,this.delay=200,this.lastText=void 0,this.results=null,this.dom={},this.dom.container=i;var r=document.createElement("div");this.dom.wrapper=r,r.className="jsoneditor-search",i.appendChild(r);var s=document.createElement("div");this.dom.results=s,s.className="jsoneditor-results",r.appendChild(s);var o=document.createElement("div");this.dom.input=o,o.className="jsoneditor-frame",o.title=Object(p["c"])("searchTitle"),r.appendChild(o);var a=document.createElement("button");a.type="button",a.className="jsoneditor-refresh",o.appendChild(a);var l=document.createElement("input");l.type="text",this.dom.search=l,l.oninput=function(e){n._onDelayedSearch(e)},l.onchange=function(e){n._onSearch()},l.onkeydown=function(e){n._onKeyDown(e)},l.onkeyup=function(e){n._onKeyUp(e)},a.onclick=function(e){l.select()},o.appendChild(l);var c=document.createElement("button");c.type="button",c.title=Object(p["c"])("searchNextResultTitle"),c.className="jsoneditor-next",c.onclick=function(){n.next()},o.appendChild(c);var h=document.createElement("button");h.type="button",h.title=Object(p["c"])("searchPreviousResultTitle"),h.className="jsoneditor-previous",h.onclick=function(){n.previous()},o.appendChild(h)}return C(e,[{key:"next",value:function(e){if(this.results){var t=null!==this.resultIndex?this.resultIndex+1:0;t>this.results.length-1&&(t=0),this._setActiveResult(t,e)}}},{key:"previous",value:function(e){if(this.results){var t=this.results.length-1,i=null!==this.resultIndex?this.resultIndex-1:t;i<0&&(i=t),this._setActiveResult(i,e)}}},{key:"_setActiveResult",value:function(e,t){if(this.activeResult){var i=this.activeResult.node,n=this.activeResult.elem;"field"===n?delete i.searchFieldActive:delete i.searchValueActive,i.updateDom()}if(!this.results||!this.results[e])return this.resultIndex=void 0,void(this.activeResult=void 0);this.resultIndex=e;var r=this.results[this.resultIndex].node,s=this.results[this.resultIndex].elem;"field"===s?r.searchFieldActive=!0:r.searchValueActive=!0,this.activeResult=this.results[this.resultIndex],r.updateDom(),r.scrollTo((function(){t&&r.focus(s)}))}},{key:"_clearDelay",value:function(){void 0!==this.timeout&&(clearTimeout(this.timeout),delete this.timeout)}},{key:"_onDelayedSearch",value:function(e){this._clearDelay();var t=this;this.timeout=setTimeout((function(e){t._onSearch()}),this.delay)}},{key:"_onSearch",value:function(e){this._clearDelay();var t=this.dom.search.value,i=t.length>0?t:void 0;if(i!==this.lastText||e){this.lastText=i,this.results=this.editor.search(i);var n=this.results[0]?this.results[0].node.MAX_SEARCH_RESULTS:1/0,r=0;if(this.activeResult)for(var s=0;s<this.results.length;s++)if(this.results[s].node===this.activeResult.node){r=s;break}if(this._setActiveResult(r,!1),void 0!==i){var o=this.results.length;this.dom.results.textContent=0===o?"no results":1===o?"1 result":o>n?n+"+ results":o+" results"}else this.dom.results.textContent=""}}},{key:"_onKeyDown",value:function(e){var t=e.which;27===t?(this.dom.search.value="",this._onSearch(),e.preventDefault(),e.stopPropagation()):13===t&&(e.ctrlKey?this._onSearch(!0):e.shiftKey?this.previous():this.next(),e.preventDefault(),e.stopPropagation())}},{key:"_onKeyUp",value:function(e){var t=e.keyCode;27!==t&&13!==t&&this._onDelayedSearch(e)}},{key:"clear",value:function(){this.dom.search.value="",this._onSearch()}},{key:"forceSearch",value:function(){this._onSearch(!0)}},{key:"isEmpty",value:function(){return""===this.dom.search.value}},{key:"destroy",value:function(){this.editor=null,this.dom.container.removeChild(this.dom.wrapper),this.dom=null,this.results=null,this.activeResult=null,this._clearDelay()}}]),e}(),A=i(3);function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t,i){return t&&b(e.prototype,t),i&&b(e,i),e}var w=function(){function e(t,i){v(this,e),t&&(this.root=i,this.path=document.createElement("div"),this.path.className="jsoneditor-treepath",this.path.setAttribute("tabindex",0),this.contentMenuClicked=!1,t.appendChild(this.path),this.reset())}return y(e,[{key:"reset",value:function(){this.path.textContent=Object(p["c"])("selectNode")}},{key:"setPath",value:function(e){var t=this;function i(e){t.contentMenuClicked=!1,Object(c["addClassName"])(t.path,"show-all"),t.path.style.width=t.path.parentNode.getBoundingClientRect().width-10+"px",t.path.onblur=function(){if(t.contentMenuClicked)return t.contentMenuClicked=!1,void t.path.focus();Object(c["removeClassName"])(t.path,"show-all"),t.path.onblur=void 0,t.path.style.width="",t.setPath(e)}}function n(e){this.selectionCallback&&this.selectionCallback(e)}function r(e,t){this.contextMenuCallback&&this.contextMenuCallback(e,t)}this.path.textContent="",e&&e.length&&e.forEach((function(s,o){var a,l=document.createElement("span");if(l.className="jsoneditor-treepath-element",l.innerText=s.name,l.onclick=n.bind(t,s),t.path.appendChild(l),s.children.length&&(a=document.createElement("span"),a.className="jsoneditor-treepath-seperator",a.textContent="►",a.onclick=function(){t.contentMenuClicked=!0;var i=[];s.children.forEach((function(n){i.push({text:n.name,className:"jsoneditor-type-modes"+(e[o+1]+1&&e[o+1].name===n.name?" jsoneditor-selected":""),click:r.bind(t,s,n.name)})}));var n=new A["a"](i);n.show(a,t.root,!0)},t.path.appendChild(a)),o===e.length-1){var c=(a||l).getBoundingClientRect().right;if(t.path.offsetWidth<c&&(t.path.scrollLeft=c),t.path.scrollLeft){var h=document.createElement("span");h.className="jsoneditor-treepath-show-all-btn",h.title="show all path",h.textContent="...",h.onclick=i.bind(t,e),t.path.insertBefore(h,t.path.firstChild)}}}))}},{key:"onSectionSelected",value:function(e){"function"===typeof e&&(this.selectionCallback=e)}},{key:"onContextMenuItemSelected",value:function(e){"function"===typeof e&&(this.contextMenuCallback=e)}}]),e}(),S=i(11),x=i.n(S),k=i(12);function R(e){function t(e){this.editor=e,this.dom={}}return t.prototype=new e,t.prototype.getDom=function(){var e=this.dom;if(e.tr)return e.tr;this._updateEditability();var t=document.createElement("tr");if(t.className="jsoneditor-append",t.node=this,e.tr=t,"tree"===this.editor.options.mode){e.tdDrag=document.createElement("td");var i=document.createElement("td");e.tdMenu=i;var n=document.createElement("button");n.type="button",n.className="jsoneditor-button jsoneditor-contextmenu-button",n.title="Click to open the actions menu (Ctrl+M)",e.menu=n,i.appendChild(e.menu)}var r=document.createElement("td"),s=document.createElement("div");return s.appendChild(document.createTextNode("("+Object(p["c"])("empty")+")")),s.className="jsoneditor-readonly",r.appendChild(s),e.td=r,e.text=s,this.updateDom(),t},t.prototype.getPath=function(){return null},t.prototype.getIndex=function(){return null},t.prototype.updateDom=function(e){var t=this.dom,i=t.td;i&&(i.style.paddingLeft=24*this.getLevel()+26+"px");var n=t.text;n&&(n.firstChild.nodeValue="("+Object(p["c"])("empty")+" "+this.parent.type+")");var r=t.tr;this.isVisible()?t.tr.firstChild||(t.tdDrag&&r.appendChild(t.tdDrag),t.tdMenu&&r.appendChild(t.tdMenu),r.appendChild(i)):t.tr.firstChild&&(t.tdDrag&&r.removeChild(t.tdDrag),t.tdMenu&&r.removeChild(t.tdMenu),r.removeChild(i))},t.prototype.isVisible=function(){return 0===this.parent.childs.length},t.prototype.showContextMenu=function(e,t){var i=this,n=[{text:Object(p["c"])("auto"),className:"jsoneditor-type-auto",title:Object(p["c"])("autoType"),click:function(){i._onAppend("","","auto")}},{text:Object(p["c"])("array"),className:"jsoneditor-type-array",title:Object(p["c"])("arrayType"),click:function(){i._onAppend("",[])}},{text:Object(p["c"])("object"),className:"jsoneditor-type-object",title:Object(p["c"])("objectType"),click:function(){i._onAppend("",{})}},{text:Object(p["c"])("string"),className:"jsoneditor-type-string",title:Object(p["c"])("stringType"),click:function(){i._onAppend("","","string")}}];i.addTemplates(n,!0);var r=[{text:Object(p["c"])("appendText"),title:Object(p["c"])("appendTitleAuto"),submenuTitle:Object(p["c"])("appendSubmenuTitle"),className:"jsoneditor-insert",click:function(){i._onAppend("","","auto")},submenu:n}];if(this.editor.options.onCreateMenu){var s=i.parent.getPath();r=this.editor.options.onCreateMenu(r,{type:"append",path:s,paths:[s]})}var o=new A["a"](r,{close:t});o.show(e,this.editor.getPopupAnchor())},t.prototype.onEvent=function(e){var t=e.type,i=e.target||e.srcElement,n=this.dom,r=n.menu;if(i===r&&("mouseover"===t?this.editor.highlighter.highlight(this.parent):"mouseout"===t&&this.editor.highlighter.unhighlight()),"click"===t&&i===n.menu){var s=this.editor.highlighter;s.highlight(this.parent),s.lock(),Object(c["addClassName"])(n.menu,"jsoneditor-selected"),this.showContextMenu(n.menu,(function(){Object(c["removeClassName"])(n.menu,"jsoneditor-selected"),s.unlock(),s.unhighlight()}))}"keydown"===t&&this.onKeyDown(e)},t}function E(e){function t(e,t){this.editor=e,this.parent=t,this.dom={}}return t.prototype=new e,t.prototype.getDom=function(){if(this.dom.tr)return this.dom.tr;if(this._updateEditability(),!this.dom.tr){var e=this,t=this.parent,i=document.createElement("a");i.appendChild(document.createTextNode(Object(p["c"])("showMore"))),i.href="#",i.onclick=function(i){return t.visibleChilds=Math.floor(t.visibleChilds/t.getMaxVisibleChilds()+1)*t.getMaxVisibleChilds(),e.updateDom(),t.showChilds(),i.preventDefault(),!1};var n=document.createElement("a");n.appendChild(document.createTextNode(Object(p["c"])("showAll"))),n.href="#",n.onclick=function(i){return t.visibleChilds=1/0,e.updateDom(),t.showChilds(),i.preventDefault(),!1};var r=document.createElement("div"),s=document.createTextNode(this._getShowMoreText());r.className="jsoneditor-show-more",r.appendChild(s),r.appendChild(i),r.appendChild(document.createTextNode(". ")),r.appendChild(n),r.appendChild(document.createTextNode(". "));var o=document.createElement("td");o.appendChild(r);var a=document.createElement("tr");"tree"===this.editor.options.mode&&(a.appendChild(document.createElement("td")),a.appendChild(document.createElement("td"))),a.appendChild(o),a.className="jsoneditor-show-more",this.dom.tr=a,this.dom.moreContents=r,this.dom.moreText=s}return this.updateDom(),this.dom.tr},t.prototype.updateDom=function(e){if(this.isVisible()){if(this.dom.tr.node=this.parent.childs[this.parent.visibleChilds],!this.dom.tr.parentNode){var t=this.parent._getNextTr();t&&t.parentNode.insertBefore(this.dom.tr,t)}this.dom.moreText.nodeValue=this._getShowMoreText(),this.dom.moreContents.style.marginLeft=24*(this.getLevel()+1)+"px"}else this.dom.tr&&this.dom.tr.parentNode&&this.dom.tr.parentNode.removeChild(this.dom.tr)},t.prototype._getShowMoreText=function(){return Object(p["c"])("showMoreStatus",{visibleChilds:this.parent.visibleChilds,totalChilds:this.parent.childs.length})+" "},t.prototype.isVisible=function(){return this.parent.expanded&&this.parent.childs.length>this.parent.visibleChilds},t.prototype.onEvent=function(e){var t=e.type;"keydown"===t&&this.onKeyDown(e)},t}var B=i(5),Z=i(6),G=i(2),T=void 0;function W(e){return W="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W(e)}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function H(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function $(e,t,i){return t&&H(e.prototype,t),i&&H(e,i),e}var V=function(){function e(t,i){_(this,e),this.editor=t,this.dom={},this.expanded=!1,i&&i instanceof Object?(this.setField(i.field,i.fieldEditable),"value"in i&&this.setValue(i.value,i.type),"internalValue"in i&&this.setInternalValue(i.internalValue)):(this.setField(""),this.setValue(null)),this._debouncedOnChangeValue=Object(c["debounce"])(this._onChangeValue.bind(this),e.prototype.DEBOUNCE_INTERVAL),this._debouncedOnChangeField=Object(c["debounce"])(this._onChangeField.bind(this),e.prototype.DEBOUNCE_INTERVAL),this.visibleChilds=this.getMaxVisibleChilds()}return $(e,[{key:"getMaxVisibleChilds",value:function(){return this.editor&&this.editor.options&&this.editor.options.maxVisibleChilds?this.editor.options.maxVisibleChilds:L}},{key:"_updateEditability",value:function(){if(this.editable={field:!0,value:!0},this.editor&&(this.editable.field="tree"===this.editor.options.mode,this.editable.value="view"!==this.editor.options.mode,("tree"===this.editor.options.mode||"form"===this.editor.options.mode)&&"function"===typeof this.editor.options.onEditable)){var e=this.editor.options.onEditable({field:this.field,value:this.value,path:this.getPath()});"boolean"===typeof e?(this.editable.field=e,this.editable.value=e):("boolean"===typeof e.field&&(this.editable.field=e.field),"boolean"===typeof e.value&&(this.editable.value=e.value))}}},{key:"getPath",value:function(){var e=this,t=[];while(e){var i=e.getName();void 0!==i&&t.unshift(i),e=e.parent}return t}},{key:"getInternalPath",value:function(){var e=this,t=[];while(e)e.parent&&t.unshift(e.getIndex()),e=e.parent;return t}},{key:"getName",value:function(){return this.parent?"array"!==this.parent.type?this.field:this.index:void 0}},{key:"findNodeByPath",value:function(e){if(e){if(0===e.length)return this;if(e.length&&this.childs&&this.childs.length)for(var t=0;t<this.childs.length;++t)if(""+e[0]===""+this.childs[t].getName())return this.childs[t].findNodeByPath(e.slice(1))}}},{key:"findNodeByInternalPath",value:function(e){if(e){for(var t=this,i=0;i<e.length&&t;i++){var n=e[i];t=t.childs[n]}return t}}},{key:"serialize",value:function(){return{value:this.getValue(),path:this.getPath()}}},{key:"findNode",value:function(e){var t=Object(c["parsePath"])(e),i=this,n=function(){var e=t.shift();if("number"===typeof e){if("array"!==i.type)throw new Error("Cannot get child node at index "+e+": node is no array");i=i.childs[e]}else{if("object"!==i.type)throw new Error("Cannot get child node "+e+": node is no object");i=i.childs.filter((function(t){return t.field===e}))[0]}};while(i&&t.length>0)n();return i}},{key:"findParents",value:function(){var e=[],t=this.parent;while(t)e.unshift(t),t=t.parent;return e}},{key:"setError",value:function(e,t){this.error=e,this.errorChild=t,this.dom&&this.dom.tr&&this.updateError()}},{key:"updateError",value:function(){var e=this,t=this.fieldError||this.valueError||this.error,i=this.dom.tdError;if(t&&this.dom&&this.dom.tr){Object(c["addClassName"])(this.dom.tr,"jsoneditor-validation-error"),i||(i=document.createElement("td"),this.dom.tdError=i,this.dom.tdValue.parentNode.appendChild(i));var n=document.createElement("button");n.type="button",n.className="jsoneditor-button jsoneditor-schema-error";var r=function(){e.dom.popupAnchor&&e.dom.popupAnchor.destroy()},s=function(){delete e.dom.popupAnchor},o=function(i){var r=e.editor.frame;e.dom.popupAnchor=Object(k["a"])(n,e.editor.getPopupAnchor(),s,i);var o=200,a=n.getBoundingClientRect(),l=r.getBoundingClientRect(),c=l.width-a.x>o/2+20?"jsoneditor-above":"jsoneditor-left",h=document.createElement("div");h.className="jsoneditor-popover "+c,h.appendChild(document.createTextNode(t.message)),e.dom.popupAnchor.appendChild(h)};n.onmouseover=function(){e.dom.popupAnchor||o(!0)},n.onfocus=function(){r(),o(!1)},n.onblur=function(){r()};var a=this.errorChild;a&&(n.onclick=function(){a.findParents().forEach((function(e){e.expand(!1)})),a.scrollTo((function(){a.focus()}))});while(i.firstChild)i.removeChild(i.firstChild);i.appendChild(n)}else this.dom.tr&&Object(c["removeClassName"])(this.dom.tr,"jsoneditor-validation-error"),i&&(this.dom.tdError.parentNode.removeChild(this.dom.tdError),delete this.dom.tdError)}},{key:"getIndex",value:function(){if(this.parent){var e=this.parent.childs.indexOf(this);return-1!==e?e:null}return-1}},{key:"setParent",value:function(e){this.parent=e}},{key:"setField",value:function(e,t){this.field=e,this.previousField=e,this.fieldEditable=!0===t}},{key:"getField",value:function(){return void 0===this.field&&this._getDomField(),this.field}},{key:"setValue",value:function(t,i){var n,r,s,o,a=!1,l=this.childs;if(this.type=this._getType(t),i&&i!==this.type){if("string"!==i||"auto"!==this.type)throw new Error('Type mismatch: cannot cast value of type "'+this.type+' to the specified type "'+i+'"');this.type=i}if("array"===this.type){for(this.childs||(this.childs=[]),s=0;s<t.length;s++)if(n=t[s],void 0!==n&&!(n instanceof Function))if(s<this.childs.length)r=this.childs[s],r.fieldEditable=!1,r.index=s,r.setValue(n);else{r=new e(this.editor,{value:n});var c=s<this.getMaxVisibleChilds();this.appendChild(r,c,a)}for(o=this.childs.length;o>=t.length;o--)this.removeChild(this.childs[o],a)}else if("object"===this.type){for(this.childs||(this.childs=[]),o=this.childs.length-1;o>=0;o--)F(t,this.childs[o].field)||this.removeChild(this.childs[o],a);for(var h in s=0,t)if(F(t,h)){if(n=t[h],void 0!==n&&!(n instanceof Function)){var d=this.findChildByProperty(h);if(d)d.setField(h,!0),d.setValue(n);else{var u=new e(this.editor,{field:h,value:n}),g=s<this.getMaxVisibleChilds();this.appendChild(u,g,a)}}s++}if(this.value="",!0===this.editor.options.sortObjectKeys){var p=!1;this.sort([],"asc",p)}}else this.hideChilds(),delete this.append,delete this.showMore,delete this.expanded,delete this.childs,this.value=t;Array.isArray(l)!==Array.isArray(this.childs)&&this.recreateDom(),this.updateDom({updateIndexes:!0}),this.previousValue=this.value}},{key:"setInternalValue",value:function(t){var i,n,r,s,o,a=!1,l=this.childs;if(this.type=t.type,"array"===t.type){for(this.childs||(this.childs=[]),s=0;s<t.childs.length;s++)i=t.childs[s],void 0===i||i instanceof Function||(s<this.childs.length?(n=this.childs[s],n.fieldEditable=!1,n.index=s,n.setInternalValue(i)):(n=new e(this.editor,{internalValue:i}),r=s<this.getMaxVisibleChilds(),this.appendChild(n,r,a)));for(o=this.childs.length;o>=t.childs.length;o--)this.removeChild(this.childs[o],a)}else if("object"===t.type){for(this.childs||(this.childs=[]),s=0;s<t.childs.length;s++)i=t.childs[s],void 0===i||i instanceof Function||(s<this.childs.length?(n=this.childs[s],delete n.index,n.setField(i.field,!0),n.setInternalValue(i.value)):(n=new e(this.editor,{field:i.field,internalValue:i.value}),r=s<this.getMaxVisibleChilds(),this.appendChild(n,r,a)));for(o=this.childs.length;o>=t.childs.length;o--)this.removeChild(this.childs[o],a)}else this.hideChilds(),delete this.append,delete this.showMore,delete this.expanded,delete this.childs,this.value=t.value;Array.isArray(l)!==Array.isArray(this.childs)&&this.recreateDom(),this.updateDom({updateIndexes:!0}),this.previousValue=this.value}},{key:"recreateDom",value:function(){if(this.dom&&this.dom.tr&&this.dom.tr.parentNode){var e=this._detachFromDom();this.clearDom(),this._attachToDom(e)}else this.clearDom()}},{key:"getValue",value:function(){if("array"===this.type){var e=[];return this.childs.forEach((function(t){e.push(t.getValue())})),e}if("object"===this.type){var t={};return this.childs.forEach((function(e){t[e.getField()]=e.getValue()})),t}return void 0===this.value&&this._getDomValue(),this.value}},{key:"getInternalValue",value:function(){return"array"===this.type?{type:this.type,childs:this.childs.map((function(e){return e.getInternalValue()}))}:"object"===this.type?{type:this.type,childs:this.childs.map((function(e){return{field:e.getField(),value:e.getInternalValue()}}))}:(void 0===this.value&&this._getDomValue(),{type:this.type,value:this.value})}},{key:"getLevel",value:function(){return this.parent?this.parent.getLevel()+1:0}},{key:"getNodePath",value:function(){var e=this.parent?this.parent.getNodePath():[];return e.push(this),e}},{key:"clone",value:function(){var t=new e(this.editor);if(t.type=this.type,t.field=this.field,t.fieldInnerText=this.fieldInnerText,t.fieldEditable=this.fieldEditable,t.previousField=this.previousField,t.value=this.value,t.valueInnerText=this.valueInnerText,t.previousValue=this.previousValue,t.expanded=this.expanded,t.visibleChilds=this.visibleChilds,this.childs){var i=[];this.childs.forEach((function(e){var n=e.clone();n.setParent(t),i.push(n)})),t.childs=i}else t.childs=void 0;return t}},{key:"expand",value:function(e){this.childs&&(this.expanded=!0,this.dom.expand&&(this.dom.expand.className="jsoneditor-button jsoneditor-expanded"),this.showChilds(),!1!==e&&this.childs.forEach((function(t){t.expand(e)})),this.updateDom({recurse:!1}))}},{key:"collapse",value:function(e){this.childs&&(this.hideChilds(),!1!==e&&this.childs.forEach((function(t){t.collapse(e)})),this.dom.expand&&(this.dom.expand.className="jsoneditor-button jsoneditor-collapsed"),this.expanded=!1,this.updateDom({recurse:!1}))}},{key:"showChilds",value:function(){var e=this.childs;if(e&&this.expanded){var t,i=this.dom.tr,n=i?i.parentNode:void 0;if(n){var r=this.getAppendDom();r.parentNode||(t=i.nextSibling,t?n.insertBefore(r,t):n.appendChild(r));var s=Math.min(this.childs.length,this.visibleChilds);t=this._getNextTr();for(var o=0;o<s;o++){var a=this.childs[o];a.getDom().parentNode||n.insertBefore(a.getDom(),t),a.showChilds()}var l=this.getShowMoreDom();t=this._getNextTr(),l.parentNode||n.insertBefore(l,t),this.showMore.updateDom()}}}},{key:"_getNextTr",value:function(){return this.showMore&&this.showMore.getDom().parentNode?this.showMore.getDom():this.append&&this.append.getDom().parentNode?this.append.getDom():void 0}},{key:"hide",value:function(e){var t=this.dom.tr,i=t?t.parentNode:void 0;i&&i.removeChild(t),this.dom.popupAnchor&&this.dom.popupAnchor.destroy(),this.hideChilds(e)}},{key:"hideChilds",value:function(e){var t=this.childs;if(t&&this.expanded){var i=this.getAppendDom();i.parentNode&&i.parentNode.removeChild(i),this.childs.forEach((function(e){e.hide()}));var n=this.getShowMoreDom();n.parentNode&&n.parentNode.removeChild(n),e&&!e.resetVisibleChilds||(this.visibleChilds=this.getMaxVisibleChilds())}}},{key:"_updateCssClassName",value:function(){if(this.dom.field&&this.editor&&this.editor.options&&"function"===typeof this.editor.options.onClassName&&this.dom.tree){Object(c["removeAllClassNames"])(this.dom.tree);var e=this.editor.options.onClassName({path:this.getPath(),field:this.field,value:this.value})||"";Object(c["addClassName"])(this.dom.tree,"jsoneditor-values "+e)}}},{key:"recursivelyUpdateCssClassesOnNodes",value:function(){if(this._updateCssClassName(),Array.isArray(this.childs))for(var e=0;e<this.childs.length;e++)this.childs[e].recursivelyUpdateCssClassesOnNodes()}},{key:"expandTo",value:function(){var e=this.parent;while(e)e.expanded||e.expand(),e=e.parent}},{key:"appendChild",value:function(e,t,i){if(this._hasChilds()){if(e.setParent(this),e.fieldEditable="object"===this.type,"array"===this.type&&(e.index=this.childs.length),"object"===this.type&&void 0===e.field&&e.setField(""),this.childs.push(e),this.expanded&&!1!==t){var n=e.getDom(),r=this._getNextTr(),s=r?r.parentNode:void 0;r&&s&&s.insertBefore(n,r),e.showChilds(),this.visibleChilds++}!1!==i&&(this.updateDom({updateIndexes:!0}),e.updateDom({recurse:!0}))}}},{key:"moveBefore",value:function(e,t,i){if(this._hasChilds()){var n=this.dom.tr?this.dom.tr.parentNode:void 0;if(n){var r=document.createElement("tr");r.style.height=n.clientHeight+"px",n.appendChild(r)}if(e.parent&&e.parent.removeChild(e),t instanceof P||!t)if(this.childs.length+1>this.visibleChilds){var s=this.childs[this.visibleChilds-1];this.insertBefore(e,s,i)}else{var o=!0;this.appendChild(e,o,i)}else this.insertBefore(e,t,i);n&&n.removeChild(r)}}},{key:"insertBefore",value:function(e,t,i){if(this._hasChilds()){if(this.visibleChilds++,"object"===this.type&&void 0===e.field&&e.setField(""),t===this.append)e.setParent(this),e.fieldEditable="object"===this.type,this.childs.push(e);else{var n=this.childs.indexOf(t);if(-1===n)throw new Error("Node not found");e.setParent(this),e.fieldEditable="object"===this.type,this.childs.splice(n,0,e)}if(this.expanded){var r=e.getDom(),s=t.getDom(),o=s?s.parentNode:void 0;s&&o&&o.insertBefore(r,s),e.showChilds(),this.showChilds()}!1!==i&&(this.updateDom({updateIndexes:!0}),e.updateDom({recurse:!0}))}}},{key:"insertAfter",value:function(e,t){if(this._hasChilds()){var i=this.childs.indexOf(t),n=this.childs[i+1];n?this.insertBefore(e,n):this.appendChild(e)}}},{key:"search",value:function(e,t){var i;Array.isArray(t)||(t=[]);var n=e?e.toLowerCase():void 0;if(delete this.searchField,delete this.searchValue,void 0!==this.field&&t.length<=this.MAX_SEARCH_RESULTS){var r=String(this.field).toLowerCase();i=r.indexOf(n),-1!==i&&(this.searchField=!0,t.push({node:this,elem:"field"})),this._updateDomField()}if(this._hasChilds())this.childs&&this.childs.forEach((function(i){i.search(e,t)}));else if(void 0!==this.value&&t.length<=this.MAX_SEARCH_RESULTS){var s=String(this.value).toLowerCase();i=s.indexOf(n),-1!==i&&(this.searchValue=!0,t.push({node:this,elem:"value"})),this._updateDomValue()}return t}},{key:"scrollTo",value:function(e){this.expandPathToNode(),this.dom.tr&&this.dom.tr.parentNode&&this.editor.scrollTo(this.dom.tr.offsetTop,e)}},{key:"expandPathToNode",value:function(){var e=this,t=!1;while(e&&e.parent){var i="array"===e.parent.type?e.index:e.parent.childs.indexOf(e);while(e.parent.visibleChilds<i+1)e.parent.visibleChilds+=this.getMaxVisibleChilds();e.parent.expand(t),e=e.parent}}},{key:"focus",value:function(t){if(e.focusElement=t,this.dom.tr&&this.dom.tr.parentNode){var i=this.dom;switch(t){case"drag":i.drag?i.drag.focus():i.menu.focus();break;case"menu":i.menu.focus();break;case"expand":this._hasChilds()?i.expand.focus():i.field&&this.fieldEditable?(i.field.focus(),Object(c["selectContentEditable"])(i.field)):i.value&&!this._hasChilds()?(i.value.focus(),Object(c["selectContentEditable"])(i.value)):i.menu.focus();break;case"field":i.field&&this.fieldEditable?(i.field.focus(),Object(c["selectContentEditable"])(i.field)):i.value&&!this._hasChilds()?(i.value.focus(),Object(c["selectContentEditable"])(i.value)):this._hasChilds()?i.expand.focus():i.menu.focus();break;case"value":default:i.select?i.select.focus():i.value&&!this._hasChilds()?(i.value.focus(),Object(c["selectContentEditable"])(i.value)):i.field&&this.fieldEditable?(i.field.focus(),Object(c["selectContentEditable"])(i.field)):this._hasChilds()?i.expand.focus():i.menu.focus();break}}}},{key:"containsNode",value:function(e){if(this===e)return!0;var t=this.childs;if(t)for(var i=0,n=t.length;i<n;i++)if(t[i].containsNode(e))return!0;return!1}},{key:"removeChild",value:function(e,t){if(this.childs){var i=this.childs.indexOf(e);if(-1!==i){i<this.visibleChilds&&this.expanded&&this.visibleChilds--,e.hide(),delete e.searchField,delete e.searchValue;var n=this.childs.splice(i,1)[0];return n.parent=null,!1!==t&&this.updateDom({updateIndexes:!0}),n}}}},{key:"_remove",value:function(e){this.removeChild(e)}},{key:"changeType",value:function(e){var t=this.type;if(t!==e){if("string"!==e&&"auto"!==e||"string"!==t&&"auto"!==t){var i=this._detachFromDom();this.clearDom(),this.type=e,"object"===e?(this.childs||(this.childs=[]),this.childs.forEach((function(e){e.clearDom(),delete e.index,e.fieldEditable=!0,void 0===e.field&&(e.field="")})),"string"!==t&&"auto"!==t||(this.expanded=!0)):"array"===e?(this.childs||(this.childs=[]),this.childs.forEach((function(e,t){e.clearDom(),e.fieldEditable=!1,e.index=t})),"string"!==t&&"auto"!==t||(this.expanded=!0)):this.expanded=!1,this._attachToDom(i)}else this.type=e;"auto"!==e&&"string"!==e||(this.value="string"===e?String(this.value):Object(c["parseString"])(String(this.value)),this.focus()),this.updateDom({updateIndexes:!0})}}},{key:"deepEqual",value:function(e){var t;if("array"===this.type){if(!Array.isArray(e))return!1;if(this.childs.length!==e.length)return!1;for(t=0;t<this.childs.length;t++)if(!this.childs[t].deepEqual(e[t]))return!1}else if("object"===this.type){if("object"!==W(e)||!e)return!1;var i=Object.keys(e);if(this.childs.length!==i.length)return!1;for(t=0;t<i.length;t++){var n=this.childs[t];if(n.field!==i[t]||!n.deepEqual(e[n.field]))return!1}}else if(this.value!==e)return!1;return!0}},{key:"_getDomValue",value:function(){if(this._clearValueError(),this.dom.value&&"array"!==this.type&&"object"!==this.type&&(this.valueInnerText=Object(c["getInnerText"])(this.dom.value),""===this.valueInnerText&&""!==this.dom.value.innerHTML&&(this.dom.value.textContent="")),void 0!==this.valueInnerText)try{var e;if("string"===this.type)e=this._unescapeHTML(this.valueInnerText);else{var t=this._unescapeHTML(this.valueInnerText);e=Object(c["parseString"])(t)}e!==this.value&&(this.value=e,this._debouncedOnChangeValue())}catch(i){this._setValueError(Object(p["c"])("cannotParseValueError"))}}},{key:"_setValueError",value:function(e){this.valueError={message:e},this.updateError()}},{key:"_clearValueError",value:function(){this.valueError&&(this.valueError=null,this.updateError())}},{key:"_setFieldError",value:function(e){this.fieldError={message:e},this.updateError()}},{key:"_clearFieldError",value:function(){this.fieldError&&(this.fieldError=null,this.updateError())}},{key:"_onChangeValue",value:function(){var e=this.editor.getDomSelection();if(e.range){var t=Object(c["textDiff"])(String(this.value),String(this.previousValue));e.range.startOffset=t.start,e.range.endOffset=t.end}var i=this.editor.getDomSelection();if(i.range){var n=Object(c["textDiff"])(String(this.previousValue),String(this.value));i.range.startOffset=n.start,i.range.endOffset=n.end}this.editor._onAction("editValue",{path:this.getInternalPath(),oldValue:this.previousValue,newValue:this.value,oldSelection:e,newSelection:i}),this.previousValue=this.value}},{key:"_onChangeField",value:function(){var e=this.editor.getDomSelection(),t=this.previousField||"";if(e.range){var i=Object(c["textDiff"])(this.field,t);e.range.startOffset=i.start,e.range.endOffset=i.end}var n=this.editor.getDomSelection();if(n.range){var r=Object(c["textDiff"])(t,this.field);n.range.startOffset=r.start,n.range.endOffset=r.end}this.editor._onAction("editField",{parentPath:this.parent.getInternalPath(),index:this.getIndex(),oldValue:this.previousField,newValue:this.field,oldSelection:e,newSelection:n}),this.previousField=this.field}},{key:"_updateDomValue",value:function(){var e=this.dom.value;if(e){var t=["jsoneditor-value"],i=this.value,n="auto"===this.type?Object(c["getType"])(i):this.type,r="string"===n&&Object(c["isUrl"])(i);t.push("jsoneditor-"+n),r&&t.push("jsoneditor-url");var s=""===String(this.value)&&"array"!==this.type&&"object"!==this.type;if(s&&t.push("jsoneditor-empty"),this.searchValueActive&&t.push("jsoneditor-highlight-active"),this.searchValue&&t.push("jsoneditor-highlight"),e.className=t.join(" "),"array"===n||"object"===n){var o=this.childs?this.childs.length:0;e.title=this.type+" containing "+o+" items"}else r&&this.editable.value?e.title=Object(p["c"])("openUrl"):e.title="";if("boolean"===n&&this.editable.value?(this.dom.checkbox||(this.dom.checkbox=document.createElement("input"),this.dom.checkbox.type="checkbox",this.dom.tdCheckbox=document.createElement("td"),this.dom.tdCheckbox.className="jsoneditor-tree",this.dom.tdCheckbox.appendChild(this.dom.checkbox),this.dom.tdValue.parentNode.insertBefore(this.dom.tdCheckbox,this.dom.tdValue)),this.dom.checkbox.checked=this.value):this.dom.tdCheckbox&&(this.dom.tdCheckbox.parentNode.removeChild(this.dom.tdCheckbox),delete this.dom.tdCheckbox,delete this.dom.checkbox),this["enum"]&&this.editable.value){if(!this.dom.select){this.dom.select=document.createElement("select"),this.id=this.field+"_"+(new Date).getUTCMilliseconds(),this.dom.select.id=this.id,this.dom.select.name=this.dom.select.id,this.dom.select.option=document.createElement("option"),this.dom.select.option.value="",this.dom.select.option.textContent="--",this.dom.select.appendChild(this.dom.select.option);for(var a=0;a<this["enum"].length;a++)this.dom.select.option=document.createElement("option"),this.dom.select.option.value=this["enum"][a],this.dom.select.option.textContent=this["enum"][a],this.dom.select.option.value===this.value&&(this.dom.select.option.selected=!0),this.dom.select.appendChild(this.dom.select.option);this.dom.tdSelect=document.createElement("td"),this.dom.tdSelect.className="jsoneditor-tree",this.dom.tdSelect.appendChild(this.dom.select),this.dom.tdValue.parentNode.insertBefore(this.dom.tdSelect,this.dom.tdValue)}!this.schema||F(this.schema,"oneOf")||F(this.schema,"anyOf")||F(this.schema,"allOf")?delete this.valueFieldHTML:(this.valueFieldHTML=this.dom.tdValue.innerHTML,this.dom.tdValue.style.visibility="hidden",this.dom.tdValue.textContent="")}else this.dom.tdSelect&&(this.dom.tdSelect.parentNode.removeChild(this.dom.tdSelect),delete this.dom.tdSelect,delete this.dom.select,this.dom.tdValue.innerHTML=this.valueFieldHTML,this.dom.tdValue.style.visibility="",delete this.valueFieldHTML);if(this.editable.value&&this.editor.options.colorPicker&&"string"===typeof i&&Object(c["isValidColor"])(i)?(this.dom.color||(this.dom.color=document.createElement("div"),this.dom.color.className="jsoneditor-color",this.dom.tdColor=document.createElement("td"),this.dom.tdColor.className="jsoneditor-tree",this.dom.tdColor.appendChild(this.dom.color),this.dom.tdValue.parentNode.insertBefore(this.dom.tdColor,this.dom.tdValue)),Object(c["addClassName"])(this.dom.value,"jsoneditor-color-value"),this.dom.color.style.backgroundColor=i):this._deleteDomColor(),this._showTimestampTag()){this.dom.date||(this.dom.date=document.createElement("div"),this.dom.date.className="jsoneditor-date",this.dom.value.parentNode.appendChild(this.dom.date));var l=null;if("function"===typeof this.editor.options.timestampFormat&&(l=this.editor.options.timestampFormat({field:this.field,value:this.value,path:this.getPath()})),l){while(this.dom.date.firstChild)this.dom.date.removeChild(this.dom.date.firstChild);this.dom.date.appendChild(document.createTextNode(l))}else this.dom.date.textContent=new Date(i).toISOString();this.dom.date.title=new Date(i).toString()}else this.dom.date&&(this.dom.date.parentNode.removeChild(this.dom.date),delete this.dom.date);Object(c["stripFormatting"])(e),this._updateDomDefault()}}},{key:"_deleteDomColor",value:function(){this.dom.color&&(this.dom.tdColor.parentNode.removeChild(this.dom.tdColor),delete this.dom.tdColor,delete this.dom.color,Object(c["removeClassName"])(this.dom.value,"jsoneditor-color-value"))}},{key:"_updateDomField",value:function(){var e=this.dom.field;if(e){var t=Object(c["makeFieldTooltip"])(this.schema,this.editor.options.language);t&&(e.title=t);var i=""===String(this.field)&&"array"!==this.parent.type;i?Object(c["addClassName"])(e,"jsoneditor-empty"):Object(c["removeClassName"])(e,"jsoneditor-empty"),this.searchFieldActive?Object(c["addClassName"])(e,"jsoneditor-highlight-active"):Object(c["removeClassName"])(e,"jsoneditor-highlight-active"),this.searchField?Object(c["addClassName"])(e,"jsoneditor-highlight"):Object(c["removeClassName"])(e,"jsoneditor-highlight"),Object(c["stripFormatting"])(e)}}},{key:"_getDomField",value:function(e){if(this._clearFieldError(),this.dom.field&&this.fieldEditable&&(this.fieldInnerText=Object(c["getInnerText"])(this.dom.field),""===this.fieldInnerText&&""!==this.dom.field.innerHTML&&(this.dom.field.textContent="")),void 0!==this.fieldInnerText)try{var t=this._unescapeHTML(this.fieldInnerText),i=this.parent.getFieldNames(this),n=-1!==i.indexOf(t);n?e?(t=Object(c["findUniqueName"])(t,i),t!==this.field&&(this.field=t,this._debouncedOnChangeField())):this._setFieldError(Object(p["c"])("duplicateFieldError")):t!==this.field&&(this.field=t,this._debouncedOnChangeField())}catch(r){this._setFieldError(Object(p["c"])("cannotParseFieldError"))}}},{key:"_updateDomDefault",value:function(){if(this.schema&&void 0!==this.schema["default"]&&!this._hasChilds()){var e=this.dom.select?this.dom.select:this.dom.value;e&&(this.value===this.schema["default"]?(e.title=Object(p["c"])("default"),Object(c["addClassName"])(e,"jsoneditor-is-default"),Object(c["removeClassName"])(e,"jsoneditor-is-not-default")):(e.removeAttribute("title"),Object(c["removeClassName"])(e,"jsoneditor-is-default"),Object(c["addClassName"])(e,"jsoneditor-is-not-default")))}}},{key:"_showTimestampTag",value:function(){if("number"!==typeof this.value)return!1;var e=this.editor.options.timestampTag;if("function"===typeof e){var t=e({field:this.field,value:this.value,path:this.getPath()});return"boolean"===typeof t?t:Object(c["isTimestamp"])(this.field,this.value)}return!0===e&&Object(c["isTimestamp"])(this.field,this.value)}},{key:"clearDom",value:function(){this.dom={}}},{key:"getDom",value:function(){var e=this.dom;if(e.tr)return e.tr;if(this._updateEditability(),e.tr=document.createElement("tr"),e.tr.node=this,"tree"===this.editor.options.mode){var t=document.createElement("td");if(this.editable.field&&this.parent){var i=document.createElement("button");i.type="button",e.drag=i,i.className="jsoneditor-button jsoneditor-dragarea",i.title=Object(p["c"])("drag"),t.appendChild(i)}e.tr.appendChild(t);var n=document.createElement("td"),r=document.createElement("button");r.type="button",e.menu=r,r.className="jsoneditor-button jsoneditor-contextmenu-button",r.title=Object(p["c"])("actionsMenu"),n.appendChild(e.menu),e.tr.appendChild(n)}var s=document.createElement("td");return e.tr.appendChild(s),e.tree=this._createDomTree(),s.appendChild(e.tree),this.updateDom({updateIndexes:!0}),e.tr}},{key:"isVisible",value:function(){return this.dom&&this.dom.tr&&this.dom.tr.parentNode||!1}},{key:"isDescendantOf",value:function(e){var t=this.parent;while(t){if(t===e)return!0;t=t.parent}return!1}},{key:"_createDomField",value:function(){return document.createElement("div")}},{key:"setHighlight",value:function(e){this.dom.tr&&(e?Object(c["addClassName"])(this.dom.tr,"jsoneditor-highlight"):Object(c["removeClassName"])(this.dom.tr,"jsoneditor-highlight"),this.append&&this.append.setHighlight(e),this.childs&&this.childs.forEach((function(t){t.setHighlight(e)})))}},{key:"setSelected",value:function(e,t){this.selected=e,this.dom.tr&&(e?Object(c["addClassName"])(this.dom.tr,"jsoneditor-selected"):Object(c["removeClassName"])(this.dom.tr,"jsoneditor-selected"),t?Object(c["addClassName"])(this.dom.tr,"jsoneditor-first"):Object(c["removeClassName"])(this.dom.tr,"jsoneditor-first"),this.append&&this.append.setSelected(e),this.showMore&&this.showMore.setSelected(e),this.childs&&this.childs.forEach((function(t){t.setSelected(e)})))}},{key:"updateValue",value:function(e){this.value=e,this.previousValue=e,this.valueError=void 0,this.updateDom()}},{key:"updateField",value:function(e){this.field=e,this.previousField=e,this.fieldError=void 0,this.updateDom()}},{key:"updateDom",value:function(t){var i=this.dom.tree;i&&(i.style.marginLeft=24*this.getLevel()+"px");var n=this.dom.field;if(n){var r;if(this.fieldEditable?(n.contentEditable=this.editable.field,n.spellcheck=!1,n.className="jsoneditor-field"):(n.contentEditable=!1,n.className="jsoneditor-readonly"),void 0!==this.index)r=this.index;else if(void 0!==this.field)r=this.field;else{var s=this.editor.options.schema?e._findSchema(this.editor.options.schema,this.editor.options.schemaRefs||{},this.getPath()):void 0;r=s&&s.title?s.title:this._hasChilds()?this.type:""}var o=this._escapeHTML(r);document.activeElement===n&&o===this._unescapeHTML(Object(c["getInnerText"])(n))||(n.innerHTML=o),this._updateSchema()}var a=this.dom.value;if(a)if("array"===this.type||"object"===this.type)this.updateNodeName();else{var l=this._escapeHTML(this.value);document.activeElement===a&&l===this._unescapeHTML(Object(c["getInnerText"])(a))||(a.innerHTML=l)}var h=this.dom.tr;h&&("array"===this.type||"object"===this.type?(Object(c["addClassName"])(h,"jsoneditor-expandable"),this.expanded?(Object(c["addClassName"])(h,"jsoneditor-expanded"),Object(c["removeClassName"])(h,"jsoneditor-collapsed")):(Object(c["addClassName"])(h,"jsoneditor-collapsed"),Object(c["removeClassName"])(h,"jsoneditor-expanded"))):(Object(c["removeClassName"])(h,"jsoneditor-expandable"),Object(c["removeClassName"])(h,"jsoneditor-expanded"),Object(c["removeClassName"])(h,"jsoneditor-collapsed"))),this._updateDomField(),this._updateDomValue(),t&&!0===t.updateIndexes&&this._updateDomIndexes(),t&&!0===t.recurse&&this.childs&&this.childs.forEach((function(e){e.updateDom(t)})),this.error&&this.updateError(),this.append&&this.append.updateDom(),this.showMore&&this.showMore.updateDom(),this._updateCssClassName()}},{key:"_updateSchema",value:function(){this.editor&&this.editor.options&&(this.schema=this.editor.options.schema?e._findSchema(this.editor.options.schema,this.editor.options.schemaRefs||{},this.getPath()):null,this.schema?this["enum"]=e._findEnum(this.schema):delete this["enum"])}},{key:"_updateDomIndexes",value:function(){var e=this.dom.value,t=this.childs;e&&t&&("array"===this.type?t.forEach((function(e,t){e.index=t;var i=e.dom.field;i&&(i.textContent=t)})):"object"===this.type&&t.forEach((function(e){void 0!==e.index&&(delete e.index,void 0===e.field&&(e.field=""))})))}},{key:"_createDomValue",value:function(){var e;return"array"===this.type?(e=document.createElement("div"),e.textContent="[...]"):"object"===this.type?(e=document.createElement("div"),e.textContent="{...}"):!this.editable.value&&Object(c["isUrl"])(this.value)?(e=document.createElement("a"),e.href=this.value,e.innerHTML=this._escapeHTML(this.value)):(e=document.createElement("div"),e.contentEditable=this.editable.value,e.spellcheck=!1,e.innerHTML=this._escapeHTML(this.value)),e}},{key:"_createDomExpandButton",value:function(){var e=document.createElement("button");return e.type="button",this._hasChilds()?(e.className=this.expanded?"jsoneditor-button jsoneditor-expanded":"jsoneditor-button jsoneditor-collapsed",e.title=Object(p["c"])("expandTitle")):(e.className="jsoneditor-button jsoneditor-invisible",e.title=""),e}},{key:"_createDomTree",value:function(){var e=this.dom,t=document.createElement("table"),i=document.createElement("tbody");t.style.borderCollapse="collapse",t.className="jsoneditor-values",t.appendChild(i);var n=document.createElement("tr");i.appendChild(n);var r=document.createElement("td");r.className="jsoneditor-tree",n.appendChild(r),e.expand=this._createDomExpandButton(),r.appendChild(e.expand),e.tdExpand=r;var s=document.createElement("td");s.className="jsoneditor-tree",n.appendChild(s),e.field=this._createDomField(),s.appendChild(e.field),e.tdField=s;var o=document.createElement("td");o.className="jsoneditor-tree",n.appendChild(o),"object"!==this.type&&"array"!==this.type&&(o.appendChild(document.createTextNode(":")),o.className="jsoneditor-separator"),e.tdSeparator=o;var a=document.createElement("td");return a.className="jsoneditor-tree",n.appendChild(a),e.value=this._createDomValue(),a.appendChild(e.value),e.tdValue=a,t}},{key:"onEvent",value:function(e){var t=e.type,i=e.target||e.srcElement,n=this.dom,r=this,s=this._hasChilds();if("function"===typeof this.editor.options.onEvent&&this._onEvent(e),i!==n.drag&&i!==n.menu||("mouseover"===t?this.editor.highlighter.highlight(this):"mouseout"===t&&this.editor.highlighter.unhighlight()),"click"===t&&i===n.menu){var o=r.editor.highlighter;o.highlight(r),o.lock(),Object(c["addClassName"])(n.menu,"jsoneditor-selected"),this.showContextMenu(n.menu,(function(){Object(c["removeClassName"])(n.menu,"jsoneditor-selected"),o.unlock(),o.unhighlight()}))}if("click"===t&&i===n.expand&&s){var a=e.ctrlKey;this._onExpand(a)}"click"!==t||e.target!==r.dom.tdColor&&e.target!==r.dom.color||this._showColorPicker(),"change"===t&&i===n.checkbox&&(this.dom.value.textContent=String(!this.value),this._getDomValue(),this._updateDomDefault()),"change"===t&&i===n.select&&(this.dom.value.innerHTML=this._escapeHTML(n.select.value),this._getDomValue(),this._updateDomValue());var l=n.value;if(i===l)switch(t){case"blur":case"change":this._getDomValue(),this._clearValueError(),this._updateDomValue();var h=this._escapeHTML(this.value);h!==this._unescapeHTML(Object(c["getInnerText"])(l))&&(l.innerHTML=h);break;case"input":this._getDomValue(),this._updateDomValue();break;case"keydown":case"mousedown":this.editor.selection=this.editor.getDomSelection();break;case"click":e.ctrlKey&&this.editable.value&&Object(c["isUrl"])(this.value)&&(e.preventDefault(),window.open(this.value,"_blank"));break;case"keyup":this._getDomValue(),this._updateDomValue();break;case"cut":case"paste":setTimeout((function(){r._getDomValue(),r._updateDomValue()}),1);break}var d=n.field;if(i===d)switch(t){case"blur":this._getDomField(!0),this._updateDomField();var u=this._escapeHTML(this.field);u!==this._unescapeHTML(Object(c["getInnerText"])(d))&&(d.innerHTML=u);break;case"input":this._getDomField(),this._updateSchema(),this._updateDomField(),this._updateDomValue();break;case"keydown":case"mousedown":this.editor.selection=this.editor.getDomSelection();break;case"keyup":this._getDomField(),this._updateDomField();break;case"cut":case"paste":setTimeout((function(){r._getDomField(),r._updateDomField()}),1);break}var g=n.tree;if(g&&i===g.parentNode&&"click"===t&&!e.hasMoved){var p=void 0!==e.offsetX?e.offsetX<24*(this.getLevel()+1):e.pageX<Object(c["getAbsoluteLeft"])(n.tdSeparator);p||s?d&&(Object(c["setEndOfContentEditable"])(d),d.focus()):l&&!this["enum"]&&(Object(c["setEndOfContentEditable"])(l),l.focus())}(i!==n.tdExpand||s)&&i!==n.tdField&&i!==n.tdSeparator||"click"!==t||e.hasMoved||d&&(Object(c["setEndOfContentEditable"])(d),d.focus()),"keydown"===t&&this.onKeyDown(e)}},{key:"_onEvent",value:function(e){var t=e.target;if(t===this.dom.field||t===this.dom.value){var i={field:this.getField(),path:this.getPath()};this._hasChilds()||t!==this.dom.value||(i.value=this.getValue()),this.editor.options.onEvent(i,e)}}},{key:"onKeyDown",value:function(t){var i,n,r,s,o,a,l,h,d,u,g,p,m,f=t.which||t.keyCode,C=t.target||t.srcElement,I=t.ctrlKey,A=t.shiftKey,v=t.altKey,b=!1,y="tree"===this.editor.options.mode,w=this.editor.multiselection.nodes.length>0?this.editor.multiselection.nodes:[this],S=w[0],x=w[w.length-1];if(13===f){if(C===this.dom.value)this.editable.value&&!t.ctrlKey||Object(c["isUrl"])(this.value)&&(window.open(this.value,"_blank"),b=!0);else if(C===this.dom.expand){var k=this._hasChilds();if(k){var R=t.ctrlKey;this._onExpand(R),C.focus(),b=!0}}}else if(68===f)I&&y&&(e.onDuplicate(w),b=!0);else if(69===f)I&&(this._onExpand(A),C.focus(),b=!0);else if(77===f&&y)I&&(this.showContextMenu(C),b=!0);else if(46===f&&y)I&&(e.onRemove(w),b=!0);else if(45===f&&y)I&&!A?(this._onInsertBefore(),b=!0):I&&A&&(this._onInsertAfter(),b=!0);else if(35===f){if(v){var E=this._lastNode();E&&E.focus(e.focusElement||this._getElementName(C)),b=!0}}else if(36===f){if(v){var B=this._firstNode();B&&B.focus(e.focusElement||this._getElementName(C)),b=!0}}else if(37===f){if(v&&!A){var Z=this._previousElement(C);Z&&this.focus(this._getElementName(Z)),b=!0}else if(v&&A&&y){if(x.expanded){var G=x.getAppendDom();r=G?G.nextSibling:void 0}else{var T=x.getDom();r=T.nextSibling}if(r){n=e.getNodeFromTarget(r),s=r.nextSibling;var W=e.getNodeFromTarget(s);n&&n instanceof P&&1!==x.parent.childs.length&&W&&W.parent&&(o=this.editor.getDomSelection(),l=S.parent,a=l.childs[x.getIndex()+1]||l.append,h=S.getIndex(),d=W.getIndex(),u=l.getInternalPath(),g=W.parent.getInternalPath(),w.forEach((function(e){W.parent.moveBefore(e,W)})),this.focus(e.focusElement||this._getElementName(C)),this.editor._onAction("moveNodes",{count:w.length,fieldNames:w.map(O),oldParentPath:l.getInternalPath(),newParentPath:S.parent.getInternalPath(),oldIndex:a.getIndex(),newIndex:S.getIndex(),oldIndexRedo:h,newIndexRedo:d,oldParentPathRedo:u,newParentPathRedo:g,oldSelection:o,newSelection:this.editor.getDomSelection()}))}}}else if(38===f)v&&!A?(i=this._previousNode(),i&&(this.editor.deselect(!0),i.focus(e.focusElement||this._getElementName(C))),b=!0):!v&&I&&A&&y?(i=this._previousNode(),i&&(m=this.editor.multiselection,m.start=m.start||this,m.end=i,p=this.editor._findTopLevelNodes(m.start,m.end),this.editor.select(p),i.focus("field")),b=!0):v&&A&&y&&(i=S._previousNode(),i&&i.parent&&(o=this.editor.getDomSelection(),l=S.parent,a=l.childs[x.getIndex()+1]||l.append,h=S.getIndex(),d=i.getIndex(),u=l.getInternalPath(),g=i.parent.getInternalPath(),w.forEach((function(e){i.parent.moveBefore(e,i)})),this.focus(e.focusElement||this._getElementName(C)),this.editor._onAction("moveNodes",{count:w.length,fieldNames:w.map(O),oldParentPath:l.getInternalPath(),newParentPath:S.parent.getInternalPath(),oldIndex:a.getIndex(),newIndex:S.getIndex(),oldIndexRedo:h,newIndexRedo:d,oldParentPathRedo:u,newParentPathRedo:g,oldSelection:o,newSelection:this.editor.getDomSelection()})),b=!0);else if(39===f){if(v&&!A){var _=this._nextElement(C);_&&this.focus(this._getElementName(_)),b=!0}else if(v&&A&&y){T=S.getDom();var H=T.previousSibling;H&&(i=e.getNodeFromTarget(H),i&&i.parent&&!i.isVisible()&&(o=this.editor.getDomSelection(),l=S.parent,a=l.childs[x.getIndex()+1]||l.append,h=S.getIndex(),d=i.getIndex(),u=l.getInternalPath(),g=i.parent.getInternalPath(),w.forEach((function(e){i.parent.moveBefore(e,i)})),this.focus(e.focusElement||this._getElementName(C)),this.editor._onAction("moveNodes",{count:w.length,fieldNames:w.map(O),oldParentPath:l.getInternalPath(),newParentPath:S.parent.getInternalPath(),oldIndex:a.getIndex(),newIndex:S.getIndex(),oldIndexRedo:h,newIndexRedo:d,oldParentPathRedo:u,newParentPathRedo:g,oldSelection:o,newSelection:this.editor.getDomSelection()})))}}else if(40===f)if(v&&!A)n=this._nextNode(),n&&(this.editor.deselect(!0),n.focus(e.focusElement||this._getElementName(C))),b=!0;else if(!v&&I&&A&&y)n=this._nextNode(),n&&(m=this.editor.multiselection,m.start=m.start||this,m.end=n,p=this.editor._findTopLevelNodes(m.start,m.end),this.editor.select(p),n.focus("field")),b=!0;else if(v&&A&&y){n=x.expanded?x.append?x.append._nextNode():void 0:x._nextNode(),n&&!n.isVisible()&&(n=n.parent.showMore),n&&n instanceof P&&(n=x);var $=n&&(n._nextNode()||n.parent.append);$&&$.parent&&(o=this.editor.getDomSelection(),l=S.parent,a=l.childs[x.getIndex()+1]||l.append,h=S.getIndex(),d=$.getIndex(),u=l.getInternalPath(),g=$.parent.getInternalPath(),w.forEach((function(e){$.parent.moveBefore(e,$)})),this.focus(e.focusElement||this._getElementName(C)),this.editor._onAction("moveNodes",{count:w.length,fieldNames:w.map(O),oldParentPath:l.getInternalPath(),newParentPath:S.parent.getInternalPath(),oldParentPathRedo:u,newParentPathRedo:g,oldIndexRedo:h,newIndexRedo:d,oldIndex:a.getIndex(),newIndex:S.getIndex(),oldSelection:o,newSelection:this.editor.getDomSelection()})),b=!0}b&&(t.preventDefault(),t.stopPropagation())}},{key:"_onExpand",value:function(e){if(e){var t=this.dom.tr.parentNode,i=t.parentNode,n=i.scrollTop;i.removeChild(t)}this.expanded?this.collapse(e):this.expand(e),e&&(i.appendChild(t),i.scrollTop=n)}},{key:"_showColorPicker",value:function(){if("function"===typeof this.editor.options.onColorPicker&&this.dom.color){var e=this;e._deleteDomColor(),e.updateDom();var t=Object(k["a"])(this.dom.color,this.editor.getPopupAnchor());this.editor.options.onColorPicker(t,this.value,(function(t){"string"===typeof t&&t!==e.value&&(e._deleteDomColor(),e.value=t,e.updateDom(),e._debouncedOnChangeValue())}))}}},{key:"getFieldNames",value:function(e){return"object"===this.type?this.childs.filter((function(t){return t!==e})).map((function(e){return e.field})):[]}},{key:"_onInsertBefore",value:function(t,i,n){var r=this.editor.getDomSelection(),s=new e(this.editor,{field:void 0!==t?t:"",value:void 0!==i?i:"",type:n});s.expand(!0);var o=this.getInternalPath();this.parent.insertBefore(s,this),this.editor.highlighter.unhighlight(),s.focus("field");var a=this.editor.getDomSelection();this.editor._onAction("insertBeforeNodes",{nodes:[s],paths:[s.getInternalPath()],beforePath:o,parentPath:this.parent.getInternalPath(),oldSelection:r,newSelection:a})}},{key:"_onInsertAfter",value:function(t,i,n){var r=this.editor.getDomSelection(),s=new e(this.editor,{field:void 0!==t?t:"",value:void 0!==i?i:"",type:n});s.expand(!0),this.parent.insertAfter(s,this),this.editor.highlighter.unhighlight(),s.focus("field");var o=this.editor.getDomSelection();this.editor._onAction("insertAfterNodes",{nodes:[s],paths:[s.getInternalPath()],afterPath:this.getInternalPath(),parentPath:this.parent.getInternalPath(),oldSelection:r,newSelection:o})}},{key:"_onAppend",value:function(t,i,n){var r=this.editor.getDomSelection(),s=new e(this.editor,{field:void 0!==t?t:"",value:void 0!==i?i:"",type:n});s.expand(!0),this.parent.appendChild(s),this.editor.highlighter.unhighlight(),s.focus("field");var o=this.editor.getDomSelection();this.editor._onAction("appendNodes",{nodes:[s],paths:[s.getInternalPath()],parentPath:this.parent.getInternalPath(),oldSelection:r,newSelection:o})}},{key:"_onChangeType",value:function(e){var t=this.type;if(e!==t){var i=this.editor.getDomSelection();this.changeType(e);var n=this.editor.getDomSelection();this.editor._onAction("changeType",{path:this.getInternalPath(),oldType:t,newType:e,oldSelection:i,newSelection:n})}}},{key:"sort",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("string"===typeof e&&(e=Object(c["parsePath"])(e)),this._hasChilds()){this.hideChilds();var n=this.childs;this.childs=this.childs.concat();var r="desc"===t?-1:1;"object"===this.type?this.childs.sort((function(e,t){return r*x()(e.field,t.field)})):this.childs.sort((function(t,i){var n=t.getNestedChild(e),s=i.getNestedChild(e);if(!n)return r;if(!s)return-r;var o=n.value,a=s.value;return"string"!==typeof o&&"string"!==typeof a?o>a?r:o<a?-r:0:r*x()(o,a)})),this._updateDomIndexes(),this.showChilds(),!0===i&&this.editor._onAction("sort",{path:this.getInternalPath(),oldChilds:n,newChilds:this.childs})}}},{key:"update",value:function(e){var t=this.getInternalValue();this.setValue(e),this.editor._onAction("transform",{path:this.getInternalPath(),oldValue:t,newValue:this.getInternalValue()})}},{key:"_detachFromDom",value:function(){var e,t=this.dom.tr?this.dom.tr.parentNode:void 0;e=this.expanded?this.getAppendDom():this.getDom();var i=e&&e.parentNode?e.nextSibling:void 0;return this.hide({resetVisibleChilds:!1}),{table:t,nextTr:i}}},{key:"_attachToDom",value:function(e){e.table&&(e.nextTr?e.table.insertBefore(this.getDom(),e.nextTr):e.table.appendChild(this.getDom())),this.expanded&&this.showChilds()}},{key:"transform",value:function(e){if(this._hasChilds()){this.hideChilds();try{var t=this.getInternalValue(),i=this.getValue(),n=this.editor.options.executeQuery(i,e);this.setValue(n);var r=this.getInternalValue();this.editor._onAction("transform",{path:this.getInternalPath(),oldValue:t,newValue:r}),this.showChilds()}catch(s){this.showChilds(),this.editor._onError(s)}}}},{key:"extract",value:function(){this.editor.node.hideChilds(),this.hideChilds();try{var e=this.editor.node.getInternalValue();this.editor._setRoot(this);var t=this.editor.node.getInternalValue();this.editor._onAction("transform",{path:this.editor.node.getInternalPath(),oldValue:e,newValue:t})}catch(i){this.editor._onError(i)}finally{this.updateDom({recurse:!0}),this.showChilds()}}},{key:"getNestedChild",value:function(e){var t=0,i=this;while(i&&t<e.length)i=i.findChildByProperty(e[t]),t++;return i}},{key:"findChildByProperty",value:function(e){if("object"===this.type)return this.childs.find((function(t){return t.field===e}))}},{key:"getAppendDom",value:function(){return this.append||(this.append=new P(this.editor),this.append.setParent(this)),this.append.getDom()}},{key:"getShowMoreDom",value:function(){return this.showMore||(this.showMore=new K(this.editor,this)),this.showMore.getDom()}},{key:"nextSibling",value:function(){var e=this.parent.childs.indexOf(this);return this.parent.childs[e+1]||this.parent.append}},{key:"_previousNode",value:function(){var t=null,i=this.getDom();if(i&&i.parentNode){var n=i;do{n=n.previousSibling,t=e.getNodeFromTarget(n)}while(n&&t&&t instanceof P&&!t.isVisible())}return t}},{key:"_nextNode",value:function(){var t=null,i=this.getDom();if(i&&i.parentNode){var n=i;do{n=n.nextSibling,t=e.getNodeFromTarget(n)}while(n&&t&&t instanceof P&&!t.isVisible())}return t}},{key:"_firstNode",value:function(){var t=null,i=this.getDom();if(i&&i.parentNode){var n=i.parentNode.firstChild;t=e.getNodeFromTarget(n)}return t}},{key:"_lastNode",value:function(){var t=null,i=this.getDom();if(i&&i.parentNode){var n=i.parentNode.lastChild;t=e.getNodeFromTarget(n);while(n&&t&&!t.isVisible())n=n.previousSibling,t=e.getNodeFromTarget(n)}return t}},{key:"_previousElement",value:function(e){var t=this.dom;switch(e){case t.value:if(this.fieldEditable)return t.field;case t.field:if(this._hasChilds())return t.expand;case t.expand:return t.menu;case t.menu:if(t.drag)return t.drag;default:return null}}},{key:"_nextElement",value:function(e){var t=this.dom;switch(e){case t.drag:return t.menu;case t.menu:if(this._hasChilds())return t.expand;case t.expand:if(this.fieldEditable)return t.field;case t.field:if(!this._hasChilds())return t.value;default:return null}}},{key:"_getElementName",value:function(e){var t=this;return Object.keys(this.dom).find((function(i){return t.dom[i]===e}))}},{key:"_hasChilds",value:function(){return"array"===this.type||"object"===this.type}},{key:"addTemplates",value:function(e,t){var i=this,n=i.editor.options.templates;if(null!=n){n.length&&e.push({type:"separator"});var r=function(e,t){i._onAppend(e,t)},s=function(e,t){i._onInsertBefore(e,t)};n.forEach((function(i){e.push({text:i.text,className:i.className||"jsoneditor-type-object",title:i.title,click:t?r.bind(this,i.field,i.value):s.bind(this,i.field,i.value)})}))}}},{key:"showContextMenu",value:function(t,i){var n=this,r=[];if(this.editable.value&&r.push({text:Object(p["c"])("type"),title:Object(p["c"])("typeTitle"),className:"jsoneditor-type-"+this.type,submenu:[{text:Object(p["c"])("auto"),className:"jsoneditor-type-auto"+("auto"===this.type?" jsoneditor-selected":""),title:Object(p["c"])("autoType"),click:function(){n._onChangeType("auto")}},{text:Object(p["c"])("array"),className:"jsoneditor-type-array"+("array"===this.type?" jsoneditor-selected":""),title:Object(p["c"])("arrayType"),click:function(){n._onChangeType("array")}},{text:Object(p["c"])("object"),className:"jsoneditor-type-object"+("object"===this.type?" jsoneditor-selected":""),title:Object(p["c"])("objectType"),click:function(){n._onChangeType("object")}},{text:Object(p["c"])("string"),className:"jsoneditor-type-string"+("string"===this.type?" jsoneditor-selected":""),title:Object(p["c"])("stringType"),click:function(){n._onChangeType("string")}}]}),this._hasChilds()&&(this.editor.options.enableSort&&r.push({text:Object(p["c"])("sort"),title:Object(p["c"])("sortTitle",{type:this.type}),className:"jsoneditor-sort-asc",click:function(){n.showSortModal()}}),this.editor.options.enableTransform&&r.push({text:Object(p["c"])("transform"),title:Object(p["c"])("transformTitle",{type:this.type}),className:"jsoneditor-transform",click:function(){n.showTransformModal()}}),this.parent&&r.push({text:Object(p["c"])("extract"),title:Object(p["c"])("extractTitle",{type:this.type}),className:"jsoneditor-extract",click:function(){n.extract()}})),this.parent&&this.parent._hasChilds()){r.length&&r.push({type:"separator"});var s=n.parent.childs;if(n===s[s.length-1]){var o=[{text:Object(p["c"])("auto"),className:"jsoneditor-type-auto",title:Object(p["c"])("autoType"),click:function(){n._onAppend("","","auto")}},{text:Object(p["c"])("array"),className:"jsoneditor-type-array",title:Object(p["c"])("arrayType"),click:function(){n._onAppend("",[])}},{text:Object(p["c"])("object"),className:"jsoneditor-type-object",title:Object(p["c"])("objectType"),click:function(){n._onAppend("",{})}},{text:Object(p["c"])("string"),className:"jsoneditor-type-string",title:Object(p["c"])("stringType"),click:function(){n._onAppend("","","string")}}];n.addTemplates(o,!0),r.push({text:Object(p["c"])("appendText"),title:Object(p["c"])("appendTitle"),submenuTitle:Object(p["c"])("appendSubmenuTitle"),className:"jsoneditor-append",click:function(){n._onAppend("","","auto")},submenu:o})}var a=[{text:Object(p["c"])("auto"),className:"jsoneditor-type-auto",title:Object(p["c"])("autoType"),click:function(){n._onInsertBefore("","","auto")}},{text:Object(p["c"])("array"),className:"jsoneditor-type-array",title:Object(p["c"])("arrayType"),click:function(){n._onInsertBefore("",[])}},{text:Object(p["c"])("object"),className:"jsoneditor-type-object",title:Object(p["c"])("objectType"),click:function(){n._onInsertBefore("",{})}},{text:Object(p["c"])("string"),className:"jsoneditor-type-string",title:Object(p["c"])("stringType"),click:function(){n._onInsertBefore("","","string")}}];n.addTemplates(a,!1),r.push({text:Object(p["c"])("insert"),title:Object(p["c"])("insertTitle"),submenuTitle:Object(p["c"])("insertSub"),className:"jsoneditor-insert",click:function(){n._onInsertBefore("","","auto")},submenu:a}),this.editable.field&&(r.push({text:Object(p["c"])("duplicateText"),title:Object(p["c"])("duplicateField"),className:"jsoneditor-duplicate",click:function(){e.onDuplicate(n)}}),r.push({text:Object(p["c"])("removeText"),title:Object(p["c"])("removeField"),className:"jsoneditor-remove",click:function(){e.onRemove(n)}}))}if(this.editor.options.onCreateMenu){var l=n.getPath();r=this.editor.options.onCreateMenu(r,{type:"single",path:l,paths:[l]})}var c=new A["a"](r,{close:i});c.show(t,this.editor.getPopupAnchor())}},{key:"showSortModal",value:function(){var e=this,t=this.editor.options.modalAnchor||G["a"],i=this.getValue();function n(t){var i=t.path,n=Object(c["parsePath"])(i);e.sortedBy=t,e.sort(n,t.direction)}Object(B["showSortModal"])(t,i,n,e.sortedBy)}},{key:"showTransformModal",value:function(){var e=this,t=this.editor.options,i=t.modalAnchor,n=t.createQuery,r=t.executeQuery,s=t.queryDescription,o=this.getValue();Object(Z["showTransformModal"])({anchor:i||G["a"],json:o,queryDescription:s,createQuery:n,executeQuery:r,onTransform:function(t){e.transform(t)}})}},{key:"_getType",value:function(e){return e instanceof Array?"array":e instanceof Object?"object":"string"===typeof e&&"string"!==typeof Object(c["parseString"])(e)?"string":"auto"}},{key:"_escapeHTML",value:function(e){if("string"!==typeof e)return String(e);var t=String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/ {2}/g," ").replace(/^ /," ").replace(/ $/," "),i=JSON.stringify(t),n=i.substring(1,i.length-1);return!0===this.editor.options.escapeUnicode&&(n=Object(c["escapeUnicodeChars"])(n)),n}},{key:"_unescapeHTML",value:function(e){var t='"'+this._escapeJSON(e)+'"',i=Object(c["parse"])(t);return i.replace(/</g,"<").replace(/>/g,">").replace(/ |\u00A0/g," ").replace(/&/g,"&")}},{key:"_escapeJSON",value:function(e){var t="",i=0;while(i<e.length){var n=e.charAt(i);"\n"===n?t+="\\n":"\\"===n?(t+=n,i++,n=e.charAt(i),""!==n&&-1!=='"\\/bfnrtu'.indexOf(n)||(t+="\\"),t+=n):t+='"'===n?'\\"':n,i++}return t}},{key:"updateNodeName",value:function(){var e,t=this.childs?this.childs.length:0;if("object"===this.type||"array"===this.type){if(this.editor.options.onNodeName)try{e=this.editor.options.onNodeName({path:this.getPath(),size:t,type:this.type})}catch(i){}this.dom.value.textContent="object"===this.type?"{"+(e||t)+"}":"["+(e||t)+"]"}}},{key:"recursivelyUpdateNodeName",value:function(){var e;if(this.expanded&&(this.updateNodeName(),"undefined"!==this.childs))for(e in this.childs)this.childs[e].recursivelyUpdateNodeName()}}]),e}();V.prototype.DEBOUNCE_INTERVAL=150,V.prototype.MAX_SEARCH_RESULTS=999;var L=100;function N(e){return e.getInternalPath()}function O(e){return e.getField()}function F(e,t){return Object.prototype.hasOwnProperty.call(e,t)}V.focusElement=void 0,V.select=function(e){setTimeout((function(){Object(c["selectContentEditable"])(e)}),0)},V.onDragStart=function(e,t){if(!Array.isArray(e))return V.onDragStart([e],t);if(0!==e.length){var i=e[0],n=e[e.length-1],r=i.parent,s=V.getNodeFromTarget(t.target),o=i.editor,a=Object(c["getAbsoluteTop"])(s.dom.tr)-Object(c["getAbsoluteTop"])(i.dom.tr);o.mousemove||(o.mousemove=Object(c["addEventListener"])(window,"mousemove",(function(t){V.onDrag(e,t)}))),o.mouseup||(o.mouseup=Object(c["addEventListener"])(window,"mouseup",(function(t){V.onDragEnd(e,t)}))),o.highlighter.lock(),o.drag={oldCursor:document.body.style.cursor,oldSelection:o.getDomSelection(),oldPaths:e.map(N),oldParent:r,oldNextNode:r.childs[n.getIndex()+1]||r.append,oldParentPathRedo:r.getInternalPath(),oldIndexRedo:i.getIndex(),mouseX:t.pageX,offsetY:a,level:i.getLevel()},document.body.style.cursor="move",t.preventDefault()}},V.onDrag=function(e,t){if(!Array.isArray(e))return V.onDrag([e],t);if(0!==e.length){var i,n,r,s,o,a,l,h,d,u,g,p=e[0].editor,m=t.pageY-p.drag.offsetY,f=t.pageX,C=!1,I=e[0],A=I.dom.tr,v=Object(c["getAbsoluteTop"])(A),b=A.offsetHeight;if(m<v){i=A;do{i=i.previousSibling,a=V.getNodeFromTarget(i),h=i?Object(c["getAbsoluteTop"])(i):0}while(i&&m<h);a&&!a.parent&&(a=void 0),a||(o=A.parentNode.firstChild,i=o?o.nextSibling:void 0,a=V.getNodeFromTarget(i),a===I&&(a=void 0)),a&&a.isVisible()&&(i=a.dom.tr,h=i?Object(c["getAbsoluteTop"])(i):0,m>h+b&&(a=void 0)),!a||!1!==p.options.limitDragging&&a.parent!==e[0].parent||(e.forEach((function(e){a.parent.moveBefore(e,a)})),C=!0)}else{var y=e[e.length-1];if(s=y.expanded&&y.append?y.append.getDom():y.dom.tr,r=s?s.nextSibling:void 0,r){d=Object(c["getAbsoluteTop"])(r),n=r;do{l=V.getNodeFromTarget(n),n&&(u=n.nextSibling?Object(c["getAbsoluteTop"])(n.nextSibling):0,g=n?u-d:0,l&&l.parent.childs.length===e.length&&l.parent.childs[e.length-1]===y&&(v+=27),n=n.nextSibling)}while(n&&m>v+g);if(l&&l.parent){var w=f-p.drag.mouseX,S=Math.round(w/24/2),x=p.drag.level+S,k=l.getLevel();i=l.dom.tr&&l.dom.tr.previousSibling;while(k<x&&i){a=V.getNodeFromTarget(i);var R=e.some((function(e){return e===a||a.isDescendantOf(e)}));if(R);else{if(!(a instanceof P))break;var E=a.parent.childs;if(E.length===e.length&&E[e.length-1]===y)break;l=V.getNodeFromTarget(i),k=l.getLevel()}i=i.previousSibling}l instanceof P&&!l.isVisible()&&l.parent.showMore.isVisible()&&(l=l._nextNode()),l&&(!1===p.options.limitDragging||l.parent===e[0].parent)&&l.dom.tr&&l.dom.tr!==s.nextSibling&&(e.forEach((function(e){l.parent.moveBefore(e,l)})),C=!0)}}}C&&(p.drag.mouseX=f,p.drag.level=I.getLevel()),p.startAutoScroll(m),t.preventDefault()}},V.onDragEnd=function(e,t){if(!Array.isArray(e))return V.onDrag([e],t);if(0!==e.length){var i=e[0],n=i.editor;e[0]&&e[0].dom.menu.focus();var r=n.drag.oldParent.getInternalPath(),s=i.parent.getInternalPath(),o=n.drag.oldParent===i.parent,a=n.drag.oldNextNode.getIndex(),l=i.getIndex(),h=n.drag.oldParentPathRedo,d=n.drag.oldIndexRedo,u=o&&d<l?l+e.length:l;o&&d===l||n._onAction("moveNodes",{count:e.length,fieldNames:e.map(O),oldParentPath:r,newParentPath:s,oldIndex:a,newIndex:l,oldIndexRedo:d,newIndexRedo:u,oldParentPathRedo:h,newParentPathRedo:null,oldSelection:n.drag.oldSelection,newSelection:n.getDomSelection()}),document.body.style.cursor=n.drag.oldCursor,n.highlighter.unlock(),e.forEach((function(e){e.updateDom(),t.target!==e.dom.drag&&t.target!==e.dom.menu&&n.highlighter.unhighlight()})),delete n.drag,n.mousemove&&(Object(c["removeEventListener"])(window,"mousemove",n.mousemove),delete n.mousemove),n.mouseup&&(Object(c["removeEventListener"])(window,"mouseup",n.mouseup),delete n.mouseup),n.stopAutoScroll(),t.preventDefault()}},V._findEnum=function(e){if(e["enum"])return e["enum"];var t=e.oneOf||e.anyOf||e.allOf;if(t){var i=t.filter((function(e){return e["enum"]}));if(i.length>0)return i[0]["enum"]}return null},V._findSchema=function(e,t,i){var n=e,r=n,s=e.oneOf||e.anyOf||e.allOf;s||(s=[e]);for(var o=0;o<s.length;o++){n=s[o],"$ref"in n&&"string"===typeof n.$ref&&(n=t[n.$ref],n&&(r=V._findSchema(n,t,i)));for(var a=0;a<i.length&&n;a++){var l=i.slice(a+1,i.length),c=i[a];if("string"!==typeof c||!n.patternProperties||n.properties&&c in n.properties)"string"===typeof c&&n.properties?c in n.properties?(n=n.properties[c],n&&(r=V._findSchema(n,t,l))):r=null:"number"===typeof c&&n.items&&(n=n.items,n&&(r=V._findSchema(n,t,l)));else for(var h in n.patternProperties)c.match(h)&&(r=V._findSchema(n.patternProperties[h],t,l))}}return r===e&&i.length>0?null:r},V.onRemove=function(e){if(!Array.isArray(e))return V.onRemove([e]);if(e&&e.length>0){var t=e[0],i=t.parent,n=t.editor,r=t.getIndex();n.highlighter.unhighlight();var s=n.getDomSelection();V.blurNodes(e);var o=n.getDomSelection(),a=e.map(N);e.forEach((function(e){e.parent._remove(e)})),n._onAction("removeNodes",{nodes:e,paths:a,parentPath:i.getInternalPath(),index:r,oldSelection:s,newSelection:o})}},V.onDuplicate=function(e){if(!Array.isArray(e))return V.onDuplicate([e]);if(e&&e.length>0){var t=e[e.length-1],i=t.parent,n=t.editor;n.deselect(n.multiselection.nodes);var r=n.getDomSelection(),s=t,o=e.map((function(e){var t=e.clone();if("object"===e.parent.type){var n=e.parent.getFieldNames();t.field=Object(c["findUniqueName"])(e.field,n)}return i.insertAfter(t,s),s=t,t}));1===e.length?"object"===o[0].parent.type?(o[0].dom.field.innerHTML=T._escapeHTML(e[0].field),o[0].focus("field")):o[0].focus():n.select(o);var a=n.getDomSelection();n._onAction("duplicateNodes",{paths:e.map(N),clonePaths:o.map(N),afterPath:t.getInternalPath(),parentPath:i.getInternalPath(),oldSelection:r,newSelection:a})}},V.getNodeFromTarget=function(e){while(e){if(e.node)return e.node;e=e.parentNode}},V.targetIsColorPicker=function(e){var t=V.getNodeFromTarget(e);if(t){var i=e&&e.parentNode;while(i){if(i===t.dom.color)return!0;i=i.parentNode}}return!1},V.blurNodes=function(e){if(Array.isArray(e)){var t=e[0],i=t.parent,n=t.getIndex();i.childs[n+e.length]?i.childs[n+e.length].focus():i.childs[n-1]?i.childs[n-1].focus():i.focus()}else V.blurNodes([e])};var P=R(V),K=E(V),M=i(8),j=i(9),D={start:function(e,t,i){return 0===t.indexOf(e)},contain:function(e,t,i){return t.indexOf(e)>-1}};function X(e){e=e||{},e.filter=e.filter||"start",e.trigger=e.trigger||"keydown",e.confirmKeys=e.confirmKeys||[39,35,9],e.caseSensitive=e.caseSensitive||!1;var t="",i="",n=document.createElement("div");n.style.position="relative",n.style.outline="0",n.style.border="0",n.style.margin="0",n.style.padding="0";var r,s,o=document.createElement("div");o.className="autocomplete dropdown",o.style.position="absolute",o.style.visibility="hidden";var a=function(t,i){var n=[],r=0,s=-1,o=function(){this.style.backgroundColor="#ddd"},a=function(){this.style.backgroundColor=""},l=function(){c.hide(),c.onmouseselection(this.__hint,c.rs)},c={rs:i,hide:function(){t.style.visibility="hidden"},refresh:function(i,s){t.style.visibility="hidden",r=0,t.textContent="";var h=window.innerHeight||document.documentElement.clientHeight,d=t.parentNode.getBoundingClientRect(),u=d.top-6,g=h-d.bottom-6;n=[];var p="function"===typeof e.filter?e.filter:D[e.filter],m=p?s.filter((function(t){return p(e.caseSensitive?i:i.toLowerCase(),e.caseSensitive?t:t.toLowerCase(),e)})):[];n=m.map((function(e){var n=document.createElement("div");n.className="item",n.onmouseover=o,n.onmouseout=a,n.onmousedown=l,n.__hint=e,n.textContent="",n.appendChild(document.createTextNode(e.substring(0,i.length)));var r=document.createElement("b");return r.appendChild(document.createTextNode(e.substring(i.length))),n.appendChild(r),t.appendChild(n),n})),0!==n.length&&(1===n.length&&(i.toLowerCase()===n[0].__hint.toLowerCase()&&!e.caseSensitive||i===n[0].__hint&&e.caseSensitive)||n.length<2||(c.highlight(0),u>3*g?(t.style.maxHeight=u+"px",t.style.top="",t.style.bottom="100%"):(t.style.top="100%",t.style.bottom="",t.style.maxHeight=g+"px"),t.style.visibility="visible"))},highlight:function(e){-1!==s&&n[s]&&(n[s].className="item"),n[e].className="item hover",s=e},move:function(e){return"hidden"===t.style.visibility?"":(r+e===-1||r+e===n.length||(r+=e,c.highlight(r)),n[r].__hint)},onmouseselection:function(){}};return c};function l(e){var t,i;document.createRange?(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1),i=window.getSelection(),i.removeAllRanges(),i.addRange(t)):document.selection&&(t=document.body.createTextRange(),t.moveToElementText(e),t.collapse(!1),t.select())}function c(e){return void 0===r&&(r=document.createElement("span"),r.style.visibility="hidden",r.style.position="fixed",r.style.outline="0",r.style.margin="0",r.style.padding="0",r.style.border="0",r.style.left="0",r.style.whiteSpace="pre",r.style.fontSize=t,r.style.fontFamily=i,r.style.fontWeight="normal",document.body.appendChild(r)),r.textContent=e,r.getBoundingClientRect().right}var h={onArrowDown:function(){},onArrowUp:function(){},onEnter:function(){},onTab:function(){},startFrom:0,options:[],element:null,elementHint:null,elementStyle:null,wrapper:n,show:function(e,r,s){var a=this;this.startFrom=r,this.wrapper.remove(),this.elementHint&&(this.elementHint.remove(),this.elementHint=null),""===t&&(t=window.getComputedStyle(e).getPropertyValue("font-size")),""===i&&(i=window.getComputedStyle(e).getPropertyValue("font-family")),o.style.marginLeft="0",o.style.marginTop=e.getBoundingClientRect().height+"px",this.options=s.map(String),this.element!==e&&(this.element=e,this.elementStyle={zIndex:this.element.style.zIndex,position:this.element.style.position,backgroundColor:this.element.style.backgroundColor,borderColor:this.element.style.borderColor}),this.element.style.zIndex=3,this.element.style.position="relative",this.element.style.backgroundColor="transparent",this.element.style.borderColor="transparent",this.elementHint=e.cloneNode(),this.elementHint.className="autocomplete hint",this.elementHint.style.zIndex=2,this.elementHint.style.position="absolute",this.elementHint.onfocus=function(){a.element.focus()},this.element.addEventListener&&(this.element.removeEventListener("keydown",u),this.element.addEventListener("keydown",u,!1),this.element.removeEventListener("blur",g),this.element.addEventListener("blur",g,!1)),n.appendChild(this.elementHint),n.appendChild(o),e.parentElement.appendChild(n),this.repaint(e)},setText:function(e){this.element.innerText=e},getText:function(){return this.element.innerText},hideDropDown:function(){this.wrapper.remove(),this.elementHint&&(this.elementHint.remove(),this.elementHint=null,d.hide(),this.element.style.zIndex=this.elementStyle.zIndex,this.element.style.position=this.elementStyle.position,this.element.style.backgroundColor=this.elementStyle.backgroundColor,this.element.style.borderColor=this.elementStyle.borderColor)},repaint:function(t){var i=t.innerText;i=i.replace("\n","");var n=this.options.length,r=i.substring(this.startFrom);s=i.substring(0,this.startFrom);for(var a=0;a<n;a++){var l=this.options[a];if(!e.caseSensitive&&0===l.toLowerCase().indexOf(r.toLowerCase())||e.caseSensitive&&0===l.indexOf(r)){this.elementHint.innerText=s+r+l.substring(r.length),this.elementHint.realInnerText=s+l;break}}o.style.left=c(s)+"px",d.refresh(r,this.options),this.elementHint.style.width=c(this.elementHint.innerText)+10+"px";var h="hidden"===o.style.visibility;h||(this.elementHint.style.width=c(this.elementHint.innerText)+o.clientWidth+"px")}},d=a(o,h),u=function(t){t=t||window.event;var i=t.keyCode;if(null!=this.elementHint&&33!==i&&34!==i){if(27===i)return h.hideDropDown(),h.element.focus(),t.preventDefault(),void t.stopPropagation();var n=this.element.innerText;if(n=n.replace("\n",""),e.confirmKeys.indexOf(i)>=0)return 9===i&&0===this.elementHint.innerText.length&&h.onTab(),void(this.elementHint.innerText.length>0&&this.element.innerText!==this.elementHint.realInnerText&&(this.element.innerText=this.elementHint.realInnerText,h.hideDropDown(),l(this.element),9===i&&(h.element.focus(),t.preventDefault(),t.stopPropagation())));if(13!==i){if(40===i){var r=n.substring(this.startFrom),a=d.move(1);return""===a&&h.onArrowDown(),this.elementHint.innerText=s+r+a.substring(r.length),this.elementHint.realInnerText=s+a,t.preventDefault(),void t.stopPropagation()}if(38===i){var c=n.substring(this.startFrom),u=d.move(-1);""===u&&h.onArrowUp(),this.elementHint.innerText=s+c+u.substring(c.length),this.elementHint.realInnerText=s+u,t.preventDefault(),t.stopPropagation()}}else if(0===this.elementHint.innerText.length)h.onEnter();else{var g="hidden"===o.style.visibility;if(d.hide(),g)return h.hideDropDown(),h.element.focus(),void h.onEnter();this.element.innerText=this.elementHint.realInnerText,h.hideDropDown(),l(this.element),t.preventDefault(),t.stopPropagation()}}}.bind(h),g=function(e){h.hideDropDown()};return d.onmouseselection=function(e,t){t.element.innerText=t.elementHint.innerText=s+e,t.hideDropDown(),window.setTimeout((function(){t.element.focus(),l(t.element)}),1)},h}var Y=i(4),z={create:function(e,t){if(!e)throw new Error("No container element provided.");this.container=e,this.dom={},this.highlighter=new l,this.selection=void 0,this.multiselection={nodes:[]},this.validateSchema=null,this.validationSequence=0,this.errorNodes=[],this.lastSchemaErrors=void 0,this.node=null,this.focusTarget=null,this._setOptions(t),t.autocomplete&&(this.autocomplete=X(t.autocomplete)),this.options.history&&"view"!==this.options.mode&&(this.history=new g(this)),this._createFrame(),this._createTable()},destroy:function(){this.frame&&this.container&&this.frame.parentNode===this.container&&(this.container.removeChild(this.frame),this.frame=null),this.container=null,this.dom=null,this.clear(),this.node=null,this.focusTarget=null,this.selection=null,this.multiselection=null,this.errorNodes=null,this.validateSchema=null,this._debouncedValidate=null,this.history&&(this.history.destroy(),this.history=null),this.searchBox&&(this.searchBox.destroy(),this.searchBox=null),this.modeSwitcher&&(this.modeSwitcher.destroy(),this.modeSwitcher=null),this.frameFocusTracker.destroy()},_setOptions:function(e){var t=this;this.options={search:!0,history:!0,mode:"tree",name:void 0,schema:null,schemaRefs:null,autocomplete:null,navigationBar:!0,mainMenuBar:!0,limitDragging:!1,onSelectionChange:null,colorPicker:!0,onColorPicker:function(e,t,i){if(r.a){var n=300,s=e.getBoundingClientRect().top,o=window.innerHeight,a=o-s<n&&s>n;new r.a({parent:e,color:t,popup:a?"top":"bottom",onDone:function(e){var t=e.rgba[3],n=1===t?e.hex.substr(0,7):e.hex;i(n)}}).show()}},timestampTag:!0,timestampFormat:null,createQuery:Y["a"],executeQuery:Y["b"],onEvent:null,enableSort:!0,enableTransform:!0},e&&(Object.keys(e).forEach((function(i){t.options[i]=e[i]})),null==e.limitDragging&&null!=e.schema&&(this.options.limitDragging=!0)),this.setSchema(this.options.schema,this.options.schemaRefs),this._debouncedValidate=Object(c["debounce"])(this.validate.bind(this),this.DEBOUNCE_INTERVAL),e.onSelectionChange&&this.onSelectionChange(e.onSelectionChange),Object(p["b"])(this.options.languages),Object(p["a"])(this.options.language)},set:function(e){if(e instanceof Function||void 0===e)this.clear();else{this.content.removeChild(this.table);var t={field:this.options.name,value:e},i=new V(this,t);this._setRoot(i),this.validate();var n=!1;this.node.expand(n),this.content.appendChild(this.table)}this.history&&this.history.clear(),this.searchBox&&this.searchBox.clear()},update:function(e){if(!this.node.deepEqual(e)){var t=this.getSelection();if(this.onChangeDisabled=!0,this.node.update(e),this.onChangeDisabled=!1,this.validate(),this.searchBox&&!this.searchBox.isEmpty()&&this.searchBox.forceSearch(),t&&t.start&&t.end){var i=this.node.findNodeByPath(t.start.path),n=this.node.findNodeByPath(t.end.path);i&&n?this.setSelection(t.start,t.end):this.setSelection({},{})}else this.setSelection({},{})}},get:function(){return this.node?this.node.getValue():void 0},getText:function(){return JSON.stringify(this.get())},setText:function(e){try{this.set(Object(c["parse"])(e))}catch(i){var t=Object(c["repair"])(e);this.set(Object(c["parse"])(t))}},updateText:function(e){try{this.update(Object(c["parse"])(e))}catch(i){var t=Object(c["repair"])(e);this.update(Object(c["parse"])(t))}},setName:function(e){this.options.name=e,this.node&&this.node.updateField(this.options.name)},getName:function(){return this.options.name},focus:function(){var e=this.scrollableContent.querySelector("[contenteditable=true]");e?e.focus():this.node.dom.expand?this.node.dom.expand.focus():this.node.dom.menu?this.node.dom.menu.focus():(e=this.frame.querySelector("button"),e&&e.focus())},clear:function(){this.node&&(this.node.hide(),delete this.node),this.treePath&&this.treePath.reset()},_setRoot:function(e){this.clear(),this.node=e,e.setParent(null),e.setField(this.getName(),!1),delete e.index,this.tbody.appendChild(e.getDom())},search:function(e){var t;return this.node?(this.content.removeChild(this.table),t=this.node.search(e),this.content.appendChild(this.table)):t=[],t},expandAll:function(){this.node&&(this.content.removeChild(this.table),this.node.expand(),this.content.appendChild(this.table))},collapseAll:function(){this.node&&(this.content.removeChild(this.table),this.node.collapse(),this.content.appendChild(this.table))},_onAction:function(e,t){this.history&&this.history.add(e,t),this._onChange()},_onChange:function(){if(!this.onChangeDisabled){if(this.selection=this.getDomSelection(),this._debouncedValidate(),this.treePath){var e=this.node&&this.selection?this.node.findNodeByInternalPath(this.selection.path):this.multiselection?this.multiselection.nodes[0]:void 0;e?this._updateTreePath(e.getNodePath()):this.treePath.reset()}if(this.options.onChange)try{this.options.onChange()}catch(t){}if(this.options.onChangeJSON)try{this.options.onChangeJSON(this.get())}catch(t){}if(this.options.onChangeText)try{this.options.onChangeText(this.getText())}catch(t){}if(this.options.onClassName&&this.node.recursivelyUpdateCssClassesOnNodes(),this.options.onNodeName&&this.node.childs)try{this.node.recursivelyUpdateNodeName()}catch(t){}}},validate:function(){var e=this,t=this.node;if(t){var i=t.getValue(),n=[];if(this.validateSchema){var r=this.validateSchema(i);r||(n=this.validateSchema.errors.map((function(e){return Object(c["improveSchemaError"])(e)})).map((function(e){return{node:t.findNode(e.dataPath),error:e,type:"validation"}})).filter((function(e){return null!=e.node})))}try{this.validationSequence++;var s=this,o=this.validationSequence;this._validateCustom(i).then((function(t){if(o===s.validationSequence){var i=[].concat(n,t||[]);s._renderValidationErrors(i),"function"===typeof e.options.onValidationError&&(Object(c["isValidationErrorChanged"])(i,e.lastSchemaErrors)&&e.options.onValidationError.call(e,i),e.lastSchemaErrors=i)}}))["catch"]((function(e){}))}catch(a){}}},_renderValidationErrors:function(e){this.errorNodes&&this.errorNodes.forEach((function(e){e.setError(null)}));var t=e.reduce((function(e,t){return t.node.findParents().filter((function(t){return!e.some((function(e){return e[0]===t}))})).map((function(e){return[e,t.node]})).concat(e)}),[]);this.errorNodes=t.map((function(e){return{node:e[0],child:e[1],error:{message:"object"===e[0].type?"Contains invalid properties":"Contains invalid items"}}})).concat(e).map((function(e){return e.node.setError(e.error,e.child),e.node}))},_validateCustom:function(e){try{if(this.options.onValidate){var t=this.node,i=this.options.onValidate(e),n=Object(c["isPromise"])(i)?i:Promise.resolve(i);return n.then((function(e){return Array.isArray(e)?e.filter((function(e){var t=Object(c["isValidValidationError"])(e);return t})).map((function(e){var i;try{i=e&&e.path?t.findNodeByPath(e.path):null}catch(n){}return{node:i,error:e,type:"customValidation"}})).filter((function(e){return e&&e.node&&e.error&&e.error.message})):null}))}}catch(r){return Promise.reject(r)}return Promise.resolve(null)},refresh:function(){this.node&&this.node.updateDom({recurse:!0})},startAutoScroll:function(e){var t=this,i=this.scrollableContent,n=Object(c["getAbsoluteTop"])(i),r=i.clientHeight,s=n+r,o=24,a=50;e<n+o&&i.scrollTop>0?this.autoScrollStep=(n+o-e)/3:e>s-o&&r+i.scrollTop<i.scrollHeight?this.autoScrollStep=(s-o-e)/3:this.autoScrollStep=void 0,this.autoScrollStep?this.autoScrollTimer||(this.autoScrollTimer=setInterval((function(){t.autoScrollStep?i.scrollTop-=t.autoScrollStep:t.stopAutoScroll()}),a)):this.stopAutoScroll()},stopAutoScroll:function(){this.autoScrollTimer&&(clearTimeout(this.autoScrollTimer),delete this.autoScrollTimer),this.autoScrollStep&&delete this.autoScrollStep},setDomSelection:function(e){if(e)if("scrollTop"in e&&this.scrollableContent&&(this.scrollableContent.scrollTop=e.scrollTop),e.paths){var t=this,i=e.paths.map((function(e){return t.node.findNodeByInternalPath(e)}));this.select(i)}else{var n=e.path?this.node.findNodeByInternalPath(e.path):null,r=n&&e.domName?n.dom[e.domName]:null;if(e.range&&r){var s=Object.assign({},e.range,{container:r});Object(c["setSelectionOffset"])(s)}else n&&n.focus()}},getDomSelection:function(){var e=V.getNodeFromTarget(this.focusTarget),t=this.focusTarget,i=e?Object.keys(e.dom).find((function(i){return e.dom[i]===t})):null,n=Object(c["getSelectionOffset"])();return n&&"DIV"!==n.container.nodeName&&(n=null),n&&n.container!==t&&(n=null),n&&delete n.container,{path:e?e.getInternalPath():null,domName:i,range:n,paths:this.multiselection.length>0?this.multiselection.nodes.map((function(e){return e.getInternalPath()})):null,scrollTop:this.scrollableContent?this.scrollableContent.scrollTop:0}},scrollTo:function(e,t){var i=this.scrollableContent;if(i){var n=this;n.animateTimeout&&(clearTimeout(n.animateTimeout),delete n.animateTimeout),n.animateCallback&&(n.animateCallback(!1),delete n.animateCallback);var r=i.clientHeight,s=i.scrollHeight-r,o=Math.min(Math.max(e-r/4,0),s),a=function e(){var r=i.scrollTop,s=o-r;Math.abs(s)>3?(i.scrollTop+=s/3,n.animateCallback=t,n.animateTimeout=setTimeout(e,50)):(t&&t(!0),i.scrollTop=o,delete n.animateTimeout,delete n.animateCallback)};a()}else t&&t(!1)},_createFrame:function(){this.frame=document.createElement("div"),this.frame.className="jsoneditor jsoneditor-mode-"+this.options.mode,this.container.appendChild(this.frame),this.contentOuter=document.createElement("div"),this.contentOuter.className="jsoneditor-outer";var e=this;function t(t){e._onEvent&&e._onEvent(t)}var i={target:this.frame,onFocus:this.options.onFocus||null,onBlur:this.options.onBlur||null};if(this.frameFocusTracker=new j["a"](i),this.frame.onclick=function(e){var i=e.target;t(e),"BUTTON"===i.nodeName&&e.preventDefault()},this.frame.oninput=t,this.frame.onchange=t,this.frame.onkeydown=t,this.frame.onkeyup=t,this.frame.oncut=t,this.frame.onpaste=t,this.frame.onmousedown=t,this.frame.onmouseup=t,this.frame.onmouseover=t,this.frame.onmouseout=t,Object(c["addEventListener"])(this.frame,"focus",t,!0),Object(c["addEventListener"])(this.frame,"blur",t,!0),this.frame.onfocusin=t,this.frame.onfocusout=t,this.options.mainMenuBar){Object(c["addClassName"])(this.contentOuter,"has-main-menu-bar"),this.menu=document.createElement("div"),this.menu.className="jsoneditor-menu",this.frame.appendChild(this.menu);var n=document.createElement("button");n.type="button",n.className="jsoneditor-expand-all",n.title=Object(p["c"])("expandAll"),n.onclick=function(){e.expandAll()},this.menu.appendChild(n);var r=document.createElement("button");if(r.type="button",r.title=Object(p["c"])("collapseAll"),r.className="jsoneditor-collapse-all",r.onclick=function(){e.collapseAll()},this.menu.appendChild(r),this.options.enableSort){var s=document.createElement("button");s.type="button",s.className="jsoneditor-sort",s.title=Object(p["c"])("sortTitleShort"),s.onclick=function(){e.node.showSortModal()},this.menu.appendChild(s)}if(this.options.enableTransform){var o=document.createElement("button");o.type="button",o.title=Object(p["c"])("transformTitleShort"),o.className="jsoneditor-transform",o.onclick=function(){e.node.showTransformModal()},this.menu.appendChild(o)}if(this.history){var a=document.createElement("button");a.type="button",a.className="jsoneditor-undo jsoneditor-separator",a.title=Object(p["c"])("undo"),a.onclick=function(){e._onUndo()},this.menu.appendChild(a),this.dom.undo=a;var l=document.createElement("button");l.type="button",l.className="jsoneditor-redo",l.title=Object(p["c"])("redo"),l.onclick=function(){e._onRedo()},this.menu.appendChild(l),this.dom.redo=l,this.history.onChange=function(){a.disabled=!e.history.canUndo(),l.disabled=!e.history.canRedo()},this.history.onChange()}if(this.options&&this.options.modes&&this.options.modes.length){var h=this;this.modeSwitcher=new M["a"](this.menu,this.options.modes,this.options.mode,(function(e){h.setMode(e),h.modeSwitcher.focus()}))}this.options.search&&(this.searchBox=new I(this,this.menu))}this.options.navigationBar&&(this.navBar=document.createElement("div"),this.navBar.className="jsoneditor-navigation-bar nav-bar-empty",this.frame.appendChild(this.navBar),this.treePath=new w(this.navBar,this.getPopupAnchor()),this.treePath.onSectionSelected(this._onTreePathSectionSelected.bind(this)),this.treePath.onContextMenuItemSelected(this._onTreePathMenuItemSelected.bind(this)))},_onUndo:function(){this.history&&(this.history.undo(),this._onChange())},_onRedo:function(){this.history&&(this.history.redo(),this._onChange())},_onEvent:function(e){if(!V.targetIsColorPicker(e.target)){var t=V.getNodeFromTarget(e.target);if("keydown"===e.type&&this._onKeyDown(e),t&&"focus"===e.type&&(this.focusTarget=e.target,this.options.autocomplete&&"focus"===this.options.autocomplete.trigger&&this._showAutoComplete(e.target)),"mousedown"===e.type&&this._startDragDistance(e),"mousemove"!==e.type&&"mouseup"!==e.type&&"click"!==e.type||this._updateDragDistance(e),t&&this.options&&this.options.navigationBar&&t&&("keydown"===e.type||"mousedown"===e.type)){var i=this;setTimeout((function(){i._updateTreePath(t.getNodePath())}))}if(t&&t.selected){if("click"===e.type){if(e.target===t.dom.menu)return void this.showContextMenu(e.target);e.hasMoved||this.deselect()}"mousedown"===e.type&&V.onDragStart(this.multiselection.nodes,e)}else"mousedown"===e.type&&Object(c["hasParentNode"])(e.target,this.content)&&(this.deselect(),t&&e.target===t.dom.drag?V.onDragStart(t,e):(!t||e.target!==t.dom.field&&e.target!==t.dom.value&&e.target!==t.dom.select)&&this._onMultiSelectStart(e));t&&t.onEvent(e)}},_updateTreePath:function(e){if(e&&e.length){Object(c["removeClassName"])(this.navBar,"nav-bar-empty");var t=[];e.forEach((function(e){var n={name:i(e),node:e,children:[]};e.childs&&e.childs.length&&e.childs.forEach((function(e){n.children.push({name:i(e),node:e})})),t.push(n)})),this.treePath.setPath(t)}else Object(c["addClassName"])(this.navBar,"nav-bar-empty");function i(e){return e.parent?"array"===e.parent.type?e.index:e.field:e.field||e.type}},_onTreePathSectionSelected:function(e){e&&e.node&&(e.node.expandTo(),e.node.focus())},_onTreePathMenuItemSelected:function(e,t){if(e&&e.children.length){var i=e.children.find((function(e){return e.name===t}));i&&i.node&&(this._updateTreePath(i.node.getNodePath()),i.node.expandTo(),i.node.focus())}},_startDragDistance:function(e){this.dragDistanceEvent={initialTarget:e.target,initialPageX:e.pageX,initialPageY:e.pageY,dragDistance:0,hasMoved:!1}},_updateDragDistance:function(e){this.dragDistanceEvent||this._startDragDistance(e);var t=e.pageX-this.dragDistanceEvent.initialPageX,i=e.pageY-this.dragDistanceEvent.initialPageY;return this.dragDistanceEvent.dragDistance=Math.sqrt(t*t+i*i),this.dragDistanceEvent.hasMoved=this.dragDistanceEvent.hasMoved||this.dragDistanceEvent.dragDistance>10,e.dragDistance=this.dragDistanceEvent.dragDistance,e.hasMoved=this.dragDistanceEvent.hasMoved,e.dragDistance},_onMultiSelectStart:function(e){var t=V.getNodeFromTarget(e.target);if("tree"===this.options.mode&&void 0===this.options.onEditable){this.multiselection={start:t||null,end:null,nodes:[]},this._startDragDistance(e);var i=this;this.mousemove||(this.mousemove=Object(c["addEventListener"])(window,"mousemove",(function(e){i._onMultiSelect(e)}))),this.mouseup||(this.mouseup=Object(c["addEventListener"])(window,"mouseup",(function(e){i._onMultiSelectEnd(e)}))),e.preventDefault()}},_onMultiSelect:function(e){if(e.preventDefault(),this._updateDragDistance(e),e.hasMoved){var t=V.getNodeFromTarget(e.target);t&&(null==this.multiselection.start&&(this.multiselection.start=t),this.multiselection.end=t),this.deselect();var i=this.multiselection.start,n=this.multiselection.end||this.multiselection.start;if(i&&n){if(this.multiselection.nodes=this._findTopLevelNodes(i,n),this.multiselection.nodes&&this.multiselection.nodes.length){var r=this.multiselection.nodes[0];this.multiselection.start===r||this.multiselection.start.isDescendantOf(r)?this.multiselection.direction="down":this.multiselection.direction="up"}this.select(this.multiselection.nodes)}}},_onMultiSelectEnd:function(){this.multiselection.nodes[0]&&this.multiselection.nodes[0].dom.menu.focus(),this.multiselection.start=null,this.multiselection.end=null,this.mousemove&&(Object(c["removeEventListener"])(window,"mousemove",this.mousemove),delete this.mousemove),this.mouseup&&(Object(c["removeEventListener"])(window,"mouseup",this.mouseup),delete this.mouseup)},deselect:function(e){var t=!!this.multiselection.nodes.length;this.multiselection.nodes.forEach((function(e){e.setSelected(!1)})),this.multiselection.nodes=[],e&&(this.multiselection.start=null,this.multiselection.end=null),t&&this._selectionChangedHandler&&this._selectionChangedHandler()},select:function(e){if(!Array.isArray(e))return this.select([e]);if(e){this.deselect(),this.multiselection.nodes=e.slice(0);var t=e[0];if(e.forEach((function(e){e.expandPathToNode(),e.setSelected(!0,e===t)})),this._selectionChangedHandler){var i=this.getSelection();this._selectionChangedHandler(i.start,i.end)}}},_findTopLevelNodes:function(e,t){var i=e.getNodePath(),n=t.getNodePath(),r=0;while(r<i.length&&i[r]===n[r])r++;var s=i[r-1],o=i[r],a=n[r];if(o&&a||(s.parent?(o=s,a=s,s=s.parent):(o=s.childs[0],a=s.childs[s.childs.length-1])),s&&o&&a){var l=s.childs.indexOf(o),c=s.childs.indexOf(a),h=Math.min(l,c),d=Math.max(l,c);return s.childs.slice(h,d+1)}return[]},_showAutoComplete:function(e){var t=V.getNodeFromTarget(e),i="";e.className.indexOf("jsoneditor-value")>=0&&(i="value"),e.className.indexOf("jsoneditor-field")>=0&&(i="field");var n=this;setTimeout((function(){if(t&&("focus"===n.options.autocomplete.trigger||e.innerText.length>0)){var r=n.options.autocomplete.getOptions(e.innerText,t.getPath(),i,t.editor);null===r?n.autocomplete.hideDropDown():"function"===typeof r.then?r.then((function(t){null===t?n.autocomplete.hideDropDown():t.options?n.autocomplete.show(e,t.startFrom,t.options):n.autocomplete.show(e,0,t)}))["catch"]((function(e){})):r.options?n.autocomplete.show(e,r.startFrom,r.options):n.autocomplete.show(e,0,r)}else n.autocomplete.hideDropDown()}),50)},_onKeyDown:function(e){var t=e.which||e.keyCode,i=e.altKey,n=e.ctrlKey,r=e.metaKey,s=e.shiftKey,o=!1,a=this.focusTarget;if(9===t){var l=this;setTimeout((function(){l.focusTarget!==a&&Object(c["selectContentEditable"])(l.focusTarget)}),0)}if(this.searchBox)if(n&&70===t)this.searchBox.dom.search.focus(),this.searchBox.dom.search.select(),o=!0;else if(114===t||n&&71===t){var h=!0;s?this.searchBox.previous(h):this.searchBox.next(h),o=!0}this.history&&(n&&!s&&90===t?(this._onUndo(),o=!0):n&&s&&90===t&&(this._onRedo(),o=!0)),this.options.autocomplete&&!o&&(n||i||r||1!==e.key.length&&8!==t&&46!==t||(o=!1,this._showAutoComplete(e.target))),o&&(e.preventDefault(),e.stopPropagation())},_createTable:function(){var e;this.options.navigationBar&&Object(c["addClassName"])(this.contentOuter,"has-nav-bar"),this.scrollableContent=document.createElement("div"),this.scrollableContent.className="jsoneditor-tree",this.contentOuter.appendChild(this.scrollableContent),this.content=document.createElement("div"),this.content.className="jsoneditor-tree-inner",this.scrollableContent.appendChild(this.content),this.table=document.createElement("table"),this.table.className="jsoneditor-tree",this.content.appendChild(this.table),this.colgroupContent=document.createElement("colgroup"),"tree"===this.options.mode&&(e=document.createElement("col"),e.width="24px",this.colgroupContent.appendChild(e)),e=document.createElement("col"),e.width="24px",this.colgroupContent.appendChild(e),e=document.createElement("col"),this.colgroupContent.appendChild(e),this.table.appendChild(this.colgroupContent),this.tbody=document.createElement("tbody"),this.table.appendChild(this.tbody),this.frame.appendChild(this.contentOuter)},showContextMenu:function(e,t){var i=[],n=this.multiselection.nodes.slice();if(i.push({text:Object(p["c"])("duplicateText"),title:Object(p["c"])("duplicateTitle"),className:"jsoneditor-duplicate",click:function(){V.onDuplicate(n)}}),i.push({text:Object(p["c"])("remove"),title:Object(p["c"])("removeTitle"),className:"jsoneditor-remove",click:function(){V.onRemove(n)}}),this.options.onCreateMenu){var r=n.map((function(e){return e.getPath()}));i=this.options.onCreateMenu(i,{type:"multiple",path:r[0],paths:r})}var s=new A["a"](i,{close:t});s.show(e,this.getPopupAnchor())},getPopupAnchor:function(){return this.options.popupAnchor||this.frame},getSelection:function(){var e={start:null,end:null};if(this.multiselection.nodes&&this.multiselection.nodes.length&&this.multiselection.nodes.length){var t=this.multiselection.nodes[0],i=this.multiselection.nodes[this.multiselection.nodes.length-1];"down"===this.multiselection.direction?(e.start=t.serialize(),e.end=i.serialize()):(e.start=i.serialize(),e.end=t.serialize())}return e},onSelectionChange:function(e){"function"===typeof e&&(this._selectionChangedHandler=Object(c["debounce"])(e,this.DEBOUNCE_INTERVAL))},setSelection:function(e,t){e&&e.dom&&e.range&&this.setDomSelection(e);var i=this._getNodeInstancesByRange(e,t);i.forEach((function(e){e.expandTo()})),this.select(i)},_getNodeInstancesByRange:function(e,t){var i,n;e&&e.path&&(i=this.node.findNodeByPath(e.path),t&&t.path&&(n=this.node.findNodeByPath(t.path)));var r=[];if(i instanceof V)if(n instanceof V&&n!==i)if(i.parent===n.parent){i.getIndex()<n.getIndex()?(e=i,t=n):(e=n,t=i);var s=e;r.push(s);do{s=s.nextSibling(),r.push(s)}while(s&&s!==t)}else r=this._findTopLevelNodes(i,n);else r.push(i);return r},getNodesByRange:function(e,t){var i=this._getNodeInstancesByRange(e,t),n=[];return i.forEach((function(e){n.push(e.serialize())})),n}},J=[{mode:"tree",mixin:z,data:"json"},{mode:"view",mixin:z,data:"json"},{mode:"form",mixin:z,data:"json"}]},function(e,t,i){"use strict";i.r(t),i.d(t,"previewModeMixins",(function(){return A}));var n=i(1),r=i(8),s=i(15),o=i(5),a=i(6),l=i(21),c=i(2),h=i(9),d=i(0);function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e,t,i){return t&&g(e.prototype,t),i&&g(e,i),e}var m=function(){function e(t,i,n){u(this,e),this.onChange=t,this.calculateItemSize=i||function(){return 1},this.limit=n,this.items=[],this.index=-1}return p(e,[{key:"add",value:function(e){while(this._calculateHistorySize()>this.limit&&this.items.length>1)this.items.shift(),this.index--;this.items=this.items.slice(0,this.index+1),this.items.push(e),this.index++,this.onChange()}},{key:"_calculateHistorySize",value:function(){var e=this.calculateItemSize,t=0;return this.items.forEach((function(i){t+=e(i)})),t}},{key:"undo",value:function(){if(this.canUndo())return this.index--,this.onChange(),this.items[this.index]}},{key:"redo",value:function(){if(this.canRedo())return this.index++,this.onChange(),this.items[this.index]}},{key:"canUndo",value:function(){return this.index>0}},{key:"canRedo",value:function(){return this.index<this.items.length-1}},{key:"clear",value:function(){this.items=[],this.index=-1,this.onChange()}}]),e}(),f=i(4),C=l["textModeMixins"][0].mixin,I={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"undefined"===typeof t.statusBar&&(t.statusBar=!0),t.mainMenuBar=!1!==t.mainMenuBar,t.enableSort=!1!==t.enableSort,t.enableTransform=!1!==t.enableTransform,t.createQuery=t.createQuery||f["a"],t.executeQuery=t.executeQuery||f["b"],this.options=t,"number"===typeof t.indentation?this.indentation=Number(t.indentation):this.indentation=2,Object(n["b"])(this.options.languages),Object(n["a"])(this.options.language),this.mode="preview";var i=this;this.container=e,this.dom={},this.json=void 0,this.text="",this._debouncedValidate=Object(d["debounce"])(this.validate.bind(this),this.DEBOUNCE_INTERVAL),this.width=e.clientWidth,this.height=e.clientHeight,this.frame=document.createElement("div"),this.frame.className="jsoneditor jsoneditor-mode-preview",this.frame.onclick=function(e){e.preventDefault()};var o={target:this.frame,onFocus:this.options.onFocus||null,onBlur:this.options.onBlur||null};if(this.frameFocusTracker=new h["a"](o),this.content=document.createElement("div"),this.content.className="jsoneditor-outer",this.dom.busy=document.createElement("div"),this.dom.busy.className="jsoneditor-busy",this.dom.busyContent=document.createElement("span"),this.dom.busyContent.textContent="busy...",this.dom.busy.appendChild(this.dom.busyContent),this.content.appendChild(this.dom.busy),this.dom.previewContent=document.createElement("pre"),this.dom.previewContent.className="jsoneditor-preview",this.dom.previewText=document.createTextNode(""),this.dom.previewContent.appendChild(this.dom.previewText),this.content.appendChild(this.dom.previewContent),this.options.mainMenuBar){Object(d["addClassName"])(this.content,"has-main-menu-bar"),this.menu=document.createElement("div"),this.menu.className="jsoneditor-menu",this.frame.appendChild(this.menu);var a=document.createElement("button");a.type="button",a.className="jsoneditor-format",a.title=Object(n["c"])("formatTitle"),this.menu.appendChild(a),a.onclick=function(){i.executeWithBusyMessage((function(){try{i.format()}catch(e){i._onError(e)}}),"formatting...")};var l=document.createElement("button");if(l.type="button",l.className="jsoneditor-compact",l.title=Object(n["c"])("compactTitle"),this.menu.appendChild(l),l.onclick=function(){i.executeWithBusyMessage((function(){try{i.compact()}catch(e){i._onError(e)}}),"compacting...")},this.options.enableSort){var u=document.createElement("button");u.type="button",u.className="jsoneditor-sort",u.title=Object(n["c"])("sortTitleShort"),u.onclick=function(){i._showSortModal()},this.menu.appendChild(u)}if(this.options.enableTransform){var g=document.createElement("button");g.type="button",g.title=Object(n["c"])("transformTitleShort"),g.className="jsoneditor-transform",g.onclick=function(){i._showTransformModal()},this.dom.transform=g,this.menu.appendChild(g)}var p=document.createElement("button");if(p.type="button",p.className="jsoneditor-repair",p.title=Object(n["c"])("repairTitle"),this.menu.appendChild(p),p.onclick=function(){void 0===i.json&&i.executeWithBusyMessage((function(){try{i.repair()}catch(e){i._onError(e)}}),"repairing...")},!1!==this.options.history){var C=function(){i.dom.undo.disabled=!i.history.canUndo(),i.dom.redo.disabled=!i.history.canRedo()},I=function(e){return 2*e.text.length};this.history=new m(C,I,c["c"]);var A=document.createElement("button");A.type="button",A.className="jsoneditor-undo jsoneditor-separator",A.title=Object(n["c"])("undo"),A.onclick=function(){var e=i.history.undo();e&&i._applyHistory(e)},this.menu.appendChild(A),this.dom.undo=A;var v=document.createElement("button");v.type="button",v.className="jsoneditor-redo",v.title=Object(n["c"])("redo"),v.onclick=function(){var e=i.history.redo();e&&i._applyHistory(e)},this.menu.appendChild(v),this.dom.redo=v,this.history.onChange()}this.options&&this.options.modes&&this.options.modes.length&&(this.modeSwitcher=new r["a"](this.menu,this.options.modes,this.options.mode,(function(e){i.setMode(e),i.modeSwitcher.focus()})))}if(this.errorTable=new s["a"]({errorTableVisible:!0,onToggleVisibility:function(){i.validate()},onFocusLine:null,onChangeHeight:function(e){var t=i.dom.statusBar?i.dom.statusBar.clientHeight:0,n=e+t+1;i.content.style.marginBottom=-n+"px",i.content.style.paddingBottom=n+"px"}}),this.frame.appendChild(this.content),this.frame.appendChild(this.errorTable.getErrorTable()),this.container.appendChild(this.frame),t.statusBar){Object(d["addClassName"])(this.content,"has-status-bar");var b=document.createElement("div");this.dom.statusBar=b,b.className="jsoneditor-statusbar",this.frame.appendChild(b),this.dom.fileSizeInfo=document.createElement("span"),this.dom.fileSizeInfo.className="jsoneditor-size-info",this.dom.fileSizeInfo.innerText="",b.appendChild(this.dom.fileSizeInfo),this.dom.arrayInfo=document.createElement("span"),this.dom.arrayInfo.className="jsoneditor-size-info",this.dom.arrayInfo.innerText="",b.appendChild(this.dom.arrayInfo),b.appendChild(this.errorTable.getErrorCounter()),b.appendChild(this.errorTable.getWarningIcon()),b.appendChild(this.errorTable.getErrorIcon())}this._renderPreview(),this.setSchema(this.options.schema,this.options.schemaRefs)},_renderPreview:function(){var e=this.getText();this.dom.previewText.nodeValue=Object(d["limitCharacters"])(e,c["b"]),this.dom.fileSizeInfo&&(this.dom.fileSizeInfo.innerText="Size: "+Object(d["formatSize"])(e.length)),this.dom.arrayInfo&&(Array.isArray(this.json)?this.dom.arrayInfo.innerText="Array: "+this.json.length+" items":this.dom.arrayInfo.innerText="")},_onChange:function(){if(this._debouncedValidate(),this.options.onChange)try{this.options.onChange()}catch(e){}if(this.options.onChangeJSON)try{this.options.onChangeJSON(this.get())}catch(e){}if(this.options.onChangeText)try{this.options.onChangeText(this.getText())}catch(e){}},_showSortModal:function(){var e=this;function t(t,i){if(Array.isArray(t)){var n=Object(d["sort"])(t,i.path,i.direction);e.sortedBy=i,e._setAndFireOnChange(n)}if(Object(d["isObject"])(t)){var r=Object(d["sortObjectKeys"])(t,i.direction);e.sortedBy=i,e._setAndFireOnChange(r)}}this.executeWithBusyMessage((function(){var i=e.options.modalAnchor||c["a"],n=e.get();e._renderPreview(),Object(o["showSortModal"])(i,n,(function(i){e.executeWithBusyMessage((function(){t(n,i)}),"sorting...")}),e.sortedBy)}),"parsing...")},_showTransformModal:function(){var e=this;this.executeWithBusyMessage((function(){var t=e.options,i=t.createQuery,n=t.executeQuery,r=t.modalAnchor,s=t.queryDescription,o=e.get();e._renderPreview(),Object(a["showTransformModal"])({anchor:r||c["a"],json:o,queryDescription:s,createQuery:i,executeQuery:n,onTransform:function(t){e.executeWithBusyMessage((function(){var i=n(o,t);e._setAndFireOnChange(i)}),"transforming...")}})}),"parsing...")},destroy:function(){this.frame&&this.container&&this.frame.parentNode===this.container&&this.container.removeChild(this.frame),this.modeSwitcher&&(this.modeSwitcher.destroy(),this.modeSwitcher=null),this._debouncedValidate=null,this.history&&(this.history.clear(),this.history=null),this.frameFocusTracker.destroy()},compact:function(){var e=this.get(),t=JSON.stringify(e);this._setTextAndFireOnChange(t,e)},format:function(){var e=this.get(),t=JSON.stringify(e,null,this.indentation);this._setTextAndFireOnChange(t,e)},repair:function(){var e=this.getText(),t=Object(d["repair"])(e);this._setTextAndFireOnChange(t)},focus:function(){this.dom.transform.focus()},set:function(e){this.history&&this.history.clear(),this._set(e)},update:function(e){this._set(e)},_set:function(e){this.text=void 0,this.json=e,this._renderPreview(),this._pushHistory(),this._debouncedValidate()},_setAndFireOnChange:function(e){this._set(e),this._onChange()},get:function(){if(void 0===this.json){var e=this.getText();this.json=Object(d["parse"])(e)}return this.json},getText:function(){return void 0===this.text&&(this.text=JSON.stringify(this.json,null,this.indentation),!0===this.options.escapeUnicode&&(this.text=Object(d["escapeUnicodeChars"])(this.text))),this.text},setText:function(e){this.history&&this.history.clear(),this._setText(e)},updateText:function(e){this.getText()!==e&&this._setText(e)},_setText:function(e,t){if(!0===this.options.escapeUnicode?this.text=Object(d["escapeUnicodeChars"])(e):this.text=e,this.json=t,this._renderPreview(),void 0===this.json){var i=this;this.executeWithBusyMessage((function(){try{i.json=i.get(),i._renderPreview(),i._pushHistory()}catch(e){}}),"parsing...")}else this._pushHistory();this._debouncedValidate()},_setTextAndFireOnChange:function(e,t){this._setText(e,t),this._onChange()},_applyHistory:function(e){this.json=e.json,this.text=e.text,this._renderPreview(),this._debouncedValidate()},_pushHistory:function(){if(this.history){var e={text:this.text,json:this.json};this.history.add(e)}},executeWithBusyMessage:function(e,t){var i=this.getText().length;if(i>c["d"]){var n=this;Object(d["addClassName"])(n.frame,"busy"),n.dom.busyContent.innerText=t,setTimeout((function(){e(),Object(d["removeClassName"])(n.frame,"busy"),n.dom.busyContent.innerText=""}),100)}else e()}};I.validate=C.validate,I._renderErrors=C._renderErrors;var A=[{mode:"preview",mixin:I,data:"json"}]}])}))},dcf5:function(e,t,i){e.exports=i("be36")}}]);
|
|