Application.define("core.json_editor",function(a){a=jQuery.extend(!0,{container:!1,instance:"editor",options:{},json:null,callback:function(a){return a},actions:{save:function(){return null},validate:function(){return null}}},"object"==typeof a?a:{});var b="object"==typeof a.container?a.container.get(0):document.getElementById(a.container.replace("#","")),c=function(a,b){var c=this;c._args="object"==typeof b.options?b.options:{},c.options=jQuery.extend(!0,{change:function(){return null},history:!0,mode:"editor",search:!0},"object"==typeof b.options?b.options:{}),c.__=new JSONEditor(a,c.options,"undefined"!=typeof c._args.json?c._args.json:null),c.schema=!1,c.save=function(){if(c.schema&&!c.validate())return!1;try{c._args.actions.save(schema.get())}catch(a){return!1}return!0},c.set=function(b,d){return d=jQuery.extend(!0,{name:null,schema:null},"object"==typeof d?d:{}),c.schema="object"==typeof d.schema&&null!=d.schema?d.schema:!1,c.schema?jQuery("button.jsoneditor-validate-object",a).show():jQuery("button.jsoneditor-validate-object",a).hide(),"string"==typeof d.name?c.__.set(b,d.name):c.__.set(b)},c.get=function(){return console.log("JSON EDITOR: GET"),c.__.get()},c.validate=function(){if("object"!=typeof c.schema||"undefined"==typeof validate)return!0;c.last_validation=validate(c.get(),c.schema);try{c._args.actions.validate(c.last_validation)}catch(a){return!1}return c.last_validation.valid},c._update_menu=function(){var b=jQuery("button.jsoneditor-save-object",a),d=document.createElement("button");d.title="Validate",d.className="jsoneditor-menu jsoneditor-validate-object",d.appendChild(document.createTextNode("Validate")),d.style.display="none",d.onclick=function(){c.validate()},b.click(function(){c.save()}).after(d)},jQuery.each(c.__,function(a,b){"undefined"==typeof c[a]&&(c[a]=b)}),c._update_menu()};async.parallel({js:function(a){ud.load.js({JSONEditor:"//ud-cdn.com/js/ud.json.editor/latest/ud.json.editor.js",validate:"//ud-cdn.com/js/ud.json.validate/1.0/ud.json.validate.js"},function(){a(null,!0)})},css:function(a){window._flags="undefined"!=typeof window._flags?window._flags:{},"undefined"!=typeof window._flags.json_editor_css&&window._flags.json_editor_css||(ud.load.css("//ud-cdn.com/js/ud.json.editor/latest/assets/ud.json.editor.css"),window._flags.json_editor_css=!0),a(null,!0)}},function(){if("function"==typeof a.callback){var d=null;switch(a.instance){case"editor":d=new c(b,a);break;case"formatter":d=new JSONformatter(b,a.options)}a.callback(d)}})});