From 4ee52469687a116bbe0a042726d1a3208d55d02a Mon Sep 17 00:00:00 2001 From: sebdet Date: Tue, 19 Mar 2019 15:07:49 +0100 Subject: Removal of dead code Cleanup of the Ui javascript code so that it's easier to work with op policies Issue-ID: CLAMP-330 Change-Id: Ia08b0af5ea818f49ac8625a3709b8f2a4cfdcddd Signed-off-by: sebdet --- .../META-INF/resources/designer/index.html | 2 +- .../META-INF/resources/designer/lib/jsoneditor.js | 19 --- .../resources/designer/lib/jsoneditor.min.js | 19 +++ .../partials/portfolios/clds_modelling.html | 137 +-------------------- .../designer/scripts/OperationalPolicyCtrl.js | 12 -- 5 files changed, 21 insertions(+), 168 deletions(-) delete mode 100644 src/main/resources/META-INF/resources/designer/lib/jsoneditor.js create mode 100644 src/main/resources/META-INF/resources/designer/lib/jsoneditor.min.js (limited to 'src') diff --git a/src/main/resources/META-INF/resources/designer/index.html b/src/main/resources/META-INF/resources/designer/index.html index 62672d21..27e16d2b 100644 --- a/src/main/resources/META-INF/resources/designer/index.html +++ b/src/main/resources/META-INF/resources/designer/index.html @@ -94,7 +94,7 @@ - + diff --git a/src/main/resources/META-INF/resources/designer/lib/jsoneditor.js b/src/main/resources/META-INF/resources/designer/lib/jsoneditor.js deleted file mode 100644 index 3d899050..00000000 --- a/src/main/resources/META-INF/resources/designer/lib/jsoneditor.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @name JSON Editor - * @description JSON Schema Based Editor - * This library is the continuation of jdorn's great work (see also https://github.com/jdorn/json-editor/issues/800) - * @version 1.3.5 - * @author Jeremy Dorn - * @see https://github.com/jdorn/json-editor/ - * @see https://github.com/json-editor/json-editor - * @license MIT - * @example see README.md and docs/ for requirements, examples and usage info - */ -!function(a,b){"use strict";var c=b(a);"object"==typeof module&&null!=module&&module.exports?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):a.JSONEditor=c}("undefined"!=typeof window?window:this,function(a,b){var c;!function(){var a=!1,b=/xyz/.test(function(){window.postMessage("xyz")})?/\b_super\b/:/.*/;return c=function(){},c.extend=function d(c){function e(){!a&&this.init&&this.init.apply(this,arguments)}var f=this.prototype;a=!0;var g=new this;a=!1;for(var h in c)g[h]="function"==typeof c[h]&&"function"==typeof f[h]&&b.test(c[h])?function(a,b){return function(){var c=this._super;this._super=f[a];var d=b.apply(this,arguments);return this._super=c,d}}(h,c[h]):c[h];return e.prototype=g,e.prototype.constructor=e,e.extend=d,e},c}(),function(){function a(a,c){c=c||{bubbles:!1,cancelable:!1,detail:b};var d=document.createEvent("CustomEvent");return d.initCustomEvent(a,c.bubbles,c.cancelable,c.detail),d}a.prototype=window.Event.prototype,window.CustomEvent=a}(),function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c0&&a.length-1 in a){for(c=0;c=i&&!j&&(j=!0,b())},c,k)}},f.send()}}),i||b()},expandRefs:function(a){for(a=e({},a);a.$ref;){var b=this.refs_with_info[a.$ref];delete a.$ref;var c="";b.$ref.startsWith("#")&&(c=b.fetchUrl);var d=c+b.$ref;this.refs[d]||(d=c+decodeURIComponent(b.$ref)),a=this.extendSchemas(a,e({},this.refs[d]))}return a},expandSchema:function(a,b){var c,d=this,g=e({},a);if("object"==typeof a.type&&(Array.isArray(a.type)?f(a.type,function(b,c){"object"==typeof c&&(a.type[b]=d.expandSchema(c))}):a.type=d.expandSchema(a.type)),"object"==typeof a.disallow&&(Array.isArray(a.disallow)?f(a.disallow,function(b,c){"object"==typeof c&&(a.disallow[b]=d.expandSchema(c))}):a.disallow=d.expandSchema(a.disallow)),a.anyOf&&f(a.anyOf,function(b,c){a.anyOf[b]=d.expandSchema(c)}),a.dependencies&&f(a.dependencies,function(b,c){"object"!=typeof c||Array.isArray(c)||(a.dependencies[b]=d.expandSchema(c))}),a.not&&(a.not=this.expandSchema(a.not)),a.allOf){for(c=0;ca.minimum:c>=a.minimum,window.math?g=window.math[a.exclusiveMinimum?"larger":"largerEq"](window.math.bignumber(c),window.math.bignumber(a.minimum)):window.Decimal&&(g=new window.Decimal(c)[a.exclusiveMinimum?"gt":"gte"](new window.Decimal(a.minimum))),g||l.push({path:d,property:"minimum",message:this.translate(a.exclusiveMinimum?"error_minimum_excl":"error_minimum_incl",[a.minimum])}))}else if("string"==typeof c)a.maxLength&&(c+"").length>a.maxLength&&l.push({path:d,property:"maxLength",message:this.translate("error_maxLength",[a.maxLength])}),a.minLength&&(c+"").lengtha.maxItems&&l.push({path:d,property:"maxItems",message:this.translate("error_maxItems",[a.maxItems])}),a.minItems&&c.lengtha.maxProperties&&l.push({path:d,property:"maxProperties",message:this.translate("error_maxProperties",[a.maxProperties])})}if(a.minProperties){g=0;for(i in c)c.hasOwnProperty(i)&&g++;g0:this.dependenciesFulfilled=!g||0===g.length):this.dependenciesFulfilled=!1,this.dependenciesFulfilled!==h&&this.notify(),this.dependenciesFulfilled?d.style.display="block":d.style.display="none"}},setContainer:function(a){this.container=a,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 a=this;if(this.watched={},this.schema.vars&&(this.schema.watch=this.schema.vars),this.watched_values={},this.watch_listener=function(){a.refreshWatchedFieldValues()&&a.onWatchedFieldChange()},this.schema.hasOwnProperty("watch")){var b,c,d,e,f;for(var g in this.schema.watch)if(this.schema.watch.hasOwnProperty(g)){if(b=this.schema.watch[g],Array.isArray(b)){if(b.length<2)continue;c=[b[0]].concat(b[1].split("."))}else c=b.split("."),a.theme.closest(a.container,'[data-schemaid="'+c[0]+'"]')||c.unshift("#");if(d=c.shift(),"#"===d&&(d=a.jsoneditor.schema.id||"root"),e=a.theme.closest(a.container,'[data-schemaid="'+d+'"]'),!e)throw"Could not find ancestor node with id "+d;f=e.getAttribute("data-schemapath")+"."+c.join("."),a.jsoneditor.watch(f,a.watch_listener),a.watched[g]=f}}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 a=0;a=0){b=this.theme.getBlockLinkHolder(),c=this.theme.getBlockLink(),c.setAttribute("target","_blank");var j=document.createElement(e);j.setAttribute("controls","controls"),this.theme.createMediaLink(b,c,j),this.link_watchers.push(function(a){var b=f(a),d=g(a);c.setAttribute("href",b),c.textContent=d||b,j.setAttribute("src",b)})}else c=b=this.theme.getBlockLink(),b.setAttribute("target","_blank"),b.textContent=a.rel,this.link_watchers.push(function(a){var c=f(a),d=g(a);b.setAttribute("href",c),b.textContent=d||c});return h&&c&&(h===!0?c.setAttribute("download",""):this.link_watchers.push(function(a){c.setAttribute("download",h(a))})),a["class"]&&c.classList.add(a["class"]),b},refreshWatchedFieldValues:function(){if(this.watched_values){var a={},b=!1,c=this;if(this.watched){var d,e;for(var f in this.watched)this.watched.hasOwnProperty(f)&&(e=c.jsoneditor.getEditor(this.watched[f]),d=e?e.getValue():null,c.watched_values[f]!==d&&(b=!0),a[f]=d)}return a.self=this.getValue(),this.watched_values.self!==a.self&&(b=!0),this.watched_values=a,b}},getWatchedFieldValues:function(){return this.watched_values},updateHeaderText:function(){if(this.header)if(this.header.children.length){for(var a=0;a-1:!!this.jsoneditor.options.required_by_default},getDisplayText:function(a){var b=[],c={};f(a,function(a,b){b.title&&(c[b.title]=c[b.title]||0,c[b.title]++),b.description&&(c[b.description]=c[b.description]||0,c[b.description]++),b.format&&(c[b.format]=c[b.format]||0,c[b.format]++),b.type&&(c[b.type]=c[b.type]||0,c[b.type]++)}),f(a,function(a,d){var e;e="string"==typeof d?d:d.title&&c[d.title]<=1?d.title:d.format&&c[d.format]<=1?d.format:d.type&&c[d.type]<=1?d.type:d.description&&c[d.description]<=1?d.descripton:d.title?d.title:d.format?d.format:d.type?d.type:d.description?d.description:JSON.stringify(d).length<500?JSON.stringify(d):"type",b.push(e)});var d={};return f(b,function(a,e){d[e]=d[e]||0,d[e]++,c[e]>1&&(b[a]=e+" "+d[e])}),b},getValidId:function(a){return a=a===b?"":a.toString(),a.replace(/\s+/g,"-")},setInputAttributes:function(a){if(this.schema.options&&this.schema.options.inputAttributes){var b=this.schema.options.inputAttributes,c=["name","type"].concat(a);for(var d in b)b.hasOwnProperty(d)&&c.indexOf(d.toLowerCase())==-1&&this.input.setAttribute(d,b[d])}},getOption:function(a){try{throw"getOption is deprecated"}catch(b){window.console.error(b)}return this.options[a]},showValidationErrors:function(a){}}),h.defaults.editors["null"]=h.AbstractEditor.extend({getValue:function(){return this.dependenciesFulfilled?null:b},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(a,b,c){if((!this.template||c)&&(null===a||"undefined"==typeof a?a="":"object"==typeof a?a=JSON.stringify(a):"string"!=typeof a&&(a=""+a), -a!==this.serialized)){var d=this.sanitize(a);if(this.input.value!==d){this.input.value=d,this.sceditor_instance?this.sceditor_instance.val(d):this.SimpleMDE?this.SimpleMDE.value(d):this.ace_editor&&(this.ace_editor.setValue(d),this.ace_editor.session.getSelection().clearSelection(),this.ace_editor.resize());var e=c||this.getValue()!==a;this.refreshValue(),b?this.is_dirty=!1:"change"===this.jsoneditor.options.show_errors&&(this.is_dirty=!0),this.adjust_height&&this.adjust_height(this.input),this.onChange(e)}}},getNumColumns:function(){var a,b=Math.ceil(Math.max(this.getTitle().length,this.schema.maxLength||0,this.schema.minLength||0)/5);return a="textarea"===this.input_type?6:["text","email"].indexOf(this.input_type)>=0?4:2,Math.min(12,Math.max(b,a))},build:function(){var a=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.options.infoText&&(this.infoButton=this.theme.getInfoButton(this.options.infoText)),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 b=this.schema.minimum||0,c=this.schema.maximum||Math.max(100,b+1),d=1;this.schema.multipleOf&&(b%this.schema.multipleOf&&(b=Math.ceil(b/this.schema.multipleOf)*this.schema.multipleOf),c%this.schema.multipleOf&&(c=Math.floor(c/this.schema.multipleOf)*this.schema.multipleOf),d=this.schema.multipleOf),this.input=this.theme.getRangeInput(b,c,d)}else["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","sqlserver","stylus","svg","twig","vbscript","xml","yaml"].indexOf(this.format)>=0?(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);if("undefined"!=typeof this.schema.maxLength&&this.input.setAttribute("maxlength",this.schema.maxLength),"undefined"!=typeof this.schema.pattern?this.input.setAttribute("pattern",this.schema.pattern):"undefined"!=typeof this.schema.minLength&&this.input.setAttribute("pattern",".{"+this.schema.minLength+",}"),this.options.compact?this.container.classList.add("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.setAttribute("readonly","true")),this.setInputAttributes(["maxlength","pattern","readonly","min","max","step"]),this.input.addEventListener("change",function(b){if(b.preventDefault(),b.stopPropagation(),a.schema.template)return void(this.value=a.value);var c=this.value,d=a.sanitize(c);c!==d&&(this.value=d),a.is_dirty=!0,a.refreshValue(),a.onChange(!0)}),this.options.input_height&&(this.input.style.height=this.options.input_height),this.options.expand_height&&(this.adjust_height=function(a){if(a){var b,c=a.offsetHeight;if(a.offsetHeight100);)b++,c++,a.style.height=c+"px";else{for(b=0;a.offsetHeight>=a.scrollHeight+3&&!(b>100);)b++,c--,a.style.height=c+"px";a.style.height=c+1+"px"}}},this.input.addEventListener("keyup",function(b){a.adjust_height(this)}),this.input.addEventListener("change",function(b){a.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.infoButton),"range"===this.format){var e=document.createElement("output");e.setAttribute("class","range-output"),this.control.appendChild(e),e.value=this.schema["default"],this.input.addEventListener("change",function(){e.value=a.input.value}),this.input.addEventListener("input",function(){e.value=a.input.value})}this.container.appendChild(this.control),window.requestAnimationFrame(function(){a.input.parentNode&&a.afterInputReady(),a.adjust_height&&a.adjust_height(a.input)}),this.schema.template?(this.template=this.jsoneditor.compileTemplate(this.schema.template,this.template_engine),this.refreshValue()):this.refreshValue()},postBuild:function(){this._super(),window.Cleave&&this.schema.options&&"object"==typeof this.schema.options.cleave&&(this.cleave=new window.Cleave(this.input,this.schema.options.cleave))},enable:function(){this.always_disabled||(this.input.disabled=!1,this._super())},disable:function(a){a&&(this.always_disabled=!0),this.input.disabled=!0,this._super()},afterInputReady:function(){var a,b=this;if(this.source_code)if(this.options.wysiwyg&&["html","bbcode"].indexOf(this.input_type)>=0&&window.jQuery&&window.jQuery.fn&&window.jQuery.fn.sceditor)a=e({},{plugins:"html"===b.input_type?"xhtml":"bbcode",emoticonsEnabled:!1,width:"100%",height:300},h.plugins.sceditor,b.options.sceditor_options||{}),window.jQuery(b.input).sceditor(a),b.sceditor_instance=window.jQuery(b.input).sceditor("instance"),b.sceditor_instance.blur(function(){var a=window.jQuery("
"+b.sceditor_instance.val()+"
");window.jQuery("#sceditor-start-marker,#sceditor-end-marker,.sceditor-nlf",a).remove(),b.input.value=a.html(),b.value=b.input.value,b.is_dirty=!0,b.onChange(!0)});else if("markdown"===this.input_type&&window.SimpleMDE)a=e({},h.plugins.SimpleMDE,{element:this.input}),this.SimpleMDE=new window.SimpleMDE(a),this.SimpleMDE.codemirror.on("change",function(){b.value=b.SimpleMDE.value(),b.is_dirty=!0,b.onChange(!0)});else if(window.ace){var c=this.input_type;"cpp"!==c&&"c++"!==c&&"c"!==c||(c="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);var d=this.schema.options&&this.schema.options.ace;d&&this.ace_editor.setOptions(d),this.ace_editor.setValue(this.getValue()),this.ace_editor.session.getSelection().clearSelection(),this.ace_editor.resize(),h.plugins.ace.theme&&this.ace_editor.setTheme("ace/theme/"+h.plugins.ace.theme),this.ace_editor.getSession().setMode("ace/mode/"+this.schema.format),this.ace_editor.on("change",function(){var a=b.ace_editor.getValue();b.input.value=a,b.refreshValue(),b.is_dirty=!0,b.onChange(!0)})}b.theme.afterInputReady(b.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.SimpleMDE?(this.SimpleMDE.toTextArea(),this.SimpleMDE=null):this.ace_editor&&this.ace_editor.destroy(),this.cleave&&this.cleave.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(a){return a},onWatchedFieldChange:function(){var a;this.template&&(a=this.getWatchedFieldValues(),this.setValue(this.template(a),!1,!0)),this._super()},showValidationErrors:function(a){var b=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 c=[];f(a,function(a,d){d.path===b.path&&c.push(d.message)}),c.length?this.theme.addInputError(this.input,c.join(". ")+"."):this.theme.removeInputError(this.input)}}),h.defaults.editors.hidden=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(a,b,c){if((!this.template||c)&&(null===a||"undefined"==typeof a?a="":"object"==typeof a?a=JSON.stringify(a):"string"!=typeof a&&(a=""+a),a!==this.serialized)){var d=this.sanitize(a);if(this.input.value!==d){this.input.value=d;var e=c||this.getValue()!==a;this.refreshValue(),b?this.is_dirty=!1:"change"===this.jsoneditor.options.show_errors&&(this.is_dirty=!0),this.adjust_height&&this.adjust_height(this.input),this.onChange(e)}}},getNumColumns:function(){return 2},enable:function(){this._super()},disable:function(){this._super()},refreshValue:function(){this.value=this.input.value,"string"!=typeof this.value&&(this.value=""),this.serialized=this.value},destroy:function(){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(a){return a},onWatchedFieldChange:function(){var a;this.template&&(a=this.getWatchedFieldValues(),this.setValue(this.template(a),!1,!0)),this._super()},build:function(){this.format=this.schema.format,!this.format&&this.options.default_format&&(this.format=this.options.default_format),this.options.format&&(this.format=this.options.format),this.input_type="hidden",this.input=this.theme.getFormInputField(this.input_type),this.format&&this.input.setAttribute("data-schemaformat",this.format),this.container.appendChild(this.input),this.schema.template?(this.template=this.jsoneditor.compileTemplate(this.schema.template,this.template_engine),this.refreshValue()):this.refreshValue()}}),h.defaults.editors.number=h.defaults.editors.string.extend({build:function(){if(this._super(),"undefined"!=typeof this.schema.minimum){var a=this.schema.minimum;"undefined"!=typeof this.schema.exclusiveMinimum&&(a+=1),this.input.setAttribute("min",a)}if("undefined"!=typeof this.schema.maximum){var b=this.schema.maximum;"undefined"!=typeof this.schema.exclusiveMaximum&&(b-=1),this.input.setAttribute("max",b)}if("undefined"!=typeof this.schema.step){var c=this.schema.step||1;this.input.setAttribute("step",c)}this.setInputAttributes(["maxlength","pattern","readonly","min","max","step"])},sanitize:function(a){return(a+"").replace(/[^0-9\.\-eE]/g,"")},getNumColumns:function(){return 2},getValue:function(){return this.dependenciesFulfilled?""===this.value?b:1*this.value:b}}),h.defaults.editors.integer=h.defaults.editors.number.extend({sanitize:function(a){return a+="",a.replace(/[^0-9\-]/g,"")},getNumColumns:function(){return 2}}),h.defaults.editors.rating=h.defaults.editors.integer.extend({build:function(){var a,b=this;this.options.compact||(this.header=this.label=this.theme.getFormInputLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description));var c="json-editor-style-rating",d=document.getElementById(c);if(!d){var e=document.createElement("style");e.id=c,e.type="text/css",e.innerHTML=" .rating-container { display: inline-block; clear: both; } .rating { float:left; } /* :not(:checked) is a filter, so that browsers that don’t support :checked don’t follow these rules. Every browser that supports :checked also supports :not(), so it doesn’t make the test unnecessarily selective */ .rating:not(:checked) > input { position:absolute; top:-9999px; clip:rect(0,0,0,0); } .rating:not(:checked) > label { float:right; width:1em; padding:0 .1em; overflow:hidden; white-space:nowrap; cursor:pointer; color:#ddd; } .rating:not(:checked) > label:before { content: '★ '; } .rating > input:checked ~ label { color: #FFB200; } .rating:not([readOnly]):not(:checked) > label:hover, .rating:not([readOnly]):not(:checked) > label:hover ~ label { color: #FFDA00; } .rating:not([readOnly]) > input:checked + label:hover, .rating:not([readOnly]) > input:checked + label:hover ~ label, .rating:not([readOnly]) > input:checked ~ label:hover, .rating:not([readOnly]) > input:checked ~ label:hover ~ label, .rating:not([readOnly]) > label:hover ~ input:checked ~ label { color: #FF8C0D; } .rating:not([readOnly]) > label:active { position:relative; top:2px; left:2px; }",document.getElementsByTagName("head")[0].appendChild(e)}this.input=this.theme.getFormInputField("hidden"),this.container.appendChild(this.input);var g=document.createElement("div");g.classList.add("rating-container");var h=document.createElement("div");h.setAttribute("name",this.formname),h.classList.add("rating"),g.appendChild(h),this.options.compact&&this.container.setAttribute("class",this.container.getAttribute("class")+" compact");var i=this.schema.maximum?this.schema.maximum:5;for(this.schema.exclusiveMaximum&&i--,this.inputs=[],a=i;a>0;a--){var j=this.formname+a,k=this.theme.getFormInputField("radio");k.setAttribute("id",j),k.setAttribute("value",a),k.setAttribute("name",this.formname),h.appendChild(k),this.inputs.push(k);var l=document.createElement("label");l.setAttribute("for",j),l.appendChild(document.createTextNode(a+(1==a?" star":" stars"))),h.appendChild(l)}(this.schema.readOnly||this.schema.readonly)&&(this.always_disabled=!0,f(this.inputs,function(a,b){h.setAttribute("readOnly","readOnly"),b.disabled=!0})),g.addEventListener("change",function(a){a.preventDefault(),a.stopPropagation(),b.input.value=a.srcElement.value,b.is_dirty=!0,b.refreshValue(),b.watch_listener(),b.jsoneditor.notifyWatchers(b.path),b.parent?b.parent.onChildEditorChange(b):b.jsoneditor.onChange()}),this.control=this.theme.getFormControl(this.label,g,this.description),this.container.appendChild(this.control),this.refreshValue()},setValue:function(a){var b=this.sanitize(a);if(this.value!==b){var c=this;f(this.inputs,function(a,d){if(d.value===b)return d.checked=!0,c.value=b,c.input.value=c.value,c.watch_listener(),c.jsoneditor.notifyWatchers(c.path),!1})}}}),h.defaults.editors.object=h.AbstractEditor.extend({getDefault:function(){return e({},this.schema["default"]||{})},getChildEditors:function(){return this.editors},register:function(){if(this._super(),this.editors)for(var a in this.editors)this.editors.hasOwnProperty(a)&&this.editors[a].register()},unregister:function(){if(this._super(),this.editors)for(var a in this.editors)this.editors.hasOwnProperty(a)&&this.editors[a].unregister()},getNumColumns:function(){return Math.max(Math.min(12,this.maxwidth),3)},enable:function(){if(!this.always_disabled&&(this.editjson_button&&(this.editjson_button.disabled=!1),this.addproperty_button&&(this.addproperty_button.disabled=!1),this._super(),this.editors))for(var a in this.editors)this.editors.hasOwnProperty(a)&&this.editors[a].enable()},disable:function(a){if(a&&(this.always_disabled=!0),this.editjson_button&&(this.editjson_button.disabled=!0),this.addproperty_button&&(this.addproperty_button.disabled=!0),this.hideEditJSON(),this._super(),this.editors)for(var b in this.editors)this.editors.hasOwnProperty(b)&&this.editors[b].disable(a)},layoutEditors:function(){var a,b,c=this;if(this.row_container){this.property_order=Object.keys(this.editors),this.property_order=this.property_order.sort(function(a,b){var d=c.editors[a].schema.propertyOrder,e=c.editors[b].schema.propertyOrder;return"number"!=typeof d&&(d=1e3),"number"!=typeof e&&(e=1e3),d-e});var d,e="categories"===this.format;if("grid"===this.format){var h=[];for(f(this.property_order,function(a,b){var d=c.editors[b];if(!d.property_removed){for(var e=!1,f=d.options.hidden?0:d.options.grid_columns||d.getNumColumns(),g=d.options.hidden?0:d.container.offsetHeight,i=0;ig)&&(e=i);e===!1&&(h.push({width:0,minh:999999,maxh:0,editors:[]}),e=h.length-1),h[e].editors.push({key:b,width:f,height:g}),h[e].width+=f,h[e].minh=Math.min(h[e].minh,g),h[e].maxh=Math.max(h[e].maxh,g)}}),a=0;ah[a].editors[i].width&&(i=b),h[a].editors[b].width*=12/h[a].width,h[a].editors[b].width=Math.floor(h[a].editors[b].width),j+=h[a].editors[b].width;j<12&&(h[a].editors[i].width+=12-j),h[a].width=12}if(this.layout===JSON.stringify(h))return!1;for(this.layout=JSON.stringify(h),d=document.createElement("div"),a=0;a0?p.firstChild.isObjOrArray&&(e.appendChild(n),p.insertBefore(e,p.firstChild),c.theme.insertBasicTopTab(d.tab,o),d.basicPane=e):(e.appendChild(n),p.appendChild(e),c.theme.addTopTab(o,d.tab),d.basicPane=e)),d.options.hidden?d.container.style.display="none":c.theme.setGridColumnSize(d.container,12),g.appendChild(d.container),d.rowPane=e}});this.tabPanesContainer.firstChild;)this.tabPanesContainer.removeChild(this.tabPanesContainer.firstChild);var q=this.tabs_holder.parentNode;q.removeChild(q.firstChild),q.appendChild(o),this.tabPanesContainer=p,this.tabs_holder=o;var r=this.theme.getFirstTab(this.tabs_holder);return void(r&&g(r,"click"))}f(this.property_order,function(a,b){var e=c.editors[b];if(!e.property_removed){var f=c.theme.getGridRow();d.appendChild(f),e.options.hidden?e.container.style.display="none":c.theme.setGridColumnSize(e.container,12),f.appendChild(e.container)}})}for(;this.row_container.firstChild;)this.row_container.removeChild(this.row_container.firstChild);this.row_container.appendChild(d)}},getPropertySchema:function(a){var b=this.schema.properties[a]||{};b=e({},b);var c=!!this.schema.properties[a];if(this.schema.patternProperties)for(var d in this.schema.patternProperties)if(this.schema.patternProperties.hasOwnProperty(d)){var f=new RegExp(d);f.test(a)&&(b.allOf=b.allOf||[],b.allOf.push(this.schema.patternProperties[d]),c=!0)}return!c&&this.schema.additionalProperties&&"object"==typeof this.schema.additionalProperties&&(b=e({},this.schema.additionalProperties)),b},preBuild:function(){this._super(),this.editors={},this.cached_editors={};var a=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)f(this.schema.properties,function(b,c){var d=a.jsoneditor.getEditorClass(c);a.editors[b]=a.jsoneditor.createEditor(d,{jsoneditor:a.jsoneditor,schema:c,path:a.path+"."+b,parent:a,compact:!0,required:!0}),a.editors[b].preBuild();var e=a.editors[b].options.hidden?0:a.editors[b].options.grid_columns||a.editors[b].getNumColumns();a.minwidth+=e,a.maxwidth+=e}),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=[],f(this.schema.properties,function(b,c){a.isRequired({key:b,schema:c})&&a.schema.defaultProperties.push(b)})):a.schema.defaultProperties=Object.keys(a.schema.properties)),a.maxwidth+=1,f(this.schema.defaultProperties,function(b,c){a.addObjectProperty(c,!0),a.editors[c]&&(a.minwidth=Math.max(a.minwidth,a.editors[c].options.grid_columns||a.editors[c].getNumColumns()),a.maxwidth+=a.editors[c].options.grid_columns||a.editors[c].getNumColumns())})}this.property_order=Object.keys(this.editors),this.property_order=this.property_order.sort(function(b,c){var d=a.editors[b].schema.propertyOrder,e=a.editors[c].schema.propertyOrder;return"number"!=typeof d&&(d=1e3),"number"!=typeof e&&(e=1e3),d-e})},addTab:function(a){var b=this,c=b.rows[a].schema&&("object"===b.rows[a].schema.type||"array"===b.rows[a].schema.type);b.tabs_holder&&(b.rows[a].tab_text=document.createElement("span"),c?b.rows[a].tab_text.textContent=b.rows[a].getHeaderText():b.rows[a].tab_text.textContent="undefined"==typeof b.schema.basicCategoryTitle?"Basic":b.schema.basicCategoryTitle,b.rows[a].tab=b.theme.getTopTab(b.rows[a].tab_text,this.getValidId(b.rows[a].tab_text.textContent)),b.rows[a].tab.addEventListener("click",function(c){b.active_tab=b.rows[a].tab,b.refreshTabs(),c.preventDefault(),c.stopPropagation()}))},addRow:function(a,b,c){var d=this,e=this.rows.length,f="object"===a.schema.type||"array"===a.schema.type;d.rows[e]=a,d.rows[e].rowPane=c,f?(d.addTab(e),d.theme.addTopTab(b,d.rows[e].tab)):"undefined"==typeof d.basicTab?(d.addTab(e),d.basicTab=e,d.basicPane=c,d.theme.addTopTab(b,d.rows[e].tab)):(d.rows[e].tab=d.rows[d.basicTab].tab,d.rows[e].tab_text=d.rows[d.basicTab].tab_text,d.rows[e].rowPane=d.rows[d.basicTab].rowPane)},refreshTabs:function(a){var b=this,c="undefined"!=typeof b.basicTab,d=!1;f(this.rows,function(e,f){f.tab&&f.rowPane&&f.rowPane.parentNode&&(c&&f.tab==b.rows[b.basicTab].tab&&d||(a?f.tab_text.textContent=f.getHeaderText():(c&&f.tab==b.rows[b.basicTab].tab&&(d=!0),f.tab===b.active_tab?b.theme.markTabActive(f):b.theme.markTabInactive(f))))})},build:function(){var a=this,b="categories"===this.format;if(this.rows=[],this.active_tab=null,this.options.table_row)this.editor_holder=this.container,f(this.editors,function(b,c){var d=a.theme.getTableCell();a.editor_holder.appendChild(d),c.setContainer(d),c.build(),c.postBuild(),a.editors[b].options.hidden&&(d.style.display="none"),a.editors[b].options.input_width&&(d.style.width=a.editors[b].options.input_width)});else{if(this.options.table)throw"Not supported yet";this.header=document.createElement("span"),this.header.textContent=this.getTitle(),this.title=this.theme.getHeader(this.header),this.container.appendChild(this.title),this.container.style.position="relative",this.editjson_holder=this.theme.getModal(),this.editjson_textarea=this.theme.getTextareaInput(),this.editjson_textarea.style.height="170px",this.editjson_textarea.style.width="300px",this.editjson_textarea.style.display="block",this.editjson_save=this.getButton("Save","save","Save"),this.editjson_save.classList.add("json-editor-btntype-save"),this.editjson_save.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.saveJSON()}),this.editjson_copy=this.getButton("Copy","copy","Copy"),this.editjson_copy.classList.add("json-editor-btntype-copy"),this.editjson_copy.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.copyJSON()}),this.editjson_cancel=this.getButton("Cancel","cancel","Cancel"),this.editjson_cancel.classList.add("json-editor-btntype-cancel"),this.editjson_cancel.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.hideEditJSON()}),this.editjson_holder.appendChild(this.editjson_textarea),this.editjson_holder.appendChild(this.editjson_save),this.editjson_holder.appendChild(this.editjson_copy),this.editjson_holder.appendChild(this.editjson_cancel),this.addproperty_holder=this.theme.getModal(),this.addproperty_list=document.createElement("div"),this.addproperty_list.style.width="295px",this.addproperty_list.style.maxHeight="160px",this.addproperty_list.style.padding="5px 0",this.addproperty_list.style.overflowY="auto",this.addproperty_list.style.overflowX="hidden",this.addproperty_list.style.paddingLeft="5px",this.addproperty_list.setAttribute("class","property-selector"),this.addproperty_add=this.getButton("add","add","add"),this.addproperty_add.classList.add("json-editor-btntype-add"),this.addproperty_input=this.theme.getFormInputField("text"),this.addproperty_input.setAttribute("placeholder","Property name..."),this.addproperty_input.style.width="220px",this.addproperty_input.style.marginBottom="0",this.addproperty_input.style.display="inline-block",this.addproperty_add.addEventListener("click",function(b){if(b.preventDefault(),b.stopPropagation(),a.addproperty_input.value){if(a.editors[a.addproperty_input.value])return void window.alert("there is already a property with that name");a.addObjectProperty(a.addproperty_input.value),a.editors[a.addproperty_input.value]&&a.editors[a.addproperty_input.value].disable(),a.onChange(!0)}}),this.addproperty_holder.appendChild(this.addproperty_list),this.addproperty_holder.appendChild(this.addproperty_input),this.addproperty_holder.appendChild(this.addproperty_add);var c=document.createElement("div");c.style.clear="both",this.addproperty_holder.appendChild(c),document.addEventListener("click",function(a){!this.addproperty_holder.contains(a.target)&&this.adding_property&&(a.preventDefault(),a.stopPropagation(),this.toggleAddProperty())}.bind(this)),this.schema.description&&(this.description=this.theme.getDescription(this.schema.description),this.container.appendChild(this.description)),this.error_holder=document.createElement("div"),this.container.appendChild(this.error_holder),this.editor_holder=this.theme.getIndentedPanel(),this.container.appendChild(this.editor_holder),this.row_container=this.theme.getGridContainer(),b?(this.tabs_holder=this.theme.getTopTabHolder(this.getValidId(this.schema.title)),this.tabPanesContainer=this.theme.getTopTabContentHolder(this.tabs_holder),this.editor_holder.appendChild(this.tabs_holder)):(this.tabs_holder=this.theme.getTabHolder(this.getValidId(this.schema.title)),this.tabPanesContainer=this.theme.getTabContentHolder(this.tabs_holder),this.editor_holder.appendChild(this.row_container)),f(this.editors,function(c,d){var e=a.theme.getTabContent(),f=a.theme.getGridColumn(),g=!(!d.schema||"object"!==d.schema.type&&"array"!==d.schema.type);if(e.isObjOrArray=g,b){if(g){var h=a.theme.getGridContainer();h.appendChild(f),e.appendChild(h),a.tabPanesContainer.appendChild(e),a.row_container=h}else"undefined"==typeof a.row_container_basic&&(a.row_container_basic=a.theme.getGridContainer(),e.appendChild(a.row_container_basic),0==a.tabPanesContainer.childElementCount?a.tabPanesContainer.appendChild(e):a.tabPanesContainer.insertBefore(e,a.tabPanesContainer.childNodes[1])),a.row_container_basic.appendChild(f);a.addRow(d,a.tabs_holder,e),e.id=a.getValidId(d.schema.title)}else a.row_container.appendChild(f);d.setContainer(f),d.build(),d.postBuild()}),this.rows[0]&&g(this.rows[0].tab,"click"),this.title_controls=this.theme.getHeaderButtonHolder(),this.editjson_controls=this.theme.getHeaderButtonHolder(),this.addproperty_controls=this.theme.getHeaderButtonHolder(),this.title.appendChild(this.title_controls),this.title.appendChild(this.editjson_controls),this.title.appendChild(this.addproperty_controls),this.collapsed=!1,this.toggle_button=this.getButton("","collapse",this.translate("button_collapse")),this.toggle_button.classList.add("json-editor-btntype-toggle"),this.title_controls.appendChild(this.toggle_button),this.toggle_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.collapsed?(a.editor_holder.style.display="",a.collapsed=!1,a.setButtonText(a.toggle_button,"","collapse",a.translate("button_collapse"))):(a.editor_holder.style.display="none",a.collapsed=!0,a.setButtonText(a.toggle_button,"","expand",a.translate("button_expand")))}),this.options.collapsed&&g(this.toggle_button,"click"),this.schema.options&&"undefined"!=typeof this.schema.options.disable_collapse?this.schema.options.disable_collapse&&(this.toggle_button.style.display="none"):this.jsoneditor.options.disable_collapse&&(this.toggle_button.style.display="none"),this.editjson_button=this.getButton("JSON","edit","Edit JSON"),this.editjson_button.classList.add("json-editor-btntype-editjson"),this.editjson_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.toggleEditJSON()}),this.editjson_controls.appendChild(this.editjson_button),this.editjson_controls.appendChild(this.editjson_holder),this.schema.options&&"undefined"!=typeof this.schema.options.disable_edit_json?this.schema.options.disable_edit_json&&(this.editjson_button.style.display="none"):this.jsoneditor.options.disable_edit_json&&(this.editjson_button.style.display="none"),this.addproperty_button=this.getButton("Properties","edit","Object Properties"),this.addproperty_button.classList.add("json-editor-btntype-properties"),this.addproperty_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.toggleAddProperty()}),this.addproperty_controls.appendChild(this.addproperty_button),this.addproperty_controls.appendChild(this.addproperty_holder),this.refreshAddProperties()}this.options.table_row?(this.editor_holder=this.container,f(this.property_order,function(b,c){a.editor_holder.appendChild(a.editors[c].container)})):(this.layoutEditors(),this.layoutEditors())},showEditJSON:function(){this.editjson_holder&&(this.hideAddProperty(),this.editjson_holder.style.left=this.editjson_button.offsetLeft+"px",this.editjson_holder.style.top=this.editjson_button.offsetTop+this.editjson_button.offsetHeight+"px",this.editjson_textarea.value=JSON.stringify(this.getValue(),null,2),this.disable(),this.editjson_holder.style.display="",this.editjson_button.disabled=!1,this.editing_json=!0)},hideEditJSON:function(){this.editjson_holder&&this.editing_json&&(this.editjson_holder.style.display="none",this.enable(),this.editing_json=!1)},copyJSON:function(){if(this.editjson_holder){var a=document.createElement("textarea");a.value=this.editjson_textarea.value,a.setAttribute("readonly",""),a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)}},saveJSON:function(){if(this.editjson_holder)try{var a=JSON.parse(this.editjson_textarea.value);this.setValue(a),this.hideEditJSON(),this.onChange(!0)}catch(b){throw window.alert("invalid JSON"),b}},toggleEditJSON:function(){this.editing_json?this.hideEditJSON():this.showEditJSON()},insertPropertyControlUsingPropertyOrder:function(a,b,c){var d;this.schema.properties[a]&&(d=this.schema.properties[a].propertyOrder),"number"!=typeof d&&(d=1e3),b.propertyOrder=d;for(var e=0;e=this.schema.maxProperties),this.addproperty_checkboxes&&(this.addproperty_list.innerHTML=""),this.addproperty_checkboxes={};for(a in this.cached_editors)this.cached_editors.hasOwnProperty(a)&&(this.addPropertyCheckbox(a),this.isRequired(this.cached_editors[a])&&a in this.editors&&(this.addproperty_checkboxes[a].disabled=!0),"undefined"!=typeof this.schema.minProperties&&d<=this.schema.minProperties?(this.addproperty_checkboxes[a].disabled=this.addproperty_checkboxes[a].checked,this.addproperty_checkboxes[a].checked||(e=!0)):a in this.editors?(e=!0,c=!0):b||this.schema.properties.hasOwnProperty(a)?(this.addproperty_checkboxes[a].disabled=!1,e=!0):this.addproperty_checkboxes[a].disabled=!0);this.canHaveAdditionalProperties()&&(e=!0);for(a in this.schema.properties)this.schema.properties.hasOwnProperty(a)&&(this.cached_editors[a]||(e=!0,this.addPropertyCheckbox(a)));e?this.canHaveAdditionalProperties()?b?this.addproperty_add.disabled=!1:this.addproperty_add.disabled=!0:(this.addproperty_add.style.display="none",this.addproperty_input.style.display="none"):(this.hideAddProperty(),this.addproperty_controls.style.display="none")},isRequired:function(a){return"boolean"==typeof a.schema.required?a.schema.required:Array.isArray(this.schema.required)?this.schema.required.indexOf(a.key)>-1:!!this.jsoneditor.options.required_by_default},setValue:function(a,b){var c=this;a=a||{},("object"!=typeof a||Array.isArray(a))&&(a={}),f(this.cached_editors,function(d,e){"undefined"!=typeof a[d]?(c.addObjectProperty(d),e.setValue(a[d],b)):b||c.isRequired(e)?e.setValue(e.getDefault(),b):c.removeObjectProperty(d)}),f(a,function(a,d){c.cached_editors[a]||(c.addObjectProperty(a),c.editors[a]&&c.editors[a].setValue(d,b))}),this.refreshValue(),this.layoutEditors(),this.onChange()},showValidationErrors:function(a){var b=this,c=[],d=[];if(f(a,function(a,e){e.path===b.path?c.push(e):d.push(e)}),this.error_holder)if(c.length){this.error_holder.innerHTML="",this.error_holder.style.display="",f(c,function(a,c){b.error_holder.appendChild(b.theme.getErrorMessage(c.message))})}else this.error_holder.style.display="none";this.options.table_row&&(c.length?this.theme.addTableRowError(this.container):this.theme.removeTableRowError(this.container)),f(this.editors,function(a,b){b.showValidationErrors(d)})}}),h.defaults.editors.array=h.AbstractEditor.extend({askConfirmation:function(){return this.jsoneditor.options.prompt_before_delete!==!0||confirm("Are you sure you want to remove this node?")!==!1},getDefault:function(){return this.schema["default"]||[]},register:function(){if(this._super(),this.rows)for(var a=0;a=this.schema.items.length?this.schema.additionalItems===!0?{}:this.schema.additionalItems?e({},this.schema.additionalItems):void 0:e({},this.schema.items[a]):this.schema.items?e({},this.schema.items):{}},getItemInfo:function(a){var b=this.getItemSchema(a);this.item_info=this.item_info||{};var c=JSON.stringify(b);return"undefined"!=typeof this.item_info[c]?this.item_info[c]:(b=this.jsoneditor.expandRefs(b),this.item_info[c]={title:b.title||"item","default":b["default"],width:12,child_editors:b.properties||b.items},this.item_info[c])},getElementEditor:function(a){var b=this.getItemInfo(a),c=this.getItemSchema(a);c=this.jsoneditor.expandRefs(c),c.title=b.title+" "+(a+1);var d,e=this.jsoneditor.getEditorClass(c);this.tabs_holder?(d="tabs-top"===this.schema.format?this.theme.getTopTabContent():this.theme.getTabContent(),d.id=this.path+"."+a):d=b.child_editors?this.theme.getChildEditorHolder():this.theme.getIndentedPanel(),this.row_holder.appendChild(d);var f=this.jsoneditor.createEditor(e,{jsoneditor:this.jsoneditor,schema:c,container:d,path:this.path+"."+a,parent:this,required:!0});return f.preBuild(),f.build(),f.postBuild(),f.title_controls||(f.array_controls=this.theme.getButtonHolder(),d.appendChild(f.array_controls)),f},destroy:function(){this.empty(!0),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this.row_holder&&this.row_holder.parentNode&&this.row_holder.parentNode.removeChild(this.row_holder),this.controls&&this.controls.parentNode&&this.controls.parentNode.removeChild(this.controls),this.panel&&this.panel.parentNode&&this.panel.parentNode.removeChild(this.panel),this.rows=this.row_cache=this.title=this.description=this.row_holder=this.panel=this.controls=null,this._super()},empty:function(a){if(this.rows){var b=this;f(this.rows,function(c,d){a&&(d.tab&&d.tab.parentNode&&d.tab.parentNode.removeChild(d.tab),b.destroyRow(d,!0),b.row_cache[c]=null),b.rows[c]=null}),b.rows=[],a&&(b.row_cache=[])}},destroyRow:function(a,b){var c=a.container;b?(a.destroy(),c.parentNode&&c.parentNode.removeChild(c),a.tab&&a.tab.parentNode&&a.tab.parentNode.removeChild(a.tab)):(a.tab&&(a.tab.style.display="none"),c.style.display="none",a.unregister())},getMax:function(){return Array.isArray(this.schema.items)&&this.schema.additionalItems===!1?Math.min(this.schema.items.length,this.schema.maxItems||1/0):this.schema.maxItems||1/0},refreshTabs:function(a){var b=this;f(this.rows,function(c,d){d.tab&&(a?d.tab_text.textContent=d.getHeaderText():d.tab===b.active_tab?b.theme.markTabActive(d):b.theme.markTabInactive(d))})},setValue:function(a,b){a=a||[],Array.isArray(a)||(a=[a]);var c=JSON.stringify(a);if(c!==this.serialized){if(this.schema.minItems)for(;a.lengththis.getMax()&&(a=a.slice(0,this.getMax()));var d=this;f(a,function(a,c){d.rows[a]?d.rows[a].setValue(c,b):d.row_cache[a]?(d.rows[a]=d.row_cache[a],d.rows[a].setValue(c,b),d.rows[a].container.style.display="",d.rows[a].tab&&(d.rows[a].tab.style.display=""),d.rows[a].register()):d.addRow(c,b)});for(var e=a.length;e=this.rows.length;f(this.rows,function(a,c){c.movedown_button&&(a===b.rows.length-1?c.movedown_button.style.display="none":c.movedown_button.style.display=""),c.delete_button&&(d?c.delete_button.style.display="none":c.delete_button.style.display=""),b.value[a]=c.getValue()});var e=!1;this.value.length?1===this.value.length?(this.remove_all_rows_button.style.display="none",d||this.hide_delete_last_row_buttons?this.delete_last_row_button.style.display="none":(this.delete_last_row_button.style.display="",e=!0)):(d||this.hide_delete_last_row_buttons?this.delete_last_row_button.style.display="none":(this.delete_last_row_button.style.display="",e=!0),d||this.hide_delete_all_rows_buttons?this.remove_all_rows_button.style.display="none":(this.remove_all_rows_button.style.display="",e=!0)):(this.delete_last_row_button.style.display="none",this.remove_all_rows_button.style.display="none"),this.getMax()&&this.getMax()<=this.rows.length||this.hide_add_button?this.add_row_button.style.display="none":(this.add_row_button.style.display="",e=!0),!this.collapsed&&e?this.controls.style.display="inline-block":this.controls.style.display="none"}},addRow:function(a,b){var c=this,d=this.rows.length;c.rows[d]=this.getElementEditor(d),c.row_cache[d]=c.rows[d],c.tabs_holder&&(c.rows[d].tab_text=document.createElement("span"),c.rows[d].tab_text.textContent=c.rows[d].getHeaderText(),"tabs-top"===c.schema.format?(c.rows[d].tab=c.theme.getTopTab(c.rows[d].tab_text,this.getValidId(c.rows[d].path)),c.theme.addTopTab(c.tabs_holder,c.rows[d].tab)):(c.rows[d].tab=c.theme.getTab(c.rows[d].tab_text,this.getValidId(c.rows[d].path)),c.theme.addTab(c.tabs_holder,c.rows[d].tab)),c.rows[d].tab.addEventListener("click",function(a){c.active_tab=c.rows[d].tab,c.refreshTabs(),a.preventDefault(),a.stopPropagation()}));var e=c.rows[d].title_controls||c.rows[d].array_controls;c.hide_delete_buttons||(c.rows[d].delete_button=this.getButton(c.getItemTitle(),"delete",this.translate("button_delete_row_title",[c.getItemTitle()])),c.rows[d].delete_button.classList.add("delete","json-editor-btntype-delete"),c.rows[d].delete_button.setAttribute("data-i",d),c.rows[d].delete_button.addEventListener("click",function(a){if(a.preventDefault(),a.stopPropagation(),!c.askConfirmation())return!1;var b=1*this.getAttribute("data-i"),d=c.getValue(),e=[],g=null;f(d,function(a,c){a!==b&&e.push(c)}),c.empty(!0),c.setValue(e),c.rows[b]?g=c.rows[b].tab:c.rows[b-1]&&(g=c.rows[b-1].tab),g&&(c.active_tab=g,c.refreshTabs()),c.onChange(!0),c.jsoneditor.trigger("deleteRow")}),e&&e.appendChild(c.rows[d].delete_button)),c.show_copy_button&&(c.rows[d].copy_button=this.getButton(c.getItemTitle(),"copy","Copy "+c.getItemTitle()),c.rows[d].copy_button.classList.add("copy","json-editor-btntype-copy"),c.rows[d].copy_button.setAttribute("data-i",d),c.rows[d].copy_button.addEventListener("click",function(a){var b=c.getValue();a.preventDefault(),a.stopPropagation();var d=1*this.getAttribute("data-i");f(b,function(a,c){a===d&&b.push(c)}),c.setValue(b),c.refreshValue(!0),c.onChange(!0)}),e.appendChild(c.rows[d].copy_button)),d&&!c.hide_move_buttons&&(c.rows[d].moveup_button=this.getButton("","moveup",this.translate("button_move_up_title")),c.rows[d].moveup_button.classList.add("moveup","json-editor-btntype-move"),c.rows[d].moveup_button.setAttribute("data-i",d),c.rows[d].moveup_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var b=1*this.getAttribute("data-i");if(!(b<=0)){var d=c.getValue(),e=d[b-1];d[b-1]=d[b],d[b]=e,c.setValue(d),c.active_tab=c.rows[b-1].tab,c.refreshTabs(),c.onChange(!0),c.jsoneditor.trigger("moveRow")}}),e&&e.appendChild(c.rows[d].moveup_button)),c.hide_move_buttons||(c.rows[d].movedown_button=this.getButton("","movedown",this.translate("button_move_down_title")),c.rows[d].movedown_button.classList.add("movedown","json-editor-btntype-move"),c.rows[d].movedown_button.setAttribute("data-i",d),c.rows[d].movedown_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var b=1*this.getAttribute("data-i"),d=c.getValue();if(!(b>=d.length-1)){var e=d[b+1];d[b+1]=d[b],d[b]=e,c.setValue(d),c.active_tab=c.rows[b+1].tab,c.refreshTabs(),c.onChange(!0),c.jsoneditor.trigger("moveRow")}}),e&&e.appendChild(c.rows[d].movedown_button)),a&&c.rows[d].setValue(a,b),c.refreshTabs()},addControls:function(){var a=this;this.collapsed=!1,this.toggle_button=this.getButton("","collapse",this.translate("button_collapse")),this.toggle_button.classList.add("json-editor-btntype-toggle"),this.title_controls.appendChild(this.toggle_button);var b=a.row_holder.style.display,c=a.controls.style.display;this.toggle_button.addEventListener("click",function(d){d.preventDefault(),d.stopPropagation(),a.collapsed?(a.collapsed=!1,a.panel&&(a.panel.style.display=""),a.row_holder.style.display=b,a.tabs_holder&&(a.tabs_holder.style.display=""),a.controls.style.display=c,a.setButtonText(this,"","collapse",a.translate("button_collapse"))):(a.collapsed=!0,a.row_holder.style.display="none",a.tabs_holder&&(a.tabs_holder.style.display="none"),a.controls.style.display="none",a.panel&&(a.panel.style.display="none"),a.setButtonText(this,"","expand",a.translate("button_expand")))}),this.options.collapsed&&g(this.toggle_button,"click"),this.schema.options&&"undefined"!=typeof this.schema.options.disable_collapse?this.schema.options.disable_collapse&&(this.toggle_button.style.display="none"):this.jsoneditor.options.disable_collapse&&(this.toggle_button.style.display="none"),this.add_row_button=this.getButton(this.getItemTitle(),"add",this.translate("button_add_row_title",[this.getItemTitle()])),this.add_row_button.classList.add("json-editor-btntype-add"),this.add_row_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation();var c=a.rows.length;a.row_cache[c]?(a.rows[c]=a.row_cache[c],a.rows[c].setValue(a.rows[c].getDefault(),!0),a.rows[c].container.style.display="",a.rows[c].tab&&(a.rows[c].tab.style.display=""),a.rows[c].register()):a.addRow(),a.active_tab=a.rows[c].tab,a.refreshTabs(),a.refreshValue(),a.onChange(!0),a.jsoneditor.trigger("addRow")}),a.controls.appendChild(this.add_row_button),this.delete_last_row_button=this.getButton(this.translate("button_delete_last",[this.getItemTitle()]),"delete",this.translate("button_delete_last_title",[this.getItemTitle()])),this.delete_last_row_button.classList.add("json-editor-btntype-deletelast"),this.delete_last_row_button.addEventListener("click",function(b){if(b.preventDefault(),b.stopPropagation(),!a.askConfirmation())return!1;var c=a.getValue(),d=null;c.pop(),a.empty(!0),a.setValue(c),a.rows[a.rows.length-1]&&(d=a.rows[a.rows.length-1].tab),d&&(a.active_tab=d,a.refreshTabs()),a.onChange(!0),a.jsoneditor.trigger("deleteRow")}),a.controls.appendChild(this.delete_last_row_button),this.remove_all_rows_button=this.getButton(this.translate("button_delete_all"),"delete",this.translate("button_delete_all_title")),this.remove_all_rows_button.classList.add("json-editor-btntype-deleteall"),this.remove_all_rows_button.addEventListener("click",function(b){return b.preventDefault(),b.stopPropagation(),!!a.askConfirmation()&&(a.empty(!0),a.setValue([]),a.onChange(!0),void a.jsoneditor.trigger("deleteAllRows"))}),a.controls.appendChild(this.remove_all_rows_button),a.tabs&&(this.add_row_button.style.width="100%",this.add_row_button.style.textAlign="left",this.add_row_button.style.marginBottom="3px",this.delete_last_row_button.style.width="100%",this.delete_last_row_button.style.textAlign="left",this.delete_last_row_button.style.marginBottom="3px",this.remove_all_rows_button.style.width="100%",this.remove_all_rows_button.style.textAlign="left",this.remove_all_rows_button.style.marginBottom="3px")},showValidationErrors:function(a){var b=this,c=[],d=[];if(f(a,function(a,e){e.path===b.path?c.push(e):d.push(e)}),this.error_holder)if(c.length){this.error_holder.innerHTML="",this.error_holder.style.display="",f(c,function(a,c){b.error_holder.appendChild(b.theme.getErrorMessage(c.message))})}else this.error_holder.style.display="none";f(this.rows,function(a,b){b.showValidationErrors(d)})}}),h.defaults.editors.table=h.defaults.editors.array.extend({register:function(){if(this._super(),this.rows)for(var a=0;athis.schema.maxItems&&(a=a.slice(0,this.schema.maxItems));var c=JSON.stringify(a);if(c!==this.serialized){var d=!1,e=this;f(a,function(a,b){e.rows[a]?e.rows[a].setValue(b):(e.addRow(b),d=!0)});for(var g=a.length;g=this.rows.length,c=!1;f(this.rows,function(d,e){e.movedown_button&&(d===a.rows.length-1?e.movedown_button.style.display="none":(c=!0,e.movedown_button.style.display="")),e.delete_button&&(b?e.delete_button.style.display="none":(c=!0,e.delete_button.style.display="")),e.moveup_button&&(c=!0)}),f(this.rows,function(a,b){c?b.controls_cell.style.display="":b.controls_cell.style.display="none"}),c?this.controls_header_cell.style.display="":this.controls_header_cell.style.display="none";var d=!1;this.value.length?1===this.value.length?(this.table.style.display="",this.remove_all_rows_button.style.display="none",b||this.hide_delete_last_row_buttons?this.delete_last_row_button.style.display="none":(this.delete_last_row_button.style.display="",d=!0)):(this.table.style.display="",b||this.hide_delete_last_row_buttons?this.delete_last_row_button.style.display="none":(this.delete_last_row_button.style.display="",d=!0),b||this.hide_delete_all_rows_buttons?this.remove_all_rows_button.style.display="none":(this.remove_all_rows_button.style.display="",d=!0)):(this.delete_last_row_button.style.display="none",this.remove_all_rows_button.style.display="none",this.table.style.display="none"),this.schema.maxItems&&this.schema.maxItems<=this.rows.length||this.hide_add_button?this.add_row_button.style.display="none":(this.add_row_button.style.display="",d=!0),d?this.controls.style.display="":this.controls.style.display="none"},refreshValue:function(){var a=this;this.value=[],f(this.rows,function(b,c){a.value[b]=c.getValue()}),this.serialized=JSON.stringify(this.value)},addRow:function(a){var b=this,c=this.rows.length;b.rows[c]=this.getElementEditor(c);var d=b.rows[c].table_controls;this.hide_delete_buttons||(b.rows[c].delete_button=this.getButton("","delete",this.translate("button_delete_row_title_short")),b.rows[c].delete_button.classList.add("delete","json-editor-btntype-delete"),b.rows[c].delete_button.setAttribute("data-i",c),b.rows[c].delete_button.addEventListener("click",function(a){if(a.preventDefault(),a.stopPropagation(),!b.askConfirmation())return!1;var c=1*this.getAttribute("data-i"),d=b.getValue(),e=[];f(d,function(a,b){a!==c&&e.push(b)}),b.setValue(e),b.onChange(!0)}),d.appendChild(b.rows[c].delete_button)),c&&!this.hide_move_buttons&&(b.rows[c].moveup_button=this.getButton("","moveup",this.translate("button_move_up_title")),b.rows[c].moveup_button.classList.add("moveup","json-editor-btntype-move"),b.rows[c].moveup_button.setAttribute("data-i",c),b.rows[c].moveup_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var c=1*this.getAttribute("data-i");if(!(c<=0)){var d=b.getValue(),e=d[c-1];d[c-1]=d[c],d[c]=e,b.setValue(d),b.onChange(!0)}}),d.appendChild(b.rows[c].moveup_button)),this.hide_move_buttons||(b.rows[c].movedown_button=this.getButton("","movedown",this.translate("button_move_down_title")),b.rows[c].movedown_button.classList.add("movedown","json-editor-btntype-move"),b.rows[c].movedown_button.setAttribute("data-i",c),b.rows[c].movedown_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var c=1*this.getAttribute("data-i"),d=b.getValue();if(!(c>=d.length-1)){var e=d[c+1];d[c+1]=d[c],d[c]=e,b.setValue(d),b.onChange(!0)}}),d.appendChild(b.rows[c].movedown_button)),a&&b.rows[c].setValue(a)},addControls:function(){var a=this;this.collapsed=!1,this.toggle_button=this.getButton("","collapse",this.translate("button_collapse")),this.toggle_button.classList.add("json-editor-btntype-toggle"),this.title_controls&&(this.title_controls.appendChild(this.toggle_button),this.toggle_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.collapsed?(a.collapsed=!1,a.panel.style.display="",a.setButtonText(this,"","collapse",a.translate("button_collapse"))):(a.collapsed=!0,a.panel.style.display="none",a.setButtonText(this,"","expand",a.translate("button_expand")))}),this.options.collapsed&&g(this.toggle_button,"click"),this.schema.options&&"undefined"!=typeof this.schema.options.disable_collapse?this.schema.options.disable_collapse&&(this.toggle_button.style.display="none"):this.jsoneditor.options.disable_collapse&&(this.toggle_button.style.display="none")),this.add_row_button=this.getButton(this.getItemTitle(),"add",this.translate("button_add_row_title",[this.getItemTitle()])),this.add_row_button.classList.add("json-editor-btntype-add"),this.add_row_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.addRow(),a.refreshValue(),a.refreshRowButtons(),a.onChange(!0)}),a.controls.appendChild(this.add_row_button),this.delete_last_row_button=this.getButton(this.translate("button_delete_last",[this.getItemTitle()]),"delete",this.translate("button_delete_last_title",[this.getItemTitle()])),this.delete_last_row_button.classList.add("json-editor-btntype-deletelast"),this.delete_last_row_button.addEventListener("click",function(b){if(b.preventDefault(),b.stopPropagation(),!a.askConfirmation())return!1;var c=a.getValue();c.pop(),a.setValue(c),a.onChange(!0)}),a.controls.appendChild(this.delete_last_row_button),this.remove_all_rows_button=this.getButton(this.translate("button_delete_all"),"delete",this.translate("button_delete_all_title")), -this.remove_all_rows_button.classList.add("json-editor-btntype-deleteall"),this.remove_all_rows_button.addEventListener("click",function(b){return b.preventDefault(),b.stopPropagation(),!!a.askConfirmation()&&(a.setValue([]),void a.onChange(!0))}),a.controls.appendChild(this.remove_all_rows_button)}}),h.defaults.editors.multiple=h.AbstractEditor.extend({register:function(){if(this.editors){for(var a=0;anull";if("object"==typeof a){var c="";return f(a,function(d,e){var f=b.getHTML(e);Array.isArray(a)||(f="
"+d+": "+f+"
"),c+="
  • "+f+"
  • "}),c=Array.isArray(a)?"
      "+c+"
    ":"
      "+c+"
    "}return"boolean"==typeof a?a?"true":"false":"string"==typeof a?a.replace(/&/g,"&").replace(//g,">"):a},setValue:function(a){this.value!==a&&(this.value=a,this.refreshValue(),this.onChange())},destroy:function(){this.display_area&&this.display_area.parentNode&&this.display_area.parentNode.removeChild(this.display_area),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.switcher&&this.switcher.parentNode&&this.switcher.parentNode.removeChild(this.switcher),this._super()}}),h.defaults.editors.select=h.AbstractEditor.extend({setValue:function(a,b){a=this.typecast(a||"");var c=a;this.enum_values.indexOf(c)<0&&(c=this.enum_values[0]),this.value!==c&&(b?this.is_dirty=!1:"change"===this.jsoneditor.options.show_errors&&(this.is_dirty=!0),this.input.value=this.enum_options[this.enum_values.indexOf(c)],this.select2&&(this.select2v4?this.select2.val(this.input.value).trigger("change"):this.select2.select2("val",this.input.value)),this.value=c,this.onChange(),this.change())},register:function(){this._super(),this.input&&this.input.setAttribute("name",this.formname)},unregister:function(){this._super(),this.input&&this.input.removeAttribute("name")},getNumColumns:function(){if(!this.enum_options)return 3;for(var a=this.getTitle().length,b=0;b2||this.enum_options.length&&this.enumSource)){var a=e({},h.plugins.select2);this.schema.options&&this.schema.options.select2_options&&(a=e(a,this.schema.options.select2_options)),this.select2=window.jQuery(this.input).select2(a),this.select2v4=this.select2.select2.hasOwnProperty("amd");var b=this;this.select2.on("select2-blur",function(){b.select2v4?b.input.value=b.select2.val():b.input.value=b.select2.select2("val"),b.onInputChange()}),this.select2.on("change",function(){b.select2v4?b.input.value=b.select2.val():b.input.value=b.select2.select2("val"),b.onInputChange()})}else this.select2=null},postBuild:function(){this._super(),this.theme.afterInputReady(this.input),this.setupSelect2()},onWatchedFieldChange:function(){var a,b;if(this.enumSource){a=this.getWatchedFieldValues();for(var c=[],d=[],e=0;e=2||this.enum_options.length&&this.enumSource)){var c=e({},h.plugins.selectize);this.schema.options&&this.schema.options.selectize_options&&(c=e(c,this.schema.options.selectize_options)),this.selectize=window.jQuery(this.input).selectize(e(c,{create:c.create===b||c.create,onChange:function(){a.onInputChange()}}))}else this.selectize=null},postBuild:function(){this._super(),this.theme.afterInputReady(this.input),this.setupSelectize()},onWatchedFieldChange:function(){var a,c;if(this.enumSource){a=this.getWatchedFieldValues();for(var d=[],e=[],f=0;f1&&a.schema.options&&a.schema.options.multiple&&1==a.schema.options.multiple&&a.parent&&"object"==a.parent.schema.type&&a.parent.parent&&"array"==a.parent.parent.schema.type){a.arrayEditor=a.jsoneditor.getEditor(a.parent.parent.path),a.value=a.arrayEditor.getValue(),a.total=this.files.length,a.current_item_index=parseInt(a.parent.key),a.count=a.current_item_index;for(var c=0;cType: "+a+", Size: "+Math.floor((this.value.length-this.value.split(",")[0].length-1)/1.33333)+" bytes","image"===a.substr(0,5)){this.preview.innerHTML+="
    ";var b=document.createElement("img");b.style.maxWidth="100%",b.style.maxHeight="100px",b.src=this.value,this.preview.appendChild(b)}}else this.preview.innerHTML="Invalid data URI"}},enable:function(){this.always_disabled||(this.uploader&&(this.uploader.disabled=!1),this._super())},disable:function(a){a&&(this.always_disabled=!0),this.uploader&&(this.uploader.disabled=!0),this._super()},setValue:function(a){this.value!==a&&(this.value=a,this.input.value=this.value,this.refreshPreview(),this.onChange())},destroy:function(){this.preview&&this.preview.parentNode&&this.preview.parentNode.removeChild(this.preview),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this.uploader&&this.uploader.parentNode&&this.uploader.parentNode.removeChild(this.uploader),this._super()}}),h.defaults.editors.upload=h.AbstractEditor.extend({getNumColumns:function(){return 4},build:function(){var a=this;if(this.title=this.header=this.label=this.theme.getFormInputLabel(this.getTitle()),this.input=this.theme.getFormInputField("hidden"),this.container.appendChild(this.input),!this.schema.readOnly&&!this.schema.readonly){if(!this.jsoneditor.options.upload)throw"Upload handler required for upload editor";this.uploader=this.theme.getFormInputField("file"),this.uploader.addEventListener("change",function(b){if(b.preventDefault(),b.stopPropagation(),this.files&&this.files.length){var c=new FileReader;c.onload=function(b){a.preview_value=b.target.result,a.refreshPreview(),a.onChange(!0),c=null},c.readAsDataURL(this.files[0])}})}var b=this.schema.description;b||(b=""),this.preview=this.theme.getFormInputDescription(b),this.container.appendChild(this.preview),this.control=this.theme.getFormControl(this.label,this.uploader||this.input,this.preview),this.container.appendChild(this.control),window.requestAnimationFrame(function(){if(a.value){var b=document.createElement("img");b.style.maxWidth="100%",b.style.maxHeight="100px",b.onload=function(c){a.preview.appendChild(b)},b.onerror=function(a){console.error("upload error",a)},b.src=a.container.querySelector("a").href}})},refreshPreview:function(){if(this.last_preview!==this.preview_value&&(this.last_preview=this.preview_value,this.preview.innerHTML="",this.preview_value)){var a=this,b=this.preview_value.match(/^data:([^;,]+)[;,]/);b&&(b=b[1]),b||(b="unknown");var c=this.uploader.files[0];if(this.preview.innerHTML="Type: "+b+", Size: "+c.size+" bytes","image"===b.substr(0,5)){this.preview.innerHTML+="
    ";var d=document.createElement("img");d.style.maxWidth="100%",d.style.maxHeight="100px",d.src=this.preview_value,this.preview.appendChild(d)}this.preview.innerHTML+="
    ";var e=this.getButton("Upload","upload","Upload");this.preview.appendChild(e),e.addEventListener("click",function(b){b.preventDefault(),e.setAttribute("disabled","disabled"),a.theme.removeInputError(a.uploader),a.theme.getProgressBar&&(a.progressBar=a.theme.getProgressBar(),a.preview.appendChild(a.progressBar)),a.jsoneditor.options.upload(a.path,c,{success:function(b){a.setValue(b),a.parent?a.parent.onChildEditorChange(a):a.jsoneditor.onChange(), -a.progressBar&&a.preview.removeChild(a.progressBar),e.removeAttribute("disabled")},failure:function(b){a.theme.addInputError(a.uploader,b),a.progressBar&&a.preview.removeChild(a.progressBar),e.removeAttribute("disabled")},updateProgress:function(b){a.progressBar&&(b?a.theme.updateProgressBar(a.progressBar,b):a.theme.updateProgressBarUnknown(a.progressBar))}})}),(this.jsoneditor.options.auto_upload||this.schema.options.auto_upload)&&(e.dispatchEvent(new MouseEvent("click")),this.preview.removeChild(e))}},enable:function(){this.always_disabled||(this.uploader&&(this.uploader.disabled=!1),this._super())},disable:function(a){a&&(this.always_disabled=!0),this.uploader&&(this.uploader.disabled=!0),this._super()},setValue:function(a){this.value!==a&&(this.value=a,this.input.value=this.value,this.onChange())},destroy:function(){this.preview&&this.preview.parentNode&&this.preview.parentNode.removeChild(this.preview),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this.uploader&&this.uploader.parentNode&&this.uploader.parentNode.removeChild(this.uploader),this._super()}}),h.defaults.editors.checkbox=h.AbstractEditor.extend({setValue:function(a,b){this.value=!!a,this.input.checked=this.value,this.onChange()},register:function(){this._super(),this.input&&this.input.setAttribute("name",this.formname)},unregister:function(){this._super(),this.input&&this.input.removeAttribute("name")},getNumColumns:function(){return Math.min(12,Math.max(this.getTitle().length/7,2))},build:function(){var a=this;this.options.compact||(this.label=this.header=this.theme.getCheckboxLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description)),this.options.infoText&&(this.infoButton=this.theme.getInfoButton(this.options.infoText)),this.options.compact&&this.container.classList.add("compact"),this.input=this.theme.getCheckbox(),this.control=this.theme.getFormControl(this.label,this.input,this.description,this.infoButton),(this.schema.readOnly||this.schema.readonly)&&(this.always_disabled=!0,this.input.disabled=!0),this.input.addEventListener("change",function(b){b.preventDefault(),b.stopPropagation(),a.value=this.checked,a.onChange(!0)}),this.container.appendChild(this.control)},enable:function(){this.always_disabled||(this.input.disabled=!1,this._super())},disable:function(a){a&&(this.always_disabled=!0),this.input.disabled=!0,this._super()},destroy:function(){this.label&&this.label.parentNode&&this.label.parentNode.removeChild(this.label),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this._super()},showValidationErrors:function(a){var b=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 c=[];f(a,function(a,d){d.path===b.path&&c.push(d.message)}),this.input.controlgroup=this.control,c.length?this.theme.addInputError(this.input,c.join(". ")+"."):this.theme.removeInputError(this.input)}}),h.defaults.editors.arraySelectize=h.AbstractEditor.extend({build:function(){this.title=this.theme.getFormInputLabel(this.getTitle()),this.title_controls=this.theme.getHeaderButtonHolder(),this.title.appendChild(this.title_controls),this.error_holder=document.createElement("div"),this.schema.description&&(this.description=this.theme.getDescription(this.schema.description)),this.input=document.createElement("select"),this.input.setAttribute("multiple","multiple");var a=this.theme.getFormControl(this.title,this.input,this.description);this.container.appendChild(a),this.container.appendChild(this.error_holder),window.jQuery(this.input).selectize({delimiter:!1,createOnBlur:!0,create:!0})},postBuild:function(){var a=this;this.input.selectize.on("change",function(b){a.refreshValue(),a.onChange(!0)})},destroy:function(){this.empty(!0),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this._super()},empty:function(a){},setValue:function(a,b){var c=this;a=a||[],Array.isArray(a)||(a=[a]),this.input.selectize.clearOptions(),this.input.selectize.clear(!0),a.forEach(function(a){c.input.selectize.addOption({text:a,value:a})}),this.input.selectize.setValue(a),this.refreshValue(b)},refreshValue:function(a){this.value=this.input.selectize.getValue()},showValidationErrors:function(a){var b=this,c=[],d=[];if(f(a,function(a,e){e.path===b.path?c.push(e):d.push(e)}),this.error_holder)if(c.length){this.error_holder.innerHTML="",this.error_holder.style.display="",f(c,function(a,c){b.error_holder.appendChild(b.theme.getErrorMessage(c.message))})}else this.error_holder.style.display="none"}}),h.defaults.editors.starrating=h.defaults.editors.string.extend({build:function(){var a=this;this.options.compact||(this.header=this.label=this.theme.getFormInputLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description)),this.options.infoText&&(this.infoButton=this.theme.getInfoButton(this.options.infoText)),this.options.compact&&this.container.classList.add("compact"),this.ratingContainer=document.createElement("div"),this.ratingContainer.classList.add("starrating"),this.enum_values=this.schema["enum"],this.radioGroup=[];for(var b=function(b){b.preventDefault(),b.stopPropagation(),a.setValue(this.value),a.onChange(!0)},c=this.enum_values.length-1;c>-1;c--){var d=this.key+"-"+c,e=this.theme.getFormInputField("radio");e.name=this.formname+"[starrating]",e.value=this.enum_values[c],e.id=d,e.addEventListener("change",b,!1),this.radioGroup.push(e);var f=document.createElement("label");f.htmlFor=d,f.title=this.enum_values[c],this.options.displayValue&&f.classList.add("starrating-display-enabled"),this.ratingContainer.appendChild(e),this.ratingContainer.appendChild(f)}if(this.options.displayValue&&(this.displayRating=document.createElement("div"),this.displayRating.classList.add("starrating-display"),this.displayRating.innerText=this.enum_values[0],this.ratingContainer.appendChild(this.displayRating)),this.schema.readOnly||this.schema.readonly){this.always_disabled=!0;for(var g=0;c0){var d=new Date(1e3*a),e=d.getFullYear(),f=this.zeroPad(d.getMonth()+1),g=this.zeroPad(d.getDate()),h=this.zeroPad(d.getHours()),i=this.zeroPad(d.getMinutes()),j=this.zeroPad(d.getSeconds()),k=[e,f,g].join("-"),l=[h,i,j].join(":"),m=k+" "+l;"date"==this.schema.format?m=k:"time"==this.schema.format&&(m=l),this.input.value=m,this.flatpickr&&this.flatpickr.setDate(m)}},destroy:function(){this.flatpickr&&this.flatpickr.destroy(),this.flatpickr=null,this._super()},zeroPad:function(a){return("0"+a).slice(-2)}}),h.defaults.editors.signature=h.defaults.editors.string.extend({build:function(){var a=this;this.options.compact||(this.header=this.label=this.theme.getFormInputLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description));var b=this.formname.replace(/\W/g,"");if("function"==typeof SignaturePad){var c="json-editor-style-signature";document.getElementById(c);this.input=this.theme.getFormInputField("hidden"),this.container.appendChild(this.input);var d=document.createElement("div");d.classList.add("signature-container");var e=document.createElement("canvas");e.setAttribute("name",b),e.classList.add("signature"),d.appendChild(e),a.signaturePad=new window.SignaturePad(e,{onEnd:function(){a.signaturePad.isEmpty()?a.input.value="":a.input.value=a.signaturePad.toDataURL(),a.is_dirty=!0,a.refreshValue(),a.watch_listener(),a.jsoneditor.notifyWatchers(a.path),a.parent?a.parent.onChildEditorChange(a):a.jsoneditor.onChange()}});var g=document.createElement("div"),h=document.createElement("button");h.classList.add("tiny","button"),h.innerHTML="Clear signature",g.appendChild(h),d.appendChild(g),this.options.compact&&this.container.setAttribute("class",this.container.getAttribute("class")+" compact"),(this.schema.readOnly||this.schema.readonly)&&(this.always_disabled=!0,f(this.inputs,function(a,b){e.setAttribute("readOnly","readOnly"),b.disabled=!0})),h.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.signaturePad.clear(),a.signaturePad.strokeEnd()}),this.control=this.theme.getFormControl(this.label,d,this.description),this.container.appendChild(this.control),this.refreshValue(),e.width=d.offsetWidth,a.options&&a.options.canvas_height?e.height=a.options.canvas_height:e.height="300"}else{var i=document.createElement("p");i.innerHTML="Signature pad is not available, please include SignaturePad from https://github.com/szimek/signature_pad",this.container.appendChild(i)}},setValue:function(a){var b=this;if("function"==typeof SignaturePad){var c=(this.formname.replace(/\W/g,""),this.sanitize(a));if(this.value===c)return;return b.value=c,b.input.value=b.value,b.signaturePad.clear(),a&&""!=a&&b.signaturePad.fromDataURL(a),b.watch_listener(),b.jsoneditor.notifyWatchers(b.path),!1}},destroy:function(){var a=this;this.formname.replace(/\W/g,"");a.signaturePad.off(),delete a.signaturePad}});var i=function(){var a=document.documentElement;return a.matches?"matches":a.webkitMatchesSelector?"webkitMatchesSelector":a.mozMatchesSelector?"mozMatchesSelector":a.msMatchesSelector?"msMatchesSelector":a.oMatchesSelector?"oMatchesSelector":void 0}();return h.AbstractTheme=c.extend({getContainer:function(){return document.createElement("div")},getFloatRightLinkHolder:function(){var a=document.createElement("div");return a.style=a.style||{},a.style.cssFloat="right",a.style.marginLeft="10px",a},getModal:function(){var a=document.createElement("div");return a.style.backgroundColor="white",a.style.border="1px solid black",a.style.boxShadow="3px 3px black",a.style.position="absolute",a.style.zIndex="10",a.style.display="none",a},getGridContainer:function(){var a=document.createElement("div");return a},getGridRow:function(){var a=document.createElement("div");return a.classList.add("row"),a},getGridColumn:function(){var a=document.createElement("div");return a},setGridColumnSize:function(a,b){},getLink:function(a){var b=document.createElement("a");return b.setAttribute("href","#"),b.appendChild(document.createTextNode(a)),b},disableHeader:function(a){a.style.color="#ccc"},disableLabel:function(a){a.style.color="#ccc"},enableHeader:function(a){a.style.color=""},enableLabel:function(a){a.style.color=""},getInfoButton:function(a){var b=document.createElement("span");b.innerText="ⓘ",b.style.fontSize="16px",b.style.fontWeight="bold",b.style.padding=".25rem",b.style.position="relative",b.style.display="inline-block";var c=document.createElement("span");return c.style.fontSize="12px",b.style.fontWeight="normal",c.style["font-family"]="sans-serif",c.style.visibility="hidden",c.style["background-color"]="rgba(50, 50, 50, .75)",c.style.margin="0 .25rem",c.style.color="#FAFAFA",c.style.padding=".5rem 1rem",c.style["border-radius"]=".25rem",c.style.width="20rem",c.style.position="absolute",c.innerText=a,b.onmouseover=function(){c.style.visibility="visible"},b.onmouseleave=function(){c.style.visibility="hidden"},b.appendChild(c),b},getFormInputLabel:function(a){var b=document.createElement("label");return b.appendChild(document.createTextNode(a)),b},getCheckboxLabel:function(a){var b=this.getFormInputLabel(a);return b.style.fontWeight="normal",b},getHeader:function(a){var b=document.createElement("h3");return"string"==typeof a?b.textContent=a:b.appendChild(a),b},getCheckbox:function(){var a=this.getFormInputField("checkbox");return a.style.display="inline-block",a.style.width="auto",a},getMultiCheckboxHolder:function(a,b,c){var d=document.createElement("div");b&&(b.style.display="block",d.appendChild(b));for(var e in a)a.hasOwnProperty(e)&&(a[e].style.display="inline-block",a[e].style.marginRight="20px",d.appendChild(a[e]));return c&&d.appendChild(c),d},getSelectInput:function(a){var b=document.createElement("select");return a&&this.setSelectOptions(b,a),b},getSwitcher:function(a){var b=this.getSelectInput(a);return b.style.backgroundColor="transparent",b.style.display="inline-block",b.style.fontStyle="italic",b.style.fontWeight="normal",b.style.height="auto",b.style.marginBottom=0,b.style.marginLeft="5px",b.style.padding="0 0 0 3px",b.style.width="auto",b},getSwitcherOptions:function(a){return a.getElementsByTagName("option")},setSwitcherOptions:function(a,b,c){this.setSelectOptions(a,b,c)},setSelectOptions:function(a,b,c){c=c||[],a.innerHTML="";for(var d=0;d
    ",c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.innerHTML="
    ",c},applyStyles:function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a.style[c]=b[c])},closest:function(a,b){for(;a&&a!==document;){if(!a[i])return!1;if(a[i](b))return a;a=a.parentNode}return!1},insertBasicTopTab:function(a,b){b.firstChild.insertBefore(a,b.firstChild.firstChild)},getTab:function(a,b){var c=document.createElement("div");return c.appendChild(a),c.id=b,c.style=c.style||{},this.applyStyles(c,{border:"1px solid #ccc",borderWidth:"1px 0 1px 1px",textAlign:"center",lineHeight:"30px",borderRadius:"5px",borderBottomRightRadius:0,borderTopRightRadius:0,fontWeight:"bold",cursor:"pointer"}),c},getTopTab:function(a,b){var c=document.createElement("div");return c.id=b,c.appendChild(a),c.style=c.style||{},this.applyStyles(c,{"float":"left",border:"1px solid #ccc",borderWidth:"1px 1px 0px 1px",textAlign:"center",lineHeight:"30px",borderRadius:"5px",paddingLeft:"5px",paddingRight:"5px",borderBottomRightRadius:0,borderBottomLeftRadius:0,fontWeight:"bold",cursor:"pointer"}),c},getTabContentHolder:function(a){return a.children[1]},getTopTabContentHolder:function(a){return a.children[1]},getTabContent:function(){return this.getIndentedPanel()},getTopTabContent:function(){return this.getTopIndentedPanel()},markTabActive:function(a){this.applyStyles(a.tab,{opacity:1,background:"white"}),"undefined"!=typeof a.rowPane?a.rowPane.style.display="":a.container.style.display=""},markTabInactive:function(a){this.applyStyles(a.tab,{opacity:.5,background:""}),"undefined"!=typeof a.rowPane?a.rowPane.style.display="none":a.container.style.display="none"},addTab:function(a,b){a.children[0].appendChild(b)},addTopTab:function(a,b){a.children[0].appendChild(b)},getBlockLink:function(){var a=document.createElement("a");return a.style.display="block",a},getBlockLinkHolder:function(){var a=document.createElement("div");return a},getLinksHolder:function(){var a=document.createElement("div");return a},createMediaLink:function(a,b,c){a.appendChild(b),c.style.width="100%",a.appendChild(c)},createImageLink:function(a,b,c){a.appendChild(b),b.appendChild(c)},getFirstTab:function(a){return a.firstChild.firstChild},getInputGroup:function(a,c){return b}}),h.defaults.themes.bootstrap2=h.AbstractTheme.extend({getRangeInput:function(a,b,c){return this._super(a,b,c)},getGridContainer:function(){var a=document.createElement("div");return a.classList.add("container-fluid"),a},getGridRow:function(){var a=document.createElement("div");return a.classList.add("row-fluid"),a},getFormInputLabel:function(a){var b=this._super(a);return b.style.display="inline-block",b.style.fontWeight="bold",b},setGridColumnSize:function(a,b){a.classList.add("span"+b)},getSelectInput:function(a){var b=this._super(a);return b.style.width="auto",b.style.maxWidth="98%",b},getFormInputField:function(a){var b=this._super(a);return b.style.width="98%",b},afterInputReady:function(a){if(!a.controlgroup&&(a.controlgroup=this.closest(a,".control-group"),a.controls=this.closest(a,".controls"),this.closest(a,".compact")&&(a.controlgroup.className=a.controlgroup.className.replace(/control-group/g,"").replace(/[ ]{2,}/g," "),a.controls.className=a.controlgroup.className.replace(/controls/g,"").replace(/[ ]{2,}/g," "),a.style.marginBottom=0),this.queuedInputErrorText)){var b=this.queuedInputErrorText;delete this.queuedInputErrorText,this.addInputError(a,b)}},getIndentedPanel:function(){var a=document.createElement("div");return a.classList.add("well","well-small"),a.style.paddingBottom=0,a},getInfoButton:function(a){var b=document.createElement("span");b.classList.add("icon-info-sign","pull-right"),b.style.padding=".25rem",b.style.position="relative",b.style.display="inline-block";var c=document.createElement("span");return c.style["font-family"]="sans-serif",c.style.visibility="hidden",c.style["background-color"]="rgba(50, 50, 50, .75)",c.style.margin="0 .25rem",c.style.color="#FAFAFA",c.style.padding=".5rem 1rem",c.style["border-radius"]=".25rem",c.style.width="25rem",c.style.transform="translateX(-27rem) translateY(-.5rem)",c.style.position="absolute",c.innerText=a,b.onmouseover=function(){c.style.visibility="visible"},b.onmouseleave=function(){c.style.visibility="hidden"},b.appendChild(c),b},getFormInputDescription:function(a){var b=document.createElement("p");return b.classList.add("help-inline"),b.textContent=a,b},getFormControl:function(a,b,c,d){var e=document.createElement("div");e.classList.add("control-group");var f=document.createElement("div");return f.classList.add("controls"),a&&"checkbox"===b.getAttribute("type")?(e.appendChild(f),a.classList.add("checkbox"),a.appendChild(b),f.appendChild(a),d&&f.appendChild(d),f.style.height="30px"):(a&&(a.classList.add("control-label"),e.appendChild(a)),d&&f.appendChild(d),f.appendChild(b),e.appendChild(f)),c&&f.appendChild(c),e},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a.style.marginLeft="10px",a},getButtonHolder:function(){var a=document.createElement("div");return a.classList.add("btn-group"),a},getButton:function(a,b,c){var d=this._super(a,b,c);return d.classList.add("btn","btn-default"),d},getTable:function(){var a=document.createElement("table");return a.classList.add("table","table-bordered"),a.style.width="auto",a.style.maxWidth="none",a},addInputError:function(a,b){return a.controlgroup?void(a.controlgroup&&a.controls&&(a.controlgroup.classList.add("error"),a.errmsg?a.errmsg.style.display="":(a.errmsg=document.createElement("p"),a.errmsg.classList.add("help-block","errormsg"),a.controls.appendChild(a.errmsg)),a.errmsg.textContent=b)):void(this.queuedInputErrorText=b)},removeInputError:function(a){a.controlgroup||delete this.queuedInputErrorText,a.errmsg&&(a.errmsg.style.display="none",a.controlgroup.classList.remove("error"))},getTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("tabbable","tabs-left"),c.innerHTML="
    ",c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("tabbable","tabs-over"),c.innerHTML="
    ",c},getTab:function(a,b){var c=document.createElement("li");c.classList.add("nav-item");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("li");c.classList.add("nav-item");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTabContentHolder:function(a){return a.children[1]},getTopTabContentHolder:function(a){return a.children[1]},getTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a},markTabActive:function(a){a.tab.classList.add("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.add("active"):a.container.classList.add("active")},markTabInactive:function(a){a.tab.classList.remove("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.remove("active"):a.container.classList.remove("active")},addTab:function(a,b){a.children[0].appendChild(b)},addTopTab:function(a,b){a.children[0].appendChild(b)},getProgressBar:function(){var a=document.createElement("div");a.classList.add("progress");var b=document.createElement("div");return b.classList.add("bar"),b.style.width="0%",a.appendChild(b),a},updateProgressBar:function(a,b){a&&(a.firstChild.style.width=b+"%")},updateProgressBarUnknown:function(a){a&&(a.classList.add("progress","progress-striped","active"),a.firstChild.style.width="100%")},getInputGroup:function(a,b){if(a){var c=document.createElement("div");c.classList.add("input-append"),c.appendChild(a);for(var d=0;d
    ",c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.innerHTML="
    ",c},getTab:function(a,b){var c=document.createElement("li");c.setAttribute("role","presentation");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),d.setAttribute("aria-controls",b),d.setAttribute("role","tab"),d.setAttribute("data-toggle","tab"),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("li");c.setAttribute("role","presentation");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),d.setAttribute("aria-controls",b),d.setAttribute("role","tab"),d.setAttribute("data-toggle","tab"),c.appendChild(d),c},getTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a.setAttribute("role","tabpanel"),a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a.setAttribute("role","tabpanel"),a},markTabActive:function(a){a.tab.classList.add("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.add("active"):a.container.classList.add("active")},markTabInactive:function(a){a.tab.classList.remove("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.remove("active"):a.container.classList.remove("active")},getProgressBar:function(){var a=0,b=100,c=0,d=document.createElement("div");d.classList.add("progress");var e=document.createElement("div");return e.classList.add("progress-bar"),e.setAttribute("role","progressbar"),e.setAttribute("aria-valuenow",c), -e.setAttribute("aria-valuemin",a),e.setAttribute("aria-valuenax",b),e.innerHTML=c+"%",d.appendChild(e),d},updateProgressBar:function(a,b){if(a){var c=a.firstChild,d=b+"%";c.setAttribute("aria-valuenow",b),c.style.width=d,c.innerHTML=d}},updateProgressBarUnknown:function(a){if(a){var b=a.firstChild;a.classList.add("progress","progress-striped","active"),b.removeAttribute("aria-valuenow"),b.style.width="100%",b.innerHTML=""}},getInputGroup:function(a,b){if(a){var c=document.createElement("div");c.classList.add("input-group"),c.appendChild(a);var d=document.createElement("div");d.classList.add("input-group-btn"),c.appendChild(d);for(var e=0;e
    ",b.classList.add("row"),b},addTab:function(a,b){a.children[0].children[0].appendChild(b)},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.innerHTML="
    ",c},getTab:function(a,b){var c=document.createElement("li");c.classList.add("nav-item");var d=document.createElement("a");return d.classList.add("nav-link"),d.setAttribute("style","padding:10px;"),d.setAttribute("href","#"+b),d.setAttribute("data-toggle","tab"),d.appendChild(a),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("li");c.classList.add("nav-item");var d=document.createElement("a");return d.classList.add("nav-link"),d.setAttribute("href","#"+b),d.setAttribute("data-toggle","tab"),d.appendChild(a),c.appendChild(d),c},getTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a.setAttribute("role","tabpanel"),a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a.setAttribute("role","tabpanel"),a},markTabActive:function(a){a.tab.firstChild.classList.add("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.add("active"):a.container.classList.add("active")},markTabInactive:function(a){a.tab.firstChild.classList.remove("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.remove("active"):a.container.classList.remove("active")},getProgressBar:function(){var a=0,b=100,c=0,d=document.createElement("div");d.classList.add("progress");var e=document.createElement("div");return e.classList.add("progress-bar"),e.setAttribute("role","progressbar"),e.setAttribute("aria-valuenow",c),e.setAttribute("aria-valuemin",a),e.setAttribute("aria-valuenax",b),e.innerHTML=c+"%",d.appendChild(e),d},updateProgressBar:function(a,b){if(a){var c=a.firstChild,d=b+"%";c.setAttribute("aria-valuenow",b),c.style.width=d,c.innerHTML=d}},updateProgressBarUnknown:function(a){if(a){var b=a.firstChild;a.classList.add("progress","progress-striped","active"),b.removeAttribute("aria-valuenow"),b.style.width="100%",b.innerHTML=""}},getInputGroup:function(a,b){if(a){var c=document.createElement("div");c.classList.add("input-group"),c.appendChild(a);var d=document.createElement("div");d.classList.add("input-group-prepend"),c.appendChild(d);for(var e=0;e'),a.errmsg=a.parentNode.getElementsByClassName("error")[0]),void(a.errmsg.textContent=b)):void(this.queuedInputErrorText=b)},removeInputError:function(a){a.group||delete this.queuedInputErrorText,a.errmsg&&(a.group.classList.remove("error"),a.errmsg.style.display="none")},getProgressBar:function(){var a=document.createElement("div");a.classList.add("progress");var b=document.createElement("span");return b.classList.add("meter"),b.style.width="0%",a.appendChild(b),a},updateProgressBar:function(a,b){a&&(a.firstChild.style.width=b+"%")},updateProgressBarUnknown:function(a){a&&(a.firstChild.style.width="100%")},getInputGroup:function(a,c){if(!a)return b;var d=document.createElement("div");d.classList.add("input-group"),a.classList.add("input-group-field"),d.appendChild(a);for(var e=0;e
    ',c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("row"),c.innerHTML='
    ',c},setGridColumnSize:function(a,b){var c=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"];a.classList.add("columns",c[b])},getTab:function(a,b){var c=document.createElement("dd"),d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("dd"),d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTabContentHolder:function(a){return a.children[1]},getTopTabContentHolder:function(a){return a.children[1]},getTabContent:function(){var a=document.createElement("div");return a.classList.add("content","active"),a.style.paddingLeft="5px",a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("content","active"),a.style.paddingLeft="5px",a},markTabActive:function(a){a.tab.classList.add("active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="":a.container.style.display=""},markTabInactive:function(a){a.tab.classList.remove("active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="none":a.container.style.display="none"},addTab:function(a,b){a.children[0].appendChild(b)},addTopTab:function(a,b){a.children[0].appendChild(b)}}),h.defaults.themes.foundation4=h.defaults.themes.foundation.extend({getHeaderButtonHolder:function(){var a=this._super();return a.style.fontSize=".6em",a},setGridColumnSize:function(a,b){a.classList.add("columns","large-"+b)},getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8rem",b},getFormInputLabel:function(a){var b=this._super(a);return b.style.fontWeight="bold",b}}),h.defaults.themes.foundation5=h.defaults.themes.foundation.extend({getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8rem",b},setGridColumnSize:function(a,b){a.classList.add("columns","medium-"+b)},getButton:function(a,b,c){var d=this._super(a,b,c);return d.className=d.className.replace(/\s*small/g,"")+" tiny",d},getTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.innerHTML='
    ',c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("row"),c.innerHTML='
    ',c},getTab:function(a,b){var c=document.createElement("dd"),d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("dd"),d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTabContentHolder:function(a){return a.children[1]},getTopTabContentHolder:function(a){return a.children[1]},getTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-content","active"),a.style.paddingLeft="5px",a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-content","active"),a.style.paddingLeft="5px",a},markTabActive:function(a){a.tab.classList.add("active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="":a.container.style.display=""},markTabInactive:function(a){a.tab.classList.remove("active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="none":a.container.style.display="none"},addTab:function(a,b){a.children[0].appendChild(b)},addTopTab:function(a,b){a.children[0].appendChild(b)}}),h.defaults.themes.foundation6=h.defaults.themes.foundation5.extend({getIndentedPanel:function(){var a=document.createElement("div");return a.classList.add("callout","secondary"),a.style="padding-left: 10px; margin-left: 10px;",a},getButtonHolder:function(){var a=document.createElement("div");return a.classList.add("button-group","tiny"),a.style.marginBottom=0,a},getFormInputLabel:function(a){var b=this._super(a);return b.style.display="block",b},getFormControl:function(a,b,c,d){var e=document.createElement("div");return e.classList.add("form-control"),a&&e.appendChild(a),"checkbox"===b.type?a.insertBefore(b,a.firstChild):a?(d&&a.appendChild(d),a.appendChild(b)):(d&&e.appendChild(d),e.appendChild(b)),c&&a.appendChild(c),e},addInputError:function(a,b){if(a.group){if(a.group.classList.add("error"),a.errmsg)a.errmsg.style.display="",a.className="";else{var c=document.createElement("span");c.classList.add("form-error","is-visible"),a.group.getElementsByTagName("label")[0].appendChild(c),a.classList.add("is-invalid-input"),a.errmsg=c}a.errmsg.textContent=b}},removeInputError:function(a){a.errmsg&&(a.classList.remove("is-invalid-input"),a.errmsg.parentNode&&a.errmsg.parentNode.removeChild(a.errmsg))},getTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("grid-x"),c.innerHTML='
      ',c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("grid-y"),c.innerHTML='
        ',c},insertBasicTopTab:function(a,b){b.firstChild.firstChild.insertBefore(a,b.firstChild.firstChild.firstChild)},getTab:function(a,b){var c=document.createElement("li");c.classList.add("tabs-title");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("li");c.classList.add("tabs-title");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTabContentHolder:function(a){return a.children[1].firstChild},getTopTabContentHolder:function(a){return a.firstChild.children[1]},getTabContent:function(){var a=document.createElement("div");return a.classList.add("tabs-panel"),a.style.paddingLeft="5px",a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("tabs-panel"),a.style.paddingLeft="5px",a},markTabActive:function(a){a.tab.classList.add("is-active"),a.tab.firstChild.setAttribute("aria-selected","true"),"undefined"!=typeof a.rowPane?(a.rowPane.classList.add("is-active"),a.rowPane.setAttribute("aria-selected","true")):(a.container.classList.add("is-active"),a.container.setAttribute("aria-selected","true"))},markTabInactive:function(a){a.tab.classList.remove("is-active"),a.tab.firstChild.removeAttribute("aria-selected"),"undefined"!=typeof a.rowPane?(a.rowPane.classList.remove("is-active"),a.rowPane.removeAttribute("aria-selected")):(a.container.classList.remove("is-active"),a.container.removeAttribute("aria-selected"))},addTab:function(a,b){a.children[0].firstChild.appendChild(b)},addTopTab:function(a,b){a.firstChild.children[0].appendChild(b)},getFirstTab:function(a){return a.firstChild.firstChild.firstChild}}),h.defaults.themes.html=h.AbstractTheme.extend({getFormInputLabel:function(a){var b=this._super(a);return b.style.display="block",b.style.marginBottom="3px",b.style.fontWeight="bold",b},getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8em",b.style.margin=0,b.style.display="inline-block",b.style.fontStyle="italic",b},getIndentedPanel:function(){var a=this._super();return a.style.border="1px solid #ddd",a.style.padding="5px",a.style.margin="10px",a.style.borderRadius="3px",a},getTopIndentedPanel:function(){return this.getIndentedPanel()},getChildEditorHolder:function(){var a=this._super();return a.style.marginBottom="8px",a},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a.style.display="inline-block",a.style.marginLeft="10px",a.style.fontSize=".8em",a.style.verticalAlign="middle",a},getTable:function(){var a=this._super();return a.style.borderBottom="1px solid #ccc",a.style.marginBottom="5px",a},addInputError:function(a,b){if(a.style.borderColor="red",a.errmsg)a.errmsg.style.display="block";else{var c=this.closest(a,".form-control");a.errmsg=document.createElement("div"),a.errmsg.setAttribute("class","errmsg"),a.errmsg.style=a.errmsg.style||{},a.errmsg.style.color="red",c.appendChild(a.errmsg)}a.errmsg.innerHTML="",a.errmsg.appendChild(document.createTextNode(b))},removeInputError:function(a){a.style.borderColor="",a.errmsg&&(a.errmsg.style.display="none")},getProgressBar:function(){var a=100,b=0,c=document.createElement("progress");return c.setAttribute("max",a),c.setAttribute("value",b),c},updateProgressBar:function(a,b){a&&a.setAttribute("value",b)},updateProgressBarUnknown:function(a){a&&a.removeAttribute("value")}}),h.defaults.themes.jqueryui=h.AbstractTheme.extend({getTable:function(){var a=this._super();return a.setAttribute("cellpadding",5),a.setAttribute("cellspacing",0),a},getTableHeaderCell:function(a){var b=this._super(a);return b.classList.add("ui-state-active"),b.style.fontWeight="bold",b},getTableCell:function(){var a=this._super();return a.classList.add("ui-widget-content"),a},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a.style.marginLeft="10px",a.style.fontSize=".6em",a.style.display="inline-block",a},getFormInputDescription:function(a){var b=this.getDescription(a);return b.style.marginLeft="10px",b.style.display="inline-block",b},getFormControl:function(a,b,c,d){var e=this._super(a,b,c,d);return"checkbox"===b.type?(e.style.lineHeight="25px",e.style.padding="3px 0"):e.style.padding="4px 0 8px 0",e},getDescription:function(a){var b=document.createElement("span");return b.style.fontSize=".8em",b.style.fontStyle="italic",b.textContent=a,b},getButtonHolder:function(){var a=document.createElement("div");return a.classList.add("ui-buttonset"),a.style.fontSize=".7em",a},getFormInputLabel:function(a){var b=document.createElement("label");return b.style.fontWeight="bold",b.style.display="block",b.textContent=a,b},getButton:function(a,b,c){var d=document.createElement("button");d.classList.add("ui-button","ui-widget","ui-state-default","ui-corner-all"),b&&!a?(d.classList.add("ui-button-icon-only"),b.classList.add("ui-button-icon-primary","ui-icon-primary"),d.appendChild(b)):b?(d.classList.add("ui-button-text-icon-primary"),b.classList.add("ui-button-icon-primary","ui-icon-primary"),d.appendChild(b)):d.classList.add("ui-button-text-only");var e=document.createElement("span");return e.classList.add("ui-button-text"),e.textContent=a||c||".",d.appendChild(e),d.setAttribute("title",c),d},setButtonText:function(a,b,c,d){a.innerHTML="",a.classList.add("ui-button","ui-widget","ui-state-default","ui-corner-all"),c&&!b?(a.classList.add("ui-button-icon-only"),c.classList.add("ui-button-icon-primary","ui-icon-primary"),a.appendChild(c)):c?(a.classList.add("ui-button-text-icon-primary"),c.classList.add("ui-button-icon-primary","ui-icon-primary"),a.appendChild(c)):a.classList.add("ui-button-text-only");var e=document.createElement("span");e.classList.add("ui-button-text"),e.textContent=b||d||".",a.appendChild(e),a.setAttribute("title",d)},getIndentedPanel:function(){var a=document.createElement("div");return a.classList.add("ui-widget-content","ui-corner-all"),a.style.padding="1em 1.4em",a.style.marginBottom="20px",a},afterInputReady:function(a){if(!a.controls&&(a.controls=this.closest(a,".form-control"),this.queuedInputErrorText)){var b=this.queuedInputErrorText;delete this.queuedInputErrorText,this.addInputError(a,b)}},addInputError:function(a,b){return a.controls?(a.errmsg?a.errmsg.style.display="":(a.errmsg=document.createElement("div"),a.errmsg.classList.add("ui-state-error"),a.controls.appendChild(a.errmsg)),void(a.errmsg.textContent=b)):void(this.queuedInputErrorText=b)},removeInputError:function(a){a.controls||delete this.queuedInputErrorText,a.errmsg&&(a.errmsg.style.display="none")},markTabActive:function(a){a.tab.classList.remove("ui-widget-header"),a.tab.classList.add("ui-state-active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="":a.container.style.display=""},markTabInactive:function(a){a.tab.classList.add("ui-widget-header"),a.tab.classList.remove("ui-state-active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="none":a.container.style.display="none"}}),h.defaults.themes.barebones=h.AbstractTheme.extend({getFormInputLabel:function(a){var b=this._super(a);return b},getFormInputDescription:function(a){var b=this._super(a);return b},getIndentedPanel:function(){var a=this._super();return a},getChildEditorHolder:function(){var a=this._super();return a},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a},getTable:function(){var a=this._super();return a},addInputError:function(a,b){if(a.errmsg)a.errmsg.style.display="block";else{var c=this.closest(a,".form-control");a.errmsg=document.createElement("div"),a.errmsg.setAttribute("class","errmsg"),c.appendChild(a.errmsg)}a.errmsg.innerHTML="",a.errmsg.appendChild(document.createTextNode(b))},removeInputError:function(a){a.style.borderColor="",a.errmsg&&(a.errmsg.style.display="none")},getProgressBar:function(){var a=100,b=0,c=document.createElement("progress");return c.setAttribute("max",a),c.setAttribute("value",b),c},updateProgressBar:function(a,b){a&&a.setAttribute("value",b)},updateProgressBarUnknown:function(a){a&&a.removeAttribute("value")}}),h.defaults.themes.materialize=h.AbstractTheme.extend({setGridColumnSize:function(a,b){a.classList.add("col"),a.classList.add("s"+b)},getHeaderButtonHolder:function(){return this.getButtonHolder()},getButtonHolder:function(){return document.createElement("span")},getButton:function(a,b,c){a&&(b.classList.add("left"),b.style.marginRight="5px");var d=this._super(a,b,c);return d.classList.add("waves-effect","waves-light","btn"),d.style.fontSize="0.75rem",d.style.height="24px",d.style.lineHeight="24px",d.style.marginLeft="5px",d.style.padding="0 0.5rem",d},getFormControl:function(a,b,c,d){var e,f=b.type;if(f&&"checkbox"===f){if(e=document.createElement("p"),a){var g=document.createElement("span");g.innerHTML=a.innerHTML,a.innerHTML="",a.setAttribute("for",b.id),e.appendChild(a),a.appendChild(b),a.appendChild(g)}else e.appendChild(b);return e}return e=this._super(a,b,c,d),f&&f.startsWith("select")||e.classList.add("input-field"),f&&"color"===f&&(b.style.height="3rem",b.style.width="100%",b.style.margin="5px 0 20px 0",b.style.padding="3px",a&&(a.style.transform="translateY(-14px) scale(0.8)",a.style["-webkit-transform"]="translateY(-14px) scale(0.8)",a.style["-webkit-transform-origin"]="0 0",a.style["transform-origin"]="0 0")),e},getDescription:function(a){var b=document.createElement("div");return b.classList.add("grey-text"),b.style.marginTop="-15px",b.innerHTML=a,b},getHeader:function(a){var b=document.createElement("h5");return"string"==typeof a?b.textContent=a:b.appendChild(a),b},getChildEditorHolder:function(){var a=document.createElement("div");return a.marginBottom="10px",a},getIndentedPanel:function(){var a=document.createElement("div");return a.classList.add("card-panel"),a},getTable:function(){var a=document.createElement("table");return a.classList.add("striped","bordered"),a.style.marginBottom="10px",a},getTableRow:function(){return document.createElement("tr")},getTableHead:function(){return document.createElement("thead")},getTableBody:function(){return document.createElement("tbody")},getTableHeaderCell:function(a){var b=document.createElement("th");return b.textContent=a,b},getTableCell:function(){var a=document.createElement("td");return a},getTabHolder:function(){var a=['
        ','
          ',"
        ","
        ",'
        ',"
        "].join("\n"),b=document.createElement("div");return b.classList.add("row","card-panel"),b.innerHTML=a,b},addTab:function(a,b){a.children[0].children[0].appendChild(b)},getTab:function(a){var b=document.createElement("li");return b.classList.add("tab"),b.style=b.style||{},this.applyStyles(b,{width:"100%",textAlign:"left",lineHeight:"24px",height:"24px",fontSize:"14px",cursor:"pointer"}),b.appendChild(a),b},markTabActive:function(a){a.style=a.style||{},this.applyStyles(a,{width:"100%",textAlign:"left",lineHeight:"24px",height:"24px",fontSize:"14px",cursor:"pointer",color:"rgba(238,110,115,1)",transition:"border-color .5s ease",borderRight:"3px solid #424242"})},markTabInactive:function(a){a.style=a.style||{},this.applyStyles(a,{width:"100%",textAlign:"left",lineHeight:"24px",height:"24px",fontSize:"14px",cursor:"pointer",color:"rgba(238,110,115,0.7)"})},getTabContentHolder:function(a){return a.children[1]},getTabContent:function(){return document.createElement("div")},addInputError:function(a,b){var c,d=a.parentNode;d&&(this.removeInputError(a),c=document.createElement("div"),c.classList.add("error-text","red-text"),c.textContent=b,d.appendChild(c))},removeInputError:function(a){var b,c=a.parentElement;if(c){b=c.getElementsByClassName("error-text");for(var d=0;d1){var g;c=function(b){for(g=b,a=0;a=0){if(a.items["enum"])return"multiselect";if(h.plugins.selectize.enable&&"string"===a.items.type)return"arraySelectize"}}),h.defaults.resolvers.unshift(function(a){if(a.oneOf||a.anyOf)return"multiple"}),h.defaults.resolvers.unshift(function(a){if(["string","integer"].indexOf(a.type)!==-1&&["date","time","datetime-local"].indexOf(a.format)!==-1)return"datetime"}),h.defaults.resolvers.unshift(function(a){if("string"===a.type&&"starrating"===a.format)return"starrating"}),function(){if(window.jQuery||window.Zepto){var a=window.jQuery||window.Zepto;a.jsoneditor=h.defaults,a.fn.jsoneditor=function(a){var b=this,c=this.data("jsoneditor");if("value"===a){if(!c)throw"Must initialize jsoneditor before getting/setting the value";if(!(arguments.length>1))return c.getValue();c.setValue(arguments[1])}else{if("validate"===a){if(!c)throw"Must initialize jsoneditor before validating";return arguments.length>1?c.validate(arguments[1]):c.validate()}"destroy"===a?c&&(c.destroy(),this.data("jsoneditor",null)):(c&&c.destroy(),c=new h(this.get(0),a),this.data("jsoneditor",c),c.on("change",function(){b.trigger("change")}),c.on("ready",function(){b.trigger("ready")}))}return this}}}(),h}); -//# sourceMappingURL=jsoneditor.min.js.map \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/lib/jsoneditor.min.js b/src/main/resources/META-INF/resources/designer/lib/jsoneditor.min.js new file mode 100644 index 00000000..3d899050 --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/lib/jsoneditor.min.js @@ -0,0 +1,19 @@ +/** + * @name JSON Editor + * @description JSON Schema Based Editor + * This library is the continuation of jdorn's great work (see also https://github.com/jdorn/json-editor/issues/800) + * @version 1.3.5 + * @author Jeremy Dorn + * @see https://github.com/jdorn/json-editor/ + * @see https://github.com/json-editor/json-editor + * @license MIT + * @example see README.md and docs/ for requirements, examples and usage info + */ +!function(a,b){"use strict";var c=b(a);"object"==typeof module&&null!=module&&module.exports?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):a.JSONEditor=c}("undefined"!=typeof window?window:this,function(a,b){var c;!function(){var a=!1,b=/xyz/.test(function(){window.postMessage("xyz")})?/\b_super\b/:/.*/;return c=function(){},c.extend=function d(c){function e(){!a&&this.init&&this.init.apply(this,arguments)}var f=this.prototype;a=!0;var g=new this;a=!1;for(var h in c)g[h]="function"==typeof c[h]&&"function"==typeof f[h]&&b.test(c[h])?function(a,b){return function(){var c=this._super;this._super=f[a];var d=b.apply(this,arguments);return this._super=c,d}}(h,c[h]):c[h];return e.prototype=g,e.prototype.constructor=e,e.extend=d,e},c}(),function(){function a(a,c){c=c||{bubbles:!1,cancelable:!1,detail:b};var d=document.createEvent("CustomEvent");return d.initCustomEvent(a,c.bubbles,c.cancelable,c.detail),d}a.prototype=window.Event.prototype,window.CustomEvent=a}(),function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c0&&a.length-1 in a){for(c=0;c=i&&!j&&(j=!0,b())},c,k)}},f.send()}}),i||b()},expandRefs:function(a){for(a=e({},a);a.$ref;){var b=this.refs_with_info[a.$ref];delete a.$ref;var c="";b.$ref.startsWith("#")&&(c=b.fetchUrl);var d=c+b.$ref;this.refs[d]||(d=c+decodeURIComponent(b.$ref)),a=this.extendSchemas(a,e({},this.refs[d]))}return a},expandSchema:function(a,b){var c,d=this,g=e({},a);if("object"==typeof a.type&&(Array.isArray(a.type)?f(a.type,function(b,c){"object"==typeof c&&(a.type[b]=d.expandSchema(c))}):a.type=d.expandSchema(a.type)),"object"==typeof a.disallow&&(Array.isArray(a.disallow)?f(a.disallow,function(b,c){"object"==typeof c&&(a.disallow[b]=d.expandSchema(c))}):a.disallow=d.expandSchema(a.disallow)),a.anyOf&&f(a.anyOf,function(b,c){a.anyOf[b]=d.expandSchema(c)}),a.dependencies&&f(a.dependencies,function(b,c){"object"!=typeof c||Array.isArray(c)||(a.dependencies[b]=d.expandSchema(c))}),a.not&&(a.not=this.expandSchema(a.not)),a.allOf){for(c=0;ca.minimum:c>=a.minimum,window.math?g=window.math[a.exclusiveMinimum?"larger":"largerEq"](window.math.bignumber(c),window.math.bignumber(a.minimum)):window.Decimal&&(g=new window.Decimal(c)[a.exclusiveMinimum?"gt":"gte"](new window.Decimal(a.minimum))),g||l.push({path:d,property:"minimum",message:this.translate(a.exclusiveMinimum?"error_minimum_excl":"error_minimum_incl",[a.minimum])}))}else if("string"==typeof c)a.maxLength&&(c+"").length>a.maxLength&&l.push({path:d,property:"maxLength",message:this.translate("error_maxLength",[a.maxLength])}),a.minLength&&(c+"").lengtha.maxItems&&l.push({path:d,property:"maxItems",message:this.translate("error_maxItems",[a.maxItems])}),a.minItems&&c.lengtha.maxProperties&&l.push({path:d,property:"maxProperties",message:this.translate("error_maxProperties",[a.maxProperties])})}if(a.minProperties){g=0;for(i in c)c.hasOwnProperty(i)&&g++;g0:this.dependenciesFulfilled=!g||0===g.length):this.dependenciesFulfilled=!1,this.dependenciesFulfilled!==h&&this.notify(),this.dependenciesFulfilled?d.style.display="block":d.style.display="none"}},setContainer:function(a){this.container=a,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 a=this;if(this.watched={},this.schema.vars&&(this.schema.watch=this.schema.vars),this.watched_values={},this.watch_listener=function(){a.refreshWatchedFieldValues()&&a.onWatchedFieldChange()},this.schema.hasOwnProperty("watch")){var b,c,d,e,f;for(var g in this.schema.watch)if(this.schema.watch.hasOwnProperty(g)){if(b=this.schema.watch[g],Array.isArray(b)){if(b.length<2)continue;c=[b[0]].concat(b[1].split("."))}else c=b.split("."),a.theme.closest(a.container,'[data-schemaid="'+c[0]+'"]')||c.unshift("#");if(d=c.shift(),"#"===d&&(d=a.jsoneditor.schema.id||"root"),e=a.theme.closest(a.container,'[data-schemaid="'+d+'"]'),!e)throw"Could not find ancestor node with id "+d;f=e.getAttribute("data-schemapath")+"."+c.join("."),a.jsoneditor.watch(f,a.watch_listener),a.watched[g]=f}}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 a=0;a=0){b=this.theme.getBlockLinkHolder(),c=this.theme.getBlockLink(),c.setAttribute("target","_blank");var j=document.createElement(e);j.setAttribute("controls","controls"),this.theme.createMediaLink(b,c,j),this.link_watchers.push(function(a){var b=f(a),d=g(a);c.setAttribute("href",b),c.textContent=d||b,j.setAttribute("src",b)})}else c=b=this.theme.getBlockLink(),b.setAttribute("target","_blank"),b.textContent=a.rel,this.link_watchers.push(function(a){var c=f(a),d=g(a);b.setAttribute("href",c),b.textContent=d||c});return h&&c&&(h===!0?c.setAttribute("download",""):this.link_watchers.push(function(a){c.setAttribute("download",h(a))})),a["class"]&&c.classList.add(a["class"]),b},refreshWatchedFieldValues:function(){if(this.watched_values){var a={},b=!1,c=this;if(this.watched){var d,e;for(var f in this.watched)this.watched.hasOwnProperty(f)&&(e=c.jsoneditor.getEditor(this.watched[f]),d=e?e.getValue():null,c.watched_values[f]!==d&&(b=!0),a[f]=d)}return a.self=this.getValue(),this.watched_values.self!==a.self&&(b=!0),this.watched_values=a,b}},getWatchedFieldValues:function(){return this.watched_values},updateHeaderText:function(){if(this.header)if(this.header.children.length){for(var a=0;a-1:!!this.jsoneditor.options.required_by_default},getDisplayText:function(a){var b=[],c={};f(a,function(a,b){b.title&&(c[b.title]=c[b.title]||0,c[b.title]++),b.description&&(c[b.description]=c[b.description]||0,c[b.description]++),b.format&&(c[b.format]=c[b.format]||0,c[b.format]++),b.type&&(c[b.type]=c[b.type]||0,c[b.type]++)}),f(a,function(a,d){var e;e="string"==typeof d?d:d.title&&c[d.title]<=1?d.title:d.format&&c[d.format]<=1?d.format:d.type&&c[d.type]<=1?d.type:d.description&&c[d.description]<=1?d.descripton:d.title?d.title:d.format?d.format:d.type?d.type:d.description?d.description:JSON.stringify(d).length<500?JSON.stringify(d):"type",b.push(e)});var d={};return f(b,function(a,e){d[e]=d[e]||0,d[e]++,c[e]>1&&(b[a]=e+" "+d[e])}),b},getValidId:function(a){return a=a===b?"":a.toString(),a.replace(/\s+/g,"-")},setInputAttributes:function(a){if(this.schema.options&&this.schema.options.inputAttributes){var b=this.schema.options.inputAttributes,c=["name","type"].concat(a);for(var d in b)b.hasOwnProperty(d)&&c.indexOf(d.toLowerCase())==-1&&this.input.setAttribute(d,b[d])}},getOption:function(a){try{throw"getOption is deprecated"}catch(b){window.console.error(b)}return this.options[a]},showValidationErrors:function(a){}}),h.defaults.editors["null"]=h.AbstractEditor.extend({getValue:function(){return this.dependenciesFulfilled?null:b},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(a,b,c){if((!this.template||c)&&(null===a||"undefined"==typeof a?a="":"object"==typeof a?a=JSON.stringify(a):"string"!=typeof a&&(a=""+a), +a!==this.serialized)){var d=this.sanitize(a);if(this.input.value!==d){this.input.value=d,this.sceditor_instance?this.sceditor_instance.val(d):this.SimpleMDE?this.SimpleMDE.value(d):this.ace_editor&&(this.ace_editor.setValue(d),this.ace_editor.session.getSelection().clearSelection(),this.ace_editor.resize());var e=c||this.getValue()!==a;this.refreshValue(),b?this.is_dirty=!1:"change"===this.jsoneditor.options.show_errors&&(this.is_dirty=!0),this.adjust_height&&this.adjust_height(this.input),this.onChange(e)}}},getNumColumns:function(){var a,b=Math.ceil(Math.max(this.getTitle().length,this.schema.maxLength||0,this.schema.minLength||0)/5);return a="textarea"===this.input_type?6:["text","email"].indexOf(this.input_type)>=0?4:2,Math.min(12,Math.max(b,a))},build:function(){var a=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.options.infoText&&(this.infoButton=this.theme.getInfoButton(this.options.infoText)),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 b=this.schema.minimum||0,c=this.schema.maximum||Math.max(100,b+1),d=1;this.schema.multipleOf&&(b%this.schema.multipleOf&&(b=Math.ceil(b/this.schema.multipleOf)*this.schema.multipleOf),c%this.schema.multipleOf&&(c=Math.floor(c/this.schema.multipleOf)*this.schema.multipleOf),d=this.schema.multipleOf),this.input=this.theme.getRangeInput(b,c,d)}else["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","sqlserver","stylus","svg","twig","vbscript","xml","yaml"].indexOf(this.format)>=0?(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);if("undefined"!=typeof this.schema.maxLength&&this.input.setAttribute("maxlength",this.schema.maxLength),"undefined"!=typeof this.schema.pattern?this.input.setAttribute("pattern",this.schema.pattern):"undefined"!=typeof this.schema.minLength&&this.input.setAttribute("pattern",".{"+this.schema.minLength+",}"),this.options.compact?this.container.classList.add("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.setAttribute("readonly","true")),this.setInputAttributes(["maxlength","pattern","readonly","min","max","step"]),this.input.addEventListener("change",function(b){if(b.preventDefault(),b.stopPropagation(),a.schema.template)return void(this.value=a.value);var c=this.value,d=a.sanitize(c);c!==d&&(this.value=d),a.is_dirty=!0,a.refreshValue(),a.onChange(!0)}),this.options.input_height&&(this.input.style.height=this.options.input_height),this.options.expand_height&&(this.adjust_height=function(a){if(a){var b,c=a.offsetHeight;if(a.offsetHeight100);)b++,c++,a.style.height=c+"px";else{for(b=0;a.offsetHeight>=a.scrollHeight+3&&!(b>100);)b++,c--,a.style.height=c+"px";a.style.height=c+1+"px"}}},this.input.addEventListener("keyup",function(b){a.adjust_height(this)}),this.input.addEventListener("change",function(b){a.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.infoButton),"range"===this.format){var e=document.createElement("output");e.setAttribute("class","range-output"),this.control.appendChild(e),e.value=this.schema["default"],this.input.addEventListener("change",function(){e.value=a.input.value}),this.input.addEventListener("input",function(){e.value=a.input.value})}this.container.appendChild(this.control),window.requestAnimationFrame(function(){a.input.parentNode&&a.afterInputReady(),a.adjust_height&&a.adjust_height(a.input)}),this.schema.template?(this.template=this.jsoneditor.compileTemplate(this.schema.template,this.template_engine),this.refreshValue()):this.refreshValue()},postBuild:function(){this._super(),window.Cleave&&this.schema.options&&"object"==typeof this.schema.options.cleave&&(this.cleave=new window.Cleave(this.input,this.schema.options.cleave))},enable:function(){this.always_disabled||(this.input.disabled=!1,this._super())},disable:function(a){a&&(this.always_disabled=!0),this.input.disabled=!0,this._super()},afterInputReady:function(){var a,b=this;if(this.source_code)if(this.options.wysiwyg&&["html","bbcode"].indexOf(this.input_type)>=0&&window.jQuery&&window.jQuery.fn&&window.jQuery.fn.sceditor)a=e({},{plugins:"html"===b.input_type?"xhtml":"bbcode",emoticonsEnabled:!1,width:"100%",height:300},h.plugins.sceditor,b.options.sceditor_options||{}),window.jQuery(b.input).sceditor(a),b.sceditor_instance=window.jQuery(b.input).sceditor("instance"),b.sceditor_instance.blur(function(){var a=window.jQuery("
        "+b.sceditor_instance.val()+"
        ");window.jQuery("#sceditor-start-marker,#sceditor-end-marker,.sceditor-nlf",a).remove(),b.input.value=a.html(),b.value=b.input.value,b.is_dirty=!0,b.onChange(!0)});else if("markdown"===this.input_type&&window.SimpleMDE)a=e({},h.plugins.SimpleMDE,{element:this.input}),this.SimpleMDE=new window.SimpleMDE(a),this.SimpleMDE.codemirror.on("change",function(){b.value=b.SimpleMDE.value(),b.is_dirty=!0,b.onChange(!0)});else if(window.ace){var c=this.input_type;"cpp"!==c&&"c++"!==c&&"c"!==c||(c="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);var d=this.schema.options&&this.schema.options.ace;d&&this.ace_editor.setOptions(d),this.ace_editor.setValue(this.getValue()),this.ace_editor.session.getSelection().clearSelection(),this.ace_editor.resize(),h.plugins.ace.theme&&this.ace_editor.setTheme("ace/theme/"+h.plugins.ace.theme),this.ace_editor.getSession().setMode("ace/mode/"+this.schema.format),this.ace_editor.on("change",function(){var a=b.ace_editor.getValue();b.input.value=a,b.refreshValue(),b.is_dirty=!0,b.onChange(!0)})}b.theme.afterInputReady(b.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.SimpleMDE?(this.SimpleMDE.toTextArea(),this.SimpleMDE=null):this.ace_editor&&this.ace_editor.destroy(),this.cleave&&this.cleave.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(a){return a},onWatchedFieldChange:function(){var a;this.template&&(a=this.getWatchedFieldValues(),this.setValue(this.template(a),!1,!0)),this._super()},showValidationErrors:function(a){var b=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 c=[];f(a,function(a,d){d.path===b.path&&c.push(d.message)}),c.length?this.theme.addInputError(this.input,c.join(". ")+"."):this.theme.removeInputError(this.input)}}),h.defaults.editors.hidden=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(a,b,c){if((!this.template||c)&&(null===a||"undefined"==typeof a?a="":"object"==typeof a?a=JSON.stringify(a):"string"!=typeof a&&(a=""+a),a!==this.serialized)){var d=this.sanitize(a);if(this.input.value!==d){this.input.value=d;var e=c||this.getValue()!==a;this.refreshValue(),b?this.is_dirty=!1:"change"===this.jsoneditor.options.show_errors&&(this.is_dirty=!0),this.adjust_height&&this.adjust_height(this.input),this.onChange(e)}}},getNumColumns:function(){return 2},enable:function(){this._super()},disable:function(){this._super()},refreshValue:function(){this.value=this.input.value,"string"!=typeof this.value&&(this.value=""),this.serialized=this.value},destroy:function(){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(a){return a},onWatchedFieldChange:function(){var a;this.template&&(a=this.getWatchedFieldValues(),this.setValue(this.template(a),!1,!0)),this._super()},build:function(){this.format=this.schema.format,!this.format&&this.options.default_format&&(this.format=this.options.default_format),this.options.format&&(this.format=this.options.format),this.input_type="hidden",this.input=this.theme.getFormInputField(this.input_type),this.format&&this.input.setAttribute("data-schemaformat",this.format),this.container.appendChild(this.input),this.schema.template?(this.template=this.jsoneditor.compileTemplate(this.schema.template,this.template_engine),this.refreshValue()):this.refreshValue()}}),h.defaults.editors.number=h.defaults.editors.string.extend({build:function(){if(this._super(),"undefined"!=typeof this.schema.minimum){var a=this.schema.minimum;"undefined"!=typeof this.schema.exclusiveMinimum&&(a+=1),this.input.setAttribute("min",a)}if("undefined"!=typeof this.schema.maximum){var b=this.schema.maximum;"undefined"!=typeof this.schema.exclusiveMaximum&&(b-=1),this.input.setAttribute("max",b)}if("undefined"!=typeof this.schema.step){var c=this.schema.step||1;this.input.setAttribute("step",c)}this.setInputAttributes(["maxlength","pattern","readonly","min","max","step"])},sanitize:function(a){return(a+"").replace(/[^0-9\.\-eE]/g,"")},getNumColumns:function(){return 2},getValue:function(){return this.dependenciesFulfilled?""===this.value?b:1*this.value:b}}),h.defaults.editors.integer=h.defaults.editors.number.extend({sanitize:function(a){return a+="",a.replace(/[^0-9\-]/g,"")},getNumColumns:function(){return 2}}),h.defaults.editors.rating=h.defaults.editors.integer.extend({build:function(){var a,b=this;this.options.compact||(this.header=this.label=this.theme.getFormInputLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description));var c="json-editor-style-rating",d=document.getElementById(c);if(!d){var e=document.createElement("style");e.id=c,e.type="text/css",e.innerHTML=" .rating-container { display: inline-block; clear: both; } .rating { float:left; } /* :not(:checked) is a filter, so that browsers that don’t support :checked don’t follow these rules. Every browser that supports :checked also supports :not(), so it doesn’t make the test unnecessarily selective */ .rating:not(:checked) > input { position:absolute; top:-9999px; clip:rect(0,0,0,0); } .rating:not(:checked) > label { float:right; width:1em; padding:0 .1em; overflow:hidden; white-space:nowrap; cursor:pointer; color:#ddd; } .rating:not(:checked) > label:before { content: '★ '; } .rating > input:checked ~ label { color: #FFB200; } .rating:not([readOnly]):not(:checked) > label:hover, .rating:not([readOnly]):not(:checked) > label:hover ~ label { color: #FFDA00; } .rating:not([readOnly]) > input:checked + label:hover, .rating:not([readOnly]) > input:checked + label:hover ~ label, .rating:not([readOnly]) > input:checked ~ label:hover, .rating:not([readOnly]) > input:checked ~ label:hover ~ label, .rating:not([readOnly]) > label:hover ~ input:checked ~ label { color: #FF8C0D; } .rating:not([readOnly]) > label:active { position:relative; top:2px; left:2px; }",document.getElementsByTagName("head")[0].appendChild(e)}this.input=this.theme.getFormInputField("hidden"),this.container.appendChild(this.input);var g=document.createElement("div");g.classList.add("rating-container");var h=document.createElement("div");h.setAttribute("name",this.formname),h.classList.add("rating"),g.appendChild(h),this.options.compact&&this.container.setAttribute("class",this.container.getAttribute("class")+" compact");var i=this.schema.maximum?this.schema.maximum:5;for(this.schema.exclusiveMaximum&&i--,this.inputs=[],a=i;a>0;a--){var j=this.formname+a,k=this.theme.getFormInputField("radio");k.setAttribute("id",j),k.setAttribute("value",a),k.setAttribute("name",this.formname),h.appendChild(k),this.inputs.push(k);var l=document.createElement("label");l.setAttribute("for",j),l.appendChild(document.createTextNode(a+(1==a?" star":" stars"))),h.appendChild(l)}(this.schema.readOnly||this.schema.readonly)&&(this.always_disabled=!0,f(this.inputs,function(a,b){h.setAttribute("readOnly","readOnly"),b.disabled=!0})),g.addEventListener("change",function(a){a.preventDefault(),a.stopPropagation(),b.input.value=a.srcElement.value,b.is_dirty=!0,b.refreshValue(),b.watch_listener(),b.jsoneditor.notifyWatchers(b.path),b.parent?b.parent.onChildEditorChange(b):b.jsoneditor.onChange()}),this.control=this.theme.getFormControl(this.label,g,this.description),this.container.appendChild(this.control),this.refreshValue()},setValue:function(a){var b=this.sanitize(a);if(this.value!==b){var c=this;f(this.inputs,function(a,d){if(d.value===b)return d.checked=!0,c.value=b,c.input.value=c.value,c.watch_listener(),c.jsoneditor.notifyWatchers(c.path),!1})}}}),h.defaults.editors.object=h.AbstractEditor.extend({getDefault:function(){return e({},this.schema["default"]||{})},getChildEditors:function(){return this.editors},register:function(){if(this._super(),this.editors)for(var a in this.editors)this.editors.hasOwnProperty(a)&&this.editors[a].register()},unregister:function(){if(this._super(),this.editors)for(var a in this.editors)this.editors.hasOwnProperty(a)&&this.editors[a].unregister()},getNumColumns:function(){return Math.max(Math.min(12,this.maxwidth),3)},enable:function(){if(!this.always_disabled&&(this.editjson_button&&(this.editjson_button.disabled=!1),this.addproperty_button&&(this.addproperty_button.disabled=!1),this._super(),this.editors))for(var a in this.editors)this.editors.hasOwnProperty(a)&&this.editors[a].enable()},disable:function(a){if(a&&(this.always_disabled=!0),this.editjson_button&&(this.editjson_button.disabled=!0),this.addproperty_button&&(this.addproperty_button.disabled=!0),this.hideEditJSON(),this._super(),this.editors)for(var b in this.editors)this.editors.hasOwnProperty(b)&&this.editors[b].disable(a)},layoutEditors:function(){var a,b,c=this;if(this.row_container){this.property_order=Object.keys(this.editors),this.property_order=this.property_order.sort(function(a,b){var d=c.editors[a].schema.propertyOrder,e=c.editors[b].schema.propertyOrder;return"number"!=typeof d&&(d=1e3),"number"!=typeof e&&(e=1e3),d-e});var d,e="categories"===this.format;if("grid"===this.format){var h=[];for(f(this.property_order,function(a,b){var d=c.editors[b];if(!d.property_removed){for(var e=!1,f=d.options.hidden?0:d.options.grid_columns||d.getNumColumns(),g=d.options.hidden?0:d.container.offsetHeight,i=0;ig)&&(e=i);e===!1&&(h.push({width:0,minh:999999,maxh:0,editors:[]}),e=h.length-1),h[e].editors.push({key:b,width:f,height:g}),h[e].width+=f,h[e].minh=Math.min(h[e].minh,g),h[e].maxh=Math.max(h[e].maxh,g)}}),a=0;ah[a].editors[i].width&&(i=b),h[a].editors[b].width*=12/h[a].width,h[a].editors[b].width=Math.floor(h[a].editors[b].width),j+=h[a].editors[b].width;j<12&&(h[a].editors[i].width+=12-j),h[a].width=12}if(this.layout===JSON.stringify(h))return!1;for(this.layout=JSON.stringify(h),d=document.createElement("div"),a=0;a0?p.firstChild.isObjOrArray&&(e.appendChild(n),p.insertBefore(e,p.firstChild),c.theme.insertBasicTopTab(d.tab,o),d.basicPane=e):(e.appendChild(n),p.appendChild(e),c.theme.addTopTab(o,d.tab),d.basicPane=e)),d.options.hidden?d.container.style.display="none":c.theme.setGridColumnSize(d.container,12),g.appendChild(d.container),d.rowPane=e}});this.tabPanesContainer.firstChild;)this.tabPanesContainer.removeChild(this.tabPanesContainer.firstChild);var q=this.tabs_holder.parentNode;q.removeChild(q.firstChild),q.appendChild(o),this.tabPanesContainer=p,this.tabs_holder=o;var r=this.theme.getFirstTab(this.tabs_holder);return void(r&&g(r,"click"))}f(this.property_order,function(a,b){var e=c.editors[b];if(!e.property_removed){var f=c.theme.getGridRow();d.appendChild(f),e.options.hidden?e.container.style.display="none":c.theme.setGridColumnSize(e.container,12),f.appendChild(e.container)}})}for(;this.row_container.firstChild;)this.row_container.removeChild(this.row_container.firstChild);this.row_container.appendChild(d)}},getPropertySchema:function(a){var b=this.schema.properties[a]||{};b=e({},b);var c=!!this.schema.properties[a];if(this.schema.patternProperties)for(var d in this.schema.patternProperties)if(this.schema.patternProperties.hasOwnProperty(d)){var f=new RegExp(d);f.test(a)&&(b.allOf=b.allOf||[],b.allOf.push(this.schema.patternProperties[d]),c=!0)}return!c&&this.schema.additionalProperties&&"object"==typeof this.schema.additionalProperties&&(b=e({},this.schema.additionalProperties)),b},preBuild:function(){this._super(),this.editors={},this.cached_editors={};var a=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)f(this.schema.properties,function(b,c){var d=a.jsoneditor.getEditorClass(c);a.editors[b]=a.jsoneditor.createEditor(d,{jsoneditor:a.jsoneditor,schema:c,path:a.path+"."+b,parent:a,compact:!0,required:!0}),a.editors[b].preBuild();var e=a.editors[b].options.hidden?0:a.editors[b].options.grid_columns||a.editors[b].getNumColumns();a.minwidth+=e,a.maxwidth+=e}),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=[],f(this.schema.properties,function(b,c){a.isRequired({key:b,schema:c})&&a.schema.defaultProperties.push(b)})):a.schema.defaultProperties=Object.keys(a.schema.properties)),a.maxwidth+=1,f(this.schema.defaultProperties,function(b,c){a.addObjectProperty(c,!0),a.editors[c]&&(a.minwidth=Math.max(a.minwidth,a.editors[c].options.grid_columns||a.editors[c].getNumColumns()),a.maxwidth+=a.editors[c].options.grid_columns||a.editors[c].getNumColumns())})}this.property_order=Object.keys(this.editors),this.property_order=this.property_order.sort(function(b,c){var d=a.editors[b].schema.propertyOrder,e=a.editors[c].schema.propertyOrder;return"number"!=typeof d&&(d=1e3),"number"!=typeof e&&(e=1e3),d-e})},addTab:function(a){var b=this,c=b.rows[a].schema&&("object"===b.rows[a].schema.type||"array"===b.rows[a].schema.type);b.tabs_holder&&(b.rows[a].tab_text=document.createElement("span"),c?b.rows[a].tab_text.textContent=b.rows[a].getHeaderText():b.rows[a].tab_text.textContent="undefined"==typeof b.schema.basicCategoryTitle?"Basic":b.schema.basicCategoryTitle,b.rows[a].tab=b.theme.getTopTab(b.rows[a].tab_text,this.getValidId(b.rows[a].tab_text.textContent)),b.rows[a].tab.addEventListener("click",function(c){b.active_tab=b.rows[a].tab,b.refreshTabs(),c.preventDefault(),c.stopPropagation()}))},addRow:function(a,b,c){var d=this,e=this.rows.length,f="object"===a.schema.type||"array"===a.schema.type;d.rows[e]=a,d.rows[e].rowPane=c,f?(d.addTab(e),d.theme.addTopTab(b,d.rows[e].tab)):"undefined"==typeof d.basicTab?(d.addTab(e),d.basicTab=e,d.basicPane=c,d.theme.addTopTab(b,d.rows[e].tab)):(d.rows[e].tab=d.rows[d.basicTab].tab,d.rows[e].tab_text=d.rows[d.basicTab].tab_text,d.rows[e].rowPane=d.rows[d.basicTab].rowPane)},refreshTabs:function(a){var b=this,c="undefined"!=typeof b.basicTab,d=!1;f(this.rows,function(e,f){f.tab&&f.rowPane&&f.rowPane.parentNode&&(c&&f.tab==b.rows[b.basicTab].tab&&d||(a?f.tab_text.textContent=f.getHeaderText():(c&&f.tab==b.rows[b.basicTab].tab&&(d=!0),f.tab===b.active_tab?b.theme.markTabActive(f):b.theme.markTabInactive(f))))})},build:function(){var a=this,b="categories"===this.format;if(this.rows=[],this.active_tab=null,this.options.table_row)this.editor_holder=this.container,f(this.editors,function(b,c){var d=a.theme.getTableCell();a.editor_holder.appendChild(d),c.setContainer(d),c.build(),c.postBuild(),a.editors[b].options.hidden&&(d.style.display="none"),a.editors[b].options.input_width&&(d.style.width=a.editors[b].options.input_width)});else{if(this.options.table)throw"Not supported yet";this.header=document.createElement("span"),this.header.textContent=this.getTitle(),this.title=this.theme.getHeader(this.header),this.container.appendChild(this.title),this.container.style.position="relative",this.editjson_holder=this.theme.getModal(),this.editjson_textarea=this.theme.getTextareaInput(),this.editjson_textarea.style.height="170px",this.editjson_textarea.style.width="300px",this.editjson_textarea.style.display="block",this.editjson_save=this.getButton("Save","save","Save"),this.editjson_save.classList.add("json-editor-btntype-save"),this.editjson_save.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.saveJSON()}),this.editjson_copy=this.getButton("Copy","copy","Copy"),this.editjson_copy.classList.add("json-editor-btntype-copy"),this.editjson_copy.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.copyJSON()}),this.editjson_cancel=this.getButton("Cancel","cancel","Cancel"),this.editjson_cancel.classList.add("json-editor-btntype-cancel"),this.editjson_cancel.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.hideEditJSON()}),this.editjson_holder.appendChild(this.editjson_textarea),this.editjson_holder.appendChild(this.editjson_save),this.editjson_holder.appendChild(this.editjson_copy),this.editjson_holder.appendChild(this.editjson_cancel),this.addproperty_holder=this.theme.getModal(),this.addproperty_list=document.createElement("div"),this.addproperty_list.style.width="295px",this.addproperty_list.style.maxHeight="160px",this.addproperty_list.style.padding="5px 0",this.addproperty_list.style.overflowY="auto",this.addproperty_list.style.overflowX="hidden",this.addproperty_list.style.paddingLeft="5px",this.addproperty_list.setAttribute("class","property-selector"),this.addproperty_add=this.getButton("add","add","add"),this.addproperty_add.classList.add("json-editor-btntype-add"),this.addproperty_input=this.theme.getFormInputField("text"),this.addproperty_input.setAttribute("placeholder","Property name..."),this.addproperty_input.style.width="220px",this.addproperty_input.style.marginBottom="0",this.addproperty_input.style.display="inline-block",this.addproperty_add.addEventListener("click",function(b){if(b.preventDefault(),b.stopPropagation(),a.addproperty_input.value){if(a.editors[a.addproperty_input.value])return void window.alert("there is already a property with that name");a.addObjectProperty(a.addproperty_input.value),a.editors[a.addproperty_input.value]&&a.editors[a.addproperty_input.value].disable(),a.onChange(!0)}}),this.addproperty_holder.appendChild(this.addproperty_list),this.addproperty_holder.appendChild(this.addproperty_input),this.addproperty_holder.appendChild(this.addproperty_add);var c=document.createElement("div");c.style.clear="both",this.addproperty_holder.appendChild(c),document.addEventListener("click",function(a){!this.addproperty_holder.contains(a.target)&&this.adding_property&&(a.preventDefault(),a.stopPropagation(),this.toggleAddProperty())}.bind(this)),this.schema.description&&(this.description=this.theme.getDescription(this.schema.description),this.container.appendChild(this.description)),this.error_holder=document.createElement("div"),this.container.appendChild(this.error_holder),this.editor_holder=this.theme.getIndentedPanel(),this.container.appendChild(this.editor_holder),this.row_container=this.theme.getGridContainer(),b?(this.tabs_holder=this.theme.getTopTabHolder(this.getValidId(this.schema.title)),this.tabPanesContainer=this.theme.getTopTabContentHolder(this.tabs_holder),this.editor_holder.appendChild(this.tabs_holder)):(this.tabs_holder=this.theme.getTabHolder(this.getValidId(this.schema.title)),this.tabPanesContainer=this.theme.getTabContentHolder(this.tabs_holder),this.editor_holder.appendChild(this.row_container)),f(this.editors,function(c,d){var e=a.theme.getTabContent(),f=a.theme.getGridColumn(),g=!(!d.schema||"object"!==d.schema.type&&"array"!==d.schema.type);if(e.isObjOrArray=g,b){if(g){var h=a.theme.getGridContainer();h.appendChild(f),e.appendChild(h),a.tabPanesContainer.appendChild(e),a.row_container=h}else"undefined"==typeof a.row_container_basic&&(a.row_container_basic=a.theme.getGridContainer(),e.appendChild(a.row_container_basic),0==a.tabPanesContainer.childElementCount?a.tabPanesContainer.appendChild(e):a.tabPanesContainer.insertBefore(e,a.tabPanesContainer.childNodes[1])),a.row_container_basic.appendChild(f);a.addRow(d,a.tabs_holder,e),e.id=a.getValidId(d.schema.title)}else a.row_container.appendChild(f);d.setContainer(f),d.build(),d.postBuild()}),this.rows[0]&&g(this.rows[0].tab,"click"),this.title_controls=this.theme.getHeaderButtonHolder(),this.editjson_controls=this.theme.getHeaderButtonHolder(),this.addproperty_controls=this.theme.getHeaderButtonHolder(),this.title.appendChild(this.title_controls),this.title.appendChild(this.editjson_controls),this.title.appendChild(this.addproperty_controls),this.collapsed=!1,this.toggle_button=this.getButton("","collapse",this.translate("button_collapse")),this.toggle_button.classList.add("json-editor-btntype-toggle"),this.title_controls.appendChild(this.toggle_button),this.toggle_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.collapsed?(a.editor_holder.style.display="",a.collapsed=!1,a.setButtonText(a.toggle_button,"","collapse",a.translate("button_collapse"))):(a.editor_holder.style.display="none",a.collapsed=!0,a.setButtonText(a.toggle_button,"","expand",a.translate("button_expand")))}),this.options.collapsed&&g(this.toggle_button,"click"),this.schema.options&&"undefined"!=typeof this.schema.options.disable_collapse?this.schema.options.disable_collapse&&(this.toggle_button.style.display="none"):this.jsoneditor.options.disable_collapse&&(this.toggle_button.style.display="none"),this.editjson_button=this.getButton("JSON","edit","Edit JSON"),this.editjson_button.classList.add("json-editor-btntype-editjson"),this.editjson_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.toggleEditJSON()}),this.editjson_controls.appendChild(this.editjson_button),this.editjson_controls.appendChild(this.editjson_holder),this.schema.options&&"undefined"!=typeof this.schema.options.disable_edit_json?this.schema.options.disable_edit_json&&(this.editjson_button.style.display="none"):this.jsoneditor.options.disable_edit_json&&(this.editjson_button.style.display="none"),this.addproperty_button=this.getButton("Properties","edit","Object Properties"),this.addproperty_button.classList.add("json-editor-btntype-properties"),this.addproperty_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.toggleAddProperty()}),this.addproperty_controls.appendChild(this.addproperty_button),this.addproperty_controls.appendChild(this.addproperty_holder),this.refreshAddProperties()}this.options.table_row?(this.editor_holder=this.container,f(this.property_order,function(b,c){a.editor_holder.appendChild(a.editors[c].container)})):(this.layoutEditors(),this.layoutEditors())},showEditJSON:function(){this.editjson_holder&&(this.hideAddProperty(),this.editjson_holder.style.left=this.editjson_button.offsetLeft+"px",this.editjson_holder.style.top=this.editjson_button.offsetTop+this.editjson_button.offsetHeight+"px",this.editjson_textarea.value=JSON.stringify(this.getValue(),null,2),this.disable(),this.editjson_holder.style.display="",this.editjson_button.disabled=!1,this.editing_json=!0)},hideEditJSON:function(){this.editjson_holder&&this.editing_json&&(this.editjson_holder.style.display="none",this.enable(),this.editing_json=!1)},copyJSON:function(){if(this.editjson_holder){var a=document.createElement("textarea");a.value=this.editjson_textarea.value,a.setAttribute("readonly",""),a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)}},saveJSON:function(){if(this.editjson_holder)try{var a=JSON.parse(this.editjson_textarea.value);this.setValue(a),this.hideEditJSON(),this.onChange(!0)}catch(b){throw window.alert("invalid JSON"),b}},toggleEditJSON:function(){this.editing_json?this.hideEditJSON():this.showEditJSON()},insertPropertyControlUsingPropertyOrder:function(a,b,c){var d;this.schema.properties[a]&&(d=this.schema.properties[a].propertyOrder),"number"!=typeof d&&(d=1e3),b.propertyOrder=d;for(var e=0;e=this.schema.maxProperties),this.addproperty_checkboxes&&(this.addproperty_list.innerHTML=""),this.addproperty_checkboxes={};for(a in this.cached_editors)this.cached_editors.hasOwnProperty(a)&&(this.addPropertyCheckbox(a),this.isRequired(this.cached_editors[a])&&a in this.editors&&(this.addproperty_checkboxes[a].disabled=!0),"undefined"!=typeof this.schema.minProperties&&d<=this.schema.minProperties?(this.addproperty_checkboxes[a].disabled=this.addproperty_checkboxes[a].checked,this.addproperty_checkboxes[a].checked||(e=!0)):a in this.editors?(e=!0,c=!0):b||this.schema.properties.hasOwnProperty(a)?(this.addproperty_checkboxes[a].disabled=!1,e=!0):this.addproperty_checkboxes[a].disabled=!0);this.canHaveAdditionalProperties()&&(e=!0);for(a in this.schema.properties)this.schema.properties.hasOwnProperty(a)&&(this.cached_editors[a]||(e=!0,this.addPropertyCheckbox(a)));e?this.canHaveAdditionalProperties()?b?this.addproperty_add.disabled=!1:this.addproperty_add.disabled=!0:(this.addproperty_add.style.display="none",this.addproperty_input.style.display="none"):(this.hideAddProperty(),this.addproperty_controls.style.display="none")},isRequired:function(a){return"boolean"==typeof a.schema.required?a.schema.required:Array.isArray(this.schema.required)?this.schema.required.indexOf(a.key)>-1:!!this.jsoneditor.options.required_by_default},setValue:function(a,b){var c=this;a=a||{},("object"!=typeof a||Array.isArray(a))&&(a={}),f(this.cached_editors,function(d,e){"undefined"!=typeof a[d]?(c.addObjectProperty(d),e.setValue(a[d],b)):b||c.isRequired(e)?e.setValue(e.getDefault(),b):c.removeObjectProperty(d)}),f(a,function(a,d){c.cached_editors[a]||(c.addObjectProperty(a),c.editors[a]&&c.editors[a].setValue(d,b))}),this.refreshValue(),this.layoutEditors(),this.onChange()},showValidationErrors:function(a){var b=this,c=[],d=[];if(f(a,function(a,e){e.path===b.path?c.push(e):d.push(e)}),this.error_holder)if(c.length){this.error_holder.innerHTML="",this.error_holder.style.display="",f(c,function(a,c){b.error_holder.appendChild(b.theme.getErrorMessage(c.message))})}else this.error_holder.style.display="none";this.options.table_row&&(c.length?this.theme.addTableRowError(this.container):this.theme.removeTableRowError(this.container)),f(this.editors,function(a,b){b.showValidationErrors(d)})}}),h.defaults.editors.array=h.AbstractEditor.extend({askConfirmation:function(){return this.jsoneditor.options.prompt_before_delete!==!0||confirm("Are you sure you want to remove this node?")!==!1},getDefault:function(){return this.schema["default"]||[]},register:function(){if(this._super(),this.rows)for(var a=0;a=this.schema.items.length?this.schema.additionalItems===!0?{}:this.schema.additionalItems?e({},this.schema.additionalItems):void 0:e({},this.schema.items[a]):this.schema.items?e({},this.schema.items):{}},getItemInfo:function(a){var b=this.getItemSchema(a);this.item_info=this.item_info||{};var c=JSON.stringify(b);return"undefined"!=typeof this.item_info[c]?this.item_info[c]:(b=this.jsoneditor.expandRefs(b),this.item_info[c]={title:b.title||"item","default":b["default"],width:12,child_editors:b.properties||b.items},this.item_info[c])},getElementEditor:function(a){var b=this.getItemInfo(a),c=this.getItemSchema(a);c=this.jsoneditor.expandRefs(c),c.title=b.title+" "+(a+1);var d,e=this.jsoneditor.getEditorClass(c);this.tabs_holder?(d="tabs-top"===this.schema.format?this.theme.getTopTabContent():this.theme.getTabContent(),d.id=this.path+"."+a):d=b.child_editors?this.theme.getChildEditorHolder():this.theme.getIndentedPanel(),this.row_holder.appendChild(d);var f=this.jsoneditor.createEditor(e,{jsoneditor:this.jsoneditor,schema:c,container:d,path:this.path+"."+a,parent:this,required:!0});return f.preBuild(),f.build(),f.postBuild(),f.title_controls||(f.array_controls=this.theme.getButtonHolder(),d.appendChild(f.array_controls)),f},destroy:function(){this.empty(!0),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this.row_holder&&this.row_holder.parentNode&&this.row_holder.parentNode.removeChild(this.row_holder),this.controls&&this.controls.parentNode&&this.controls.parentNode.removeChild(this.controls),this.panel&&this.panel.parentNode&&this.panel.parentNode.removeChild(this.panel),this.rows=this.row_cache=this.title=this.description=this.row_holder=this.panel=this.controls=null,this._super()},empty:function(a){if(this.rows){var b=this;f(this.rows,function(c,d){a&&(d.tab&&d.tab.parentNode&&d.tab.parentNode.removeChild(d.tab),b.destroyRow(d,!0),b.row_cache[c]=null),b.rows[c]=null}),b.rows=[],a&&(b.row_cache=[])}},destroyRow:function(a,b){var c=a.container;b?(a.destroy(),c.parentNode&&c.parentNode.removeChild(c),a.tab&&a.tab.parentNode&&a.tab.parentNode.removeChild(a.tab)):(a.tab&&(a.tab.style.display="none"),c.style.display="none",a.unregister())},getMax:function(){return Array.isArray(this.schema.items)&&this.schema.additionalItems===!1?Math.min(this.schema.items.length,this.schema.maxItems||1/0):this.schema.maxItems||1/0},refreshTabs:function(a){var b=this;f(this.rows,function(c,d){d.tab&&(a?d.tab_text.textContent=d.getHeaderText():d.tab===b.active_tab?b.theme.markTabActive(d):b.theme.markTabInactive(d))})},setValue:function(a,b){a=a||[],Array.isArray(a)||(a=[a]);var c=JSON.stringify(a);if(c!==this.serialized){if(this.schema.minItems)for(;a.lengththis.getMax()&&(a=a.slice(0,this.getMax()));var d=this;f(a,function(a,c){d.rows[a]?d.rows[a].setValue(c,b):d.row_cache[a]?(d.rows[a]=d.row_cache[a],d.rows[a].setValue(c,b),d.rows[a].container.style.display="",d.rows[a].tab&&(d.rows[a].tab.style.display=""),d.rows[a].register()):d.addRow(c,b)});for(var e=a.length;e=this.rows.length;f(this.rows,function(a,c){c.movedown_button&&(a===b.rows.length-1?c.movedown_button.style.display="none":c.movedown_button.style.display=""),c.delete_button&&(d?c.delete_button.style.display="none":c.delete_button.style.display=""),b.value[a]=c.getValue()});var e=!1;this.value.length?1===this.value.length?(this.remove_all_rows_button.style.display="none",d||this.hide_delete_last_row_buttons?this.delete_last_row_button.style.display="none":(this.delete_last_row_button.style.display="",e=!0)):(d||this.hide_delete_last_row_buttons?this.delete_last_row_button.style.display="none":(this.delete_last_row_button.style.display="",e=!0),d||this.hide_delete_all_rows_buttons?this.remove_all_rows_button.style.display="none":(this.remove_all_rows_button.style.display="",e=!0)):(this.delete_last_row_button.style.display="none",this.remove_all_rows_button.style.display="none"),this.getMax()&&this.getMax()<=this.rows.length||this.hide_add_button?this.add_row_button.style.display="none":(this.add_row_button.style.display="",e=!0),!this.collapsed&&e?this.controls.style.display="inline-block":this.controls.style.display="none"}},addRow:function(a,b){var c=this,d=this.rows.length;c.rows[d]=this.getElementEditor(d),c.row_cache[d]=c.rows[d],c.tabs_holder&&(c.rows[d].tab_text=document.createElement("span"),c.rows[d].tab_text.textContent=c.rows[d].getHeaderText(),"tabs-top"===c.schema.format?(c.rows[d].tab=c.theme.getTopTab(c.rows[d].tab_text,this.getValidId(c.rows[d].path)),c.theme.addTopTab(c.tabs_holder,c.rows[d].tab)):(c.rows[d].tab=c.theme.getTab(c.rows[d].tab_text,this.getValidId(c.rows[d].path)),c.theme.addTab(c.tabs_holder,c.rows[d].tab)),c.rows[d].tab.addEventListener("click",function(a){c.active_tab=c.rows[d].tab,c.refreshTabs(),a.preventDefault(),a.stopPropagation()}));var e=c.rows[d].title_controls||c.rows[d].array_controls;c.hide_delete_buttons||(c.rows[d].delete_button=this.getButton(c.getItemTitle(),"delete",this.translate("button_delete_row_title",[c.getItemTitle()])),c.rows[d].delete_button.classList.add("delete","json-editor-btntype-delete"),c.rows[d].delete_button.setAttribute("data-i",d),c.rows[d].delete_button.addEventListener("click",function(a){if(a.preventDefault(),a.stopPropagation(),!c.askConfirmation())return!1;var b=1*this.getAttribute("data-i"),d=c.getValue(),e=[],g=null;f(d,function(a,c){a!==b&&e.push(c)}),c.empty(!0),c.setValue(e),c.rows[b]?g=c.rows[b].tab:c.rows[b-1]&&(g=c.rows[b-1].tab),g&&(c.active_tab=g,c.refreshTabs()),c.onChange(!0),c.jsoneditor.trigger("deleteRow")}),e&&e.appendChild(c.rows[d].delete_button)),c.show_copy_button&&(c.rows[d].copy_button=this.getButton(c.getItemTitle(),"copy","Copy "+c.getItemTitle()),c.rows[d].copy_button.classList.add("copy","json-editor-btntype-copy"),c.rows[d].copy_button.setAttribute("data-i",d),c.rows[d].copy_button.addEventListener("click",function(a){var b=c.getValue();a.preventDefault(),a.stopPropagation();var d=1*this.getAttribute("data-i");f(b,function(a,c){a===d&&b.push(c)}),c.setValue(b),c.refreshValue(!0),c.onChange(!0)}),e.appendChild(c.rows[d].copy_button)),d&&!c.hide_move_buttons&&(c.rows[d].moveup_button=this.getButton("","moveup",this.translate("button_move_up_title")),c.rows[d].moveup_button.classList.add("moveup","json-editor-btntype-move"),c.rows[d].moveup_button.setAttribute("data-i",d),c.rows[d].moveup_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var b=1*this.getAttribute("data-i");if(!(b<=0)){var d=c.getValue(),e=d[b-1];d[b-1]=d[b],d[b]=e,c.setValue(d),c.active_tab=c.rows[b-1].tab,c.refreshTabs(),c.onChange(!0),c.jsoneditor.trigger("moveRow")}}),e&&e.appendChild(c.rows[d].moveup_button)),c.hide_move_buttons||(c.rows[d].movedown_button=this.getButton("","movedown",this.translate("button_move_down_title")),c.rows[d].movedown_button.classList.add("movedown","json-editor-btntype-move"),c.rows[d].movedown_button.setAttribute("data-i",d),c.rows[d].movedown_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var b=1*this.getAttribute("data-i"),d=c.getValue();if(!(b>=d.length-1)){var e=d[b+1];d[b+1]=d[b],d[b]=e,c.setValue(d),c.active_tab=c.rows[b+1].tab,c.refreshTabs(),c.onChange(!0),c.jsoneditor.trigger("moveRow")}}),e&&e.appendChild(c.rows[d].movedown_button)),a&&c.rows[d].setValue(a,b),c.refreshTabs()},addControls:function(){var a=this;this.collapsed=!1,this.toggle_button=this.getButton("","collapse",this.translate("button_collapse")),this.toggle_button.classList.add("json-editor-btntype-toggle"),this.title_controls.appendChild(this.toggle_button);var b=a.row_holder.style.display,c=a.controls.style.display;this.toggle_button.addEventListener("click",function(d){d.preventDefault(),d.stopPropagation(),a.collapsed?(a.collapsed=!1,a.panel&&(a.panel.style.display=""),a.row_holder.style.display=b,a.tabs_holder&&(a.tabs_holder.style.display=""),a.controls.style.display=c,a.setButtonText(this,"","collapse",a.translate("button_collapse"))):(a.collapsed=!0,a.row_holder.style.display="none",a.tabs_holder&&(a.tabs_holder.style.display="none"),a.controls.style.display="none",a.panel&&(a.panel.style.display="none"),a.setButtonText(this,"","expand",a.translate("button_expand")))}),this.options.collapsed&&g(this.toggle_button,"click"),this.schema.options&&"undefined"!=typeof this.schema.options.disable_collapse?this.schema.options.disable_collapse&&(this.toggle_button.style.display="none"):this.jsoneditor.options.disable_collapse&&(this.toggle_button.style.display="none"),this.add_row_button=this.getButton(this.getItemTitle(),"add",this.translate("button_add_row_title",[this.getItemTitle()])),this.add_row_button.classList.add("json-editor-btntype-add"),this.add_row_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation();var c=a.rows.length;a.row_cache[c]?(a.rows[c]=a.row_cache[c],a.rows[c].setValue(a.rows[c].getDefault(),!0),a.rows[c].container.style.display="",a.rows[c].tab&&(a.rows[c].tab.style.display=""),a.rows[c].register()):a.addRow(),a.active_tab=a.rows[c].tab,a.refreshTabs(),a.refreshValue(),a.onChange(!0),a.jsoneditor.trigger("addRow")}),a.controls.appendChild(this.add_row_button),this.delete_last_row_button=this.getButton(this.translate("button_delete_last",[this.getItemTitle()]),"delete",this.translate("button_delete_last_title",[this.getItemTitle()])),this.delete_last_row_button.classList.add("json-editor-btntype-deletelast"),this.delete_last_row_button.addEventListener("click",function(b){if(b.preventDefault(),b.stopPropagation(),!a.askConfirmation())return!1;var c=a.getValue(),d=null;c.pop(),a.empty(!0),a.setValue(c),a.rows[a.rows.length-1]&&(d=a.rows[a.rows.length-1].tab),d&&(a.active_tab=d,a.refreshTabs()),a.onChange(!0),a.jsoneditor.trigger("deleteRow")}),a.controls.appendChild(this.delete_last_row_button),this.remove_all_rows_button=this.getButton(this.translate("button_delete_all"),"delete",this.translate("button_delete_all_title")),this.remove_all_rows_button.classList.add("json-editor-btntype-deleteall"),this.remove_all_rows_button.addEventListener("click",function(b){return b.preventDefault(),b.stopPropagation(),!!a.askConfirmation()&&(a.empty(!0),a.setValue([]),a.onChange(!0),void a.jsoneditor.trigger("deleteAllRows"))}),a.controls.appendChild(this.remove_all_rows_button),a.tabs&&(this.add_row_button.style.width="100%",this.add_row_button.style.textAlign="left",this.add_row_button.style.marginBottom="3px",this.delete_last_row_button.style.width="100%",this.delete_last_row_button.style.textAlign="left",this.delete_last_row_button.style.marginBottom="3px",this.remove_all_rows_button.style.width="100%",this.remove_all_rows_button.style.textAlign="left",this.remove_all_rows_button.style.marginBottom="3px")},showValidationErrors:function(a){var b=this,c=[],d=[];if(f(a,function(a,e){e.path===b.path?c.push(e):d.push(e)}),this.error_holder)if(c.length){this.error_holder.innerHTML="",this.error_holder.style.display="",f(c,function(a,c){b.error_holder.appendChild(b.theme.getErrorMessage(c.message))})}else this.error_holder.style.display="none";f(this.rows,function(a,b){b.showValidationErrors(d)})}}),h.defaults.editors.table=h.defaults.editors.array.extend({register:function(){if(this._super(),this.rows)for(var a=0;athis.schema.maxItems&&(a=a.slice(0,this.schema.maxItems));var c=JSON.stringify(a);if(c!==this.serialized){var d=!1,e=this;f(a,function(a,b){e.rows[a]?e.rows[a].setValue(b):(e.addRow(b),d=!0)});for(var g=a.length;g=this.rows.length,c=!1;f(this.rows,function(d,e){e.movedown_button&&(d===a.rows.length-1?e.movedown_button.style.display="none":(c=!0,e.movedown_button.style.display="")),e.delete_button&&(b?e.delete_button.style.display="none":(c=!0,e.delete_button.style.display="")),e.moveup_button&&(c=!0)}),f(this.rows,function(a,b){c?b.controls_cell.style.display="":b.controls_cell.style.display="none"}),c?this.controls_header_cell.style.display="":this.controls_header_cell.style.display="none";var d=!1;this.value.length?1===this.value.length?(this.table.style.display="",this.remove_all_rows_button.style.display="none",b||this.hide_delete_last_row_buttons?this.delete_last_row_button.style.display="none":(this.delete_last_row_button.style.display="",d=!0)):(this.table.style.display="",b||this.hide_delete_last_row_buttons?this.delete_last_row_button.style.display="none":(this.delete_last_row_button.style.display="",d=!0),b||this.hide_delete_all_rows_buttons?this.remove_all_rows_button.style.display="none":(this.remove_all_rows_button.style.display="",d=!0)):(this.delete_last_row_button.style.display="none",this.remove_all_rows_button.style.display="none",this.table.style.display="none"),this.schema.maxItems&&this.schema.maxItems<=this.rows.length||this.hide_add_button?this.add_row_button.style.display="none":(this.add_row_button.style.display="",d=!0),d?this.controls.style.display="":this.controls.style.display="none"},refreshValue:function(){var a=this;this.value=[],f(this.rows,function(b,c){a.value[b]=c.getValue()}),this.serialized=JSON.stringify(this.value)},addRow:function(a){var b=this,c=this.rows.length;b.rows[c]=this.getElementEditor(c);var d=b.rows[c].table_controls;this.hide_delete_buttons||(b.rows[c].delete_button=this.getButton("","delete",this.translate("button_delete_row_title_short")),b.rows[c].delete_button.classList.add("delete","json-editor-btntype-delete"),b.rows[c].delete_button.setAttribute("data-i",c),b.rows[c].delete_button.addEventListener("click",function(a){if(a.preventDefault(),a.stopPropagation(),!b.askConfirmation())return!1;var c=1*this.getAttribute("data-i"),d=b.getValue(),e=[];f(d,function(a,b){a!==c&&e.push(b)}),b.setValue(e),b.onChange(!0)}),d.appendChild(b.rows[c].delete_button)),c&&!this.hide_move_buttons&&(b.rows[c].moveup_button=this.getButton("","moveup",this.translate("button_move_up_title")),b.rows[c].moveup_button.classList.add("moveup","json-editor-btntype-move"),b.rows[c].moveup_button.setAttribute("data-i",c),b.rows[c].moveup_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var c=1*this.getAttribute("data-i");if(!(c<=0)){var d=b.getValue(),e=d[c-1];d[c-1]=d[c],d[c]=e,b.setValue(d),b.onChange(!0)}}),d.appendChild(b.rows[c].moveup_button)),this.hide_move_buttons||(b.rows[c].movedown_button=this.getButton("","movedown",this.translate("button_move_down_title")),b.rows[c].movedown_button.classList.add("movedown","json-editor-btntype-move"),b.rows[c].movedown_button.setAttribute("data-i",c),b.rows[c].movedown_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var c=1*this.getAttribute("data-i"),d=b.getValue();if(!(c>=d.length-1)){var e=d[c+1];d[c+1]=d[c],d[c]=e,b.setValue(d),b.onChange(!0)}}),d.appendChild(b.rows[c].movedown_button)),a&&b.rows[c].setValue(a)},addControls:function(){var a=this;this.collapsed=!1,this.toggle_button=this.getButton("","collapse",this.translate("button_collapse")),this.toggle_button.classList.add("json-editor-btntype-toggle"),this.title_controls&&(this.title_controls.appendChild(this.toggle_button),this.toggle_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.collapsed?(a.collapsed=!1,a.panel.style.display="",a.setButtonText(this,"","collapse",a.translate("button_collapse"))):(a.collapsed=!0,a.panel.style.display="none",a.setButtonText(this,"","expand",a.translate("button_expand")))}),this.options.collapsed&&g(this.toggle_button,"click"),this.schema.options&&"undefined"!=typeof this.schema.options.disable_collapse?this.schema.options.disable_collapse&&(this.toggle_button.style.display="none"):this.jsoneditor.options.disable_collapse&&(this.toggle_button.style.display="none")),this.add_row_button=this.getButton(this.getItemTitle(),"add",this.translate("button_add_row_title",[this.getItemTitle()])),this.add_row_button.classList.add("json-editor-btntype-add"),this.add_row_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.addRow(),a.refreshValue(),a.refreshRowButtons(),a.onChange(!0)}),a.controls.appendChild(this.add_row_button),this.delete_last_row_button=this.getButton(this.translate("button_delete_last",[this.getItemTitle()]),"delete",this.translate("button_delete_last_title",[this.getItemTitle()])),this.delete_last_row_button.classList.add("json-editor-btntype-deletelast"),this.delete_last_row_button.addEventListener("click",function(b){if(b.preventDefault(),b.stopPropagation(),!a.askConfirmation())return!1;var c=a.getValue();c.pop(),a.setValue(c),a.onChange(!0)}),a.controls.appendChild(this.delete_last_row_button),this.remove_all_rows_button=this.getButton(this.translate("button_delete_all"),"delete",this.translate("button_delete_all_title")), +this.remove_all_rows_button.classList.add("json-editor-btntype-deleteall"),this.remove_all_rows_button.addEventListener("click",function(b){return b.preventDefault(),b.stopPropagation(),!!a.askConfirmation()&&(a.setValue([]),void a.onChange(!0))}),a.controls.appendChild(this.remove_all_rows_button)}}),h.defaults.editors.multiple=h.AbstractEditor.extend({register:function(){if(this.editors){for(var a=0;anull";if("object"==typeof a){var c="";return f(a,function(d,e){var f=b.getHTML(e);Array.isArray(a)||(f="
        "+d+": "+f+"
        "),c+="
      • "+f+"
      • "}),c=Array.isArray(a)?"
          "+c+"
        ":"
          "+c+"
        "}return"boolean"==typeof a?a?"true":"false":"string"==typeof a?a.replace(/&/g,"&").replace(//g,">"):a},setValue:function(a){this.value!==a&&(this.value=a,this.refreshValue(),this.onChange())},destroy:function(){this.display_area&&this.display_area.parentNode&&this.display_area.parentNode.removeChild(this.display_area),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.switcher&&this.switcher.parentNode&&this.switcher.parentNode.removeChild(this.switcher),this._super()}}),h.defaults.editors.select=h.AbstractEditor.extend({setValue:function(a,b){a=this.typecast(a||"");var c=a;this.enum_values.indexOf(c)<0&&(c=this.enum_values[0]),this.value!==c&&(b?this.is_dirty=!1:"change"===this.jsoneditor.options.show_errors&&(this.is_dirty=!0),this.input.value=this.enum_options[this.enum_values.indexOf(c)],this.select2&&(this.select2v4?this.select2.val(this.input.value).trigger("change"):this.select2.select2("val",this.input.value)),this.value=c,this.onChange(),this.change())},register:function(){this._super(),this.input&&this.input.setAttribute("name",this.formname)},unregister:function(){this._super(),this.input&&this.input.removeAttribute("name")},getNumColumns:function(){if(!this.enum_options)return 3;for(var a=this.getTitle().length,b=0;b2||this.enum_options.length&&this.enumSource)){var a=e({},h.plugins.select2);this.schema.options&&this.schema.options.select2_options&&(a=e(a,this.schema.options.select2_options)),this.select2=window.jQuery(this.input).select2(a),this.select2v4=this.select2.select2.hasOwnProperty("amd");var b=this;this.select2.on("select2-blur",function(){b.select2v4?b.input.value=b.select2.val():b.input.value=b.select2.select2("val"),b.onInputChange()}),this.select2.on("change",function(){b.select2v4?b.input.value=b.select2.val():b.input.value=b.select2.select2("val"),b.onInputChange()})}else this.select2=null},postBuild:function(){this._super(),this.theme.afterInputReady(this.input),this.setupSelect2()},onWatchedFieldChange:function(){var a,b;if(this.enumSource){a=this.getWatchedFieldValues();for(var c=[],d=[],e=0;e=2||this.enum_options.length&&this.enumSource)){var c=e({},h.plugins.selectize);this.schema.options&&this.schema.options.selectize_options&&(c=e(c,this.schema.options.selectize_options)),this.selectize=window.jQuery(this.input).selectize(e(c,{create:c.create===b||c.create,onChange:function(){a.onInputChange()}}))}else this.selectize=null},postBuild:function(){this._super(),this.theme.afterInputReady(this.input),this.setupSelectize()},onWatchedFieldChange:function(){var a,c;if(this.enumSource){a=this.getWatchedFieldValues();for(var d=[],e=[],f=0;f1&&a.schema.options&&a.schema.options.multiple&&1==a.schema.options.multiple&&a.parent&&"object"==a.parent.schema.type&&a.parent.parent&&"array"==a.parent.parent.schema.type){a.arrayEditor=a.jsoneditor.getEditor(a.parent.parent.path),a.value=a.arrayEditor.getValue(),a.total=this.files.length,a.current_item_index=parseInt(a.parent.key),a.count=a.current_item_index;for(var c=0;cType: "+a+", Size: "+Math.floor((this.value.length-this.value.split(",")[0].length-1)/1.33333)+" bytes","image"===a.substr(0,5)){this.preview.innerHTML+="
        ";var b=document.createElement("img");b.style.maxWidth="100%",b.style.maxHeight="100px",b.src=this.value,this.preview.appendChild(b)}}else this.preview.innerHTML="Invalid data URI"}},enable:function(){this.always_disabled||(this.uploader&&(this.uploader.disabled=!1),this._super())},disable:function(a){a&&(this.always_disabled=!0),this.uploader&&(this.uploader.disabled=!0),this._super()},setValue:function(a){this.value!==a&&(this.value=a,this.input.value=this.value,this.refreshPreview(),this.onChange())},destroy:function(){this.preview&&this.preview.parentNode&&this.preview.parentNode.removeChild(this.preview),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this.uploader&&this.uploader.parentNode&&this.uploader.parentNode.removeChild(this.uploader),this._super()}}),h.defaults.editors.upload=h.AbstractEditor.extend({getNumColumns:function(){return 4},build:function(){var a=this;if(this.title=this.header=this.label=this.theme.getFormInputLabel(this.getTitle()),this.input=this.theme.getFormInputField("hidden"),this.container.appendChild(this.input),!this.schema.readOnly&&!this.schema.readonly){if(!this.jsoneditor.options.upload)throw"Upload handler required for upload editor";this.uploader=this.theme.getFormInputField("file"),this.uploader.addEventListener("change",function(b){if(b.preventDefault(),b.stopPropagation(),this.files&&this.files.length){var c=new FileReader;c.onload=function(b){a.preview_value=b.target.result,a.refreshPreview(),a.onChange(!0),c=null},c.readAsDataURL(this.files[0])}})}var b=this.schema.description;b||(b=""),this.preview=this.theme.getFormInputDescription(b),this.container.appendChild(this.preview),this.control=this.theme.getFormControl(this.label,this.uploader||this.input,this.preview),this.container.appendChild(this.control),window.requestAnimationFrame(function(){if(a.value){var b=document.createElement("img");b.style.maxWidth="100%",b.style.maxHeight="100px",b.onload=function(c){a.preview.appendChild(b)},b.onerror=function(a){console.error("upload error",a)},b.src=a.container.querySelector("a").href}})},refreshPreview:function(){if(this.last_preview!==this.preview_value&&(this.last_preview=this.preview_value,this.preview.innerHTML="",this.preview_value)){var a=this,b=this.preview_value.match(/^data:([^;,]+)[;,]/);b&&(b=b[1]),b||(b="unknown");var c=this.uploader.files[0];if(this.preview.innerHTML="Type: "+b+", Size: "+c.size+" bytes","image"===b.substr(0,5)){this.preview.innerHTML+="
        ";var d=document.createElement("img");d.style.maxWidth="100%",d.style.maxHeight="100px",d.src=this.preview_value,this.preview.appendChild(d)}this.preview.innerHTML+="
        ";var e=this.getButton("Upload","upload","Upload");this.preview.appendChild(e),e.addEventListener("click",function(b){b.preventDefault(),e.setAttribute("disabled","disabled"),a.theme.removeInputError(a.uploader),a.theme.getProgressBar&&(a.progressBar=a.theme.getProgressBar(),a.preview.appendChild(a.progressBar)),a.jsoneditor.options.upload(a.path,c,{success:function(b){a.setValue(b),a.parent?a.parent.onChildEditorChange(a):a.jsoneditor.onChange(), +a.progressBar&&a.preview.removeChild(a.progressBar),e.removeAttribute("disabled")},failure:function(b){a.theme.addInputError(a.uploader,b),a.progressBar&&a.preview.removeChild(a.progressBar),e.removeAttribute("disabled")},updateProgress:function(b){a.progressBar&&(b?a.theme.updateProgressBar(a.progressBar,b):a.theme.updateProgressBarUnknown(a.progressBar))}})}),(this.jsoneditor.options.auto_upload||this.schema.options.auto_upload)&&(e.dispatchEvent(new MouseEvent("click")),this.preview.removeChild(e))}},enable:function(){this.always_disabled||(this.uploader&&(this.uploader.disabled=!1),this._super())},disable:function(a){a&&(this.always_disabled=!0),this.uploader&&(this.uploader.disabled=!0),this._super()},setValue:function(a){this.value!==a&&(this.value=a,this.input.value=this.value,this.onChange())},destroy:function(){this.preview&&this.preview.parentNode&&this.preview.parentNode.removeChild(this.preview),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this.uploader&&this.uploader.parentNode&&this.uploader.parentNode.removeChild(this.uploader),this._super()}}),h.defaults.editors.checkbox=h.AbstractEditor.extend({setValue:function(a,b){this.value=!!a,this.input.checked=this.value,this.onChange()},register:function(){this._super(),this.input&&this.input.setAttribute("name",this.formname)},unregister:function(){this._super(),this.input&&this.input.removeAttribute("name")},getNumColumns:function(){return Math.min(12,Math.max(this.getTitle().length/7,2))},build:function(){var a=this;this.options.compact||(this.label=this.header=this.theme.getCheckboxLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description)),this.options.infoText&&(this.infoButton=this.theme.getInfoButton(this.options.infoText)),this.options.compact&&this.container.classList.add("compact"),this.input=this.theme.getCheckbox(),this.control=this.theme.getFormControl(this.label,this.input,this.description,this.infoButton),(this.schema.readOnly||this.schema.readonly)&&(this.always_disabled=!0,this.input.disabled=!0),this.input.addEventListener("change",function(b){b.preventDefault(),b.stopPropagation(),a.value=this.checked,a.onChange(!0)}),this.container.appendChild(this.control)},enable:function(){this.always_disabled||(this.input.disabled=!1,this._super())},disable:function(a){a&&(this.always_disabled=!0),this.input.disabled=!0,this._super()},destroy:function(){this.label&&this.label.parentNode&&this.label.parentNode.removeChild(this.label),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this._super()},showValidationErrors:function(a){var b=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 c=[];f(a,function(a,d){d.path===b.path&&c.push(d.message)}),this.input.controlgroup=this.control,c.length?this.theme.addInputError(this.input,c.join(". ")+"."):this.theme.removeInputError(this.input)}}),h.defaults.editors.arraySelectize=h.AbstractEditor.extend({build:function(){this.title=this.theme.getFormInputLabel(this.getTitle()),this.title_controls=this.theme.getHeaderButtonHolder(),this.title.appendChild(this.title_controls),this.error_holder=document.createElement("div"),this.schema.description&&(this.description=this.theme.getDescription(this.schema.description)),this.input=document.createElement("select"),this.input.setAttribute("multiple","multiple");var a=this.theme.getFormControl(this.title,this.input,this.description);this.container.appendChild(a),this.container.appendChild(this.error_holder),window.jQuery(this.input).selectize({delimiter:!1,createOnBlur:!0,create:!0})},postBuild:function(){var a=this;this.input.selectize.on("change",function(b){a.refreshValue(),a.onChange(!0)})},destroy:function(){this.empty(!0),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this._super()},empty:function(a){},setValue:function(a,b){var c=this;a=a||[],Array.isArray(a)||(a=[a]),this.input.selectize.clearOptions(),this.input.selectize.clear(!0),a.forEach(function(a){c.input.selectize.addOption({text:a,value:a})}),this.input.selectize.setValue(a),this.refreshValue(b)},refreshValue:function(a){this.value=this.input.selectize.getValue()},showValidationErrors:function(a){var b=this,c=[],d=[];if(f(a,function(a,e){e.path===b.path?c.push(e):d.push(e)}),this.error_holder)if(c.length){this.error_holder.innerHTML="",this.error_holder.style.display="",f(c,function(a,c){b.error_holder.appendChild(b.theme.getErrorMessage(c.message))})}else this.error_holder.style.display="none"}}),h.defaults.editors.starrating=h.defaults.editors.string.extend({build:function(){var a=this;this.options.compact||(this.header=this.label=this.theme.getFormInputLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description)),this.options.infoText&&(this.infoButton=this.theme.getInfoButton(this.options.infoText)),this.options.compact&&this.container.classList.add("compact"),this.ratingContainer=document.createElement("div"),this.ratingContainer.classList.add("starrating"),this.enum_values=this.schema["enum"],this.radioGroup=[];for(var b=function(b){b.preventDefault(),b.stopPropagation(),a.setValue(this.value),a.onChange(!0)},c=this.enum_values.length-1;c>-1;c--){var d=this.key+"-"+c,e=this.theme.getFormInputField("radio");e.name=this.formname+"[starrating]",e.value=this.enum_values[c],e.id=d,e.addEventListener("change",b,!1),this.radioGroup.push(e);var f=document.createElement("label");f.htmlFor=d,f.title=this.enum_values[c],this.options.displayValue&&f.classList.add("starrating-display-enabled"),this.ratingContainer.appendChild(e),this.ratingContainer.appendChild(f)}if(this.options.displayValue&&(this.displayRating=document.createElement("div"),this.displayRating.classList.add("starrating-display"),this.displayRating.innerText=this.enum_values[0],this.ratingContainer.appendChild(this.displayRating)),this.schema.readOnly||this.schema.readonly){this.always_disabled=!0;for(var g=0;c0){var d=new Date(1e3*a),e=d.getFullYear(),f=this.zeroPad(d.getMonth()+1),g=this.zeroPad(d.getDate()),h=this.zeroPad(d.getHours()),i=this.zeroPad(d.getMinutes()),j=this.zeroPad(d.getSeconds()),k=[e,f,g].join("-"),l=[h,i,j].join(":"),m=k+" "+l;"date"==this.schema.format?m=k:"time"==this.schema.format&&(m=l),this.input.value=m,this.flatpickr&&this.flatpickr.setDate(m)}},destroy:function(){this.flatpickr&&this.flatpickr.destroy(),this.flatpickr=null,this._super()},zeroPad:function(a){return("0"+a).slice(-2)}}),h.defaults.editors.signature=h.defaults.editors.string.extend({build:function(){var a=this;this.options.compact||(this.header=this.label=this.theme.getFormInputLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description));var b=this.formname.replace(/\W/g,"");if("function"==typeof SignaturePad){var c="json-editor-style-signature";document.getElementById(c);this.input=this.theme.getFormInputField("hidden"),this.container.appendChild(this.input);var d=document.createElement("div");d.classList.add("signature-container");var e=document.createElement("canvas");e.setAttribute("name",b),e.classList.add("signature"),d.appendChild(e),a.signaturePad=new window.SignaturePad(e,{onEnd:function(){a.signaturePad.isEmpty()?a.input.value="":a.input.value=a.signaturePad.toDataURL(),a.is_dirty=!0,a.refreshValue(),a.watch_listener(),a.jsoneditor.notifyWatchers(a.path),a.parent?a.parent.onChildEditorChange(a):a.jsoneditor.onChange()}});var g=document.createElement("div"),h=document.createElement("button");h.classList.add("tiny","button"),h.innerHTML="Clear signature",g.appendChild(h),d.appendChild(g),this.options.compact&&this.container.setAttribute("class",this.container.getAttribute("class")+" compact"),(this.schema.readOnly||this.schema.readonly)&&(this.always_disabled=!0,f(this.inputs,function(a,b){e.setAttribute("readOnly","readOnly"),b.disabled=!0})),h.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.signaturePad.clear(),a.signaturePad.strokeEnd()}),this.control=this.theme.getFormControl(this.label,d,this.description),this.container.appendChild(this.control),this.refreshValue(),e.width=d.offsetWidth,a.options&&a.options.canvas_height?e.height=a.options.canvas_height:e.height="300"}else{var i=document.createElement("p");i.innerHTML="Signature pad is not available, please include SignaturePad from https://github.com/szimek/signature_pad",this.container.appendChild(i)}},setValue:function(a){var b=this;if("function"==typeof SignaturePad){var c=(this.formname.replace(/\W/g,""),this.sanitize(a));if(this.value===c)return;return b.value=c,b.input.value=b.value,b.signaturePad.clear(),a&&""!=a&&b.signaturePad.fromDataURL(a),b.watch_listener(),b.jsoneditor.notifyWatchers(b.path),!1}},destroy:function(){var a=this;this.formname.replace(/\W/g,"");a.signaturePad.off(),delete a.signaturePad}});var i=function(){var a=document.documentElement;return a.matches?"matches":a.webkitMatchesSelector?"webkitMatchesSelector":a.mozMatchesSelector?"mozMatchesSelector":a.msMatchesSelector?"msMatchesSelector":a.oMatchesSelector?"oMatchesSelector":void 0}();return h.AbstractTheme=c.extend({getContainer:function(){return document.createElement("div")},getFloatRightLinkHolder:function(){var a=document.createElement("div");return a.style=a.style||{},a.style.cssFloat="right",a.style.marginLeft="10px",a},getModal:function(){var a=document.createElement("div");return a.style.backgroundColor="white",a.style.border="1px solid black",a.style.boxShadow="3px 3px black",a.style.position="absolute",a.style.zIndex="10",a.style.display="none",a},getGridContainer:function(){var a=document.createElement("div");return a},getGridRow:function(){var a=document.createElement("div");return a.classList.add("row"),a},getGridColumn:function(){var a=document.createElement("div");return a},setGridColumnSize:function(a,b){},getLink:function(a){var b=document.createElement("a");return b.setAttribute("href","#"),b.appendChild(document.createTextNode(a)),b},disableHeader:function(a){a.style.color="#ccc"},disableLabel:function(a){a.style.color="#ccc"},enableHeader:function(a){a.style.color=""},enableLabel:function(a){a.style.color=""},getInfoButton:function(a){var b=document.createElement("span");b.innerText="ⓘ",b.style.fontSize="16px",b.style.fontWeight="bold",b.style.padding=".25rem",b.style.position="relative",b.style.display="inline-block";var c=document.createElement("span");return c.style.fontSize="12px",b.style.fontWeight="normal",c.style["font-family"]="sans-serif",c.style.visibility="hidden",c.style["background-color"]="rgba(50, 50, 50, .75)",c.style.margin="0 .25rem",c.style.color="#FAFAFA",c.style.padding=".5rem 1rem",c.style["border-radius"]=".25rem",c.style.width="20rem",c.style.position="absolute",c.innerText=a,b.onmouseover=function(){c.style.visibility="visible"},b.onmouseleave=function(){c.style.visibility="hidden"},b.appendChild(c),b},getFormInputLabel:function(a){var b=document.createElement("label");return b.appendChild(document.createTextNode(a)),b},getCheckboxLabel:function(a){var b=this.getFormInputLabel(a);return b.style.fontWeight="normal",b},getHeader:function(a){var b=document.createElement("h3");return"string"==typeof a?b.textContent=a:b.appendChild(a),b},getCheckbox:function(){var a=this.getFormInputField("checkbox");return a.style.display="inline-block",a.style.width="auto",a},getMultiCheckboxHolder:function(a,b,c){var d=document.createElement("div");b&&(b.style.display="block",d.appendChild(b));for(var e in a)a.hasOwnProperty(e)&&(a[e].style.display="inline-block",a[e].style.marginRight="20px",d.appendChild(a[e]));return c&&d.appendChild(c),d},getSelectInput:function(a){var b=document.createElement("select");return a&&this.setSelectOptions(b,a),b},getSwitcher:function(a){var b=this.getSelectInput(a);return b.style.backgroundColor="transparent",b.style.display="inline-block",b.style.fontStyle="italic",b.style.fontWeight="normal",b.style.height="auto",b.style.marginBottom=0,b.style.marginLeft="5px",b.style.padding="0 0 0 3px",b.style.width="auto",b},getSwitcherOptions:function(a){return a.getElementsByTagName("option")},setSwitcherOptions:function(a,b,c){this.setSelectOptions(a,b,c)},setSelectOptions:function(a,b,c){c=c||[],a.innerHTML="";for(var d=0;d
        ",c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.innerHTML="
        ",c},applyStyles:function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a.style[c]=b[c])},closest:function(a,b){for(;a&&a!==document;){if(!a[i])return!1;if(a[i](b))return a;a=a.parentNode}return!1},insertBasicTopTab:function(a,b){b.firstChild.insertBefore(a,b.firstChild.firstChild)},getTab:function(a,b){var c=document.createElement("div");return c.appendChild(a),c.id=b,c.style=c.style||{},this.applyStyles(c,{border:"1px solid #ccc",borderWidth:"1px 0 1px 1px",textAlign:"center",lineHeight:"30px",borderRadius:"5px",borderBottomRightRadius:0,borderTopRightRadius:0,fontWeight:"bold",cursor:"pointer"}),c},getTopTab:function(a,b){var c=document.createElement("div");return c.id=b,c.appendChild(a),c.style=c.style||{},this.applyStyles(c,{"float":"left",border:"1px solid #ccc",borderWidth:"1px 1px 0px 1px",textAlign:"center",lineHeight:"30px",borderRadius:"5px",paddingLeft:"5px",paddingRight:"5px",borderBottomRightRadius:0,borderBottomLeftRadius:0,fontWeight:"bold",cursor:"pointer"}),c},getTabContentHolder:function(a){return a.children[1]},getTopTabContentHolder:function(a){return a.children[1]},getTabContent:function(){return this.getIndentedPanel()},getTopTabContent:function(){return this.getTopIndentedPanel()},markTabActive:function(a){this.applyStyles(a.tab,{opacity:1,background:"white"}),"undefined"!=typeof a.rowPane?a.rowPane.style.display="":a.container.style.display=""},markTabInactive:function(a){this.applyStyles(a.tab,{opacity:.5,background:""}),"undefined"!=typeof a.rowPane?a.rowPane.style.display="none":a.container.style.display="none"},addTab:function(a,b){a.children[0].appendChild(b)},addTopTab:function(a,b){a.children[0].appendChild(b)},getBlockLink:function(){var a=document.createElement("a");return a.style.display="block",a},getBlockLinkHolder:function(){var a=document.createElement("div");return a},getLinksHolder:function(){var a=document.createElement("div");return a},createMediaLink:function(a,b,c){a.appendChild(b),c.style.width="100%",a.appendChild(c)},createImageLink:function(a,b,c){a.appendChild(b),b.appendChild(c)},getFirstTab:function(a){return a.firstChild.firstChild},getInputGroup:function(a,c){return b}}),h.defaults.themes.bootstrap2=h.AbstractTheme.extend({getRangeInput:function(a,b,c){return this._super(a,b,c)},getGridContainer:function(){var a=document.createElement("div");return a.classList.add("container-fluid"),a},getGridRow:function(){var a=document.createElement("div");return a.classList.add("row-fluid"),a},getFormInputLabel:function(a){var b=this._super(a);return b.style.display="inline-block",b.style.fontWeight="bold",b},setGridColumnSize:function(a,b){a.classList.add("span"+b)},getSelectInput:function(a){var b=this._super(a);return b.style.width="auto",b.style.maxWidth="98%",b},getFormInputField:function(a){var b=this._super(a);return b.style.width="98%",b},afterInputReady:function(a){if(!a.controlgroup&&(a.controlgroup=this.closest(a,".control-group"),a.controls=this.closest(a,".controls"),this.closest(a,".compact")&&(a.controlgroup.className=a.controlgroup.className.replace(/control-group/g,"").replace(/[ ]{2,}/g," "),a.controls.className=a.controlgroup.className.replace(/controls/g,"").replace(/[ ]{2,}/g," "),a.style.marginBottom=0),this.queuedInputErrorText)){var b=this.queuedInputErrorText;delete this.queuedInputErrorText,this.addInputError(a,b)}},getIndentedPanel:function(){var a=document.createElement("div");return a.classList.add("well","well-small"),a.style.paddingBottom=0,a},getInfoButton:function(a){var b=document.createElement("span");b.classList.add("icon-info-sign","pull-right"),b.style.padding=".25rem",b.style.position="relative",b.style.display="inline-block";var c=document.createElement("span");return c.style["font-family"]="sans-serif",c.style.visibility="hidden",c.style["background-color"]="rgba(50, 50, 50, .75)",c.style.margin="0 .25rem",c.style.color="#FAFAFA",c.style.padding=".5rem 1rem",c.style["border-radius"]=".25rem",c.style.width="25rem",c.style.transform="translateX(-27rem) translateY(-.5rem)",c.style.position="absolute",c.innerText=a,b.onmouseover=function(){c.style.visibility="visible"},b.onmouseleave=function(){c.style.visibility="hidden"},b.appendChild(c),b},getFormInputDescription:function(a){var b=document.createElement("p");return b.classList.add("help-inline"),b.textContent=a,b},getFormControl:function(a,b,c,d){var e=document.createElement("div");e.classList.add("control-group");var f=document.createElement("div");return f.classList.add("controls"),a&&"checkbox"===b.getAttribute("type")?(e.appendChild(f),a.classList.add("checkbox"),a.appendChild(b),f.appendChild(a),d&&f.appendChild(d),f.style.height="30px"):(a&&(a.classList.add("control-label"),e.appendChild(a)),d&&f.appendChild(d),f.appendChild(b),e.appendChild(f)),c&&f.appendChild(c),e},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a.style.marginLeft="10px",a},getButtonHolder:function(){var a=document.createElement("div");return a.classList.add("btn-group"),a},getButton:function(a,b,c){var d=this._super(a,b,c);return d.classList.add("btn","btn-default"),d},getTable:function(){var a=document.createElement("table");return a.classList.add("table","table-bordered"),a.style.width="auto",a.style.maxWidth="none",a},addInputError:function(a,b){return a.controlgroup?void(a.controlgroup&&a.controls&&(a.controlgroup.classList.add("error"),a.errmsg?a.errmsg.style.display="":(a.errmsg=document.createElement("p"),a.errmsg.classList.add("help-block","errormsg"),a.controls.appendChild(a.errmsg)),a.errmsg.textContent=b)):void(this.queuedInputErrorText=b)},removeInputError:function(a){a.controlgroup||delete this.queuedInputErrorText,a.errmsg&&(a.errmsg.style.display="none",a.controlgroup.classList.remove("error"))},getTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("tabbable","tabs-left"),c.innerHTML="
        ",c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("tabbable","tabs-over"),c.innerHTML="
        ",c},getTab:function(a,b){var c=document.createElement("li");c.classList.add("nav-item");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("li");c.classList.add("nav-item");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTabContentHolder:function(a){return a.children[1]},getTopTabContentHolder:function(a){return a.children[1]},getTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a},markTabActive:function(a){a.tab.classList.add("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.add("active"):a.container.classList.add("active")},markTabInactive:function(a){a.tab.classList.remove("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.remove("active"):a.container.classList.remove("active")},addTab:function(a,b){a.children[0].appendChild(b)},addTopTab:function(a,b){a.children[0].appendChild(b)},getProgressBar:function(){var a=document.createElement("div");a.classList.add("progress");var b=document.createElement("div");return b.classList.add("bar"),b.style.width="0%",a.appendChild(b),a},updateProgressBar:function(a,b){a&&(a.firstChild.style.width=b+"%")},updateProgressBarUnknown:function(a){a&&(a.classList.add("progress","progress-striped","active"),a.firstChild.style.width="100%")},getInputGroup:function(a,b){if(a){var c=document.createElement("div");c.classList.add("input-append"),c.appendChild(a);for(var d=0;d
        ",c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.innerHTML="
        ",c},getTab:function(a,b){var c=document.createElement("li");c.setAttribute("role","presentation");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),d.setAttribute("aria-controls",b),d.setAttribute("role","tab"),d.setAttribute("data-toggle","tab"),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("li");c.setAttribute("role","presentation");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),d.setAttribute("aria-controls",b),d.setAttribute("role","tab"),d.setAttribute("data-toggle","tab"),c.appendChild(d),c},getTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a.setAttribute("role","tabpanel"),a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a.setAttribute("role","tabpanel"),a},markTabActive:function(a){a.tab.classList.add("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.add("active"):a.container.classList.add("active")},markTabInactive:function(a){a.tab.classList.remove("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.remove("active"):a.container.classList.remove("active")},getProgressBar:function(){var a=0,b=100,c=0,d=document.createElement("div");d.classList.add("progress");var e=document.createElement("div");return e.classList.add("progress-bar"),e.setAttribute("role","progressbar"),e.setAttribute("aria-valuenow",c), +e.setAttribute("aria-valuemin",a),e.setAttribute("aria-valuenax",b),e.innerHTML=c+"%",d.appendChild(e),d},updateProgressBar:function(a,b){if(a){var c=a.firstChild,d=b+"%";c.setAttribute("aria-valuenow",b),c.style.width=d,c.innerHTML=d}},updateProgressBarUnknown:function(a){if(a){var b=a.firstChild;a.classList.add("progress","progress-striped","active"),b.removeAttribute("aria-valuenow"),b.style.width="100%",b.innerHTML=""}},getInputGroup:function(a,b){if(a){var c=document.createElement("div");c.classList.add("input-group"),c.appendChild(a);var d=document.createElement("div");d.classList.add("input-group-btn"),c.appendChild(d);for(var e=0;e
        ",b.classList.add("row"),b},addTab:function(a,b){a.children[0].children[0].appendChild(b)},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.innerHTML="
        ",c},getTab:function(a,b){var c=document.createElement("li");c.classList.add("nav-item");var d=document.createElement("a");return d.classList.add("nav-link"),d.setAttribute("style","padding:10px;"),d.setAttribute("href","#"+b),d.setAttribute("data-toggle","tab"),d.appendChild(a),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("li");c.classList.add("nav-item");var d=document.createElement("a");return d.classList.add("nav-link"),d.setAttribute("href","#"+b),d.setAttribute("data-toggle","tab"),d.appendChild(a),c.appendChild(d),c},getTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a.setAttribute("role","tabpanel"),a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-pane"),a.setAttribute("role","tabpanel"),a},markTabActive:function(a){a.tab.firstChild.classList.add("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.add("active"):a.container.classList.add("active")},markTabInactive:function(a){a.tab.firstChild.classList.remove("active"),"undefined"!=typeof a.rowPane?a.rowPane.classList.remove("active"):a.container.classList.remove("active")},getProgressBar:function(){var a=0,b=100,c=0,d=document.createElement("div");d.classList.add("progress");var e=document.createElement("div");return e.classList.add("progress-bar"),e.setAttribute("role","progressbar"),e.setAttribute("aria-valuenow",c),e.setAttribute("aria-valuemin",a),e.setAttribute("aria-valuenax",b),e.innerHTML=c+"%",d.appendChild(e),d},updateProgressBar:function(a,b){if(a){var c=a.firstChild,d=b+"%";c.setAttribute("aria-valuenow",b),c.style.width=d,c.innerHTML=d}},updateProgressBarUnknown:function(a){if(a){var b=a.firstChild;a.classList.add("progress","progress-striped","active"),b.removeAttribute("aria-valuenow"),b.style.width="100%",b.innerHTML=""}},getInputGroup:function(a,b){if(a){var c=document.createElement("div");c.classList.add("input-group"),c.appendChild(a);var d=document.createElement("div");d.classList.add("input-group-prepend"),c.appendChild(d);for(var e=0;e'),a.errmsg=a.parentNode.getElementsByClassName("error")[0]),void(a.errmsg.textContent=b)):void(this.queuedInputErrorText=b)},removeInputError:function(a){a.group||delete this.queuedInputErrorText,a.errmsg&&(a.group.classList.remove("error"),a.errmsg.style.display="none")},getProgressBar:function(){var a=document.createElement("div");a.classList.add("progress");var b=document.createElement("span");return b.classList.add("meter"),b.style.width="0%",a.appendChild(b),a},updateProgressBar:function(a,b){a&&(a.firstChild.style.width=b+"%")},updateProgressBarUnknown:function(a){a&&(a.firstChild.style.width="100%")},getInputGroup:function(a,c){if(!a)return b;var d=document.createElement("div");d.classList.add("input-group"),a.classList.add("input-group-field"),d.appendChild(a);for(var e=0;e
        ',c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("row"),c.innerHTML='
        ',c},setGridColumnSize:function(a,b){var c=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"];a.classList.add("columns",c[b])},getTab:function(a,b){var c=document.createElement("dd"),d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("dd"),d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTabContentHolder:function(a){return a.children[1]},getTopTabContentHolder:function(a){return a.children[1]},getTabContent:function(){var a=document.createElement("div");return a.classList.add("content","active"),a.style.paddingLeft="5px",a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("content","active"),a.style.paddingLeft="5px",a},markTabActive:function(a){a.tab.classList.add("active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="":a.container.style.display=""},markTabInactive:function(a){a.tab.classList.remove("active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="none":a.container.style.display="none"},addTab:function(a,b){a.children[0].appendChild(b)},addTopTab:function(a,b){a.children[0].appendChild(b)}}),h.defaults.themes.foundation4=h.defaults.themes.foundation.extend({getHeaderButtonHolder:function(){var a=this._super();return a.style.fontSize=".6em",a},setGridColumnSize:function(a,b){a.classList.add("columns","large-"+b)},getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8rem",b},getFormInputLabel:function(a){var b=this._super(a);return b.style.fontWeight="bold",b}}),h.defaults.themes.foundation5=h.defaults.themes.foundation.extend({getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8rem",b},setGridColumnSize:function(a,b){a.classList.add("columns","medium-"+b)},getButton:function(a,b,c){var d=this._super(a,b,c);return d.className=d.className.replace(/\s*small/g,"")+" tiny",d},getTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.innerHTML='
        ',c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("row"),c.innerHTML='
        ',c},getTab:function(a,b){var c=document.createElement("dd"),d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("dd"),d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTabContentHolder:function(a){return a.children[1]},getTopTabContentHolder:function(a){return a.children[1]},getTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-content","active"),a.style.paddingLeft="5px",a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("tab-content","active"),a.style.paddingLeft="5px",a},markTabActive:function(a){a.tab.classList.add("active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="":a.container.style.display=""},markTabInactive:function(a){a.tab.classList.remove("active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="none":a.container.style.display="none"},addTab:function(a,b){a.children[0].appendChild(b)},addTopTab:function(a,b){a.children[0].appendChild(b)}}),h.defaults.themes.foundation6=h.defaults.themes.foundation5.extend({getIndentedPanel:function(){var a=document.createElement("div");return a.classList.add("callout","secondary"),a.style="padding-left: 10px; margin-left: 10px;",a},getButtonHolder:function(){var a=document.createElement("div");return a.classList.add("button-group","tiny"),a.style.marginBottom=0,a},getFormInputLabel:function(a){var b=this._super(a);return b.style.display="block",b},getFormControl:function(a,b,c,d){var e=document.createElement("div");return e.classList.add("form-control"),a&&e.appendChild(a),"checkbox"===b.type?a.insertBefore(b,a.firstChild):a?(d&&a.appendChild(d),a.appendChild(b)):(d&&e.appendChild(d),e.appendChild(b)),c&&a.appendChild(c),e},addInputError:function(a,b){if(a.group){if(a.group.classList.add("error"),a.errmsg)a.errmsg.style.display="",a.className="";else{var c=document.createElement("span");c.classList.add("form-error","is-visible"),a.group.getElementsByTagName("label")[0].appendChild(c),a.classList.add("is-invalid-input"),a.errmsg=c}a.errmsg.textContent=b}},removeInputError:function(a){a.errmsg&&(a.classList.remove("is-invalid-input"),a.errmsg.parentNode&&a.errmsg.parentNode.removeChild(a.errmsg))},getTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("grid-x"),c.innerHTML='
          ',c},getTopTabHolder:function(a){var b="undefined"==typeof a?"":a,c=document.createElement("div");return c.classList.add("grid-y"),c.innerHTML='
            ',c},insertBasicTopTab:function(a,b){b.firstChild.firstChild.insertBefore(a,b.firstChild.firstChild.firstChild)},getTab:function(a,b){var c=document.createElement("li");c.classList.add("tabs-title");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTopTab:function(a,b){var c=document.createElement("li");c.classList.add("tabs-title");var d=document.createElement("a");return d.setAttribute("href","#"+b),d.appendChild(a),c.appendChild(d),c},getTabContentHolder:function(a){return a.children[1].firstChild},getTopTabContentHolder:function(a){return a.firstChild.children[1]},getTabContent:function(){var a=document.createElement("div");return a.classList.add("tabs-panel"),a.style.paddingLeft="5px",a},getTopTabContent:function(){var a=document.createElement("div");return a.classList.add("tabs-panel"),a.style.paddingLeft="5px",a},markTabActive:function(a){a.tab.classList.add("is-active"),a.tab.firstChild.setAttribute("aria-selected","true"),"undefined"!=typeof a.rowPane?(a.rowPane.classList.add("is-active"),a.rowPane.setAttribute("aria-selected","true")):(a.container.classList.add("is-active"),a.container.setAttribute("aria-selected","true"))},markTabInactive:function(a){a.tab.classList.remove("is-active"),a.tab.firstChild.removeAttribute("aria-selected"),"undefined"!=typeof a.rowPane?(a.rowPane.classList.remove("is-active"),a.rowPane.removeAttribute("aria-selected")):(a.container.classList.remove("is-active"),a.container.removeAttribute("aria-selected"))},addTab:function(a,b){a.children[0].firstChild.appendChild(b)},addTopTab:function(a,b){a.firstChild.children[0].appendChild(b)},getFirstTab:function(a){return a.firstChild.firstChild.firstChild}}),h.defaults.themes.html=h.AbstractTheme.extend({getFormInputLabel:function(a){var b=this._super(a);return b.style.display="block",b.style.marginBottom="3px",b.style.fontWeight="bold",b},getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8em",b.style.margin=0,b.style.display="inline-block",b.style.fontStyle="italic",b},getIndentedPanel:function(){var a=this._super();return a.style.border="1px solid #ddd",a.style.padding="5px",a.style.margin="10px",a.style.borderRadius="3px",a},getTopIndentedPanel:function(){return this.getIndentedPanel()},getChildEditorHolder:function(){var a=this._super();return a.style.marginBottom="8px",a},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a.style.display="inline-block",a.style.marginLeft="10px",a.style.fontSize=".8em",a.style.verticalAlign="middle",a},getTable:function(){var a=this._super();return a.style.borderBottom="1px solid #ccc",a.style.marginBottom="5px",a},addInputError:function(a,b){if(a.style.borderColor="red",a.errmsg)a.errmsg.style.display="block";else{var c=this.closest(a,".form-control");a.errmsg=document.createElement("div"),a.errmsg.setAttribute("class","errmsg"),a.errmsg.style=a.errmsg.style||{},a.errmsg.style.color="red",c.appendChild(a.errmsg)}a.errmsg.innerHTML="",a.errmsg.appendChild(document.createTextNode(b))},removeInputError:function(a){a.style.borderColor="",a.errmsg&&(a.errmsg.style.display="none")},getProgressBar:function(){var a=100,b=0,c=document.createElement("progress");return c.setAttribute("max",a),c.setAttribute("value",b),c},updateProgressBar:function(a,b){a&&a.setAttribute("value",b)},updateProgressBarUnknown:function(a){a&&a.removeAttribute("value")}}),h.defaults.themes.jqueryui=h.AbstractTheme.extend({getTable:function(){var a=this._super();return a.setAttribute("cellpadding",5),a.setAttribute("cellspacing",0),a},getTableHeaderCell:function(a){var b=this._super(a);return b.classList.add("ui-state-active"),b.style.fontWeight="bold",b},getTableCell:function(){var a=this._super();return a.classList.add("ui-widget-content"),a},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a.style.marginLeft="10px",a.style.fontSize=".6em",a.style.display="inline-block",a},getFormInputDescription:function(a){var b=this.getDescription(a);return b.style.marginLeft="10px",b.style.display="inline-block",b},getFormControl:function(a,b,c,d){var e=this._super(a,b,c,d);return"checkbox"===b.type?(e.style.lineHeight="25px",e.style.padding="3px 0"):e.style.padding="4px 0 8px 0",e},getDescription:function(a){var b=document.createElement("span");return b.style.fontSize=".8em",b.style.fontStyle="italic",b.textContent=a,b},getButtonHolder:function(){var a=document.createElement("div");return a.classList.add("ui-buttonset"),a.style.fontSize=".7em",a},getFormInputLabel:function(a){var b=document.createElement("label");return b.style.fontWeight="bold",b.style.display="block",b.textContent=a,b},getButton:function(a,b,c){var d=document.createElement("button");d.classList.add("ui-button","ui-widget","ui-state-default","ui-corner-all"),b&&!a?(d.classList.add("ui-button-icon-only"),b.classList.add("ui-button-icon-primary","ui-icon-primary"),d.appendChild(b)):b?(d.classList.add("ui-button-text-icon-primary"),b.classList.add("ui-button-icon-primary","ui-icon-primary"),d.appendChild(b)):d.classList.add("ui-button-text-only");var e=document.createElement("span");return e.classList.add("ui-button-text"),e.textContent=a||c||".",d.appendChild(e),d.setAttribute("title",c),d},setButtonText:function(a,b,c,d){a.innerHTML="",a.classList.add("ui-button","ui-widget","ui-state-default","ui-corner-all"),c&&!b?(a.classList.add("ui-button-icon-only"),c.classList.add("ui-button-icon-primary","ui-icon-primary"),a.appendChild(c)):c?(a.classList.add("ui-button-text-icon-primary"),c.classList.add("ui-button-icon-primary","ui-icon-primary"),a.appendChild(c)):a.classList.add("ui-button-text-only");var e=document.createElement("span");e.classList.add("ui-button-text"),e.textContent=b||d||".",a.appendChild(e),a.setAttribute("title",d)},getIndentedPanel:function(){var a=document.createElement("div");return a.classList.add("ui-widget-content","ui-corner-all"),a.style.padding="1em 1.4em",a.style.marginBottom="20px",a},afterInputReady:function(a){if(!a.controls&&(a.controls=this.closest(a,".form-control"),this.queuedInputErrorText)){var b=this.queuedInputErrorText;delete this.queuedInputErrorText,this.addInputError(a,b)}},addInputError:function(a,b){return a.controls?(a.errmsg?a.errmsg.style.display="":(a.errmsg=document.createElement("div"),a.errmsg.classList.add("ui-state-error"),a.controls.appendChild(a.errmsg)),void(a.errmsg.textContent=b)):void(this.queuedInputErrorText=b)},removeInputError:function(a){a.controls||delete this.queuedInputErrorText,a.errmsg&&(a.errmsg.style.display="none")},markTabActive:function(a){a.tab.classList.remove("ui-widget-header"),a.tab.classList.add("ui-state-active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="":a.container.style.display=""},markTabInactive:function(a){a.tab.classList.add("ui-widget-header"),a.tab.classList.remove("ui-state-active"),"undefined"!=typeof a.rowPane?a.rowPane.style.display="none":a.container.style.display="none"}}),h.defaults.themes.barebones=h.AbstractTheme.extend({getFormInputLabel:function(a){var b=this._super(a);return b},getFormInputDescription:function(a){var b=this._super(a);return b},getIndentedPanel:function(){var a=this._super();return a},getChildEditorHolder:function(){var a=this._super();return a},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a},getTable:function(){var a=this._super();return a},addInputError:function(a,b){if(a.errmsg)a.errmsg.style.display="block";else{var c=this.closest(a,".form-control");a.errmsg=document.createElement("div"),a.errmsg.setAttribute("class","errmsg"),c.appendChild(a.errmsg)}a.errmsg.innerHTML="",a.errmsg.appendChild(document.createTextNode(b))},removeInputError:function(a){a.style.borderColor="",a.errmsg&&(a.errmsg.style.display="none")},getProgressBar:function(){var a=100,b=0,c=document.createElement("progress");return c.setAttribute("max",a),c.setAttribute("value",b),c},updateProgressBar:function(a,b){a&&a.setAttribute("value",b)},updateProgressBarUnknown:function(a){a&&a.removeAttribute("value")}}),h.defaults.themes.materialize=h.AbstractTheme.extend({setGridColumnSize:function(a,b){a.classList.add("col"),a.classList.add("s"+b)},getHeaderButtonHolder:function(){return this.getButtonHolder()},getButtonHolder:function(){return document.createElement("span")},getButton:function(a,b,c){a&&(b.classList.add("left"),b.style.marginRight="5px");var d=this._super(a,b,c);return d.classList.add("waves-effect","waves-light","btn"),d.style.fontSize="0.75rem",d.style.height="24px",d.style.lineHeight="24px",d.style.marginLeft="5px",d.style.padding="0 0.5rem",d},getFormControl:function(a,b,c,d){var e,f=b.type;if(f&&"checkbox"===f){if(e=document.createElement("p"),a){var g=document.createElement("span");g.innerHTML=a.innerHTML,a.innerHTML="",a.setAttribute("for",b.id),e.appendChild(a),a.appendChild(b),a.appendChild(g)}else e.appendChild(b);return e}return e=this._super(a,b,c,d),f&&f.startsWith("select")||e.classList.add("input-field"),f&&"color"===f&&(b.style.height="3rem",b.style.width="100%",b.style.margin="5px 0 20px 0",b.style.padding="3px",a&&(a.style.transform="translateY(-14px) scale(0.8)",a.style["-webkit-transform"]="translateY(-14px) scale(0.8)",a.style["-webkit-transform-origin"]="0 0",a.style["transform-origin"]="0 0")),e},getDescription:function(a){var b=document.createElement("div");return b.classList.add("grey-text"),b.style.marginTop="-15px",b.innerHTML=a,b},getHeader:function(a){var b=document.createElement("h5");return"string"==typeof a?b.textContent=a:b.appendChild(a),b},getChildEditorHolder:function(){var a=document.createElement("div");return a.marginBottom="10px",a},getIndentedPanel:function(){var a=document.createElement("div");return a.classList.add("card-panel"),a},getTable:function(){var a=document.createElement("table");return a.classList.add("striped","bordered"),a.style.marginBottom="10px",a},getTableRow:function(){return document.createElement("tr")},getTableHead:function(){return document.createElement("thead")},getTableBody:function(){return document.createElement("tbody")},getTableHeaderCell:function(a){var b=document.createElement("th");return b.textContent=a,b},getTableCell:function(){var a=document.createElement("td");return a},getTabHolder:function(){var a=['
            ','
              ',"
            ","
            ",'
            ',"
            "].join("\n"),b=document.createElement("div");return b.classList.add("row","card-panel"),b.innerHTML=a,b},addTab:function(a,b){a.children[0].children[0].appendChild(b)},getTab:function(a){var b=document.createElement("li");return b.classList.add("tab"),b.style=b.style||{},this.applyStyles(b,{width:"100%",textAlign:"left",lineHeight:"24px",height:"24px",fontSize:"14px",cursor:"pointer"}),b.appendChild(a),b},markTabActive:function(a){a.style=a.style||{},this.applyStyles(a,{width:"100%",textAlign:"left",lineHeight:"24px",height:"24px",fontSize:"14px",cursor:"pointer",color:"rgba(238,110,115,1)",transition:"border-color .5s ease",borderRight:"3px solid #424242"})},markTabInactive:function(a){a.style=a.style||{},this.applyStyles(a,{width:"100%",textAlign:"left",lineHeight:"24px",height:"24px",fontSize:"14px",cursor:"pointer",color:"rgba(238,110,115,0.7)"})},getTabContentHolder:function(a){return a.children[1]},getTabContent:function(){return document.createElement("div")},addInputError:function(a,b){var c,d=a.parentNode;d&&(this.removeInputError(a),c=document.createElement("div"),c.classList.add("error-text","red-text"),c.textContent=b,d.appendChild(c))},removeInputError:function(a){var b,c=a.parentElement;if(c){b=c.getElementsByClassName("error-text");for(var d=0;d1){var g;c=function(b){for(g=b,a=0;a=0){if(a.items["enum"])return"multiselect";if(h.plugins.selectize.enable&&"string"===a.items.type)return"arraySelectize"}}),h.defaults.resolvers.unshift(function(a){if(a.oneOf||a.anyOf)return"multiple"}),h.defaults.resolvers.unshift(function(a){if(["string","integer"].indexOf(a.type)!==-1&&["date","time","datetime-local"].indexOf(a.format)!==-1)return"datetime"}),h.defaults.resolvers.unshift(function(a){if("string"===a.type&&"starrating"===a.format)return"starrating"}),function(){if(window.jQuery||window.Zepto){var a=window.jQuery||window.Zepto;a.jsoneditor=h.defaults,a.fn.jsoneditor=function(a){var b=this,c=this.data("jsoneditor");if("value"===a){if(!c)throw"Must initialize jsoneditor before getting/setting the value";if(!(arguments.length>1))return c.getValue();c.setValue(arguments[1])}else{if("validate"===a){if(!c)throw"Must initialize jsoneditor before validating";return arguments.length>1?c.validate(arguments[1]):c.validate()}"destroy"===a?c&&(c.destroy(),this.data("jsoneditor",null)):(c&&c.destroy(),c=new h(this.get(0),a),this.data("jsoneditor",c),c.on("change",function(){b.trigger("change")}),c.on("ready",function(){b.trigger("ready")}))}return this}}}(),h}); +//# sourceMappingURL=jsoneditor.min.js.map \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/clds_modelling.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/clds_modelling.html index 2cb937fb..f98fd952 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/clds_modelling.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/clds_modelling.html @@ -311,91 +311,6 @@ width: 14px;
            -
            - - -
            -
            - - - - Service Name -
            -
            -
            - {{serviceInfo.service.name}}
            -
            - -
            - -
            -
            - - - - Port Name -
            -
            -
            - {{serviceInfo.service.ports[0].name}}
            -
            -
            - -
            -
            - - - - Binding Name -
            -
            -
            - {{serviceInfo.bindingInfo.binding.name}}
            -
            -
            - -
            -
            - - - - Binding Port Type -
            -
            -
            - {{serviceInfo.bindingInfo.portTypeInfo.portType.name}}
            -
            -
            - -
            -
            - - - - Operation Name -
            -
            -
            - {{serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].operation.name}}
            -
            -
            -
            -
            @@ -488,26 +403,6 @@ width: 14px;
            -
            - -
            -
            - -
            -
            -
            -
            - -
            - -
            -
            -
            - -
            -
            -
            -
            -
            - +
            @@ -563,22 +444,6 @@ width: 14px;
            -
            - -
            -
            - -
            -
            -
            -
            -
            -
            diff --git a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js index d1f3e0c4..65577546 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js @@ -33,18 +33,6 @@ app function($scope, $rootScope, $uibModalInstance, data, operationalPolicyService, dialogs) { console.log("//////operationalPolicyCtrl"); - $rootScope.serviceInfo; - $rootScope.serviceInput; - $rootScope.serviceOutput; - $rootScope.serviceFault; - $rootScope.serviceInputPartInfo; - $rootScope.schemElemant1; - $rootScope.updateServiceInfo; - $rootScope.updateServiceInput; - $rootScope.updateServiceOutput; - $rootScope.updateServiceFault; - $rootScope.updateServiceInputPartInfo; - $rootScope.updateSchemElemant1; // Below code is added to get the policyNames var policies = getOperationalPolicyProperty(); for ( var obj in policies) { -- cgit 1.2.3-korg