!function(e,t){"object"==typeofexports&&"object"==typeofmodule?module.exports=t():"function"==typeofdefine&&define.amd?define([],t):"object"==typeofexports?exports.JSONEditor=t():e.JSONEditor=t()}(this,function(){returnfunction(e){functiont(n){if(i[n])returni[n].exports;varr=i[n]={exports:{},id:n,loaded:!1};returne[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}vari={};returnt.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){"use strict";functionn(e,t,i){if(!(thisinstanceofn))thrownewError('JSONEditor constructor called without "new".');varr=a.getInternetExplorerVersion();if(-1!=r&&r<9)thrownewError("Unsupported browser, IE9 or newer required. Please install the newest version of your browser.");if(t&&(t.error&&(console.warn('Option "error" has been renamed to "onError"'),t.onError=t.error,deletet.error),t.change&&(console.warn('Option "change" has been renamed to "onChange"'),t.onChange=t.change,deletet.change),t.editable&&(console.warn('Option "editable" has been renamed to "onEditable"'),t.onEditable=t.editable,deletet.editable),t)){varo=["ace","theme","ajv","schema","templates","onChange","onEditable","onError","onModeChange","escapeUnicode","history","search","mode","modes","name","indentation","sortObjectKeys"];Object.keys(t).forEach(function(e){-1===o.indexOf(e)&&console.warn('Unknown option "'+e+'". This option will be ignored')})}arguments.length&&this._create(e,t,i)}varr;try{r=i(1)}catch(e){}varo=i(54),s=i(65),a=i(57);n.modes={},n.prototype.DEBOUNCE_INTERVAL=150,n.prototype._create=function(e,t,i){this.container=e,this.options=t||{},this.json=i||{};varn=this.options.mode||"tree";this.setMode(n)},n.prototype.destroy=function(){},n.prototype.set=function(e){this.json=e},n.prototype.get=function(){returnthis.json},n.prototype.setText=function(e){this.json=a.parse(e)},n.prototype.getText=function(){returnJSON.stringify(this.json)},n.prototype.setName=function(e){this.options||(this.options={}),this.options.name=e},n.prototype.getName=function(){returnthis.options&&this.options.name},n.prototype.setMode=function(e){vart,i,r=this.container,o=a.extend({},this.options),s=o.mode;o.mode=e;varl=n.modes[e];if(!l)thrownewError('Unknown mode "'+o.mode+'"');try{varc="text"==l.data;if(i=this.getName(),t=this[c?"getText":"get"](),this.destroy(),a.clear(this),a.extend(this,l.mixin),this.create(r,o),this.setName(i),this[c?"setText":"set"](t),"function"==typeofl.load)try{l.load.call(this)}catch(e){console.error(e)}if("function"==typeofo.onModeChange&&e!==s)try{o.onModeChange(e,s)}catch(e){console.error(e)}}catch(e){this._onError(e)}},n.prototype.getMode=function(){returnthis.options.mode},n.prototype._onError=function(e){if(!this.options||"function"!=typeofthis.options.onError)throwe;this.options.onError(e)},n.prototype.setSchema=function(e){if(e){vart;try{t=this.options.ajv||r({allErrors:!0,verbose:!0})}catch(e){console.warn("Failed to create an instance of Ajv, JSON Schema validation is not available. Please use a JSONEditor bundle including Ajv, or pass an instance of Ajv as via the configuration option `ajv`.")}t&&(this.validateSchema=t.compile(e),this.options.schema=e,this.validate()),this.refresh()}elsethis.validateSchema=null,this.options.schema=null,this.validate(),this.refresh()},n.prototype.validate=function(){},n.prototype.refresh=function(){},n.registerMode=function(e){vart,i;if(a.isArray(e))for(t=0;t<e.length;t++)n.registerMode(e[t]);else{if(!("mode"ine))thrownewError('Property "mode" missing');if(!("mixin"ine))thrownewError('Property "mixin" missing');if(!("data"ine))thrownewError('Property "data" missing');varr=e.mode;if(rinn.modes)thrownewError('Mode "'+r+'" already registered');if("function"!=typeofe.mixin.create)thrownewError('Required function "create" missing on mixin');varo=["setMode","registerMode","modes"];for(t=0;t<o.length;t++)if((i=o[t])ine.mixin)thrownewError('Reserved property "'+i+'" not allowed in mixin');n.modes[r]=e}},n.registerMode(o),n.registerMode(s),e.exports=n},function(e,t,i){"use strict";functionn(e){if(!(thisinstanceofn))retur
n.prototype._onInsertAfter=function(e,t,i){varr=this.editor.getSelection(),o=newn(this.editor,{field:void0!=e?e:"",value:void0!=t?t:"",type:i});o.expand(!0),this.parent.insertAfter(o,this),this.editor.highlighter.unhighlight(),o.focus("field");vars=this.editor.getSelection();this.editor._onAction("insertAfterNodes",{nodes:[o],afterNode:this,parent:this.parent,oldSelection:r,newSelection:s})},n.prototype._onAppend=function(e,t,i){varr=this.editor.getSelection(),o=newn(this.editor,{field:void0!=e?e:"",value:void0!=t?t:"",type:i});o.expand(!0),this.parent.appendChild(o),this.editor.highlighter.unhighlight(),o.focus("field");vars=this.editor.getSelection();this.editor._onAction("appendNodes",{nodes:[o],parent:this.parent,oldSelection:r,newSelection:s})},n.prototype._onChangeType=function(e){vart=this.type;if(e!=t){vari=this.editor.getSelection();this.changeType(e);varn=this.editor.getSelection();this.editor._onAction("changeType",{node:this,oldType:t,newType:e,oldSelection:i,newSelection:n})}},n.prototype.sort=function(e){if(this._hasChilds()){vart="desc"==e?-1:1,i="array"==this.type?"value":"field";this.hideChilds();varn=this.childs,o=this.sortOrder;this.childs=this.childs.concat(),this.childs.sort(function(e,n){returnt*r(e[i],n[i])}),this.sortOrder=1==t?"asc":"desc",this.editor._onAction("sort",{node:this,oldChilds:n,oldSort:o,newChilds:this.childs,newSort:this.sortOrder}),this.showChilds()}},n.prototype.getAppend=function(){returnthis.append||(this.append=newl(this.editor),this.append.setParent(this)),this.append.getDom()},n.getNodeFromTarget=function(e){for(;e;){if(e.node)returne.node;e=e.parentNode}},n.blurNodes=function(e){if(!Array.isArray(e))returnvoidn.blurNodes([e]);vart=e[0],i=t.parent,r=t.getIndex();i.childs[r+e.length]?i.childs[r+e.length].focus():i.childs[r-1]?i.childs[r-1].focus():i.focus()},n.prototype._nextSibling=function(){vare=this.parent.childs.indexOf(this);returnthis.parent.childs[e+1]||this.parent.append},n.prototype._previousNode=function(){vare=null,t=this.getDom();if(t&&t.parentNode){vari=t;do{i=i.previousSibling,e=n.getNodeFromTarget(i)}while(i&&einstanceofl&&!e.isVisible())}returne},n.prototype._nextNode=function(){vare=null,t=this.getDom();if(t&&t.parentNode){vari=t;do{i=i.nextSibling,e=n.getNodeFromTarget(i)}while(i&&einstanceofl&&!e.isVisible())}returne},n.prototype._firstNode=function(){vare=null,t=this.getDom();if(t&&t.parentNode){vari=t.parentNode.firstChild;e=n.getNodeFromTarget(i)}returne},n.prototype._lastNode=function(){vare=null,t=this.getDom();if(t&&t.parentNode){vari=t.parentNode.lastChild;for(e=n.getNodeFromTarget(i);i&&einstanceofl&&!e.isVisible();)i=i.previousSibling,e=n.getNodeFromTarget(i)}returne},n.prototype._previousElement=function(e){vart=this.dom;switch(e){caset.value:if(this.fieldEditable)returnt.field;caset.field:if(this._hasChilds())returnt.expand;caset.expand:returnt.menu;caset.menu:if(t.drag)returnt.drag;default:returnnull}},n.prototype._nextElement=function(e){vart=this.dom;switch(e){caset.drag:returnt.menu;caset.menu:if(this._hasChilds())returnt.expand;caset.expand:if(this.fieldEditable)returnt.field;caset.field:if(!this._hasChilds())returnt.value;default:returnnull}},n.prototype._getElementName=function(e){vart=this.dom;for(variint)if(t.hasOwnProperty(i)&&t[i]==e)returni;returnnull},n.prototype._hasChilds=function(){return"array"==this.type||"object"==this.type},n.TYPE_TITLES={auto:'Field type "auto". The field type is automatically determined from the value and can be a string, number, boolean, or null.',object:'Field type "object". An object contains an unordered set of key/value pairs.',array:'Field type "array". An array contains an ordered collection of values.',string:'Field type "string". Field type is not determined from the value, but always returned as string.'},n.prototype.addTemplates=function(e,t){vari=this,n=i.editor.options.templates;if(null!=n){n.length&&e.push({type:"separator"});varr=function(e,t){i._onAppend(e,t)},o=function(e,t){i._onInsertBefore(e,t)};n.forEach(function(i){e
;l=this.getFoldsInRange(e),this.removeFolds(l);varh=this.getFoldLine(r.row),u=0;if(h){h.addRemoveChars(r.row,r.column,n.column-r.column),h.shiftRow(-a);vard=this.getFoldLine(o);d&&d!==h&&(d.merge(h),h=d),u=c.indexOf(h)+1}for(u;u<c.length;u++){varh=c[u];h.start.row>=r.row&&h.shiftRow(-a)}s=o}else{varf=Array(a);f.unshift(o,0);varp=t?this.$wrapData:this.$rowLengthCache;p.splice.apply(p,f);varc=this.$foldData,h=this.getFoldLine(o),u=0;if(h){varg=h.range.compareInside(n.row,n.column);0==g?(h=h.split(n.row,n.column))&&(h.shiftRow(a),h.addRemoveChars(s,0,r.column-n.column)):-1==g&&(h.addRemoveChars(o,0,r.column-n.column),h.shiftRow(a)),u=c.indexOf(h)+1}for(u;u<c.length;u++){varh=c[u];h.start.row>=o&&h.shiftRow(a)}}else{a=Math.abs(e.start.column-e.end.column),"remove"===i&&(l=this.getFoldsInRange(e),this.removeFolds(l),a=-a);varh=this.getFoldLine(o);h&&h.addRemoveChars(o,n.column,a)}returnt&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,t?this.$updateWrapData(o,s):this.$updateRowLengthCache(o,s),l},this.$updateRowLengthCache=function(e,t,i){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,n){varr,o,s=this.doc.getAllLines(),a=this.getTabSize(),l=this.$wrapData,c=this.$wrapLimit,h=e;for(n=Math.min(n,s.length-1);h<=n;)o=this.getFoldLine(h,o),o?(r=[],o.walk(function(e,n,o,a){varl;if(null!=e){l=this.$getDisplayTokens(e,r.length),l[0]=t;for(varc=1;c<l.length;c++)l[c]=i}elsel=this.$getDisplayTokens(s[n].substring(a,o),r.length);r=r.concat(l)}.bind(this),o.end.row,s[o.end.row].length+1),l[o.start.row]=this.$computeWrapSplits(r,c,a),h=o.end.row+1):(r=this.$getDisplayTokens(s[h]),l[h]=this.$computeWrapSplits(r,c,a),h++)};vart=3,i=4,a=10,h=11,f=12;this.$computeWrapSplits=function(e,n,r){functiono(){vart=0;if(0===m)returnt;if(g)for(vari=0;i<e.length;i++){varn=e[i];if(n==a)t+=1;else{if(n!=h){if(n==f)continue;break}t+=r}}returnp&&!1!==g&&(t+=r),Math.min(t,m)}functions(t){vari=e.slice(u,t),n=i.length;i.join("").replace(/12/g,function(){n-=1}).replace(/2/g,function(){n-=1}),l.length||(v=o(),l.indent=v),d+=n,l.push(d),u=t}if(0==e.length)return[];for(varl=[],c=e.length,u=0,d=0,p=this.$wrapAsCode,g=this.$indentedSoftWrap,m=n<=Math.max(2*r,8)||!1===g?0:Math.floor(n/2),v=0;c-u>n-v;){varw=u+n-v;if(e[w-1]>=a&&e[w]>=a)s(w);elseif(e[w]!=t&&e[w]!=i){for(vary=Math.max(w-(n-(n>>2)),u-1);w>y&&e[w]<t;)w--;if(p){for(;w>y&&e[w]<t;)w--;for(;w>y&&9==e[w];)w--}elsefor(;w>y&&e[w]<a;)w--;w>y?s(++w):(w=u+n,2==e[w]&&w--,s(w-v))}else{for(w;w!=u-1&&e[w]!=t;w--);if(w>u){s(w);continue}for(w=u+n;w<e.length&&e[w]==i;w++);if(w==e.length)break;s(w)}}returnl},this.$getDisplayTokens=function(t,i){varn,r=[];i=i||0;for(varo=0;o<t.length;o++){vars=t.charCodeAt(o);if(9==s){n=this.getScreenTabSize(r.length+i),r.push(h);for(varl=1;l<n;l++)r.push(f)}else32==s?r.push(a):s>39&&s<48||s>57&&s<64?r.push(9):s>=4352&&e(s)?r.push(1,2):r.push(1)}returnr},this.$getStringScreenWidth=function(t,i,n){if(0==i)return[0,0];null==i&&(i=1/0),n=n||0;varr,o;for(o=0;o<t.length&&(r=t.charCodeAt(o),9==r?n+=this.getScreenTabSize(n):r>=4352&&e(r)?n+=2:n+=1,!(n>i));o++);return[n,o]},this.lineWidgets=null,this.getRowLength=function(e){if(this.lineWidgets)vart=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0;elset=0;returnthis.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1+t:1+t},this.getRowLineCount=function(e){returnthis.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1:1},this.getRowWrapIndent=function(e){if(this.$useWrapMode){vart=this.screenToDocumentPosition(e,Number.MAX_VALUE),i=this.$wrapData[t.row];returni.length&&i[0]<t.column?i.indent:0}return0},this.getScreenLastRowColumn=function(e){vart=this.screenToDocumentPosition(e,Number.MAX_VALUE);returnthis.documentToScreenColumn(t.row,t.column)},this.getDocumentLastRowColumn=function(e,t){vari=this.documentToScreenRow(e,t);returnthis.getScreenLastRowColumn(i)},this.getDocumentLastRowColumnPosition=function(e,t){vari=this.documentToScreenRow(e,t);return