(function(){functione(t,i,o){if(!(thisinstanceofe))thrownewError('JSONEditor constructor called without "new".');arguments.length&&this._create(t,i,o)}functiont(e,i,o){if(!(thisinstanceoft))thrownewError('TreeEditor constructor called without "new".');this._create(e,i,o)}functioni(e,t,o){if(!(thisinstanceofi))thrownewError('TextEditor constructor called without "new".');this._create(e,t,o)}functiono(e,t){this.editor=e,this.dom={},this.expanded=!1,t&&tinstanceofObject?(this.setField(t.field,t.fieldEditable),this.setValue(t.value,t.type)):(this.setField(""),this.setValue(null))}functionn(e){this.editor=e,this.dom={}}functions(e,t){functioni(e,t,n){n.forEach(function(n){if(n.type=="separator"){vars=document.createElement("div");s.className="separator",a=document.createElement("li"),a.appendChild(s),e.appendChild(a)}else{varr={},a=document.createElement("li");e.appendChild(a);varl=document.createElement("button");if(l.className=n.className,r.button=l,n.title&&(l.title=n.title),n.click&&(l.onclick=function(){o.hide(),n.click()}),a.appendChild(l),n.submenu){vard=document.createElement("div");d.className="icon",l.appendChild(d),l.appendChild(document.createTextNode(n.text));varh;if(n.click){l.className+=" default";varc=document.createElement("button");r.buttonExpand=c,c.className="expand",c.innerHTML='<div class="expand"></div>',a.appendChild(c),n.submenuTitle&&(c.title=n.submenuTitle),h=c}else{varu=document.createElement("div");u.className="expand",l.appendChild(u),h=l}h.onclick=function(){o._onExpandItem(r),h.focus()};varp=[];r.subItems=p;varf=document.createElement("ul");r.ul=f,f.className="menu",f.style.height="0",a.appendChild(f),i(f,p,n.submenu)}elsel.innerHTML='<div class="icon"></div>'+n.text;t.push(r)}})}this.dom={};varo=this,n=this.dom;this.anchor=void0,this.items=e,this.eventListeners={},this.selection=void0,this.visibleSubmenu=void0,this.onClose=t?t.close:void0;vars=document.createElement("div");s.className="jsoneditor-contextmenu",n.menu=s;varr=document.createElement("ul");r.className="menu",s.appendChild(r),n.list=r,n.items=[];vara=document.createElement("button");n.focusButton=a;varl=document.createElement("li");l.style.overflow="hidden",l.style.height="0",l.appendChild(a),r.appendChild(l),i(r,this.dom.items,e),this.maxHeight=0,e.forEach(function(t){vari=(e.length+(t.submenu?t.submenu.length:0))*24;o.maxHeight=Math.max(o.maxHeight,i)})}functionr(e){this.editor=e,this.clear(),this.actions={editField:{undo:function(e){e.node.updateField(e.oldValue)},redo:function(e){e.node.updateField(e.newValue)}},editValue:{undo:function(e){e.node.updateValue(e.oldValue)},redo:function(e){e.node.updateValue(e.newValue)}},appendNode:{undo:function(e){e.parent.removeChild(e.node)},redo:function(e){e.parent.appendChild(e.node)}},insertBeforeNode:{undo:function(e){e.parent.removeChild(e.node)},redo:function(e){e.parent.insertBefore(e.node,e.beforeNode)}},insertAfterNode:{undo:function(e){e.parent.removeChild(e.node)},redo:function(e){e.parent.insertAfter(e.node,e.afterNode)}},removeNode:{undo:function(e){vart=e.parent,i=t.childs[e.index]||t.append;t.insertBefore(e.node,i)},redo:function(e){e.parent.removeChild(e.node)}},duplicateNode:{undo:function(e){e.parent.removeChild(e.clone)},redo:function(e){e.parent.insertAfter(e.clone,e.node)}},changeType:{undo:function(e){e.node.changeType(e.oldType)},redo:function(e){e.node.changeType(e.newType)}},moveNode:{undo:function(e){e.startParent.moveTo(e.node,e.startIndex)},redo:function(e){e.endParent.moveTo(e.node,e.endIndex)}},sort:{undo:function(e){vart=e.node;t.hideChilds(),t.sort=e.oldSort,t.childs=e.oldChilds,t.showChilds()},redo:function(e){vart=e.node;t.hideChilds(),t.sort=e.newSort,t.childs=e.newChilds,t.showChilds()}}}}functiona(e,t,i){functiono(t){e.setMode(t);vari=e.dom&&e.dom.modeBox;i&&i.focus()}for(varn={code:{text:"Code",title:"Switch to code highlighter",click:function(){o("code")}},form:{text:"Form",title:"Switch to form editor",click:function(){o("form")}},text:{text:"Text",title:"Switch to plain text editor",click:function(){o(
while(s&&g>c+v);if(h&&h.parent){varb=y-this.drag.mouseX,C=Math.round(b/24/2),N=this.drag.level+C,E=h.getLevel();for(i=h.dom.tr.previousSibling;N>E&&i;){if(d=o.getNodeFromTarget(i),d==this||d._isChildOf(this));else{if(!(dinstanceofn))break;varw=d.parent.childs;if(!(w.length>1||w.length==1&&w[0]!=this))break;h=o.getNodeFromTarget(i),E=h.getLevel()}i=i.previousSibling}a.nextSibling!=h.dom.tr&&(h.parent.moveBefore(this,h),x=!0)}}x&&(this.drag.mouseX=y,this.drag.level=this.getLevel()),this.editor.startAutoScroll(g),util.preventDefault(e)},o.prototype._onDragEnd=function(e){e=e||window.event;vart={node:this,startParent:this.drag.startParent,startIndex:this.drag.startIndex,endParent:this.parent,endIndex:this.parent.childs.indexOf(this)};(t.startParent!=t.endParent||t.startIndex!=t.endIndex)&&this.editor._onAction("moveNode",t),document.body.style.cursor=this.drag.oldCursor,this.editor.highlighter.unlock(),deletethis.drag,this.mousemove&&(util.removeEventListener(document,"mousemove",this.mousemove),deletethis.mousemove),this.mouseup&&(util.removeEventListener(document,"mouseup",this.mouseup),deletethis.mouseup),this.editor.stopAutoScroll(),util.preventDefault(e)},o.prototype._isChildOf=function(e){for(vart=this.parent;t;){if(t==e)return!0;t=t.parent}return!1},o.prototype._createDomField=function(){returndocument.createElement("div")},o.prototype.setHighlight=function(e){this.dom.tr&&(this.dom.tr.className=e?"highlight":"",this.append&&this.append.setHighlight(e),this.childs&&this.childs.forEach(function(t){t.setHighlight(e)}))},o.prototype.updateValue=function(e){this.value=e,this.updateDom()},o.prototype.updateField=function(e){this.field=e,this.updateDom()},o.prototype.updateDom=function(e){vart=this.dom.tree;t&&(t.style.marginLeft=this.getLevel()*24+"px");vari=this.dom.field;if(i){this.fieldEditable==1?(i.contentEditable=this.editor.mode.edit,i.spellcheck=!1,i.className="field"):i.className="readonly";varo;o=this.index!=void0?this.index:this.field!=void0?this.field:this._hasChilds()?this.type:"",i.innerHTML=this._escapeHTML(o)}varn=this.dom.value;if(n){vars=this.childs?this.childs.length:0;n.innerHTML=this.type=="array"?"["+s+"]":this.type=="object"?"{"+s+"}":this._escapeHTML(this.value)}this._updateDomField(),this._updateDomValue(),e&&e.updateIndexes==1&&this._updateDomIndexes(),e&&e.recurse==1&&this.childs&&this.childs.forEach(function(t){t.updateDom(e)}),this.append&&this.append.updateDom()},o.prototype._updateDomIndexes=function(){vare=this.dom.value,t=this.childs;e&&t&&(this.type=="array"?t.forEach(function(e,t){e.index=t;vari=e.dom.field;i&&(i.innerHTML=t)}):this.type=="object"&&t.forEach(function(e){e.index!=void0&&(deletee.index,e.field==void0&&(e.field=""))}))},o.prototype._createDomValue=function(){vare;returnthis.type=="array"?(e=document.createElement("div"),e.className="readonly",e.innerHTML="[...]"):this.type=="object"?(e=document.createElement("div"),e.className="readonly",e.innerHTML="{...}"):!this.editor.mode.edit&&util.isUrl(this.value)?(e=document.createElement("a"),e.className="value",e.href=this.value,e.target="_blank",e.innerHTML=this._escapeHTML(this.value)):(e=document.createElement("div"),e.contentEditable=!this.editor.mode.view,e.spellcheck=!1,e.className="value",e.innerHTML=this._escapeHTML(this.value)),e},o.prototype._createDomExpandButton=function(){vare=document.createElement("button");returnthis._hasChilds()?(e.className=this.expanded?"expanded":"collapsed",e.title="Click to expand/collapse this field (Ctrl+E). \nCtrl+Click to expand/collapse including all childs."):(e.className="invisible",e.title=""),e},o.prototype._createDomTree=function(){vare=this.dom,t=document.createElement("table"),i=document.createElement("tbody");t.style.borderCollapse="collapse",t.className="values",t.appendChild(i);varo=document.createElement("tr");i.appendChild(o);varn=document.createElement("td");n.className="tree",o.appendChild(n),e.expand=this._createDomExpandButton(),n.appendChild(e.expand),e.tdExpand=n;vars=document.createElement("td");s.className="tree",o.appendChild(s),e.field=
};varu={JSONEditor:e,JSONFormatter:function(){thrownewError('JSONFormatter is deprecated. Use JSONEditor with mode "text" or "code" instead')},util:util},p=function(){for(vare=document.getElementsByTagName("script"),t=0;t<e.length;t++){vari=e[t].src;if(/(^|\/)jsoneditor([-\.]min)?.js$/.test(i)){varo=i.split("?")[0],n=o.substring(0,o.length-2)+"css",s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=n,document.getElementsByTagName("head")[0].appendChild(s);break}}};"undefined"!=typeofmodule&&"undefined"!=typeofexports&&(p(),module.exports=exports=u),"undefined"!=typeofrequire&&"undefined"!=typeofdefine?(p(),define(function(){returnu})):window.jsoneditor=u})();