text: /* X3 v0.21.4 2016-11-19 */
  function fileTreeToggle(b,c){if(lick){var d="#left_folder_menu_box";if(!a)var a={};void 0==a.root&&(a.root="/"),void 0==a.script&&(a.script=b+"folderMenu.php"),void 0==a.folderEvent&&(a.folderEvent="click"),void 0==a.expandSpeed&&(a.expandSpeed=100),void 0==a.collapseSpeed&&(a.collapseSpeed=100),void 0==a.expandEasing&&(a.expandEasing=null),void 0==a.collapseEasing&&(a.collapseEasing=null),void 0==a.multiFolder&&(a.multiFolder=!0),void 0==a.loadMessage&&(a.loadMessage="Loading..."),liClick($(d),a,c)}}function liClick(a,d,c){"#"+$(a).attr("id");if(repeat_flag){repeat_flag=!1;var b=c.id;if("FILEMANAGER_NO_COLLAPSE"!=c.id){var e=document.getElementById(b).getAttribute("rel");document.getElementById(b).getAttribute("data-children");$(a).addClass("wait"),$(".jqueryFileTree.start").remove(),in_array(open_folders,c.id)?($("#"+b+" ul").remove(),removeItem(open_folders,c.id),$("#"+b).removeClass("expanded"),first_flag=$("#show_left_sidebar").html(),setTimeout(function(){repeat_flag=!0},500)):$.post(d.script,{dir:e,sign:here},function(f){$(a).find(".start").html(""),$(a).removeClass("wait").append(f),d.root==e?$(a).find("UL:hidden").show():($("#"+b+" ul").remove(),$(a).find("UL:hidden").appendTo("#"+b),$(a).find("UL:hidden").slideDown({duration:d.expandSpeed,easing:d.expandEasing}),open_folders.push(c.id),$("#"+b).addClass("expanded"),first_flag=$("#show_left_sidebar").html(),repeat_flag=!0),liBindTree(c,d)})}}}function liBindTree(a,b){$(a).bind(b.folderEvent,function(){first_flag=$("#show_left_sidebar").html()})}function liAutoOpen(a,d,c){var f=("#"+$(a).attr("id"),!0);if(f){repeat_flag=!1;var b=c.id;if("FILEMANAGER_NO_COLLAPSE"!=c.id){var e=document.getElementById(b).getAttribute("rel");document.getElementById(b).getAttribute("data-children");$(a).addClass("wait"),$(".jqueryFileTree.start").remove(),in_array(open_folders,c.id)?($("#"+b+" ul").remove(),removeItem(open_folders,c.id),$("#"+b).removeClass("expanded"),first_flag=$("#show_left_sidebar").html(),setTimeout(function(){repeat_flag=!0},500)):$.post(d.script,{dir:e,sign:here},function(f){$(a).find(".start").html(""),$(a).removeClass("wait").append(f),d.root==e?$(a).find("UL:hidden").show():($("#"+b+" ul").remove(),$(a).find("UL:hidden").appendTo("#"+b),$(a).find("UL:hidden").slideDown({duration:d.expandSpeed,easing:d.expandEasing}),open_folders.push(c.id),$("#"+b).addClass("expanded"),first_flag=$("#show_left_sidebar").html(),repeat_flag=!0),liBindTree(c,d)})}}}function open_all_dirs(a){var c=!0,b=$(".left_open_all_dir");b.children().each(function(){if(""!=$(this).attr("data-class")&&$(this).addClass($(this).attr("data-class")),"yes"==$(this).attr("data-children")&&c){var e="#left_folder_menu_box";if(!d)var d={};void 0==d.root&&(d.root="/"),void 0==d.script&&(d.script=a+"folderMenu.php"),void 0==d.folderEvent&&(d.folderEvent="click"),void 0==d.expandSpeed&&(d.expandSpeed=100),void 0==d.collapseSpeed&&(d.collapseSpeed=100),void 0==d.expandEasing&&(d.expandEasing=null),void 0==d.collapseEasing&&(d.collapseEasing=null),void 0==d.multiFolder&&(d.multiFolder=!0),void 0==d.loadMessage&&(d.loadMessage="Loading..."),liAutoOpen($(e),d,this),b.removeClass("left_open_all_dir"),setTimeout(function(){open_all_dirs(a)},1e3,a)}})}function cf_getDomainID(){$.post("cloudflare.php",{action:"zones"},function(a){a.success&&a.result.length>0?(cf_domain_id=a.result[0].id,localStorage.setItem("cf_domain_id",cf_domain_id),cf_addButton()):cloudflare=!1},"json")}function cf_getUrl(){var a=window.location.href.split("/");return a[a.length-1].length<1&&a.pop(),a.pop(),a=a.join("/")+"/"}function cf_getRelPath(b){var a=b.replace("../../content/","").replace("../content/","").split("/");return $.each(a,function(c,b){b.indexOf(".")>-1&&$.isNumeric(b.split(".")[0])&&(a[c]=b.split(".")[1])}),a=a.join("/").replace(/\/?$/,"/").replace("index/","")}function cf_getAllFiles(){var b=cf_getUrl(),a=[];return $.each(json_menu,function(d,e){var c=cf_getRelPath(e.link);c=b+c,a.push(c);var f=c.replace(/\/$/,"")+".json";d>0&&a.push(f)}),a.push(b),a.push(b+"?/index.json"),a.push(b+"index.json"),a.push(b+"services/site/"),a.push(b+"services/site.json"),a.push(b+"content/site.json"),a.push(b+"custom/404/"),a.push(b+"custom/404.json"),a.push(b+"custom/audio/"),a.push(b+"custom/audio.json"),a}function cf_getCurrentFile(){var a=cf_getUrl(),c=cf_getRelPath(localStorage.getItem("current_page")),b=[];return b.push("/"==c?a:a+c),b.push("/"==c||""==c?a+"?/index.json":a+c.replace(/\/$/,"")+".json"),b.push(a+"services/site/"),b.push(a+"services/site.json"),b.push(a+"content/site.json"),b}function cf_purgeFiles(b){var a=b?cf_getAllFiles():cf_getCurrentFile();console.dir(a),show_preloader(),$(".container").addClass("cf-busy"),$.post("cloudflare.php",{action:"purge_files",zone_identifier:cf_domain_id,files:a},function(a){a.success?show_errors_on_nav(language.Cloudflare_Flush_Success,"green"):show_errors_on_nav(language.Cloudflare_Flush_Fail,"red"),$(".container").removeClass("cf-busy")},"json")}function cf_addButton(){$(".navbar-nav > li").last().after('<li class="dropdown cloudflare-dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-cloud"></span></a><ul class="dropdown-menu pull-right dropdown-menu-right" role="menu"><li role="presentation" class="dropdown-header">CLOUDFLARE</li><li id=cf_flush_current><a href="#"><span class="glyphicon glyphicon-trash"></span>&nbsp; '+language.Cloudflare_Flush_Current_Page+'</a></li><li id=cf_flush_all><a href="#"><span class="glyphicon glyphicon-trash"></span>&nbsp; '+language.Cloudflare_Flush_All_Pages+"</a></li></ul></li>"),$(".navbar-nav li.cloudflare-dropdown").hoverIntent({over:function(b){var a=$(this).find(".dropdown-menu");a.velocity({opacity:1},{duration:200,display:"block"}),$(this).addClass("open")},out:function(){var a=$(this).find(".dropdown-menu");a.velocity("stop").css({opacity:0,display:"none"}),$(this).removeClass("open")},timeout:300}),$(".cloudflare-dropdown").on("click","#cf_flush_current",function(a){a.preventDefault(),cf_purgeFiles(!1)}),$(".cloudflare-dropdown").on("click","#cf_flush_all",function(a){a.preventDefault(),cf_purgeFiles(!0)})}function cf_load(){cloudflare&&!cf_checked&&supports_local_storage()&&(cf_checked=!0,null!==localStorage.getItem("cf_domain_id")?(cf_domain_id=localStorage.getItem("cf_domain_id"),cf_addButton()):setTimeout(function(){cf_getDomainID()},1e3))}function collectFiledata(){var a={};return $(".manage-table .file-data").each(function(d,e){var c=$(this).children("input.file-title").val();if(description=$(this).children("textarea").val(),link=$(this).children("input.file-link").val(),target=$(this).find("label.active").data("name"),c.length>0||description.length>0||link.length>0||was_custom_sort||is_custom_sort&&3===active_gallery_sort){var b=$(this).closest("tr").data("name");a[b]={},c.length>0&&(a[b].title=c),description.length>0&&(a[b].description=description),link.length>0&&(a[b].link=link,"auto"!==target&&(a[b].target=target)),is_custom_sort&&3===active_gallery_sort?(was_custom_sort=!0,a[b].index=parseInt($(this).closest("tr").attr("data-custom")),$(this).closest("tr").attr("data-original-custom",$(this).closest("tr").attr("data-custom"))):was_custom_sort&&(a[b].index=parseInt($(this).closest("tr").attr("data-original-custom")))}}),a}function setMenuActive(a){$(".navbar-nav > li.active").removeClass("active"),$(a).addClass("active")}function createContextMenu(){$("body").append('<div id="context-menu" style="" class="dropdown">\n	<ul class="dropdown-menu" role="menu" aria-labelledby="context-menu">\n	<li role="presentation" class="dropdown-header">Content</li>\n	<li role="presentation" class=cm-rename><a role="menuitem" tabindex="-1"><span class="glyphicon glyphicon-pencil"></span>'+language.Rename+'</a></li>\n	<li role="presentation" class="cm-delete"><a role="menuitem" tabindex="-1"><span class="glyphicon glyphicon-remove"></span>'+language.Delete+'</a></li>\n	<li role="presentation" class=cm-move><a role="menuitem" tabindex="-1"><span class="glyphicon glyphicon-move"></span>'+language.Move+'</a></li>\n	<li role="presentation" class=cm-copy><a role="menuitem" tabindex="-1"><span class="glyphicon glyphicon-transfer"></span>'+language.Copy+'</a></li>\n	<li role="presentation" class=cm-upload><a role="menuitem" tabindex="-1"><span class="glyphicon glyphicon-plus"></span>'+language.Upload+'</a></li>\n	<li role="presentation" class=cm-new><a role="menuitem" tabindex="-1"><span class="glyphicon glyphicon-file"></span>'+language.Create_New_Folder+"</a></li>\n	</ul>\n	</div>");var a=$("#context-menu");a.find("li.cm-rename > a, li.cm-move > a, li.cm-copy > a").click(function(c){c.preventDefault();var d=here;here=a.data("path").replace(/\/$/,"");var b=$(".modal#showConf");b.on("hidden.bs.modal",function(a){setTimeout(function(){here=d},1),b.off("hidden.bs.modal")})}),a.find("li.cm-delete > a").click(function(b){b.preventDefault(),remove_dir(a.data("path"),a.data("name"),"first"),$("#showConf").modal("show")}),a.find("li.cm-rename > a").click(function(b){b.preventDefault(),rename_dir(a.data("path"),a.data("name"),"first"),$("#showConf").modal("show")}),a.find("li.cm-move > a").click(function(b){b.preventDefault(),rename_dir(a.data("path"),a.data("name"),"move"),$("#showConf").modal("show")}),a.find("li.cm-copy > a").click(function(b){b.preventDefault(),copy_dir(a.data("path"),a.data("name"),"first"),$("#showConf").modal("show")}),a.find("li.cm-upload > a").click(function(c){c.preventDefault(),showUploader(a.data("path"));var b=$(".modal#uploader"),d=b.find(".modal-title").text();b.find(".modal-title").text("Upload to "+a.data("name")),b.find(".modal-footer > button").hide(),b.find(".modal-footer").append('<button type="button" class="btn btn-default btn-temp" data-dismiss="modal" onclick="show_preloader(); setTimeout(function(){loading_from_file = false; hide_preloader(); have_action = \'yes\'; showFileManager(\''+a.data("path")+"')}, 1000);\">Click to see uploaded files.</button>"),b.on("hidden.bs.modal",function(a){$(this).find(".modal-title").text(d),$(this).find(".modal-footer > button.btn-temp").remove(),$(this).find(".modal-footer > button").show(),b.off("hidden.bs.modal")}),b.modal("show")}),a.find("li.cm-new > a").click(function(b){b.preventDefault(),$("#newFolder").data("there",a.data("path")),$("#newFolder").modal("show")}),$("body").on("show.bs.modal","#newFolder",function(b){var a=($(this).data("there")||here)+"//";$(this).find("label > span.path").text(a.replace(/\.\.\//g,"").replace(/\.\//g,"").replace("content/","").replace("///","").replace("//",""))}).on("hidden.bs.modal","#newFolder",function(a){$(this).removeData("there")})}function createMtree(){var a=$("#left_folder_menu_box > ul");a.mtree({use_nodes:!0,skip_init:!1,close_same_level:!1}),json_menu=[],protectPageAfter(),a.find("a").each(function(e,f){var b=$(this).text(),c=b.split("."),d=c.length>1&&$.isNumeric(c[0])?"is-numeric":"is-hidden";$(this).parent("li").addClass(d),$(this).parent("li").attr("id","menu_"+b.replace(".","_")),$(this).parent("li").append('<span class=mtree-tools>&nbsp;<span class="glyphicon glyphicon-wrench"></span></span>');var a=$(this).data("href").replace("../../content/","").replace("../content/","").split("/");$.each(a,function(c,b){b.indexOf(".")>-1&&$.isNumeric(b.split(".")[0])&&(a[c]=b.split(".")[1])}),a=a.join("/").replace(/\/?$/,"/").replace("index/",""),a.length>0&&0!=a.indexOf("custom/")&&0!=a.indexOf("services/")&&json_menu.push({link:a,label:a})}),cf_load(),$("#menu-expand").length<1&&a.prepend("<button id=menu-expand>+ "+language.Menu_Expand+"</button>"),$("#context-menu").length<1&&createContextMenu(),supports_local_storage()&&null!==localStorage.getItem("mtree_state")&&(mtree_menu_open=JSON.parse(localStorage.getItem("mtree_state")),mtree_menu_open.length>0&&(mtree_menu_expanded=!0,$("#menu-expand").text("- "+language.Menu_Collapse))),mtreeEvents()}function updateMtree(){var a=$("#left_folder_menu_box > ul");a.mtree({use_nodes:!1,skip_init:!0,close_same_level:!1}),mtreeEvents()}function toggleMenuFixed(){clearTimeout(fixed_timer),fixed_timer=setTimeout(function(){var a=$("#menu-container");$.isScrollToFixed(a)&&a.height()>$(window).height()-100?a.trigger("detach.ScrollToFixed"):!$.isScrollToFixed(a)&&a.height()<$(window).height()-100&&a.scrollToFixed({zIndex:2,marginTop:40})},300)}function mtreeEvents(){var a=$("#left_folder_menu_box > ul");a.on("click",".mtree-icon",function(){mtreeSaveState(),toggleMenuFixed()}),mtreeLoadState(),a.hoverIntent({over:function(c){var b=$(this).siblings(".mtree-tools");b.addClass("current_intent"),a.find(".current_hover").not(".current_intent").hide().removeClass("current_hover"),b.hasClass("current_hover")||b.velocity({opacity:1},{duration:200,display:"block"}).addClass("current_hover"),b.removeClass("current_intent")},out:function(){},selector:"a"}).on("mouseover","a",function(b){a.contextmenu("closemenu",b),$("#context-menu").off("mouseleave.closemenu"),a.find("li.current-li-active").removeClass("current-li-active"),$(this).parent("li").addClass("current-li-active")}).on("mouseleave",function(b){a.find(".current_hover").hide().removeClass("current_hover")}),a.hoverIntent({over:function(b){a.contextmenu("show",b),$("#context-menu").on("mouseleave.closemenu",function(b){a.contextmenu("closemenu",b),$("#context-menu").off("mouseleave.closemenu")})},out:function(){},selector:".mtree-tools"}),a.find("a").click(function(a){a.preventDefault(),$(".mtree").find(".menu_active").removeClass("menu_active"),$(this).parent("li").addClass("menu_active"),showFileManager($(this).data("href"))});var b=$("#context-menu");a.contextmenu({target:"#context-menu",before:function(g,h){g.preventDefault();var d=a.find(".current-li-active");d.addClass("current-context-active");var c=d.children("a").data("href"),e=c.split("/"),f=e[e.length-1];return b.data("path",c),b.data("name",f),b.find(".dropdown-header").text(f),b.find(".disabled").removeClass("disabled"),c.indexOf("/custom/")>-1?b.find(".cm-rename, .cm-delete, .cm-move, .cm-copy, .cm-new").addClass("disabled"):c.indexOf("/custom")>-1?b.find(".cm-rename, .cm-delete, .cm-move, .cm-upload, .cm-new").addClass("disabled"):(c.indexOf(".index")>-1||c.indexOf("/index")>-1)&&b.find(".cm-new").addClass("disabled"),!0}}),b.on("hide.bs.context",function(){a.find(".current-context-active").removeClass("current-context-active")}),$("#menu-expand").click(function(c){mtree_menu_expanded?a.find(".mtree-open").removeClass("mtree-open mtree-active").addClass("mtree-closed").children("ul").css({height:"0px",display:"none"}):a.find(".mtree-closed").removeClass("mtree-closed").addClass("mtree-open").children("ul").css({height:"auto",display:"block"}),mtree_menu_expanded=!mtree_menu_expanded;var b=mtree_menu_expanded?"- "+language.Menu_Collapse:"+ "+language.Menu_Expand;$(this).text(b),toggleMenuFixed(),mtreeSaveState()}),mtreeActive(),a.show()}function mtreeActive(){var a=$("#left_folder_menu_box > ul");a.find(".menu_active").removeClass("menu_active"),a.find('a[data-href="'+here.replace(/\/+$/,"")+'"]').parent("li").addClass("menu_active")}function mtreeSaveState(){var a=$("ul.mtree");mtree_menu_open.length=0,a.find(".mtree-open").each(function(a,b){mtree_menu_open.push($(this).attr("id"))}),supports_local_storage()&&localStorage.setItem("mtree_state",JSON.stringify(mtree_menu_open)),mtree_menu_open.length>0?(mtree_menu_expanded=!0,$("#menu-expand").text("- "+language.Menu_Collapse)):(mtree_menu_expanded=!1,$("#menu-expand").text("+ "+language.Menu_Expand))}function mtreeLoadState(){var a=$("ul.mtree");$.each(mtree_menu_open,function(c,b){a.find("#"+b).has("ul").removeClass("mtree-closed").addClass("mtree-open").children("ul").css({height:"auto",display:"block"})})}function supports_local_storage(){try{return"localStorage"in window&&null!==window.localStorage}catch(a){return!1}}function x3BeforeShowFileManager(){var a=$(".x3-manager").height();$("#content_show").css("height",a),$(document).scrollTop()>300&&$("html, body").velocity("scroll",{duration:600,easing:"easeInOutCubic"})}function x3ShowFileManager(){var a=supports_local_storage()&&null!==localStorage.getItem("current_page")?localStorage.getItem("current_page"):"";here=a,showFileManager(a)}function x3AfterShowFileManager(a){if(!supports_local_storage()||supports_local_storage()&&"hide"!==localStorage.getItem("help-"+a)){var h=a.split("/").pop(),b=$(".manage_box_show > .col-md-9 > hr");"3.examples"==h?b.after(x3_help["page-examples"]):-1!==a.indexOf("content/1.index")?b.after(x3_help["page-index"]):-1!==a.indexOf("content/custom/logo")?b.after(x3_help["page-logo"]):-1!==a.indexOf("content/custom/audio")?b.after(x3_help["page-audio"]):-1!==a.indexOf("content/custom/404")?b.after(x3_help["page-404"]):-1!==a.indexOf("content/custom/favicon")?b.after(x3_help["page-favicon"]):-1!==a.indexOf("content/custom")?b.after(x3_help["page-custom"]):-1!==a.indexOf("examples/assets")?b.after(x3_help["page-assets"]):a.length<1&&b.after(x3_help["page-content"]),b.siblings(".alert").data("path",a)}var g=$(".table.manage-table > .popup-parent").children("tr");current_folder_images=[],g.length&&g.each(function(a,b){1==$(this).data("isimage")&&current_folder_images.push($(this).data("name"))});var d=$("#menu-container");!$.isScrollToFixed(d)&&d.height()<$(window).height()-100&&d.scrollToFixed({zIndex:2,marginTop:40}),supports_local_storage()&&localStorage.setItem("current_page",a),x3TabManager(),$("#content_show").css("height","");var c=a.replace("../../content/","").replace("../content/","").split("/");c[c.length-1];$.each(c,function(b,a){a.indexOf(".")>-1&&$.isNumeric(a.split(".")[0])&&(c[b]=a.split(".")[1])}),c=c.join("/").replace(/\/?$/,"/").replace("index/",""),$(".current-folder-btns").append('<a type=button href="../'+c+'" target=_blank class="view-page btn btn-default btn-sm" title="'+language.View_Page+'"><span class="glyphicon glyphicon-new-window"></span></a>'),files_checked=!1,$(".selected-actions button").addClass("disabled"),x3SetSelected(),x3SetByteSize(),setPreviewImageActive(),was_custom_sort=!1,is_custom_sort=!1;var e=0,f=0;$(".manage-table tr").each(function(b,g){$(this).attr("data-sort",b);var a=$(this).is('[data-isfile="0"]')?!0:!1;$(this).addClass(a?"is-folder":"is-file"),a?e++:f++;var c=b-9999;if(!a&&$(this).data("name")in page_settings&&void 0!==page_settings[$(this).data("name")].index){var c=page_settings[$(this).data("name")].index;was_custom_sort=!0}if($(this).attr("data-custom",String(c)),$(this).attr("data-original-custom",String(c)),$(this).is('[data-isimage="1"]')){var d=$(this).find("ul.dropdown-menu");d.children('[role="presentation"]').after("<li><a href=# class=set-preview>Set as preview image</a></li>"),$(this).children(".td-name").prepend('<span class="fa fa-flag set-preview" title="Set as folder preview image"></span>')}}),$("div.manage-container").addClass(e>0?"has-folders":"no-folders").addClass(f>0?"has-files":"no-files").toggleClass("is-empty",0===e&&0===f),x3SetSort(active_gallery_sort,0==active_gallery_sort?!0:!1),x3FileManagerThumbs(),x3FileManagerView(active_gallery_view),$(".manage-list-buttons > .selected-actions").css("min-height",$(".manage-list-buttons > .list-actions").outerHeight(!0)),$(".manage-list-buttons").scrollToFixed({zIndex:5})}function updatePreviewImage(a){var b=a?a.data("name"):null;setTimeout(function(){save_inject({image:b},function(d){if(d&&a){var c=$('input.form-control.selectized[name="image"]');c.length&&c[0].selectize.addItem(b,!0),a.addClass("preview-image")}},"Updated preview image: "+b,!1)},500)}function setPreviewImageActive(){var d=$(".manage-table"),a=d.find('tr[data-isimage="1"]');if(d.find("tr.preview-image").removeClass("preview-image"),a.length)if(page_settings.image&&-1===page_settings.image.indexOf("/")){var b=a.filter('[data-name="'+page_settings.image+'"]');if(b.length)b.addClass("preview-image");else if(!page_settings.gallery.assets){var c=a.filter('[data-name="preview.jpg"]');b=c.length?c:a.first(),updatePreviewImage(b)}}else if(!page_settings.image&&a.length){var c=a.filter('[data-name="preview.jpg"]');b=c.length?c:a.first(),updatePreviewImage(b)}}function x3FileManagerThumbs(){var a=[];$(".manage-table tr").each(function(b,i){var e=String($(this).data("name")).split("."),f="0"==$(this).data("isfile")&&e.length>1&&$.isNumeric(e[0])||"1"==$(this).data("isfile")&&0!==$(this).data("name").indexOf("__")?"is-visible":"is-hidden";$(this).addClass(f),a[b]={name:$(this).data("name"),path:$(this).data("path").replace("../content/../content/","../content/"),encoded:$(this).data("encoded"),ext:$(this).data("ext"),isfile:$(this).data("isfile"),isimage:$(this).data("isimage")};var c;if(-1!==$.inArray(a[b].ext.toLowerCase(),["jpg","jpeg","png","gif"])){var g=window.devicePixelRatio>1?"200":"100",h=a[b].path.replace("../../","../").replace("content","render/w"+g+"-c1:1-q90");c='<td class="td-thumb td-jpg"><span class="glyphicon glyphicon-picture"></span><a href="'+a[b].path.replace("../../","../")+'" class="popup" data-width="'+$(this).find("a.popup").data("width")+'" data-height="'+$(this).find("a.popup").data("height")+'" data-name="'+$(this).find("a.popup").data("name")+'" data-filesize="'+$(this).find("a.popup").data("filesize")+'" rel="group2"><img src="'+h+'" /></a></td>',$(this).find(".td-name a").attr("href",a[b].path.replace("../../","../"))}else c="mp4"==a[b].ext.toLowerCase()?'<td class="td-thumb td-file"><span class="fa fa-film"></span></td>':"1"==a[b].isimage?'<td class="td-thumb td-picture"><span class="glyphicon glyphicon-picture"></span></td>':"1"==a[b].isfile?'<td class="td-thumb td-file"><span class="glyphicon glyphicon-file"></span></td>':'<td class="td-thumb td-folder"><span class="glyphicon glyphicon-folder-close"></span></td>';if($(this).find(".td-checkbox").after(c),"1"==a[b].isfile){var c=$(this).children(".td-name");if(c.append('<div class="file-data"><i class="fa fa-question panel-help" data-help="image_title"></i><input type="text" class="form-control file-title" placeholder="Title"><i class="fa fa-question panel-help" data-help="image_description"></i><textarea class="form-control" rows="3" placeholder="Description"></textarea><a href=# class="fa fa-link" target=_blank></a><i class="fa fa-question panel-help" data-help="image_link"></i><input type="text" class="form-control file-link" placeholder="Link"><div class="btn-group btn-group-sm" data-toggle="buttons"><label class="btn btn-default active" data-name="auto"><input type="radio" checked>auto</label><label class="btn btn-default" data-name="_self"><input type="radio">_self</label><label class="btn btn-default" data-name="_blank"><input type="radio">_blank</label><label class="btn btn-default" data-name="popup"><input type="radio">popup window</label><label class="btn btn-default" data-name="x3_popup"><input type="radio">X3 popup</label></div></div>'),a[b].name in page_settings){var d=page_settings[a[b].name];d.title&&c.find("input.file-title").val(d.title),d.description&&c.find("textarea").val(d.description),d.link&&(c.children(".file-data").addClass("has-link"),c.find("input.file-link").val(d.link)),d.target&&"auto"!==d.target&&(c.find('label[data-name="auto"]').removeClass("active").children("input").prop("checked",!1),c.find('[data-name="'+d.target+'"]').addClass("active").children("input").prop("checked",!0))}}else $(this).children(".td-name").append('<div class="folder-data"><span class="glyphicon glyphicon-ban-circle" aria-hidden="true"></span></div>')}),setTimeout(function(){autosize($(".manage-table textarea"))},1)}function x3FileManagerView(a){var b=$(".manage-table").parent();b.removeClass("view-list view-small view-big view-edit view-grid").addClass("view-"+gallery_views[a][0]),$(".btn-view > span").removeClass().addClass("glyphicon glyphicon-"+gallery_views[a][1]),$(".manage-table .td-button button").removeClass("btn-xs btn-sm").addClass(gallery_views[a][2]),x3ToggleEditview(3==a)}function x3ToggleEditview(a){a?$(".manage-table").find('a, button, input[type="checkbox"]').prop("tabIndex",-1):$(".manage-table").find('a, button, input[type="checkbox"]').prop("tabIndex",!0)}function x3TabManager(){var b=$("#myTab"),a=b.find('a[href="'+active_page_tab+'"]');a.is(":visible")?a.tab("show"):a.parent("li").siblings(":visible").children("a").tab("show")}function select_all(){files_checked=!files_checked,$(".td-checkbox>input").prop("checked",files_checked),selected.length=0,files_checked&&$(".manage-table tr").each(function(a,b){selected.push($(this).data("name"))}),$(".manage-table tr").toggleClass("is-checked",files_checked),updateSelectAll(),selectUpdate(),x3SaveSelected()}function updateSelectAll(){var a=$("#select_all"),b=files_checked?a.data("unselect"):a.data("select");a.toggleClass("active",files_checked).data("title",b),$(".list-actions > .button-helper").text(b)}function selectUpdate(){var a=$(".manage-table input:checkbox:checked").length;console.log("amount: "+a);var b=$(".manage-table input:checkbox").length,c=$(".manage-list-buttons .selected-text"),d=a>0?!0:!1;c.text(a+" "+c.data("lang")).toggleClass("has-selection",a>0),$(".selected-actions button").toggleClass("disabled",!d).toggleClass("btn-primary",d),files_checked&&b>a?(files_checked=!1,updateSelectAll()):files_checked||b!=a||(files_checked=!0,updateSelectAll())}function x3SaveSelected(){page_selected_items[here]=[],$(".manage-table tr").each(function(a,b){$(this).hasClass("is-checked")&&page_selected_items[here].push($(this).data("name"))}),supports_local_storage()&&localStorage.setItem("selected_"+here,JSON.stringify(page_selected_items[here]))}function x3SetSelected(){var a=[];if(void 0!=page_selected_items[here]&&page_selected_items[here].length>0?a=page_selected_items[here]:supports_local_storage()&&null!==localStorage.getItem("selected_"+here)&&(a=JSON.parse(localStorage.getItem("selected_"+here))),a.length>0){selected.length=0;var b=$(".manage-table");$.each(a,function(d,c){var a=b.find('tr[data-name="'+c+'"]');a.length&&(a.addClass("is-checked").find(".td-checkbox > input").prop("checked",!0),selected.push(a.data("name")))}),x3SaveSelected(),selectUpdate()}}function x3SetByteSize(){$(".manage-table tr").each(function(b,c){var a=$(this).data("filesize")||"";a.indexOf("GB")>-1?a=1e9*parseInt(a):a.indexOf("MB")>-1?a=1e6*parseInt(a):a.indexOf("KB")>-1&&(a=1e3*parseInt(a)),$(this).attr("data-filesize",parseInt(a)),$(this).data("filesize",parseInt(a))})}function x3SetSort(d,e){var a=gallery_sort[d][0],b=$("div.manage-container"),c=[];$(".manage-table tr").each(function(b,d){c.push(String($(this).attr("data-"+a)))}),c.sort(function(b,c){return"sort"==a?c-b:"filesize"==a?b-c:"date"==a?new Date(b)-new Date(c):"custom"==a?parseInt(c)-parseInt(b):void 0}),e!==!0&&$.each(c,function(c,b){$(".manage-table tr[data-"+a+'="'+b+'"][data-isfile="1"]').not(".sorted").last().addClass("sorted").prependTo($(".manage-table tbody"))}),$.each(c,function(c,b){$(".manage-table tr[data-"+a+'="'+b+'"][data-isfile="0"]').not(".sorted").last().addClass("sorted").prependTo($(".manage-table tbody"))}),$(".manage-table tr").removeClass("sorted"),toggleSortButton(d),"custom"===a?b.hasClass("custom-sort")||(b.prepend('<div class=custom-sort-help><a href=# class="text-help" data-help="custom_sort">Custom Sort</a><span class="can-sort"> - Drag items into order, and click <em>save</em>.</span><em class="cannot-sort"> * This folder does not contain any files to sort.</em></div>'),b.addClass("custom-sort"),mysortable=Sortable.create($(".manage-table > tbody")[0],{filter:".is-folder",draggable:".is-file",animation:100,ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",onStart:function(a){b.addClass("is-sorting")},onEnd:function(a){b.removeClass("is-sorting")},onUpdate:function(a){is_custom_sort=!0,$(".manage-table tr").each(function(a,b){$(this).attr("data-custom",String(a))})}})):b.hasClass("custom-sort")&&(b.children(".custom-sort-help").remove(),b.removeClass("custom-sort"),mysortable.destroy())}function toggleSortButton(b){var a=$(".btn-sort");a.html('<span class="glyphicon glyphicon-sort'+gallery_sort[b][1]+'"></span> '+a.data(gallery_sort[b][0])).data("title",a.data("sortby")+" "+a.data(gallery_sort[active_gallery_sort][0]))}function x3NavPage(){if(current_nav="fileManager",supports_local_storage()){var a=localStorage.getItem("current_nav");null!==a?"setting"==a?(showSetting(),current_nav="setting"):"users"==a?(showUsers(),current_nav="users"):"editProfile"==a?(showEditProfile(),current_nav="editProfile"):"protect"==a?(protectPage(),current_nav="protect"):"tools"==a?(showTools(),current_nav="tools"):"auth"==a?(authPage(),current_nav="auth"):x3ShowFileManager():x3ShowFileManager()}else x3ShowFileManager()}function x3Notifier(b,c,d,a){var e="danger"==a?"ban":"warning"==a?"warning":"check";$.bootstrapGrowl('<i class="fa fa-'+e+'"></i>&nbsp;&nbsp;'+b||"nothing.",{type:a||"info x3-note",offset:{from:"bottom",amount:20},align:"right",width:d||"auto",delay:c||1e3,allow_dismiss:!1})}function x3UpdateSettings(a){$.extend(x3_settings,a),supports_local_storage()&&localStorage.setItem("x3_settings",JSON.stringify(x3_settings))}function preventJSClick(a){return(a.which>1||a.metaKey||a.ctrlKey||a.shiftKey||a.altKey)&&void 0!==a.currentTarget.href&&a.currentTarget.href.length>0?!0:void 0}!function(a){a.fn.hoverIntent=function(c,h,l){var b={interval:100,sensitivity:6,timeout:0};b="object"==typeof c?a.extend(b,c):a.isFunction(h)?a.extend(b,{over:c,out:h,selector:l}):a.extend(b,{over:c,out:c,selector:h});var f,g,e,d,i=function(a){f=a.pageX,g=a.pageY},j=function(h,c){return c.hoverIntent_t=clearTimeout(c.hoverIntent_t),Math.sqrt((e-f)*(e-f)+(d-g)*(d-g))<b.sensitivity?(a(c).off("mousemove.hoverIntent",i),c.hoverIntent_s=!0,b.over.apply(c,[h])):(e=f,d=g,c.hoverIntent_t=setTimeout(function(){j(h,c)},b.interval),void 0)},m=function(c,a){return a.hoverIntent_t=clearTimeout(a.hoverIntent_t),a.hoverIntent_s=!1,b.out.apply(a,[c])},k=function(g){var f=a.extend({},g),c=this;c.hoverIntent_t&&(c.hoverIntent_t=clearTimeout(c.hoverIntent_t)),"mouseenter"===g.type?(e=f.pageX,d=f.pageY,a(c).on("mousemove.hoverIntent",i),c.hoverIntent_s||(c.hoverIntent_t=setTimeout(function(){j(f,c)},b.interval))):(a(c).off("mousemove.hoverIntent",i),c.hoverIntent_s&&(c.hoverIntent_t=setTimeout(function(){m(f,c)},b.timeout)))};return this.on({"mouseenter.hoverIntent":k,"mouseleave.hoverIntent":k},b.selector)}}(jQuery),function(a){"use strict";var c='[data-toggle="context"]',b=function(c,b){this.$element=a(c),this.before=b.before||this.before,this.onItem=b.onItem||this.onItem,this.scopes=b.scopes||null,b.target&&this.$element.data("target",b.target),this.listen()};b.prototype={constructor:b,show:function(b){var c,g,d,e,f={relatedTarget:this,target:b.currentTarget};if(!this.isDisabled()&&(this.closemenu(),this.before.call(this,b,a(b.currentTarget))))return c=this.getMenu(),c.trigger(g=a.Event("show.bs.context",f)),d=this.getPosition(b,c),e="li:not(.divider)",c.attr("style","").css(d).addClass("open").on("click.context.data-api",e,a.proxy(this.onItem,this,a(b.currentTarget))).trigger("shown.bs.context",f),a("html").on("click.context.data-api",c.selector,a.proxy(this.closemenu,this)),!1},closemenu:function(f){var b,e,d,c;return b=this.getMenu(),b.hasClass("open")?(c={relatedTarget:this},b.trigger(e=a.Event("hide.bs.context",c)),d="li:not(.divider)",b.removeClass("open").off("click.context.data-api",d).trigger("hidden.bs.context",c),a("html").off("click.context.data-api",b.selector),!1):void 0},keydown:function(a){27==a.which&&this.closemenu(a)},before:function(a){return!0},onItem:function(a){return!0},listen:function(){this.$element.on("contextmenu.context.data-api",this.scopes,a.proxy(this.show,this)),a("html").on("click.context.data-api",a.proxy(this.closemenu,this)),a("html").on("keydown.context.data-api",a.proxy(this.keydown,this))},destroy:function(){this.$element.off(".context.data-api").removeData("context"),a("html").off(".context.data-api")},isDisabled:function(){return this.$element.hasClass("disabled")||this.$element.attr("disabled");
  },getMenu:function(){var c,b=this.$element.data("target");return b||(b=this.$element.attr("href"),b=b&&b.replace(/.*(?=#[^\s]*$)/,"")),c=a(b),c&&c.length?c:this.$element.find(b)},getPosition:function(j,g){var b,c,f,d=j.clientX,e=j.clientY,l=a(window).width(),k=a(window).height(),h=g.find(".dropdown-menu").outerWidth(),i=g.find(".dropdown-menu").outerHeight(),m={position:"absolute","z-index":9999};return b=e+i>k?{top:e-i+a(window).scrollTop()}:{top:e+a(window).scrollTop()},c=d+h>l&&d-h>0?{left:d-h+a(window).scrollLeft()}:{left:d+a(window).scrollLeft()},f=g.offsetParent().offset(),c.left=c.left-f.left,b.top=b.top-f.top,a.extend(m,b,c)}},a.fn.contextmenu=function(c,d){return this.each(function(){var f=a(this),e=f.data("context"),g="object"==typeof c&&c;e||f.data("context",e=new b(f,g)),"string"==typeof c&&e[c].call(e,d)})},a.fn.contextmenu.Constructor=b,a(document).on("contextmenu.context.data-api",function(){a(c).each(function(){var b=a(this).data("context");b&&b.closemenu()})}).on("contextmenu.context.data-api",c,function(b){a(this).contextmenu("show",b),b.preventDefault(),b.stopPropagation()})}(jQuery),function(){var a;a=jQuery,a.bootstrapGrowl=function(f,b){var c,e,d;switch(b=a.extend({},a.bootstrapGrowl.default_options,b),c=a("<div>"),c.attr("class","bootstrap-growl alert"),b.type&&c.addClass("alert-"+b.type),b.allow_dismiss&&c.append('<a class="close" data-dismiss="alert" href="#">&times;</a>'),c.append(f),b.top_offset&&(b.offset={from:"top",amount:b.top_offset}),d=b.offset.amount,a(".bootstrap-growl").each(function(){return d=Math.max(d,parseInt(a(this).css(b.offset.from))+a(this).outerHeight()+b.stackup_spacing)}),e={position:"body"===b.ele?"fixed":"absolute",margin:0,"z-index":"9999",display:"none"},e[b.offset.from]=d+"px",c.css(e),"auto"!==b.width&&c.css("width",b.width+"px"),a(b.ele).append(c),b.align){case"center":c.css({left:"50%","margin-left":"-"+c.outerWidth()/2+"px"});break;case"left":c.css("left","20px");break;default:c.css("right","20px")}return c.fadeIn(),b.delay>0?c.delay(b.delay).fadeOut(function(){return a(this).remove()}):void 0},a.bootstrapGrowl.default_options={ele:"body",type:null,offset:{from:"top",amount:20},align:"right",width:250,delay:4e3,allow_dismiss:!0,stackup_spacing:10}}.call(this),function(b,a){"function"==typeof define&&define.amd?define("sifter",a):"object"==typeof exports?module.exports=a():b.Sifter=a()}(this,function(){var a=function(a,b){this.items=a,this.settings=b||{diacritics:!0}};a.prototype.tokenize=function(a){if(a=g(String(a||"").toLowerCase()),!a||!a.length)return[];var c,i,d,e,j=[],f=a.split(/ +/);for(c=0,i=f.length;i>c;c++){if(d=h(f[c]),this.settings.diacritics)for(e in b)b.hasOwnProperty(e)&&(d=d.replace(new RegExp(e,"g"),b[e]));j.push({string:f[c],regex:new RegExp(d,"i")})}return j},a.prototype.iterator=function(a,d){var b;b=c(a)?Array.prototype.forEach||function(b){for(var a=0,c=this.length;c>a;a++)b(this[a],a,this)}:function(b){for(var a in this)this.hasOwnProperty(a)&&b(this[a],a,this)},b.apply(a,[d])},a.prototype.getScoreFunction=function(b,h){var f,d,c,a;f=this,b=f.prepareSearch(b,h),c=b.tokens,d=b.options.fields,a=c.length;var g=function(a,d){var b,c;return a?(a=String(a||""),c=a.search(d.regex),-1===c?0:(b=d.string.length/a.length,0===c&&(b+=.5),b)):0},e=function(){var a=d.length;return a?1===a?function(a,b){return g(b[d[0]],a)}:function(e,f){for(var b=0,c=0;a>b;b++)c+=g(f[d[b]],e);return c/a}:function(){return 0}}();return a?1===a?function(a){return e(c[0],a)}:"and"===b.options.conjunction?function(g){for(var b,d=0,f=0;a>d;d++){if(b=e(c[d],g),0>=b)return 0;f+=b}return f/a}:function(f){for(var b=0,d=0;a>b;b++)d+=e(c[b],f);return d/a}:function(){return 0}},a.prototype.getSortFunction=function(e,k){var a,c,l,j,b,h,n,i,f,m,g;if(l=this,e=l.prepareSearch(e,k),g=!e.query&&k.sort_empty||k.sort,f=function(a,b){return"$score"===a?b.score:l.items[b.id][a]},b=[],g)for(a=0,c=g.length;c>a;a++)(e.query||"$score"!==g[a].field)&&b.push(g[a]);if(e.query){for(m=!0,a=0,c=b.length;c>a;a++)if("$score"===b[a].field){m=!1;break}m&&b.unshift({field:"$score",direction:"desc"})}else for(a=0,c=b.length;c>a;a++)if("$score"===b[a].field){b.splice(a,1);break}for(i=[],a=0,c=b.length;c>a;a++)i.push("desc"===b[a].direction?-1:1);return h=b.length,h?1===h?(j=b[0].field,n=i[0],function(a,b){return n*d(f(j,a),f(j,b))}):function(g,j){var a,e,c;for(a=0;h>a;a++)if(c=b[a].field,e=i[a]*d(f(c,g),f(c,j)))return e;return 0}:null},a.prototype.prepareSearch=function(b,a){if("object"==typeof b)return b;a=f({},a);var d=a.fields,e=a.sort,g=a.sort_empty;return d&&!c(d)&&(a.fields=[d]),e&&!c(e)&&(a.sort=[e]),g&&!c(g)&&(a.sort_empty=[g]),{options:a,query:String(b||"").toLowerCase(),tokens:this.tokenize(b),total:0,items:[]}},a.prototype.search=function(d,b){var e,a,f,g,c=this;return a=this.prepareSearch(d,b),b=a.options,d=a.query,g=b.score||c.getScoreFunction(a),d.length?c.iterator(c.items,function(c,d){e=g(c),(b.filter===!1||e>0)&&a.items.push({score:e,id:d})}):c.iterator(c.items,function(c,b){a.items.push({score:1,id:b})}),f=c.getSortFunction(a,b),f&&a.items.sort(f),a.total=a.items.length,"number"==typeof b.limit&&(a.items=a.items.slice(0,b.limit)),a};var d=function(a,b){return"number"==typeof a&&"number"==typeof b?a>b?1:b>a?-1:0:(a=e(String(a||"")),b=e(String(b||"")),a>b?1:b>a?-1:0)},f=function(d,f){var a,e,b,c;for(a=1,e=arguments.length;e>a;a++)if(c=arguments[a])for(b in c)c.hasOwnProperty(b)&&(d[b]=c[b]);return d},g=function(a){return(a+"").replace(/^\s+|\s+$|/g,"")},h=function(a){return(a+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},c=Array.isArray||$&&$.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},b={a:"[aÀÁÂÃÄÅàáâãäåĀāąĄ]",c:"[cÇçćĆčČ]",d:"[dđĐďĎ]",e:"[eÈÉÊËèéêëěĚĒēęĘ]",i:"[iÌÍÎÏìíîïĪī]",l:"[lłŁ]",n:"[nÑñňŇńŃ]",o:"[oÒÓÔÕÕÖØòóôõöøŌō]",r:"[rřŘ]",s:"[sŠšśŚ]",t:"[tťŤ]",u:"[uÙÚÛÜùúûüůŮŪū]",y:"[yŸÿýÝ]",z:"[zŽžżŻźŹ]"},e=function(){var c,e,a,d,f="",g={};for(a in b)if(b.hasOwnProperty(a))for(d=b[a].substring(2,b[a].length-1),f+=d,c=0,e=d.length;e>c;c++)g[d.charAt(c)]=a;var h=new RegExp("["+f+"]","g");return function(a){return a.replace(h,function(a){return g[a]}).toLowerCase()}}();return a}),function(b,a){"function"==typeof define&&define.amd?define("microplugin",a):"object"==typeof exports?module.exports=a():b.MicroPlugin=a()}(this,function(){var a={};a.mixin=function(a){a.plugins={},a.prototype.initializePlugins=function(a){var c,g,d,f=this,e=[];if(f.plugins={names:[],settings:{},requested:{},loaded:{}},b.isArray(a))for(c=0,g=a.length;g>c;c++)"string"==typeof a[c]?e.push(a[c]):(f.plugins.settings[a[c].name]=a[c].options,e.push(a[c].name));else if(a)for(d in a)a.hasOwnProperty(d)&&(f.plugins.settings[d]=a[d],e.push(d));for(;e.length;)f.require(e.shift())},a.prototype.loadPlugin=function(b){var c=this,d=c.plugins,e=a.plugins[b];if(!a.plugins.hasOwnProperty(b))throw new Error('Unable to find "'+b+'" plugin');d.requested[b]=!0,d.loaded[b]=e.fn.apply(c,[c.plugins.settings[b]||{}]),d.names.push(b)},a.prototype.require=function(a){var b=this,c=b.plugins;if(!b.plugins.loaded.hasOwnProperty(a)){if(c.requested[a])throw new Error('Plugin has circular dependency ("'+a+'")');b.loadPlugin(a)}return c.loaded[a]},a.define=function(b,c){a.plugins[b]={name:b,fn:c}}};var b={isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}};return a}),function(a,b){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],b):"object"==typeof exports?module.exports=b(require("jquery"),require("sifter"),require("microplugin")):a.Selectize=b(a.jQuery,a.Sifter,a.MicroPlugin)}(this,function(a,t,v){"use strict";var u=function(d,a){if("string"!=typeof a||a.length){var b="string"==typeof a?new RegExp(a,"i"):a,c=function(a){var g=0;if(3===a.nodeType){var h=a.data.search(b);if(h>=0&&a.data.length>0){var i=a.data.match(b),f=document.createElement("span");f.className="highlight";var d=a.splitText(h),j=(d.splitText(i[0].length),d.cloneNode(!0));f.appendChild(j),d.parentNode.replaceChild(f,d),g=1}}else if(1===a.nodeType&&a.childNodes&&!/(script|style)/i.test(a.tagName))for(var e=0;e<a.childNodes.length;++e)e+=c(a.childNodes[e]);return g};return d.each(function(){c(this)})}},h=function(){};h.prototype={on:function(a,b){this._events=this._events||{},this._events[a]=this._events[a]||[],this._events[a].push(b)},off:function(a,c){var b=arguments.length;return 0===b?delete this._events:1===b?delete this._events[a]:(this._events=this._events||{},void(a in this._events!=!1&&this._events[a].splice(this._events[a].indexOf(c),1)))},trigger:function(a){if(this._events=this._events||{},a in this._events!=!1)for(var b=0;b<this._events[a].length;b++)this._events[a][b].apply(this,Array.prototype.slice.call(arguments,1))}},h.mixin=function(c){for(var b=["on","off","trigger"],a=0;a<b.length;a++)c.prototype[b[a]]=h.prototype[b[a]]};var e=/Mac/.test(navigator.userAgent),z=65,C=13,F=27,k=37,x=38,y=80,n=39,A=40,B=78,f=8,l=46,H=16,s=e?91:17,L=e?18:17,m=9,g=1,w=2,r=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("form").validity,p=function(a){return"undefined"!=typeof a},c=function(a){return"undefined"==typeof a||null===a?null:"boolean"==typeof a?a?"1":"0":a+""},d=function(a){return(a+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},o=function(a){return(a+"").replace(/\$/g,"$$$$")},i={};i.before=function(a,b,c){var d=a[b];a[b]=function(){return c.apply(a,arguments),d.apply(a,arguments)}},i.after=function(a,b,c){var d=a[b];a[b]=function(){var b=d.apply(a,arguments);return c.apply(a,arguments),b}};var D=function(b){var a=!1;return function(){a||(a=!0,b.apply(this,arguments))}},E=function(b,c){var a;return function(){var d=this,e=arguments;window.clearTimeout(a),a=window.setTimeout(function(){b.apply(d,e)},c)}},q=function(a,e,f){var c,d=a.trigger,b={};a.trigger=function(){var c=arguments[0];return-1===e.indexOf(c)?d.apply(a,arguments):void(b[c]=arguments)},f.apply(a,[]),a.trigger=d;for(c in b)b.hasOwnProperty(c)&&d.apply(a,b[c])},G=function(a,b,c,d){a.on(b,c,function(c){for(var b=c.target;b&&b.parentNode!==a[0];)b=b.parentNode;return c.currentTarget=b,d.apply(this,[c])})},j=function(b){var a={};if("selectionStart"in b)a.start=b.selectionStart,a.length=b.selectionEnd-a.start;else if(document.selection){b.focus();var c=document.selection.createRange(),d=document.selection.createRange().text.length;c.moveStart("character",-b.value.length),a.start=c.text.length-d,a.length=d}return a},I=function(d,f,b){var a,e,c={};if(b)for(a=0,e=b.length;e>a;a++)c[b[a]]=d.css(b[a]);else c=d.css();f.css(c)},J=function(c,d){if(!c)return 0;var b=a("<test>").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).text(c).appendTo("body");I(d,b,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]);var e=b.width();return b.remove(),e},K=function(a){var b=null,c=function(g,k){var c,d,n,m,i,o,h,e;g=g||window.event||{},k=k||{},g.metaKey||g.altKey||(k.force||a.data("grow")!==!1)&&(c=a.val(),g.type&&"keydown"===g.type.toLowerCase()&&(d=g.keyCode,n=d>=97&&122>=d||d>=65&&90>=d||d>=48&&57>=d||32===d,d===l||d===f?(e=j(a[0]),e.length?c=c.substring(0,e.start)+c.substring(e.start+e.length):d===f&&e.start?c=c.substring(0,e.start-1)+c.substring(e.start+1):d===l&&"undefined"!=typeof e.start&&(c=c.substring(0,e.start)+c.substring(e.start+1))):n&&(o=g.shiftKey,h=String.fromCharCode(g.keyCode),h=o?h.toUpperCase():h.toLowerCase(),c+=h)),m=a.attr("placeholder"),!c&&m&&(c=m),i=J(c,a)+4,i!==b&&(b=i,a.width(i),a.triggerHandler("resize")))};a.on("keydown keyup update blur",c),c()},b=function(f,h){var d,i,j,e,c=this;e=f[0],e.selectize=c;var k=window.getComputedStyle&&window.getComputedStyle(e,null);if(j=k?k.getPropertyValue("direction"):e.currentStyle&&e.currentStyle.direction,j=j||f.parents("[dir]:first").attr("dir")||"",a.extend(c,{order:0,settings:h,$input:f,tabIndex:f.attr("tabindex")||"",tagType:"select"===e.tagName.toLowerCase()?g:w,rtl:/rtl/i.test(j),eventNS:".selectize"+ ++b.count,highlightedValue:null,isOpen:!1,isDisabled:!1,isRequired:f.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===h.loadThrottle?c.onSearchChange:E(c.onSearchChange,h.loadThrottle)}),c.sifter=new t(this.options,{diacritics:h.diacritics}),c.settings.options){for(d=0,i=c.settings.options.length;i>d;d++)c.registerOption(c.settings.options[d]);delete c.settings.options}if(c.settings.optgroups){for(d=0,i=c.settings.optgroups.length;i>d;d++)c.registerOptionGroup(c.settings.optgroups[d]);delete c.settings.optgroups}c.settings.mode=c.settings.mode||(1===c.settings.maxItems?"single":"multi"),"boolean"!=typeof c.settings.hideSelected&&(c.settings.hideSelected="multi"===c.settings.mode),c.initializePlugins(c.settings.plugins),c.setupCallbacks(),c.setupTemplates(),c.setup()};return h.mixin(b),v.mixin(b),a.extend(b.prototype,{setup:function(){var j,k,f,h,t,q,n,o,l,b=this,d=b.settings,i=b.eventNS,p=a(window),m=a(document),c=b.$input;if(n=b.settings.mode,o=c.attr("class")||"",j=a("<div>").addClass(d.wrapperClass).addClass(o).addClass(n),k=a("<div>").addClass(d.inputClass).addClass("items").appendTo(j),f=a('<input type="text" autocomplete="off" />').appendTo(k).attr("tabindex",c.is(":disabled")?"-1":b.tabIndex),q=a(d.dropdownParent||j),h=a("<div>").addClass(d.dropdownClass).addClass(n).hide().appendTo(q),t=a("<div>").addClass(d.dropdownContentClass).appendTo(h),b.settings.copyClassesToDropdown&&h.addClass(o),j.css({width:c[0].style.width}),b.plugins.names.length&&(l="plugin-"+b.plugins.names.join(" plugin-"),j.addClass(l),h.addClass(l)),(null===d.maxItems||d.maxItems>1)&&b.tagType===g&&c.attr("multiple","multiple"),b.settings.placeholder&&f.attr("placeholder",d.placeholder),!b.settings.splitOn&&b.settings.delimiter){var u=b.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");b.settings.splitOn=new RegExp("\\s*"+u+"+\\s*")}c.attr("autocorrect")&&f.attr("autocorrect",c.attr("autocorrect")),c.attr("autocapitalize")&&f.attr("autocapitalize",c.attr("autocapitalize")),b.$wrapper=j,b.$control=k,b.$control_input=f,b.$dropdown=h,b.$dropdown_content=t,h.on("mouseenter","[data-selectable]",function(){return b.onOptionHover.apply(b,arguments)}),h.on("mousedown click","[data-selectable]",function(){return b.onOptionSelect.apply(b,arguments)}),G(k,"mousedown","*:not(input)",function(){return b.onItemSelect.apply(b,arguments)}),K(f),k.on({mousedown:function(){return b.onMouseDown.apply(b,arguments)},click:function(){return b.onClick.apply(b,arguments)}}),f.on({mousedown:function(a){a.stopPropagation()},keydown:function(){return b.onKeyDown.apply(b,arguments)},keyup:function(){return b.onKeyUp.apply(b,arguments)},keypress:function(){return b.onKeyPress.apply(b,arguments)},resize:function(){b.positionDropdown.apply(b,[])},blur:function(){return b.onBlur.apply(b,arguments)},focus:function(){return b.ignoreBlur=!1,b.onFocus.apply(b,arguments)},paste:function(){return b.onPaste.apply(b,arguments)}}),m.on("keydown"+i,function(a){b.isCmdDown=a[e?"metaKey":"ctrlKey"],b.isCtrlDown=a[e?"altKey":"ctrlKey"],b.isShiftDown=a.shiftKey}),m.on("keyup"+i,function(a){a.keyCode===L&&(b.isCtrlDown=!1),a.keyCode===H&&(b.isShiftDown=!1),a.keyCode===s&&(b.isCmdDown=!1)}),m.on("mousedown"+i,function(a){if(b.isFocused){if(a.target===b.$dropdown[0]||a.target.parentNode===b.$dropdown[0])return!1;b.$control.has(a.target).length||a.target===b.$control[0]||b.blur(a.target)}}),p.on(["scroll"+i,"resize"+i].join(" "),function(){b.isOpen&&b.positionDropdown.apply(b,arguments)}),p.on("mousemove"+i,function(){b.ignoreHover=!1}),this.revertSettings={$children:c.children().detach(),tabindex:c.attr("tabindex")},c.attr("tabindex",-1).hide().after(b.$wrapper),a.isArray(d.items)&&(b.setValue(d.items),delete d.items),r&&c.on("invalid"+i,function(a){a.preventDefault(),b.isInvalid=!0,b.refreshState()}),b.updateOriginalInput(),b.refreshItems(),b.refreshState(),b.updatePlaceholder(),b.isSetup=!0,c.is(":disabled")&&b.disable(),b.on("change",this.onChange),c.data("selectize",b),c.addClass("selectized"),b.trigger("initialize"),d.preload===!0&&b.onSearchChange("")},setupTemplates:function(){var b=this,c=b.settings.labelField,d=b.settings.optgroupLabelField,e={optgroup:function(a){return'<div class="optgroup">'+a.html+"</div>"},optgroup_header:function(a,b){return'<div class="optgroup-header">'+b(a[d])+"</div>"},option:function(a,b){return'<div class="option">'+b(a[c])+"</div>"},item:function(a,b){return'<div class="item">'+b(a[c])+"</div>"},option_create:function(a,b){return'<div class="create">Add <strong>'+b(a.input)+"</strong>&hellip;</div>"}};b.settings.render=a.extend({},e,b.settings.render)},setupCallbacks:function(){var a,b,c={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(a in c)c.hasOwnProperty(a)&&(b=this.settings[c[a]],b&&this.on(a,b))},onClick:function(b){var a=this;a.isFocused||(a.focus(),b.preventDefault())},onMouseDown:function(c){var b=this,d=c.isDefaultPrevented();a(c.target);if(b.isFocused){if(c.target!==b.$control_input[0])return"single"===b.settings.mode?b.isOpen?b.close():b.open():d||b.setActiveItem(null),!1}else d||window.setTimeout(function(){b.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(c){var b=this;b.isFull()||b.isInputHidden||b.isLocked?c.preventDefault():b.settings.splitOn&&setTimeout(function(){for(var d=a.trim(b.$control_input.val()||"").split(b.settings.splitOn),c=0,e=d.length;e>c;c++)b.createItem(d[c])},0)},onKeyPress:function(a){if(this.isLocked)return a&&a.preventDefault();var b=String.fromCharCode(a.keyCode||a.which);return this.settings.create&&"multi"===this.settings.mode&&b===this.settings.delimiter?(this.createItem(),a.preventDefault(),!1):void 0},onKeyDown:function(b){var a=(b.target===this.$control_input[0],this);if(a.isLocked)return void(b.keyCode!==m&&b.preventDefault());switch(b.keyCode){case z:if(a.isCmdDown)return void a.selectAll();break;case F:return void(a.isOpen&&(b.preventDefault(),b.stopPropagation(),a.close()));case B:if(!b.ctrlKey||b.altKey)break;case A:if(!a.isOpen&&a.hasOptions)a.open();else if(a.$activeOption){a.ignoreHover=!0;var c=a.getAdjacentOption(a.$activeOption,1);c.length&&a.setActiveOption(c,!0,!0)}return void b.preventDefault();case y:if(!b.ctrlKey||b.altKey)break;case x:if(a.$activeOption){a.ignoreHover=!0;var d=a.getAdjacentOption(a.$activeOption,-1);d.length&&a.setActiveOption(d,!0,!0)}return void b.preventDefault();case C:return void(a.isOpen&&a.$activeOption&&(a.onOptionSelect({currentTarget:a.$activeOption}),b.preventDefault()));case k:return void a.advanceSelection(-1,b);case n:return void a.advanceSelection(1,b);case m:return a.settings.selectOnTab&&a.isOpen&&a.$activeOption&&(a.onOptionSelect({currentTarget:a.$activeOption}),a.isFull()||b.preventDefault()),void(a.settings.create&&a.createItem()&&b.preventDefault());case f:case l:return void a.deleteSelection(b)}return!a.isFull()&&!a.isInputHidden||(e?b.metaKey:b.ctrlKey)?void 0:void b.preventDefault()},onKeyUp:function(c){var a=this;if(a.isLocked)return c&&c.preventDefault();var b=a.$control_input.val()||"";a.lastValue!==b&&(a.lastValue=b,a.onSearchChange(b),a.refreshOptions(),a.trigger("type",b))},onSearchChange:function(b){var a=this,c=a.settings.load;c&&(a.loadedSearches.hasOwnProperty(b)||(a.loadedSearches[b]=!0,a.load(function(d){c.apply(a,[b,d])})))},onFocus:function(b){var a=this,c=a.isFocused;return a.isDisabled?(a.blur(),b&&b.preventDefault(),!1):void(a.ignoreFocus||(a.isFocused=!0,"focus"===a.settings.preload&&a.onSearchChange(""),c||a.trigger("focus"),a.$activeItems.length||(a.showInput(),a.setActiveItem(null),a.refreshOptions(!!a.settings.openOnFocus)),a.refreshState()))},onBlur:function(c,d){var a=this;if(a.isFocused&&(a.isFocused=!1,!a.ignoreFocus)){if(!a.ignoreBlur&&document.activeElement===a.$dropdown_content[0])return a.ignoreBlur=!0,void a.onFocus(c);var b=function(){a.close(),a.setTextboxValue(""),a.setActiveItem(null),a.setActiveOption(null),a.setCaret(a.items.length),a.refreshState(),(d||document.body).focus(),a.ignoreFocus=!1,a.trigger("blur")};a.ignoreFocus=!0,a.settings.create&&a.settings.createOnBlur?a.createItem(null,!1,b):b()}},onOptionHover:function(a){this.ignoreHover||this.setActiveOption(a.currentTarget,!1)},onOptionSelect:function(c){var d,e,b=this;c.preventDefault&&(c.preventDefault(),c.stopPropagation()),e=a(c.currentTarget),e.hasClass("create")?b.createItem(null,function(){b.settings.closeAfterSelect&&b.close()}):(d=e.attr("data-value"),"undefined"!=typeof d&&(b.lastQuery=null,b.setTextboxValue(""),b.addItem(d),b.settings.closeAfterSelect?b.close():!b.settings.hideSelected&&c.type&&/mouse/.test(c.type)&&b.setActiveOption(b.getOption(d))))},onItemSelect:function(a){var b=this;b.isLocked||"multi"===b.settings.mode&&(a.preventDefault(),b.setActiveItem(a.currentTarget,a))},load:function(b){var a=this,c=a.$wrapper.addClass(a.settings.loadingClass);a.loading++,b.apply(a,[function(b){a.loading=Math.max(a.loading-1,0),b&&b.length&&(a.addOption(b),a.refreshOptions(a.isFocused&&!a.isInputHidden)),a.loading||c.removeClass(a.settings.loadingClass),a.trigger("load",b)}])},setTextboxValue:function(a){var b=this.$control_input,c=b.val()!==a;c&&(b.val(a).triggerHandler("update"),this.lastValue=a)},getValue:function(){return this.tagType===g&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(b,a){var c=a?[]:["change"];q(this,c,function(){this.clear(a),this.addItems(b,a)})},setActiveItem:function(c,i){var f,g,j,e,d,h,k,l,b=this;if("single"!==b.settings.mode){if(c=a(c),!c.length)return a(b.$activeItems).removeClass("active"),b.$activeItems=[],void(b.isFocused&&b.showInput());if(f=i&&i.type.toLowerCase(),"mousedown"===f&&b.isShiftDown&&b.$activeItems.length){for(l=b.$control.children(".active:last"),e=Array.prototype.indexOf.apply(b.$control[0].childNodes,[l[0]]),d=Array.prototype.indexOf.apply(b.$control[0].childNodes,[c[0]]),e>d&&(k=e,e=d,d=k),g=e;d>=g;g++)h=b.$control[0].childNodes[g],-1===b.$activeItems.indexOf(h)&&(a(h).addClass("active"),b.$activeItems.push(h));i.preventDefault()}else"mousedown"===f&&b.isCtrlDown||"keydown"===f&&this.isShiftDown?c.hasClass("active")?(j=b.$activeItems.indexOf(c[0]),b.$activeItems.splice(j,1),c.removeClass("active")):b.$activeItems.push(c.addClass("active")[0]):(a(b.$activeItems).removeClass("active"),b.$activeItems=[c.addClass("active")[0]]);b.hideInput(),this.isFocused||b.focus()}},setActiveOption:function(e,c,h){var f,g,d,i,j,b=this;b.$activeOption&&b.$activeOption.removeClass("active"),b.$activeOption=null,e=a(e),e.length&&(b.$activeOption=e.addClass("active"),(c||!p(c))&&(f=b.$dropdown_content.height(),g=b.$activeOption.outerHeight(!0),c=b.$dropdown_content.scrollTop()||0,d=b.$activeOption.offset().top-b.$dropdown_content.offset().top+c,i=d,j=d-f+g,d+g>f+c?b.$dropdown_content.stop().animate({scrollTop:j},h?b.settings.scrollDuration:0):c>d&&b.$dropdown_content.stop().animate({scrollTop:i},h?b.settings.scrollDuration:0)))},selectAll:function(){var a=this;"single"!==a.settings.mode&&(a.$activeItems=Array.prototype.slice.apply(a.$control.children(":not(input)").addClass("active")),a.$activeItems.length&&(a.hideInput(),a.close()),a.focus())},hideInput:function(){var a=this;a.setTextboxValue(""),a.$control_input.css({opacity:0,position:"absolute",left:a.rtl?1e4:-1e4}),a.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var a=this;a.isDisabled||(a.ignoreFocus=!0,a.$control_input[0].focus(),window.setTimeout(function(){a.ignoreFocus=!1,a.onFocus()},0))},blur:function(a){this.$control_input[0].blur(),this.onBlur(null,a)},getScoreFunction:function(a){return this.sifter.getScoreFunction(a,this.getSearchOptions())},getSearchOptions:function(){var b=this.settings,a=b.sortField;return"string"==typeof a&&(a=[{field:a}]),{fields:b.searchField,conjunction:b.searchConjunction,sort:a}},search:function(f){var e,d,g,b=this,h=b.settings,i=this.getSearchOptions();if(h.score&&(g=b.settings.score.apply(this,[f]),"function"!=typeof g))throw new Error('Selectize "score" setting must be a function that returns a function');if(f!==b.lastQuery?(b.lastQuery=f,d=b.sifter.search(f,a.extend(i,{score:g})),b.currentResults=d):d=a.extend(!0,{},b.currentResults),h.hideSelected)for(e=d.items.length-1;e>=0;e--)-1!==b.items.indexOf(c(d.items[e].id))&&d.items.splice(e,1);return d},refreshOptions:function(q){var e,n,x,f,h,k,v,w,d,m,l,s,r,i,p,o;"undefined"==typeof q&&(q=!0);var b=this,t=a.trim(b.$control_input.val()),g=b.search(t),j=b.$dropdown_content,y=b.$activeOption&&c(b.$activeOption.attr("data-value"));for(f=g.items.length,"number"==typeof b.settings.maxOptions&&(f=Math.min(f,b.settings.maxOptions)),h={},k=[],e=0;f>e;e++)for(v=b.options[g.items[e].id],w=b.render("option",v),d=v[b.settings.optgroupField]||"",m=a.isArray(d)?d:[d],n=0,x=m&&m.length;x>n;n++)d=m[n],b.optgroups.hasOwnProperty(d)||(d=""),h.hasOwnProperty(d)||(h[d]=[],k.push(d)),h[d].push(w);for(this.settings.lockOptgroupOrder&&k.sort(function(a,c){var d=b.optgroups[a].$order||0,e=b.optgroups[c].$order||0;return d-e}),l=[],e=0,f=k.length;f>e;e++)d=k[e],b.optgroups.hasOwnProperty(d)&&h[d].length?(s=b.render("optgroup_header",b.optgroups[d])||"",s+=h[d].join(""),l.push(b.render("optgroup",a.extend({},b.optgroups[d],{html:s})))):l.push(h[d].join(""));if(j.html(l.join("")),b.settings.highlight&&g.query.length&&g.tokens.length)for(e=0,f=g.tokens.length;f>e;e++)u(j,g.tokens[e].regex);if(!b.settings.hideSelected)for(e=0,f=b.items.length;f>e;e++)b.getOption(b.items[e]).addClass("selected");r=b.canCreate(t),r&&(j.prepend(b.render("option_create",{input:t})),o=a(j[0].childNodes[0])),b.hasOptions=g.items.length>0||r,b.hasOptions?(g.items.length>0?(p=y&&b.getOption(y),p&&p.length?i=p:"single"===b.settings.mode&&b.items.length&&(i=b.getOption(b.items[0])),i&&i.length||(i=o&&!b.settings.addPrecedence?b.getAdjacentOption(o,1):j.find("[data-selectable]:first"))):i=o,b.setActiveOption(i),q&&!b.isOpen&&b.open()):(b.setActiveOption(null),q&&b.isOpen&&b.close())},addOption:function(b){var d,f,e,c=this;if(a.isArray(b))for(d=0,f=b.length;f>d;d++)c.addOption(b[d]);else(e=c.registerOption(b))&&(c.userOptions[e]=!0,c.lastQuery=null,c.trigger("option_add",e,b))},registerOption:function(a){var b=c(a[this.settings.valueField]);return!b||this.options.hasOwnProperty(b)?!1:(a.$order=a.$order||++this.order,this.options[b]=a,b)},registerOptionGroup:function(a){var b=c(a[this.settings.optgroupValueField]);return b?(a.$order=a.$order||++this.order,this.optgroups[b]=a,b):!1},addOptionGroup:function(a,b){b[this.settings.optgroupValueField]=a,(a=this.registerOptionGroup(b))&&this.trigger("optgroup_add",a,b)},removeOptionGroup:function(a){this.optgroups.hasOwnProperty(a)&&(delete this.optgroups[a],this.renderCache={},this.trigger("optgroup_remove",a))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(d,f){var i,j,e,k,g,h,l,b=this;if(d=c(d),e=c(f[b.settings.valueField]),null!==d&&b.options.hasOwnProperty(d)){if("string"!=typeof e)throw new Error("Value must be set in option data");l=b.options[d].$order,e!==d&&(delete b.options[d],k=b.items.indexOf(d),-1!==k&&b.items.splice(k,1,e)),f.$order=f.$order||l,b.options[e]=f,g=b.renderCache.item,h=b.renderCache.option,g&&(delete g[d],delete g[e]),h&&(delete h[d],delete h[e]),-1!==b.items.indexOf(e)&&(i=b.getItem(d),j=a(b.render("item",f)),i.hasClass("active")&&j.addClass("active"),i.replaceWith(j)),b.lastQuery=null,b.isOpen&&b.refreshOptions(!1)}},removeOption:function(a,f){var b=this;a=c(a);var d=b.renderCache.item,e=b.renderCache.option;d&&delete d[a],e&&delete e[a],delete b.userOptions[a],delete b.options[a],b.lastQuery=null,b.trigger("option_remove",a),b.removeItem(a,f)},clearOptions:function(){var a=this;a.loadedSearches={},a.userOptions={},a.renderCache={},a.options=a.sifter.items={},a.lastQuery=null,a.trigger("option_clear"),a.clear()},getOption:function(a){return this.getElementWithValue(a,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(d,e){var b=this.$dropdown.find("[data-selectable]"),c=b.index(d)+e;return c>=0&&c<b.length?b.eq(c):a()},getElementWithValue:function(b,e){if(b=c(b),"undefined"!=typeof b&&null!==b)for(var d=0,f=e.length;f>d;d++)if(e[d].getAttribute("data-value")===b)return a(e[d]);return a()},getItem:function(a){return this.getElementWithValue(a,this.$control.children())},addItems:function(c,f){for(var d=a.isArray(c)?c:[c],b=0,e=d.length;e>b;b++)this.isPending=e-1>b,this.addItem(d[b],f)},addItem:function(b,d){var e=d?[]:["change"];q(this,e,function(){var g,i,j,h,k,e=this,f=e.settings.mode;return b=c(b),-1!==e.items.indexOf(b)?void("single"===f&&e.close()):void(e.options.hasOwnProperty(b)&&("single"===f&&e.clear(d),"multi"===f&&e.isFull()||(g=a(e.render("item",e.options[b])),k=e.isFull(),e.items.splice(e.caretPos,0,b),e.insertAtCaret(g),(!e.isPending||!k&&e.isFull())&&e.refreshState(),e.isSetup&&(j=e.$dropdown_content.find("[data-selectable]"),e.isPending||(i=e.getOption(b),h=e.getAdjacentOption(i,1).attr("data-value"),e.refreshOptions(e.isFocused&&"single"!==f),h&&e.setActiveOption(e.getOption(h))),!j.length||e.isFull()?e.close():e.positionDropdown(),e.updatePlaceholder(),e.trigger("item_add",b,g),e.updateOriginalInput({silent:d})))))})},removeItem:function(b,f){var d,e,g,a=this;d="object"==typeof b?b:a.getItem(b),b=c(d.attr("data-value")),e=a.items.indexOf(b),-1!==e&&(d.remove(),d.hasClass("active")&&(g=a.$activeItems.indexOf(d[0]),a.$activeItems.splice(g,1)),a.items.splice(e,1),a.lastQuery=null,!a.settings.persist&&a.userOptions.hasOwnProperty(b)&&a.removeOption(b,f),e<a.caretPos&&a.setCaret(a.caretPos-1),a.refreshState(),a.updatePlaceholder(),a.updateOriginalInput({silent:f}),a.positionDropdown(),a.trigger("item_remove",b,d))},createItem:function(e,f){var b=this,i=b.caretPos;e=e||a.trim(b.$control_input.val()||"");var d=arguments[arguments.length-1];if("function"!=typeof d&&(d=function(){}),"boolean"!=typeof f&&(f=!0),!b.canCreate(e))return d(),!1;b.lock();var j="function"==typeof b.settings.create?this.settings.create:function(c){var a={};return a[b.settings.labelField]=c,a[b.settings.valueField]=c,a},g=D(function(a){if(b.unlock(),!a||"object"!=typeof a)return d();var e=c(a[b.settings.valueField]);return"string"!=typeof e?d():(b.setTextboxValue(""),b.addOption(a),b.setCaret(i),b.addItem(e),b.refreshOptions(f&&"single"!==b.settings.mode),void d(a))}),h=j.apply(this,[e,g]);return"undefined"!=typeof h&&g(h),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){var b,a=this;a.isRequired&&(a.items.length&&(a.isInvalid=!1),a.$control_input.prop("required",b)),a.refreshClasses()},refreshClasses:function(){var b=this,c=b.isFull(),d=b.isLocked;b.$wrapper.toggleClass("rtl",b.rtl),b.$control.toggleClass("focus",b.isFocused).toggleClass("disabled",b.isDisabled).toggleClass("required",b.isRequired).toggleClass("invalid",b.isInvalid).toggleClass("locked",d).toggleClass("full",c).toggleClass("not-full",!c).toggleClass("input-active",b.isFocused&&!b.isInputHidden).toggleClass("dropdown-active",b.isOpen).toggleClass("has-options",!a.isEmptyObject(b.options)).toggleClass("has-items",b.items.length>0),
  b.$control_input.data("grow",!c&&!d)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(e){var b,f,c,h,a=this;if(e=e||{},a.tagType===g){for(c=[],b=0,f=a.items.length;f>b;b++)h=a.options[a.items[b]][a.settings.labelField]||"",c.push('<option value="'+d(a.items[b])+'" selected="selected">'+d(h)+"</option>");c.length||this.$input.attr("multiple")||c.push('<option value="" selected="selected"></option>'),a.$input.html(c.join(""))}else a.$input.val(a.getValue()),a.$input.attr("value",a.$input.val());a.isSetup&&(e.silent||a.trigger("change",a.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var a=this.$control_input;this.items.length?a.removeAttr("placeholder"):a.attr("placeholder",this.settings.placeholder),a.triggerHandler("update",{force:!0})}},open:function(){var a=this;a.isLocked||a.isOpen||"multi"===a.settings.mode&&a.isFull()||(a.focus(),a.isOpen=!0,a.refreshState(),a.$dropdown.css({visibility:"hidden",display:"block"}),a.positionDropdown(),a.$dropdown.css({visibility:"visible"}),a.trigger("dropdown_open",a.$dropdown))},close:function(){var a=this,b=a.isOpen;"single"===a.settings.mode&&a.items.length&&a.hideInput(),a.isOpen=!1,a.$dropdown.hide(),a.setActiveOption(null),a.refreshState(),b&&a.trigger("dropdown_close",a.$dropdown)},positionDropdown:function(){var a=this.$control,b="body"===this.settings.dropdownParent?a.offset():a.position();b.top+=a.outerHeight(!0),this.$dropdown.css({width:a.outerWidth(),top:b.top,left:b.left})},clear:function(b){var a=this;a.items.length&&(a.$control.children(":not(input)").remove(),a.items=[],a.lastQuery=null,a.setCaret(0),a.setActiveItem(null),a.updatePlaceholder(),a.updateOriginalInput({silent:b}),a.refreshState(),a.showInput(),a.trigger("clear"))},insertAtCaret:function(c){var b=Math.min(this.caretPos,this.items.length);0===b?this.$control.prepend(c):a(this.$control[0].childNodes[b]).before(c),this.setCaret(b+1)},deleteSelection:function(e){var h,m,d,g,c,i,k,l,n,b=this;if(d=e&&e.keyCode===f?-1:1,g=j(b.$control_input[0]),b.$activeOption&&!b.settings.hideSelected&&(k=b.getAdjacentOption(b.$activeOption,-1).attr("data-value")),c=[],b.$activeItems.length){for(n=b.$control.children(".active:"+(d>0?"last":"first")),i=b.$control.children(":not(input)").index(n),d>0&&i++,h=0,m=b.$activeItems.length;m>h;h++)c.push(a(b.$activeItems[h]).attr("data-value"));e&&(e.preventDefault(),e.stopPropagation())}else(b.isFocused||"single"===b.settings.mode)&&b.items.length&&(0>d&&0===g.start&&0===g.length?c.push(b.items[b.caretPos-1]):d>0&&g.start===b.$control_input.val().length&&c.push(b.items[b.caretPos]));if(!c.length||"function"==typeof b.settings.onDelete&&b.settings.onDelete.apply(b,[c])===!1)return!1;for("undefined"!=typeof i&&b.setCaret(i);c.length;)b.removeItem(c.pop());return b.showInput(),b.positionDropdown(),b.refreshOptions(!0),k&&(l=b.getOption(k),l.length&&b.setActiveOption(l)),!0},advanceSelection:function(b,i){var g,c,d,e,h,f,a=this;0!==b&&(a.rtl&&(b*=-1),g=b>0?"last":"first",c=j(a.$control_input[0]),a.isFocused&&!a.isInputHidden?(e=a.$control_input.val().length,h=0>b?0===c.start&&0===c.length:c.start===e,h&&!e&&a.advanceCaret(b,i)):(f=a.$control.children(".active:"+g),f.length&&(d=a.$control.children(":not(input)").index(f),a.setActiveItem(null),a.setCaret(b>0?d+1:d))))},advanceCaret:function(b,d){var e,c,a=this;0!==b&&(e=b>0?"next":"prev",a.isShiftDown?(c=a.$control_input[e](),c.length&&(a.hideInput(),a.setActiveItem(c),d&&d.preventDefault())):a.setCaret(a.caretPos+b))},setCaret:function(d){var b=this;if(d="single"===b.settings.mode?b.items.length:Math.max(0,Math.min(b.items.length,d)),!b.isPending){var c,g,e,f;for(e=b.$control.children(":not(input)"),c=0,g=e.length;g>c;c++)f=a(e[c]).detach(),d>c?b.$control_input.before(f):b.$control.append(f)}b.caretPos=d},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var a=this;a.$input.prop("disabled",!0),a.$control_input.prop("disabled",!0).prop("tabindex",-1),a.isDisabled=!0,a.lock()},enable:function(){var a=this;a.$input.prop("disabled",!1),a.$control_input.prop("disabled",!1).prop("tabindex",a.tabIndex),a.isDisabled=!1,a.unlock()},destroy:function(){var b=this,c=b.eventNS,d=b.revertSettings;b.trigger("destroy"),b.off(),b.$wrapper.remove(),b.$dropdown.remove(),b.$input.html("").append(d.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:d.tabindex}).show(),b.$control_input.removeData("grow"),b.$input.removeData("selectize"),a(window).off(c),a(document).off(c),a(document.body).off(c),delete b.$input[0].selectize},render:function(a,g){var f,j,b="",h=!1,e=this,i=/^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;return("option"===a||"item"===a)&&(f=c(g[e.settings.valueField]),h=!!f),h&&(p(e.renderCache[a])||(e.renderCache[a]={}),e.renderCache[a].hasOwnProperty(f))?e.renderCache[a][f]:(b=e.settings.render[a].apply(this,[g,d]),("option"===a||"option_create"===a)&&(b=b.replace(i,"<$1 data-selectable")),"optgroup"===a&&(j=g[e.settings.optgroupValueField]||"",b=b.replace(i,'<$1 data-group="'+o(d(j))+'"')),("option"===a||"item"===a)&&(b=b.replace(i,'<$1 data-value="'+o(d(f||""))+'"')),h&&(e.renderCache[a][f]=b),b)},clearCache:function(a){var b=this;"undefined"==typeof a?b.renderCache={}:delete b.renderCache[a]},canCreate:function(b){var c=this;if(!c.settings.create)return!1;var a=c.settings.createFilter;return!(!b.length||"function"==typeof a&&!a.apply(c,[b])||"string"==typeof a&&!new RegExp(a).test(b)||a instanceof RegExp&&!a.test(b))}}),b.count=0,b.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!1,preload:!1,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},a.fn.selectize=function(j){var i=a.fn.selectize.defaults,d=a.extend({},i,j),g=d.dataAttr,h=d.labelField,f=d.valueField,e=d.optgroupField,k=d.optgroupLabelField,l=d.optgroupValueField,m=function(k,c){var b,i,e,j,l=k.attr(g);if(l)for(c.options=JSON.parse(l),b=0,i=c.options.length;i>b;b++)c.items.push(c.options[b][f]);else{var m=a.trim(k.val()||"");if(!d.allowEmptyOption&&!m.length)return;for(e=m.split(d.delimiter),b=0,i=e.length;i>b;b++)j={},j[h]=e[b],j[f]=e[b],c.options.push(j);c.items=e}},n=function(q,m){var b,o,n,i,s=m.options,j={},r=function(b){var a=g&&b.attr(g);return"string"==typeof a&&a.length?JSON.parse(a):null},p=function(i,k){i=a(i);var b=c(i.attr("value"));if(b||d.allowEmptyOption)if(j.hasOwnProperty(b)){if(k){var l=j[b][e];l?a.isArray(l)?l.push(k):j[b][e]=[l,k]:j[b][e]=k}}else{var g=r(i)||{};g[h]=g[h]||i.text(),g[f]=g[f]||b,g[e]=g[e]||k,j[b]=g,s.push(g),i.is(":selected")&&m.items.push(b)}},t=function(b){var d,g,c,e,f;for(b=a(b),c=b.attr("label"),c&&(e=r(b)||{},e[k]=c,e[l]=c,m.optgroups.push(e)),f=a("option",b),d=0,g=f.length;g>d;d++)p(f[d],c)};for(m.maxItems=q.attr("multiple")?null:1,i=q.children(),b=0,o=i.length;o>b;b++)n=i[b].tagName.toLowerCase(),"optgroup"===n?t(i[b]):"option"===n&&p(i[b])};return this.each(function(){if(!this.selectize){var g,c=a(this),h=this.tagName.toLowerCase(),e=c.attr("placeholder")||c.attr("data-placeholder");e||d.allowEmptyOption||(e=c.children('option[value=""]').text());var f={placeholder:e,options:[],optgroups:[],items:[]};"select"===h?n(c,f):m(c,f),g=new b(c,a.extend(!0,{},i,f,j))}})},a.fn.selectize.defaults=b.defaults,a.fn.selectize.support={validity:r},b.define("drag_drop",function(c){if(!a.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var b=this;b.lock=function(){var a=b.lock;return function(){var c=b.$control.data("sortable");return c&&c.disable(),a.apply(b,arguments)}}(),b.unlock=function(){var a=b.unlock;return function(){var c=b.$control.data("sortable");return c&&c.enable(),a.apply(b,arguments)}}(),b.setup=function(){var c=b.setup;return function(){c.apply(this,arguments);var d=b.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:b.isLocked,start:function(b,a){a.placeholder.css("width",a.helper.css("width")),d.css({overflow:"visible"})},stop:function(){d.css({overflow:"hidden"});var e=b.$activeItems?b.$activeItems.slice():null,c=[];d.children("[data-value]").each(function(){c.push(a(this).attr("data-value"))}),b.setValue(c),b.setActiveItem(e)}})}}()}}),b.define("dropdown_header",function(c){var b=this;c=a.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(a){return'<div class="'+a.headerClass+'"><div class="'+a.titleRowClass+'"><span class="'+a.labelClass+'">'+a.title+'</span><a href="javascript:void(0)" class="'+a.closeClass+'">&times;</a></div></div>'}},c),b.setup=function(){var d=b.setup;return function(){d.apply(b,arguments),b.$dropdown_header=a(c.html(c)),b.$dropdown.prepend(b.$dropdown_header)}}()}),b.define("optgroup_columns",function(b){var c=this;b=a.extend({equalizeWidth:!0,equalizeHeight:!0},b),this.getAdjacentOption=function(d,e){var b=d.closest("[data-group]").find("[data-selectable]"),c=b.index(d)+e;return c>=0&&c<b.length?b.eq(c):a()},this.onKeyDown=function(){var a=c.onKeyDown;return function(d){var g,e,f,b;return!this.isOpen||d.keyCode!==k&&d.keyCode!==n?a.apply(this,arguments):(c.ignoreHover=!0,b=this.$activeOption.closest("[data-group]"),g=b.find("[data-selectable]").index(this.$activeOption),b=d.keyCode===k?b.prev("[data-group]"):b.next("[data-group]"),f=b.find("[data-selectable]"),e=f.eq(Math.min(f.length-1,g)),void(e.length&&this.setActiveOption(e)))}}();var d=function(){var a,b=d.width,c=document;return"undefined"==typeof b&&(a=c.createElement("div"),a.innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',a=a.firstChild,c.body.appendChild(a),b=d.width=a.offsetWidth-a.clientWidth,c.body.removeChild(a)),b},e=function(){var g,e,h,i,k,j,f;if(f=a("[data-group]",c.$dropdown_content),e=f.length,e&&c.$dropdown_content.width()){if(b.equalizeHeight){for(h=0,g=0;e>g;g++)h=Math.max(h,f.eq(g).height());f.css({height:h})}b.equalizeWidth&&(j=c.$dropdown_content.innerWidth()-d(),i=Math.round(j/e),f.css({width:i}),e>1&&(k=j-i*(e-1),f.eq(e-1).css({width:k})))}};(b.equalizeHeight||b.equalizeWidth)&&(i.after(this,"positionDropdown",e),i.after(this,"refreshOptions",e))}),b.define("remove_button",function(c){if("single"!==this.settings.mode){c=a.extend({label:"&times;",title:"Remove",className:"remove",append:!0},c);var b=this,e='<a href="javascript:void(0)" class="'+c.className+'" tabindex="-1" title="'+d(c.title)+'">'+c.label+"</a>",f=function(a,c){var b=a.search(/(<\/[^>]+>\s*)$/);return a.substring(0,b)+c+a.substring(b)};this.setup=function(){var d=b.setup;return function(){if(c.append){var g=b.settings.render.item;b.settings.render.item=function(a){return f(g.apply(this,arguments),e)}}d.apply(this,arguments),this.$control.on("click","."+c.className,function(c){if(c.preventDefault(),!b.isLocked){var d=a(c.currentTarget).parent();b.setActiveItem(d),b.deleteSelection()&&b.setCaret(b.items.length)}})}}()}}),b.define("restore_on_backspace",function(a){var b=this;a.text=a.text||function(a){return a[this.settings.labelField]},this.onKeyDown=function(){var c=b.onKeyDown;return function(d){var b,e;return d.keyCode===f&&""===this.$control_input.val()&&!this.$activeItems.length&&(b=this.caretPos-1,b>=0&&b<this.items.length)?(e=this.options[this.items[b]],this.deleteSelection(d)&&(this.setTextboxValue(a.text.apply(this,[e])),this.refreshOptions(!0)),void d.preventDefault()):c.apply(this,arguments)}}()}),b}),require=function g(a,b,c){function d(e,j){if(!b[e]){if(!a[e]){var i="function"==typeof require&&require;if(!j&&i)return i(e,!0);if(f)return f(e,!0);throw new Error("Cannot find module '"+e+"'")}var h=b[e]={exports:{}};a[e][0].call(h.exports,function(b){var c=a[e][1][b];return d(c?c:b)},h,h.exports,g,a,b,c)}return b[e].exports}for(var f="function"==typeof require&&require,e=0;e<c.length;e++)d(c[e]);return d}({1:[function(d,c,e){function b(){}var a=c.exports={};a.nextTick=function(){var b="undefined"!=typeof window&&window.setImmediate,c="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(b)return function(a){return window.setImmediate(a)};if(c){var a=[];return window.addEventListener("message",function(b){var c=b.source;if((c===window||null===c)&&"process-tick"===b.data&&(b.stopPropagation(),a.length>0)){var d=a.shift();d()}},!0),function(b){a.push(b),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),a.title="browser",a.browser=!0,a.env={},a.argv=[],a.on=b,a.addListener=b,a.once=b,a.off=b,a.removeListener=b,a.removeAllListeners=b,a.emit=b,a.binding=function(a){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(a){throw new Error("process.chdir is not supported")}},{}],2:[function(b,a,c){"use strict";a.exports={INVALID_TYPE:"Expected type {0} but found type {1}",INVALID_FORMAT:"Object didn't pass validation for format {0}: {1}",ENUM_MISMATCH:"No enum match for: {0}",ANY_OF_MISSING:"Data does not match any schemas from 'anyOf'",ONE_OF_MISSING:"Data does not match any schemas from 'oneOf'",ONE_OF_MULTIPLE:"Data is valid against more than one schema from 'oneOf'",NOT_PASSED:"Data matches schema from 'not'",ARRAY_LENGTH_SHORT:"Array is too short ({0}), minimum {1}",ARRAY_LENGTH_LONG:"Array is too long ({0}), maximum {1}",ARRAY_UNIQUE:"Array items are not unique (indexes {0} and {1})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",MULTIPLE_OF:"Value {0} is not a multiple of {1}",MINIMUM:"Value {0} is less than minimum {1}",MINIMUM_EXCLUSIVE:"Value {0} is equal or less than exclusive minimum {1}",MAXIMUM:"Value {0} is greater than maximum {1}",MAXIMUM_EXCLUSIVE:"Value {0} is equal or greater than exclusive maximum {1}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({0}), minimum {1}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({0}), maximum {1}",OBJECT_MISSING_REQUIRED_PROPERTY:"Missing required property: {0}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed: {0}",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {0} (due to key: {1})",MIN_LENGTH:"String is too short ({0} chars), minimum {1}",MAX_LENGTH:"String is too long ({0} chars), maximum {1}",PATTERN:"String does not match pattern {0}: {1}",KEYWORD_TYPE_EXPECTED:"Keyword '{0}' is expected to be of type '{1}'",KEYWORD_UNDEFINED_STRICT:"Keyword '{0}' must be defined in strict mode",KEYWORD_UNEXPECTED:"Keyword '{0}' is not expected to appear in the schema",KEYWORD_MUST_BE:"Keyword '{0}' must be {1}",KEYWORD_DEPENDENCY:"Keyword '{0}' requires keyword '{1}'",KEYWORD_PATTERN:"Keyword '{0}' is not a valid RegExp pattern: {1}",KEYWORD_VALUE_TYPE:"Each element of keyword '{0}' array must be a '{1}'",UNKNOWN_FORMAT:"There is no validation function for format '{0}'",CUSTOM_MODE_FORCE_PROPERTIES:"{0} must define at least one property if present",REF_UNRESOLVED:"Reference has not been resolved during compilation: {0}",UNRESOLVABLE_REFERENCE:"Reference could not be resolved: {0}",SCHEMA_NOT_REACHABLE:"Validator was not able to read schema with uri: {0}",SCHEMA_TYPE_EXPECTED:"Schema is expected to be of type 'object'",SCHEMA_NOT_AN_OBJECT:"Schema is not an object: {0}",ASYNC_TIMEOUT:"{0} asynchronous task(s) have timed out after {1} ms",PARENT_SCHEMA_VALIDATION_FAILED:"Schema failed to validate against its parent schema, see inner errors for details."}},{}],3:[function(c,b,d){var a={date:function(b){if("string"!=typeof b)return!0;var a=/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.exec(b);return null===a?!1:a[2]<"01"||a[2]>"12"||a[3]<"01"||a[3]>"31"?!1:!0},"date-time":function(c){if("string"!=typeof c)return!0;var d=c.toLowerCase().split("t");if(!a.date(d[0]))return!1;var b=/^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$/.exec(d[1]);return null===b?!1:b[1]>"23"||b[2]>"59"||b[3]>"59"?!1:!0},email:function(a){return"string"!=typeof a?!0:/^[a-zA-Z0-9+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/.test(a)},hostname:function(a){if("string"!=typeof a)return!0;var c=/^[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?(\.[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?)*$/.test(a);if(c){if(a.length>255)return!1;for(var d=a.split("."),b=0;b<d.length;b++)if(d[b].length>63)return!1}return c},"host-name":function(b){return a.hostname.call(this,b)},ipv4:function(a){return"string"!=typeof a?!0:-1===a.indexOf(".")?!1:/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(a)},ipv6:function(a){return"string"!=typeof a||/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/.test(a)},regex:function(a){try{return RegExp(a),!0}catch(a){return!1}},uri:function(b){return this.options.strictUris?a["strict-uri"].apply(this,arguments):"string"!=typeof b||RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?").test(b)},"strict-uri":function(a){return"string"!=typeof a||RegExp("^(?:(?:https?|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:/[^\\s]*)?$","i").test(a)}};b.exports=a},{}],4:[function(d,i,b){"use strict";var f=d("./FormatValidators"),e=d("./Report"),a=d("./Utils"),c={multipleOf:function(d,b,c){"number"==typeof c&&"integer"!==a.whatIs(c/b.multipleOf)&&d.addError("MULTIPLE_OF",[c,b.multipleOf],null,b.description)},maximum:function(c,a,b){"number"==typeof b&&(a.exclusiveMaximum!==!0?b>a.maximum&&c.addError("MAXIMUM",[b,a.maximum],null,a.description):b>=a.maximum&&c.addError("MAXIMUM_EXCLUSIVE",[b,a.maximum],null,a.description))},exclusiveMaximum:function(){},minimum:function(c,a,b){"number"==typeof b&&(a.exclusiveMinimum!==!0?b<a.minimum&&c.addError("MINIMUM",[b,a.minimum],null,a.description):b<=a.minimum&&c.addError("MINIMUM_EXCLUSIVE",[b,a.minimum],null,a.description))},exclusiveMinimum:function(){},maxLength:function(c,a,b){"string"==typeof b&&b.length>a.maxLength&&c.addError("MAX_LENGTH",[b.length,a.maxLength],null,a.description)},minLength:function(c,a,b){"string"==typeof b&&b.length<a.minLength&&c.addError("MIN_LENGTH",[b.length,a.minLength],null,a.description)},pattern:function(c,a,b){"string"==typeof b&&RegExp(a.pattern).test(b)===!1&&c.addError("PATTERN",[a.pattern,b],null,a.description)},additionalItems:function(c,a,b){Array.isArray(b)&&a.additionalItems===!1&&Array.isArray(a.items)&&b.length>a.items.length&&c.addError("ARRAY_ADDITIONAL_ITEMS",null,null,a.description)},items:function(){},maxItems:function(c,a,b){Array.isArray(b)&&b.length>a.maxItems&&c.addError("ARRAY_LENGTH_LONG",[b.length,a.maxItems],null,a.description)},minItems:function(c,a,b){Array.isArray(b)&&b.length<a.minItems&&c.addError("ARRAY_LENGTH_SHORT",[b.length,a.minItems],null,a.description)},uniqueItems:function(e,b,c){if(Array.isArray(c)&&b.uniqueItems===!0){var d=[];a.isUniqueArray(c,d)===!1&&e.addError("ARRAY_UNIQUE",d,null,b.description)}},maxProperties:function(e,b,c){if("object"===a.whatIs(c)){var d=Object.keys(c).length;d>b.maxProperties&&e.addError("OBJECT_PROPERTIES_MAXIMUM",[d,b.maxProperties],null,b.description)}},minProperties:function(e,b,c){if("object"===a.whatIs(c)){var d=Object.keys(c).length;d<b.minProperties&&e.addError("OBJECT_PROPERTIES_MINIMUM",[d,b.minProperties],null,b.description)}},required:function(f,b,c){if("object"===a.whatIs(c))for(var d=b.required.length;d--;){var e=b.required[d];void 0===c[e]&&f.addError("OBJECT_MISSING_REQUIRED_PROPERTY",[e],null,b.description)}},additionalProperties:function(b,a,d){return void 0===a.properties&&void 0===a.patternProperties?c.properties.call(this,b,a,d):void 0},patternProperties:function(b,a,d){return void 0===a.properties?c.properties.call(this,b,a,d):void 0},properties:function(l,c,e){if("object"===a.whatIs(e)){var h=void 0!==c.properties?c.properties:{},i=void 0!==c.patternProperties?c.patternProperties:{};if(c.additionalProperties===!1){var b=Object.keys(e),j=Object.keys(h),f=Object.keys(i);b=a.difference(b,j);for(var g=f.length;g--;)for(var k=RegExp(f[g]),d=b.length;d--;)k.test(b[d])===!0&&b.splice(d,1);b.length>0&&l.addError("OBJECT_ADDITIONAL_PROPERTIES",[b],null,c.description)}}},dependencies:function(g,e,c){if("object"===a.whatIs(c))for(var h=Object.keys(e.dependencies),i=h.length;i--;){var f=h[i];if(c[f]){var d=e.dependencies[f];if("object"===a.whatIs(d))b.validate.call(this,g,d,c);else for(var j=d.length;j--;){var k=d[j];void 0===c[k]&&g.addError("OBJECT_DEPENDENCY_KEY",[k,f],null,e.description)}}}},enum:function(f,b,c){for(var d=!1,e=b.enum.length;e--;)if(a.areEqual(c,b.enum[e])){d=!0;break}d===!1&&f.addError("ENUM_MISMATCH",[c],null,b.description)},allOf:function(d,a,e){for(var c=a.allOf.length;c--&&b.validate.call(this,d,a.allOf[c],e)!==!1;);},anyOf:function(d,a,i){for(var f=[],c=!1,g=a.anyOf.length;g--&&c===!1;){var h=new e(d);f.push(h),c=b.validate.call(this,h,a.anyOf[g],i)}c===!1&&d.addError("ANY_OF_MISSING",void 0,f,a.description)},oneOf:function(c,a,i){for(var d=0,f=[],g=a.oneOf.length;g--;){var h=new e(c);f.push(h),b.validate.call(this,h,a.oneOf[g],i)===!0&&d++}0===d?c.addError("ONE_OF_MISSING",void 0,f,a.description):d>1&&c.addError("ONE_OF_MULTIPLE",null,null,a.description)},not:function(a,c,d){var f=new e(a);b.validate.call(this,f,c.not,d)===!0&&a.addError("NOT_PASSED",null,null,c.description)},definitions:function(){},format:function(b,a,c){var d=f[a.format];"function"==typeof d?2===d.length?b.addAsyncTask(d,[c],function(d){d!==!0&&b.addError("INVALID_FORMAT",[a.format,c],null,a.description)}):d.call(this,c)!==!0&&b.addError("INVALID_FORMAT",[a.format,c],null,a.description):b.addError("UNKNOWN_FORMAT",[a.format],null,a.description)}},g=function(c,d,e){var a=e.length;if(Array.isArray(d.items))for(;a--;)a<d.items.length?(c.path.push(a.toString()),b.validate.call(this,c,d.items[a],e[a]),c.path.pop()):"object"==typeof d.additionalItems&&(c.path.push(a.toString()),b.validate.call(this,c,d.additionalItems,e[a]),c.path.pop());else if("object"==typeof d.items)for(;a--;)c.path.push(a.toString()),b.validate.call(this,c,d.items,e[a]),c.path.pop()},h=function(g,a,j){var d=a.additionalProperties;(d===!0||void 0===d)&&(d={});for(var n=a.properties?Object.keys(a.properties):[],k=a.patternProperties?Object.keys(a.patternProperties):[],l=Object.keys(j),i=l.length;i--;){var f=l[i],m=j[f],c=[];-1!==n.indexOf(f)&&c.push(a.properties[f]);for(var e=k.length;e--;){var h=k[e];RegExp(h).test(f)===!0&&c.push(a.patternProperties[h])}for(0===c.length&&d!==!1&&c.push(d),e=c.length;e--;)g.path.push(f),b.validate.call(this,g,c[e],m),g.path.pop()}};b.validate=function(d,b,i){var l=a.whatIs(b);if("object"!==l)return d.addError("SCHEMA_NOT_AN_OBJECT",[l],null,b.description),!1;var f=Object.keys(b);if(0===f.length)return!0;var m=!1;if(d.rootSchema||(d.rootSchema=b,m=!0),void 0!==b.$ref){for(var j=99;b.$ref&&j>0;){if(!b.__$refResolved){d.addError("REF_UNRESOLVED",[b.$ref],null,b.description);break}if(b.__$refResolved===b)break;b=b.__$refResolved,f=Object.keys(b),j--}if(0===j)throw new Error("Circular dependency by $ref references!")}var e=a.whatIs(i);if(b.type)if("string"==typeof b.type){if(e!==b.type&&("integer"!==e||"number"!==b.type))return d.addError("INVALID_TYPE",[b.type,e],null,b.description),!1}else if(-1===b.type.indexOf(e)&&("integer"!==e||-1===b.type.indexOf("number")))return d.addError("INVALID_TYPE",[b.type,e],null,b.description),!1;for(var k=f.length;k--&&(!c[f[k]]||(c[f[k]].call(this,d,b,i),!d.errors.length)););return"array"===e?g.call(this,d,b,i):"object"===e&&h.call(this,d,b,i),m&&(d.rootSchema=void 0),0===d.errors.length}},{"./FormatValidators":3,"./Report":6,"./Utils":10}],5:[function(a,b,c){"function"!=typeof Number.isFinite&&(Number.isFinite=function(a){return"number"!=typeof a?!1:a!==a||a===1/0||a===-(1/0)?!1:!0})},{}],6:[function(a,b,c){(function(e){"use strict";function c(a){this.parentReport=a instanceof c?a:void 0,this.options=a instanceof c?a.options:a||{},this.errors=[],this.path=[],this.asyncTasks=[]}var d=a("./Errors");c.prototype.isValid=function(){if(this.asyncTasks.length>0)throw new Error("Async tasks pending, can't answer isValid");return 0===this.errors.length},c.prototype.addAsyncTask=function(a,b,c){this.asyncTasks.push([a,b,c])},c.prototype.processAsyncTasks=function(j,d){function f(){e.nextTick(function(){var a=0===b.errors.length,c=a?void 0:b.errors;d(c,a)})}function k(b){return function(c){i||(b(c),0===--a&&f())}}var g=j||2e3,a=this.asyncTasks.length,h=a,i=!1,b=this;if(0===a||this.errors.length>0)return void f();for(;h--;){var c=this.asyncTasks[h];c[0].apply(null,c[1].concat(k(c[2])))}setTimeout(function(){a>0&&(i=!0,b.addError("ASYNC_TIMEOUT",[a,g]),d(b.errors,!1))},g)},c.prototype.getPath=function(){var a=[];return this.parentReport&&(a=a.concat(this.parentReport.path)),a=a.concat(this.path),this.options.reportPathAsArray!==!0&&(a="#/"+a.map(function(a){return a.replace("~","~0").replace("/","~1")}).join("/")),a},c.prototype.addError=function(e,f,a,h){if(!e)throw new Error("No errorCode passed into addError()");if(!d[e])throw new Error("No errorMessage known for code "+e);f=f||[];for(var b=f.length,g=d[e];b--;)g=g.replace("{"+b+"}",f[b]);var c={code:e,params:f,message:g,path:this.getPath()};if(h&&(c.description=h),null!=a){for(Array.isArray(a)||(a=[a]),c.inner=[],b=a.length;b--;)for(var i=a[b],j=i.errors.length;j--;)c.inner.push(i.errors[j]);0===c.inner.length&&(c.inner=void 0)}this.errors.push(c)},b.exports=c}).call(this,a("+NscNm"))},{"+NscNm":1,"./Errors":2}],7:[function(d,i,a){"use strict";function e(a){return decodeURIComponent(a).replace(/~[0-1]/g,function(a){return"~1"===a?"/":"~"})}function b(a){var b=a.indexOf("#");return-1===b?a:a.slice(0,b)}function f(a){var b=a.indexOf("#"),c=-1===b?void 0:a.slice(b+1);return c}function c(a,d){if("object"==typeof a&&null!==a){if(!d)return a;if(a.id&&(a.id===d||"#"===a.id[0]&&a.id.substring(1)===d))return a;var b,e;if(Array.isArray(a)){for(b=a.length;b--;)if(e=c(a[b],d))return e}else{var f=Object.keys(a);for(b=f.length;b--;){var g=f[b];if(0!==g.indexOf("__$")&&(e=c(a[g],d)))return e}}}}var g=d("./SchemaCompilation"),h=d("./SchemaValidation");a.cacheSchemaByUri=function(c,d){var a=b(c);a&&(this.cache[a]=d)},a.removeFromCacheByUri=function(c){var a=b(c);a&&(this.cache[a]=void 0)},a.checkCacheForUri=function(c){var a=b(c);return a?null!=this.cache[a]:!1},a.getSchemaByUri=function(d,m,l){var i=b(m),p=f(m),a=i?this.cache[i]:l;if(a&&i){var r=a!==l;if(r){d.path.push(i);var k=g.compileSchema.call(this,d,a);if(k&&(k=h.validateSchema.call(this,d,a)),d.path.pop(),!k)return void 0}}if(a&&p)for(var o=p.split("/"),j=0,q=o.length;q>j;j++){var n=e(o[j]);a=0===j?c(a,n):a[n]}return a},a.getRemotePath=b},{"./SchemaCompilation":8,"./SchemaValidation":9}],8:[function(g,k,f){"use strict";function b(a){return/^https?:\/\//.test(a)}function e(a){return/.+#/.test(a)}function d(h,d){if(b(d))return d;var c,a=h.join(""),i=b(a),j=e(a),f=e(d);i&&f?(c=a.match(/\/[^\/]*$/),c&&(a=a.slice(0,c.index+1))):j&&f?a="":(c=a.match(/[^#/]+$/),c&&(a=a.slice(0,c.index)));var g=a+d;return g=g.replace(/##/,"#")}function c(a,f,g,b){if(f=f||[],g=g||[],b=b||[],"object"!=typeof a||null===a)return f;"string"==typeof a.id&&g.push(a.id),"string"==typeof a.$ref&&f.push({ref:d(g,a.$ref),key:"$ref",obj:a,path:b.join("/")}),"string"==typeof a.$schema&&f.push({ref:d(g,a.$schema),key:"$schema",obj:a,path:b.join("/")});var e;if(Array.isArray(a))for(e=a.length;e--;)b.push(e),c(a[e],f,g,b),b.pop();else{var h=Object.keys(a);for(e=h.length;e--;)0!==h[e].indexOf("__$")&&(b.push(h[e]),c(a[h[e]],f,g,b),b.pop())}return"string"==typeof a.id&&g.pop(),f}var h=g("./Report"),a=g("./SchemaCache"),i=function(a,b){for(var c=b.length,d=0;c--;){var e=new h(a),g=f.compileSchema.call(this,e,b[c]);g&&d++,a.errors=a.errors.concat(e.errors)}return d},j=function(a,d){var e,b=0;do{for(var c=a.errors.length;c--;)"UNRESOLVABLE_REFERENCE"===a.errors[c].code&&a.errors.splice(c,1);e=b,b=i.call(this,a,d)}while(b!==d.length&&b!==e);return a.isValid()};f.compileSchema=function(e,d){if("string"==typeof d){var g=a.getSchemaByUri.call(this,e,d);if(!g)return e.addError("SCHEMA_NOT_REACHABLE",[d]),!1;d=g}if(Array.isArray(d))return j.call(this,e,d);if(d.__$compiled&&d.id&&a.checkCacheForUri.call(this,d.id)===!1&&(d.__$compiled=void 0),d.__$compiled)return!0;d.id&&a.cacheSchemaByUri.call(this,d.id,d);for(var h=c.call(this,d),i=h.length;i--;){var f=h[i],k=a.getSchemaByUri.call(this,e,f.ref,d);if(!(k||b(f.ref)&&this.options.ignoreUnresolvableReferences===!0))return e.path.push(f.path),e.addError("UNRESOLVABLE_REFERENCE",[f.ref]),e.path.pop(),!1;f.obj["__"+f.key+"Resolved"]=k}var l=e.isValid();return l?d.__$compiled=!0:d.id&&a.removeFromCacheByUri.call(this,d.id),l}},{"./Report":6,"./SchemaCache":7}],9:[function(c,i,b){"use strict";var e=c("./FormatValidators"),f=c("./JsonValidation"),g=c("./Report"),a=c("./Utils"),d={$ref:function(a,b){"string"!=typeof b.$ref&&a.addError("KEYWORD_TYPE_EXPECTED",["$ref","string"])},$schema:function(a,b){"string"!=typeof b.$schema&&a.addError("KEYWORD_TYPE_EXPECTED",["$schema","string"])},multipleOf:function(a,b){"number"!=typeof b.multipleOf?a.addError("KEYWORD_TYPE_EXPECTED",["multipleOf","number"]):b.multipleOf<=0&&a.addError("KEYWORD_MUST_BE",["multipleOf","strictly greater than 0"])},maximum:function(a,b){"number"!=typeof b.maximum&&a.addError("KEYWORD_TYPE_EXPECTED",["maximum","number"])},exclusiveMaximum:function(a,b){"boolean"!=typeof b.exclusiveMaximum?a.addError("KEYWORD_TYPE_EXPECTED",["exclusiveMaximum","boolean"]):void 0===b.maximum&&a.addError("KEYWORD_DEPENDENCY",["exclusiveMaximum","maximum"])},minimum:function(a,b){"number"!=typeof b.minimum&&a.addError("KEYWORD_TYPE_EXPECTED",["minimum","number"])},exclusiveMinimum:function(a,b){"boolean"!=typeof b.exclusiveMinimum?a.addError("KEYWORD_TYPE_EXPECTED",["exclusiveMinimum","boolean"]):void 0===b.minimum&&a.addError("KEYWORD_DEPENDENCY",["exclusiveMinimum","minimum"]);
  },maxLength:function(b,c){"integer"!==a.whatIs(c.maxLength)?b.addError("KEYWORD_TYPE_EXPECTED",["maxLength","integer"]):c.maxLength<0&&b.addError("KEYWORD_MUST_BE",["maxLength","greater than, or equal to 0"])},minLength:function(b,c){"integer"!==a.whatIs(c.minLength)?b.addError("KEYWORD_TYPE_EXPECTED",["minLength","integer"]):c.minLength<0&&b.addError("KEYWORD_MUST_BE",["minLength","greater than, or equal to 0"])},pattern:function(b,a){if("string"!=typeof a.pattern)b.addError("KEYWORD_TYPE_EXPECTED",["pattern","string"]);else try{RegExp(a.pattern)}catch(c){b.addError("KEYWORD_PATTERN",["pattern",a.pattern])}},additionalItems:function(c,e){var d=a.whatIs(e.additionalItems);"boolean"!==d&&"object"!==d?c.addError("KEYWORD_TYPE_EXPECTED",["additionalItems",["boolean","object"]]):"object"===d&&(c.path.push("additionalItems"),b.validateSchema.call(this,c,e.additionalItems),c.path.pop())},items:function(c,d){var f=a.whatIs(d.items);if("object"===f)c.path.push("items"),b.validateSchema.call(this,c,d.items),c.path.pop();else if("array"===f)for(var e=d.items.length;e--;)c.path.push("items"),c.path.push(e.toString()),b.validateSchema.call(this,c,d.items[e]),c.path.pop(),c.path.pop();else c.addError("KEYWORD_TYPE_EXPECTED",["items",["array","object"]]);this.options.forceAdditional===!0&&void 0===d.additionalItems&&Array.isArray(d.items)&&c.addError("KEYWORD_UNDEFINED_STRICT",["additionalItems"]),this.options.assumeAdditional===!0&&void 0===d.additionalItems&&Array.isArray(d.items)&&(d.additionalItems=!1)},maxItems:function(a,b){"number"!=typeof b.maxItems?a.addError("KEYWORD_TYPE_EXPECTED",["maxItems","integer"]):b.maxItems<0&&a.addError("KEYWORD_MUST_BE",["maxItems","greater than, or equal to 0"])},minItems:function(b,c){"integer"!==a.whatIs(c.minItems)?b.addError("KEYWORD_TYPE_EXPECTED",["minItems","integer"]):c.minItems<0&&b.addError("KEYWORD_MUST_BE",["minItems","greater than, or equal to 0"])},uniqueItems:function(a,b){"boolean"!=typeof b.uniqueItems&&a.addError("KEYWORD_TYPE_EXPECTED",["uniqueItems","boolean"])},maxProperties:function(b,c){"integer"!==a.whatIs(c.maxProperties)?b.addError("KEYWORD_TYPE_EXPECTED",["maxProperties","integer"]):c.maxProperties<0&&b.addError("KEYWORD_MUST_BE",["maxProperties","greater than, or equal to 0"])},minProperties:function(b,c){"integer"!==a.whatIs(c.minProperties)?b.addError("KEYWORD_TYPE_EXPECTED",["minProperties","integer"]):c.minProperties<0&&b.addError("KEYWORD_MUST_BE",["minProperties","greater than, or equal to 0"])},required:function(c,b){if("array"!==a.whatIs(b.required))c.addError("KEYWORD_TYPE_EXPECTED",["required","array"]);else if(0===b.required.length)c.addError("KEYWORD_MUST_BE",["required","an array with at least one element"]);else{for(var d=b.required.length;d--;)"string"!=typeof b.required[d]&&c.addError("KEYWORD_VALUE_TYPE",["required","string"]);a.isUniqueArray(b.required)===!1&&c.addError("KEYWORD_MUST_BE",["required","an array with unique items"])}},additionalProperties:function(c,e){var d=a.whatIs(e.additionalProperties);"boolean"!==d&&"object"!==d?c.addError("KEYWORD_TYPE_EXPECTED",["additionalProperties",["boolean","object"]]):"object"===d&&(c.path.push("additionalProperties"),b.validateSchema.call(this,c,e.additionalProperties),c.path.pop())},properties:function(c,d){if("object"!==a.whatIs(d.properties))return void c.addError("KEYWORD_TYPE_EXPECTED",["properties","object"]);for(var e=Object.keys(d.properties),f=e.length;f--;){var g=e[f],h=d.properties[g];c.path.push("properties"),c.path.push(g),b.validateSchema.call(this,c,h),c.path.pop(),c.path.pop()}this.options.forceAdditional===!0&&void 0===d.additionalProperties&&c.addError("KEYWORD_UNDEFINED_STRICT",["additionalProperties"]),this.options.assumeAdditional===!0&&void 0===d.additionalProperties&&(d.additionalProperties=!1),this.options.forceProperties===!0&&0===e.length&&c.addError("CUSTOM_MODE_FORCE_PROPERTIES",["properties"])},patternProperties:function(c,e){if("object"!==a.whatIs(e.patternProperties))return void c.addError("KEYWORD_TYPE_EXPECTED",["patternProperties","object"]);for(var f=Object.keys(e.patternProperties),g=f.length;g--;){var d=f[g],h=e.patternProperties[d];try{RegExp(d)}catch(a){c.addError("KEYWORD_PATTERN",["patternProperties",d])}c.path.push("patternProperties"),c.path.push(d.toString()),b.validateSchema.call(this,c,h),c.path.pop(),c.path.pop()}this.options.forceProperties===!0&&0===f.length&&c.addError("CUSTOM_MODE_FORCE_PROPERTIES",["patternProperties"])},dependencies:function(c,e){if("object"!==a.whatIs(e.dependencies))c.addError("KEYWORD_TYPE_EXPECTED",["dependencies","object"]);else for(var g=Object.keys(e.dependencies),h=g.length;h--;){var i=g[h],d=e.dependencies[i],j=a.whatIs(d);if("object"===j)c.path.push("dependencies"),c.path.push(i),b.validateSchema.call(this,c,d),c.path.pop(),c.path.pop();else if("array"===j){var f=d.length;for(0===f&&c.addError("KEYWORD_MUST_BE",["dependencies","not empty array"]);f--;)"string"!=typeof d[f]&&c.addError("KEYWORD_VALUE_TYPE",["dependensices","string"]);a.isUniqueArray(d)===!1&&c.addError("KEYWORD_MUST_BE",["dependencies","an array with unique items"])}else c.addError("KEYWORD_VALUE_TYPE",["dependencies","object or array"])}},enum:function(b,c){Array.isArray(c.enum)===!1?b.addError("KEYWORD_TYPE_EXPECTED",["enum","array"]):0===c.enum.length?b.addError("KEYWORD_MUST_BE",["enum","an array with at least one element"]):a.isUniqueArray(c.enum)===!1&&b.addError("KEYWORD_MUST_BE",["enum","an array with unique elements"])},type:function(c,b){var e=["array","boolean","integer","number","null","object","string"],f=e.join(","),d=Array.isArray(b.type);if(d){for(var g=b.type.length;g--;)-1===e.indexOf(b.type[g])&&c.addError("KEYWORD_TYPE_EXPECTED",["type",f]);a.isUniqueArray(b.type)===!1&&c.addError("KEYWORD_MUST_BE",["type","an object with unique properties"])}else"string"==typeof b.type?-1===e.indexOf(b.type)&&c.addError("KEYWORD_TYPE_EXPECTED",["type",f]):c.addError("KEYWORD_TYPE_EXPECTED",["type",["string","array"]]);this.options.noEmptyStrings===!0&&("string"===b.type||d&&-1!==b.type.indexOf("string"))&&void 0===b.minLength&&(b.minLength=1),this.options.noEmptyArrays===!0&&("array"===b.type||d&&-1!==b.type.indexOf("array"))&&void 0===b.minItems&&(b.minItems=1),this.options.forceProperties===!0&&("object"===b.type||d&&-1!==b.type.indexOf("object"))&&void 0===b.properties&&void 0===b.patternProperties&&c.addError("KEYWORD_UNDEFINED_STRICT",["properties"]),this.options.forceItems===!0&&("array"===b.type||d&&-1!==b.type.indexOf("array"))&&void 0===b.items&&c.addError("KEYWORD_UNDEFINED_STRICT",["items"]),this.options.forceMaxLength===!0&&("string"===b.type||d&&-1!==b.type.indexOf("string"))&&void 0===b.maxLength&&void 0===b.format&&void 0===b.enum&&c.addError("KEYWORD_UNDEFINED_STRICT",["maxLength"])},allOf:function(a,c){if(Array.isArray(c.allOf)===!1)a.addError("KEYWORD_TYPE_EXPECTED",["allOf","array"]);else if(0===c.allOf.length)a.addError("KEYWORD_MUST_BE",["allOf","an array with at least one element"]);else for(var d=c.allOf.length;d--;)a.path.push("allOf"),a.path.push(d.toString()),b.validateSchema.call(this,a,c.allOf[d]),a.path.pop(),a.path.pop()},anyOf:function(a,c){if(Array.isArray(c.anyOf)===!1)a.addError("KEYWORD_TYPE_EXPECTED",["anyOf","array"]);else if(0===c.anyOf.length)a.addError("KEYWORD_MUST_BE",["anyOf","an array with at least one element"]);else for(var d=c.anyOf.length;d--;)a.path.push("anyOf"),a.path.push(d.toString()),b.validateSchema.call(this,a,c.anyOf[d]),a.path.pop(),a.path.pop()},oneOf:function(a,c){if(Array.isArray(c.oneOf)===!1)a.addError("KEYWORD_TYPE_EXPECTED",["oneOf","array"]);else if(0===c.oneOf.length)a.addError("KEYWORD_MUST_BE",["oneOf","an array with at least one element"]);else for(var d=c.oneOf.length;d--;)a.path.push("oneOf"),a.path.push(d.toString()),b.validateSchema.call(this,a,c.oneOf[d]),a.path.pop(),a.path.pop()},not:function(c,d){"object"!==a.whatIs(d.not)?c.addError("KEYWORD_TYPE_EXPECTED",["not","object"]):(c.path.push("not"),b.validateSchema.call(this,c,d.not),c.path.pop())},definitions:function(c,d){if("object"!==a.whatIs(d.definitions))c.addError("KEYWORD_TYPE_EXPECTED",["definitions","object"]);else for(var e=Object.keys(d.definitions),f=e.length;f--;){var g=e[f],h=d.definitions[g];c.path.push("definitions"),c.path.push(g),b.validateSchema.call(this,c,h),c.path.pop(),c.path.pop()}},format:function(b,a){"string"!=typeof a.format?b.addError("KEYWORD_TYPE_EXPECTED",["format","string"]):void 0===e[a.format]&&b.addError("UNKNOWN_FORMAT",[a.format])},id:function(a,b){"string"!=typeof b.id&&a.addError("KEYWORD_TYPE_EXPECTED",["id","string"])},title:function(a,b){"string"!=typeof b.title&&a.addError("KEYWORD_TYPE_EXPECTED",["title","string"])},description:function(a,b){"string"!=typeof b.description&&a.addError("KEYWORD_TYPE_EXPECTED",["description","string"])},default:function(){}},h=function(a,c){for(var d=c.length;d--;)b.validateSchema.call(this,a,c[d]);return a.isValid()};b.validateSchema=function(b,a){if(Array.isArray(a))return h.call(this,b,a);if(a.__$validated)return!0;var i=a.$schema&&a.id!==a.$schema;if(i)if(a.__$schemaResolved&&a.__$schemaResolved!==a){var j=new g(b),n=f.validate.call(this,j,a.__$schemaResolved,a);n===!1&&b.addError("PARENT_SCHEMA_VALIDATION_FAILED",null,j)}else this.options.ignoreUnresolvableReferences!==!0&&b.addError("REF_UNRESOLVED",[a.$schema]);if(this.options.noTypeless===!0){if(void 0!==a.type){var c=[];Array.isArray(a.anyOf)&&(c=c.concat(a.anyOf)),Array.isArray(a.oneOf)&&(c=c.concat(a.oneOf)),Array.isArray(a.allOf)&&(c=c.concat(a.allOf)),c.forEach(function(b){b.type||(b.type=a.type)})}void 0===a.type&&void 0===a.anyOf&&void 0===a.oneOf&&void 0===a.not&&void 0===a.$ref&&b.addError("KEYWORD_UNDEFINED_STRICT",["type"])}for(var k=Object.keys(a),l=k.length;l--;){var e=k[l];0!==e.indexOf("__")&&(void 0!==d[e]?d[e].call(this,b,a):i||this.options.noExtraKeywords===!0&&b.addError("KEYWORD_UNEXPECTED",[e]))}var m=b.isValid();return m&&(a.__$validated=!0),m}},{"./FormatValidators":3,"./JsonValidation":4,"./Report":6,"./Utils":10}],10:[function(b,c,a){"use strict";a.whatIs=function(a){var b=typeof a;return"object"===b?null===a?"null":Array.isArray(a)?"array":"object":"number"===b?Number.isFinite(a)?a%1===0?"integer":"number":Number.isNaN(a)?"not-a-number":"unknown-number":b},a.areEqual=function g(c,d){if(c===d)return!0;var b,e;if(Array.isArray(c)&&Array.isArray(d)){if(c.length!==d.length)return!1;for(e=c.length,b=0;e>b;b++)if(!g(c[b],d[b]))return!1;return!0}if("object"===a.whatIs(c)&&"object"===a.whatIs(d)){var f=Object.keys(c),h=Object.keys(d);if(!g(f,h))return!1;for(e=f.length,b=0;e>b;b++)if(!g(c[f[b]],d[f[b]]))return!1;return!0}return!1},a.isUniqueArray=function(d,e){var b,c,f=d.length;for(b=0;f>b;b++)for(c=b+1;f>c;c++)if(a.areEqual(d[b],d[c]))return e&&e.push(b,c),!1;return!0},a.difference=function(a,d){for(var c=[],b=a.length;b--;)-1===d.indexOf(a[b])&&c.push(a[b]);return c},a.clone=function(a){if("object"!=typeof a||null===a)return a;var c,b;if(Array.isArray(a))for(c=[],b=a.length;b--;)c[b]=a[b];else{c={};var d=Object.keys(a);for(b=d.length;b--;){var e=d[b];c[e]=a[e]}}return c}},{}],C768cZ:[function(b,h,l){"use strict";function a(a){if(this.cache={},"object"==typeof a){for(var b=Object.keys(a),c=b.length;c--;){var d=b[c];if(void 0===f[d])throw new Error("Unexpected option passed to constructor: "+d)}this.options=a}else this.options=j.clone(f);this.options.strictMode===!0&&(this.options.forceAdditional=!0,this.options.forceItems=!0,this.options.forceMaxLength=!0,this.options.forceProperties=!0,this.options.noExtraKeywords=!0,this.options.noTypeless=!0,this.options.noEmptyStrings=!0,this.options.noEmptyArrays=!0)}b("./Polyfills");var d=b("./Report"),i=b("./FormatValidators"),k=b("./JsonValidation"),c=b("./SchemaCache"),e=b("./SchemaCompilation"),g=b("./SchemaValidation"),j=b("./Utils"),f={asyncTimeout:2e3,forceAdditional:!1,assumeAdditional:!1,forceItems:!1,forceMaxLength:!1,forceProperties:!1,ignoreUnresolvableReferences:!1,noExtraKeywords:!1,noTypeless:!1,noEmptyStrings:!1,noEmptyArrays:!1,strictUris:!1,strictMode:!1,reportPathAsArray:!1};a.prototype.compileSchema=function(a){var b=new d(this.options);return"string"==typeof a&&(a=c.getSchemaByUri.call(this,b,a)),e.compileSchema.call(this,b,a),this.lastReport=b,b.isValid()},a.prototype.validateSchema=function(a){var b=new d(this.options);"string"==typeof a&&(a=c.getSchemaByUri.call(this,b,a));var f=e.compileSchema.call(this,b,a);return f&&g.validateSchema.call(this,b,a),this.lastReport=b,b.isValid()},a.prototype.validate=function(h,b,f){var a=new d(this.options);"string"==typeof b&&(b=c.getSchemaByUri.call(this,a,b));var i=e.compileSchema.call(this,a,b);if(!i)return this.lastReport=a,!1;var j=g.validateSchema.call(this,a,b);if(!j)return this.lastReport=a,!1;if(k.validate.call(this,a,b,h),f)return void a.processAsyncTasks(this.options.asyncTimeout,f);if(a.asyncTasks.length>0)throw new Error("This validation has async tasks and cannot be done in sync mode, please provide callback argument.");return this.lastReport=a,a.isValid()},a.prototype.getLastErrors=function(){return this.lastReport.errors.length>0?this.lastReport.errors:void 0},a.prototype.getMissingReferences=function(){for(var a=[],b=this.lastReport.errors.length;b--;){var c=this.lastReport.errors[b];if("UNRESOLVABLE_REFERENCE"===c.code){var d=c.params[0];-1===a.indexOf(d)&&a.push(d)}}return a},a.prototype.getMissingRemoteReferences=function(){for(var d=this.getMissingReferences(),a=[],e=d.length;e--;){var b=c.getRemotePath(d[e]);b&&-1===a.indexOf(b)&&a.push(b)}return a},a.prototype.setRemoteReference=function(b,a){"string"==typeof a&&(a=JSON.parse(a)),c.cacheSchemaByUri.call(this,b,a)},a.registerFormat=function(a,b){i[a]=b},a.registerFormatter=function(){},h.exports=a},{"./FormatValidators":3,"./JsonValidation":4,"./Polyfills":5,"./Report":6,"./SchemaCache":7,"./SchemaCompilation":8,"./SchemaValidation":9,"./Utils":10}],ZSchema:[function(a,b,c){b.exports=a("C768cZ")},{}]},{},[2,3,4,5,6,7,8,9,10,"C768cZ"]);var ZSchema=require("ZSchema");!function(y,m,a,b,l){if(y&&"undefined"==typeof b&&(b=require("underscore"),"undefined"===b))throw"Failed to load underscore.js";var w=function(a){return a?{groupClass:"control-group",groupMarkClassPrefix:"",labelClass:"control-label",controlClass:"controls",iconClassPrefix:"icon",buttonClass:"btn",textualInputClass:"",prependClass:"input-prepend",appendClass:"input-append",addonClass:"add-on",inlineClassSuffix:" inline"}:{groupClass:"form-group",groupMarkClassPrefix:"has-",labelClass:"control-label",controlClass:"controls",iconClassPrefix:"glyphicon glyphicon",buttonClass:"btn btn-default",textualInputClass:"form-control",prependClass:"input-group",appendClass:"input-group",addonClass:"input-group-addon",buttonAddonClass:"input-group-btn",inlineClassSuffix:"-inline"}},g=/\[([0-9]*)\](?=\[|\.|$)/g,r={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},n={evaluate:/\{\[([\s\S]+?)\]\}/g,interpolate:/\{\{([\s\S]+?)\}\}/g},j="string"==typeof b.template("",{})?b.template:function(a,c,d){return b.template(a,d)(c)},e=function(a){return!(b.isUndefined(a)||b.isNull(a))},q=function(a,b){return"object"==typeof a&&Object.prototype.hasOwnProperty.call(a,b)},c={util:{}},o=function(a){return e(a)?(a=""+a,a?a.replace(/&(?!\w+;|#\d+;|#x[\da-f]+;)/gi,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;"):""):""},f=function(a){return a.replace(/([ \!\"\#\$\%\&\'\(\)\*\+\,\.\/\:\;<\=\>\?\@\[\\\]\^\`\{\|\}\~])/g,"\\$1")},x=function(d){var b=function(a,b){b.find("> .active").removeClass("active"),a.addClass("active")},c=function(a,b){a.find("input, textarea, select").removeAttr("disabled"),a.parent().children(":not([data-idx="+b+"])").find("input, textarea, select").attr("disabled","disabled")},e=function(g){var d,e=a("option:selected",a(this)),h=a(this),f=e.get(0).getAttribute("data-idx")||e.attr("value");g.preventDefault(),e.hasClass("active")||(d=a(this).parents(".tabbable").eq(0).find("> .tab-content > [data-idx="+f+"]"),b(e,h),b(d,d.parent()),c(d,f))},f=function(f){var g=(a("a",a(this)),a(this).parents(".tabbable").first().find(".tab-content").first()),e=a(this).index(),d=g.find("[data-idx="+e+"]");f.preventDefault(),b(a(this),a(this).parent()),b(d,d.parent()),a(this).parent().hasClass("jsonform-alternative")&&c(d,e)};d.each(function(){a(this).delegate("select.nav","change",e),a(this).find("select.nav").each(function(){a(this).val(a(this).find(".active").attr("value"));var b=a(this).find("option:selected").get(0).getAttribute("data-idx")||a(this).find("option:selected").attr("value"),d=a(this).parents(".tabbable").eq(0).find("> .tab-content > [data-idx="+b+"]");c(d,b)}),a(this).delegate("ul.nav li","click",f),a(this).find("ul.nav li.active").click()})};c.fieldTemplate=function(a){return'<div class="<%= cls.groupClass %> jsonform-node jsonform-error-<%= keydash %><%= elt.htmlClass ? " " + elt.htmlClass : "" %><%= (node.required && node.formElement && (node.formElement.type !== "checkbox") ? " jsonform-required" : "") %><%= (node.isReadOnly() ? " jsonform-readonly" : "") %><%= (node.disabled ? " jsonform-disabled" : "") %>" data-jsonform-type="<%= node.formElement.type %>"><% if (node.title && !elt.notitle && elt.inlinetitle !== true) { %><label class="<%= cls.labelClass %>" for="<%= node.id %>"><%= node.title %></label><% } %><div class="<%= cls.controlClass %>"><% if (node.description) { %><span class="help-block jsonform-description"><%= node.description %></span><% } %><% if (node.prepend || node.append) { %><div class="<%= node.prepend ? cls.prependClass : "" %> <%= node.append ? cls.appendClass : "" %>"><% if (node.prepend && node.prepend.indexOf("<button ") >= 0) { %><% if (cls.buttonAddonClass) { %><span class="<%= cls.buttonAddonClass %>"><%= node.prepend %></span><% } else { %><%= node.prepend %><% } %><% } %><% if (node.prepend && node.prepend.indexOf("<button ") < 0) { %><span class="<%= cls.addonClass %>"><%= node.prepend %></span><% } %><% } %>'+a+'<% if (node.append && node.append.indexOf("<button ") >= 0) { %><% if (cls.buttonAddonClass) { %><span class="<%= cls.buttonAddonClass %>"><%= node.append %></span><% } else { %><%= node.append %><% } %><% } %><% if (node.append && node.append.indexOf("<button ") < 0) { %><span class="<%= cls.addonClass %>"><%= node.append %></span><% } %><% if (node.prepend || node.append) { %></div><% } %><span class="help-block jsonform-errortext" style="display:none;"></span></div></div>'};var u='<div class="_jsonform-preview"><% if (value.type=="image") { %><img class="jsonform-preview" id="jsonformpreview-<%= id %>" src="<%= value.url %>" /><% } else { %><a href="<%= value.url %>"><%= value.name %></a> (<%= Math.ceil(value.size/1024) %>kB)<% } %></div><a href="#" class="<%= cls.buttonClass %> _jsonform-delete"><i class="<%= cls.iconClassPrefix %>-remove" title="Remove"></i></a> ',h=function(e,f,d){var c={template:'<input type="'+e+'" class="<%= fieldHtmlClass'+(f?" || cls.textualInputClass":"")+' %>" name="<%= node.name %>" value="<%= escape(value) %>" id="<%= id %>"<%= (node.disabled? " disabled" : "")%><%= (node.isReadOnly() ? " readonly=\'readonly\'" : "") %><%= (node.schemaElement && node.schemaElement.maxLength ? " maxlength=\'" + node.schemaElement.maxLength + "\'" : "") %><%= (node.required ? " required=\'required\'" : "") %><%= (node.placeholder? " placeholder=" + \'"\' + escape(node.placeholder) + \'"\' : "")%> />',fieldtemplate:!0,inputfield:!0,onInsert:function(h,b){if(b.formElement&&b.formElement.autocomplete){var c=a(b.el).find("input");c.autocomplete&&c.autocomplete(b.formElement.autocomplete)}if(b.formElement&&(b.formElement.tagsinput||"tagsvalue"===b.formElement.getValue)){if(!a.fn.tagsinput)throw new Error("tagsinput is not found");var c=a(b.el).find("input"),f=Array.isArray(b.value);f&&c.attr("value","").val(""),c.tagsinput(b.formElement?b.formElement.tagsinput||{}:{}),f&&b.value.forEach(function(a){c.tagsinput("add",a)})}if(b.formElement&&b.formElement.typeahead){var c=a(b.el).find("input");if(c.typeahead)if(Array.isArray(b.formElement.typeahead)){for(var e=1;e<b.formElement.typeahead.length;++e){var d=b.formElement.typeahead[e];if(d.source&&Array.isArray(d.source)){var g=d.source;d.source=function(a,b){var c=a.toLowerCase();b(g.filter(function(a){return a.toLowerCase().indexOf(c)>=0}).map(function(a){return"string"==typeof a?{value:a}:a}))}}}a.fn.typeahead.apply(c,b.formElement.typeahead)}else c.typeahead(b.formElement.typeahead)}}};return d&&(c=b.extend(c,d)),c},t=function(a,b){return{template:'<input type="'+a+'" class="<%= fieldHtmlClass'+(b?" || cls.textualInputClass":"")+' %>" name="<%= node.name %>" value="<%= escape(value) %>" id="<%= id %>"<%= (node.disabled? " disabled" : "")%><%= (node.isReadOnly() ? " readonly=\'readonly\'" : "") %><%= (range.min !== undefined ? " min="+range.min : "")%><%= (range.max !== undefined ? " max="+range.max : "")%><%= (range.step !== undefined ? " step="+range.step : "")%><%= (node.schemaElement && node.schemaElement.maxLength ? " maxlength=\'" + node.schemaElement.maxLength + "\'" : "") %><%= (node.required ? " required=\'required\'" : "") %><%= (node.placeholder? "placeholder=" + \'"\' + escape(node.placeholder) + \'"\' : "")%> />',fieldtemplate:!0,inputfield:!0,onBeforeRender:function(c,b){if(c.range={step:1},"range"==a&&(c.range.min=1,c.range.max=100),b&&b.schemaElement){b.formElement&&b.formElement.step?c.range.step=b.formElement.step:"number"==b.schemaElement.type&&(c.range.step="any");var d="any"===c.range.step?1:c.range.step;"undefined"!=typeof b.schemaElement.minimum&&(b.schemaElement.exclusiveMinimum?c.range.min=b.schemaElement.minimum+d:c.range.min=b.schemaElement.minimum),"undefined"!=typeof b.schemaElement.maximum&&(b.schemaElement.exclusiveMaximum?c.range.max=b.schemaElement.maximum-d:c.range.max=b.schemaElement.maximum)}}}};c.elementTypes={none:{template:""},root:{template:"<div><%= children %></div>"},text:h("text",!0),password:h("password",!0),date:h("date",!0,{onInsert:function(f,c){if(window.Modernizr&&window.Modernizr.inputtypes&&!window.Modernizr.inputtypes.date){var d=a(c.el).find("input");if(d.datepicker){var e={dateFormat:"yy-mm-dd"};c.formElement&&c.formElement.datepicker&&"object"==typeof c.formElement.datepicker&&b.extend(e,c.formElement.datepicker),d.datepicker(e)}}}}),datetime:h("datetime",!0),"datetime-local":h("datetime-local",!0,{onBeforeRender:function(a,b){a.value&&a.value.getTime&&(a.value=new Date(a.value.getTime()-6e4*a.value.getTimezoneOffset()).toISOString().slice(0,-1))}}),email:h("email",!0),month:h("month",!0),number:t("number",!0),search:h("search",!0),tel:h("tel",!0),time:h("time",!0),url:h("url",!0),week:h("week",!0),range:t("range"),color:{template:'<input type="text" <%= (fieldHtmlClass ? "class=\'" + fieldHtmlClass + "\' " : "") %>name="<%= node.name %>" value="<%= escape(value) %>" id="<%= id %>"<%= (node.disabled? " disabled" : "")%><%= (node.required ? " required=\'required\'" : "") %> />',fieldtemplate:!0,inputfield:!0,onInsert:function(c,b){a(b.el).find("#"+f(b.id)).spectrum({preferredFormat:"hex",showInput:!0})}},textarea:{template:'<textarea id="<%= id %>" name="<%= node.name %>" class="<%= fieldHtmlClass || cls.textualInputClass %>" style="<%= elt.height ? "height:" + elt.height + ";" : "" %>width:<%= elt.width || "100%" %>;"<%= (node.disabled? " disabled" : "")%><%= (node.isReadOnly() ? " readonly=\'readonly\'" : "") %><%= (node.schemaElement && node.schemaElement.maxLength ? " maxlength=\'" + node.schemaElement.maxLength + "\'" : "") %><%= (node.required ? " required=\'required\'" : "") %><%= (node.placeholder? " placeholder=" + \'"\' + escape(node.placeholder) + \'"\' : "")%>><%= value %></textarea>',fieldtemplate:!0,inputfield:!0},wysihtml5:{template:'<textarea id="<%= id %>" name="<%= node.name %>" style="height:<%= elt.height || "300px" %>;width:<%= elt.width || "100%" %>;"<%= (node.disabled? " disabled" : "")%><%= (node.isReadOnly() ? " readonly=\'readonly\'" : "") %><%= (node.schemaElement && node.schemaElement.maxLength ? " maxlength=\'" + node.schemaElement.maxLength + "\'" : "") %><%= (node.required ? " required=\'required\'" : "") %><%= (node.placeholder? " placeholder=" + \'"\' + escape(node.placeholder) + \'"\' : "")%>><%= value %></textarea>',fieldtemplate:!0,inputfield:!0,onInsert:function(e,b){var c=function(){a(b.el).data("wysihtml5")||(a(b.el).data("wysihtml5_loaded",!0),a(b.el).find("#"+f(b.id)).wysihtml5({html:!0,link:!0,"font-styles":!0,image:!0,events:{load:function(){a(this.textareaElement).removeAttr("required")}}}))};if(window.jsonform_wysihtml5_setup)return void window.jsonform_wysihtml5_setup(c);var d=window.setInterval(function(){window.wysihtml5&&(window.clearInterval(d),c())},1e3)}},ace:{template:'<div id="<%= id %>" style="position:relative;height:<%= elt.height || "300px" %>;"><div id="<%= id %>__ace" style="width:<%= elt.width || "100%" %>;height:<%= elt.height || "300px" %>;"></div><input type="hidden" name="<%= node.name %>" id="<%= id %>__hidden" value="<%= escape(value) %>"/></div>',fieldtemplate:!0,inputfield:!0,onBeforeRender:function(a,b){(a.value&&"object"==typeof a.value||Array.isArray(a.value))&&(a.value=l.stringify(a.value,null,2))},onInsert:function(g,c){var d=function(){var h=c.formElement||{},i=window.ace,d=i.edit(a(c.el).find("#"+f(c.id)+"__ace").get(0)),g="#"+f(c.id)+"__hidden";d.getSession().setNewLineMode("unix"),d.renderer.setShowPrintMargin(!1),d.setTheme("ace/theme/"+(h.aceTheme||"twilight")),h.aceMode&&d.getSession().setMode("ace/mode/"+h.aceMode),d.getSession().setTabSize(2);var e=c.value;null===e||void 0===e?e="":("object"==typeof e||Array.isArray(e))&&(e=l.stringify(e,null,2)),d.getSession().setValue(e);var j=b.debounce(function(){a(c.el).find(g).val(d.getSession().getValue()),a(c.el).find(g).change()},600);d.getSession().on("change",j),d.on("blur",function(){a(c.el).find(g).change(),a(c.el).find(g).trigger("blur")}),d.on("focus",function(){a(c.el).find(g).trigger("focus")})};if(window.jsonform_ace_setup)return void window.jsonform_ace_setup(d);var e=window.setInterval(function(){window.ace&&(window.clearInterval(e),d())},1e3)}},checkbox:{template:'<div class="checkbox"><label><input type="checkbox" id="<%= id %>" name="<%= node.name %>" value="1" <% if (value) {%>checked<% } %><%= (node.disabled? " disabled" : "")%><%= (node.required && node.schemaElement && (node.schemaElement.type !== "boolean") ? " required=\'required\'" : "") %> /><span><%= (node.inlinetitle === true ? node.title : node.inlinetitle) || "" %></span></label></div>',fieldtemplate:!0,inputfield:!0,onInsert:function(f,b){if(b.formElement.toggleNext){var c=b.formElement.toggleNext===!0?1:b.formElement.toggleNext,e="jsonform-toggle-next jsonform-toggle-next-"+c,d=1===c?a(b.el).next():"all"===c?a(b.el).nextAll():a(b.el).nextAll().slice(0,c);d.addClass("jsonform-toggle-next-target"),a(b.el).addClass(e).find(":checkbox").on("change",function(){var e=a(this),c=e.is(":checked");a(b.el).toggleClass("checked",c),d.toggle(c).toggleClass("jsonform-toggled-visible",c)}).change()}},getElement:function(b){return a(b).parent().parent().get(0)}},file:{template:'<input class="input-file" id="<%= id %>" name="<%= node.name %>" type="file" <%= (node.required ? " required=\'required\'" : "") %>/>',fieldtemplate:!0,inputfield:!0},"file-hosted-public":{template:"<span><% if (value && (value.type||value.url)) { %>"+u+'<% } %><input class="input-file" id="_transloadit_<%= id %>" type="file" name="<%= transloaditname %>" /><input data-transloadit-name="_transloadit_<%= transloaditname %>" type="hidden" id="<%= id %>" name="<%= node.name %>" value=\'<%= escape(JSON.stringify(node.value)) %>\' /></span>',fieldtemplate:!0,inputfield:!0,getElement:function(b){return a(b).parent().get(0)},onBeforeRender:function(b,a){a.ownerTree._transloadit_generic_public_index?a.ownerTree._transloadit_generic_public_index++:a.ownerTree._transloadit_generic_public_index=1,b.transloaditname="_transloadit_jsonform_genericupload_public_"+a.ownerTree._transloadit_generic_public_index,a.ownerTree._transloadit_generic_elts||(a.ownerTree._transloadit_generic_elts={}),a.ownerTree._transloadit_generic_elts[b.transloaditname]=a},onChange:function(g,c){if(c.ownerTree._transloadit_bound)return!1;c.ownerTree._transloadit_bound=!0;var d=a(c.ownerTree.domRoot);d.transloadit({autoSubmit:!1,wait:!0,onSuccess:function(g){var a=b.values(g.results);a=b.flatten(a),b.each(a,function(a){var g=c.ownerTree._transloadit_generic_elts[a.field].id,h=d.find("#"+f(g)),i=b.filter(b.keys(a.meta),function(b){return!!e(a.meta[b])});a.meta=b.pick(a.meta,i),h.val(l.stringify(a))}),c.ownerTree._transloadit_bound=!1,d.unbind("submit.transloadit"),b.delay(function(){console.log("submit form"),c.ownerTree.submit()},10)},onError:function(a){console.log("assembly error",a)}})},onInsert:function(c,b){a(b.el).find("a._jsonform-delete").on("click",function(c){return a(b.el).find("._jsonform-preview").remove(),a(b.el).find("a._jsonform-delete").remove(),a(b.el).find("#"+f(b.id)).val(""),c.preventDefault(),!1})},onSubmit:function(b,a){return a.ownerTree._transloadit_bound?!1:!0}},"file-transloadit":{template:"<span><% if (value && (value.type||value.url)) { %>"+u+'<% } %><input class="input-file" id="_transloadit_<%= id %>" type="file" name="_transloadit_<%= node.name %>" /><input type="hidden" id="<%= id %>" name="<%= node.name %>" value=\'<%= escape(JSON.stringify(node.value)) %>\' /></span>',fieldtemplate:!0,inputfield:!0,getElement:function(b){return a(b).parent().get(0)},onChange:function(f,c){if(c.ownerTree._transloadit_bound)return!1;c.ownerTree._transloadit_bound=!0;var d=a(c.ownerTree.domRoot);d.transloadit({autoSubmit:!1,wait:!0,onSuccess:function(f){var a=b.values(f.results);a=b.flatten(a),b.each(a,function(a){var c=d.find('input[name="'+a.field.replace(/^_transloadit_/,"")+'"]'),f=b.filter(b.keys(a.meta),function(b){return!!e(a.meta[b])});a.meta=b.pick(a.meta,f),c.val(l.stringify(a))}),c.ownerTree._transloadit_bound=!1,d.unbind("submit.transloadit"),b.delay(function(){console.log("submit form"),c.ownerTree.submit()},10)},onError:function(a){console.log("assembly error",a)}})},onInsert:function(c,b){a(b.el).find("a._jsonform-delete").on("click",function(c){return a(b.el).find("._jsonform-preview").remove(),a(b.el).find("a._jsonform-delete").remove(),a(b.el).find("#"+f(b.id)).val(""),c.preventDefault(),!1})},onSubmit:function(b,a){return a.ownerTree._transloadit_bound?!1:!0}},select:{template:'<select name="<%= node.name %>" id="<%= id %>" class="<%= fieldHtmlClass || cls.textualInputClass %>"<%= (node.disabled? " disabled" : "")%><%= (node.required ? " required=\'required\'" : "") %>> <% _.each(node.options, function(key, val) { if(key instanceof Object) { if (value === key.value) { %> <option selected value="<%= key.value %>"><%= key.title %></option> <% } else { %> <option value="<%= key.value %>"><%= key.title %></option> <% }} else { if (value === key) { %> <option selected value="<%= key %>"><%= key %></option> <% } else { %><option value="<%= key %>"><%= key %></option> <% }}}); %> </select>',fieldtemplate:!0,inputfield:!0},tagsinput:{template:'<select name="<%= node.name %><%= node.formElement.getValue === "tagsinput" ? "" : "[]" %>" id="<%= id %>" class="<%= fieldHtmlClass || cls.textualInputClass %>" multiple<%= (node.disabled? " disabled" : "")%><%= (node.required ? " required=\'required\'" : "") %>> </select>',fieldtemplate:!0,inputfield:!0,onInsert:function(d,b){if(!a.fn.tagsinput)throw new Error("tagsinput is not found");var c=a(b.el).find("select");c.tagsinput(b.formElement?b.formElement.tagsinput||{}:{}),b.value&&b.value.forEach(function(a){c.tagsinput("add",a)})}},imageselect:{template:'<div><input type="hidden" name="<%= node.name %>" id="<%= node.id %>" value="<%= value %>" /><div class="dropdown"><a class="<%= node.value ? buttonClass : cls.buttonClass %>" data-toggle="dropdown" href="#"<% if (node.value) { %> style="max-width:<%= width %>px;max-height:<%= height %>px"<% } %>><% if (node.value) { %><img src="<% if (!node.value.match(/^https?:/)) { %><%= prefix %><% } %><%= node.value %><%= suffix %>" alt="" /><% } else { %><%= buttonTitle %><% } %></a><div class="dropdown-menu navbar" id="<%= node.id %>_dropdown"><div><% _.each(node.options, function(key, idx) { if ((idx > 0) && ((idx % columns) === 0)) { %></div><div><% } %><a class="<%= buttonClass %>" style="max-width:<%= width %>px;max-height:<%= height %>px"><% if (key instanceof Object) { %><img src="<% if (!key.value.match(/^https?:/)) { %><%= prefix %><% } %><%= key.value %><%= suffix %>" alt="<%= key.title %>" /></a><% } else { %><img src="<% if (!key.match(/^https?:/)) { %><%= prefix %><% } %><%= key %><%= suffix %>" alt="" /><% } %></a> <% }); %></div><div class="pagination-right"><a class="<%= cls.buttonClass %>">Reset</a></div></div></div></div>',
  fieldtemplate:!0,inputfield:!0,onBeforeRender:function(a,c){var b=c.formElement||{},e=null,d=b.imageSelectorColumns||5;a.buttonTitle=b.imageSelectorTitle||"Select...",a.prefix=b.imagePrefix||"",a.suffix=b.imageSuffix||"",a.width=b.imageWidth||32,a.height=b.imageHeight||32,a.buttonClass=b.imageButtonClass||a.cls.buttonClass,c.options.length>d?(e=Math.ceil(c.options.length/d),a.columns=Math.ceil(c.options.length/e)):a.columns=d},getElement:function(b){return a(b).parent().get(0)},onInsert:function(c,b){a(b.el).on("click",".dropdown-menu a",function(e){e.preventDefault(),e.stopPropagation();var h="img"===e.target.nodeName.toLowerCase()?a(e.target):a(e.target).find("img"),c=h.attr("src"),d=b.formElement||{},f=d.imagePrefix||"",g=d.imageSuffix||"",i=d.imageWidth||32,j=d.imageHeight||32;c?(0===c.indexOf(f)&&(c=c.substring(f.length)),c=c.substring(0,c.length-g.length),a(b.el).find("input").attr("value",c),a(b.el).find('a[data-toggle="dropdown"]').addClass(d.imageButtonClass).attr("style","max-width:"+i+"px;max-height:"+j+"px").html('<img src="'+(c.match(/^https?:/)?"":f)+c+g+'" alt="" />')):(a(b.el).find("input").attr("value",""),a(b.el).find('a[data-toggle="dropdown"]').removeClass(d.imageButtonClass).removeAttr("style").html(d.imageSelectorTitle||"Select..."))})}},iconselect:{template:'<div><input type="hidden" name="<%= node.name %>" id="<%= node.id %>" value="<%= value %>" /><div class="dropdown"><a class="<%= node.value ? buttonClass : cls.buttonClass %>" data-toggle="dropdown" href="#"<% if (node.value) { %> style="max-width:<%= width %>px;max-height:<%= height %>px"<% } %>><% if (node.value) { %><i class="<%= cls.iconClassPrefix %>-<%= node.value %>" /><% } else { %><%= buttonTitle %><% } %></a><div class="dropdown-menu navbar" id="<%= node.id %>_dropdown"><div><% _.each(node.options, function(key, idx) { if ((idx > 0) && ((idx % columns) === 0)) { %></div><div><% } %><a class="<%= buttonClass %>" ><% if (key instanceof Object) { %><i class="<%= cls.iconClassPrefix %>-<%= key.value %>" alt="<%= key.title %>" /></a><% } else { %><i class="<%= cls.iconClassPrefix %>-<%= key %>" alt="" /><% } %></a> <% }); %></div><div class="pagination-right"><a class="<%= cls.buttonClass %>">Reset</a></div></div></div></div>',fieldtemplate:!0,inputfield:!0,onBeforeRender:function(a,b){var c=b.formElement||{},e=null,d=c.imageSelectorColumns||5;a.buttonTitle=c.imageSelectorTitle||"Select...",a.buttonClass=c.imageButtonClass||a.cls.buttonClass,b.options.length>d?(e=Math.ceil(b.options.length/d),a.columns=Math.ceil(b.options.length/e)):a.columns=d},getElement:function(b){return a(b).parent().get(0)},onInsert:function(c,b){a(b.el).on("click",".dropdown-menu a",function(c){c.preventDefault(),c.stopPropagation();var f="i"===c.target.nodeName.toLowerCase()?a(c.target):a(c.target).find("i"),d=f.attr("class"),e=b.formElement||{};d?(d=d,a(b.el).find("input").attr("value",d),a(b.el).find('a[data-toggle="dropdown"]').addClass(e.imageButtonClass).html('<i class="'+d+'" alt="" />')):(a(b.el).find("input").attr("value",""),a(b.el).find('a[data-toggle="dropdown"]').removeClass(e.imageButtonClass).html(e.imageSelectorTitle||"Select..."))})}},radios:{template:'<div id="<%= node.id %>"><% _.each(node.options, function(key, val) { %><% if (!elt.inline) { %><div class="radio"><label><% } else { %><label class="radio<%= cls.inlineClassSuffix %>"><% } %><input type="radio" <% if (((key instanceof Object) && (value === key.value)) || (value === key)) { %> checked="checked" <% } %> name="<%= node.name %>" value="<%= (key instanceof Object ? key.value : key) %>"<%= (node.disabled? " disabled" : "")%><%= (node.required ? " required=\'required\'" : "") %>/><span><%= (key instanceof Object ? key.title : key) %></span></label><%= elt.inline ? "" : "</div>" %> <% }); %></div>',fieldtemplate:!0,inputfield:!0,onInsert:function(i,b){if(b.formElement.toggleNextMap){var c={};for(var e in b.formElement.toggleNextMap){var f=b.formElement.toggleNextMap[e],d=f===!0?1:f,h="jsonform-toggle-next jsonform-toggle-next-"+d,g=1===d?a(b.el).next():"all"===d?a(b.el).nextAll():a(b.el).nextAll().slice(0,d);g.addClass("jsonform-toggle-next-target"),c[e]=g}a(b.el).addClass(h).find(":radio").on("change",function(){var f=a(this),g=f.val(),b=f.is(":checked");if(b)for(var d in c){var e=c[d];d===g?e.toggle(b).toggleClass("jsonform-toggled-visible",b):e.toggle(!b).toggleClass("jsonform-toggled-visible",!b)}else for(var d in c){var e=c[d];e.toggle(!1).toggleClass("jsonform-toggled-visible",!1)}}).change()}}},radiobuttons:{template:'<div id="<%= node.id %>"  class="<%= elt.htmlClass ? " " + elt.htmlClass : "" %>"><% _.each(node.options, function(key, val) { %><label class="<%= cls.buttonClass %>"><input type="radio" style="position:absolute;left:-9999px;" <% if (((key instanceof Object) && (value === key.value)) || (value === key)) { %> checked="checked" <% } %> name="<%= node.name %>" value="<%= (key instanceof Object ? key.value : key) %>" /><span><%= (key instanceof Object ? key.title : key) %></span></label> <% }); %></div>',fieldtemplate:!0,inputfield:!0,onInsert:function(e,c){var b="active",d=c.formElement||{};d.activeClass&&(b+=" "+d.activeClass),a(c.el).find("label").on("click",function(){a(this).parent().find("label").removeClass(b),a(this).addClass(b)}).find(":checked").closest("label").addClass(b)}},checkboxes:{template:'<div id="<%= node.id %>"><%= choiceshtml %><%= children %></div>',fieldtemplate:!0,inputfield:!0,childTemplate:function(d,a){if(!a.formElement.otherField)return d;var b="";a.formElement.otherField.asArrayValue&&a.otherValues&&(b+='<% value = node.parentNode.otherValues.join(", ") %>'),b+='<input type="checkbox"<%= value !== undefined && value !== null && value !== "" ? " checked=\'checked\'" : "" %>',(!a.formElement.otherField.asArrayValue&&a.formElement.otherField.novalue!==!0||a.formElement.otherField.novalue===!1)&&(b+=' name="'+a.key+"["+(void 0!==a.formElement.otherField.idx?a.formElement.otherField.idx:a.formElement.options.length)+']" value="'+(a.formElement.optionsAsEnumOrder?1:a.formElement.otherField.otherValue||"OTHER")+'"'),b+='<%= node.disabled? " disabled" : "" %> />',b+='<span><%= node.title || "Other" %> </span>';var c="other-field";return a.formElement.otherField.inline&&(b+='<div class="other-field-content">'+d+"</div>",c="inline-"+c),b=a.formElement.inline?'<label class="'+c+' checkbox<%= cls.inlineClassSuffix %>">'+b+"</label>":'<div class="'+c+' checkbox"><label>'+b+"</label></div>",a.formElement.otherField.inline||(b+='<div class="other-field-content">'+d+"</div>"),b},onBeforeRender:function(f,a){if(a&&a.schemaElement&&a.schemaElement.items){var d=a.formElement.options;if(d){var c='<input type="checkbox"<%= checked ? " checked=\'checked\'" : "" %> name="<%= name %>" value="<%= escape(value) %>"<%= node.disabled? " disabled" : "" %> /><span><%= title %></span>';c=a.formElement.inline?'<label class="checkbox'+f.cls.inlineClassSuffix+'">'+c+"</label>":'<div class="checkbox"><label>'+c+"</label></div>";var g="";if(a.formElement.otherField&&a.formElement.otherField.asArrayValue&&a.value){var h=d.map(function(a){return a.value}),e=[];a.value.forEach(function(a){b.include(h,a)||e.push(a)}),e.length>0&&(a.otherValues=e)}else delete a.otherValues;b.each(d,function(d,e){return a.formElement.otherField&&d.value===(a.formElement.otherField.otherValue||"OTHER")?void(a.formElement.otherField.idx=e):void(g+=j(c,{name:a.key+"["+e+"]",value:a.formElement.optionsAsEnumOrder?1:d.value,checked:b.include(a.value,d.value),title:d.title,node:a,escape:o},r))}),a.formElement.otherField,f.choiceshtml=g}}},onInsert:function(g,b){function f(c){var b=!1;return c.each(function(){var c=a(this);if(c.is(":checkbox, :radio")&&c.prop("checked"))return b=!0,!1;if(!c.is("button"))return""!==a(this).val()?(b=!0,!1):void 0}),b}function d(){e.prop("checked",f(c))}var e=b.formElement.otherField&&b.formElement.otherField.inline?a(b.el).find(".inline-other-field :checkbox").first():a(b.el).find(".other-field :checkbox"),c=a(b.el).find(".other-field-content :input");c.on("keyup",d).on("change",d).change(),e.on("change",function(){this.checked?(this.checked=!1,c.not(":checkbox,:radio,button").focus()):c.filter("input[type=text], textarea").val("")})}},checkboxbuttons:{template:'<div id="<%= node.id %>"><%= choiceshtml %></div>',fieldtemplate:!0,inputfield:!0,onBeforeRender:function(c,a){var d=null,e=null,f='<label class="<%= cls.buttonClass %> '+c.fieldHtmlClass+'"><input type="checkbox" style="position:absolute;left:-9999px;" <% if (checked) { %> checked="checked" <% } %> name="<%= name %>" value="<%= value %>"<%= (node.disabled? " disabled" : "")%>/><span><%= title %></span></label>';a&&a.schemaElement&&a.schemaElement.items&&(d=a.formElement.options,d&&(a.value&&Array.isArray(a.value)||(a.value=[]),e="",b.each(d,function(d,g){e+=j(f,{name:a.key+"["+g+"]",checked:b.include(a.value,d.value),value:d.value,title:d.title,node:a,cls:c.cls},r)}),c.choiceshtml=e))},onInsert:function(e,c){var b="active",d=c.formElement||{};d.activeClass&&(b+=" "+d.activeClass),a(c.el).find("label").on("click",function(){a(this).toggleClass(b,a(this).find("input:checkbox").prop("checked"))}).find(":checked").closest("label").addClass(b)}},array:{template:'<div id="<%= id %>"><ul class="_jsonform-array-ul" style="list-style-type:none;"><%= children %></ul><% if (!node.isReadOnly()) { %><span class="_jsonform-array-buttons"><a href="#" class="<%= cls.buttonClass %> _jsonform-array-addmore"><i class="<%= cls.iconClassPrefix %>-plus-sign" title="Add new"></i></a> <a href="#" class="<%= cls.buttonClass %> _jsonform-array-deletelast"><i class="<%= cls.iconClassPrefix %>-minus-sign" title="Delete last"></i></a></span><% } %></div>',fieldtemplate:!0,array:!0,childTemplate:function(b,c){return!c.isReadOnly()&&a("").sortable?'<li data-idx="<%= node.childPos %>"><span class="draggable line"><i class="<%= cls.iconClassPrefix %>-list" title="Move item"></i></span> <a href="#" class="_jsonform-array-item-delete"><i class="<%= cls.iconClassPrefix %>-remove" title="Remove item"></i></a>'+b+"</li>":'<li data-idx="<%= node.childPos %>">'+b+"</li>"},onInsert:function(k,b){var c=a(b.el).find("#"+f(b.id)),d=b.getArrayBoundaries(),i=function(d,e){if(d!==e){var j=e>d?1:-1,f=0,g=a("> ul",c);for(f=d;f!==e;f+=j)b.children[f].switchValuesWith(b.children[f+j]),b.children[f].render(g.get(0)),b.children[f+j].render(g.get(0));var h=a(b.children[d].el),i=a(b.children[e].el);h.detach(),i.detach(),e>d?(0===d?g.prepend(h):a(b.children[d-1].el).after(h),a(b.children[e-1].el).after(i)):(0===e?g.prepend(i):a(b.children[e-1].el).after(i),a(b.children[d-1].el).after(h))}},j=function(g){if(d.maxItems>=0){var e=d.maxItems-b.children.length;if(c.find("> span > a._jsonform-array-addmore").toggleClass("disabled",1>=e),1>e)return!1}b.insertArrayItem(g,a("> ul",c).get(0));var f=b.children.length>d.minItems;c.find("> span > a._jsonform-array-deletelast").toggleClass("disabled",!f),c.find("> ul > li > a._jsonform-array-item-delete").toggle(f)},e=function(e){var a=b.children.length-Math.max(d.minItems,0);return c.find("> span > a._jsonform-array-deletelast").toggleClass("disabled",1>=a),c.find("> ul > li > a._jsonform-array-item-delete").toggle(a>1),1>a?!1:(b.deleteArrayItem(e),void c.find("> span > a._jsonform-array-addmore").toggleClass("disabled",d.maxItems>=0&&b.children.length>=d.maxItems))};a("> span > a._jsonform-array-addmore",c).click(function(a){a.preventDefault(),a.stopPropagation();var c=b.children.length;j(c)});a("> ul > li",c).length;if(d.minItems>0)for(var g=b.children.length;g<d.minItems;g++)b.insertArrayItem(b.children.length,c.find("> ul").get(0));var h=b.children.length-Math.max(d.minItems,0);c.find("> span > a._jsonform-array-deletelast").toggleClass("disabled",0>=h),c.find("> ul > li > a._jsonform-array-item-delete").toggle(h>0),c.find("> span > a._jsonform-array-addmore").toggleClass("disabled",d.maxItems>=0&&b.children.length>=d.maxItems),a("> span > a._jsonform-array-deletelast",c).click(function(a){var c=b.children.length-1;a.preventDefault(),a.stopPropagation(),e(c)}),c.on("click","> ul > li > a._jsonform-array-item-delete",function(c){c.preventDefault();var d=a(c.currentTarget).parent();if(d.parent().parent().attr("id")==b.id){c.stopPropagation();var f=d.data("idx");e(f)}}),!b.isReadOnly()&&a(b.el).sortable&&(a("> ul",c).sortable(),a("> ul",c).bind("sortstop",function(e,b){var c=a(b.item).data("idx"),d=a(b.item).index();i(c,d)}))}},tabarray:{template:'<div id="<%= id %>"><div class="tabbable tabs-left"><ul class="nav nav-tabs"><%= tabs %></ul><div class="tab-content"><%= children %></div></div></div>',fieldtemplate:!0,array:!0,childTemplate:function(a){return'<div data-idx="<%= node.childPos %>" class="tab-pane">'+a+"</div>"},onBeforeRender:function(a,b){a.tabs=""},onInsert:function(m,c){var d=a(c.el).find("#"+f(c.id)),e=c.getArrayBoundaries(),l=function(e,f){if(e!==f){var g=f>e?1:-1,b=0,h=a("> .tabbable > .tab-content",d).get(0);for(b=e;b!==f;b+=g)c.children[b].switchValuesWith(c.children[b+g]),c.children[b].render(h),c.children[b+g].render(h)}},g=function(f){var g="",h=!1;void 0===f&&(f=a("> .tabbable > .nav-tabs .active",d).data("idx"),f?f=parseInt(f,10):(h=!0,f=0)),f>=c.children.length&&(f=c.children.length-1),b.each(c.children,function(a,b){var d=a.legend||a.title||"Item "+(b+1);g+='<li data-idx="'+b+'"><a class="draggable tab" data-toggle="tab">'+o(d),c.isReadOnly()||(g+=' <span href="#" class="_jsonform-array-item-delete"><i class="'+c.ownerTree.defaultClasses.iconClassPrefix+'-remove" title="Remove item"></i></span></a>'),g+="</li>"}),!c.isReadOnly()&&(e.maxItems<0||c.children.length<e.maxItems)&&(g+='<li data-idx="-1"><a class="tab _jsonform-array-addmore" title="'+(c.formElement.addMoreTooltip?o(c.formElement.addMoreTooltip):"Add new item")+'"><i class="'+c.ownerTree.defaultClasses.iconClassPrefix+'-plus-sign"></i> '+(c.formElement.addMoreTitle||"New")+"</a></li>"),a("> .tabbable > .nav-tabs",d).html(g);var i=e.minItems>=0&&c.children.length<=e.minItems;d.find("> .tabbable > .nav-tabs > li > a > ._jsonform-array-item-delete").toggle(!i),h&&a('> .tabbable > .nav-tabs [data-idx="0"]',d).addClass("active"),a('> .tabbable > .nav-tabs [data-toggle="tab"]',d).eq(f).click()},h=function(b){var a=c.children.length-Math.max(e.minItems,0);return d.find("> a._jsonform-array-deleteitem").toggleClass("disabled",1>=a),d.find("> .tabbable > .nav-tabs > li > a > ._jsonform-array-item-delete").toggle(a>1),1>a?!1:(c.deleteArrayItem(b),g(),void d.find("> a._jsonform-array-addmore").toggleClass("disabled",e.maxItems>=0&&c.children.length>=e.maxItems))},i=function(a){if(e.maxItems>=0){var b=e.maxItems-c.children.length;if(d.find("> a._jsonform-array-addmore").toggleClass("disabled",1>=b),1>b)return!1}c.insertArrayItem(a,d.find("> .tabbable > .tab-content").get(0)),g(a),d.find("> a._jsonform-array-deleteitem").toggleClass("disabled",c.children.length<=e.minItems)};if(a("> a._jsonform-array-deleteitem",d).click(function(b){var c=a("> .tabbable > .nav-tabs .active",d).data("idx");b.preventDefault(),b.stopPropagation(),h(c)}),d.on("click","> a._jsonform-array-addmore, > .tabbable > .nav-tabs > li > ._jsonform-array-addmore",function(a){var b=c.children.length;a.preventDefault(),a.stopPropagation(),i(b)}),d.on("click","> .tabbable > .nav-tabs > li > a > ._jsonform-array-item-delete",function(b){b.preventDefault(),b.stopPropagation();var c=a(b.currentTarget).closest("li").data("idx");h(c)}),a(c.el).on("legendUpdated",function(a){g(),a.preventDefault(),a.stopPropagation()}),!c.isReadOnly()&&a(c.el).sortable&&a("> .tabbable > .nav-tabs",d).sortable({containment:c.el,cancel:"._jsonform-array-addmore",tolerance:"pointer"}).on("sortchange",function(c,b){b.placeholder.index()==a(this).children().length-1&&-1==b.placeholder.prev().data("idx")&&b.placeholder.prev().before(b.placeholder)}).on("sortstop",function(e,b){var d=a(b.item).data("idx"),c=a(b.item).index();l(d,c),g(c)}),e.minItems>=0){for(var j=c.children.length;j<e.minItems;j++)i(c.children.length);g(0)}else g();d.find("> a._jsonform-array-addmore").toggleClass("disabled",e.maxItems>=0&&c.children.length>=e.maxItems);var k=e.minItems>=0&&c.children.length<=e.minItems;d.find("> a._jsonform-array-deleteitem").toggleClass("disabled",k),d.find("> .tabbable > .nav-tabs > li > a > ._jsonform-array-item-delete").toggle(!k)}},help:{template:'<span <%= id ? \'id="\' + id + \'"\' : "" %> class="help-block" style="padding-top:5px"><%= node.helpvalue || elt.helpvalue %></span>',fieldtemplate:!0},msg:{template:"<%= elt.msg %>"},html:{template:"<%= elt.html %>"},textview:{template:'<pre id="<%= id %>" name="<%= node.name %>"><%= value %></pre>',inputfield:!0,fieldtemplate:!0},fieldset:{template:'<fieldset class="jsonform-node jsonform-error-<%= keydash %> <% if (elt.expandable) { %>expandable<% } %> <%= elt.htmlClass?elt.htmlClass:"" %>" <% if (id) { %> id="<%= id %>"<% } %> data-jsonform-type="fieldset"><% if (node.title || node.legend) { %><legend><%= node.title || node.legend %></legend><% } %><% if (elt.expandable) { %><div hidden class="<%= cls.groupClass %>"><% } %><%= children %><% if (elt.expandable) { %></div><% } %><span class="help-block jsonform-errortext" style="display:none;"></span></fieldset>'},advancedfieldset:{template:'<fieldset<% if (id) { %> id="<%= id %>"<% } %> class="expandable jsonform-node jsonform-error-<%= keydash %> <%= elt.htmlClass?elt.htmlClass:"" %>" data-jsonform-type="advancedfieldset"><legend>Advanced options</legend><div hidden class="<%= cls.groupClass %>"><%= children %></div><span class="help-block jsonform-errortext" style="display:none;"></span></fieldset>'},authfieldset:{template:'<fieldset<% if (id) { %> id="<%= id %>"<% } %> class="expandable jsonform-node jsonform-error-<%= keydash %> <%= elt.htmlClass?elt.htmlClass:"" %>" data-jsonform-type="authfieldset"><legend>Authentication settings</legend><div hidden class="<%= cls.groupClass %>"><%= children %></div><span class="help-block jsonform-errortext" style="display:none;"></span></fieldset>'},submit:{template:'<input type="submit" <% if (id) { %> id="<%= id %>" <% } %> class="btn btn-primary <%= elt.htmlClass?elt.htmlClass:"" %>" value="<%= value || node.title %>"<%= (node.disabled? " disabled" : "")%>/>'},button:{template:' <button <% if (id) { %> id="<%= id %>" <% } %> class="<%= cls.buttonClass %> <%= elt.htmlClass?elt.htmlClass:"" %>"><%= node.title %></button> '},actions:{template:'<div class="form-actions <%= elt.htmlClass?elt.htmlClass:"" %>"><%= children %></div>'},hidden:{template:'<input type="hidden" id="<%= id %>" name="<%= node.name %>" value="<%= escape(value) %>" <%= (node.disabled? " disabled" : "")%> />',inputfield:!0},selectfieldset:{template:'<fieldset class="tab-container <%= elt.htmlClass?elt.htmlClass:"" %>"><% if (node.legend) { %><legend><%= node.legend %></legend><% } %><% if (node.formElement.key) { %><input type="hidden" id="<%= node.id %>" name="<%= node.name %>" value="<%= escape(value) %>" /><% } else { %><a id="<%= node.id %>"></a><% } %><div class="tabbable"><div class="<%= cls.groupClass %><%= node.formElement.hideMenu ? " hide" : "" %>"><% if (node.title && !elt.notitle) { %><label class="<%= cls.labelClass %>" for="<%= node.id %>"><%= node.title %></label><% } %><div class="<%= cls.controlClass %>"><%= tabs %></div></div><div class="tab-content"><%= children %></div></div></fieldset>',inputfield:!0,getElement:function(b){return a(b).parent().get(0)},childTemplate:function(a){return'<div data-idx="<%= node.childPos %>" class="tab-pane<% if (node.active) { %> active<% } %>">'+a+"</div>"},onBeforeRender:function(f,a){var g=null,d=[];a.schemaElement&&(d=a.schemaElement.enum||[]),g=a.options?b.map(a.options,function(c,g){var f=a.children[g];return c instanceof Object?(c=b.extend({node:f},c),c.title=c.title||f.legend||f.title||"Option "+(f.childPos+1),c.value=e(c.value)?c.value:e(d[g])?d[g]:g,c):{title:c,value:e(d[f.childPos])?d[f.childPos]:f.childPos,node:f}}):b.map(a.children,function(a,b){return{title:a.legend||a.title||"Option "+(a.childPos+1),value:d[a.childPos]||a.childPos,node:a}});var c=null;f.value&&(c=b.find(g,function(b){return b.value===a.value})),c||(c=b.find(g,function(a){return a.node.hasNonDefaultValue()})),c||(c=g[0]),c.node.active=!0,f.value=c.value;var h=(a.formElement,'<select class="nav '+f.cls.textualInputClass+'"'+(a.disabled?" disabled":"")+">");return b.each(g,function(a,b){h+='<option data-idx="'+b+'" value="'+a.value+'"'+(a.node.active?' class="active"':"")+">"+o(a.title)+"</option>"}),h+="</select>",f.tabs=h,f},onInsert:function(c,b){a(b.el).find("select.nav").first().on("change",function(d){var c=a(this).find("option:selected");a(b.el).find('input[type="hidden"]').first().val(c.attr("value"))})}},optionfieldset:{template:'<div<% if (node.id) { %> id="<%= node.id %>"<% } %>><%= children %></div>'},section:{template:'<div<% if (node.id) { %> id="<%= node.id %>"<% } %> class="jsonform-node jsonform-error-<%= keydash %> <%= elt.htmlClass?elt.htmlClass:"" %>"><%= children %></div>'},questions:{template:'<div><input type="hidden" id="<%= node.id %>" name="<%= node.name %>" value="<%= escape(value) %>" /><%= children %></div>',fieldtemplate:!0,inputfield:!0,getElement:function(b){return a(b).parent().get(0)},onInsert:function(d,c){c.children&&0!==c.children.length&&(b.each(c.children,function(b){a(b.el).hide()}),a(c.children[0].el).show())}},question:{template:'<div id="<%= node.id %>"><% _.each(node.options, function(key, val) { %><% if (elt.optionsType === "radiobuttons") { %><label class="<%= cls.buttonClass%> <%= ((key instanceof Object && key.htmlClass) ? " " + key.htmlClass : "") %>"><% } else { %><% if (!elt.inline) { %><div class="radio"><% } %><label class="<%= elt.inline ? "radio"+cls.inlineClassSuffix : "" %> <%= ((key instanceof Object && key.htmlClass) ? " " + key.htmlClass : "") %>"><% } %><input type="radio" <% if (elt.optionsType === "radiobuttons") { %> style="position:absolute;left:-9999px;" <% } %>name="<%= node.id %>" value="<%= val %>"<%= (node.disabled? " disabled" : "")%>/><span><%= (key instanceof Object ? key.title : key) %></span></label><%= elt.optionsType !== "radiobuttons" && !elt.inline ? "</div>" : "" %> <% }); %></div>',fieldtemplate:!0,onInsert:function(f,c){var d="active",e=c.formElement||{};e.activeClass&&(d+=" "+e.activeClass),a(c.el).find('input[type="radio"]').on("change",function(g){var f=null,e=c.options[a(this).val()];c.parentNode&&c.parentNode.el&&(a(c.el).find("label").removeClass(d),a(this).parent().addClass(d),a(c.el).nextAll().hide(),a(c.el).nextAll().find('input[type="radio"]').prop("checked",!1),e.value&&a(c.parentNode.el).find('input[type="hidden"]').val(e.value),e.next&&(f=b.find(c.parentNode.children,function(a){return a.formElement&&a.formElement.qid===e.next}),a(f.el).show(),a(f.el).nextAll().hide(),a(f.el).nextAll().find('input[type="radio"]').prop("checked",!1)),e.href&&(e.target?window.open(e.href,e.target):window.location=e.href),e.submit&&setTimeout(function(){c.ownerTree.submit()},0))})}}},c.util.getObjKey=function(j,k,h){for(var a=j,i=k.split("."),d=null,e=null,c=null,f=0;f<i.length;f++){if(null===a||"object"!=typeof a)return null;if(d=i[f],c=d.replace(g,""),g.lastIndex=0,e=g.exec(d))for(a=a[c];;){if(!b.isArray(a))return null;if(a=a[parseInt(e[1],10)],e=g.exec(d),!e)break}else a=h&&!a[c]&&b.isArray(a)&&a[0]?a[0][c]:a[c]}return h&&b.isArray(a)&&a[0]?a[0]:a},c.util.getObjKeyEx=function(e,a,d){var c=e;if(null===a||void 0===a||""===a)return e;if("string"==typeof d&&d.length>0){if(a.slice(0,d.length)!==d)throw console.log([d,e,a]),new Error("key ["+a+"] does not match the objKey ["+d+"]");a=a.slice(d.length),"."===a[0]&&(a=a.slice(1))}var b=a.match(/^((([^\\\[.]|\\.)+)|\[(\d+)\])\.?(.*)$/);if(!b)throw new Error("bad format key: "+a);if("string"==typeof b[2]&&b[2].length>0)c=c[b[2]];else{if(!("string"==typeof b[4]&&b[4].length>0))throw new Error("impossible reach here");c=c[Number(b[4])]}return c&&b[5].length>0&&(c=this.getObjKeyEx(c,b[5])),c},c.util.setObjKey=function(j,k,i){for(var a=j,f=k.split("."),d=null,e=null,c=null,h=0;h<f.length-1;h++)if(d=f[h],c=d.replace(g,""),g.lastIndex=0,e=g.exec(d)){for(;;)if(b.isArray(a[c])||(a[c]=[]),a=a[c],c=parseInt(e[1],10),e=g.exec(d),!e)break;("object"!=typeof a[c]||null===a[c])&&(a[c]={}),a=a[c]}else("object"!=typeof a[c]||null===a[c])&&(a[c]={}),a=a[c];if(d=f[f.length-1],c=d.replace(g,""),g.lastIndex=0,e=g.exec(d)){for(;;)if(b.isArray(a[c])||(a[c]=[]),a=a[c],c=parseInt(e[1],10),e=g.exec(d),!e)break;a[c]=i}else a[c]=i};var p=function(b,d){var e=d.replace(/\./g,".properties.").replace(/\[[0-9]*\]/g,".items"),a=c.util.getObjKey(b,e,!0);if(a&&a.$ref)throw new Error("JSONForm does not yet support schemas that use the $ref keyword. See: https://github.com/joshfire/jsonform/issues/54");return a},s=function(a,f,b){b=b||0;var g=void 0;if(e(f)&&""!==f)if(a.default&&0==b)g=c.util.getObjKeyEx(a.default,f);else{var d=f.match(/^((([^\\\[.]|\\.)+)|\[(\d+)\])\.?(.*)$/);if(!d)throw new Error("bad format key: "+f);if("string"==typeof d[2]&&d[2].length>0)a=a.properties[d[2]];else{if(!("string"==typeof d[4]&&d[4].length>0))throw new Error("impossible reach here");a=a.items,b>0&&--b}a&&(g=a.default&&0==b?c.util.getObjKeyEx(a.default,d[5]):s(a,d[5],b))}else 0==b&&(g=a.default);return g},i=function(b,a){var c=0;if(!b)return null;if(!a||0===a.length)return b;var d=b.replace(g,function(d,f){var b=d;return e(a[c])&&(b="["+a[c]+"]"),c+=1,b});return d},v=function(h,l,k,d,m){var a=null;d=d||{},d.idx=d.idx||(k?k[k.length-1]:1),d.value=e(d.value)?d.value:"",d.getValue=d.getValue||function(a){return v(h,a,k,d,m)};var o=function(c,d){var a=null;return c&&c.length?(b.each(c,function(c){return a?void 0:c===d?void(a={key:c}):void(b.isString(c)||(c.key===d?a=c:c.items&&(a=o(c.items,d))))}),a):null},g=o(h.form||[],l),f=p(h.schema.properties,l);return m&&h.value&&(a=c.util.getObjKey(h.value,i(l,k))),e(a)||(g&&"undefined"!=typeof g.value?a=g.value:f&&e(f.default)&&(a=f.default),a&&-1!==a.indexOf("{{values.")&&(a=a.replace(/\{\{values\.([^\}]+)\}\}/g,'{{getValue("$1")}}')),a&&(a=j(a,d,n))),e(a)&&g&&q(g.titleMap,a)&&(a=j(g.titleMap[a],d,n)),a&&b.isString(a)&&f&&f.maxLength&&a.length>f.maxLength&&(a=a.substr(0,f.maxLength-1)+"…"),e(a)?a:null},d=function(){this.id=null,this.key=null,this.el=null,this.formElement=null,this.schemaElement=null,this.view=null,this.children=[],this.ownerTree=null,this.parentNode=null,this.childTemplate=null,this.legendChild=null,this.arrayPath=[],this.childPos=0};d.prototype.clone=function(c){var a=new d;return a.childPos=this.childPos,a.arrayPath=b.clone(this.arrayPath),a.ownerTree=this.ownerTree,a.parentNode=c||this.parentNode,a.formElement=this.formElement,a.schemaElement=this.schemaElement,a.view=this.view,a.children=b.map(this.children,function(b){return b.clone(a)}),a},d.prototype.hasNonDefaultValue=function(){if(this.formElement&&"hidden"==this.formElement.type)return!1;if(this.value&&!this.defaultValue)return!0;var a=b.find(this.children,function(a){return a.hasNonDefaultValue()});return!!a},d.prototype.getProperty=function(a,c){var b=this[a];return void 0===b&&c&&this.parentNode?this.parentNode.getProperty(a,!0):b},d.prototype.isReadOnly=function(){return this.getProperty("readOnly",!0)},d.prototype.appendChild=function(a){return a.parentNode=this,a.childPos=this.children.length,this.children.push(a),a},d.prototype.removeChild=function(){var b=this.children[this.children.length-1];if(b)return a(b.el).remove(),this.children.pop()},d.prototype.moveValuesTo=function(a){var b=this.getFormValues(a.arrayPath);a.resetValues(),a.computeInitialValues(b,!0)},d.prototype.switchValuesWith=function(a){var b=this.getFormValues(a.arrayPath),c=a.getFormValues(this.arrayPath);a.resetValues(),a.computeInitialValues(b,!0),this.resetValues(),this.computeInitialValues(c,!0)},d.prototype.resetValues=function(){var c=null;if(this.value=null,this.parentNode?(this.arrayPath=b.clone(this.parentNode.arrayPath),this.parentNode.view&&this.parentNode.view.array&&this.arrayPath.push(this.childPos)):this.arrayPath=[],this.view&&this.view.inputfield)c=a(":input",this.el).serializeArray(),b.each(c,function(b){a('[name="'+f(b.name)+'"]',a(this.el)).val("")},this);else if(this.view&&this.view.array)for(;this.children.length>0;)this.removeChild();b.each(this.children,function(a){a.resetValues()})},d.prototype.setChildTemplate=function(a){this.childTemplate=a,a.parentNode=this},d.prototype.getChildTemplate=function(){return this.childTemplate||this.view.array&&(this.formElement.items?key=this.formElement.items[0]||this.formElement.items:key=this.formElement.key+"[]",b.isString(key)&&(key={key:key}),this.setChildTemplate(this.ownerTree.buildFromLayout(key))),this.childTemplate},d.prototype.computeInitialValues=function(g,p,m){var h=this,a=null,k=1,o=0,d=this.ownerTree.formDesc.tpldata||{};if(m=m||0,this.parentNode?(this.arrayPath=b.clone(this.parentNode.arrayPath),this.parentNode.view&&this.parentNode.view.array&&this.arrayPath.push(this.childPos)):this.arrayPath=[],d.idx=this.arrayPath.length>0?this.arrayPath[this.arrayPath.length-1]+1:this.childPos+1,d.value="",d.getValue=function(a){return v(h.ownerTree.formDesc,a,h.arrayPath,d,!!g)},this.formElement&&(this.formElement.id?this.id=i(this.formElement.id,this.arrayPath):this.view&&this.view.array?this.id=f(this.ownerTree.formDesc.prefix)+"-elt-counter-"+b.uniqueId():this.parentNode&&this.parentNode.view&&this.parentNode.view.array?this.id=f(this.ownerTree.formDesc.prefix)+"-elt-counter-"+b.uniqueId():("button"===this.formElement.type||"selectfieldset"===this.formElement.type||"question"===this.formElement.type||"buttonquestion"===this.formElement.type)&&(this.id=f(this.ownerTree.formDesc.prefix)+"-elt-counter-"+b.uniqueId()),this.formElement.key&&(this.key=i(this.formElement.key,this.arrayPath),this.keydash=this.key.replace(/\./g,"---")),this.name=i(this.formElement.name,this.arrayPath),b.each(["title","legend","description","append","prepend","inlinetitle","helpvalue","value","disabled","required","placeholder","readOnly"],function(a){b.isString(this.formElement[a])?(-1!==this.formElement[a].indexOf("{{values.")?this[a]=this.formElement[a].replace(/\{\{values\.([^\}]+)\}\}/g,'{{getValue("$1")}}'):this[a]=i(this.formElement[a],this.arrayPath),this[a]&&(this[a]=j(this[a],d,n))):this[a]=this.formElement[a]},this),this.formElement.options&&(this.options=b.map(this.formElement.options,function(a){var c=null;return b.isObject(a)&&a.title?(c=-1!==a.title.indexOf("{{values.")?a.title.replace(/\{\{values\.([^\}]+)\}\}/g,'{{getValue("$1")}}'):i(a.title,h.arrayPath),b.extend({},a,{value:e(a.value)?a.value:"",title:j(c,d,n)})):a}))),this.view&&this.view.inputfield&&this.schemaElement){if(g)e(c.util.getObjKey(g,this.key))&&(this.value=c.util.getObjKey(g,this.key));else if(!p&&!e(this.value)){var l=s(h.ownerTree.formDesc.schema,this.key,m);e(l)&&(this.value=l,b.isString(this.value)&&(-1!==this.value.indexOf("{{values.")?this.value=this.value.replace(/\{\{values\.([^\}]+)\}\}/g,'{{getValue("$1")}}'):this.value=i(this.value,this.arrayPath),this.value&&(this.value=j(this.value,d,n))),this.defaultValue=!0)}}else if(this.view&&this.view.array){k=1;var r=this.getArrayBoundaries().minItems;if(g){var q=c.util.getObjKeyEx(g,this.key);q&&Array.isArray(q)&&(k=q.length)}else if(p)r>=0&&(k=0);else{var l=s(h.ownerTree.formDesc.schema,this.key,m);l&&Array.isArray(l)&&(k=l.length)}for(o=0;k>o;o++)this.appendChild(this.getChildTemplate().clone())}if(b.each(this.children,function(a){a.computeInitialValues(g,p,m)}),this.formElement&&this.formElement.valueInLegend)for(a=this;a;){if(a.parentNode&&a.parentNode.view&&a.parentNode.view.array&&(a.legendChild=this,a.formElement&&a.formElement.legend)){a.legend=i(a.formElement.legend,a.arrayPath),d.idx=a.arrayPath.length>0?a.arrayPath[a.arrayPath.length-1]+1:a.childPos+1,d.value=e(this.value)?this.value:"",a.legend=j(a.legend,d,n);break}a=a.parentNode}},d.prototype.getFormValues=function(k){var j={};if(!this.el)throw new Error("formNode.getFormValues can only be called on nodes that are associated with a DOM element in the tree");
  var d=a(":input",this.el).serializeArray();d=d.concat(a(":input[type=checkbox]:not(:disabled):not(:checked)[name]",this.el).map(function(){return{name:this.name,value:this.checked}}).get()),k&&b.each(d,function(a){a.name=i(a.name,k)});for(var o=this.ownerTree.formDesc.schema,e=0;e<d.length;e++){var g=d[e].name,f=p(o.properties,g),n=null,h=null;if(f)if(f._jsonform_checkboxes_as_array&&(n=g.match(/\[([0-9]*)\]$/)))g=g.replace(/\[([0-9]*)\]$/,""),h=c.util.getObjKey(j,g)||[],"value"===f._jsonform_checkboxes_as_array&&d[e].value!==!1&&""!==d[e].value?h.push(d[e].value):f._jsonform_checkboxes_as_array===!0&&"1"===d[e].value&&h.push(f.enum[parseInt(n[1],10)]),c.util.setObjKey(j,g,h);else if("tagsinput"!==f._jsonform_get_value_by_tagsinput)if("[]"!==g.slice(-2)||(g=g.slice(0,-2),f=p(o.properties,g),"array"!==f.type)){if("boolean"===f.type&&("0"===d[e].value||"false"===d[e].value?d[e].value=!1:""===d[e].value?d[e].value=null:d[e].value=!!d[e].value),("number"===f.type||"integer"===f.type)&&b.isString(d[e].value)&&(d[e].value.length?isNaN(Number(d[e].value))||(d[e].value=Number(d[e].value)):d[e].value=null),"string"!==f.type||""!==d[e].value||f._jsonform_allowEmpty||(d[e].value=null),"object"===f.type&&b.isString(d[e].value)&&"{"===d[e].value.substring(0,1))try{d[e].value=l.parse(d[e].value)}catch(a){d[e].value={}}if("array"===f.type&&b.isString(d[e].value))if("["===d[e].value.substring(0,1))try{d[e].value=l.parse(d[e].value)}catch(a){d[e].value=[]}else d[e].value=null;"object"!==f.type||"null"!==d[e].value&&""!==d[e].value||(d[e].value=null),d[e].name&&null!==d[e].value&&c.util.setObjKey(j,d[e].name,d[e].value)}else h=c.util.getObjKey(j,g)||[],h.indexOf(d[e].value)<0&&(h.push(d[e].value),c.util.setObjKey(j,g,h));else{var m;if(k){var q=i(g,this.arrayPath);m=a(':input[name="'+q+'"]',this.el).tagsinput("items")}else m=a(':input[name="'+g+'"]',this.el).tagsinput("items");c.util.setObjKey(j,g,m)}}return j},d.prototype.render=function(a){var b=this.generate();this.setContent(b,a),this.enhance()},d.prototype.setContent=function(e,f){var b=a(e),d=f||(this.parentNode?this.parentNode.el:this.ownerTree.domRoot),c=null;this.el?a(this.el).replaceWith(b):(c=a(d).children().get(this.childPos),c?a(c).before(b):a(d).append(b)),this.el=b,this.updateElement(this.el)},d.prototype.updateElement=function(c){this.id&&(this.el=a("#"+f(this.id),c).get(0),this.view&&this.view.getElement&&(this.el=this.view.getElement(this.el)),this.fieldtemplate!==!1&&this.view&&this.view.fieldtemplate&&(this.el=a(this.el).parent().parent(),(this.prepend||this.append)&&(this.el=this.el.parent()),this.el=this.el.get(0)),this.parentNode&&this.parentNode.view&&this.parentNode.view.childTemplate&&(this.el=a(this.el).parent().get(0))),b.each(this.children,function(a){a.updateElement(this.el||c)})},d.prototype.generate=function(){var a={id:this.id,keydash:this.keydash,elt:this.formElement,schema:this.schemaElement,node:this,value:e(this.value)?this.value:"",cls:this.ownerTree.defaultClasses,escape:o},d=null,g="";this.ownerTree.formDesc.onBeforeRender&&this.ownerTree.formDesc.onBeforeRender(a,this),this.view.onBeforeRender&&this.view.onBeforeRender(a,this),d=this.template?this.template:this.formElement&&this.formElement.template?this.formElement.template:this.view.template,this.fieldtemplate!==!1&&(this.fieldtemplate||this.view.fieldtemplate)&&(d=c.fieldTemplate(d)),this.parentNode&&this.parentNode.view&&this.parentNode.view.childTemplate&&(d=this.parentNode.view.childTemplate(d,this.parentNode));var f="";return b.each(this.children,function(a){f+=a.generate()}),a.children=f,a.fieldHtmlClass="",this.ownerTree&&this.ownerTree.formDesc&&this.ownerTree.formDesc.params&&this.ownerTree.formDesc.params.fieldHtmlClass&&(a.fieldHtmlClass=this.ownerTree.formDesc.params.fieldHtmlClass),this.formElement&&"undefined"!=typeof this.formElement.fieldHtmlClass&&(a.fieldHtmlClass=this.formElement.fieldHtmlClass),g=j(d,a,r)},d.prototype.enhance=function(){function g(b){c.formElement&&c.formElement.legend&&c.parentNode&&(c.legend=i(c.formElement.legend,c.arrayPath),f.idx=c.arrayPath.length>0?c.arrayPath[c.arrayPath.length-1]+1:c.childPos+1,f.value=a(b.target).val(),c.legend=j(c.legend,f,n),a(c.parentNode.el).trigger("legendUpdated"))}var c=this,d=null,e=null,f=b.clone(this.ownerTree.formDesc.tpldata)||{};this.formElement&&(this.view.onInsert&&this.view.onInsert({target:a(this.el)},this),d=this.handlers||this.formElement.handlers,e=this.onInsert||this.formElement.onInsert,e&&e({target:a(this.el)},this),d&&b.each(d,function(b,c){"insert"===c&&b({target:a(this.el)},this)},this),this.el&&(this.onChange&&a(this.el).bind("change",function(a){c.onChange(a,c)}),this.view.onChange&&a(this.el).bind("change",function(a){c.view.onChange(a,c)}),this.formElement.onChange&&a(this.el).bind("change",function(a){c.formElement.onChange(a,c)}),this.onClick&&a(this.el).bind("click",function(a){c.onClick(a,c)}),this.view.onClick&&a(this.el).bind("click",function(a){c.view.onClick(a,c)}),this.formElement.onClick&&a(this.el).bind("click",function(a){c.formElement.onClick(a,c)}),this.onKeyUp&&a(this.el).bind("keyup",function(a){c.onKeyUp(a,c)}),this.view.onKeyUp&&a(this.el).bind("keyup",function(a){c.view.onKeyUp(a,c)}),this.formElement.onKeyUp&&a(this.el).bind("keyup",function(a){c.formElement.onKeyUp(a,c)}),d&&b.each(d,function(d,b){"insert"!==b&&a(this.el).bind(b,function(a){d(a,c)})},this)),this.formElement.legend&&this.legendChild&&this.legendChild.formElement&&(a(this.legendChild.el).on("keyup",g),a(this.legendChild.el).on("change",g))),b.each(this.children,function(a){a.enhance()})},d.prototype.insertArrayItem=function(b,d){var a=0;void 0===b&&(b=this.children.length);var c=this.getChildTemplate().clone();for(this.appendChild(c),c.resetValues(),a=this.children.length-2;a>=b;a--)this.children[a].moveValuesTo(this.children[a+1]);for(this.children[b].resetValues(),this.children[b].computeInitialValues(null,!1,this.children[b].arrayPath.length),a=b;a<this.children.length;a++)this.children[a].render(d)},d.prototype.deleteArrayItem=function(b){var a=0;for(void 0===b&&(b=this.children.length-1),a=b;a<this.children.length-1;a++)this.children[a+1].moveValuesTo(this.children[a]),this.children[a].render();this.removeChild()},d.prototype.getArrayBoundaries=function(){var c={minItems:-1,maxItems:-1};if(!this.view||!this.view.array)return c;var a=function(d,f){var e=null,g=null,c={minItems:-1,maxItems:-1};return f=f||d,d.view&&d.view.array&&d!==f?c:d.key?(g=d.key.replace(/\[[0-9]+\]/g,"[]"),d!==f&&(g=g.replace(/\[\][^\[\]]*$/,"")),(e=p(d.ownerTree.formDesc.schema.properties,g))?(e.minItems>=0&&(c.minItems=e.minItems),e.minLength>=0&&(c.minItems=e.minLength),e.maxItems>=0&&(c.maxItems=e.maxItems),e.maxLength>=0&&(c.maxItems=e.maxLength),c):c):(b.each(d.children,function(d){var b=a(d,f);-1!==b.minItems&&(-1!==c.minItems?c.minItems=Math.max(c.minItems,b.minItems):c.minItems=b.minItems),-1!==b.maxItems&&(-1!==c.maxItems?c.maxItems=Math.min(c.maxItems,b.maxItems):c.maxItems=b.maxItems)}),c)};return a(this)};var k=function(){this.eventhandlers=[],this.root=null,this.formDesc=null};k.prototype.initialize=function(f){function a(c){if(c&&c.properties){var f=Array.isArray(c.required)?c.required:[];for(var d in c.properties){var b=c.properties[d];if(b.required===!0)f.indexOf(d)<0&&f.push(d);else if(void 0!==b.required&&b.required!==!1&&!Array.isArray(b.required))throw new Error("field "+d+"'s required property should be either boolean or array of strings");if("object"===b.type?e.indexOf(b)<0&&(e.push(b),a(b)):delete b.required,"array"===b.type&&b.items){if(Array.isArray(b.items))throw new Error("the items property of array property "+d+" in the schema definition must be an object");"object"===b.items.type&&e.indexOf(b.items)<0&&(e.push(b.items),a(b.items))}}f.length>0?c.required=f:delete c.required}}function g(a,b){Object.keys(a).forEach(function(d,f,i){var c=a[d];if(null!==c&&"object"==typeof c)if(c.$ref)if("#/definitions/"===c.$ref.slice(0,14)){var e=c.$ref.replace(/^#\/definitions\//,"");a[d]=b[e]}else console.log("Unresolved $ref: "+c.$ref);else h.indexOf(c)<0&&(g(c,b),h.push(c))})}f=f||{},this.formDesc=b.clone(f),c.defaultClasses=w(this.formDesc.isBootstrap2||c.isBootstrap2),this.defaultClasses=b.clone(c.defaultClasses),this.formDesc.defaultClasses&&b.extend(this.defaultClasses,this.formDesc.defaultClasses),this.formDesc.prefix=this.formDesc.prefix||"jsonform-"+b.uniqueId(),this.formDesc.schema&&!this.formDesc.schema.properties&&(this.formDesc.schema={properties:this.formDesc.schema});var e=[];if(a(this.formDesc.schema),this.formDesc.schema.definitions)for(var i in this.formDesc.schema.definitions)a(this.formDesc.schema.definitions[i]);this.formDesc._originalSchema=this.formDesc.schema,this.formDesc.schema=l.parse(l.stringify(this.formDesc.schema));var h=[];this.formDesc.schema.definitions&&g(this.formDesc.schema,this.formDesc.schema.definitions),this.formDesc.form=this.formDesc.form||["*",{type:"actions",items:[{type:"submit",value:"Submit"}]}],this.formDesc.form=b.isArray(this.formDesc.form)?this.formDesc.form:[this.formDesc.form],this.formDesc.params=this.formDesc.params||{},this.root=new d,this.root.ownerTree=this,this.root.view=c.elementTypes.root,this.buildTree(),this.computeInitialValues()},k.prototype.buildTree=function(){b.each(this.formDesc.form,function(a){"*"===a?b.each(this.formDesc.schema.properties,function(b,a){this.formDesc.nonDefaultFormItems&&this.formDesc.nonDefaultFormItems.indexOf(a)>=0||this.root.appendChild(this.buildFromLayout({key:a}))},this):(b.isString(a)&&(a={key:a}),this.root.appendChild(this.buildFromLayout(a)))},this)},k.prototype.buildFromLayout=function(a,o){function n(g,b){var e=g.split("."),d=e.pop();if("[]"==d.slice(-2))return!1;var c=e.join("."),a=!1;if(c){var f=p(b.properties,c);a=f.required&&f.required.indexOf(d)>=0,a&&(a="[]"==c.slice(-2)||n(c,b))}else a=b.required&&b.required.indexOf(d)>=0;return a}function k(a,c){a.options?Array.isArray(a.options)?a.options=a.options.map(function(a){return q(a,"value")?a:{value:a,title:a}}):"object"==typeof a.options&&(a.options=Object.keys(a.options).map(function(b){return{value:b,title:a.options[b]}})):a.titleMap?a.options=b.map(c,function(c){var b=c.toString();return{value:c,title:q(a.titleMap,b)?a.titleMap[b]:b}}):a.options=c.map(function(a){return{value:a,title:a.toString()}})}var e=null,g=new d,i=null;if(a.key&&this.formDesc.customFormItems){var l=this.formDesc.customFormItems[a.key];void 0!==l&&(l.key=a.key,a=l)}if(a=b.clone(a),a.items&&(b.isArray(a.items)?a.items=b.map(a.items,b.clone):a.items=[b.clone(a.items)]),a.key){if(e=p(this.formDesc.schema.properties,a.key),!e)throw new Error('The JSONForm object references the schema key "'+a.key+'" but that key does not exist in the JSON schema');if(this.formDesc.onElementSchema&&this.formDesc.onElementSchema(a,e),a.name=a.name||a.key,a.title=a.title||e.title,a.description=a.description||e.description,a.readOnly=a.readOnly||e.readOnly||a.readonly||e.readonly,a.required=a.required===!0||e.required===!0||n(a.key,this.formDesc.schema),a.id||(a.id=f(this.formDesc.prefix)+"-elt-"+a.key),a.allowEmpty&&(e._jsonform_allowEmpty=!0),a.type||("string"===e.type&&"color"===e.format?a.type="color":"number"!==e.type&&"integer"!==e.type||e.enum?"string"!==e.type&&"any"!==e.type||e.enum?"boolean"===e.type?a.type="checkbox":"object"===e.type?e.properties?a.type="fieldset":a.type="textarea":b.isUndefined(e.enum)?a.type=e.type:a.type="select":a.type="text":a.type="number"),a.options)k(a);else if(e.enum||"boolean"===e.type){var j=e.enum;j?a.optionsAsEnumOrder=!0:j="select"===a.type?["",!0,!1]:[!0,!1],k(a,j)}if(("checkboxes"===a.type||"checkboxbuttons"===a.type)&&e.items){var m=Array.isArray(e.items)?e.items[0]:e.items;if(a.options)k(a),m._jsonform_checkboxes_as_array="value";else{var j=m.enum;j&&(k(a,j),a.optionsAsEnumOrder=!0,m._jsonform_checkboxes_as_array="checkboxes"===a.type?!0:"value")}}"tagsinput"===a.getValue&&(e._jsonform_get_value_by_tagsinput="tagsinput"),"object"===e.type&&b.each(e.properties,function(d,c){var b=a.key+"."+c;this.formDesc.nonDefaultFormItems&&this.formDesc.nonDefaultFormItems.indexOf(b)>=0||g.appendChild(this.buildFromLayout({key:b}))},this)}if(a.type||(a.type="text"),i=c.elementTypes[a.type],!i)throw new Error('The JSONForm contains an element whose type is unknown: "'+a.type+'"');if(e){if(!i.inputfield&&!i.array&&"selectfieldset"!==a.type&&"object"!==e.type)throw new Error('The JSONForm contains an element that links to an element in the JSON schema (key: "'+a.key+'") and that should not based on its type ("'+a.type+'")')}else if(i.inputfield&&"selectfieldset"!==a.type)throw new Error('The JSONForm defines an element of type "'+a.type+'" but no "key" property to link the input field to the JSON schema');if(a.iddot=f(a.id||""),g.formElement=a,g.schemaElement=e,g.view=i,g.ownerTree=this,a.handlers||(a.handlers={}),g.view.array);else if(a.items)b.each(a.items,function(a){b.isString(a)&&(a={key:a}),g.appendChild(this.buildFromLayout(a))},this);else if(a.otherField){var h=a.otherField;b.isString(h)?h=a.otherField={key:h,notitle:!0}:void 0===h.notitle&&(h.notitle=!0),void 0===h.inline&&(h.inline=a.inline),g.appendChild(this.buildFromLayout(h))}return g},k.prototype.computeInitialValues=function(){this.root.computeInitialValues(this.formDesc.value)},k.prototype.render=function(b){b&&(this.domRoot=b,this.root.render(),this.hasRequiredField()&&a(b).addClass("jsonform-hasrequired"),a(b).addClass("jsonform"))},k.prototype.forEachElement=function(b){var a=function(d){for(var c=0;c<d.children.length;c++)b(d.children[c]),a(d.children[c])};a(this.root)},k.prototype.validate=function(h){var g=c.getFormValue(this.domRoot),d=!1,f=this.formDesc;if(f.validate!==!1){var b=!1;if("object"!=typeof f.validate?m.ZSchema?(b=new m.ZSchema,b._vendor="z-schema"):m.jjv?(b=m.jjv(),b._vendor="jjv"):m.JSONFormValidator&&(b=m.JSONFormValidator.createEnvironment("json-schema-draft-03"),b._vendor="jsv"):b=f.validate,b)if(a(this.domRoot).jsonFormErrors(!1,f),"jjv"==b._vendor){var e=b.validate(this.formDesc._originalSchema,g);e&&(d=[e])}else{var e=b.validate(g,this.formDesc._originalSchema);"z-schema"==b._vendor?(d=b.getLastErrors(),e=e?null:{errors:d}):e&&e.errors&&e.errors.length&&(d||(d=[]),d=d.concat(e.errors))}}return d&&!h&&(f.displayErrors?f.displayErrors(d,this.domRoot):a(this.domRoot).jsonFormErrors(d,f)),{errors:d,values:g}},k.prototype.submit=function(a){var b=function(){return a&&(a.preventDefault(),a.stopPropagation()),!1},f=c.getFormValue(this.domRoot),d=this.formDesc,e=!1;if(this.forEachElement(function(b){e||b.view.onSubmit&&(e=!b.view.onSubmit(a,b))}),e)return b();var g=this.validate();return d.onSubmit&&!d.onSubmit(g.errors,f)?b():g.errors?b():d.onSubmitValid&&!d.onSubmitValid(f)?b():!1},k.prototype.hasRequiredField=function(){return a(this.domRoot).find(".jsonform-required").length>0},c.getFormValue=function(c){var b=a(c).data("jsonform-tree");return b?b.root.getFormValues():null},a.fn.jsonFormErrors=function(b,o){var e=a(this).data("jsonform-tree");if(a("."+e.defaultClasses.groupMarkClassPrefix+"error",this).removeClass(e.defaultClasses.groupMarkClassPrefix+"error"),a("."+e.defaultClasses.groupMarkClassPrefix+"warning",this).removeClass(e.defaultClasses.groupMarkClassPrefix+"warning"),a(".jsonform-errortext",this).hide(),b){for(var h=[],c=0;c<b.length;c++){var d=b[c].uri||b[c].path;if(["OBJECT_DEPENDENCY_KEY","OBJECT_MISSING_REQUIRED_PROPERTY"].indexOf(b[c].code)>=0&&("/"!=d.slice(-1)&&(d+="/"),d+=b[c].params[0]),d){d=d.replace(/.*#\//,"").replace(/\//g,".").replace(/\.([0-9]+)(?=\.|$)/g,"[$1]");var l=".jsonform-error-"+f(d.replace(/\./g,"---"));h.push(l);var m=b[c].type||"error",j=a(l,this);"ARRAY_LENGTH_SHORT"==b[c].code&&["checkboxes","checkboxbuttons"].indexOf(j.data("jsonform-type"))>=0&&(b[c].message="Please select at least "+b[c].params[1]+(b[c].params[1]>1?" options":" option")+" above."),j.addClass(e.defaultClasses.groupMarkClassPrefix+m),j.find("> div > .jsonform-errortext, > .jsonform-errortext").text(b[c].message).show()}}h=h.join(",");var k=a(h,this),n=k.parents(".tab-pane"),i=a();n.each(function(){var b=a(this);i=i.add(b.closest(".tabbable").find("> .nav > li").eq(b.index()).addClass(e.defaultClasses.groupMarkClassPrefix+"error"))});var g=k.filter(":visible").get(0);!g&&i.length>0&&(g=i.get(0)),g&&g.scrollIntoView&&g.scrollIntoView(!0,{behavior:"smooth"})}},a.fn.jsonForm=function(d,g){if("values"===d)return c.getFormValue(this);if("submit"===d){var e=this.data("jsonform-tree");return e?e.submit():null}if("validate"===d){var e=this.data("jsonform-tree");return e?e.validate(g):null}var f=this;d=b.defaults({},d,{submitEvent:"submit"});var e=new k;return e.initialize(d),e.render(f.get(0)),d.transloadit&&f.append('<input type="hidden" name="params" value=\''+o(l.stringify(d.transloadit.params))+"'>"),f.data("jsonform-tree",e),d.submitEvent&&(f.unbind(d.submitEvent+".jsonform"),f.bind(d.submitEvent+".jsonform",function(a){e.submit(a)})),x(f),a(".expandable > div, .expandable > fieldset",f).hide(),f.on("click",".expandable > legend",function(){var b=a(this).parent();b.toggleClass("expanded"),a("> div",b).slideToggle(100)}),e},a.fn.jsonFormValue=function(){return c.getFormValue(this)},m.JSONForm||(m.JSONForm=c)}("undefined"!=typeof exports,"undefined"!=typeof exports?exports:window,"undefined"!=typeof jQuery?jQuery:{fn:{}},"undefined"!=typeof _?_:null,JSON),jQuery&&function(a){a.extend(a.fn,{fileTree:function(b,c){if(!b)var b={};void 0==b.root&&(b.root="/"),void 0==b.script&&(b.script="jqueryFileTree.php"),void 0==b.folderEvent&&(b.folderEvent="click"),void 0==b.expandSpeed&&(b.expandSpeed=500),void 0==b.collapseSpeed&&(b.collapseSpeed=500),void 0==b.expandEasing&&(b.expandEasing=null),void 0==b.collapseEasing&&(b.collapseEasing=null),void 0==b.multiFolder&&(b.multiFolder=!0),void 0==b.loadMessage&&(b.loadMessage="Loading..."),a(this).each(function(){function d(c,f){if(f.search("%")>=0){var d=f.split("%"),g=d.length-1,h=-1;d[g]=d[g].replace("/",""),a.get("filemanager_js/utf-8.txt",function(l){var i=l.split("\n"),g="";for(var j in d)if(j>0)for(var k in i)h=i[k].indexOf(d[j]),h>-1&&(g=i[k].split(";"),g=g[1].split("	"),d[j]=g[1]);d=d.join(""),f=d+"/",a(c).addClass("wait"),a(".jqueryFileTree.start").remove(),a.post(b.script,{dir:f,sign:here},function(d){a(c).find(".start").html(""),a(c).removeClass("wait").append(d),b.root==f?a(c).find("UL:hidden").show():a(c).find("UL:hidden").slideDown({duration:b.expandSpeed,easing:b.expandEasing}),e(c)})})}else a(c).addClass("wait"),a(".jqueryFileTree.start").remove(),a.post(b.script,{dir:f,sign:here},function(d){a(c).find(".start").html(""),a(c).removeClass("wait").append(d),b.root==f?a(c).find("UL:hidden").show():a(c).find("UL:hidden").slideDown({duration:b.expandSpeed,easing:b.expandEasing}),e(c)})}function e(e){a(e).find("LI A").bind(b.folderEvent,function(){return a(this).parent().hasClass("directory")?a(this).parent().hasClass("collapsed")?(b.multiFolder||(a(this).parent().parent().find("UL").slideUp({duration:b.collapseSpeed,easing:b.collapseEasing}),a(this).parent().parent().find("LI.directory").removeClass("expanded").addClass("collapsed")),a(this).parent().find("UL").remove(),d(a(this).parent(),escape(a(this).attr("rel").match(/.*\//))),a(this).parent().removeClass("collapsed").addClass("expanded")):(a(this).parent().find("UL").slideUp({duration:b.collapseSpeed,easing:b.collapseEasing}),a(this).parent().removeClass("expanded").addClass("collapsed")):c(a(this).attr("rel")),!1}),"click"!=b.folderEvent.toLowerCase&&a(e).find("LI A").bind("click",function(){this_dir_selected=c(a(this).attr("rel"))})}a(this).html('<ul class="jqueryFileTree start"><li class="wait">'+b.loadMessage+"<li></ul>"),d(a(this),escape(b.root))})}}),a.extend(a.fn,{leftFileTree:function(b,c){if(!b)var b={};void 0==b.root&&(b.root="/"),void 0==b.script&&(b.script="folderMenu.php"),void 0==b.folderEvent&&(b.folderEvent="click"),void 0==b.expandSpeed&&(b.expandSpeed=500),void 0==b.collapseSpeed&&(b.collapseSpeed=500),void 0==b.expandEasing&&(b.expandEasing=null),void 0==b.collapseEasing&&(b.collapseEasing=null),void 0==b.multiFolder&&(b.multiFolder=!0),void 0==b.loadMessage&&(b.loadMessage="Loading..."),a(this).each(function(){function c(c,d){a(c).addClass("wait"),a(".jqueryFileTree.start").remove(),a.post(b.script,{dir:d,sign:here},function(e){a(c).find(".start").html(""),a(c).removeClass("wait").append(e),b.root==d?a(c).find("UL:hidden").show():a(c).find("UL:hidden").slideDown({duration:b.expandSpeed,easing:b.expandEasing})})}1==first_flag&&(a(this).html('<ul class="jqueryFileTree start"><li class="wait">'+b.loadMessage+"<li></ul>"),c(a(this),escape(b.root)))})}})}(jQuery);var open_folders=new Array,repeat_flag=!0,lick=!0,open_all=!0;window.onload=setTimeout(function(){open_all_dirs(fileTreeUserFolder)},1e3,fileTreeUserFolder),$(document).bind("drop dragover",function(a){a.preventDefault()}),$(document).bind("dragover",function(e){var a=$("#dropzone"),c=window.dropZoneTimeout;c?clearTimeout(c):a.addClass("in");var d=!1,b=e.target;do{if(b===a[0]){d=!0;break}b=b.parentNode}while(null!=b);d?a.addClass("hover"):a.removeClass("hover"),window.dropZoneTimeout=setTimeout(function(){window.dropZoneTimeout=null,a.removeClass("in hover")},100)}),function(a,f,d,g){"use strict";function c(c,d){this.$el=a(c);var b=this;this.options=a.extend(e,d,this.$el.data("options")),a.fn.notNodeClick=function(){a(this).closest("ul.mtree").find(".mtree-active").removeClass("mtree-active"),a(this).addClass("mtree-active")},a.fn.nodeClick=function(){var c=a(this).hasClass("mtree-open");c||a(this).closest("ul.mtree").find(".mtree-active").removeClass("mtree-active"),a(this).toggleClass("mtree-active",!c),b.options.close_same_level&&!c&&a(this).closest("ul").children(".mtree-open").closeNodes(),a(this).toggleClass("mtree-open mtree-closed"),a(this).children("ul").first().toggleList(!c),!c&&b.options.list_animation&&a(this).find("> ul > li, li.mtree-open > ul > li").css({opacity:0}).velocity("stop").velocity("list")},a.fn.closeNodes=function(){a(this).children("ul").toggleList(!1,b.options.duration/3),a(this).toggleClass("mtree-open mtree-closed")},a.fn.toggleList=function(c,d){if(c){var e=a(this).css("height");a(this).css({height:"auto",display:"block"});var f=a(this).outerHeight();a(this).css({height:e})}a(this).velocity("stop").velocity({height:c?f:0},{duration:b.options.duration,delay:d||0,easing:b.options.easing,display:c?"block":"none",complete:function(){c&&a(this).css("height","auto")}})},a.Velocity.Sequences.list=function(d,f,c,e){a.Velocity.animate(d,{opacity:[1,0],translateY:[0,-(c+1)]},{delay:c*(b.options.duration/e/2),duration:b.options.duration,easing:b.options.easing})},this.init()}var b="mtree",e={collapsed:!0,close_same_level:!0,duration:300,list_animation:!0,easing:"easeOutQuart",use_nodes:!1,skip_init:!1};c.prototype.init=function(){this.$nodes=this.$el.find("li:has(ul)"),this.$notNodes=this.$el.find("li").not(":has(ul)"),this.$sublists=this.$el.find("ul"),this.options.use_nodes&&this.$nodes.prepend("<span class=mtree-icon></span>"),this.$nodeButtons=this.$nodes.children(":first-child"),this.$notNodeButtons=this.$notNodes.children(":first-child"),this.options.skip_init||this.setClasses(),this.$nodeButtons.on("click.mtree-node",function(b){preventJSClick(b)||(a(this).parent("li").first().nodeClick(),b.preventDefault())}),this.$notNodeButtons.on("click.mtree-notNode",function(b){preventJSClick(b)||a(this).parent("li").first().notNodeClick()})},c.prototype.setClasses=function(){this.$el.addClass("mtree"),this.$nodes.addClass("mtree-node mtree-"+(this.options.collapsed?"closed":"open")),this.$sublists.css({overflow:"hidden",height:this.options.collapsed?0:"auto",display:this.options.collapsed?"none":"block"}),this.$nodeButtons.css("cursor","pointer"),this.$sublists.each(function(b,c){a(this).addClass("mtree-level-"+(a(this).parentsUntil(a("ul.mtree"),"ul").length+1))})},a.fn[b]=function(d){return this.each(function(){a.data(this,"plugin_"+b)||a.data(this,"plugin_"+b,new c(this,d))})},a(d).ready(function(){var c=a("body").find("ul."+b);c[b](),c.velocity("fadeIn",{complete:function(){a(this).removeAttr("style")}})})}(jQuery,this,this.document);var stylerConfig={layouts:{"topbar-center":"topbar-center topbar-fixed-up","topbar-float":"topbar-float topbar-fixed-up",sidebar:"sidebar","sidebar-right":"sidebar-right",slidemenu:"slidemenu topbar-center"},skins:{DAYLIGHT:"header","daylight darkorange":"daylight darkorange","daylight tomato":"daylight tomato","daylight ffc000":"daylight ffc000","daylight salmon":"daylight salmon","daylight burlywood":"daylight burlywood","daylight yellowgreen":"daylight yellowgreen","daylight darkseagreen":"daylight darkseagreen","daylight skyblue":"daylight skyblue","daylight deeppink":"daylight deeppink","daylight palevioletred":"daylight palevioletred",TWILIGHT:"header","twilight brown":"twilight brown","twilight goldenrod":"twilight goldenrod","twilight peru":"twilight peru","twilight crimson":"twilight crimson","twilight mediumvioletred":"twilight mediumvioletred","twilight deeppink":"twilight deeppink","twilight steelblue":"twilight steelblue","twilight darkcyan":"twilight darkcyan","twilight seagreen":"twilight seagreen","twilight 78a642":"twilight 78a642",WHITE:"header","white coral":"white coral","white hotpink":"white hotpink","white lightskyblue":"white lightskyblue","white mediumaquamarine":"white mediumaquamarine","white yellowgreen":"white yellowgreen",BLACK:"header","black crimson":"black crimson","black mediumvioletred":"black mediumvioletred","black orange":"black orange","black olivedrab":"black olivedrab","black steelblue":"black steelblue",MELLOW:"header","mellow indianred":"mellow indianred","mellow darksalmon":"mellow darksalmon","mellow tan":"mellow tan","mellow darkseagreen":"mellow darkseagreen","mellow palevioletred":"mellow palevioletred",ORGANIC:"header","organic 78a642":"organic 78a642","organic indianred":"organic indianred","organic crimson":"organic crimson","organic hotpink":"organic hotpink","organic burlywood":"organic burlywood",SCIENCE:"header","science palevioletred":"science palevioletred","science indianred":"science indianred","science salmon":"science salmon","science burlywood":"science burlywood","science darkseagreen":"science darkseagreen"},fonts:{"EDITORS FAVORITES":"header","Lato Fat":"Lato:400,700,900,400italic,700italic,900italic|logo:italic,900|header:italic,bold|subheader:italic|topbar:bold,uppercase|sidebar:bold,uppercase,small|footer:italic|styled:italic",Lato:"Lato:400,400italic,700,700italic|subheader:italic|topbar:uppercase,large|sidebar:uppercase,small|footer:italic|styled:italic","Lato Skinny":"Lato:300,300italic|subheader:italic|topbar:uppercase|sidebar:uppercase,small|footer:italic|styled:italic","Raleway - Amaranth":"Raleway:400,600|Amaranth","Open Sans - Fauna One":"Open+Sans:300,300italic,600,600italic|Fauna One|subheader:small|topbar:Fauna One,uppercase,small|sidebar:Fauna One,uppercase,xsmall","Ubuntu - Raleway":"Ubuntu:300,300italic,600,600italic|Raleway:300|topbar:uppercase,small","Merriweather - Alegreya Sans":"Merriweather:300,300italic,700,700italic|Alegreya+Sans:400,700|logo:700|header:700|menu:Alegreya Sans|topbar:uppercase|sidebar:uppercase|subheader:small","Ubuntu - Roboto Slab":"Ubuntu:300,300italic|Roboto+Slab:400|logo:small","Merriweather - Raleway":"Merriweather:300,300italic,700|Raleway:300|menu:Raleway|subheader:Raleway",custom0:"-","Raleway - Lobster":"Raleway:300,600,300italic|Lobster+Two:400|styled:italic|footer:italic","Merriweather - Berkshire Swash":"Merriweather:300,700,300italic|Berkshire+Swash|subheader:small","Open Sans - Paytone One":"Open+Sans:300italic,400,600|Paytone+One|subheader:small","Lato - Bubblegum Sans":"Lato:400,700,400italic|Bubblegum+Sans|subheader:small","Roboto - Shadows Into Light":"Roboto:300,300italic,700|Shadows Into Light Two|topbar:Shadows Into Light Two|sidebar:Shadows Into Light Two","Gudea - Rancho":"Gudea:400,700,400italic|Rancho|logo:large|topbar:Rancho,uppercase|sidebar:Rancho,uppercase,small|subheader:small",custom1:"-","Roboto [+Slab]":"Roboto:300italic,300|Roboto Slab:300,400|topbar:Roboto Slab|sidebar:Roboto Slab","PT Sans [+Narrow]":"PT Sans:400,700,400italic|PT Sans Narrow:400,700|logo:700|header:700|subheader:PT Sans Narrow|menu:PT Sans Narrow|topbar:uppercase|sidebar:uppercase","Roboto [+Condensed]":"Roboto:300,300italic,700|Roboto+Condensed:300|menu:Roboto+Condensed|sidebar:uppercase,small|topbar:small,uppercase|subheader:small|styled:Roboto+Condensed|footer:Roboto+Condensed","Alegreya Sans [+SC]":"Alegreya Sans:300,300italic,700|Alegreya Sans SC:400,400italic|styled:italic|footer:italic|topbar:Alegreya Sans SC|sidebar:Alegreya Sans SC","Alegreya [+SC]":"Alegreya:400,400italic,700|Alegreya SC:400|topbar:Alegreya SC|sidebar:Alegreya SC",Raleway:"Raleway:300,300italic,400,600|paragraph:300|logo:400|header:400|sidebar:uppercase,small|topbar:400,uppercase,small",Neuton:"Neuton:300,400,700,300italic|header:400|logo:400|subheader:300|paragraph:300,xxlarge|topbar:uppercase|sidebar:uppercase,small",Dosis:"Dosis:400,500,600|logo:500|header:500","SUPER STYLISH":"header","Cabin [+Sketch]":"Cabin:400,400italic,700|Cabin Sketch:700|logo:700|header:700|styled:Cabin|footer:Cabin","Handlee - Roboto":"Roboto:300,700,300italic|Handlee","Roboto Slab - Megrim":"Roboto Slab:300,700|Megrim|header:uppercase|logo:uppercase|subheader:small|topbar:uppercase","Noto Sans - Pacifico":"Noto Sans:400,700,400italic|Pacifico|subheader:small","PT Sans - Indie Flower":"PT Sans:400,700,400italic|Indie Flower|subheader:small|topbar:uppercase,small|sidebar:uppercase,small","Open Sans - Dancing Script":"Open+Sans:300,600,300italic|Dancing+Script:400,700|header:bold|logo:bold,xlarge|topbar:large","Lato - Just Another Hand":"Lato:300,300italic|Just Another Hand|logo:xxlarge|styled:large|topbar:Just Another Hand,xxlarge|sidebar:Just Another Hand,xxlarge|subheader:small","Droid Sans - Oleo Script":"Droid+Sans:400,400italic,700|Oleo+Script:400,700|sidebar:Oleo+Script|topbar:Oleo+Script,large|subheader:small","Open Sans - Lobster Two":"Open+Sans:300,600,300italic|Lobster+Two:400,700","Lato - Great Vibes":"Lato:300,300italic|Great+Vibes|logo:xxlarge|subheader:300|paragraph:300|styled:xlarge","Lato - Oldenburg":"Lato:300,300italic|Oldenburg|topbar:Oldenburg|sidebar:Oldenburg|subheader:small","Open Sans - Playfair Display":"Open+Sans:300italic,300,600|Playfair+Display:400|subheader:small","Roboto Condensed - Amatic SC":"Roboto+Condensed:300,300italic,700|Amatic+SC:700|topbar:Amatic SC,large|sidebar:Amatic SC,large","Nobile - Corben":"Open+Sans:300,300italic,600|Corben:400,700|logo:700,xsmall|subheader:small","Inconsolata - Special Elite":"Inconsolata:400,700|Special%20Elite|logo:small|topbar:Special Elite|sidebar:Special Elite|subheader:small|styled:Inconsolata","BEAUTIFUL SIBLINGS":"header","Open Sans [+Condensed]":"Open+Sans:300italic,300,600|Open Sans Condensed:300,700|menu:Open Sans Condensed|header:700|logo:700|subheader:Open Sans Condensed|topbar:uppercase|sidebar:uppercase","[+Slab] Roboto":"Roboto Slab:300,700|Roboto:900|logo:bold|header:bold","Ubuntu [+Condensed]":"Ubuntu:300,300italic,700|Ubuntu Condensed","[+Sans] Merriweather":"Merriweather Sans:300,300italic,700|Merriweather:400italic,700|logo:700|header:700|styled:italic|footer:italic|subheader:italic","Josefin Slab [+Sans]":"Josefin Slab:400,400italic,700|Josefin Sans:400|menu:Josefin Sans","Varela [+Round]":"Varela|Varela+Round|topbar:Varela+Round|sidebar:Varela+Round","POWERFUL SINGLES":"header",Roboto:"Roboto:300italic,300","Roboto Slab":"Roboto+Slab:300,400,700|paragraph:300|subheader:300","Roboto Condensed":"Roboto+Condensed:300italic,700italic,300,400,700|logo:700|header:700|paragraph:300|subheader:300|sidebar:uppercase,300|menu:300|topbar:400,uppercase,small|sidebar:uppercase,small","Droid Serif":"Droid+Serif:400,700,400italic|header:bold|logo:bold,small|subheader:italic,small|styled:italic|footer:italic",
  "Open Sans":"Open+Sans:300,300italic,600,600italic|topbar:uppercase,small|sidebar:uppercase,small",Montserrat:"Montserrat:400,700|topbar:uppercase,small|sidebar:uppercase,xsmall",Ubuntu:"Ubuntu:300,300italic,400,400italic|subheader:300|paragraph:300",Merriweather:"Merriweather:300,300italic,400,400italic|paragraph:300|header:400|logo:400|subheader:italic|styled:italic|footer:italic|menu:italic",Lora:"Lora:400,700,400italic,700italic|subheader:italic|styled:italic|footer:italic|menu:italic","PT Sans":"PT+Sans:400,700,400italic,700italic|logo:700|header:700|subheader:italic|topbar:uppercase|sidebar:uppercase","PT Sans Narrow":"PT Sans Narrow:400,700|logo:bold|header:bold|topbar:uppercase|sidebar:uppercase,small","Noto Sans":"Noto Sans:400,700,400italic|subheader:italic,small|styled:italic|footer:italic","Yanone Kaffeesatz":"Yanone Kaffeesatz:300,400|logo:400|header:400|subheader:300|paragraph:300|menu:300|topbar:uppercase","Source Sans Pro":"Source Sans Pro:300,300italic,600,600italic|subheader:small|paragraph:300|topbar:uppercase",Cabin:"Cabin:400,600,400italic|subheader:italic|styled:italic,normal|footer:italic","Josefin Sans":"Josefin Sans:400,400italic",Marvel:"Marvel:400,400italic,700|header:700|logo:700","Titillium Web":"Titillium Web:300,300italic,600,600italic","GOOD COMBINATIONS":"header","Raleway - Bitter":"Raleway:300,600,300italic,600italic|Bitter:400|sidebar:small","Dosis - Cinzel":"Dosis:300,600|Cinzel|sidebar:large|styled:Dosis","Oxygen - Volkhov":"Oxygen:300,700|Volkhov:400|paragraph:300|subheader:300|logo:small","Gentium Basic - Open+Sans":"Gentium Basic:400,700,400italic|body:small|Open+Sans:400,600,800|header:800,uppercase|logo:bold,uppercase,xsmall|menu:Open+Sans|sidebar:uppercase,xsmall|topbar:uppercase,small|subheader:large","Open Sans - Bree Serif":"Open+Sans:300italic,300,600|Bree+Serif","Source Sans Pro - Bitter":"Source Sans Pro:300,300italic,600|Bitter:400|topbar:uppercase|small","PT Sans - Arvo":"PT+Sans:400,700,400italic|Arvo:400,400italic,700|topbar:|sidebar:|subheader:Arvo,small|styled:PT+Sans","Josefin Sans - Montaga":"Josefin+Sans:400,700,400italic|Montaga","Roboto - Yanone Kaffeesatz":"Roboto:300,300italic,700|Yanone+Kaffeesatz:400,700|logo:bold|header:bold|subheader:small|topbar:Yanone+Kaffeesatz,uppercase|sidebar:Yanone+Kaffeesatz,uppercase","Sintony - Rufina":"Sintony:400,700|Rufina:400,700|subheader:small|logo:bold|header:bold|topbar:|sidebar:","Source Sans Pro - Oxygen":"Source Sans Pro:300,600,300italic|Oxygen:400|sidebar:Oxygen|topbar:Oxygen","Lato - Oswald":"Lato:300,700,400italic|Oswald:300|sidebar:Oswald|topbar:Oswald|subheader:300","Lora - Ubuntu":"Lora:400,700,400italic|Ubuntu:300|menu:300,Ubuntu|subheader:small","Noto Sans - Montserrat":"Noto+Sans:400,700,400italic|Montserrat|menu:Montserrat",none:"none"},classes:""};stylerConfig.favs={"&#9733; RECOMMENDED &#9733;":"mine",Akaishi:["topbar-center topbar-fixed-up","twilight brown",stylerConfig.fonts["[+Sans] Merriweather"],"clear"],Andes:["topbar-center topbar-fixed-up","white coral",stylerConfig.fonts["Open Sans - Fauna One"],"clear"],Apennines:["topbar-center topbar-fixed-up","white hotpink",stylerConfig.fonts.Raleway,"clear"],Appalachian:["topbar-center topbar-fixed-up","daylight yellowgreen",stylerConfig.fonts["Sintony - Rufina"],"clear"],Aravalli:["topbar-center topbar-fixed-up","black crimson",stylerConfig.fonts["Open Sans - Bree Serif"],"clear"],Atlantika:["topbar-center topbar-fixed-up","organic 78a642",stylerConfig.fonts["[+Slab] Roboto"],"filled"],Atlas:["topbar-center topbar-fixed-up","twilight brown",stylerConfig.fonts["Roboto Condensed - Amatic SC"],"clear"],Bakossi:["topbar-center topbar-fixed-up","science salmon",stylerConfig.fonts["Gudea - Rancho"],"filled"],Beaufort:["topbar-center topbar-fixed-up","twilight goldenrod",stylerConfig.fonts.Marvel,"filled"],Belasitsa:["topbar-center topbar-fixed-up","twilight brown",stylerConfig.fonts["PT Sans Narrow"],"clear"],Bergamo:["topbar-center topbar-fixed-up","organic indianred",stylerConfig.fonts["Raleway - Amaranth"],"clear"],Bitterroot:["topbar-center topbar-fixed-up","daylight yellowgreen",stylerConfig.fonts.Neuton,"clear"],Camelsfoot:["topbar-center topbar-fixed-up","daylight palevioletred",stylerConfig.fonts["Open Sans - Lobster Two"],"clear"],Cantabrian:["topbar-center topbar-fixed-up","twilight darkcyan",stylerConfig.fonts["Alegreya Sans [+SC]"],"filled"],Carpathian:["topbar-center topbar-fixed-up","organic 78a642",stylerConfig.fonts["Droid Sans - Oleo Script"],"filled"],Caucasus:["topbar-center topbar-fixed-up","twilight mediumvioletred",stylerConfig.fonts["Open Sans - Paytone One"],"filled"],Cederberg:["topbar-center topbar-fixed-up","twilight seagreen",stylerConfig.fonts["Raleway - Amaranth"],"filled"],Chittagong:["topbar-center topbar-fixed-up","twilight steelblue",stylerConfig.fonts["PT Sans - Arvo"],"filled"],Chuckwalla:["topbar-center topbar-fixed-up","white mediumaquamarine",stylerConfig.fonts["Noto Sans - Pacifico"],"clear"],Cordillera:["topbar-center topbar-fixed-up","mellow indianred",stylerConfig.fonts["Alegreya Sans [+SC]"],"clear"],Dachstein:["topbar-center topbar-fixed-up","daylight yellowgreen",stylerConfig.fonts["PT Sans - Indie Flower"],"clear"],Dolomites:["topbar-center topbar-fixed-up","daylight salmon",stylerConfig.fonts["Merriweather - Alegreya Sans"],"filled"],Drakensberg:["topbar-center topbar-fixed-up","daylight palevioletred",stylerConfig.fonts["Sintony - Rufina"],"clear"],Genevieve:["topbar-center topbar-fixed-up","twilight steelblue",stylerConfig.fonts["Open Sans - Fauna One"],"clear"],Granatspitze:["topbar-center topbar-fixed-up","twilight seagreen",stylerConfig.fonts["Ubuntu - Raleway"],"clear"],Grossglockner:["topbar-float topbar-fixed-up","daylight ffc000",stylerConfig.fonts["Source Sans Pro - Bitter"],"clear"],Himalayas:["topbar-float topbar-fixed-up","daylight darkorange",stylerConfig.fonts["Open Sans - Fauna One"],"clear"],"Hindu Kush":["topbar-float topbar-fixed-up","twilight brown",stylerConfig.fonts["Merriweather - Raleway"],"filled"],Jayawijaya:["topbar-float topbar-fixed-up","mellow darksalmon",stylerConfig.fonts["Sintony - Rufina"],"clear"],Jotunheimen:["topbar-float topbar-fixed-up","twilight 78a642",stylerConfig.fonts.Dosis,"clear"],Karakoram:["topbar-float topbar-fixed-up","science darkseagreen",stylerConfig.fonts["Lato - Bubblegum Sans"],"filled"],Karwendel:["topbar-float topbar-fixed-up","organic hotpink",stylerConfig.fonts["Dosis - Cinzel"],"filled"],Khibinsky:["topbar-float topbar-fixed-up","black olivedrab",stylerConfig.fonts["Roboto [+Slab]"],"clear"],Kilimanjaro:["sidebar","mellow indianred",stylerConfig.fonts["Josefin Sans"],"clear"],Livigno:["sidebar","twilight brown",stylerConfig.fonts["Inconsolata - Special Elite"],"filled"],Lebombo:["sidebar","black olivedrab",stylerConfig.fonts["Merriweather - Alegreya Sans"],"filled"],Mandara:["sidebar","mellow palevioletred",stylerConfig.fonts["Open Sans - Paytone One"],"filled"],Mantiqueira:["sidebar","daylight yellowgreen",stylerConfig.fonts["Titillium Web"],"filled"],Pyrenees:["sidebar","black crimson",stylerConfig.fonts["Source Sans Pro - Bitter"],"clear"],"Saint Elias":["sidebar","daylight darkseagreen",stylerConfig.fonts["Merriweather - Berkshire Swash"],"clear"],"Santa Catalina":["sidebar","white hotpink",stylerConfig.fonts["PT Sans - Indie Flower"],"filled"],"Sierra Nevada":["sidebar","twilight steelblue",stylerConfig.fonts["Lato - Oswald"],"filled"],Snowdonia:["sidebar","daylight darkseagreen",stylerConfig.fonts["Roboto Slab - Megrim"],"clear"],Stanovoi:["sidebar","daylight salmon",stylerConfig.fonts.Ubuntu,"filled"],Swartberg:["sidebar","daylight darkseagreen",stylerConfig.fonts["[+Slab] Roboto"],"filled"],"Tian Shan":["sidebar","science darkseagreen",stylerConfig.fonts["Josefin Sans"],"filled"],Transantarctic:["sidebar","twilight peru",stylerConfig.fonts["Roboto Slab"],"clear"],Trollheimen:["sidebar","twilight brown",stylerConfig.fonts["Roboto - Shadows Into Light"],"filled"],Vanoise:["sidebar","daylight skyblue",stylerConfig.fonts["Roboto Slab - Megrim"],"filled"],Zagros:["sidebar","organic burlywood",stylerConfig.fonts["Ubuntu - Roboto Slab"],"filled"]},function(){function a(c,d,a,b){var e=Math.round(screen.width/2-a/2),f=Math.round(screen.height/2-b/2),g=window.open(c,d,"toolbar=no, location=yes, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width="+a+", height="+b+", top="+f+", left="+e);window.focus&&g.focus()}$("body").on("click","[data-popup-window]",function(b){if(!preventJSClick(b)){b.preventDefault(),b.stopImmediatePropagation();var d=$(this).data("href")||$(this).attr("href"),c=$(this).data("popup-window").split(","),e=c[0]||"mywindow";width=Math.min(screen.width,parseInt(c[1])||600),height=Math.min(screen.height,parseInt(c[2])||500),a(d,e,width,height)}})}();var editor_templates={"Markdown Sample":"## Intro\nWe recommend using [markdown](https://help.github.com/articles/markdown-basics/) for basic content editing, because it is easy to read, faster to write and prevents html-coding mistakes which make break the page. You can use the markdown-syntax in the examples below, the toolbar or keyboard-shortcuts like `cmd-b` and `ctrl-b`.\n\nNew paragraphs should be separated by two blank lines. Styles *italic*, **bold** and ~~strikethrough~~ are easily added. Add links like [flamepix](https://flamepix.com) by using syntax `[text](url)`. Add a horizontal rule by including three hyphens:\n\n---\n\n## Links\nEasily add links into your content by adding `[link text]` in brackets, immediately followed by the `(url)` in parenthesis. Optionally, you can surround a link address in angle-brackets `<https://flamepix.com>`, and it will automtically be formatted as a link. Examples:\n\n* <http://imagevuex.com>\n* [mjau-mjau](https://mjau-mjau.com)\n* [relative link ../](../)\n\n## Lists\nUnordered lists can be started using the toolbar, or by typing `*`, `-` or `+`. Ordered lists can be started by typing `1.`.\n\n* Lists are piece of cake ...\n* They will auto-continue as you type ...\n* Double-enter will end a list\n	* Tabs and shift-tabs works also ...\n	* ... for nested lists\n\n## Image\nEmbed images by adding the image `[title]` in brackets, immediately followed by the image `(img url)` in parenthesis. **Tip!** Use `{{path}}` to refer the path of the current page, for example `![title]({{path}}/file.jpg)`.\n\n![Agent Smith](http://imagevuex.com/agent-smith.jpg)\n\n## Blockquote\nAdd blockquotes by preceding text on a new line with the `>` tag.\n\n> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eget sem et dui pulvinar aliquam. Etiam sit amet nulla erat. Mauris aliquam euismod tellus, ac varius velit tincidunt ut.","Font Awesome Icons":'<!-- Find your icon name here http://fontawesome.io/icons/ -->\nHere is a camera <i class="fa fa-camera"></i> icon.\n<i class="fa fa-heart fa-2x" style="color:tomato;"></i>\n<i class="fa fa-trophy fa-5x"  style="color:gold;"></i>',"Comparison-slider plugin":'<!-- Comparison slider demo and documentation: https://demo.flamepix.com/examples/features/comparison-slider/ -->\n<div class="comparison-slider x3-style-frame" data-orientation="horizontal" data-offset="0.5" data-hover="true">\n<img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f648.svg">\n<img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f435.svg">\n</div>',"Simple Contact Form":'<form data-abide class=contactform>\n	<div>\n		<input required type=text name="name" placeholder="Name">\n	</div>\n	<div>\n		<input required type="email" name="email" placeholder="Email">\n	</div>\n	<div>\n		<textarea required rows=6 name="message" placeholder="Message"></textarea>\n	</div>\n	<button type=submit>Send</button>\n</form>',"Columns 6/6":'<div class="row">\n  <div class="medium-6 columns">\n		<img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f98e.svg" alt="lizard">\n  </div>\n  <div class="medium-6 columns">\n  	<p>Both left and right columns are set to 6/12 width. This creates a two columns equal-width columns, which collapse into a single column on small screens. Read more about the grid <a href=http://foundation.zurb.com/docs/components/grid.html>here</a>.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla, risus ac lacinia consequat, ipsum augue posuere quam, eget commodo lorem augue vel dui. Sed elementum quis risus a volutpat. Vivamus fringilla, risus ac lacinia consequat, ipsum augue posuere quam, eget commodo lorem augue vel dui. Sed elementum quis risus a volutpat.</p>\n  </div>\n</div>',"Columns 4/8":'<div class="row">\n  <div class="medium-4 columns">\n		<img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f40a.svg" alt="crocodile">\n  </div>\n  <div class="medium-8 columns">\n  	<p>Left column is set to use 4/12 columns width, while right column is set to take 8/12 columns width. This creates a two columns layout, which collapse into a single column on small screens. Read more about the grid <a href=http://foundation.zurb.com/docs/components/grid.html>here</a>.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla, risus ac lacinia consequat, ipsum augue posuere quam, eget commodo lorem augue vel dui. Sed elementum quis risus a volutpat.</p>\n  </div>\n</div>',"Block-Grid 3,2,1":'<!-- Evenly adjust content within a block-grid -->\n<!-- Read more: http://foundation.zurb.com/sites/docs/v/5.5.3/components/block_grid.html -->\n<ul class=\'small-block-grid-1 medium-block-grid-2 large-block-grid-3\'>\n<li><div data-alert class="alert-box bg2"><strong>Block Grid</strong><br>Block grids give you a way to evenly separate contents of a list within a grid. If you want to create a row with a specific amount of elements that need to stay evenly spaced, the block grid is your friend.</div></li>\n<li><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f693.svg"></li>\n<li><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f691.svg"></li>\n<li><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f692.svg"></li>\n<li><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f699.svg"></li>\n<li><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f695.svg"></li>\n</ul>',"About Me Example":'---\n\n<div class="row text-left">\n  <div class="medium-6 columns">\n    <div class="frame">\n      <figure><!-- Add your own image in below src -->\n        <img alt="profile" src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f3c2.svg">\n      </figure>\n    </div>\n  </div>\n\n  <div class="medium-6 columns">\n  <p><strong>Howdy!</strong><br>\n  My name is Bob Dobalina, and this website is my blog as well as a playground\n  for the Imagevue X3 gallery website system. <a href="https://demo.flamepix.com" target="_blank">View Demo</a></p>\n\n  <p><strong>About me</strong><br>\n  I am interested in design, functionality, minimalism and performance. My hobbies are: sleeping, snoozing and watching TV.</p>\n\n  <p><strong>Article</strong><br>\n  More than a decade ago, when SWF was an emerging technology, this website became a very popular showcase of Flash. <a href="https://mjau-mjau.com/blog/rewind-web-2002/">See Post</a></p>\n  </div>\n</div>',"Embed Youtube":"<div class='flex-video widescreen x3-style-frame'>\n	<iframe src='//www.youtube.com/embed/A3PDXmYoF5U' frameborder='0' allowfullscreen></iframe>\n</div>","Embed Vimeo":"<div class='flex-video widescreen vimeo x3-style-frame'>\n<iframe src='//player.vimeo.com/video/84067859' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>\n</div>","Embed Google Maps":"<div class='flex-video x3-style-frame' style='height:auto;'>\n<iframe src='https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d424396.3176723366!2d150.92243255000002!3d-33.7969235!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6b129838f39a743f%3A0x3017d681632a850!2sSydney+NSW%2C+Australia!5e0!3m2!1sen!2sth!4v1415268600966' frameborder='0' style='border:0'></iframe>\n</div>","Embed MP4 Video":'<!-- Upload an MP4 video file to your page, and use the code below to embed the video into your content. The {{path}} variable will dynamically convert to the folder path -->\n<video width=100% controls>\n<source src="{{path}}videofilename.mp4" type="video/mp4">\n</video>',"Popup Links":'<!-- Basic image popup. You can replace the href tag with "{{path}}/filename.jpg" to load an image within the same folder. Demo and documentation: https://demo.flamepix.com/examples/samples/popup/ -->\n<a href="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f405.svg" data-popup>Tiger</a>\n\n<!-- Open Youtube video in popup -->\n<a href="https://www.youtube.com/embed/G46ygBKsTZI" data-popup>Youtube Video</a>\n\n<!-- Open a website in browser popup-window. You can set window name, width and height  -->\n<a href="https://flamepix.com" data-popup-window="name,800,600">flamepix.com</a>',"Carousel Plugin":'<!-- content carousel. More info: https://demo.flamepix.com/examples/plugins/carousel/ -->\n<div data-carousel data-carousel-items=3 data-carousel-loop=true data-carousel-dots=true data-carousel-autoplay=3000 data-carousel-responsive=true data-carousel-shuffle=false>\n<div><h3>Camel</h3><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f42b.svg" /></div>\n<div><h3>Fish</h3><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f41f.svg" /></div>\n<div><h3>Squirrel</h3><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f43f.svg" /></div>\n<div><h3>Goat</h3><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f410.svg" /></div>\n<div><h3>Elephant</h3><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f418.svg" /></div>\n<div><h3>Ox</h3><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f402.svg" /></div>\n<div><h3>Whale</h3><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f433.svg" /></div>\n<div><h3>Blowfish</h3><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f421.svg" /></div>\n<div><h3>Turtle</h3><img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.6/assets/svg/1f422.svg" /></div>\n</div>',"Modal Plugin":'<!-- Add the modal element anywhere in your content. It will be hidden until triggered. -->\n<div id="modal_id1" class="reveal-modal" data-reveal aria-hidden="true" role="dialog">\n<a class="close-reveal-modal" aria-label="Close"><i class="fa fa-close"></i></a>\n<h2>Modal Title</h2>\n<p>Modal content/html here.</p>\n</div>\n\n<!-- Include a link anywhere in your content to trigger a modal with a specific ID on click. Make sure the id of the modal element matches the data-reveal-id in the link! -->\n<a href="#" data-reveal-id="modal_id1">Open Modal link</a>',"Tabs Plugin":'<!-- Wrap all code inside a <section> with tabs-container class -->\n<!-- Optional style classes that can be included: tabs-style-1 OR tabs-style-2 -->\n<section class="tabs-container tabs-radius tabs-anim tabs-color-active">\n\n<!-- Create a ul list that contains the tab links -->\n<!-- include the vertical class if you want to use vertical orientation -->\n<ul class="tabs" data-tab>\n<li class="tab-title active"><a href="#panel1">Tab 1</a></li>\n<li class="tab-title"><a href="#panel2">Tab 2</a></li>\n<li class="tab-title"><a href="#panel3">Tab 3</a></li>\n<li class="tab-title"><a href="#panel4">Tab 4</a></li>\n</ul>\n\n<!-- Create a tabs content element that contains all tab contents  -->\n<!-- include the vertical class if you want to use vertical orientation -->\n<div class="tabs-content">\n<div class="content active" id="panel1">\n<p>This is the first panel of the basic tab example.</p>\n</div>\n<div class="content" id="panel2">\n<p>This is the second panel of the basic tab example.</p>\n</div>\n<div class="content" id="panel3">\n<p>This is the third panel of the basic tab example.</p>\n</div>\n<div class="content" id="panel4">\n<p>This is the fourth panel of the basic tab example.</p>\n</div>\n</div>\n\n<!-- Make sure #links in the <a> anchor tags correspond with id\'s in the tabs-content! -->\n</section>',"Alert Box":'<!-- You can use any of the following color-tags: success alert bg2 bg3 primary warning info -->\n<div data-alert class="alert-box success">\n\n<!-- close button below is optional -->\n<a href="#" class="close close-x"></a>\n\nAdd your content/html here.\n</div>',"Toggle Content":'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus tristique quis justo luctus pulvinar. Nulla venenatis lacus eget sapien pretium dignissim. <span class="toggle-content">Duis feugiat magna vitae fermentum euismod. Sed venenatis finibus lorem. Phasellus vel ante nibh. Praesent nec metus condimentum, vulputate ex vel, molestie sem. Praesent molestie tortor in mi tristique, at commodo lorem volutpat. Integer elementum facilisis erat, in pellentesque turpis venenatis ac.</span><br><a href="#" class="toggle-button" data-close-text="less">more</a>\n\n<a href="#" class="toggle-button">What is a tomato?</a>\n<div class="toggle-content">The <strong style="color: tomato;">tomato</strong> is the edible, red fruit of Solanum lycopersicum, commonly known as a tomato plant, which belongs to the nightshade family, Solanaceae. The species originated in Central and South America. The Nahuatl (Aztec language) word tomatl gave rise to the Spanish word "tomate", from which the English word tomato originates.</div>',"Custom Form Example":'<!-- More info on HTML forms: http://foundation.zurb.com/sites/docs/v/5.5.3/components/forms.html -->\n<!-- Always start your <form> with DATA-ABIDE attribute and "contactform" class -->\n<form data-abide class="contactform text-left">\n\n<!-- All form elements must contain NAME attributes-->\n<div>\n<input type="text" name="name" placeholder="Name" required>\n</div>\n\n<!-- Notice the REQUIRED attribute, which makes the input required -->\n<div>\n<input type=\'email\' name=\'email\' placeholder=\'Email\' required>\n</div>\n\n<div>\n<input type="tel" name="Phone Number" placeholder="Phone number">\n</div>\n\n<!--  Select lists -->\n<div>\n<strong>Ice Cream Flavor</strong>\n<select name="Ice Cream Flavour">\n<option value="Vanilla flavor">Vanilla</option>\n<option value="Chocolate flavor">Chocolate</option>\n<option value="Strawberry flavor">Strawberry</option>\n<option value="Pistachio flavor">Pistachio</option>\n</select>\n</div>\n\n<!--  With radio groups NAME should be the same across all radios in the group. -->\n<!--  Include CHECKED attribute to set default checked value -->\n<div>\n<strong>Favorite color</strong><br>\n<input type="radio" name="Favorite Color" value="Red" id="radio1" checked><label for="radio1">Red</label>\n<input type="radio" name="Favorite Color" value="Blue" id="radio2"><label for="radio2">Blue</label>\n<input type="radio" name="Favorite Color" value="Green" id="radio3"><label for="radio3">Green</label>\n</div>\n\n<!--  With checkboxes, set different NAME attributes. -->\n<!--  Include CHECKED attribute to set default checked values -->\n<div>\n<strong>I like to</strong><br>\n<input type="checkbox" name="sleep" value="Yes!" id="check1" checked><label for="check1">Sleep</label>\n<input type="checkbox" name="snooze" value="As long as possble" id="check2"><label for="check2">Snooze</label>\n<input type="checkbox" name="doze" value="All the time" id="check3"><label for="check3">Doze</label>\n</div>\n\n<!--  textarea input -->\n<div>\n<strong>Message</strong>\n<textarea required rows="6" name="message" placeholder="Add your message"></textarea>\n</div>\n\n<!--  SEND button -->\n<button type=submit>Send</button>\n\n<!-- End form -->\n</form>'};!function(a){function b(a){if(a.selectionStart)return a.selectionStart;if(document.selection){a.focus();var c=document.selection.createRange();if(null==c)return 0;var b=a.createTextRange(),d=b.duplicate();return b.moveToBookmark(c.getBookmark()),d.setEndPoint("EndToStart",b),d.text.length}return 0}var c={allowFloat:!1,allowNegative:!1};a.fn.numericInput=function(f){var e=a.extend({},c,f),g=e.allowFloat,d=e.allowNegative;return this.keypress(function(f){var c=f.which,e=a(this).val();if(c>0&&(48>c||c>57))if(1==g&&46==c){if(1==d&&0==b(this)&&"-"==e.charAt(0))return!1;if(e.match(/[.]/))return!1}else{if(1!=d||45!=c)return 8==c?!0:!1;if("-"==e.charAt(0))return!1;if(0!=b(this))return!1}else if(c>0&&c>=48&&57>=c&&1==d&&"-"==e.charAt(0)&&0==b(this))return!1}),this}}(jQuery);var cf_domain_id,cf_checked=!1;$("body").on("keypress.nospace, keyup.nospace",'input.file-link, [name="gallery.image.link"]',function(a){return 32==a.which?!1:void $(this).parent().toggleClass("has-link",$(this).val().length>0)}).on("mouseenter",".file-data > a",function(f){var c=$("a.view-page").attr("href"),b=$(this).closest("tr").data("name"),d=b.substr(0,b.lastIndexOf(".")),a=$(this).parent().children("input.file-link").val().replace("{file_name}",d).replace("{file_name_ext}",b),e=0===a.toLowerCase().indexOf("http")?a:0===a.indexOf("/")?".."+a:c+a;$(this).attr("href",e),"popup"===$(this).parent().find("label.active").data("name")?$(this).attr("data-popup-window",""):$(this).removeAttr("data-popup-window")}).on("focus","input.file-link",function(a){$(this).parent().addClass("has-focus")}).on("blur","input.file-link",function(a){$(this).parent().removeClass("has-focus")}).on("mouseenter",".file-data > input, .file-data > textarea",function(a){$(this).prev().addClass("has-hover")}).on("mouseleave",".file-data > input, .file-data > textarea",function(a){$(this).prev().removeClass("has-hover")}).on("click","a.set-preview, span.set-preview",function(b){b.preventDefault();var a=$(this).closest("tr").data("name");save_inject({image:a},function(c){if(c){var b=$('input.form-control.selectized[name="image"]');b.length&&b[0].selectize.addItem(a,!0)}},"Changed folder preview image.")}).on("click",".td-folder",function(a){$(this).next().children("a").click()}).on("click",'input[name="settings.menu_manual"]',function(a){$("li#refresh").toggleClass("hidden",!$(this).is(":checked"))}).on("click",".previews-log td.dir > a",function(a){a.preventDefault(),showFileManager($(this).attr("href"))}),$(function(){$("body").append('<div class="modal" id="modal-settings" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-body"></div></div></div></div>')}),$("body").on("click","a.show-help, a.text-help, .panel-help",function(a){a.stopPropagation();var b=$("body").children("#modal-settings"),c=b.find(".modal-body");if(a.preventDefault(),$(this).data("help"))var d=x3_help[$(this).data("help")];else var e=$(this).siblings(".hidden").length>0?$(this).siblings(".hidden"):$(".container").find($(this).data("hidden")),d=e.html();c.html(d),b.modal()}),$(function(){function g(a){new_folder_path=a,mkdir($("#newFolder").data("there")||null)}function d(d,e){a.text()!==d&&a.toggleClass("error",e).text(d).velocity("stop").velocity({opacity:[1,0]},{duration:200}),e&&(clearTimeout(f),c=!0,f=setTimeout(function(){c=!1,a.text()!==b&&a.removeClass("error").text(b).velocity("stop").velocity({opacity:[1,0]},{duration:200})},2e3))}$("body").on("click","#newFolder button.btn-primary",function(d){var a=$(this).closest(".modal-content").find("input#new_folder").val();if(a.length>0){var b=a.split(".");if(a.indexOf(".")>-1&&$.isNumeric(b[0]))b[1].length>0&&g(a);else{var c=confirm("Is it intentional to keep this page hidden from the menu?");c&&g(a)}}});var f,a,e,k='* Add a number before name to make page visible in website menu (f.ex "5.name").',i="* Page will be visible in website menu.",h="* Empty spaces are not allowed in folder names.",b="",j="",c=!1;$("body").on("focus","#new_folder, #rename_new_name",function(b){a=$(this).next("span"),e=$(this).closest(".modal-content").find("button.btn-primary, button.btn-success")}),$("body").on("keypress keyup focus","#new_folder, #rename_new_name:not(.input-move)",function(f){var g=String.fromCharCode(f.which);if("#$%^&*()+=[]'\"/\\|{}`~!@".indexOf(g)>-1)return"keypress"==f.type&&d(g+" character not allowed in folder names.",!0),!1;var a=$(this).val();is_numeric=a.indexOf(".")>-1&&$.isNumeric(a.split(".")[0]),b=is_numeric?i:a.length>1?k:j,32==f.which?(d(h,!0),"keyup"==f.type&&$(this).val(a.replace(/\s+/g,"-"))):c||d(b,!1),$(this).toggleClass("is_numeric",is_numeric),e.prop("disabled",a.length<1||is_numeric&&a.split(".")[1].length<1||0===a.indexOf("."))})}),x3_help={new_folder:"<h3>Create New Folder</h3><p>Creates a new child-page (subfolder) inside the current page. The name you give to the folder, represents the page URL (slug) in browser, and should be short and simple.</p><h4>Numbered Folder Names</h4><p>To make the page visible in menu, you need to apply a number in front of the name, for example <code>4.foldername</code>. The number indicates that the page is visible, and also sets the sorting order of the page.</p><p>The following example creates a page <em>visible</em> in the menu, with sort order 4:<br><strong><code>4.foldername</code></strong> : <code>yourwebsite.com/foldername/</code><br><em>* The number in folder name will NOT display in the URL.</em></p><p>The following example creates a page that is <em>not</em> visible in the menu:<br><strong><code>foldername</code></strong> : <code>yourwebsite.com/foldername/</code><br><em>* Invisible pages are still accessible by URL, but are hidden from menu and lists.</em></p><h4>Folder names are <u>NOT</u> page titles</h4><p>Folder names are only used for the URL, and to identify the page. Instead, you should use the page <code>title</code> setting for extensive page titles, and the <code>label</code> setting for menu labels. The folder name should be as simple as possible, preferably a single lowercase word, without special characters or empty spaces.</p><h4>Empty spaces not allowed</h4><p>Empty spaces are NOT allowed in folder names. Even if they were allowed, it would create inhuman url's that are bad for SEO: <code>/not%20nice%20url/</code>. If you need to use multiple words, separate them with hyphens- instead: <code>/nice-url/</code>.</p><h4>Other disallowed characters</h4><p>Other characters that are not allowed in folder names include <code>#$%^&*()+=[]'\"/\\|{}`~!@</code>. Most of these characters are simply not allowed in URL's, while some characters are disallowed because they break the functionality of X3.</p>",protect:'<h3>Page Password Protection</h3><p>Here you can add passwords to your pages. Simply locate the page in the <code>link</code> field, add a <code>username</code> and <code>password</code>, and click save. The specific page will now require login when accessed by any visitor.</p><h4>Users</h4><p><em>* Optional</em></p><p>Instead of adding a username and password per page link, you can instead include <code>users</code> to give specific users access to a page. Users are added separately from the <code>users</code> tab. The benefit of "users", is that you can assign a single login for a user, which may allow them access to multiple protected pages without re-entering login credentials. Also, it is sometimes easier to manage usernames and passwords in a users section for persistent usage.</p><p><em>* You should select either a user <strong>OR</strong> username+password, not both.</em></p><h4>Recursive Protection</h4><p>Link protection is recursive, which means the login for a specific link will inherit upon child pages. For example, a password applied to <code>galleries/</code> would also apply for child-pages <code>galleries/food/</code> and <code>galleries/landscape/</code>. If you are specifically protecting child-pages of already-protected parent-pages, the child-page login will outrank the parent-page login.</p><h4>Global Protect</h4><p>Use the special <code>*Global</code> link to protect your entire X3 website. Basically this is like protecting the / root page, and since link-protection is recursive, it will protect ALL pages - your entire website. <em>* You can still apply passwords to child-pages, which will outrank the global protection.</em></p><h4>Super Users</h4><p>There is a special <code>superuser</code> user, which can access ALL password-protected pages without even being assigned specifically for the link. A super-user should normally be reserved for gallery-owners who want to remember a single login that works on all password-protected pages. Create a super-user in the users-section by simply appending an asterisk* behind the username, for example <code>superuser*</code>. Since super-users are allowed access to ALL password-protected pages, they do not show up in the list of available users to assign from the links tab.</p><p><em>* The asterisk* character is part of the username, and needs to be included when logging in.</em></p><h4>Sessions</h4><p>Login uses WWW-Authenticate, which basically creates "sessions" in the browser that remembers the current authentication. This helps so the visitor doesn\'t need to re-authenticate, and it also allows a "user" to access all pages they are assigned to without having to enter login details more than once. This is a good thing of course, but since there is no "logout" for these sessions, it can make testing difficult from your browser since you may be logged in to a session already. Therefore, if you are testing your protected pages, you may need to use "New Incognito Window" (Google Chrome), or "New Private Window" (Safari, Firefox) for each test. These special windows do not inherit your browser sessions, so you can test properly. Just remember to to open/close the window for each test, because even private windows have temporary sessions until they are closed.</p>',
  "page-examples":'<div class="alert alert-warning alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong class=title>Examples</strong><span class=content>This folder contains examples of various layouts for your pages. Instead of deleting this folder, we recommend that you hide it by renaming it from <i>3.examples</i> to <i>_examples</i> (without the number, with _underscore). This way, the page is hidden, but remains available from your panel to view- or copy settings. <strong>NB!</strong> All galleries in the examples section are set to load images from the the same <em>3.examples/assets</em> folder, for the sake of demonstration.</span></div>',"page-logo":'<div class="alert alert-warning alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong class=title>Logo</strong><span class=content>Upload your logo here if you have selected image-logo in your settings.</span></div>',"page-audio":'<div class="alert alert-warning alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong class=title>Audio Player Files</strong><span class=content>To enable audio, upload one or more mp3 files, and enable the audio player plugin from <em>settings &rsaquo; plugins &rsaquo; audio player</em>. If you get errors on mp3 file upload, it is likely because your server has a <strong>2MB upload_max_filesize</strong> limit in php.ini (see <a href="../?diagnostics" target=_blank>diagnostics</a>). If so, you will need to either increase upload_max_filesize on your server, or upload mp3 files by FTP.</span></div>',"page-404":'<div class="alert alert-warning alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong class=title>404 "Page Not Found" Template</strong><span class=content>This page can be edited to change the text- and appearance of the page that appears when a page is not found.</span></div>',"page-custom":'<div class="alert alert-warning alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close" style=\'visibility: visible;\'><span aria-hidden="true">&times;</span></button><strong class=title>Custom</strong><span class=content>This folder contains a few special folders. Do <em>not</em> delete!</span></div>',"page-index":'<div class="alert alert-warning alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close" style=\'visibility: visible;\'><span aria-hidden="true">&times;</span></button><strong class=title>Home Page</strong><span class=content>文件夹名称1.index代表您的主页。你可以把它从菜单重命名它为index。索引页面不能包含子页面（子文件夹），而仅仅是一个占位符的主页.</span></div>',"page-content":'<div class="alert alert-warning alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close" style=\'visibility: visible;\'><span aria-hidden="true">&times;</span></button><strong class=title>Content Folder</strong><span class=content>This is your root content folder, where you basically add your page structure. This folder does not represent any page, and is just the container for your root-level pages. Do not upload images into this folder.</span></div>',"page-assets":'<div class="alert alert-warning alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close" style=\'visibility: visible;\'><span aria-hidden="true">&times;</span></button><strong class=title>Examples Gallery Assets</strong><span class=content>This is where we store images for galleries in the examples sample pages.</span></div>',"page-favicon":'<div class="alert alert-warning alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close" style=\'visibility: visible;\'><span aria-hidden="true">&times;</span></button><strong class=title>Favicon</strong><span class=content>Add a custom favicon <a href=https://en.wikipedia.org/wiki/Favicon target=_blank>[wiki]</a> by deleting the default favicon.png, and uploading your own icon with the same name. Favicon needs to be in PNG format, and should be 32 x 32 px.</span></div>',preload:'<h3>Preload Site Object</h3><p><em>* This feature only applies if you have selected Preload Site Object in settings.</em></p><h4>What does it do?</h4><p>When this setting is enabled, your website will preload a data-object containing all pages of your website. The loading of this data-object occurs as an invisible process, after first page is loaded and displaying to the visitor. Once the site Object is loaded into the visitors browser, navigating to other pages on the website are instantaneous. This makes your website seems super-fast, and it requires less loading of individual pages.</p><p><em>* The Site Object only contains page text, so images and other assets will load as usual once each page displays.</em></p><h4>Should I be using it?</h4><p>Preloading the site object is a very powerful feature, but it is not beneficial in all cases. If your website has hundreds of pages, each with loads of images, it will become too heavy and counter-productive. If you have a relatively light website (say less than 40 pages), without excessive amounts of images in each folder, then you can try it.</p><h4>Heavy Process</h4><p>As you will likely experience, creating the site object is a very heavy process, that could take a long time to process on your server, or even time-out. The reason for this, is because the script needs to loop through- and create all pages in a single process. The time required for processing, depends entirely on the power of your server, and the depth of your content (pages and images). If you get a timeout when clicking the button, it is a clear indication that you shouldn\'t be using this feature. If your server manages to create the site object, it will get cached, and will load relativey fast for visitors.</p><h4>Instructions</h4><p>If you want to use this feature, you will need to need to enable the preload site object from your main settings. Then, each time you make changes to your gallery, you will need to click the "create" button below to refresh the site object. You don\'t need to create the site object after every change you make, only when you are done editing and want to "publish" the website.</p><p><em>* You don\'t need to refresh the site object if you are testing individual pages. The site object is only used when navigating between pages, and does not apply to the page you start from.<em></p>',authorize:"<h3>Authorize</h3><p>Checks if your domain is authorized to used X3.</p><h4>Coming Soon ...</h4><p>Currently, the only limitation of non-authorized domains, is that a sticky link to imagevuex.com is added to the footer. Information will be provided shortly about how to obtain a license and authorize your domain.</p>",menu:"<h3>Create Menu</h3><p>Click the button to create- and <u>cache</u> your X3 website menu. Once the menu is created, it will be cached until next time you make any changes to your X3 website. The cached menu fragment will allow separate pages to build faster.</p><h4>Do I need this?</h4><p>No - This operation is optional because the menu will be created- and cached on the first page visit regardless. This process may be helpful for X3 websites with a heavy menu structure where you wish to pre-cache the menu before loading any pages.</p><h4>About Menu Caching</h4><p>Every time you make <u>any</u> change to your X3 website, the menu needs to get re-created and cached. The menu creation is a relatively heavy process, because it requires X3 to loop through <u>all</u> folders in your content, read the data file and gather information about all files. The speed of this process is proportional to the amount of folders and files in your content, and the speed of your server.</p>",htaccess:"<h3>Htaccess</h3><p><em>* This is an advanced feature. Do NOT edit this file unless you know what you are doing.</em></p><p>This page displays the content of the <code>.htaccess</code> file in your root directory. The .htaccess file is necessary for X3 to be able to run properly. This feature is mainly mainly used to diagnose issues, but can also be used to edit the htaccess file if it is writable.</p>",reset:"<h3>Reset</h3><p>This setting resets your global settings to default, by simply deleting the <code>config/config.user.json</code> file. It does NOT affect page-settings stored in your pages/folders. </p>",templates:"<h3>Setting Templates</h3><p>Setting templates are tested combinations of settings, which can be applied to folders- and gallery. Basically, they are just shortcuts for certain layout-combinations, which you otherwise can apply normally. You don't need to use setting templates, but they offer a quick way to achieve specific layouts.</p><p><strong>Important</strong><br>Default setting templates only change a <em>few</em> related options each, and many settings will remain default. Therefore, it is likely you may wish to make some adjustments after applying a template. Templates may not affect specific layout details, tooltips- or captions, so results may depend on your defaults.</p><h4>Custom Templates</h4><p>Create your own templates by selecting the <code>Save Current Settings As...</code> option. This will allow you to save current settings as a custom template.</p><p><em>* You still need to click SAVE after applying a template.</em></p>",image_title:"<h3>Image Title</h3><p>Add a unique title for your image. Titles may display in gallery layouts and in the image popup. <em>* You can use any characters in image title</em>.</p><h4>Some html allowed</h4><p>You are allowed to use the following html tags in image titles:<br><code>&lt;code&gt;&lt;a&gt;&lt;span&gt;&lt;em&gt;&lt;i&gt;&lt;b&gt;&lt;strong&gt;&lt;small&gt;&lt;s&gt;</code></p><h4>Dynamic Values</h4><p>You can use the following values in titles, which are replaced dynamically. This may be useful if you are including file names, or links that refer to the image name.</p><p><code>{file_name_ext}</code> is replaced by the file name.<br><code>{file_name}</code> is replaced by the file name <em>without</em> extension.<br><code>{path}</code> is replaced by the path of current folder.<br><code>{image_path}</code> is replaced by the path to the image.</p>",image_description:"<h3>Image Description</h3><p>Add a unique description for your image. Descriptions may display in gallery layouts and in the image popup. <em>* You can use any characters in image description</em>.</p><h4>Some html allowed</h4><p>You are allowed to use the following html tags in image descriptions:<br><code>&lt;a&gt;&lt;span&gt;&lt;em&gt;&lt;i&gt;&lt;b&gt;&lt;strong&gt;&lt;small&gt;&lt;s&gt;&lt;br&gt;&lt;mark&gt;&lt;img&gt;&lt;kbd&gt;&lt;code&gt;&lt;button&gt;</code></p><h4>Dynamic Values</h4><p>You can use the following values in default description, which are replaced dynamically. This may be useful if you are including file names, or links that refer to the image name.</p><p><code>{file_name_ext}</code> is replaced by the file name.<br><code>{file_name}</code> is replaced by the file name <em>without</em> extension.<br><code>{path}</code> is replaced by the path of current folder.<br><code>{image_path}</code> is replaced by the path to the image.</p>",image_link:"<h3>Image Link</h3><p>If you set an image link, clicking an image will open the link instead of the image. You can use absolute- or relative links. <em>* If you want to link to an X3 page, you should use a relative path so that the link is loaded by ajax.</em></p><p><code>https://flamepix.com</code><br><em>* Absolute link.</em></p><p><code>/pagex/pagey/</code><br><em>* Link is relative to domain name.</em></p><p><code>pagex/pagey/</code><br><em>* Link is relative to current page.</em></p><h4>Dynamic Values</h4><p>You can use the following variables in your links, which are replaced dynamically:</p><p><code>{file_name_ext}</code> is replaced by the file name.<br><code>{file_name}</code> is replaced by the file name <em>without</em> extension.<br><code>{path}</code> is replaced by the file path of current folder.<br><code>{image_path}</code> is replaced by the path to the image.</p><h3>Target</h3><p>Target decides in what window to open the link.</p><p><code>auto</code> Uses default target, or automatically determines target depending on the link.<br><code>_self</code> Opens the link in the same window.<br><code>_blank</code> Opens the link in a new window (normally a new tab).<br><code>popup</code> Opens the link in a popup window.<br><code>X3 popup</code> Opens link in native X3 popup. <em>* Good for Youtube embeds, images and simple content, but should <u>not</u> be used when linking to full websites.</em></p>",custom_sort:"<h2>Custom Sort Order</h2><p>This mode allows you to drag-and-drop items into a custom sorting order. After you have sorted items into order, click to &quot;save&quot; the custom sorting order.</p><p><em>* You need to select&nbsp;<strong>custom</strong> sort order in your page gallery settings to use the custom sorting.</em></p><br><div class='panel panel-danger'><div class='panel-heading'><strong style='font-size: 1.2em;'>Important</strong></div><div class='panel-body'><ul><li>For practical reasons, we recommend using the <em>grid</em> mode for sorting files.</li><li>You cannot sort <em>folders</em>, as they are not part of the gallery.</li><li>You can still apply <em>ascending-</em> or <em>descending</em> in page gallery settings, but normally you would use the default ascending, as descending would reverse the order.</li><li>Custom order only applies if you actually change the order from the default and save.</li><li>If you upload new items to an already-sorted page, the new items will be added to the top of the order. Sometimes, you may need to re-sort&nbsp;new items after upload, just to reinstate&nbsp;the correct sorting order.</li><li>Avoid custom sorting if you can sort by name or date.&nbsp;<em>Why?</em>&nbsp;Because custom sorting requires storing the order in your page data file, is not as robust as sorting by name or date, and requires additional processing.</li><li>If you rename a file, it will loose it&#39;s custom sorting order. Why? Because for custom sort, we need to store the sorting order with the file name as key, in a separate file.</li></ul></div></div>",previews:"<h2>Update Preview Images</h2><p>This tool will attempt to set preview images for your pages, unless already set correctly.</p><p><em>What are page preview images?</em><br>Page preview image is a unique image that identifies a page. It is used in category listing pages, in the mega menu, and also when sharing the page.</p><p><em>Do my pages need preview images?</em><br>No, but if you are using the mega menu, you may want to have unique preview images for each page. If you don't set a unique preview image, default preview image will be used.</p><p><em>Why isn't this process automatic?</em><br>This process is too slow to be handled automatically by the frontend.</p><p><em>How does this tool help?</em><br>You might have forgotten to set a preview image? Perhaps you want your category pages to inherit preview image from a child folder? Maybe you renamed an image that is used for preview? This tool will correct issues for you.</p><p><em>This tool will attempt to perform the following on all your pages:</em></p><strong>If preview image is set</strong><ol><li>Checks if the preview image is valid.</li><li>Checks if <code>preview.jpg</code> exists in folder.</li><li>Tries to set first image from the page gallery.</li><li>If the page has no images, tries to set first image from page gallery assets.</li><li>If no success, you will be notified 'Cannot locate image'.</li></ol><strong>If preview image is <u>NOT</u> set</strong><ol><li>Checks if <code>preview.jpg</code> exists in folder.</li><li>Tries to set first image from the page gallery.</li><li>If page has no images, tries to set first image from gallery assets.</li><li>If page has no assets assigned, tries to set image from first image in last child folder.</li><li>If no success, preview will be left empty.</li></ol>",refresh:"<h2>Refresh Menu</h2><p>Click this button to refresh your site main menu.</p><h4>Why isn't this process automatic?</h4><p>Building the menu can be a slow process because it requires looping through all pages, extracting data, and looping through images. Why re-build the menu each time you make a change if the change does not affect the menu? Use this button to publish your site menu when required. Pages will get created faster when the menu is cached.</p><h4>Can I set it to automatic?</h4><p><strong>Yes.</strong> Go to <em>Settings › settings › Menu Processing</em>, and disable <em>Manual refresh</em>. If you disable this feature, the site menu will be re-created every time you make <em>any</em> changes from the panel. Depending on the depth of your content and the speed of your server, this could drastically slow down page creation time.</p><p><em>* Manual menu refresh does not affect output speed of already-cached pages.</em></p>"};var mtree_menu_expanded=!1,mtree_menu_open=[],files_checked=!1,page_selected_items={},current_nav,current_folder_images=[],json_menu,fixed_timer;$("#content_show").on("keyup",".modal input.form-control",function(b){if(13==b.keyCode){var a=$(this).closest(".modal");a.find(".btn-key").length&&a.find(".btn-key").click()}}),$("#searchInput").on("keyup",function(a){13==a.keyCode&&$(this).parent().siblings(".top_search_btn").click()}),$("#content_show").on("click.tablerow",".manage-table tr",function(b){var a=b.target.nodeName.toLowerCase();if("td"==a||"tr"==a){var c=$(this).find('input[type="checkbox"]');c.click()}});var active_page_tab=supports_local_storage()&&null!==localStorage.getItem("active_page_tab")?localStorage.getItem("active_page_tab"):"#page";$("#content_show").on("click","#myTab a",function(a){active_page_tab=$(this).attr("href"),supports_local_storage()&&localStorage.setItem("active_page_tab",active_page_tab)}),supports_local_storage()&&$("body").on("click",".col-md-9 > .alert .close",function(a){a.preventDefault();var b=$(this).parent().data("path");localStorage.setItem("help-"+b,"hide")});var gallery_views,active_gallery_view=supports_local_storage()&&null!==localStorage.getItem("active_gallery_view")?Math.min(4,Number(localStorage.getItem("active_gallery_view"))):1;$(document).ready(function(){gallery_views=[["list","align-justify","btn-xs",language.List],["small","list","btn-sm",language.Small_Thumbs],["big","th-list","btn-sm",language.Large_Thumbs],["edit","pencil","btn-sm",language.Edit_Mode],["grid","th","btn-sm","grid"]]}),$("#content_show").on("click.view",".btn-view",function(a){active_gallery_view=active_gallery_view>=gallery_views.length-1?0:active_gallery_view+1,supports_local_storage()&&localStorage.setItem("active_gallery_view",active_gallery_view),x3FileManagerView(active_gallery_view),$(".list-actions > .button-helper").text(gallery_views[active_gallery_view][3])}),$("#content_show").hoverIntent({over:function(a){$(".list-actions > .button-helper").text($(this).data("title")).velocity({opacity:1},{duration:200})},out:function(a){$(".list-actions > .button-helper").text("").velocity("stop").css("opacity",0)},selector:".list-actions > *"}),$("#content_show").on("mouseover",".selected-actions button",function(d){var b=$(".selected-text"),c=$(this).hasClass("disabled"),a=selected.length+" "+b.data("lang");a=c?a:$(this).text()+" "+a,b.text(a).addClass(c?"nonselected":"ishover")}).on("mouseout",".selected-actions",function(b){var a=$(".selected-text");a.text(selected.length+" "+a.data("lang")).removeClass("ishover nonselected")}),$("#content_show").hoverIntent({over:function(a){$(this).find(".td-button .btn-group, span.set-preview").velocity({opacity:1},{duration:200})},out:function(){$(this).find(".td-button .btn-group, span.set-preview").velocity("stop").css("opacity",0)},timeout:200,selector:".manage-table tr"}),$("#content_show").hoverIntent({over:function(a){$(this).find(".dropdown-menu").velocity({opacity:1},{duration:200,display:"block"})},out:function(){$(this).find(".dropdown-menu").velocity("stop").hide()},timeout:200,selector:".td-button .btn-group"}),$("#content_show").on("click.checkbox",".td-checkbox > input",function(a){$(this).closest("tr").toggleClass("is-checked",$(this).is(":checked")),x3SaveSelected(),selectUpdate()});var gallery_sort=[["sort","-by-alphabet"],["filesize","-by-attributes-alt"],["date","-by-order"],["custom",""]],active_gallery_sort=supports_local_storage()&&null!==localStorage.getItem("active_gallery_sort")?Math.min(3,Number(localStorage.getItem("active_gallery_sort"))):0,mysortable,was_custom_sort=!1,is_custom_sort=!1;$("#content_show").on("click.sort",".btn-sort",function(a){active_gallery_sort=active_gallery_sort>=gallery_sort.length-1?0:active_gallery_sort+1,supports_local_storage()&&localStorage.setItem("active_gallery_sort",active_gallery_sort),x3SetSort(active_gallery_sort),$(".list-actions > .button-helper").text($(this).data("title"))}),$(".container").on("click.pageclass",".navbar-nav > li:not(.dropdown)",function(b){var a=$(this).attr("id");$(".container").toggleClass("fileManager","fileManager"==a),current_nav=a,supports_local_storage()&&void 0!==a&&localStorage.setItem("current_nav",a)}),$(".container").addClass("fileManager");var x3_settings=supports_local_storage()&&null!==localStorage.getItem("x3_settings")?JSON.parse(localStorage.getItem("x3_settings")):{};$("#content_show").on("click","a.popup",function(c){c.preventDefault();var d=$(this).closest(".popup-parent"),e=$(this).closest("tr").index('tr[data-isimage="1"]'),a=$(this).attr("rel"),f=void 0===a?$(this):d.find('a.popup[rel="'+a+'"]'),b=[];f.each(function(e,f){var a="<span>"+$(this).data("name")+"</span><span>"+$(this).data("width")+" x "+$(this).data("height")+"</span><span>"+$(this).data("filesize")+"</span>",c=$(this).closest("tr").find(".file-data > input").val(),d=$(this).closest("tr").find(".file-data > textarea").val();(c||d)&&(a+="<div>",c&&(a+="<span class=caption-title>"+c+"</span>"),d&&(a+=d),a+="</div>"),b.push({src:$(this).attr("href"),w:$(this).data("width"),h:$(this).data("height"),title:a})});var g={index:e,showHideOpacity:!0,bgOpacity:.95,history:!1,barsSize:{top:0,bottom:0},captionEl:!0,shareEl:!1},h=new PhotoSwipe($(".pswp")[0],PhotoSwipeUI_Default,b,g);h.init()}),supports_local_storage()&&(null!==localStorage.getItem("last_user")&&localStorage.getItem("last_user")!==user&&(localStorage.removeItem("current_nav"),localStorage.removeItem("current_page")),localStorage.setItem("last_user",user));var protectPage,protectPageAfter;$(function(){function l(){$("#preloader").modal("show");var b={};if(b.access={},$("#form-access").children().length>1){var c=[];$("#form-access").children().each(function(g,h){var a=$(this).find("#link_form").val()||"",d=$(this).find("#users_form").val()||"",e=$(this).find("#username_form").val()||"",f=$(this).find("#password_form").val()||"";a.length>0&&($.inArray(a,c)>-1&&x3Notifier('<strong>Warning: Link "'+a+'"</strong><br>'+language.warning_multiple_links,3e3,null,"warning"),c.push(a),b.access[a]={},e.length>0&&(b.access[a].username=e),f.length>0&&(b.access[a].password=f),d.length>0&&(b.access[a].users=[],$.each(d,function(d,c){b.access[a].users.push(c)})))})}if(b.users={},$("#form-users").children().length>1){var d=[];$("#form-users").children().each(function(e,f){var a=$(this).find("#users_username_form").val()||"",c=$(this).find("#users_password_form").val()||"";a.length>0&&c.length>0&&(b.users[a]=c),$.inArray(a,d)>-1&&c.length>0&&x3Notifier('<strong>Warning: Username "'+a+'"</strong><br>'+language.warning_multiple_usernames,3e3,null,"warning"),a.length>0&&0==c.length&&x3Notifier("<strong>Warning</strong><br>"+language.usernames_without_passwords,3e3,null,"warning"),0==a.length&&c.length>0&&x3Notifier("<strong>Warning</strong><br>"+language.passwords_without_usernames,3e3,null,"warning"),a.length>0&&c.length>0&&d.push(a)})}$.ajax({method:"POST",url:"x3_protect.php",dataType:"json",data:{protect:JSON.stringify(b)},success:function(b,c,d){void 0!=b.error?(console.log("Error: "+b.error),x3Notifier(language.Error+": "+b.error,null,null,"danger")):(console.log("Success"),x3Notifier(language.Saved,null,null,"success"),a=b,i())},error:function(b,a,c){x3Notifier(language.Error+" -> textStatus: "+a,null,null,"danger"),console.log("textStatus: "+a),console.log("errorThrown: "+c),console.dir(b)},complete:function(){$("#preloader").modal("hide")}})}function e(){b=!1,$("#preloader").modal("hide"),$("#content_show").html(m),$(".x3-protect .nav-tabs").find('a[href="'+g+'"]').tab("show"),$("#content_show").velocity("fadeIn",{duration:500}),i(),$(".x3-protect .protect-controls").scrollToFixed({zIndex:2})}function i(){k(),j()}function c(b,c){var a='<div class=row>\n		<div class="form-group col-md-5">\n		<div class="input-group">\n		<div class="input-group-addon"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></div>\n		<label class="sr-only" for="users_username_form">'+language.Username+'</label>\n		<input type="text" id="users_username_form" name="username" class="form-control" placeholder="'+language.Username+'" value="'+b+'">\n		</div>\n		</div>';return a+='\n		<div class="form-group col-md-5">\n		<div class="input-group">\n		<div class="input-group-addon"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span></div>\n		<label class="sr-only" for="users_password_form">'+language.Password+'</label>\n		<input type="text" id="users_password_form" name="password" class="form-control" placeholder="'+language.Password+'" value="'+c+'">\n		</div>\n		</div>',a+='\n		<div class="col-md-2">\n		<button type="button" class="btn btn-default btn-remove" tabIndex=-1><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>\n		</div>',a+="</div>"}function j(){var b="<form id=form-users name=form-users>";$.each(a.users,function(a,d){b+=c(a,d)}),b+="</form>",$("#protect-users").html(b),$("#protect-users #form-users").prepend(c("",""))}function d(c,d,f,g){var b='\n		<div class="access-item row">\n		<div class=col-md-11>\n		<div class="form-group">\n    <input type="text" id="link_form" name="link" class="form-control select-link" placeholder="'+language.Link+'" value="'+c+'">\n		</div>',e="";return $.each(a.users,function(a,b){"*"!==a.slice(-1)&&(e+='<option value="'+a+'" '+(void 0!=d&&$.inArray(a,d)>-1?"selected":"")+">"+a+"</option>")}),b+='\n		<div class="form-group">\n		<select multiple class="form-control select-users" id=users_form placeholder="'+language.Users+'">'+e+"</select>\n		</div>",b+='<div class=row>\n		<div class="form-group col-md-6">\n		<div class="input-group">\n		<div class="input-group-addon"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></div>\n		<label class="sr-only" for="username_form">'+language.Username+'</label>\n		<input type="text" id="username_form" name="username" class="form-control" placeholder="'+language.Username+'" value="'+f+'">\n		</div>\n		</div>',b+='\n		<div class="form-group col-md-6">\n		<div class="input-group">\n		<div class="input-group-addon"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span></div>\n		<label class="sr-only" for="password_form">'+language.Password+'</label>\n		<input type="text" id="password_form" name="password" class="form-control" placeholder="'+language.Password+'" value="'+g+'">\n		</div>\n		</div>\n		</div>\n		</div>',b+='\n		<div class=col-md-1>\n		<button type="button" class="btn btn-default btn-remove" tabIndex=-1><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>\n		</div>',0==c.length&&(b+='\n			<div class="col-md-12 passwords-help">\n			* '+language.passwords_help+"\n			</div>"),b+="</div>"}function h(b){var e=b.find(".select-link"),c=json_menu.slice(),f=e.val().split(",");-1==$.inArray("*",f)&&c.unshift({link:"*",label:"*GLOBAL"}),$.each(f,function(d,a){var b="*"==a?"*GLOBAL":a;c.unshift({link:a,label:b})});var i=e.selectize({valueField:"link",labelField:"label",searchField:["link"],options:c}),j=b;i[0].selectize.on("item_add",function(){var a=$("#form-access");if(j.is(":first-child")){a.prepend(d("","","",""));var b=a.find(".row:first-child");b.css("display","none").velocity("slideDown",{duration:500,delay:10,easing:"easeOutQuart"}),h(b)}});var g=b.find(".select-users").selectize();Object.keys(a.users).length<1?g[0].selectize.disable():g[0].selectize.enable()}function k(){var b="<form id=form-access name=form-access>";$.each(a.access,function(c,a){var e=void 0==c||0==c.length?"":c,f=void 0==a.username?"":a.username,g=void 0==a.password?"":a.password;b+=d(e,a.users,f,g)}),b+="</form>",$("#protect-access").html(b),$("#form-access").prepend(d("","","","")),$.each($("#form-access .access-item"),function(a,b){h($(this))})}var f=[],b=!1,g=supports_local_storage()&&null!==localStorage.getItem("protected_tab")?localStorage.getItem("protected_tab"):"#protect-access";$("body").on("keyup","#form-users .row:first-child input",function(e){var a=$(this).closest(".row"),b=a.find("#users_username_form").val(),d=a.find("#users_password_form").val();b.length>0&&d.length>0&&a.is(":first-child")&&($("#protect-users #form-users").prepend(c("","")),$("#protect-users #form-users .row:first-child").css("display","none").velocity("slideDown",{duration:500,delay:10,easing:"easeOutQuart"}))}),$("body").on("click",".x3-protect .btn-remove",function(a){$(this).closest(".row").velocity("slideUp",{duration:200,complete:function(){$(this).remove()}})}),$(".container").on("click","#protect",function(a){a.preventDefault(),protectPage()}),$(".container").on("click",".btn-save-protect",function(a){a.preventDefault(),l()}),$(".container").on("click",".x3-protect .nav-tabs a",function(e){g=$(this).attr("href"),supports_local_storage()&&localStorage.setItem("protected_tab",g);var c=$(".x3-protect").offset().top;if($(window).scrollTop()>c&&$(window).scrollTop(c),"#protect-access"==$(this).attr("href")){var b=[],d=[];$("#form-users").children().length>0&&$("#form-users").children().each(function(e,f){var a=$(this).find("#users_username_form").val()||"",c=$(this).find("#users_password_form").val()||"";a.length>0&&"*"!==a.slice(-1)&&(b.push(a),d.push(c))}),a.users={},$.each(b,function(b,c){a.users[c]=d[b]}),(0!==$(b).not(f).length||0!==$(f).not(b).length||0==b.length)&&($.each($("#form-access .access-item"),function(c,d){var a=$(this).find(".select-users")[0].selectize;b.length>0&&$.each(b,function(c,b){a.addOption({value:b,text:b})}),$.each(a.options,function(c,d){-1==$.inArray(c,b)&&a.removeOption(c)}),0==b.length?a.disable():a.enable()}),f=b)}});var a,m="\n	<div class=x3-protect>\n		<div class=protect-controls>\n		<button type=button class='btn btn-primary btn-save-protect'>"+language.Save+"</button>\n		<button type=button data-help=protect class='btn btn-default btn-protect-help panel-help'><i class='fa fa-question'></i></button>\n    <ul class='nav nav-tabs' role='tablist'>\n	    <li role=presentation class=active><a href=#protect-access aria-controls=protect-access role=tab data-toggle=tab>"+language.Links+"</a></li>\n	    <li role=presentation><a href=#protect-users aria-controls=protect-users role=tab data-toggle=tab>"+language.Users+"</a></li>\n    </ul>\n    </div>\n    <div id=myTabContent class=tab-content>\n      <div role=tabpanel class='tab-pane active in' id=protect-access></div>\n      <div role=tabpanel class='tab-pane fade' id=protect-users></div>\n    </div>\n  </div>";
  protectPageAfter=function(){b&&$(".navbar-nav li#protect").hasClass("active")&&e()},protectPage=function(){$("#preloader").modal("show"),void 0==a||b?$.getJSON("x3_protect.php",function(c,d){$(".navbar-nav > li.active").removeClass("active"),$("#protect").addClass("active"),"success"==d?void 0!=c.error?(console.log("Error: "+c.error),x3Notifier(language.Error+": "+c.error,null,null,"danger")):void 0!=json_menu?(a=c,e()):(a=c,b=!0,console.log("log: waiting for menu ...")):(console.log("Error -> success: "+d),x3Notifier(language.Error+" -> success: "+d,null,null,"danger"))}):($(".navbar-nav > li.active").removeClass("active"),$("#protect").addClass("active"),e())}}),$(function(){$("body").on("click","li#refresh > a",function(b){b.preventDefault();var a=$("li#refresh > a");original_text=a.html(),date1=new Date,a.attr("disabled",!0).width(a.width()).text("Refreshing ..."),$.getJSON("menu_create.php").done(function(a){if(a.success)var b=new Date,c=Number(b)-Number(date1),d="Menu refreshed in "+(c/1e3).toFixed(2)+" seconds.";else if(a.error)var d="Error: "+a.error+" seconds.";else var d="Error :(";x3Notifier(d,2e3,null,"success")}).fail(function(a,b,c){console.dir(a);var d=b+" : "+c;x3Notifier(d,2e3,null,"danger")}).always(function(e,f,g){var b=new Date,c=Number(b)-Number(date1),d=Math.max(1,1e3-Number(c));setTimeout(function(){a.html(original_text).attr("disabled",!1)},d)})})}),$(function(){key.filter=function(a){return!0},key("⌘+s, ctrl+s",function(a,b){return console.log("KEYKEY "+$("#json-form").find(".save-settings").length),$("#json-form").find(".save-settings").length?($("#json-form").find(".save-settings").click(),!1):void 0})});var get_x3_settings,settings_loaded=!1,current_settings;!function(){function p(){$.getJSON("settings-schema.json",function(a){f=!0,b=a}).fail(function(){console.log("Error: Can't load panel/settings-schema.json")})}function l(){$.ajax({method:"POST",url:"x3_settings.php",dataType:"json",data:{get_settings:!0},success:function(a,b,c){settings_loaded=!0,current_settings=a},error:function(b,a,c){console.log("Error: "+a),x3Notifier(language.Error+" -> textStatus: "+a,null,null,"danger")}})}function o(a){if(console.log("save SETTINGS"),!e){e=!0;var b=$("button.btn-settings-save");b.button("loading"),$("#preloader").modal("show"),$.ajax({method:"POST",url:"x3_settings.php",dataType:"json",data:{settings:JSON.stringify(a)},success:function(b,d,e){if(b.success){var c=!current_settings.back.panel.use_db&&(current_settings.back.panel.username!==a.back.panel.username||current_settings.back.panel.password!==a.back.panel.password);current_settings=a,x3Notifier(language.Saved,null,null,"success"),console.log("Success"),c&&location.replace("logout.php"),i()}else x3Notifier(language.Error+": "+b.error,2e3,null,"danger"),console.log("Error: "+b.error)},error:function(b,a,c){x3Notifier(language.Error+" -> textStatus: "+a,null,null,"danger"),console.log("Save Error: "+a)},complete:function(){setTimeout(function(){b.button("reset")},1e3),$("#preloader").modal("hide"),e=!1}})}}function j(){function g(b){var a=$('input[name="style.skin.primary_color"]')[0].selectize,c=a.getValue();a.clearOptions(),a.load(function(e){e(d[b]),a.createItem(c)})}b.value=current_settings,b.onSubmit=function(a,b){a?(console.log("Errors"),console.dir(a)):(console.log("form valid!"),o(b)),console.log(b)},$(".filter-buttons").scrollToFixed({zIndex:5}),b.form[1].items[2].items[0].onChange=function(a){var b=$(a.target).val();$(".jsonform-error-style---layout---fixed, .jsonform-error-style---layout---wide").toggle(b.indexOf("topbar")>-1)},a.append('<input style="display:none;" type="text" name="somefakename" /><input style="display:none;" type="password" name="anotherfakename" />'),a.jsonForm(b);var e=$('input[name="style.skin.primary_color"]'),h=e.val(),j=e.selectize({persist:!1,create:!0,maxItems:1,valueField:"item",labelField:"item",searchField:"item",options:d[$(".skin-selector > label.active > input[type=radio]").val()]});j[0].selectize.createItem(h),$(".skin-selector input[type=radio]").change(function(){g($(this).val())});var c=$('textarea[name="style.font.font"]'),k=c.val(),f=[];$.each(stylerConfig.fonts,function(b,a){"header"!==a&&"-"!==a&&f.push({label:b,link:a})}),c.before("<select></select><label>Source</label>");var l=c.siblings("select"),j=l.selectize({items:[k],create:!1,maxItems:1,valueField:"link",labelField:"label",searchField:["link"],options:f,onChange:function(a){c.val(a)}});autosize($("textarea")),n();var m=a.find('[data-jsonform-type="ace"]');m.each(function(d,e){var b=$(this).children(".controls").children("div"),c=b.children("div").attr("id"),a=ace.edit(c);b.css("height","auto"),a.setAutoScrollEditorIntoView(!0),a.setOption("maxLines",100),a.setOption("minLines",5),a.getSession().setUseWrapMode(!0),a.$blockScrolling=1/0}),a.find(".alt-title").each(function(b,c){var a=$(this).find(".help-block").first().html();$(this).prev("legend").html(a),$(this).remove()}),$(".settings_selectize").each(function(h,i){var a=$(this).find(".selectize-items"),d=a.hasClass("selectize-single"),b=a.text().split(","),f=d?[$(this).find("input").val()]:$(this).find("input").val().split(","),e=[];$.each(f,function(c,a){-1==$.inArray(a,b)&&b.push(a)}),$.each(b,function(b,a){e.push({item:a})});var c={create:a.hasClass("selectize-create"),valueField:"item",labelField:"item",searchField:"item",options:e};d&&(c.maxItems=1,c.delimiter=null);var g=$(this).find("input").selectize(c);g[0].selectize.enable()}),i()}function n(){c=a.children().children("fieldset");var d="";$.each(c,function(a,e){var c=b.form[a].title;d+='<label class="btn btn-primary"><input type="radio" name="options" id="option'+(a+1)+'" autocomplete="off" checked>'+c+"</label>",$(this).data("height",$(this).outerHeight(!0))}),g=$(".filter-buttons"),g.children(".btn-group").html(d).after('<button data-loading-text="Saving ..." type="button" class="btn btn-settings-save btn-primary">保存</button>'),g.removeClass("invisible"),h=supports_local_storage()&&null!==localStorage.getItem("x3_settings_tab")?Number(localStorage.getItem("x3_settings_tab")):0,$(".filter-buttons label.btn").eq(h).addClass("active"),c.not(c.eq(h)).css("display","none")}function i(){var a=$('input[name="plugins.image_background.enabled"]');a.closest("fieldset").toggleClass("is-active",a.is(":checked")&&$('input[name="plugins.image_background.src"]').val().length>0);var b=$('input[name="plugins.background.enabled"]');b.closest("fieldset").toggleClass("is-active",b.is(":checked")&&($('input[name="plugins.background.src"]').val().length>0||$('input[name="plugins.background.color"]').val().length>0));var c=$('input[name="plugins.fotomoto.enabled"]');c.closest("fieldset").toggleClass("is-active",c.is(":checked")&&$('input[name="plugins.fotomoto.store_id"]').val().length>0);var d=$('input[name="plugins.audioplayer.enabled"]');d.closest("fieldset").toggleClass("is-active",d.is(":checked"))}function m(e){var d=e,b=c.eq(d);a.css("min-height",b.data("height")),c.not(b).filter(":visible").velocity({opacity:0},{duration:100,display:"none",complete:function(){b.filter(":hidden").velocity({opacity:1},{duration:200,display:"block"})}}),supports_local_storage()&&localStorage.setItem("x3_settings_tab",d)}var b,a,c,h,g,f=!1,e=!1,d={};$.each(stylerConfig.skins,function(c,b){if("header"!==b){var a=c.split(" ")[0],e=b.split(" ")[1];void 0==d[a]&&(d[a]=[]),d[a].push({item:e})}}),p(),l(),get_x3_settings=function(){if(a=$("#json-form"),f&&settings_loaded)j();else var b=setInterval(function(){f&&settings_loaded&&(clearInterval(b),"setting"==current_nav&&j())},1e3)},$("body").on("click",".x3-settings .filter-buttons label.btn",function(a){m($(this).index())}),$("body").on("click","button.btn-settings-save, .fixed-save > .save-page",function(a){$("#json-form").find(".save-settings").click()});var k;$("body").on("mousedown","a.show-help",function(a){k=$(this).closest(".form-group").find("label.active")}).on("mouseup","a.show-help",function(b){var a=$(this).parent(".control-label");setTimeout(function(){a.removeClass("active btn-primary"),k.addClass("active btn-primary")},1)})}();var get_x3_page_settings,page_settings,save_inject;!function(){function u(){y++,2===y&&($.extend(!0,j,p,i),n=!0)}function v(d,e,a,h,b){if(console.log("save PAGE"),!o){void 0===b&&(b=!0),o=!0;var g=$("button.btn-settings-save, button.btn-save-page");g.button("loading"),b&&$("#preloader").modal("show");var c={};e?c.inject=!0:$.extend(!0,d,collectFiledata()),c.page_settings=JSON.stringify(d),c.path=t,$.ajax({method:"POST",url:"x3_settings.php",dataType:"json",data:c,success:function(b,c,g){b.success?(x3Notifier(h||language.Saved,null,null,"success"),console.log("Success"),$.extend(!0,page_settings,d),e&&(f.value=page_settings,a&&a(!0)),setPreviewImageActive(),r()):(x3Notifier(language.Error+": "+b.error,2e3,null,"danger"),console.log("Error: "+b.error))},error:function(c,b,d){x3Notifier(language.Error+" -> textStatus: "+b,null,null,"danger"),console.log("Save Error: "+b),e&&a&&a(!1)},complete:function(){setTimeout(function(){g.button("reset")},1e3),b&&$("#preloader").modal("hide"),o=!1}})}}function x(){var a=$('input[name="gallery.assets"], input[name="folders.assets"]'),b=json_menu.slice();a.each(function(a,c){$(this).selectize({create:!1,maxItems:1,valueField:"link",labelField:"label",searchField:["link"],options:b})})}function l(d){$(".x3-page-settings > .container").append(A),b=$("#json-form"),d.content&&(d.content=d.content.replace(/</g,"&lt;").replace(/>/g,"&gt;")),f.value=d,a||(f.onSubmit=function(f,b){if(b.content=e.value(),$('textarea[name="content"]').val(e.value()),f)console.log("Errors"),console.dir(f);else{if(console.log("form valid!"),console.dir(b),"apply"==a||"paste"==a||"paste-all"==a){var d=$(".x3-page-settings > .container");if(d.css("height",d.outerHeight()),d.empty(),"paste"==a){var h=["title","label","description","date","image","content","link","menu"];$.each(h,function(b,a){a in g&&delete g[a]})}var i="apply"==a?q:g;l($.extend(!0,{},current_settings,b,i)),d.css("height","auto");var j="apply"==a?k+" template applied to "+w+" settings.":"Successfully pasted settings from clipboard.";x3Notifier(j,null,null,"success")}else"get"==a?s=b:"copy"==a?(x3Notifier("Current settings successfully copied.",null,null,"success"),c.find("a.settings-paste, a.settings-paste-all").parent("li").removeClass("disabled"),g=b):v(b);a=!1}}),$(".filter-buttons").scrollToFixed({zIndex:5}),b.jsonForm(f),autosize($("textarea")),C();var o=b.find('[data-jsonform-type="ace"]');if(o.each(function(d,e){var b=$(this).children(".controls").children("div"),c=b.children("div").attr("id"),a=ace.edit(c);b.css("height","auto"),a.setAutoScrollEditorIntoView(!0),a.setOption("maxLines",100),a.setOption("minLines",5),a.getSession().setUseWrapMode(!0),a.$blockScrolling=1/0}),b.find(".alt-title").each(function(b,c){var a=$(this).find(".help-block").first().html();$(this).prev("legend").html(a),$(this).remove()}),void 0!==json_menu)x();else var t=setInterval(function(){void 0!==json_menu&&(clearInterval(t),x())},500);$(".settings_selectize").each(function(g,h){var a=$(this).find(".selectize-items"),b=a.text().split(","),e=$(this).find("input").val().split(","),d=[];$.each(e,function(c,a){-1==$.inArray(a,b)&&b.push(a)}),$.each(b,function(b,a){d.push({item:a})});var c={create:a.hasClass("selectize-create"),valueField:"item",labelField:"item",searchField:"item",options:d};a.hasClass("selectize-single")&&(c.maxItems=1,c.delimiter=null);var f=$(this).find("input").selectize(c);f[0].selectize.enable()}),setTimeout(function(){if(current_folder_images.length){var a=$('input[name="image"], input[name="plugins.image_background.src"], input[name="plugins.background.src"]');a.each(function(c,d){var a=[];$(this);$.each(current_folder_images,function(c,b){a.push({item:b})}),-1==$.inArray($(this).val(),current_folder_images)&&a.unshift({item:$(this).val()});var b=$(this).selectize({create:!0,maxItems:1,delimiter:null,valueField:"item",labelField:"item",searchField:"item",options:a});b[0].selectize.enable()})}},10),e=new SimpleMDE({element:$('textarea[name="content"]')[0],spellChecker:!1,autoDownloadFontAwesome:!1,toolbar:["preview","side-by-side","fullscreen","bold","italic","heading","|","quote","unordered-list","ordered-list","|","link","image","|"]}),1===h&&setTimeout(function(){e.codemirror.refresh()},10);var m=$(".editor-toolbar"),n="",u=Object.keys(editor_templates).sort();$.each(u,function(b,a){n+='<li><a href="#">'+a+"</a></li>"}),m.append('<div class="dropdown dropdown-templates"><a class="btn-templates dropdown-toggle fa fa-magic" data-toggle="dropdown" role="button" aria-expanded="false"></a><ul class="dropdown-menu pull-right dropdown-menu-right" role="menu" aria-labelledby="dropdown-templates"><li class="dropdown-header">Insert Template</li>'+n+"</ul></div>"),m.find(".dropdown-menu").on("click","a",function(a){a.preventDefault();var b=editor_templates[$(this).text()];e.codemirror.replaceSelection(b),e.codemirror.focus()}),$(".editor-toolbar").prepend('<button data-loading-text="Saving ..." type="button" class="btn btn-settings-save editor-save btn-primary">Save</button>'),$(".template-selector").each(function(h,l){var c=$(this).hasClass("template-gallery")?"Gallery":"Folders";$(this).prepend("<div class=setting_templates>"+z+'<select><option value="" disabled selected>'+c+" Setting Templates</option></select></div>"),c=c.toLowerCase();var d=$(this).find("select"),e="",g=Object.keys(p[c]).length,f=[];$.each(Object.keys(j[c]),function(b,a){b===g&&(e+='<option value="" disabled>---</option>'),e+="<option>"+a+"</option>",f.push(a)}),supports_local_storage()&&(e+='<option class=last-option disabled>---</option><option value="save">Save Current Settings As...</option>'),d.append(e),d.on("change",function(){if("save"==$(this).val()){var e=prompt("Save current "+c+"-settings as template:");if(e&&$.inArray(e,f)>-1)x3Notifier("Please use a unique name!",3e3,null,"danger");else if(e){a="get",b.find('input[type="submit"]').click();var g={};g[c]={},g[c][e]={},g[c][e][c]=s[c],$("#preloader").modal("show"),$.ajax({method:"POST",url:"x3_tools.php",dataType:"json",cache:!1,data:{save_template:JSON.stringify(g)},success:function(a,b,c){a.success?x3Notifier('Template "'+e+'" saved.',null,null,"success"):(x3Notifier("Save template error:<br>"+a.fail+"<br><br>Template will be available temporarily until you refresh page.",3e3,null,"warning"),console.log("Save template error: "+a.fail))},error:function(b,a,c){x3Notifier("Save template error:<br>"+a+"<br><br>Template will be available temporarily until you refresh page.",3e3,null,"warning"),console.log("Save template error: "+a)},complete:function(){$("#preloader").modal("hide")}});var h="";$.isEmptyObject(i[c])&&(h+="<option class=last-option disabled>---</option>"),h+="<option>"+e+"</option>",d.children('[value="save"]').prev().before(h),f.push(e),$.extend(!0,i,g),$.extend(!0,j,g)}d.val("")}else k=$(this).val(),w=c,q=j[c][k],a="apply",b.find('input[type="submit"]').click()})}),r()}function C(){d=b.children().children("fieldset");var a="";$.each(d,function(b,d){var c=f.form[b].title;a+='<label class="btn btn-default"><input type="radio" name="options" id="option'+(b+1)+'" autocomplete="off" checked>'+c+"</label>",$(this).data("height",$(this).outerHeight(!0))}),c=$(".filter-buttons"),c.prepend("<h3>"+$(".col-md-9 > h3").text()+"</h3>"),c.children(".btn-group").html(a).after('<button data-loading-text="Saving ..." type="button" class="btn btn-settings-save btn-primary">保存</button>'),c.removeClass("invisible"),h=supports_local_storage()&&null!==localStorage.getItem("x3_settings_page_tab")?Number(localStorage.getItem("x3_settings_page_tab")):0,$(".filter-buttons label.btn").eq(h).addClass("active"),d.not(d.eq(h)).css("display","none"),$('[data-toggle="tooltip"]').tooltip({delay:{show:300,hide:100},html:!0,placement:"bottom"});var e="<div class=hidden><h3>Copy-Paste Page Settings</h3><p>This feature allows you to copy settings from one page to another. This is useful when you want to create a page with an identical layout as an existing page. Simply navigate to the source page, click <code>copy</code>, then navigate to the new page and click <code>paste</code>.</p><h4>Copy</h4><p>Copies settings from the current page into clipboard.</p><h4>Paste</h4><p>Pastes settings from clipboard into the current page. This function will only paste layout-related settings, and will <em>ignore</em> unique page details, content, link and menu.</p><h4>Paste All</h4><p>Same as above, but this function will paste <em>all</em> page settings, including details, content, link and menu. This will basically paste an identical copy of the source page, overwriting all existing settings, so it is likely you will want to make some changes after paste.</p><p><em>* You still need to click save after pasting settings.</em></p></div>";c.find(".btn-group").after('<div class="dropdown dropdown-copy-paste"><button type="button" class="btn btn-sm btn-default btn-copy-paste dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-paste"></i></button>\n    <ul class="dropdown-menu pull-right dropdown-menu-right" role="menu" aria-labelledby="copymenu">\n    <li class="dropdown-header">Copy-Paste Settings</li>\n    <li><a href="#" class=settings-copy data-process=copy><i class="fa fa-copy"></i> Copy</a></li>\n    <li><a href="#" class=settings-paste data-process=paste><i class="fa fa-paste"></i> Paste</a></li>\n    <li><a href="#" class=settings-paste-all data-process=paste-all><i class="fa fa-paste"></i> Paste All</a></li>\n    <li role="separator" class="divider"></li>\n    <li><a href="#" class="settings-copy-help text-help" data-process=copy-paste-help><i class="fa fa-question-circle"></i> Help</a>'+e+"</li>\n  	</ul></div>"),setTimeout(function(){$(".dropdown-copy-paste, .dropdown-templates").hoverIntent({over:function(b){var a=$(this).find(".dropdown-menu");a.velocity({opacity:1},{duration:200,display:"block"}),$(this).addClass("open")},out:function(){var a=$(this).find(".dropdown-menu");a.velocity("stop").css({opacity:0,display:"none"}),$(this).removeClass("open")},timeout:300})},10),c.find("a.settings-paste, a.settings-paste-all").parent("li").toggleClass("disabled",void 0===g)}function r(){$('input[name="plugins.image_background.enabled"]').closest("fieldset").toggleClass("is-active",$('input[name="plugins.image_background.enabled"]').is(":checked")&&$('input[name="plugins.image_background.src"]').val().length>0),$('input[name="plugins.background.enabled"]').closest("fieldset").toggleClass("is-active",$('input[name="plugins.background.enabled"]').is(":checked")&&($('input[name="plugins.background.src"]').val().length>0||$('input[name="plugins.background.color"]').val().length>0)),$('input[name="plugins.video_background.src"]').closest("fieldset").toggleClass("is-active",$('input[name="plugins.video_background.src"]').val().length>0),page_settings.plugins.fotomoto.enabled&&null!=page_settings.plugins.fotomoto.store_id?($(".fotomoto-disabled").hide(),$('input[name="plugins.fotomoto.enabled_page"]').closest("fieldset").toggleClass("is-active",$('input[name="plugins.fotomoto.enabled_page"]').is(":checked"))):$(".fotomoto-disabled").siblings().not(":first").hide()}function B(e){var f=$(".x3-page-settings > .container").offset().top,c=e,a=d.eq(c);$(window).scrollTop()>f?$(".x3-page-settings > .container").velocity("scroll",{duration:500,easing:"easeInOutCubic",complete:function(){b.css("min-height",a.data("height")),d.not(a).filter(":visible").hide(),a.filter(":hidden").show()}}):(b.css("min-height",a.data("height")),d.not(a).filter(":visible").hide(),a.filter(":hidden").show()),setTimeout(function(){b.css("min-height",a.data("height"))},1e3),supports_local_storage()&&localStorage.setItem("x3_settings_page_tab",c)}var f,b,d,h,c,t,e,q,w,k,g,s,m=!1,n=!1,o=!1,a=!1,A='<div class="filter-buttons invisible">\n										<div class="btn-group btn-group-sm" data-toggle="buttons"></div>\n									</div>\n									<form id=json-form></form>\n									<div id="res" class="alert"></div>',z="<a href=# class=show-help></a><div class=hidden>"+x3_help.templates+"</div>",j={},i={},p={},y=custom_setting_templates?0:1;$.getJSON("setting-templates.json",function(a){p=a,u()}).fail(function(){x3Notifier(language.Error+": Can't load panel/setting-templates.json",null,null,"danger"),console.log("Error: Can't load panel/setting-templates.json")}),custom_setting_templates&&$.ajax({method:"POST",url:"x3_tools.php",dataType:"json",cache:!1,data:{get_templates:!0},success:function(a,b,c){i=a,u()},error:function(b,a,c){x3Notifier(language.Error+" -> textStatus: "+a,null,null,"danger"),console.log("Templates Error: "+a)}}),$.getJSON("settings-page-schema.json",function(a){m=!0,f=a}).fail(function(){console.log("Error: Can't load panel/settings-page-schema.json")}),save_inject=function(a,b,c,d){v(a,!0,b,c,d)},$("body").on("click","button.editor-save",function(a){$(this).closest("#json-form").find(".save-settings").click()}),get_x3_page_settings=function(a,b){if(page_settings=$.extend(!0,{},current_settings,a),console.dir(page_settings),t=b,m&&settings_loaded&&n)l(page_settings);else var c=setInterval(function(){m&&settings_loaded&&n&&(clearInterval(c),"fileManager"==current_nav&&l(page_settings))},1e3)},$("body").on("click",".x3-page-settings .filter-buttons label.btn",function(a){B($(this).index()),1==$(this).index()&&e.codemirror.refresh()}),$("body").on("click",".dropdown-copy-paste a",function(c){c.preventDefault(),"copy-paste-help"!==$(this).data("process")&&(a=$(this).data("process"),b.find('input[type="submit"]').click())})}();var authPage;$(function(){function c(){b.button("loading"),$(".auth-res > div").html('<div><span class="label label-default">...</span></div>'),$.ajax({type:"POST",data:{domain:e,product:3},url:d,dataType:"json",success:function(b){console.dir(b),a(b.status,b.message)}}).fail(function(){a(300,"Can't connect to "+d)}).always(function(){b.button("reset")})}function a(a,b){var c=200==parseInt(a)?"success":"danger",e=200==parseInt(a)?"ok":"remove",b=301==parseInt(a)?"No license found for this domain.":b,d='<span class="label label-'+c+'"><span class="glyphicon glyphicon-'+e+'" aria-hidden="true"></span>'+b+"</span>";301==parseInt(a)&&(d+='<br><a href="https://purchase.flamepix.com/" target=_blank class="btn btn-primary" style="margin-top:1.5em; font-size: 12px;">Purchase X3 License</a>'),$(".auth-res > div").html(d),x3Notifier(b,2e3,null,c),supports_local_storage()&&localStorage.setItem("panel_auth",a+"&&"+b)}var b,d="https://auth.flamepix.com/",e=window.location.hostname;authPage=function(){b=$(".btn-auth");var d=supports_local_storage()&&null!==localStorage.getItem("panel_auth")?localStorage.getItem("panel_auth").split("&&"):!1;d?(console.log("render"),a(d[0],d[1])):(console.log("checkLicense"),c())},$("body").on("click",".x3-auth .btn-auth",function(a){c()}).on("shown.bs.tab",'a[href="#tools-auth"]',function(a){authPage()})});var tools_auth_template="\n	<div class=x3-auth>\n		<h3>Authorize X3<i class='help-icon panel-help pull-right fa fa-question-circle' data-help='authorize'></i></h3>\n		<div class=auth-res>\n			<strong>domain:</strong> "+window.location.hostname+"\n			<div><span class='label label-default'>...</span></div>\n		</div><br>\n		<button type=button class='btn btn-primary btn-auth' data-loading-text='Checking License ...'><span class='glyphicon glyphicon-repeat' aria-hidden=true></span> &nbsp;Re-check</button>\n  </div>";$(function(){function b(a,b){$("#tools-htaccess .alert").remove();var c='<div class="alert alert-'+b+' alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+a+"</div>";$("#tools-htaccess").append(c)}function e(b){c.button("loading"),$.ajax({url:"x3_htaccess.php",method:"POST",dataType:"html",cache:!1,data:{data:a.getValue()}}).done(function(a){"ok"==a?x3Notifier(".htaccess file saved!",2e3,null,"success"):x3Notifier("Can't write to .htaccess file!",2e3,null,"danger")}).fail(function(a,b,c){console.dir(a);var d=b+": "+c;x3Notifier(d,3e3,null,"danger")}).always(function(){setTimeout(function(){c.button("reset")},1e3)})}function f(){$("#htaccess-editor").length<1&&(show_preloader(),$.ajax({url:"x3_htaccess.php",method:"POST",dataType:"html",cache:!1,data:{action:"load"}}).done(function(f){if("nofile"==f){var g="Cannot find .htaccess file in application root!";x3Notifier(g,2e3,null,"danger"),b(g,"danger")}else if("noread"==f){var g=".htaccess file is not readable!";x3Notifier(g,2e3,null,"warning"),b(g,"warning")}else if(f.length<1){var g=".htaccess file seems to be empty!";x3Notifier(g,2e3,null,"warning"),b(g,"warning")}else x3Notifier(".htaccess loaded!",2e3,null,"success"),0==f.indexOf("nowrite")&&(f=f.replace("nowrite",""),b("If this file was writeable, you could save changes directly from the panel.","warning"),d=!1),$("#tools-htaccess").append('<div id="htaccess-editor"></div>'),a=ace.edit("htaccess-editor"),a.setOption("maxLines",1/0),a.setOption("minLines",5),a.setAutoScrollEditorIntoView(!0),a.getSession().setUseWrapMode(!0),a.$blockScrolling=1/0,a.setTheme("ace/theme/tomorrow_night"),a.getSession().setMode("ace/mode/apache_conf"),a.setValue(f,-1),d&&($("#tools-htaccess").append('<button type="button" class="btn btn-primary btn-process btn-save-htaccess" data-loading-text="Saving ...">Save</button>'),c=$("#tools-htaccess > .btn-save-htaccess"),c.on("click",function(a){e()}))}).fail(function(a,c){console.dir(a);var b=a.status+" "+a.statusText;x3Notifier(b,2e3,null,"danger"),$("#htaccess-container").html(b)}).always(function(){hide_preloader()}))}var c,a,d=!0;$("body").on("shown.bs.tab",'a[href="#tools-htaccess"]',function(a){f()})});var tools_htaccess_template="<h3>.htaccess<i class='help-icon panel-help pull-right fa fa-question-circle' data-help='htaccess'></i></h3>",showTools;$(function(){var b=["flamepix.com","imagevuex.com","localhost","127.0.0.1"],a=window.location.hostname,c=-1==$.inArray(a,b)&&-1==a.indexOf("flamepix.com");showTools=function(){setMenuActive("#tools"),$("#content_show").html(d);var a=supports_local_storage()&&null!==localStorage.getItem("panel_tools_tab")?localStorage.getItem("panel_tools_tab"):"tools-auth";$('.x3-tools a[href="#'+a+'"]').tab("show"),$("#content_show").velocity("fadeIn",{duration:500}),"tools-auth"===a&&authPage()},$(".container").on("click","#tools",function(a){a.preventDefault(),showTools()}).on("shown.bs.tab",'.x3-tools [data-toggle="tab"]',function(a){supports_local_storage()&&localStorage.setItem("panel_tools_tab",String(a.target).split("#")[1])}),auth_tab=c?"<li role=presentation id=tab-tools-auth class=active><a href=#tools-auth aria-controls=tools-auth role=tab data-toggle=tab>Authorize</a></li>":"";var d="\n	<div class=x3-tools>\n		<div>\n    <ul class='nav nav-tabs' role='tablist'>\n    	"+auth_tab+"\n    	<li role=presentation id=tab-tools-htaccess><a href=#tools-htaccess aria-controls=tools-htaccess role=tab data-toggle=tab>Htaccess</a></li>\n    	<li role=presentation id=tab-tools-phpinfo class=flamepix-hidden><a href=#tools-phpinfo aria-controls=tools-phpinfo role=tab data-toggle=tab>PHPinfo</a></li>\n	    <li role=presentation><a href=#tools-site aria-controls=tools-site role=tab data-toggle=tab>Preload</a></li>\n	    <li role=presentation><a href=#tools-reset aria-controls=tools-reset role=tab data-toggle=tab>Reset</a></li>\n	    <li role=presentation id=tab-tools-touch><a href=#tools-touch aria-controls=tools-touch role=tab data-toggle=tab>Cache</a></li>\n	    <li role=presentation id=tab-tools-previews><a href=#tools-previews aria-controls=tools-previews role=tab data-toggle=tab>Previews</a></li>\n    </ul>\n    </div>\n    <div id=myTabContent class=tab-content>\n      <div role=tabpanel class='tab-pane fade tools-mini active in' id=tools-auth>"+tools_auth_template+"</div>\n      <div role=tabpanel class='tab-pane fade' id=tools-htaccess>"+tools_htaccess_template+"</div>\n      <div role=tabpanel class='tab-pane fade flamepix-hidden' id=tools-phpinfo>"+tools_phpinfo_template+"</div>\n      <div role=tabpanel class='tab-pane fade tools-mini' id=tools-site>"+tools_site_template+"</div>\n      <div role=tabpanel class='tab-pane fade tools-mini' id=tools-reset>"+tools_reset_template+"</div>\n      <div role=tabpanel class='tab-pane fade tools-mini' id=tools-touch>"+tools_touch_template+"</div>\n      <div role=tabpanel class='tab-pane fade' id=tools-previews>"+tools_previews_template+"</div>\n    </div>\n  </div>"}),$(function(){function a(){show_preloader(),$.ajax({url:"x3_tools.php",method:"POST",dataType:"html",cache:!1,data:{phpinfo:!0}}).done(function(a){if(a.length<1){var b="phpinfo() seems to be empty :(";x3Notifier(b,2e3,null,"warning")}else x3Notifier("phpinfo loaded!",2e3,null,"success"),$("#myphpinfo").html(a)}).fail(function(a,c){console.dir(a);var b=a.status+" "+a.statusText;x3Notifier(b,2e3,null,"danger"),$("#htaccess-container").html(b)}).always(function(){hide_preloader()})}$("body").on("shown.bs.tab",'a[href="#tools-phpinfo"]',function(b){a()})});var tools_phpinfo_template="<div id=myphpinfo></div>";$(function(){function a(){if(current_settings.settings.diagnostics)x3Notifier("You cannot create site object while diagnostics are enabled.",3e3,null,"warning");else if(current_settings.settings.preload){var a=$(".btn-preload");original_text=a.text(),date1=new Date,a.attr("disabled",!0).text("Creating site object ..."),$.ajax({method:"POST",url:"x3_tools.php",dataType:"json",data:{site_object:!0}}).done(function(a){if(a.success){var b=new Date,c=Number(b)-Number(date1),d="Site object created in "+(c/1e3).toFixed(2)+" seconds.";x3Notifier(d,2e3,null,"success")}else void 0!==a.error?x3Notifier(a.error,2e3,null,"danger"):x3Notifier("Error",2e3,null,"danger")}).fail(function(a,b,c){console.dir(a);var d=b+": "+c;x3Notifier(d,2e3,null,"danger")}).always(function(){a.text(original_text).attr("disabled",!1)})}else x3Notifier("This feature requires you to have Preload Site Object enabled in main settings.",3e3,null,"warning")}$(".container").on("click",".btn-preload",function(b){a()})});var tools_site_template="<h3>Preload Site Object <i class='help-icon panel-help pull-right fa fa-question-circle' data-help='preload'></i></h3><p class=boxed>Click the button below to refresh the site object, required if you are using the <em>preload</em> option in settings. <strong><a href=# class=show-help data-hidden='.preload_help'>More Info [?]</a></strong></p><p><em>*Depending on the amount of folders and the speed of your server, this process could take up to 60 seconds or even fail.</em></p><button type=button class='btn btn-primary btn-process btn-preload' data-loading-text='Creating Site Object ...'>Create site object</button>";$(function(){function b(){$("#tools-previews").find(".previews-log").remove();var b=$(".btn-previews"),c=b.text();b.attr("disabled",!0).text("Updating ..."),$.ajax({method:"POST",url:"x3_previews.php",dataType:"html"}).done(function(b){x3Notifier("Previews updated",2e3,null,"success"),a="<div class=previews-log>"+b+"</div>",$("#tools-previews").append(a)}).fail(function(a,b,c){console.dir(a);var d=b+": "+c;x3Notifier(d,2e3,null,"danger")}).always(function(){setTimeout(function(){b.attr("disabled",!1).text(c)},1e3)})}var a="";$(".container").on("click",".btn-previews",function(a){b()}).on("shown.bs.tab",'a[href="#tools-previews"]',function(b){a&&$(".previews-log table").length<1&&$("#tools-previews").append(a),$("li#refresh").is(":visible")&&$("#tools-previews .boxed").children(".remember").length<1&&$("#tools-previews .boxed").append("<em class=remember><br><br>* Remember to refresh menu after update, if there are changes.<em>")})});var tools_previews_template="<h3>Update Preview Images<i class='help-icon panel-help pull-right fa fa-question-circle' data-help='previews'></i></h3><p class=boxed>This tool will try to automatically set preview images for your pages, unless they are already set correctly.</p><button type=button class='btn btn-primary btn-process btn-previews' data-setting-text='Updating ...'>Update Preview Images</button>";
  $(function(){function b(){a=$(".btn-reset"),a.button("loading"),$.ajax({method:"POST",url:"x3_tools.php",dataType:"json",data:{reset_settings:!0}}).done(function(a){"already"==a.success?x3Notifier("Settings are already deleted",2e3,null,"primary"):a.success?(x3Notifier("Settings Successfully Reset. Logging out ...",2e3,null,"success"),setTimeout(function(){location.replace("logout.php")},2e3)):void 0!==a.error?x3Notifier(a.error,2e3,null,"danger"):x3Notifier("Error",2e3,null,"danger")}).fail(function(a,b,c){console.dir(a);var d=b+": "+c;x3Notifier(d,2e3,null,"danger")}).always(function(){setTimeout(function(){a.button("reset")},1e3)})}var a;$(".container").on("click",".btn-reset",function(c){var a=confirm("Are you sure you want to reset all settings to default?");a&&b()})});var tools_reset_template="<h3>Reset Settings<i class='help-icon panel-help pull-right fa fa-question-circle' data-help='reset'></i></h3><p class=boxed>Click below button to reset settings to default. The reset includes username and password, so you will automatically be logged out after reset.</p><p><em>*Reset will not affect your individual page settings.</em></p><button type=button class='btn btn-primary btn-process btn-reset' data-loading-text='Resetting settings to default ...'>Reset Settings</button>";$(function(){function a(){btn=$(".btn-touch"),btn.attr("disabled",!0).button("invalidating"),$.ajax({method:"POST",url:"x3_tools.php",dataType:"json",data:{touch:!0}}).done(function(a){a.success?x3Notifier(a.success,2e3,null,"success"):void 0!==a.warning?x3Notifier(a.warning,2e3,null,"warning"):void 0!==a.error?x3Notifier(a.error,2e3,null,"danger"):x3Notifier("Error",2e3,null,"danger")}).fail(function(a,b,c){console.dir(a);var d=b+": "+c;x3Notifier(d,2e3,null,"danger")}).always(function(){setTimeout(function(){btn.attr("disabled",!1).button("reset")},1e3)})}$(".container").on("click",".btn-touch",function(b){a()})});var tools_touch_template="<h3>Clear Page Cache</h3><p class=boxed>This tool allows you to clear the X3 page cache, so that new pages are always created. This process is not necessary, because pages are <em>always</em> recreated if you make any changes from the panel. It may however be useful if you are making changes by FTP, or if you simply want to clear all page cache files as part of maintenance.</p><button type=button class='btn btn-primary btn-process btn-touch' data-invalidating-text='Clearing ...'>Clear Page Cache</button>",thumbsize=window.devicePixelRatio>1?"200":"100",x3Uploader;$(function(){function f(b){c+=b,c>0&&!a.hasClass("hasqueue")?a.addClass("hasqueue"):1>c&&a.hasClass("hasqueue")&&a.removeClass("hasqueue"),a.find(".queue-text").text(c+" files in upload queue.")}function h(){var a={disableImageResize:!d.is(":checked")||!i,imageMaxWidth:Number(b.find("#resize-width").val()),imageMaxHeight:Number(b.find("#resize-height").val()),imageQuality:Number(b.find("#resize-quality").val())/100};x3UpdateSettings(a),$("#fileupload").fileupload("option",a)}var a,g,d,b,c,e=window.devicePixelRatio>1?2:1,i=!/Android(?!.*Chrome)|Opera/.test(window.navigator&&navigator.userAgent);x3Uploader=function(k){a=$(".modal#uploader"),g=a.find(".resize-options"),d=g.find(".resize-toggle input"),b=g.find(".resize-inputs"),c=0;var j={disableImageResize:Boolean(x3_settings.disableImageResize)||!Boolean(k.img_resize)||!i,imageMaxWidth:Number(x3_settings.imageMaxWidth||k.img_resize_width),imageMaxHeight:Number(x3_settings.imageMaxHeight||k.img_resize_height),imageQuality:Number(x3_settings.imageQuality||Number(k.img_resize_quality)/100)};d.prop("checked",!j.disableImageResize).parent("label").toggleClass("active",!j.disableImageResize),b.toggle(!j.disableImageResize),b.find("#resize-width").val(j.imageMaxWidth),b.find("#resize-height").val(j.imageMaxHeight),b.find("#resize-quality").val(100*j.imageQuality),a.removeClass("hasqueue isuploaded"),b.on("change","input",function(a){h()}),d.change(function(){setTimeout(function(){var a=d.is(":checked");b.toggle(a),h()},10)}),a.find('.resize-options input[type="number"]').on("input",function(b){var a=Number($(this).attr("maxlength"));this.value.length>a&&(this.value=this.value.slice(0,a))}).on("blur",function(a){0==this.value.length?this.value=$(this).attr("placeholder"):Number(this.value)<parseInt($(this).attr("min"))?this.value=$(this).attr("min"):Number(this.value)>parseInt($(this).attr("max"))&&(this.value=$(this).attr("max")),this.value=Number(this.value)}).numericInput(),a.find("button.view").click(function(b){a.find(".modal-footer > button").click()}),$("#fileupload").fileupload({dropZone:$("#dropzone"),url:k.path,disableImageResize:j.disableImageResize,imageMaxWidth:j.imageMaxWidth,imageMaxHeight:j.imageMaxHeight,imageQuality:j.imageQuality,loadImageMaxFileSize:4e7,disableVideoPreview:!0,previewMaxWidth:100*e,previewMaxHeight:50*e,previewMinWidth:100*e,previewMinHeight:50*e,acceptFileTypes:k.acceptFileTypes}).bind("fileuploadadded",function(c,b){a.hasClass("isuploaded")&&a.find("tr.template-download").length>0&&a.find("tr.template-download").remove(),b.files.error!==!0&&f(1)}).bind("fileuploadfailed",function(b,a){a.files.error!==!0&&f(-1)}).bind("fileuploadstart",function(b){a.addClass("isuploading")}).bind("fileuploadstop",function(b){a.removeClass("isuploading").addClass("isuploaded"),c=0,f(0)})}});