website-builder
Version:
edit data for a templates
1 lines • 167 kB
JavaScript
'use strict';if(typeof module!=='undefined'&&module!==null&&eval('typeof require')!=='undefined'&&require!==null&&'main'in eval('require')&&eval('typeof require.main')!=='undefined'&&require.main!==null){var ORIGINAL_MAIN_MODULE=module;if(module!==eval('require.main')&&'paths'in module&&'paths'in eval('require.main')&&typeof __dirname!=='undefined'&&__dirname!==null)module.paths=eval('require.main.paths').concat(module.paths.filter(function(path){return eval('require.main.paths').includes(path)}))};if(typeof window==='undefined'||window===null)var window=(typeof global==='undefined'||global===null)?{}:global;!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("clientnode"),require("tinymce/plugins/anchor"),require("tinymce/plugins/preview"),require("ejs"),require("tinymce"),require("tinymce/plugins/advlist"),require("tinymce/plugins/autoresize"),require("tinymce/plugins/autolink"),require("tinymce/plugins/charmap"),require("tinymce/plugins/code"),require("tinymce/plugins/contextmenu"),require("tinymce/plugins/fullscreen"),require("tinymce/plugins/help"),require("tinymce/plugins/hr"),require("tinymce/plugins/image"),require("tinymce/plugins/imagetools"),require("tinymce/plugins/insertdatetime"),require("tinymce/plugins/lists"),require("tinymce/plugins/link"),require("tinymce/plugins/media"),require("tinymce/plugins/nonbreaking"),require("tinymce/plugins/noneditable"),require("tinymce/plugins/pagebreak"),require("tinymce/plugins/paste"),require("tinymce/plugins/print"),require("tinymce/plugins/searchreplace"),require("tinymce/plugins/spellchecker"),require("tinymce/plugins/table"),require("tinymce/plugins/textcolor"),require("tinymce/plugins/toc"),require("tinymce/plugins/visualblocks"),require("tinymce/plugins/visualchars"),require("tinymce/plugins/wordcount"),require("tinymce/themes/modern/theme")):"function"==typeof define&&define.amd?define("index",["clientnode","tinymce/plugins/anchor","tinymce/plugins/preview","ejs","tinymce","tinymce/plugins/advlist","tinymce/plugins/autoresize","tinymce/plugins/autolink","tinymce/plugins/charmap","tinymce/plugins/code","tinymce/plugins/contextmenu","tinymce/plugins/fullscreen","tinymce/plugins/help","tinymce/plugins/hr","tinymce/plugins/image","tinymce/plugins/imagetools","tinymce/plugins/insertdatetime","tinymce/plugins/lists","tinymce/plugins/link","tinymce/plugins/media","tinymce/plugins/nonbreaking","tinymce/plugins/noneditable","tinymce/plugins/pagebreak","tinymce/plugins/paste","tinymce/plugins/print","tinymce/plugins/searchreplace","tinymce/plugins/spellchecker","tinymce/plugins/table","tinymce/plugins/textcolor","tinymce/plugins/toc","tinymce/plugins/visualblocks","tinymce/plugins/visualchars","tinymce/plugins/wordcount","tinymce/themes/modern/theme"],e):"object"==typeof exports?exports.index=e(require("clientnode"),require("tinymce/plugins/anchor"),require("tinymce/plugins/preview"),require("ejs"),require("tinymce"),require("tinymce/plugins/advlist"),require("tinymce/plugins/autoresize"),require("tinymce/plugins/autolink"),require("tinymce/plugins/charmap"),require("tinymce/plugins/code"),require("tinymce/plugins/contextmenu"),require("tinymce/plugins/fullscreen"),require("tinymce/plugins/help"),require("tinymce/plugins/hr"),require("tinymce/plugins/image"),require("tinymce/plugins/imagetools"),require("tinymce/plugins/insertdatetime"),require("tinymce/plugins/lists"),require("tinymce/plugins/link"),require("tinymce/plugins/media"),require("tinymce/plugins/nonbreaking"),require("tinymce/plugins/noneditable"),require("tinymce/plugins/pagebreak"),require("tinymce/plugins/paste"),require("tinymce/plugins/print"),require("tinymce/plugins/searchreplace"),require("tinymce/plugins/spellchecker"),require("tinymce/plugins/table"),require("tinymce/plugins/textcolor"),require("tinymce/plugins/toc"),require("tinymce/plugins/visualblocks"),require("tinymce/plugins/visualchars"),require("tinymce/plugins/wordcount"),require("tinymce/themes/modern/theme")):t.index=e(t.clientnode,t["tinymce/plugins/anchor"],t["tinymce/plugins/preview"],t.ejs,t.tinymce,t["tinymce/plugins/advlist"],t["tinymce/plugins/autoresize"],t["tinymce/plugins/autolink"],t["tinymce/plugins/charmap"],t["tinymce/plugins/code"],t["tinymce/plugins/contextmenu"],t["tinymce/plugins/fullscreen"],t["tinymce/plugins/help"],t["tinymce/plugins/hr"],t["tinymce/plugins/image"],t["tinymce/plugins/imagetools"],t["tinymce/plugins/insertdatetime"],t["tinymce/plugins/lists"],t["tinymce/plugins/link"],t["tinymce/plugins/media"],t["tinymce/plugins/nonbreaking"],t["tinymce/plugins/noneditable"],t["tinymce/plugins/pagebreak"],t["tinymce/plugins/paste"],t["tinymce/plugins/print"],t["tinymce/plugins/searchreplace"],t["tinymce/plugins/spellchecker"],t["tinymce/plugins/table"],t["tinymce/plugins/textcolor"],t["tinymce/plugins/toc"],t["tinymce/plugins/visualblocks"],t["tinymce/plugins/visualchars"],t["tinymce/plugins/wordcount"],t["tinymce/themes/modern/theme"])}(window,(function(t,e,i,s,n,r,o,a,l,h,d,u,c,p,m,f,g,y,_,v,b,w,x,C,k,E,N,A,j,S,T,O,I,P){return function(t){function e(s){if(i[s])return i[s].exports;var n=i[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,s){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:s})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(e.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var n in t)e.d(s,n,function(e){return t[e]}.bind(null,n));return s},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=40)}([function(e){e.exports=t},,,function(t){t.exports=e},function(t){t.exports=i},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/content/dark/content.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/content/dark/content.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/content/default/content.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/content/default/content.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/content/document/content.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/content/document/content.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/content/writer/content.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/content/writer/content.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/content.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/content.inline.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/content.inline.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/content.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/content.mobile.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/content.mobile.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/fonts/tinymce-mobile.woff"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/skin.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/skin.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/skin.mobile.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide-dark/skin.mobile.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/content.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/content.inline.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/content.inline.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/content.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/content.mobile.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/content.mobile.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/fonts/tinymce-mobile.woff"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/skin.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/skin.min.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/skin.mobile.css"},function(t,e,i){"use strict";i.r(e),e.default=i.p+"editorAssets.compiled/skins/ui/oxide/skin.mobile.min.css"},function(t){t.exports=s},function(t){(function(){var t,e=Math.min,i=Math.ceil,s=Math.floor,n=Math.max;(function(){var e=!1,i=/xyz/.test((function(){window.postMessage("xyz")}))?/\b_super\b/:/.*/;(t=function(){}).extend=function t(s){function n(){!e&&this.init&&this.init.apply(this,arguments)}var r=this.prototype;e=!0;var o=new this;for(var a in e=!1,s)o[a]="function"==typeof s[a]&&"function"==typeof r[a]&&i.test(s[a])?function(t,e){return function(){var i=this._super;this._super=r[t];var s=e.apply(this,arguments);return this._super=i,s}}(a,s[a]):s[a];return n.prototype=o,n.prototype.constructor=n,n.extend=t,n}})(),function(){function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i}t.prototype=window.Event.prototype,window.CustomEvent=t}(),function(){for(var t=0,e=["ms","moz","webkit","o"],i=0;i<e.length&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[e[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[i]+"CancelAnimationFrame"]||window[e[i]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e){var i=(new Date).getTime(),s=n(0,16-(i-t)),r=window.setTimeout((function(){e(i+s)}),s);return t=i+s,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}(),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)});var r=function(t){return!("object"!=typeof t||t.nodeType||null!==t&&t===t.window)&&(!t.constructor||Object.prototype.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))},o=function(t){var e,i,s;for(i=1;i<arguments.length;i++)for(s in e=arguments[i])e.hasOwnProperty(s)&&(e[s]&&r(e[s])?(!t.hasOwnProperty(s)&&(t[s]={}),o(t[s],e[s])):t[s]=e[s]);return t},a=function(t,e){if(t&&"object"==typeof t)if(Array.isArray(t)||"number"==typeof t.length&&0<t.length&&t.length-1 in t){for(s=0;s<t.length;s++)if(!1===e(s,t[s]))return}else if(Object.keys){var i=Object.keys(t);for(s=0;s<i.length;s++)if(!1===e(i[s],t[i[s]]))return}else for(var s in t)if(t.hasOwnProperty(s)&&!1===e(s,t[s]))return},l=function(t,e){var i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!0),t.dispatchEvent(i)},h=function(t,e){if(!(t instanceof Element))throw new Error("element should be an instance of Element");e=o({},h.defaults.options,e||{}),this.element=t,this.options=e,this.init()};h.prototype={constructor:h,init:function(){var t=this;this.ready=!1;var e=h.defaults.themes[this.options.theme||h.defaults.theme];if(!e)throw"Unknown theme "+(this.options.theme||h.defaults.theme);this.schema=this.options.schema,this.theme=new e,this.template=this.options.template,this.refs=this.options.refs||{},this.uuid=0,this.__data={};var i=h.defaults.iconlibs[this.options.iconlib||h.defaults.iconlib];i&&(this.iconlib=new i),this.root_container=this.theme.getContainer(),this.element.appendChild(this.root_container),this.translate=this.options.translate||h.defaults.translate,this._loadExternalRefs(this.schema,(function(){t._getDefinitions(t.schema);var e={};t.options.custom_validators&&(e.custom_validators=t.options.custom_validators),t.validator=new h.Validator(t,null,e);var i=t.getEditorClass(t.schema);t.root=t.createEditor(i,{jsoneditor:t,schema:t.schema,required:!0,container:t.root_container}),t.root.preBuild(),t.root.build(),t.root.postBuild(),t.options.startval&&t.root.setValue(t.options.startval),t.validation_results=t.validator.validate(t.root.getValue()),t.root.showValidationErrors(t.validation_results),t.ready=!0,window.requestAnimationFrame((function(){t.ready&&(t.validation_results=t.validator.validate(t.root.getValue()),t.root.showValidationErrors(t.validation_results),t.trigger("ready"),t.trigger("change"))}))}))},getValue:function(){if(!this.ready)throw"JSON Editor not ready yet. Listen for 'ready' event before getting the value";return this.root.getValue()},setValue:function(t){if(!this.ready)throw"JSON Editor not ready yet. Listen for 'ready' event before setting the value";return this.root.setValue(t),this},validate:function(t){if(!this.ready)throw"JSON Editor not ready yet. Listen for 'ready' event before validating";return 1===arguments.length?this.validator.validate(t):this.validation_results},destroy:function(){this.destroyed||!this.ready||(this.schema=null,this.options=null,this.root.destroy(),this.root=null,this.root_container=null,this.validator=null,this.validation_results=null,this.theme=null,this.iconlib=null,this.template=null,this.__data=null,this.ready=!1,this.element.innerHTML="",this.destroyed=!0)},on:function(t,e){return this.callbacks=this.callbacks||{},this.callbacks[t]=this.callbacks[t]||[],this.callbacks[t].push(e),this},off:function(t,e){if(t&&e){this.callbacks=this.callbacks||{},this.callbacks[t]=this.callbacks[t]||[];for(var i=[],s=0;s<this.callbacks[t].length;s++)this.callbacks[t][s]!==e&&i.push(this.callbacks[t][s]);this.callbacks[t]=i}else t?(this.callbacks=this.callbacks||{},this.callbacks[t]=[]):this.callbacks={};return this},trigger:function(t){if(this.callbacks&&this.callbacks[t]&&this.callbacks[t].length)for(var e=0;e<this.callbacks[t].length;e++)this.callbacks[t][e]();return this},setOption:function(t,e){if("show_errors"!==t)throw"Option "+t+" must be set during instantiation and cannot be changed later";return this.options.show_errors=e,this.onChange(),this},getEditorClass:function(t){var e;if(t=this.expandSchema(t),a(h.defaults.resolvers,(function(i,s){var n=s(t);if(n&&h.defaults.editors[n])return e=n,!1})),!e)throw"Unknown editor for schema "+JSON.stringify(t);if(!h.defaults.editors[e])throw"Unknown editor "+e;return h.defaults.editors[e]},createEditor:function(t,e){return new t(e=o({},t.options||{},e))},onChange:function(){if(this.ready&&!this.firing_change){this.firing_change=!0;var t=this;return window.requestAnimationFrame((function(){t.firing_change=!1,t.ready&&(t.validation_results=t.validator.validate(t.root.getValue()),"never"===t.options.show_errors?t.root.showValidationErrors([]):t.root.showValidationErrors(t.validation_results),t.trigger("change"))})),this}},compileTemplate:function(t,e){var i;if("string"==typeof(e=e||h.defaults.template)){if(!h.defaults.templates[e])throw"Unknown template engine "+e;if(!(i=h.defaults.templates[e]()))throw"Template engine "+e+" missing required library."}else i=e;if(!i)throw"No template engine set";if(!i.compile)throw"Invalid template engine set";return i.compile(t)},_data:function(t,e,i){if(3!==arguments.length)return t.hasAttribute("data-jsoneditor-"+e)?this.__data[t.getAttribute("data-jsoneditor-"+e)]:null;var s;t.hasAttribute("data-jsoneditor-"+e)?s=t.getAttribute("data-jsoneditor-"+e):(s=this.uuid++,t.setAttribute("data-jsoneditor-"+e,s)),this.__data[s]=i},registerEditor:function(t){return this.editors=this.editors||{},this.editors[t.path]=t,this},unregisterEditor:function(t){return this.editors=this.editors||{},this.editors[t.path]=null,this},getEditor:function(t){return this.editors?this.editors[t]:void 0},watch:function(t,e){return this.watchlist=this.watchlist||{},this.watchlist[t]=this.watchlist[t]||[],this.watchlist[t].push(e),this},unwatch:function(t,e){if(!this.watchlist||!this.watchlist[t])return this;if(!e)return this.watchlist[t]=null,this;for(var i=[],s=0;s<this.watchlist[t].length;s++){if(this.watchlist[t][s]===e)continue;i.push(this.watchlist[t][s])}return this.watchlist[t]=i.length?i:null,this},notifyWatchers:function(t){if(!this.watchlist||!this.watchlist[t])return this;for(var e=0;e<this.watchlist[t].length;e++)this.watchlist[t][e]()},isEnabled:function(){return!this.root||this.root.isEnabled()},enable:function(){this.root.enable()},disable:function(){this.root.disable()},_getDefinitions:function(t,e){if(e=e||"#/definitions/",t.definitions)for(var i in t.definitions)t.definitions.hasOwnProperty(i)&&(this.refs[e+i]=t.definitions[i],t.definitions[i].definitions&&this._getDefinitions(t.definitions[i],e+i+"/definitions/"))},_getExternalRefs:function(t){var e={},i=function(t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=!0)};for(var s in t.$ref&&"object"!=typeof t.$ref&&"#"!==t.$ref.substr(0,1)&&!this.refs[t.$ref]&&(e[t.$ref]=!0),t)if(t.hasOwnProperty(s))if(t[s]&&"object"==typeof t[s]&&Array.isArray(t[s]))for(var n=0;n<t[s].length;n++)"object"==typeof t[s][n]&&i(this._getExternalRefs(t[s][n]));else t[s]&&"object"==typeof t[s]&&i(this._getExternalRefs(t[s]));return e},_loadExternalRefs:function(t,e){var i=this,s=this._getExternalRefs(t),n=0,r=0,o=!1;a(s,(function(t){if(!i.refs[t]){if(!i.options.ajax)throw"Must set ajax option to true to load external ref "+t;i.refs[t]="loading",r++;var s=new XMLHttpRequest;s.open("GET",t,!0),s.onreadystatechange=function(){if(4==s.readyState){if(200!==s.status)throw window.console.log(s),"Failed to fetch ref via ajax- "+t;var a;try{a=JSON.parse(s.responseText)}catch(e){throw window.console.log(e),"Failed to parse external ref "+t}if(!a||"object"!=typeof a)throw"External ref does not contain a valid schema - "+t;i.refs[t]=a,i._loadExternalRefs(a,(function(){++n>=r&&!o&&(o=!0,e())}))}},s.send()}})),r||e()},expandRefs:function(t){for(t=o({},t);t.$ref;){var e=t.$ref;delete t.$ref,this.refs[e]||(e=decodeURIComponent(e)),t=this.extendSchemas(t,this.refs[e])}return t},expandSchema:function(t){var e,i=this,s=o({},t);if("object"==typeof t.type&&(Array.isArray(t.type)?a(t.type,(function(e,s){"object"==typeof s&&(t.type[e]=i.expandSchema(s))})):t.type=i.expandSchema(t.type)),"object"==typeof t.disallow&&(Array.isArray(t.disallow)?a(t.disallow,(function(e,s){"object"==typeof s&&(t.disallow[e]=i.expandSchema(s))})):t.disallow=i.expandSchema(t.disallow)),t.anyOf&&a(t.anyOf,(function(e,s){t.anyOf[e]=i.expandSchema(s)})),t.dependencies&&a(t.dependencies,(function(e,s){"object"!=typeof s||Array.isArray(s)||(t.dependencies[e]=i.expandSchema(s))})),t.not&&(t.not=this.expandSchema(t.not)),t.allOf){for(e=0;e<t.allOf.length;e++)s=this.extendSchemas(s,this.expandSchema(t.allOf[e]));delete s.allOf}if(t.extends){if(Array.isArray(t.extends))for(e=0;e<t.extends.length;e++)s=this.extendSchemas(s,this.expandSchema(t.extends[e]));else s=this.extendSchemas(s,this.expandSchema(t.extends));delete s.extends}if(t.oneOf){var n=o({},s);for(delete n.oneOf,e=0;e<t.oneOf.length;e++)s.oneOf[e]=this.extendSchemas(this.expandSchema(t.oneOf[e]),n)}return this.expandRefs(s)},extendSchemas:function(t,e){t=o({},t),e=o({},e);var i=this,s={};return a(t,(function(t,n){void 0===e[t]?s[t]=n:"required"!==t&&"defaultProperties"!==t||"object"!=typeof n||!Array.isArray(n)?"type"!==t||"string"!=typeof n&&!Array.isArray(n)?"object"==typeof n&&Array.isArray(n)?s[t]=n.filter((function(i){return-1!==e[t].indexOf(i)})):s[t]="object"==typeof n&&null!==n?i.extendSchemas(n,e[t]):n:("string"==typeof n&&(n=[n]),"string"==typeof e.type&&(e.type=[e.type]),s.type=e.type&&e.type.length?n.filter((function(t){return-1!==e.type.indexOf(t)})):n,1===s.type.length&&"string"==typeof s.type[0]?s.type=s.type[0]:0===s.type.length&&delete s.type):s[t]=n.concat(e[t]).reduce((function(t,e){return 0>t.indexOf(e)&&t.push(e),t}),[])})),a(e,(function(e,i){void 0===t[e]&&(s[e]=i)})),s}},h.defaults={themes:{},templates:{},iconlibs:{},editors:{},languages:{},resolvers:[],custom_validators:[]},h.Validator=t.extend({init:function(t,e,i){this.jsoneditor=t,this.schema=e||this.jsoneditor.schema,this.options=i||{},this.translate=this.jsoneditor.translate||h.defaults.translate},validate:function(t){return this._validateSchema(this.schema,t)},_validateSchema:function(t,e,i){var n,r,l,d=this,u=[],c=JSON.stringify(e);if(i=i||"root",(t=o({},this.jsoneditor.expandRefs(t))).required&&!0===t.required){if(void 0===e)return u.push({path:i,property:"required",message:this.translate("error_notset")}),u}else if(void 0===e){if(!this.jsoneditor.options.required_by_default)return u;u.push({path:i,property:"required",message:this.translate("error_notset")})}if(t.enum){for(n=!1,r=0;r<t.enum.length;r++)c===JSON.stringify(t.enum[r])&&(n=!0);n||u.push({path:i,property:"enum",message:this.translate("error_enum")})}if(t.extends)for(r=0;r<t.extends.length;r++)u=u.concat(this._validateSchema(t.extends[r],e,i));if(t.allOf)for(r=0;r<t.allOf.length;r++)u=u.concat(this._validateSchema(t.allOf[r],e,i));if(t.anyOf){for(n=!1,r=0;r<t.anyOf.length;r++)if(!this._validateSchema(t.anyOf[r],e,i).length){n=!0;break}n||u.push({path:i,property:"anyOf",message:this.translate("error_anyOf")})}if(t.oneOf){n=0;var p=[];for(r=0;r<t.oneOf.length;r++){var m=this._validateSchema(t.oneOf[r],e,i);for(m.length||n++,l=0;l<m.length;l++)m[l].path=i+".oneOf["+r+"]"+m[l].path.substr(i.length);p=p.concat(m)}1!==n&&(u.push({path:i,property:"oneOf",message:this.translate("error_oneOf",[n])}),u=u.concat(p))}if(t.not&&!this._validateSchema(t.not,e,i).length&&u.push({path:i,property:"not",message:this.translate("error_not")}),t.type)if(Array.isArray(t.type)){for(n=!1,r=0;r<t.type.length;r++)if(this._checkType(t.type[r],e)){n=!0;break}n||u.push({path:i,property:"type",message:this.translate("error_type_union")})}else this._checkType(t.type,e)||u.push({path:i,property:"type",message:this.translate("error_type",[t.type])});if(t.disallow)if(Array.isArray(t.disallow)){for(n=!0,r=0;r<t.disallow.length;r++)if(this._checkType(t.disallow[r],e)){n=!1;break}n||u.push({path:i,property:"disallow",message:this.translate("error_disallow_union")})}else this._checkType(t.disallow,e)&&u.push({path:i,property:"disallow",message:this.translate("error_disallow",[t.disallow])});if("number"==typeof e){if(t.multipleOf||t.divisibleBy){var f=t.multipleOf||t.divisibleBy;n=e/f===s(e/f),window.math?n=window.math.mod(window.math.bignumber(e),window.math.bignumber(f)).equals(0):window.Decimal&&(n=new window.Decimal(e).mod(new window.Decimal(f)).equals(0)),n||u.push({path:i,property:t.multipleOf?"multipleOf":"divisibleBy",message:this.translate("error_multipleOf",[f])})}t.hasOwnProperty("maximum")&&(n=t.exclusiveMaximum?e<t.maximum:e<=t.maximum,window.math?n=window.math[t.exclusiveMaximum?"smaller":"smallerEq"](window.math.bignumber(e),window.math.bignumber(t.maximum)):window.Decimal&&(n=new window.Decimal(e)[t.exclusiveMaximum?"lt":"lte"](new window.Decimal(t.maximum))),!n&&u.push({path:i,property:"maximum",message:this.translate(t.exclusiveMaximum?"error_maximum_excl":"error_maximum_incl",[t.maximum])})),t.hasOwnProperty("minimum")&&(n=t.exclusiveMinimum?e>t.minimum:e>=t.minimum,window.math?n=window.math[t.exclusiveMinimum?"larger":"largerEq"](window.math.bignumber(e),window.math.bignumber(t.minimum)):window.Decimal&&(n=new window.Decimal(e)[t.exclusiveMinimum?"gt":"gte"](new window.Decimal(t.minimum))),!n&&u.push({path:i,property:"minimum",message:this.translate(t.exclusiveMinimum?"error_minimum_excl":"error_minimum_incl",[t.minimum])}))}else if("string"==typeof e)t.maxLength&&(e+"").length>t.maxLength&&u.push({path:i,property:"maxLength",message:this.translate("error_maxLength",[t.maxLength])}),t.minLength&&(e+"").length<t.minLength&&u.push({path:i,property:"minLength",message:this.translate(1===t.minLength?"error_notempty":"error_minLength",[t.minLength])}),t.pattern&&!new RegExp(t.pattern).test(e)&&u.push({path:i,property:"pattern",message:this.translate("error_pattern",[t.pattern])});else if("object"==typeof e&&null!==e&&Array.isArray(e)){if(t.items)if(Array.isArray(t.items))for(r=0;r<e.length;r++)if(t.items[r])u=u.concat(this._validateSchema(t.items[r],e[r],i+"."+r));else{if(!0===t.additionalItems)break;if(!t.additionalItems){if(!1===t.additionalItems){u.push({path:i,property:"additionalItems",message:this.translate("error_additionalItems")});break}break}u=u.concat(this._validateSchema(t.additionalItems,e[r],i+"."+r))}else for(r=0;r<e.length;r++)u=u.concat(this._validateSchema(t.items,e[r],i+"."+r));if(t.maxItems&&e.length>t.maxItems&&u.push({path:i,property:"maxItems",message:this.translate("error_maxItems",[t.maxItems])}),t.minItems&&e.length<t.minItems&&u.push({path:i,property:"minItems",message:this.translate("error_minItems",[t.minItems])}),t.uniqueItems){var g={};for(r=0;r<e.length;r++){if(g[n=JSON.stringify(e[r])]){u.push({path:i,property:"uniqueItems",message:this.translate("error_uniqueItems")});break}g[n]=!0}}}else if("object"==typeof e&&null!==e){if(t.maxProperties){for(r in n=0,e)e.hasOwnProperty(r)&&n++;n>t.maxProperties&&u.push({path:i,property:"maxProperties",message:this.translate("error_maxProperties",[t.maxProperties])})}if(t.minProperties){for(r in n=0,e)e.hasOwnProperty(r)&&n++;n<t.minProperties&&u.push({path:i,property:"minProperties",message:this.translate("error_minProperties",[t.minProperties])})}if(t.required&&Array.isArray(t.required))for(r=0;r<t.required.length;r++)void 0===e[t.required[r]]&&u.push({path:i,property:"required",message:this.translate("error_required",[t.required[r]])});var y={};if(t.properties)for(r in t.properties)t.properties.hasOwnProperty(r)&&(y[r]=!0,u=u.concat(this._validateSchema(t.properties[r],e[r],i+"."+r)));if(t.patternProperties)for(r in t.patternProperties)if(t.patternProperties.hasOwnProperty(r)){var _=new RegExp(r);for(l in e)e.hasOwnProperty(l)&&_.test(l)&&(y[l]=!0,u=u.concat(this._validateSchema(t.patternProperties[r],e[l],i+"."+l)))}if(void 0!==t.additionalProperties||!this.jsoneditor.options.no_additional_properties||t.oneOf||t.anyOf||(t.additionalProperties=!1),void 0!==t.additionalProperties)for(r in e)if(e.hasOwnProperty(r)&&!y[r]){if(!t.additionalProperties){u.push({path:i,property:"additionalProperties",message:this.translate("error_additional_properties",[r])});break}if(!0===t.additionalProperties)break;u=u.concat(this._validateSchema(t.additionalProperties,e[r],i+"."+r))}if(t.dependencies)for(r in t.dependencies)if(t.dependencies.hasOwnProperty(r)&&void 0!==e[r])if(Array.isArray(t.dependencies[r]))for(l=0;l<t.dependencies[r].length;l++)void 0===e[t.dependencies[r][l]]&&u.push({path:i,property:"dependencies",message:this.translate("error_dependency",[t.dependencies[r][l]])});else u=u.concat(this._validateSchema(t.dependencies[r],e,i))}return a(h.defaults.custom_validators,(function(s,n){u=u.concat(n.call(d,t,e,i))})),this.options.custom_validators&&a(this.options.custom_validators,(function(s,n){u=u.concat(n.call(d,t,e,i))})),u},_checkType:function(t,e){return"string"==typeof t?"string"===t?"string"==typeof e:"number"===t?"number"==typeof e:"integer"===t?"number"==typeof e&&e===s(e):"boolean"===t?"boolean"==typeof e:"array"===t?Array.isArray(e):"object"===t?null!==e&&!Array.isArray(e)&&"object"==typeof e:"null"!==t||null===e:!this._validateSchema(t,e).length}}),h.AbstractEditor=t.extend({onChildEditorChange:function(){this.onChange(!0)},notify:function(){this.jsoneditor.notifyWatchers(this.path)},change:function(){this.parent?this.parent.onChildEditorChange(this):this.jsoneditor.onChange()},onChange:function(t){this.notify(),this.watch_listener&&this.watch_listener(),t&&this.change()},register:function(){this.jsoneditor.registerEditor(this),this.onChange()},unregister:function(){this.jsoneditor&&this.jsoneditor.unregisterEditor(this)},getNumColumns:function(){return 12},init:function(t){this.jsoneditor=t.jsoneditor,this.theme=this.jsoneditor.theme,this.template_engine=this.jsoneditor.template,this.iconlib=this.jsoneditor.iconlib,this.translate=this.jsoneditor.translate||h.defaults.translate,this.original_schema=t.schema,this.schema=this.jsoneditor.expandSchema(this.original_schema),this.options=o({},this.options||{},t.schema.options||{},t),t.path||this.schema.id||(this.schema.id="root"),this.path=t.path||"root",this.formname=t.formname||this.path.replace(/\.([^.]+)/g,"[$1]"),this.jsoneditor.options.form_name_root&&(this.formname=this.formname.replace(/^root\[/,this.jsoneditor.options.form_name_root+"[")),this.key=this.path.split(".").pop(),this.parent=t.parent,this.link_watchers=[],t.container&&this.setContainer(t.container)},setContainer:function(t){this.container=t,this.schema.id&&this.container.setAttribute("data-schemaid",this.schema.id),this.schema.type&&"string"==typeof this.schema.type&&this.container.setAttribute("data-schematype",this.schema.type),this.container.setAttribute("data-schemapath",this.path)},preBuild:function(){},build:function(){},postBuild:function(){this.setupWatchListeners(),this.addLinks(),this.setValue(this.getDefault(),!0),this.updateHeaderText(),this.register(),this.onWatchedFieldChange()},setupWatchListeners:function(){var t,e,i,s,n,r=this;if(this.watched={},this.schema.vars&&(this.schema.watch=this.schema.vars),this.watched_values={},this.watch_listener=function(){r.refreshWatchedFieldValues()&&r.onWatchedFieldChange()},this.register(),this.schema.hasOwnProperty("watch"))for(var o in this.schema.watch)if(this.schema.watch.hasOwnProperty(o)){if(t=this.schema.watch[o],Array.isArray(t)){if(2>t.length)continue;e=[t[0]].concat(t[1].split("."))}else e=t.split("."),r.theme.closest(r.container,'[data-schemaid="'+e[0]+'"]')||e.unshift("#");if("#"===(i=e.shift())&&(i=r.jsoneditor.schema.id||"root"),!(s=r.theme.closest(r.container,'[data-schemaid="'+i+'"]')))throw"Could not find ancestor node with id "+i;n=s.getAttribute("data-schemapath")+"."+e.join("."),r.jsoneditor.watch(n,r.watch_listener),r.watched[o]=n}this.schema.headerTemplate&&(this.header_template=this.jsoneditor.compileTemplate(this.schema.headerTemplate,this.template_engine))},addLinks:function(){if(!this.no_link_holder&&(this.link_holder=this.theme.getLinksHolder(),this.container.appendChild(this.link_holder),this.schema.links))for(var t=0;t<this.schema.links.length;t++)this.addLink(this.getLink(this.schema.links[t]))},getButton:function(t,e,i){var s="json-editor-btn-"+e;!(e=this.iconlib?this.iconlib.getIcon(e):null)&&i&&(t=i,i=null);var n=this.theme.getButton(t,e,i);return n.className+=" "+s+" ",n},setButtonText:function(t,e,i,s){return!(i=this.iconlib?this.iconlib.getIcon(i):null)&&s&&(e=s,s=null),this.theme.setButtonText(t,e,i,s)},addLink:function(t){this.link_holder&&this.link_holder.appendChild(t)},getLink:function(t){var e,i,s=(t.mediaType||"application/javascript").split("/")[0],n=this.jsoneditor.compileTemplate(t.href,this.template_engine),r=null;if(t.download&&(r=t.download),r&&!0!==r&&(r=this.jsoneditor.compileTemplate(r,this.template_engine)),"image"===s){e=this.theme.getBlockLinkHolder(),(i=document.createElement("a")).setAttribute("target","_blank");var o=document.createElement("img");this.theme.createImageLink(e,i,o),this.link_watchers.push((function(e){var s=n(e);i.setAttribute("href",s),i.setAttribute("title",t.rel||s),o.setAttribute("src",s)}))}else if(0<=["audio","video"].indexOf(s)){e=this.theme.getBlockLinkHolder(),(i=this.theme.getBlockLink()).setAttribute("target","_blank");var a=document.createElement(s);a.setAttribute("controls","controls"),this.theme.createMediaLink(e,i,a),this.link_watchers.push((function(e){var s=n(e);i.setAttribute("href",s),i.textContent=t.rel||s,a.setAttribute("src",s)}))}else i=e=this.theme.getBlockLink(),e.setAttribute("target","_blank"),e.textContent=t.rel,this.link_watchers.push((function(i){var s=n(i);e.setAttribute("href",s),e.textContent=t.rel||s}));return r&&i&&(!0===r?i.setAttribute("download",""):this.link_watchers.push((function(t){i.setAttribute("download",r(t))}))),t.class&&(i.className=i.className+" "+t.class),e},refreshWatchedFieldValues:function(){if(this.watched_values){var t,e,i={},s=!1;if(this.watched)for(var n in this.watched)this.watched.hasOwnProperty(n)&&(t=(e=this.jsoneditor.getEditor(this.watched[n]))?e.getValue():null,this.watched_values[n]!==t&&(s=!0),i[n]=t);return i.self=this.getValue(),this.watched_values.self!==i.self&&(s=!0),this.watched_values=i,s}},getWatchedFieldValues:function(){return this.watched_values},updateHeaderText:function(){if(this.header)if(this.header.children.length){for(var t=0;t<this.header.childNodes.length;t++)if(3===this.header.childNodes[t].nodeType){this.header.childNodes[t].nodeValue=this.getHeaderText();break}}else this.header.textContent=this.getHeaderText()},getHeaderText:function(t){return this.header_text?this.header_text:t?this.schema.title:this.getTitle()},onWatchedFieldChange:function(){var t;if(this.header_template){t=o(this.getWatchedFieldValues(),{key:this.key,i:this.key,i0:1*this.key,i1:1*this.key+1,title:this.getTitle()});var e=this.header_template(t);e!==this.header_text&&(this.header_text=e,this.updateHeaderText(),this.notify())}if(this.link_watchers.length){t=this.getWatchedFieldValues();for(var i=0;i<this.link_watchers.length;i++)this.link_watchers[i](t)}},setValue:function(t){this.value=t},getValue:function(){return this.value},refreshValue:function(){},getChildEditors:function(){return!1},destroy:function(){var t=this;this.unregister(this),a(this.watched,(function(e,i){t.jsoneditor.unwatch(i,t.watch_listener)})),this.watched=null,this.watched_values=null,this.watch_listener=null,this.header_text=null,this.header_template=null,this.value=null,this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null,this.jsoneditor=null,this.schema=null,this.path=null,this.key=null,this.parent=null},getDefault:function(){if(this.schema.default)return this.schema.default;if(this.schema.enum)return this.schema.enum[0];var t=this.schema.type||this.schema.oneOf;if(t&&Array.isArray(t)&&(t=t[0]),t&&"object"==typeof t&&(t=t.type),t&&Array.isArray(t)&&(t=t[0]),"string"==typeof t){if("number"===t)return 0;if("boolean"===t)return!1;if("integer"===t)return 0;if("string"===t)return"";if("object"===t)return{};if("array"===t)return[]}return null},getTitle:function(){return this.schema.title||this.key},enable:function(){this.disabled=!1},disable:function(){this.disabled=!0},isEnabled:function(){return!this.disabled},isRequired:function(){return"boolean"==typeof this.schema.required?this.schema.required:this.parent&&this.parent.schema&&Array.isArray(this.parent.schema.required)?-1<this.parent.schema.required.indexOf(this.key):!!this.jsoneditor.options.required_by_default},getDisplayText:function(t){var e=[],i={};a(t,(function(t,e){e.title&&(i[e.title]=i[e.title]||0,i[e.title]++),e.description&&(i[e.description]=i[e.description]||0,i[e.description]++),e.format&&(i[e.format]=i[e.format]||0,i[e.format]++),e.type&&(i[e.type]=i[e.type]||0,i[e.type]++)})),a(t,(function(t,s){var n;n="string"==typeof s?s:s.title&&1>=i[s.title]?s.title:s.format&&1>=i[s.format]?s.format:s.type&&1>=i[s.type]?s.type:s.description&&1>=i[s.description]?s.descripton:s.title?s.title:s.format?s.format:s.type?s.type:s.description?s.description:50>JSON.stringify(s).length?JSON.stringify(s):"type",e.push(n)}));var s={};return a(e,(function(t,n){s[n]=s[n]||0,s[n]++,1<i[n]&&(e[t]=n+" "+s[n])})),e},getOption:function(t){try{throw"getOption is deprecated"}catch(t){window.console.error(t)}return this.options[t]},showValidationErrors:function(){}}),h.defaults.editors.null=h.AbstractEditor.extend({getValue:function(){return null},setValue:function(){this.onChange()},getNumColumns:function(){return 2}}),h.defaults.editors.string=h.AbstractEditor.extend({register:function(){this._super(),this.input&&this.input.setAttribute("name",this.formname)},unregister:function(){this._super(),this.input&&this.input.removeAttribute("name")},setValue:function(t,e,i){if((!this.template||i)&&(null==t?t="":"object"==typeof t?t=JSON.stringify(t):"string"!=typeof t&&(t=""+t),t!==this.serialized)){var s=this.sanitize(t);if(this.input.value!==s){this.input.value=s,this.sceditor_instance?this.sceditor_instance.val(s):this.epiceditor?this.epiceditor.importFile(null,s):this.ace_editor&&this.ace_editor.setValue(s);var n=i||this.getValue()!==t;this.refreshValue(),e?this.is_dirty=!1:"change"===this.jsoneditor.options.show_errors&&(this.is_dirty=!0),this.adjust_height&&this.adjust_height(this.input),this.onChange(n)}}},getNumColumns:function(){var t,s=i(n(this.getTitle().length,this.schema.maxLength||0,this.schema.minLength||0)/5);return t="textarea"===this.input_type?6:0<=["text","email"].indexOf(this.input_type)?4:2,e(12,n(s,t))},build:function(){var t=this;if(this.options.compact||(this.header=this.label=this.theme.getFormInputLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description)),this.format=this.schema.format,!this.format&&this.schema.media&&this.schema.media.type&&(this.format=this.schema.media.type.replace(/(^(application|text)\/(x-)?(script\.)?)|(-source$)/g,"")),!this.format&&this.options.default_format&&(this.format=this.options.default_format),this.options.format&&(this.format=this.options.format),this.format)if("textarea"===this.format)this.input_type="textarea",this.input=this.theme.getTextareaInput();else if("range"===this.format){this.input_type="range";var e=this.schema.minimum||0,r=this.schema.maximum||n(100,e+1),o=1;this.schema.multipleOf&&(e%this.schema.multipleOf&&(e=i(e/this.schema.multipleOf)*this.schema.multipleOf),r%this.schema.multipleOf&&(r=s(r/this.schema.multipleOf)*this.schema.multipleOf),o=this.schema.multipleOf),this.input=this.theme.getRangeInput(e,r,o)}else 0<=["actionscript","batchfile","bbcode","c","c++","cpp","coffee","csharp","css","dart","django","ejs","erlang","golang","groovy","handlebars","haskell","haxe","html","ini","jade","java","javascript","json","less","lisp","lua","makefile","markdown","matlab","mysql","objectivec","pascal","perl","pgsql","php","python","r","ruby","sass","scala","scss","smarty","sql","stylus","svg","twig","vbscript","xml","yaml"].indexOf(this.format)?(this.input_type=this.format,this.source_code=!0,this.input=this.theme.getTextareaInput()):(this.input_type=this.format,this.input=this.theme.getFormInputField(this.input_type));else this.input_type="text",this.input=this.theme.getFormInputField(this.input_type);void 0!==this.schema.maxLength&&this.input.setAttribute("maxlength",this.schema.maxLength),void 0===this.schema.pattern?void 0!==this.schema.minLength&&this.input.setAttribute("pattern",".{"+this.schema.minLength+",}"):this.input.setAttribute("pattern",this.schema.pattern),this.options.compact?this.container.className+=" compact":this.options.input_width&&(this.input.style.width=this.options.input_width),(this.schema.readOnly||this.schema.readonly||this.schema.template)&&(this.always_disabled=!0,this.input.disabled=!0),this.input.addEventListener("change",(function(e){if(e.preventDefault(),e.stopPropagation(),t.schema.template)this.value=t.value;else{var i=this.value,s=t.sanitize(i);i!==s&&(this.value=s),t.is_dirty=!0,t.refreshValue(),t.onChange(!0)}})),this.options.input_height&&(this.input.style.height=this.options.input_height),this.options.expand_height&&(this.adjust_height=function(t){if(t){var e,i=t.offsetHeight;if(t.offsetHeight<t.scrollHeight)for(e=0;t.offsetHeight<t.scrollHeight+3&&!(100<e);)e++,i++,t.style.height=i+"px";else{for(e=0;t.offsetHeight>=t.scrollHeight+3&&!(100<e);)e++,i--,t.style.height=i+"px";t.style.height=i+1+"px"}}},this.input.addEventListener("keyup",(function(){t.adjust_height(this)})),this.input.addEventListener("change",(function(){t.adjust_height(this)})),this.adjust_height()),this.format&&this.input.setAttribute("data-schemaformat",this.format),this.control=this.theme.getFormControl(this.label,this.input,this.description),this.container.appendChild(this.control),window.requestAnimationFrame((function(){t.input.parentNode&&t.afterInputReady(),t.adjust_height&&t.adjust_height(t.input)})),this.schema.template?(this.template=this.jsoneditor.compileTemplate(this.schema.template,this.template_engine),this.refreshValue()):this.refreshValue()},enable:function(){this.always_disabled||(this.input.disabled=!1),this._super()},disable:function(){this.input.disabled=!0,this._super()},afterInputReady:function(){var t,e=this;if(this.source_code)if(this.options.wysiwyg&&0<=["html","bbcode"].indexOf(this.input_type)&&window.jQuery&&window.jQuery.fn&&window.jQuery.fn.sceditor)t=o({},{plugins:"html"===e.input_type?"xhtml":"bbcode",emoticonsEnabled:!1,width:"100%",height:300},h.plugins.sceditor,e.options.sceditor_options||{}),window.jQuery(e.input).sceditor(t),e.sceditor_instance=window.jQuery(e.input).sceditor("instance"),e.sceditor_instance.blur((function(){var t=window.jQuery("<div>"+e.sceditor_instance.val()+"</div>");window.jQuery("#sceditor-start-marker,#sceditor-end-marker,.sceditor-nlf",t).remove(),e.input.value=t.html(),e.value=e.input.value,e.is_dirty=!0,e.onChange(!0)}));else if("markdown"===this.input_type&&window.EpicEditor)this.epiceditor_container=document.createElement("div"),this.input.parentNode.insertBefore(this.epiceditor_container,this.input),this.input.style.display="none",t=o({},h.plugins.epiceditor,{container:this.epiceditor_container,clientSideStorage:!1}),this.epiceditor=new window.EpicEditor(t).load(),this.epiceditor.importFile(null,this.getValue()),this.epiceditor.on("update",(function(){var t=e.epiceditor.exportFile();e.input.value=t,e.value=t,e.is_dirty=!0,e.onChange(!0)}));else if(window.ace){var i=this.input_type;("cpp"===i||"c++"===i||"c"===i)&&(i="c_cpp"),this.ace_container=document.createElement("div"),this.ace_container.style.width="100%",this.ace_container.style.position="relative",this.ace_container.style.height="400px",this.input.parentNode.insertBefore(this.ace_container,this.input),this.input.style.display="none",this.ace_editor=window.ace.edit(this.ace_container),this.ace_editor.setValue(this.getValue()),h.plugins.ace.theme&&this.ace_editor.setTheme("ace/theme/"+h.plugins.ace.theme),(i=window.ace.require("ace/mode/"+i))&&this.ace_editor.getSession().setMode(new i.Mode),this.ace_editor.on("change",(function(){var t=e.ace_editor.getValue();e.input.value=t,e.refreshValue(),e.is_dirty=!0,e.onChange(!0)}))}e.theme.afterInputReady(e.input)},refreshValue:function(){this.value=this.input.value,"string"!=typeof this.value&&(this.value=""),this.serialized=this.value},destroy:function(){this.sceditor_instance?this.sceditor_instance.destroy():this.epiceditor?this.epiceditor.unload():this.ace_editor&&this.ace_editor.destroy(),this.template=null,this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this.label&&this.label.parentNode&&this.label.parentNode.removeChild(this.label),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this._super()},sanitize:function(t){return t},onWatchedFieldChange:function(){var t;this.template&&(t=this.getWatchedFieldValues(),this.setValue(this.template(t),!1,!0)),this._super()},showValidationErrors:function(t){var e=this;if("always"===this.jsoneditor.options.show_errors);else if(!this.is_dirty&&this.previous_error_setting===this.jsoneditor.options.show_errors)return;this.previous_error_setting=this.jsoneditor.options.show_errors;var i=[];a(t,(function(t,s){s.path===e.path&&i.push(s.message)})),i.length?this.theme.addInputError(this.input,i.join(". ")+"."):this.theme.removeInputError(this.input)}}),h.defaults.editors.number=h.defaults.editors.string.extend({sanitize:function(t){return(t+"").replace(/[^0-9\.\-eE]/g,"")},getNumColumns:function(){return 2},getValue:function(){return 1*this.value}}),h.defaults.editors.integer=h.defaults.editors.number.extend({sanitize:function(t){return(t+="").replace(/[^0-9\-]/g,"")},getNumColumns:function(){return 2}}),h.defaults.editors.object=h.AbstractEditor.extend({getDefault:function(){return o({},this.schema.default||{})},getChildEditors:function(){return this.editors},register:function(){if(this._super(),this.editors)for(var t in this.editors)this.editors.hasOwnProperty(t)&&this.editors[t].register()},unregister:function(){if(this._super(),this.editors)for(var t in this.editors)this.editors.hasOwnProperty(t)&&this.editors[t].unregister()},getNumColumns:function(){return n(e(12,this.maxwidth),3)},enable:function(){if(this.editjson_button&&(this.editjson_button.disabled=!1),this.addproperty_button&&(this.addproperty_button.disabled=!1),this._super(),this.editors)for(var t in this.editors)this.editors.hasOwnProperty(t)&&this.editors[t].enable()},disable:function(){if(this.editjson_button&&(this.editjson_button.disabled=!0),this.addproperty_button&&(this.addproperty_button.disabled=!0),this.hideEditJSON(),this._super(),this.editors)for(var t in this.editors)this.editors.hasOwnProperty(t)&&this.editors[t].disable()},layoutEditors:function(){var t,i,r=this;if(this.row_container){var o;if(this.property_order=Object.keys(this.editors),this.property_order=this.property_order.sort((function(t,e){var i=r.editors[t].schema.propertyOrder,s=r.editors[e].schema.propertyOrder;return"number"!=typeof i&&(i=1e3),"number"!=typeof s&&(s=1e3),i-s})),"grid"===this.format){var l=[];for(a(this.property_order,(function(t,i){var s=r.editors[i];if(!s.property_removed){for(var o=!1,a=s.options.hidden?0:s.options.grid_columns||s.getNumColumns(),h=s.options.hidden?0:s.container.offsetHeight,d=0;d<l.length;d++)12>=l[d].width+a&&(!h||.5*l[d].minh<h&&2*l[d].maxh>h)&&(o=d);!1===o&&(l.push({width:0,minh:999999,maxh:0,editors:[]}),o=l.length-1),l[o].editors.push({key:i,width:a,height:h}),l[o].width+=a,l[o].minh=e(l[o].minh,h),l[o].maxh=n(l[o].maxh,h)}})),t=0;t<l.length;t++)if(12>l[t].width){var h=!1,d=0;for(i=0;i<l[t].editors.length;i++)0==h?h=i:l[t].editors[i].width>l[t].editors[h].width&&(h=i),l[t].editors[i].width*=12/l[t].width,l[t].editors[i].width=s(l[t].editors[i].width),d+=l[t].editors[i].width;12>d&&(l[t].editors[h].width+=12-d),l[t].width=12}if(this.layout===JSON.stringify(l))return!1;for(this.layout=JSON.stringify(l),o=document.createElement("div"),t=0;t<l.length;t++){var u=this.theme.getGridRow();for(o.appendChild(u),i=0;i<l[t].editors.length;i++){var c=l[t].editors[i].key,p=this.editors[c];p.options.hidden?p.container.style.display="none":this.theme.setGridColumnSize(p.container,l[t].editors[i].width),u.appendChild(p.container)}}}else o=document.createElement("div"),a(this.property_order,(function(t,e){var i=r.editors[e];if(!i.property_removed){var s=r.theme.getGridRow();o.appendChild(s),i.options.hidden?i.container.style.display="none":r.theme.setGridColumnSize(i.container,12),s.appendChild(i.container)}}));this.row_container.innerHTML="",this.row_container.appendChild(o)}},getPropertySchema:function(t){var e=this.schema.properties[t]||{};e=o({},e);var i=!!this.schema.properties[t];if(this.schema.patternProperties)for(var s in this.schema.patternProperties)if(this.schema.patternProperties.hasOwnProperty(s)){new RegExp(s).test(t)&&(e.allOf=e.allOf||[],e.allOf.push(this.schema.patternProperties[s]),i=!0)}return!i&&this.schema.additionalProperties&&"object"==typeof this.schema.additionalProperties&&(e=o({},this.schema.additionalProperties)),e},preBuild:function(){this._super(),this.editors={},this.cached_editors={};var t=this;if(this.format=this.options.layout||this.options.object_layout||this.schema.format||this.jsoneditor.options.object_layout||"normal",this.schema.properties=this.schema.properties||{},this.minwidth=0,this.maxwidth=0,this.options.table_row)a(this.schema.properties,(function(e,i){var s=t.jsoneditor.getEditorClass(i);t.editors[e]=t.jsoneditor.createEditor(s,{jsoneditor:t.jsoneditor,schema:i,path:t.path+"."+e,parent:t,compact:!0,required:!0}),t.editors[e].preBuild();var n=t.editors[e].options.hidden?0:t.editors[e].options.grid_columns||t.editors[e].getNumColumns();t.minwidth+=n,t.maxwidth+=n})),this.no_link_holder=!0;else{if(this.options.table)throw"Not supported yet";this.schema.defaultProperties||(this.jsoneditor.options.display_required_only||this.options.display_required_only?(this.schema.defaultProperties=[],a(this.schema.properties,(function(e,i){t.isRequired({key:e,schema:i})&&t.schema.defaultProperties.push(e)}))):t.schema.defaultProperties=Object.keys(t.schema.properties)),t.maxwidth+=1,a(this.schema.defaultProperties,(function(e,i){t.addObjectProperty(i,!0),t.editors[i]&&(t.minwidth=n(t.minwidth,t.editors[i].options.grid_columns||t.editors[i].getNumColumns()),t.maxwidth+=t.editors[i].options.grid_columns||t.editors[i].getNumColumns())}))}this.property_order=Object.keys(this.editors),this.property_order=this.property_order.sort((function(e,i){var s=t.editors[e].schema.propertyOrder,n=t.editors[i].schema.propertyOrder;return"number"!=typeof s&&(s=1e3),"number"!=typeof n&&(n=1e3),s-n}))},build:function(){var t=this;if(this.options.table_row)this.editor_holder=this.container,a(this.editors,(function(e,i){var s=t.theme.getTableCell();t.editor_holder.appendChild(s),i.setContainer(s),i.build(),i.postBuild(),t.editors[e].options.hidden&&(s.style.display="none"),t.editors[e].options.input_width&&(s.style.width=t.editors[e].options.input_width)}));else{if(this.options.table)throw"Not supported yet";this.header=doc