<NME> bolt.js
<BEF> /**
 * These are Bolt’s COMPILED JS files!
 * Do not edit this file, because all changes will be lost. You can edit the 
 * `*.js` files in `app/src/js/` and then run `yarn grunt updateBolt` to generate 
 * this file. You will need to use the "Clone the Git Repository" installation method, to 
 * get these files. See: https://docs.bolt.cm/core-development/install-git-clone, 
 * as well as the `README.md` file in the `app/src/` folder.
 */
String.prototype.subst=function(t){"use strict";return this.replace(/%[A-Z][A-Z0-9_]+%/g,function(e){return e in t?t[e]:e})};var init={depublishTracking:function(){"use strict";var i="dateDepublishNotice",n=$("#datedepublish").data("notice");$("#datedepublish, #statusselect").on("change",function(){var e=$("#statusselect").val(),t=$("#datedepublish").val();$("."+i).remove(),""!==t&&"published"===e&&moment(t+Bolt.conf("timezone.offset"))<moment()&&$('<div class="'+i+' alert alert-warning alert-dismissible"><button type="button" class="close" data-dismiss="alert">×</button>'+n+"</div>").hide().insertAfter(".depublish-group").slideDown("fast")}),$("#datedepublish").trigger("change")},bindEditFile:function(e){"use strict";var n,t;"undefined"!=typeof CodeMirror&&(n=CodeMirror.fromTextArea(document.getElementById("file_edit_contents"),{lineNumbers:!0,autofocus:!0,foldGutter:{rangeFinder:CodeMirror.fold.indent},gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],extraKeys:{"Ctrl-Q":function(e){e.foldCode(e.getCursor(),{rangeFinder:CodeMirror.fold.indent,minFoldSize:3})},Tab:function(e){e.somethingSelected()?e.indentSelection("add"):e.replaceSelection(e.getOption("indentWithTabs")?"\t":Array(e.getOption("indentUnit")+1).join(" "),"end","+input")},"Ctrl-S":function(){$("#file_edit_save").click()},"Ctrl-H":"replaceAll"},tabSize:4,indentUnit:4,indentWithTabs:!1,readOnly:e.readonly}),(t=$(window).height()-312)<200&&(t=200),n.setSize(null,t)),$("#file_edit_save").on("click",function(e){Bolt.events.fire("Bolt.File.Save.Start"),e.preventDefault(),n&&n.save();$("#file_edit_save").addClass("disabled"),$("#file_edit_save i").addClass("fa-spin fa-spinner"),$("p.lastsaved").text(Bolt.data("editcontent.msg.saving"));var t=$(e.target),i=$('form[name="file_edit"]').serialize()+"&"+encodeURI(t.attr("name"))+"="+encodeURI(t.attr("value"));$.post("?returnto=ajax",i).done(function(e){e.ok?Bolt.events.fire("Bolt.File.Save.Done",e):(alert(e.msg),Bolt.events.fire("Bolt.File.Save.Fail",e)),$("p.lastsaved").html(e.msg)}).fail(function(){Bolt.events.fire("Bolt.File.Save.Fail"),alert("Not saved")}).always(function(){Bolt.events.fire("Bolt.File.Save.Always"),window.setTimeout(function(){$("#file_edit_save").removeClass("disabled").blur(),$("#file_edit_save i").removeClass("fa-spin fa-spinner")},300)})})},bindEditLocale:function(e){"use strict";CodeMirror.fromTextArea(document.getElementById("file_edit_contents"),{lineNumbers:!0,autofocus:!0,tabSize:4,indentUnit:4,indentWithTabs:!1,readOnly:e.readonly}).setSize(null,$(window).height()-276)},bindFileBrowser:function(){"use strict";$("#myTab a").click(function(e){e.preventDefault(),$(this).tab("show")});var e,t,i=(e=new RegExp("(?:[?&]|&)"+"CKEditorFuncNum"+"=([^&]+)","i"),(t=window.location.search.match(e))&&1<t.length?t[1]:null);$("a.filebrowserCallbackLink").bind("click",function(e){e.preventDefault();var t=$(this).attr("href");window.opener.CKEDITOR.tools.callFunction(i,t),window.close()}),$("a.filebrowserCloseLink").bind("click",function(){window.close()})},bindCkFileSelect:function(){"use strict";var e,t,i=(e=new RegExp("(?:[?&]|&)"+"CKEditorFuncNum"+"=([^&]+)","i"),(t=window.location.search.match(e))&&1<t.length?t[1]:null);$("a.filebrowserCallbackLink").bind("click",function(e){e.preventDefault();var t=$(this).attr("href");window.opener.CKEDITOR.tools.callFunction(i,t),window.close()})},bindPrefill:function(){"use strict";var e=$("#form_contenttypes").find(":checkbox");$("#prefill_check_all").on("click",function(){e.removeAttr("checked").trigger("click")}),$("#prefill_uncheck_all").on("click",function(){e.removeAttr("checked")})},confirmationDialogs:function(){"use strict";$(".confirm").on("click",function(){return confirm($(this).data("confirm"))})},dropDowns:function(){"use strict";$('[data-toggle="dropdown"]').each(function(e,t){var a;"undefined"==typeof event?$(t).parent().click(function(e){a=e}):a=event,$(t).parent().on("show.bs.dropdown",function(){var e,t,i,n;null!=a&&(e=$(this).find('[data-toggle="dropdown"]').next(".dropdown-menu"),t=a.pageY+20,i=e.height(),n=$(window).height()-t+i,20<t-i&&n<37&&e.css({top:"auto",bottom:"100%"}))})})},dropZone:function(){"use strict";$(document).bind("dragover",function(e){var t=$(".elm-dropzone"),i=window.dropZoneTimeout;i?clearTimeout(i):t.addClass("in"),e.target===t[0]?t.addClass("hover"):t.removeClass("hover"),window.dropZoneTimeout=setTimeout(function(){window.dropZoneTimeout=null,t.removeClass("in hover")},100)})},magnificPopup:function(){"use strict";$(".magnific, .fancybox").magnificPopup({type:"image",gallery:{enabled:!0},disableOn:400,closeBtnInside:!0,enableEscapeKey:!0,mainClass:"mfp-with-zoom",zoom:{enabled:!0,duration:300,easing:"ease-in-out",opener:function(e){return e.parent().parent().find("img")}}})},focusStatusSelect:function(){"use strict";$("#lastsavedstatus").click(function(e){e.preventDefault(),$('a[href="#tab-meta"]').click(),$("#statusselect").focus()})},passwordInput:function(){"use strict";$(".togglepass").on("click",function(){$(this).hasClass("show-password")?($('input[name="user_login[password]"]').attr("type","text"),$(".togglepass.show-password").hide(),$(".togglepass.hide-password").show()):($('input[name="user_login[password]"]').attr("type","password"),$(".togglepass.show-password").show(),$(".togglepass.hide-password").hide())}),$(".login-forgot").bind("click",function(){$(".login-group, .password-group").hide(),$("#user_login_password").attr("required",!1),$(".reset-group").show()}),$(".login-remembered").bind("click",function(){$(".login-group, .password-group").show(),$("#user_login_password").attr("required",!0),$(".reset-group").hide()})},popOvers:function(){"use strict";$(".info-pop").popover({trigger:"hover",delay:{show:500,hide:200}})},sortables:function(){"use strict";$("tbody.sortable").sortable({items:"tr",opacity:"0.5",axis:"y",handle:".sorthandle",update:function(){var e=$(this).sortable("serialize");$.ajax({url:$("#baseurl").attr("value")+"content/sortcontent/"+$(this).parent("table").data("contenttype"),type:"POST",data:e,success:function(){}})}})}},Bolt={};!function(bolt,$){"use strict";var actions={init:function(){$("button, input[type=button], a").off("click.action"),$("[data-action]").on("click.action",function(e){var action=$(this).attr("data-action");void 0!==action&&""!==action&&(e.preventDefault(),eval(action),e.stopPropagation())}).on("click.popover",".popover",function(e){e.stopPropagation()}),$(".clickspinner").on("click.spinner",function(){$(this).addClass("disabled").blur(),$(this).find("i").addClass("fa-spin fa-spinner"),window.setTimeout(function(e){$(e).removeClass("disabled"),$(e).find("i").removeClass("fa-spin fa-spinner")},1e4,this)}),$(".submitspinner").on("submit.spinner",function(){$(this).find("button[type=submit]").addClass("disabled").blur(),$(this).find("button[type=submit] i").addClass("fa-spin fa-spinner"),window.setTimeout(function(e){$(e).removeClass("disabled"),$(e).find("i").removeClass("fa-spin fa-spinner")},1e4,$(this).find("button[type=submit]"))})},submit:function(e,t){$('<input type="hidden" />').attr("name",t.name).val(1).appendTo(e),e.submit()}};bolt.actions=actions}(Bolt||{},jQuery),function(t,n,i,a){"use strict";var o,e={},s=1e4;e.gMapsApiReady=function(){o=!0,t.events.fire("Bolt.GoogleMapsAPI.Load.Done")},e.run=function(){var e;t.conf.init(),t.data.init(),s=t.conf("buid").match(/(\d+)$/)[1],e=t.conf("locale.long"),n.fn.select2.defaults.set("language",e.replace("_","-")),i.locale(e),n.datepicker.setDefaults(n.datepicker.regional[e]),t.events.on("Bolt.GoogleMapsAPI.Load.Request",function(){var e;void 0===o?(o=!1,e="https://maps.google.com/maps/api/js?sensor=false&callback=Bolt.app.gMapsApiReady",Bolt.conf.get("google_api_key")&&(e=e+"&key="+Bolt.conf.get("google_api_key")),n.getScript(e).fail(function(){o=void 0,t.events.fire("Bolt.GoogleMapsAPI.Load.Fail")})):!0===o&&t.events.fire("Bolt.GoogleMapsAPI.Load.Done")}),t.actions.init(),t.secmenu.init(),t.stack.init(),t.omnisearch.init(),t.extend.init(),t.filemanager.init(),t.ckeditor.init(),t.datetime.init(),a.confirmationDialogs(),a.magnificPopup(),a.dropZone(),a.popOvers(),a.dropDowns(),a.passwordInput(),a.sortables(),a.focusStatusSelect(),a.depublishTracking(),n("[data-bind]").each(function(){var e=n(this).data("bind");switch(e.bind){case"editcontent":t.editcontent.init(e);break;case"editfile":a.bindEditFile(e);break;case"editlocale":a.bindEditLocale(e);break;case"filebrowser":a.bindFileBrowser();break;case"ckfileselect":a.bindCkFileSelect();break;case"prefill":a.bindPrefill()}}),t.app.initWidgets()},e.buid=function(){return"buid-"+s++},e.initWidgets=function(e){void 0===e&&(e=n(document.documentElement)),n("[data-bolt-widget]",e).each(function(){var i=n(this),e=i.data("bolt-widget"),t={};"string"==typeof e?t[e]={}:t=e,n.each(t,function(e,t){i[e](t).removeAttr("data-bolt-widget").removeData("bolt-widget")})})},n(document).ready(e.run),t.app=e}(Bolt||{},jQuery,moment,init),function(a,o,t){"use strict";var e={};function s(){var e,t=[];for(var i in arguments){1!==arguments[i].length&&!arguments[i][0]||("string"==typeof(e=arguments[i][arguments[i].length-1])&&"|"===e.substr(0,1)&&(e=e.substr(1),t=t.concat("-")),t=t.concat(e))}return t}e.init=function(){t=t&&e.initcke(t)},e.update=function(){if(t)for(var e in t.instances)t.instances.hasOwnProperty(e)&&t.instances[e].updateElement()},e.add=function(e){t&&t.replace(e)},e.initcke=function(e){return e.editorConfig=function(e){var t,i=o(this.element.$).data("param")||{},n=a.conf("ckeditor");for(t in e.language=a.conf("ckeditor.lang"),e.skin="moono-lisa",e.resize_enabled=!0,e.entities=!1,e.fillEmptyBlocks=!1,e.extraPlugins+=(e.extraPlugins?",":"")+"codemirror,abbr",e.baseFloatZIndex=100015,e.toolbar=s([{name:"clipboard",items:s([n.clipboard,"Undo"],[n.clipboard,"Redo"],[n.copypaste,"Cut"],[n.copypaste,"Copy"],[n.copypaste,"Paste"],[n.copypaste,"PasteFromWord"],[n.copypaste,"PasteText"])}],[{name:"styles",items:s(["Format"],[n.styles,"Styles"])}],[{name:"basicstyles",items:s(["Bold"],["Italic"],[n.underline,"Underline"],[n.strike,"Strike"])}],[{name:"paragraph",items:s(["NumberedList"],["BulletedList"],["Indent"],["Outdent"],[n.blockquote,"|Blockquote"])}],[{name:"links",items:s(["Link"],["Unlink"],[n.anchor,"|Anchor"],[n.abbr,"|Abbr"])}],[n.subsuper,{name:"subsuper",items:s(["Subscript"],["Superscript"])}],[n.images,{name:"image",items:s(["Image"])}],[n.embed,{name:"embed",items:s(["oembed"])}],[n.tables,{name:"table",items:s(["Table"])}],[n.ruler,{name:"ruler",items:s(["HorizontalRule"])}],[n.align,{name:"align",items:s(["JustifyLeft"],["JustifyCenter"],["JustifyRight"],["JustifyBlock"])}],[n.fontcolor,{name:"colors",items:s(["TextColor"],["BGColor"])}],[n.codesnippet,{name:"code",items:s(["|CodeSnippet"])}],[{name:"tools",items:s(["RemoveFormat"],["Maximize"],["|Source"],[n.specialchar,"|SpecialChar"])}]),n.embed&&(e.extraPlugins+=",oembed,widget",e.oembed_maxWidth="853",e.oembed_maxHeight="480"),e.height=250,e.autoGrow_onStartup=!0,e.autoGrow_minHeight=150,e.autoGrow_maxHeight=400,e.autoGrow_bottomSpace=24,e.removePlugins="elementspath",e.resize_dir="vertical",n.filebrowser?(n.filebrowser.browseUrl&&(e.filebrowserBrowseUrl=n.filebrowser.browseUrl),n.filebrowser.imageBrowseUrl&&(e.filebrowserImageBrowseUrl=n.filebrowser.imageBrowseUrl),n.filebrowser.uploadUrl&&(e.filebrowserUploadUrl=n.filebrowser.uploadUrl),n.filebrowser.imageUploadUrl&&(e.filebrowserImageUploadUrl=n.filebrowser.imageUploadUrl)):(e.filebrowserBrowseUrl="",e.filebrowserImageBrowseUrl="",e.filebrowserUploadUrl="",e.filebrowserImageUploadUrl=""),e.codemirror={theme:"default",lineNumbers:!0,lineWrapping:!0,matchBrackets:!0,autoCloseTags:!0,autoCloseBrackets:!0,enableSearchTools:!0,enableCodeFolding:!0,enableCodeFormatting:!0,autoFormatOnStart:!1,autoFormatOnUncomment:!1,autoFormatOnModeChange:!1,highlightActiveLine:!0,highlightMatches:!0,showFormatButton:!1,showCommentButton:!1,showUncommentButton:!1},n.ck)n.ck.hasOwnProperty(t)&&(e[t]=n.ck[t]);for(t in i.height&&(e.height=parseInt(i.height),e.autoGrow_minHeight=Math.max(e.autoGrow_minHeight,e.height),e.autoGrow_maxHeight=Math.max(e.autoGrow_maxHeight,e.height)),i.ckeditor)i.ckeditor.hasOwnProperty(t)&&(e[t]=i.ckeditor[t])},a.conf("ckeditor").ck.allowNbsp&&e.on("instanceReady",function(e){e.editor.on("paste",function(e){e.data.dataValue=e.data.dataValue.replace(/&nbsp;/g," "),e.data.dataValue=e.data.dataValue.replace(/<p> <\/p>/g,"")},null,null,9)}),e},a.ckeditor=e}(Bolt||{},jQuery,"undefined"!=typeof CKEDITOR?CKEDITOR:void 0),function(e,t){"use strict";function i(e){for(var t=e.split("."),i=a,n=0;n<t.length;n++){if(void 0===i[t[n]])return;i=i[t[n]]}return i}var a={};(i.get=i).init=function(){a=t("script[data-config]").first().data("config")},e.conf=i}(Bolt||{},jQuery),function(e,t){"use strict";function i(e,t){for(var i=e.split("."),n=o,a=0;a<i.length;a++){if(void 0===n[i[a]])return;n=n[i[a]]}return t&&"string"==typeof n?n.subst(t):n}var o={};(i.get=i).init=function(){o=t("script[data-jsdata]").first().data("jsdata")||{}},e.data=i}(Bolt||{},jQuery),function(e,l,c){"use strict";var r,t={},a=[];function o(e){var t,i,n,a,o="",s="";"datedepublish"===e.data.attr("id")&&"1900-01-01 00:00:00"===e.data.val()&&e.data.val(""),(i=e.data.val().match(/^(\d{4}-\d{2}-\d{2})(?: (\d{2}:\d{2}:\d{2}))?$/))&&(o=i[1],s=i[2]||""),n=""===o||"0000-00-00"===o?"":l.datepicker.parseDate("yy-mm-dd",o),e.date.datepicker("setDate",n),e.time.exists&&"0000-00-00"!==o&&(s=""===s?""!==o?"00:00":"":r?e.data.val().slice(11,16):(a=(t=parseInt(s.slice(0,2)))<12?" AM":" PM",(t%12||12)+s.slice(2,5)+a),e.time.val(s)),e.data.trigger("change")}function s(e){var t,i,n,a,o,s,l=c(e.date.datepicker("getDate")),r=c([2001,11,24]),d=!1;e.time.exists&&(n="([0-5]?[0-9])",a=new RegExp("^(?:(?:([01]?[0-9]|2[0-3]))[:,.]([0-5]?[0-9])|(1[012]|0?[1-9])[:,.]([0-5]?[0-9])(?:\\s*([AP])[. ]?M\\.?))$"),(o=e.time.val().trim().toUpperCase().match(a))&&(t=parseInt(o[1]?o[1]:o[3]),i=parseInt(o[2]?o[2]:o[4]),"P"===o[5]&&12!==t?t+=12:"A"===o[5]&&12===t&&(t-=12),r=c([2001,11,24,t,i]),d=!0)),l.isValid()?(s=e.time.exists?" "+r.format("HH:mm:00"):"",e.data.val(l.format("YYYY-MM-DD")+s)):d?e.data.val(c().format("YYYY-MM-DD")+" "+r.format("HH:mm:00")):e.data.val("")}t.update=function(){for(var e in a)a.hasOwnProperty(e)&&o(a[e])},t.init=function(){r=!c.localeData()._longDateFormat.LT.replace(/\[.+?\]/gi,"").match(/A/),l("input.datetime").each(function(){var e,t,i,n=(e=l(this),t=e.closest(".datetime-container"),(i={}).data=e,i.date=t.find("input.datepicker"),i.time=t.find("input.timepicker"),i.show=t.find("button.btn-tertiary"),i.clear=t.find("button.btn-default"),i.time.exists=0<i.time.length,i);a.push(n),function(e){var t=e.date.data("field-options"),i={showOn:"none"};for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);e.date.datepicker(i),e.show.click(function(){e.date.datepicker("show")}),e.clear.click(function(){e.data.val(""),o(e)})}(n),o(n),n.date.change(function(){s(n),o(n)}),n.time.change(function(){s(n),o(n)})})},e.datetime=t}(Bolt||{},jQuery,moment),function(r,d,c,u,o,p){"use strict";var e={};function i(e){var t;return e.name&&(t=d(e).val(),"select-multiple"===e.type&&(t=JSON.stringify(t))),t}function f(){d('form[name="content_edit"]').find("input, textarea, select").each(function(){var e;"textarea"===this.type&&d(this).hasClass("ckeditor")?p.instances[this.id].checkDirty()&&(p.instances[this.id].updateElement(),p.instances[this.id].resetDirty()):void 0!==(e=i(this))&&d(this).data("watch",e)}),c.onbeforeunload=function(){if(t=0,d('form[name="content_edit"]').find("input, textarea, select").each(function(){var e;"content_edit[save]"!==d(this).attr("name")&&("textarea"===this.type&&d(this).hasClass("ckeditor")?p.instances[this.id].checkDirty()&&t++:void 0!==(e=i(this))&&d(this).data("watch")!==e&&t++)}),0<t||r.liveEditor.active)return r.data("editcontent.msg.change_quit");var t}}function s(){c.onbeforeunload=null}function h(){d("#sidebar_save, #content_edit_save, #live_editor_save").addClass("disabled"),d("#sidebar_save i, #content_edit_save i").addClass("fa-spin fa-spinner"),d("p.lastsaved").text(r.data("editcontent.msg.saving"))}e.init=function(e){var t,l,i,n,a;(t=d('form[name="content_edit"]')).attr("novalidate","novalidate").on("submit",function(e){var t=r.validation.run(this);if(d(this).data("valid",t),!t)return e.preventDefault(),!1}),t.on("boltvalidate",function(){var e=r.validation.run(this);return d(this).data("valid",e),e}),l=e,d("#sidebar_save").bind("click",function(){d("#content_edit_save").trigger("click")}),d("#content_edit_save").bind("click",function(e){e.preventDefault();var n=d('form[name="content_edit"]');if(n.trigger("boltvalidate"),!n.data("valid"))return!1;var t,i,a=l.newRecord,o=l.savedon,s=l.msgNotSaved;h(),a?(f(),r.liveEditor.active&&r.liveEditor.stop(),l.duplicate&&(c.onbeforeunload=null),r.actions.submit(n,this)):(f(),r.events.fire("Bolt.Content.Save.Start"),t=d(e.target),i=n.serialize()+"&"+encodeURI(t.attr("name"))+"="+encodeURI(t.attr("value")),d.post("",i).done(function(t){r.events.fire("Bolt.Content.Save.Done",{form:t}),c.onbeforeunload=null,d("p.lastsaved").removeClass("alert alert-danger").html(o).find("strong").text(u(t.datechanged).format("MMM D, HH:mm")).end().find(".buic-moment").buicMoment().buicMoment("set",t.datechanged);var e=d("#statusselect").find("option:selected");d("a#lastsavedstatus strong").html('<i class="fa fa-circle status-'+e.val()+'"></i> '+e.text()),d("#sidebar_save i, #content_edit_save i").removeClass("fa-flag fa-spin fa-spinner fa-exclamation-triangle").addClass("fa-check"),"object"===d.type(t)&&(d.each(t,function(i,e){var t;"object"===d.type(e)?d.each(e,function(e,t){d(':input[name="'+i+"["+e+']"]').val(t)}):"array"===d.type(e)||("checkbox"===(t=d(n.name).find("[name="+i+"]")).attr("type")?t.prop("checked","1"===e):t.val(e),p&&p.instances[i]&&p.instances[i].setData(e,{callback:function(){this.resetDirty()}}))}),d("a[data-href-placeholder]").each(function(){var e=d(this).data("href-placeholder").replace("__replaceme",t.slug);d(this).attr("href",e)})),r.datetime.update(),f()}).fail(function(e){r.events.fire("Bolt.Content.Save.Fail");var t=d.parseJSON(e.responseText),i="<b>"+s+"</b><br><small>"+t.error.message+"</small>";d("p.lastsaved").html(i).addClass("alert alert-danger"),d("#sidebar_save i, #content_edit_save i").removeClass("fa-flag fa-spin fa-spinner").addClass("fa-exclamation-triangle")}).always(function(){r.events.fire("Bolt.Content.Save.Always"),c.setTimeout(function(){d("#sidebar_save, #content_edit_save, #live_editor_save").removeClass("disabled").blur()},1e3),c.setTimeout(function(){d("#sidebar_save i, #content_edit_save i").addClass("fa-flag")},5e3)}))}),d("#sidebar_save_return").bind("click",function(){d("#content_edit_save_return").trigger("click")}),d("#content_edit_save_return").bind("click",function(){h(),s()}),d("#sidebar_save_create").bind("click",function(){d("#content_edit_save_create").trigger("click")}),d("#content_edit_save_create").bind("click",function(){h(),s(),r.actions.submit(d('form[name="content_edit"]'),this)}),(i=d('form[name="content_edit"]')).find("#sidebar_preview").attr("disabled",!1),i.find("#content_edit_preview").attr("disabled",!1),d("#sidebar_preview").bind("click",function(){d("#content_edit_preview").trigger("click")}),d("#content_edit_preview").bind("click",function(e){var t=d(e.target).data("url");e.preventDefault(),i.attr("action",t).attr("target","_blank").submit(),i.attr("action","").attr("target","_self")}),d("#sidebar_delete").bind("click",function(){d("#content_edit_delete").trigger("click")}),d("#content_edit_delete").bind("click",function(e){e.preventDefault();var i=this;o.confirm(r.data("editcontent.delete"),function(e){var t;d(".alert").alert(),!0===e&&(t=d('form[name="content_edit"]'),c.onbeforeunload=null,r.actions.submit(t,i))})}),n=c.location.hash,a=d("#filtertabs"),n&&a.find('a[href="#tab-'+n.replace(/^#/,"")+'"]').tab("show"),a.find("a").click(function(){var e;d(this).tab("show"),e=d("body").scrollTop(),c.location.hash=this.hash.replace(/^#tab-/,""),d("html,body").scrollTop(e)}),r.liveEditor.init(e),c.setTimeout(function(){d("#content_edit_save").is("*")&&(d("body, input").bind("keydown","ctrl+s meta+s",function(e){e.preventDefault(),f(),d("#content_edit_save").trigger("click")}),c.setTimeout(function(){f()},1e3))},1e3)},r.editcontent=e}(Bolt||{},jQuery,window,moment,bootbox,"undefined"!=typeof CKEDITOR?CKEDITOR:void 0),function(I,R){"use strict";var A,t,e={};function D(e){return R(".extend-bolt-container").find(e)}function O(e){var t,i,n="",a="",o="";try{n=R.parseJSON(e.responseText)}catch(e){}void 0===n.error?(o="This was the received response:\n\n<textarea>"+(t=e.responseText,((i=R(t)).find("h1, h2, h3, p").text()||i.text()).trim().replace(/ +/g," ").replace(/\s+\n/g,"\n"))+"</textarea>\n\nInspect the console output in the browser's Debug Inspector for more details.",a=I.data("extend.packages.error",{"%ERROR_TYPE%":"Unknown Error","%ERROR_MESSAGE%":o,"%ERROR_LOCATION%":""}),console.error(e)):a="Bolt\\Exception\\PackageManagerException"===n.error.type?(o=n.error.message.replace(/(<http)/g,'<a href="http').replace(/(\w+>)/g,'">this link</a>'),I.data("extend.packages.error",{"%ERROR_TYPE%":"Composer Error","%ERROR_MESSAGE%":o,"%ERROR_LOCATION%":""})):"Bolt\\Exception\\ExtensionsInfoServiceException"===n.error.type?(o=n.error.message,I.data("extend.packages.error",{"%ERROR_TYPE%":"Extension Site Error","%ERROR_MESSAGE%":o,"%ERROR_LOCATION%":""})):I.data("extend.packages.error",{"%ERROR_TYPE%":"PHP Error","%ERROR_MESSAGE%":n.error.message,"%ERROR_LOCATION%":"File: "+n.error.file+"::"+n.error.line}),R(".modal").modal("hide"),bootbox.alert(a)}function $(){D(".installed-container").each(function(){var n=R(this).find(".installed-list");A=D(".installed-container .console"),R.get(I.data("extend.baseurl")+"installed",function(e){var t,i="";"object"==typeof e?(n.show(),n.find(".installed-list-items").html(""),D(".installed-container .console").hide(),t=!0,"object"==typeof e&&(i+=function(e){var t="";for(var i in e)if(e.hasOwnProperty(i)){var n=e[i],a=I.data("extend.packages"),o=[],s=[],l=0;if(n.authors&&0<n.authors.length)for(l=0;l<n.authors.length;l++)o.push(a.author.subst({"%AUTHOR%":n.authors[l].name}));if(o=o.length?a.authors.subst({"%AUTHORS%":o.join(", ")}):"",n.keywords&&0<n.keywords.length)for(l=0;l<n.keywords.length;l++)s.push(a.keyword.subst({"%KEYWORD%":n.keywords[l]}));s=s.length?a.keywords.subst({"%KEYWORDS%":s.join(" ")}):"","wikimedia/composer-merge-plugin"===n.name&&(n.title="Local Extension Helper");var r="",d={"%NAME%":n.name,"%VERSION%":n.version,"%BASEURL%":I.data("extend.baseurl"),"%MARKETPLACE_URL%":"https://market.bolt.cm/view/"+n.name,"%REPOSITORY_URL%":n.repositoryLink},r="installed"===n.status&&"composer-plugin"!==n.type?a.manage_dropdown_installed.subst(d):a.manage_dropdown_uninstalled.subst(d),c=a.left_buttons.subst({"%README%":null!==n.readmeLink?a.readme_button.subst({"%README%":n.readmeLink}):"","%CONFIG%":null!==n.configLink?a.config_button.subst({"%CONFIG%":n.configLink}):"","%THEME%":"bolt-theme"===n.type?a.theme_button.subst({"%NAME%":n.name}):""});t+=a.item.subst({"%TITLE%":n.title?n.title:n.name,"%NAME%":n.name,"%VERSION%":n.version,"%AUTHORS%":o,"%TYPE%":n.type,"%MANAGE%":r,"%DETAILS%":c,"%BASEURL%":I.data("extend.baseurl"),"%DESCRIPTION%":n.description?a.description.subst({"%DESCRIPTION%":n.description}):"","%KEYWORDS%":s,"%STATUS%":!1===n.valid?" — [INVALID] ":"","%ENABLED%":!1===n.enabled?" — [DISABLED] ":"","%CONSTRAINT%":null!==n.constraint?'<i class="fa fa-cog fa-fw"></i> Requires Bolt '+n.constraint:""})}return t}(e),t=!1),t&&(i=I.data("extend.packages.empty"),A.hide()),n.find(".installed-list-items").append(i)):A.html(I.data("extend.text.bad-json"))}).fail(function(e){O(e)})})}var i,B=(i=0,function(e,t){clearTimeout(i),i=setTimeout(e,t)});function M(e,t,i){var n=D(".update-container");e&&n.find(".update-output-title").html(e),t&&(n.find(".update-output-console").find(".console").html(t),n.find(".update-output-console").show()),i&&n.find(".update-output-notice").html(i).show(),n.show()}function F(e,t){var i=D(".update-container");e&&i.find(".update-output-console").find(".console").html(e).show(),t&&i.find(".update-output-notice").html(t).show()}function o(e){var t,i,n="";for(var a in e)e.hasOwnProperty(a)&&void 0!==(t=e[a])&&(i="approved"===t.buildStatus?" label-success":"",n+=I.data("extend.packages.versions",{"%NAME%":t.name,"%VERSION%":t.version,"%CLASS%%":i,"%BUILDSTATUS%":t.buildStatus}));return n}function U(e){A=D(".update-output"),R.get(I.data("extend.baseurl")+"installInfo?package="+e,function(e){var t=e.dev,i=e.beta,n=e.RC,a=e.stable;D(".dev-version-container .installed-version-item").html(""),0<a.length?(D(".stable-version-container .installed-version-item").html(""),D(".stable-version-container .installed-version-item").append(o(a)),D(".latest-version-container .installed-version-item").html(""),D(".latest-version-container .installed-version-item").append(o([e.stable[0]])),D(".install-latest-container").show()):D(".install-version-container").show(),0<n.length&&D(".dev-version-container .installed-version-item").append(o(n)),0<i.length&&D(".dev-version-container .installed-version-item").append(o(i)),0<t.length&&D(".dev-version-container .installed-version-item").append(o(t)),D("#installModal .loader").hide()}).fail(function(e){O(e)})}function P(e,t){R.get(I.data("extend.baseurl")+"packageInfo",{package:e,version:t}).done(function(e){var t,i,n;"bolt-extension"===e.type&&(t=e,D(".extension-postinstall").show(),D(".extension-postinstall .modal-success").show(),D(".postinstall-footer .ext-link").attr("href",t.source),D(".postinstall-footer").show()),"bolt-theme"===e.type&&(n=(i=e).name.split(/\/+/).pop(),D(".install-response-container").hide(),D(".theme-postinstall").show(),D(".theme-generation-container").show(),D(".theme-postinstall .theme-generator").data("theme",i.name),D(".theme-postinstall #theme-name").val(n),D(".postinstall-footer").show())}).fail(function(e){O(e)})}var n=function(e){var t,i,n,a,o,s,l,r,d,c,u,p,f,h,m,g,v,b,_,k,w,y,x,C,E,T,S;switch(R(e.target).data("request")){case"update-check":D(".update-container").show(),S=D(".update-output-console").html(),D(".update-output-notice").html(S),D(".update-output-notice").find(".update-output-element").removeClass("update-output-element").addClass("update-output").show(),D(".update-list").hide(),(T=D(".update-list-items")).html(""),(A=D(".update-output")).html(I.data("extend.text.updating")),R.get(I.data("extend.baseurl")+"check",function(e){if(0<e.updates.length||0<e.installs.length){var t,i;for(t in e.installs)e.installs.hasOwnProperty(t)&&(i=e.installs[t],T.append(I.data("extend.packages.install_new",{"%PACKAGE%":i.name,"%VERSION%":i.version,"%PRETTYVERSION%":i.prettyversion})));for(t in e.updates)e.updates.hasOwnProperty(t)&&(i=e.updates[t],T.append(I.data("extend.packages.install_update",{"%PACKAGE%":i.name,"%VERSION%":i.version,"%PRETTYVERSION%":i.prettyversion})));A.hide(),D(".update-list").show()}else A.html(I.data("extend.text.updated"))}).fail(function(e){O(e)});break;case"update-run":M(I.data("extend.text.running-update-all"),I.data("extend.text.running-update"),!1),R.get(I.data("extend.baseurl")+"update",function(e){setTimeout(function(){D(".update-container").hide()},7e3),F(e),$()}).fail(function(e){O(e)});break;case"update-package":x=e.originalEvent,C=D(".update-output").html(I.data("extend.text.updating")),E=R(x.target).data("package"),C.show(),A=C,R.get(I.data("extend.baseurl")+"update?package="+E).success(function(e){D(".update-output").html(e),D('.update-list-items tr[data-package="'+E+'"]').remove(),B(function(){A.hide()},4e3),D(".update-list-items tbody tr").length<1&&D(".update-container").hide(),$()}).fail(function(e){O(e)}),x.preventDefault();break;case"check-package":k=e.originalEvent,w=D('input[name="check-package"]').val(),(y=D('input[name="check-package"]').data("packagename"))&&(w=y),U(w),k.preventDefault();break;case"uninstall-package":!function(e){var t=D(".installed-container .console").html(I.data("extend.text.removing"));if(!1===confirm(I.data("extend.text.confirm-remove")))return e.stopPropagation(),e.preventDefault();t.show(),A=t,R.get(R(e.target).attr("href")).done(function(e){D(".installed-container .console").html(e),$(),B(function(){A.hide()},2e3)}).fail(function(e){O(e)}),e.preventDefault()}(e.originalEvent);break;case"install-package":v=e.originalEvent,b=R(v.target).data("package"),_=R(v.target).data("version"),D(".install-response-container").show(),D(".install-latest-container").hide(),D(".install-version-container").hide(),(A=D(".install-response-container .console")).html(I.data("extend.text.installing")),D("#installModal .loader .message").html(I.data("extend.text.installing")),R.get(I.data("extend.baseurl")+"install",{package:b,version:_}).done(function(){P(b,_),D(".install-response-container").hide(),D(".check-package").show(),D('input[name="check-package"]').val(""),$()}).fail(function(e){O(e)}),v.preventDefault();break;case"prefill-package":m=e.originalEvent,g=R(m.target),D('input[name="check-package"]').val(g.closest("a").text()),D('input[name="check-package"]').data("packagename",g.data("packagename")),D(".auto-search").hide();break;case"install-run":h=e.originalEvent,M(I.data("extend.text.install-running"),I.data("extend.text.install-all"),!1),R.get(I.data("extend.baseurl")+"installAll",function(e){B(function(){D(".update-container").hide()},7e3),F(e),$()}).fail(function(e){O(e)}),h.stopPropagation(),h.preventDefault();break;case"autoload-dump":f=e.originalEvent,M(I.data("extend.text.autoloader-update"),I.data("extend.text.autoloader-start")+" …",!1),R.get(I.data("extend.baseurl")+"dumpAutoload",function(e){B(function(){D(".update-container").hide()},7e3),F(e)}).fail(function(e){O(e)}),f.stopPropagation(),f.preventDefault();break;case"generate-theme":c=e.originalEvent,u=R(c.target).data("theme"),p=D("#theme-name").val(),R.get(I.data("extend.baseurl")+"generateTheme",{theme:u,name:p}).done(function(e){D(".theme-generate-response").html("<p>"+e+"</p>").show(),D(".theme-generation-container").hide()}).fail(function(e){O(e)}),c.preventDefault();break;case"package-available":d=e.originalEvent,U(R(d.target).data("available"));break;case"package-copy":o=e.originalEvent,l=R(o.target).data("theme"),r=D("#theme-name").val(),confirm(I.data("extend.text.overwrite"))&&((s=D(".installed-container .console").html(I.data("extend.text.copying"))).show(),A=s,R.get(I.data("extend.baseurl")+"generateTheme",{theme:l,name:r}).done(function(e){A.html(e),B(function(){s.hide()},5e3)}).fail(function(e){O(e)})),o.preventDefault();break;case"package-readme":a=e.originalEvent,R.get(R(a.target).data("readme")).done(function(e){bootbox.dialog({message:e||"Readme is empty."})}).fail(function(e){O(e)}),a.preventDefault();break;case"package-depends":t=e.originalEvent,i=R(t.target).data("needle"),n=R(t.target).data("constraint"),D(".dependency-response-container").show(),D(".install-latest-container").hide(),D(".install-version-container").hide(),(A=D(".dependency-response-container .console")).html(""),R.get(I.data("extend.baseurl")+"depends",{needle:i,constraint:n}).done(function(e){D(".loader").hide(),D(".dependency-response-container").hide(),D(".check-package").show(),D('input[name="check-package"]').val("");var t=D("#installModal .extension-dependencies-list");t.html(""),e.forEach(function(e){t.append("<li>"+e.link+"</li>")}),t.show(),D(".extension-dependencies").show(),D(".postinstall-footer").show()}).fail(function(e){O(e)}),t.preventDefault();break;case"show-all":e.originalEvent,D(".install-latest-container").hide(),D(".install-version-container").show()}};e.init=function(){var o,e=R(".extend-bolt-container");e.length&&(e.on("click",n),R(document).ajaxStart(function(){t=setInterval(function(){A&&A.append(".")},1e3)}).ajaxSuccess(function(){clearInterval(t)}).ajaxError(function(){clearInterval(t)}),$(),(o=D('input[name="check-package"]')).on("keyup",function(){var e=R(this).val();e.length<3||B(function(){R.ajax({url:I.data("extend.siteurl")+"list.json",dataType:"jsonp",data:{name:e,bolt:I.data("extend.sitever")}}).success(function(e){if(e.packages.length){var t,i,n=o.parent().find(".auto-search");for(var a in n.html("").show(),e.packages){e.packages.hasOwnProperty(a)&&(i='data-request="prefill-package" data-packagename="'+(t=e.packages[a]).name+'"',n.append('<a class="btn btn-block btn-default prefill-package" '+i+'style="text-align: left;">'+t.title+" <small "+i+">("+t.authors+" - "+t.name+")</small></a>"))}o.on("blur",function(){n.fadeOut()})}})},500)}),R("#installModal").on("hide.bs.modal",function(){D(".latest-version-container .installed-version-item").html('<tr><td colspan="3"><strong>'+I.data("extend.text.no-stable")+"</strong></td></tr>"),D(".stable-version-container .installed-version-item").html('<tr><td colspan="3"><strong>'+I.data("extend.text.no-stable")+"</strong></td></tr>"),D(".dev-version-container .installed-version-item").html('<tr><td colspan="3"><strong>'+I.data("extend.text.no-test")+"</strong></td></tr>"),D(".install-response-container .console").html(I.data("extend.text.installing")),D(".theme-postinstall").hide(),D(".theme-generate-response").hide(),D(".extension-postinstall").hide(),D(".install-response-container").hide(),D(".install-latest-container").hide(),D(".install-version-container").hide(),D(".postinstall-footer").hide(),D("#installModal .loader").show()}))},I.extend=e}(Bolt||{},jQuery),function(e,i){"use strict";var t={},n={},a=/^([a-zA-Z0-9_-]+)(?:\.([a-zA-Z0-9_-]+))?(?:\.([a-zA-Z0-9_-]+))?(?:\.([a-zA-Z0-9_-]+))?$/;t.fire=function(e,t){var i=a.exec(e);if(i&&void 0!==i[4])for(;e;)n[e]&&n[e].fire({namespace:i[1],domain:i[2],event:i[3],status:i[4]},t),e=e.replace(/\.?[a-zA-Z0-9_-]+$/,"")},t.on=function(e,t){a.exec(e)&&(n[e]||(n[e]=i.Callbacks("unique")),n[e].add(t))},t.off=function(e,t){a.exec(e)&&n[e]&&n[e].remove(t)},e.events=t}(Bolt||{},jQuery),function(o,s){"use strict";var e={};function l(e,t,i,n){var a={url:e,type:"POST",data:t,success:function(){document.location.reload()},error:function(e){alert(e.responseText),console.error(i)}};n&&(a.success=n),s.ajax(a)}e.createFile=function(e,t,i){var n=window.prompt(o.data("files.msg.create_file"));n.length&&l(o.data("url.file.create"),{filename:n,parentPath:t,namespace:e,token:i},"Something went wrong creating this file!")},e.renameFile=function(e,t,i,n){var a=window.prompt(o.data("files.msg.rename_file"),i);a.length&&a!==i&&l(o.data("url.file.rename"),{namespace:e,parent:t,oldname:i,newname:a,token:n},"Something went wrong renaming this file!")},e.deleteFile=function(e,t,i,n){confirm(o.data("files.msg.delete_file",{"%FILENAME%":t}))&&l(o.data("url.file.delete"),{namespace:e,filename:t,token:i},"Failed to delete the file from the server",function(){null!==n&&s(n).closest("tr").slideUp()})},e.duplicateFile=function(e,t,i){l(o.data("url.file.duplicate"),{namespace:e,filename:t,token:i},"Something went wrong duplicating this file!")},e.createFolder=function(e,t,i){var n=window.prompt(o.data("files.msg.create_folder"));n.length&&l(o.data("url.folder.create"),{parent:t,foldername:n,namespace:e,token:i},"Something went wrong renaming this folder!")},e.renameFolder=function(e,t,i,n){var a=window.prompt(o.data("files.msg.rename_folder"),i);a.length&&a!==i&&l(o.data("url.folder.rename"),{namespace:e,parent:t,oldname:i,newname:a,token:n},"Something went wrong renaming this folder!")},e.deleteFolder=function(e,t,i,n){window.confirm(o.data("files.msg.delete_folder",{"%FOLDERNAME%":i}))&&l(o.data("url.folder.delete"),{namespace:e,parent:t,foldername:i,token:n},"Something went wrong renaming this folder!")},o.files=e}(Bolt||{},jQuery),function(i,a,n){"use strict";var e={};function t(){var n=a(this).val();a(".dashboardlisting").find("[data-bolt-browse-name]").each(function(){var i=a(this).data("bolt-browse-name"),e=i.search(n)<0;a(this).toggleClass("hidden",e),e||a(this).find(".name").each(function(){var e,t;a(this).html((t="<mark>"+(e=n)+"</mark>",i.replace(new RegExp(e.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),t))),0===n.length&&a(this).html(i)})})}function o(){for(var e=document.querySelectorAll("img[data-src]"),t=0;t<e.length;t++)e[t].getAttribute("data-src")&&(e[t].setAttribute("src",e[t].getAttribute("data-src")),e[t].removeAttribute("data-src"))}function s(){var e=a('form[name="file_upload"]').find("#file_upload__token").val(),t=new n(document.body,{url:i.conf("uploadConfig.url"),previewsContainer:"#dropzone-preview",acceptedFiles:"."+i.conf("uploadConfig.acceptFileTypes").join(",."),uploadMultiple:"true",enqueueForUpload:"true",hiddenInputContainer:".form-horizontal",paramName:"file_upload[select]",clickable:!1,autoProcessQueue:!0,params:{"file_upload[_token]":e},init:function(){var e,t,i;e=this,t=a("body"),i=0,t.bind({dragenter:function(e){e.preventDefault(),i++,a(this).addClass("dropzone-active")},dragleave:function(){0===--i&&a(this).removeClass("dropzone-active")}}),e.on("drop",function(){t.removeClass("dropzone-active")})}});t.on("sending",function(){a(".panel-uploadprogress").removeClass("hidden")}),t.on("complete",function(e){t.removeFile(e)}),t.on("totaluploadprogress",function(e){100===e&&window.setTimeout(function(){location.reload()},200)})}e.init=function(){n.autoDiscover=!1,null!==document.querySelector("div.file-manager")&&(s(),document.getElementById("file-manager-search").addEventListener("keyup",t),a("#file_upload_select").addClass("btn-secondary").bootstrapFileInput(),document.getElementById("file_upload_select").addEventListener("change",function(){document.getElementById("file_upload_upload").removeAttribute("disabled")}),window.addEventListener("load",o))},i.filemanager=e}(Bolt||{},jQuery,Dropzone),function(d,c,o){"use strict";var u={},p=["text","html","textarea"],a=null;u.init=function(e){u.previewUrl=e.previewUrl,Modernizr.contenteditable?(c("#sidebar_live_edit, #content_edit_live_edit").bind("click",u.start),c(".close-live-editor").bind("click",u.stop),c(".save-live-editor").bind("click",u.save)):c(".live-editor, #sidebar_live_editor, #content_edit_live_edit").remove()},u.start=function(){var e,t,i,l,n,r=c('form[name="content_edit"]');d.validation.run(r[0])&&(e=r.find("*[name=_live-editor-preview]"),t=c("#navpage-primary").find(".navbar-header a"),i=c("#live-editor-iframe"),l=function(e){e.preventDefault()},n=function(){var e=i[0],n=e.contentWindow||e,a=n.document,t=c(a);t.on("click","a",l);var o=d.ckeditor.initcke(n.CKEDITOR),s=o.editorConfig;o.editorConfig=function(e){for(var t in s.bind(this)(e),e.toolbar){var i;"tools"!==e.toolbar[t].name||-1<(i=e.toolbar[t].items.indexOf("Source"))&&delete e.toolbar[t].items[i]}},o.disableAutoInline=!1,t.find("[data-bolt-field]").each(function(){var e,t,i=r.find("*[name="+u.escapejQuery(c(this).data("bolt-field"))+"]").closest("[data-bolt-fieldset]").data("bolt-fieldset");c(this).addClass("bolt-editable"),c(this).data("no-edit")||-1===p.indexOf(i)||(c(this).attr("contenteditable",!0),"html"===i?(e=o.inline(this,{allowedContent:""}),t=d.utils.debounce(function(){e.element.data("src",e.getData())},500),e.on("instanceReady",t),e.on("change",t)):(c(this).on("paste",function(e){var t;e.preventDefault(),e.originalEvent.clipboardData?(t=e.originalEvent.clipboardData.getData("text/plain"),a.execCommand("insertText",!1,t)):n.clipboardData&&(t=n.clipboardData.getData("Text"),n.getSelection&&n.getSelection().getRangeAt(0).insertNode(a.createTextNode(t)))}),"textarea"===i?c(this).on("keypress",function(e){13===e.which&&(e.preventDefault(),a.execCommand("insertHTML",!1,"<br><br>"))}):c(this).on("keypress",function(e){return 13!==e.which}).on("focus blur",function(){c(this).html(c(this).text())})))})},i.on("load",n),d.liveEditor.active=!0,c("body").addClass("live-editor-active"),t.on("click",l),e.val("yes"),r.attr("action",u.previewUrl).attr("target","live-editor-iframe").submit(),r.attr("action","").attr("target","_self"),e.val(""),a=function(){i.off("load",n),t.off("click",l)})},u.save=function(){u.extractText(),c("#content_edit_save").trigger("click")},u.stop=function(){var e=c("#live-editor-iframe")[0];u.extractText(),c(e).attr("src",""),d.liveEditor.active=!1,c("body").removeClass("live-editor-active"),a()},u.extractText=function(){var e=c("#live-editor-iframe")[0],t=(e.contentWindow||e).document;c(t).find("[data-bolt-field]").each(function(){var e,t=c('form[name="content_edit"]'),i=c(this).data("bolt-field"),n=t.find("[name="+u.escapejQuery(i)+"]"),a=n.closest("[data-bolt-fieldset]").data("bolt-fieldset");"html"===a?(e=n.attr("id"),o.instances.hasOwnProperty(e)&&o.instances[e].setData(c(this).data("src"))):n.val(u.cleanText(c(this),a))})},u.cleanText=function(e,t){return"textarea"===t&&e.html(e.html().replace(/&nbsp;/g," ").replace(/\s?<br.*?>\s?/g,"\n")),e.text()},u.escapejQuery=function(e){return e.replace(/[:\.\[\],]/g,"\\$1")},u.active=!1,u.previewUrl=null,d.liveEditor=u}(Bolt||{},jQuery,(window,"undefined"!=typeof CKEDITOR?CKEDITOR:void 0)),function(t,n,i){"use strict";var e={init:function(){var e=n(".omnisearch select");e.select2({width:"100%",placeholder:t.data("omnisearch.placeholder"),minimumInputLength:3,multiple:!0,ajax:{delay:600,url:e.data("omnisearchUrl"),dataType:"json",data:function(e){return{q:e.term}},processResults:function(e){var i=[];return n.each(e,function(e,t){i.push({id:t.path,path:t.path,text:t.label})}),{results:i}}},templateResult:function(e){var t=e.path?"<small>"+e.path+"</small>":"";return"<div>"+(e.loading?'<i class="fa fa-spinner fa-spin"></i> ':"")+e.text+"</div>"+t},templateSelection:function(e){return i.location.href=e.path,null},escapeMarkup:function(e){return e}})}};t.omnisearch=e}(Bolt||{},jQuery,window),function(e,s,l){"use strict";var t={},n=0;function r(){var e=s("#navpage-content").outerHeight(),t=s("#navpage-secondary"),i=t.outerHeight(),n=s(document).height()-t.position().top,a=Math.max(e,n),o=5e3;i!==a&&(t.outerHeight(a),o=500),l.setTimeout(r,o)}t.init=function(){var e=!s(".navbar-toggle").is(":visible");s(".navbar-toggle").on("click",function(){var e=s("#navpage-wrapper");e.hasClass("nav-secondary-opened")?e.removeClass("nav-secondary-opened nav-secondary-collapsed"):e.removeClass("nav-secondary-collapsed").addClass("nav-secondary-opened")}),s(".nav-secondary-collapse a").on("click",function(){return s("#navpage-wrapper").removeClass("nav-secondary-opened").addClass("nav-secondary-collapsed"),setTimeout(function(){s("#navpage-wrapper").addClass("nav-secondary-collapsed-hoverable")},300),s.cookie("sidebar","collapsed",{expires:21,path:"/"}),s("#bolt-footer").addClass("bolt-footer-hidden"),!1}),s(".nav-secondary-expand a").on("click",function(){return s("#navpage-wrapper").removeClass("nav-secondary-collapsed nav-secondary-opened nav-secondary-collapsed-hoverable"),s.removeCookie("sidebar",{path:"/"}),s("#bolt-footer").removeClass("bolt-footer-hidden"),!1}),s("#navpage-secondary").length&&r(),e?s("#navpage-secondary").find("a.menu-pop").each(function(){var e=s(this),t="";e.nextAll(".submenu").children().each(function(){s(this).hasClass("subdivider")&&(t+="<hr>"),t+=s(this).html().trim().replace(/[ \n]+/g," ").replace(/(>) | (<)/g,"$1$2")}),e.popover({trigger:"manual",content:t,html:!0}),e.on("mouseover focus click dblclick",function(e){var t=this,i=300;"click"!==e.type||s(t).next().hasClass("popover")||(e.preventDefault(),i=0),l.clearTimeout(n),n=l.setTimeout(function(){s("#navpage-secondary a.menu-pop").not(t).popover("hide"),s(t).popover("show")},i)})}).end().on("mouseenter focus",".popover",function(){l.clearTimeout(n)}).on("mouseleave blur","a.menu-pop, .popover",function(){l.clearTimeout(n),n=l.setTimeout(function(){s("#navpage-secondary a.menu-pop").popover("hide")},300)}):s("#navpage-secondary a.menu-pop").on("click",function(e){var t=s(this).nextAll(".submenu");e.preventDefault(),t.hasClass("show")?t.removeClass("show"):(s("#navpage-secondary .submenu").removeClass("show"),t.addClass("show"))})},e.secmenu=t}(Bolt||{},jQuery,window),function(t,n){"use strict";var a={init:function(){n("a[data-bolt-addtostack]").each(function(){n(this).on("click",function(e){var t=n(e.currentTarget),i=t.data("bolt-addtostack");e.preventDefault(),a.addToStack(i,t)})})},addToStack:function(e,i){n.post(t.conf("stackAddUrl"),{filename:e}).done(function(t){i&&n(i).addClass("disabled"),n(":bolt-buicStack").buicStack("prepend",t.panel,t.removed),t.removed&&n(".select-from-stack [data-file]").each(function(){n(this).data("file").fullPath===t.removed&&n(this).remove()}),n(".select-from-stack").each(function(){var e=n(this).data("type");e&&t.type!==e||n(this).prepend(t.list)})}).fail(function(){console.error("Failed to add file to stack")})}};t.stack=a}(Bolt||{},jQuery),function(i){"use strict";var e={humanBytes:function(e){for(var t=-1;++t<8&&1e3<=Math.abs(e);)e/=1e3;return(e="object"==typeof Intl&&Intl&&"function"==typeof Intl.NumberFormat?e.toLocaleString(i.conf("locale.long").replace(/_/g,"-"),{maximumSignificantDigits:3}):e.toFixed(2))+" "+" kMGTPEZY"[t].trim()+"B"},filterInt:function(e,t){return/^(\-|\+)?([0-9]+|Infinity)$/.test(e)?Number(e):t||NaN},debounce:function(n,a,o){var s;return function(){var e=this,t=arguments,i=o&&!s;clearTimeout(s),s=setTimeout(function(){s=null,o||n.apply(e,t)},a),i&&n.apply(e,t)}}};i.utils=e}(Bolt||{}),function(){"use strict";jQuery.widget("bolt.baseField",{_create:function(){}})}(),function(a){"use strict";var o={};a.widget("bolt.baseInterval",{options:{delay:1e4},_create:function(){var e,t,i=this,n=this.widgetName;o[n]||(e=a.Callbacks(),t=setInterval(e.fire,this.options.delay),o[n]={id:t,delay:this.options.delay,callbacks:e}),this._fncUpdate=function(){i._update()},o[n].callbacks.add(this._fncUpdate)},_destroy:function(){var e=this.widgetName;o[e].callbacks.remove(this._fncUpdate),o[e].callbacks.has()||(clearInterval(o[e].id),delete o[e])}})}(jQuery),function(l){"use strict";l.widget("bolt.buicBrowser",{options:{url:"",multiselect:!1},_create:function(){this._url=this.options.url,this._on({click:function(){this._browse()}})},_browse:function(){var a=this,e={multiselect:this.options.multiselect},o=[],s=!1;l("body").buicModal({size:"large",remote:{url:a._url,data:e},loaded:function(e,n){var i=n.footer.find("[data-fbrowser-add-checked]");n.header.on("click.bolt","[data-fbrowser-chdir]",function(e){e.preventDefault(),a._url=l(this).data("fbrowser-chdir"),a._browse()}),n.body.on("click.bolt","[data-fbrowser-chdir]",function(e){e.preventDefault(),a._url=l(this).data("fbrowser-chdir"),a._browse()}).on("click.bolt","[data-file] a",function(e){e.preventDefault();var t=l(this).closest("[data-file]").data("file");a._trigger("selected",null,t),n.close()}).on("click.bolt","[aria-pressed]",function(e){var t="false"===l(this).attr("aria-pressed"),i=this.className.replace("toogle-","");l(this).attr("aria-pressed",t?"true":"false"),n.body.find("tbody."+i).toggleClass("hidden",!t),0<e.clientX&&this.blur()}).on("change",'select[name="ext"]',function(){a._filter(n)}).keyup('input[name="filter"]',function(){a._filter(n)}).on("change","[data-fbrowser-check]",function(){var e=l(this).closest("[data-file]").data("file"),t=o.indexOf(e.fullPath);-1<t?(o.splice(t,1),s=!1,0===o.length&&i.addClass("disabled")):(o.push(e.fullPath),i.removeClass("disabled"))}),n.footer.on("click.bolt",".toggle-all",function(e){e.preventDefault(),s?(n.body.find("[data-fbrowser-check]").each(function(){l(this).prop("checked",!1)}),o.length=0,s=!1,i.addClass("disabled")):(n.body.find("[data-fbrowser-check]").each(function(){l(this).prop("checked",!0);var e=l(this).closest("[data-file]").data("file");o.push(e.fullPath)}),s=!0,i.removeClass("disabled"))}).on("click.bolt","[data-fbrowser-add-checked]:not(.disabled)",function(e){e.preventDefault(),n.body.find("[data-fbrowser-check]").each(function(){var e;l(this).prop("checked")&&(e=l(this).closest("[data-file]").data("file"),a._trigger("selected",null,e))}),n.close()})}})},_filter:function(e){var t,i,n=e.body.find('input[name="filter"]').val(),a=e.body.find('select[name="ext"]').val();e.body.find("[data-file],[data-folder]").each(function(){t=l(this).data("file")||l(this).data("folder"),i=""!==a&&t.extension!==a||""!==n&&t.filename.search(n)<0,l(this).toggleClass("hidden",i),i||l(this).find("a, span").each(function(){l(this).html(t.filename.replace(n,"<mark>"+n+"</mark>"))})})}})}(jQuery),function(){"use strict";jQuery.widget("bolt.buicCheckbox",{_create:function(){var e=this.element.find("button"),t=this.element.find("input");this._on(e,{click:function(){t.prop("checked",!t.prop("checked"))}})}})}(),function(l,r){"use strict";l.widget("bolt.buicListing",{_create:function(){this.csrfToken=this.element.data("bolt_csrf_token"),this.contentType=this.element.data("contenttype"),this.contentTypeName=this.element.data("contenttype-name"),this.element.find("table.listing tbody").buicListingPart()},modifyRecords:function(e,t,i){var n,a=this,o={},s={delete:{safe:!1,name:r.data("recordlisting.action.delete",{"%CTNAME%":this.contentTypeName}),cmd:{delete:null}},publish:{safe:!0,name:r.data("recordlisting.action.publish",{"%CTNAME%":this.contentTypeName}),cmd:{modify:{status:"published"}}},depublish:{safe:!0,name:r.data("recordlisting.action.depublish"),cmd:{modify:{status:"held"}}},draft:{safe:!0,name:r.data("recordlisting.action.draft"),cmd:{modify:{status:"draft"}}}};o[a.contentType]={},l(t).each(function(){o[a.contentType][this]=s[e].cmd}),n=(n=1===t.length?r.data("recordlisting.confirm.one"):r.data("recordlisting.confirm.multi",{"%NUMBER%":"<b>"+t.length+"</b>"}))+"<br><br><b>"+r.data("recordlisting.confirm.no-undo")+"</b>",s[e].safe?a._sendModifyRecordsQuery(o):bootbox.dialog({message:n,title:s[e].name,buttons:{cancel:{label:r.data("recordlisting.action.cancel"),className:"btn-default"},ok:{label:i,className:"btn-danger",callback:function(){a._sendModifyRecordsQuery(o)}}}})},_sendModifyRecordsQuery:function(e){var t=this;l.ajax({url:r.conf("contentActionUrl"),type:"POST",data:{bolt_csrf_token:t.csrfToken,contenttype:t.contentType,actions:e},success:function(e){t.element.html(e),t.element.find("table.listing tbody").buicListingPart()},error:function(e,t,i){console.error(e.status+" ("+i+"):"),console.error(JSON.parse(e.responseText))},dataType:"html"})}})}(jQuery,Bolt),function(a){"use strict";a.widget("bolt.buicListingPart",{_create:function(){var t=this;this.listing=this.element.closest(":bolt-buicListing"),this.toolbar=this.element.find("tr.selectiontoolbar"),this.toolbarCount=this.toolbar.find("div.count"),this.menu=this.element.find("tr.header th.menu"),this.menuOnlyOnSelection=this.menu.find("li:not(.select-all)"),this.menuSelectionCount=this.menu.find("li.dropdown-header"),this.menuSelectionCountTemplate=this.menuSelectionCount.text(),this.selectedIds=[],this.menu.find("li.select-all, li.select-none").on("click",function(){var e=a(this).hasClass("select-all");t.element.find('td input:checkbox[name="checkRow"]').each(function(){this.checked=e,t._update(this)})}),this.element.find('td input:checkbox[name="checkRow"]').on("click",function(){t._update(this)}),this.toolbar.find('button[data-stb-cmd^="record:"]').on("click",function(){t._modifyRecords(a(this).data("stb-cmd"),t.selectedIds,a(this).html())}),this.element.find('a[data-listing-cmd^="record:"]').on("click",function(){t._modifyRecords(a(this).data("listing-cmd"),[a(this).parents("tr").attr("id").substr(5)],a(this).html())})},_modifyRecords:function(e,t,i){0<t.length&&this.listing.buicListing("modifyRecords",e.replace(/^record:/,""),t,i)},_update:function(e){var t,i=a(e).closest("tr"),n=i.attr("id").substr(5);e.checked?(-1===this.selectedIds.indexOf(n)&&this.selectedIds.push(n),i.addClass("row-selected")):(this.selectedIds.splice(this.selectedIds.indexOf(n),1),i.removeClass("row-selected")),(t=this.selectedIds.length)?(this.toolbar.removeClass("hidden"),this.menuOnlyOnSelection.removeClass("hidden")):(this.toolbar.addClass("hidden"),this.menuOnlyOnSelection.addClass("hidden")),this.toolbarCount.text(t),this.menuSelectionCount.text(this.menuSelectionCountTemplate.replace("(#)","("+t+")"))}})}(jQuery),function(l){"use strict";l.widget("bolt.buicModal",{options:{size:void 0,closer:!1,classname:void 0,headline:void 0,header:void 0,body:void 0,footer:void 0,remote:void 0,loaded:void 0},_create:function(){var e=this,t=l('<div class="modal-header hidden"/>'),i=l("<div class=modal-body/>"),n=l('<div class="modal-footer hidden"/>'),a=l("<div class=modal-content/>").append(t,i,n),o=l("<div class=modal-dialog role=document/>").append(a),s=l('<div tabindex=-1 role=dialog class="modal fade buic-modal"/>').append(o);this._ui={header:t,body:i,footer:n,content:a,dialog:o,modal:s},this._on(this.element,{"click .modal-retry":function(){e._load()}}),e.element.prepend(e._ui.modal),e._ui.modal.on("show.bs.modal",function(){e._fire("show")}).on("shown.bs.modal",function(){e._fire("shown")}).on("hide.bs.modal",function(){e._fire("hide")}).on("hidden.bs.modal",function(){e._fire("hidden"),e.destroy()}).modal("show")},_destroy:function(){this._ui.modal.data("modal",null).remove()},_fire:function(e){var t=this;t._trigger(e,null,{close:function(){t._ui.modal.modal("hide")},header:t._ui.header,body:t._ui.body,footer:t._ui.footer})},_init:function(){this._ui.dialog.toggleClass("modal-sm","small"===this.options.size).toggleClass("modal-lg","large"===this.options.size),this.options.remote?this._load():this._update()},_load:function(){var a=this;a._ui.content.addClass("modal-loading"),l.get(a.options.remote.url,a.options.remote.data||{}).done(function(n){a.options.classname=l(n)[0].className,l.each(["header","body","footer"],function(e,t){var i=l(n).children(t.replace("body","main"))[0];a.options[t]=i?i.innerHTML:void 0}),a._update(),a._fire("loaded")}).fail(function(){a.options.header=void 0,a.options.body='<button type=button class="btn btn-default modal-retry"><i class="fa fa-refresh"></i></button>',a.options.footer=void 0,a._update()}).always(function(){a._ui.content.removeClass("modal-loading")})},_update:function(){var i,n=this;void 0!==this.options.headline&&(this.options.header=l(),this.options.closer&&(this.options.header=this.options.header.add('<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>')),this.options.header=this.options.header.add(l('<h4 class="modal-title"/>').append(this.options.headline))),this._ui.content.attr("class","modal-content").addClass(this.options.classname),l.each(["header","body","footer"],function(e,t){i=l("<div>").append(n.options[t]).html()||"",n._ui[t].off().toggleClass("hidden",!i.length).html(i)}),this._ui.modal.modal("handleUpdate")}})}(jQuery),function(e,t){"use strict";e.widget("bolt.buicMoment",e.bolt.baseInterval,{options:{delay:15e3,titleFormat:"YYYY-MM-DD HH:mm:ss ZZ"},_create:function(){this.set(),this._super()},_update:function(){this.element.html(t(this.element.attr("datetime")).fromNow())},set:function(e){e?this.element.attr("datetime",t(e).format()):e=this.element.attr("datetime"),this.element.attr("title",t(e).format(this.options.titleFormat)),this._update()}})}(jQuery,moment),function(n){"use strict";n.widget("bolt.buicProgress",{_create:function(){this.bars={},this.element.addClass("buic-progress")},_set:function(e,t){t=parseFloat(t),t=isNaN(t)?0:Math.min(100,Math.max(0,Math.round(100*t))),this.bars[e]&&this.bars[e].find(".progress-bar").attr("aria-valuenow",t).css("width",t+"%")},add:function(e,t,i){this.bars[e]||(this.bars[e]=n('<div class="progress"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div></div>'),this.bars[e].attr("data-label",i||e).find(".progress-bar").text(i||e),this._set(e,t),this.element.append(this.bars[e]).show(),this.bars[e].show(300))},remove:function(e){var t,i;this.bars[e]&&(i=(t=this).bars[e],delete this.bars[e],i.hide(300,function(){i.remove(),0===Object.keys(t.bars).length&&t.element.hide()}))},set:function(e,t){this._set(e,t)}})}(jQuery),function(){"use strict";jQuery.widget("bolt.buicSelect",{_create:function(){this.select=this.element.find("select"),this.buttonAll=this.element.find(".select-all"),this.buttonNone=this.element.find(".select-none"),this.buttonAll.prop("title",this.buttonAll.text().trim()),this._on(this.buttonAll,{click:function(){this.all()}}),this.buttonNone.prop("title",this.buttonNone.text().trim()),this._on(this.buttonNone,{click:function(){this.none()}}),this._update(),this._on(this.select,{change:function(){this._update()}})},_update:function(){var e=this.select.find("option"),t=e.length,i=e.filter(":selected").length,n=this.select.prop("multiple")?0===i:""===this.select.val();this.buttonAll.prop("disabled",i===t),this.buttonNone.prop("disabled",n)},all:function(){this.select.find("option").prop("selected",!0).trigger("change")},none:function(){this.select.val(null).trigger("change")}})}(),function(i,n){"use strict";i.widget("bolt.buicStack",{_addPath:function(e,t){n.stack.addToStack(t.path)},_create:function(){var e=this.element;this._ui={holder:e.find(".stackholder")},this._on({buicbrowserselected:this._addPath,buicuploaduploaded:this._addPath}),e.on("inserted.bs.popover",".stackitem",function(){n.app.initWidgets()}),e.buicUpload()},prepend:function(e,t){t&&this._ui.holder.find("[data-file]").each(function(){i(this).data("file").fullPath===t&&i(this).remove()}),this._ui.holder.find(".empty").remove(),this._ui.holder.prepend(e),this._ui.holder.find(".info-pop").popover({trigger:"hover",delay:{show:500,hide:200}})}})}(jQuery,Bolt),function(l,r){"use strict";l.widget("bolt.buicUpload",{_create:function(){var e,t=this.element,i=l("input[type=file]",t),n=l(".elm-dropzone",t),a=l(i).attr("accept"),o=a?a.replace(/^\./,"").split(/,\./):[],s=new RegExp("(\\.|\\/)("+o.join("|")+")$","i");null===this.options.maxSize&&(e=Math.floor(r.conf("uploadConfig.maxSize")),this.options.maxSize=r.utils.filterInt(e,2e6)),this._ui={progress:null},i.fileupload({dataType:"json",dropZone:n,pasteZone:null,maxFileSize:0<this.options.maxSize?this.options.maxSize:void 0,minFileSize:void 0,acceptFileTypes:a?s:void 0,maxNumberOfFiles:void 0,messages:{maxFileSize:">:"+r.utils.humanBytes(this.options.maxSize),minFileSize:"<",acceptFileTypes:"T:."+o.join(", ."),maxNumberOfFiles:"#"}}),this._on({fileuploadprocessfail:this._onProcessFail,fileuploadsubmit:this._onUploadSubmit,fileuploadprogress:this._onUploadProgress,fileuploadalways:this._onUploadAlways,fileuploaddone:this._onUploadDone})},_onProcessFail:function(e,t){var i,n=t.files[t.index],a=n.error.substr(0,1),o={"%FILENAME%":n.name,"%FILESIZE%":r.utils.humanBytes(n.size),"%FILETYPE%":n.type,"%ALLOWED%":n.error.substr(2)};switch(a){case">":i=r.data("field.uploads.template.large-file",o);break;case"T":i=r.data("field.uploads.template.wrong-type",o);break;default:i="<p>"+n.error+"</p>"}bootbox.alert(i)},_onUploadSubmit:function(e,t){this._progress("add",t.files)},_onUploadProgress:function(e,t){this._progress("set",t.files,t.loaded/t.total)},_onUploadAlways:function(e,t){this._progress("remove",t.files)},_onUploadDone:function(i,e){var n=this;l.each(e.result,function(e,t){t.error?bootbox.alert(r.data("field.uploads.template.error",{"%ERROR%":t.error})):n._trigger("uploaded",i,t)})},_progress:function(e,t,i){var n=this;null===n._ui.progress&&(n._ui.progress=l(":bolt-buicProgress",n.element)),l.each(t,function(){n._ui.progress.buicProgress(e,this.name,i)})},options:{maxSize:null}})}(jQuery,Bolt),function(a,o,i){"use strict";a.widget("bolt.fieldBlock",a.bolt.baseField,{options:{name:""},_create:function(){var i=this;this._ui={add:i.element.find(".block-add .add-button"),slot:i.element.find(".block-slot")},this._templates=i.element.find('script[type="text/template"]'),i._ui.add.on("click",function(e){i._append(e)}),i.element.find(".block-slot").sortable({cursor:"move",handle:".panel-heading",stop:function(e,t){i._renumber(),i._resetEditors(t.item)}}),i.element.on("click",".delete-button",function(){var t=a(this).closest(".block-group");bootbox.confirm(o.data("editcontent.deleteset"),function(e){a(".alert").alert(),!0===e&&(t.remove(),i._renumber())})}),i.element.on("click",".move-up",function(){var e=a(this).closest(".block-group");e.insertBefore(e.prev(".block-group")),i._renumber(),i._resetEditors(e)}),i.element.on("click",".move-down",function(){var e=a(this).closest(".block-group");e.insertAfter(e.next(".block-group")),i._renumber(),i._resetEditors(e)}),i.element.on("click",".repeater-collapse",function(){var e=a(this).closest(".block-group").find(".panel-body");a(this).toggleClass("collapsed"),e.slideToggle()}),i.element.on("click",".hide-all-blocks",function(){var e=a(this).closest(".bolt-field-block"),t=e.find(".panel-body");e.find(".repeater-collapse").addClass("collapsed"),t.slideUp()}),i.element.on("click",".show-all-blocks",function(){var e=a(this).closest(".bolt-field-block"),t=e.find(".panel-body");e.find(".repeater-collapse").removeClass("collapsed"),t.slideDown()}),i.element.on("keyup change","input[type=text]",function(){var e,t,i,n;a(this).closest(".bolt-field-text").length&&(t=(e=a(this).closest(".block-group")).find(".bolt-field-text input:first"),n=(i=e.find(".block-heading")).data("default"),i.text(a(t).val().substring(0,60)||n))})},_append:function(e){var i,n=a(e.target).data("block-type");a.each(this._templates,function(e,t){a(t).data("block-type")===n&&(i=a(t).html())});var t=this._clone(i);t.data("block-type",n),this._ui.slot.append(t),this._renumber(),o.datetime.init(),o.ckeditor.init(),init.popOvers()},_clone:function(e){var i=a(e).clone();return i.find("[id]").each(function(){var e=a(this).attr("id"),t=o.app.buid();a(this).attr("id",t),i.find('[for="'+e+'"]').each(function(){a(this).attr("for",t)})}),o.app.initWidgets(i),i},_renumber:function(){var i=new RegExp("^([^\\[]+\\[)([#|\\d]+)(\\].*)$","gi");this._ui.slot.find("div.block-group").each(function(e,t){a(t).find("[name]").each(function(){this.name=this.name.replace(i,"$1"+e+"$3")}),a(t).is(":first-of-type")?a(t).find(".move-up").addClass("disabled"):a(t).find(".move-up").removeClass("disabled"),a(t).is(":last-of-type")?a(t).find(".move-down").addClass("disabled"):a(t).find(".move-down").removeClass("disabled")})},_resetEditors:function(e){e.find(".ckeditor").each(function(e,t){i.instances[t.id]&&i.instances[t.id].destroy(),i.replace(t.id)})}})}(jQuery,Bolt,"undefined"!=typeof CKEDITOR?CKEDITOR:void 0),function(e,t){"use strict";e.widget("bolt.fieldCategories",e.bolt.baseField,{_create:function(){this.element.find("select").select2({width:"100%",allowClear:!0,placeholder:{id:"",text:t.data("field.categories.text.placeholder")}})}})}(jQuery,Bolt),function(a,o){"use strict";a.widget("bolt.fieldEmbed",a.bolt.baseField,{_create:function(){var e=this,t=this.element,i=0;this._ui={url:t.find("input.url"),width:t.find("input.width"),height:t.find("input.height"),html:t.find("input.html"),ratio:t.find("input.ratio"),authorName:t.find("input.author_name"),authorUrl:t.find("input.author_url"),provider_name:t.find("input.provider_name"),thumbnailUrl:t.find("input.thumbnail_url"),preview:t.find("img"),play:t.find("button.preview"),refresh:t.find("button.refresh"),spinner:t.find("button.refresh i")},e._ui.url.on("propertychange input",function(){clearTimeout(i),i=setTimeout(function(){e._update()},1e3)}),e._ui.width.on("propertychange input",function(){0<e._ui.ratio.val()&&e._ui.height.val(Math.round(e._ui.width.val()/e._ui.ratio.val()))}),e._ui.height.on("propertychange input",function(){0<e._ui.ratio.val()&&e._ui.width.val(Math.round(e._ui.height.val()*e._ui.ratio.val()))}),e._ui.refresh.on("click",function(){e._update()}),e._ui.play.on("click",function(){a("body").buicModal({size:"large",closer:!0,headline:e._ui.provider_name.val(),body:e._ui.html.val()})})},_update:function(){var t=this,e=o.data("endpoint.embed"),i=a("#id").closest("form").find('input[name="content_edit[_token]"]').val(),n={format:"json",url:t._ui.url.val(),_token:i,provider:"oembed"};n.url.length<2?t._set({}):(this._ui.refresh.prop("disabled",!0),t._ui.spinner.addClass("fa-spin"),a.post(e,n).done(function(e){t._set(e)}).fail(function(){t._set({})}).always(function(){t._ui.spinner.removeClass("fa-spin")}))},_set:function(e){this._ui.html.val(e.html||""),this._ui.width.val(e.width||""),this._ui.height.val(e.height||""),this._ui.authorName.val(e.author_name||""),this._ui.authorUrl.val(e.author_url||""),this._ui.provider_name.val(e.provider_name||""),this._ui.thumbnailUrl.val(e.thumbnail_url||this._ui.preview.data("defaultUrl")),this._ui.refresh.prop("disabled",this._ui.url.val().length<=2||0<this._ui.html.val().length)}})}(jQuery,Bolt),function(n,i){"use strict";n.widget("bolt.fieldFile",n.bolt.baseField,{_create:function(){var i=this,e=this.element,t=n("input.path",e);t.data("selected",{path:t.val()}),t.autocomplete({source:e.find("[data-autocomplete-url]").data("autocompleteUrl"),minLength:2,focus:function(e,t){return i._onPreview(e,t.item),!1},select:function(e,t){return i._onSelect(e,t.item),!1},close:function(){i._onClose()}}).autocomplete("instance")._renderItem=function(e,t){return n("<li>").append(t.path).appendTo(e)},t.on("change",function(){n(this).data("changeWithoutSelection",!0)}),t.on("blur",function(){n(this).data("changeWithoutSelection")&&(""===n(this).val()?i._onClear():i._onClose())}),i._on({"click.select-from-stack a":i._onSelectFromStack,buicbrowserselected:i._onSelect,buicuploaduploaded:i._onSelect}),e.buicUpload()},_onPreview:function(e,t){n("input.path",this.element).val(t.path)},_onSelectFromStack:function(e){var t=n(e.target),i=t.parent("[data-file]");t.closest(".btn-group").removeClass("open"),this._onSelect(e,i.data("file")),e.preventDefault()},_onSelect:function(e,t){n("input.path",this.element).data("changeWithoutSelection",!1).data("selected",t).val(t.path).trigger("change"),"click"!==e.type&&i.stack.addToStack(t.path)},_onClose:function(){var e=n("input.path",this.element);e.val(e.data("selected").path)},_onClear:function(){var e=n("input.path",this.element);e.val(""),e.data("selected",{})}})}(jQuery,Bolt),function(d,o){"use strict";d.widget("bolt.fieldFilelist",d.bolt.baseField,{_create:function(){var e=this,r=this.element;this._ui={data:r.find("textarea"),list:r.find(".list")},this._lastClickIndex=0,e.options.isImage=this.options.isImage||!1,e._ui.list.sortable({helper:function(e,t){return t.addClass("selected"),d("<div/>")},start:function(e,t){var i=d(".selected",r).not(".ui-sortable-placeholder"),n=i.length,a=t.placeholder,o=a.outerHeight(!0),s=a.height(),l=parseInt(a.css("margin-top"))+parseInt(a.css("margin-bottom"));i.hide(),a.height(s+(n-1)*o-l),t.item.data("items",i)},beforeStop:function(e,t){t.item.before(t.item.data("items"))},stop:function(){d(".selected",r).show(),e._serialize()},axis:"y",delay:100,distance:5}),e._on(e._ui.list,{"click.item":e._onSelect,"click.remove":e._onRemove,"change input":e._serialize}),d("input.title",e._ui.list).on("keyup",e._updateTitle),e._on({"click.select-from-stack a":e._onSelectFromStack,buicbrowserselected:e._onAddPath,buicuploaduploaded:e._onAddPath}),r.buicUpload()},_onAddPath:function(e,t){d(">p",this._ui.list).remove(),this._ui.list.append(d(Bolt.data(this.options.isImage?"field.imagelist.template.item":"field.filelist.template.item",{"%TITLE_A%":t.path.replace(/\.[a-z0-9]+$/,""),"%FILEPATH_E%":d("<div>").text(t.path).html(),"%FILEPATH_A%":t.path,"%EXT_E%":t.extension.toUpperCase(),"%PREVIEW_A%":t.previewListUrl,"%URL_A%":t.url}))),this._serialize()},_onRemove:function(e){var t=d(e.target).closest(".item"),i=t.hasClass("selected")?d(".selected",this._ui.list):t,n=this.options.isImage?"field.imagelist.message.remove":"field.filelist.message.remove",a=this.options.isImage?"field.imagelist.message.removeMulti":"field.filelist.message.removeMulti";i.addClass("zombie"),confirm(o.data(1<i.length?a:n))?(d(e.target).closest(".item").remove(),this._serialize()):i.removeClass("zombie"),e.preventDefault(),e.stopPropagation()},_onSelect:function(e){var i,n,t,a=d(e.target);a.hasClass("item")&&(e.shiftKey?(i=Math.min(this._lastClickIndex,a.index()),n=Math.max(this._lastClickIndex,a.index()),this._ui.list.children().each(function(e,t){d(t).toggleClass("selected",i<=e&&e<=n)})):(e.ctrlKey||e.metaKey?a.toggleClass("selected"):((t=this._ui.list.children(".selected").not(a)).removeClass("selected"),a.toggleClass("selected",0<t.length||null)),this._lastClickIndex=a.index()))},_onSelectFromStack:function(e){var t=d(e.target),i=t.closest("[data-file]");t.closest(".btn-group").removeClass("open"),this._onAddPath(e,i.data("file")),e.preventDefault()},_serialize:function(){var e=this.options.isImage?"field.imagelist.template.empty":"field.filelist.template.empty",t=[];d(".item",this._ui.list).each(function(){t.push({filename:d("input.filename",this).val(),title:d("input.title",this).val()})}),this._ui.data.val(JSON.stringify(t)),0===t.length&&this._ui.list.html(o.data(e))},_updateTitle:function(e){var t=d(e.target).closest(".item");d("a",t).attr("title",d(".title",t).val())}})}(jQuery,Bolt),function(a,o){"use strict";a.widget("bolt.fieldGeolocation",a.bolt.baseField,{options:{latitude:"",longitude:""},_create:function(){var e=this,t=e.element;this._ui={address:t.find(".address"),matched:t.find(".matched"),mapholder:t.find(".mapholder"),spinner:t.find(".mapholder i"),latitude:t.find(".latitude"),longitude:t.find(".longitude"),snap:t.find(".snap")},this._map=null,this._marker=null,this._timeout=0,e._on({"click.expand":e._onExpand,"click.compress":e._onExpand});var i=function(){o.events.off("Bolt.GoogleMapsAPI.Load.Done",i),e._initGoogleMap(e.options.latitude,e.options.longitude)};o.events.on("Bolt.GoogleMapsAPI.Load.Done",i),o.events.on("Bolt.GoogleMapsAPI.Load.Fail",function(){e._ui.spinner.removeClass("fa-spinner fa-spin").addClass("fa-refresh").one("click",function(){e._ui.spinner.removeClass("fa-refresh").addClass("fa-spinner fa-spin"),o.events.fire("Bolt.GoogleMapsAPI.Load.Request")})}),o.events.fire("Bolt.GoogleMapsAPI.Load.Request")},_geoCode:function(n){var a=this;n&&(new google.maps.Geocoder).geocode(n,function(e,t){var i;t===google.maps.GeocoderStatus.OK&&(i=n.latLng&&!a._ui.snap.is(":checked")?n.latLng:e[0].geometry.location,a._display(e[0].formatted_address,i.lat(),i.lng()),a._marker.setPosition(i),a._map.setCenter(i))}),a._display()},_display:function(e,t,i){this._ui.matched.val(e||""),this._ui.latitude.val(t||""),this._ui.longitude.val(i||"")},_initGoogleMap:function(e,t){var i=this,n={zoom:15,mapTypeId:google.maps.MapTypeId.ROADMAP,center:new google.maps.LatLng(e,t),streetViewControl:!1};i._map=new google.maps.Map(i._ui.mapholder[0],n),i._marker=new google.maps.Marker({map:i._map,position:n.center,title:o.data("field.geolocation.marker"),draggable:!0,animation:google.maps.Animation.DROP,icon:i.element.data("pin-icon")}),google.maps.event.addListener(i._marker,"mouseup",function(){i._geoCode({latLng:i._marker.getPosition()})}),i._ui.address.on("propertychange input",function(){clearTimeout(i._timeout),i._timeout=setTimeout(function(){var e=i._ui.address.val();i._geoCode(2<e.length?{address:e}:void 0)},800)}),a('a[data-toggle="tab"]').on("shown.bs.tab",function(){i._ui.mapholder.closest("div.tab-pane").hasClass("active")&&google.maps.event.trigger(i._map,"resize")})},_onExpand:function(){var e=this._marker.getPosition();this._ui.mapholder.parent().toggleClass("expanded"),google.maps.event.trigger(this._map,"resize"),this._map.setCenter(e)}})}(jQuery,Bolt),function(e,t){"use strict";e.widget("bolt.fieldHtml",e.bolt.baseField,{_create:function(){t.ckeditor.add(this.element.find(".ckeditor")[0])}})}(jQuery,Bolt),function(t){"use strict";t.widget("bolt.fieldImage",t.bolt.fieldFile,{_create:function(){this._super(),t("input.path",this.element).data("selected").previewUrl=this.element.find("img").attr("src")},_onPreview:function(e,t){this._super(e,t),this.element.find("img").attr("src",t.previewUrl)},_onSelect:function(e,t){this._super(e,t),this.element.find("img").attr("src",t.previewUrl)},_onClose:function(){this._super();var e=t("input.path",this.element);this.element.find("img").attr("src",e.data("selected").previewUrl)},_onClear:function(){this._super();var e=this.element.find("img");e.attr("src",e.data("defaultUrl"))}})}(jQuery),function(e){"use strict";e.widget("bolt.fieldImagelist",e.bolt.fieldFilelist,{_create:function(){this.options.isImage=!0,this._super()}})}(jQuery),function(e,t){"use strict";e.widget("bolt.fieldMarkdown",e.bolt.baseField,{_create:function(){t.$("textarea[data-uk-htmleditor]",this.element).each(function(){var e=t.$(this);e.data("htmleditor")||t.htmleditor(e,t.Utils.options(e.attr("data-uk-htmleditor")))})}})}(jQuery,"undefined"!=typeof UIkit?UIkit:void 0),function(e){"use strict";e.widget("bolt.fieldMeta",e.bolt.baseField,{_create:function(){var e=this.element.find("#statusselect"),t=this.element.find("#ownerid");e.select2({width:"50%",minimumResultsForSearch:1/0}),t.select2({width:"50%",minimumResultsForSearch:1/0})}})}(jQuery),function(i,e){"use strict";i.widget("bolt.fieldRelationship",i.bolt.baseField,{_create:function(){this.element.find("select").select2({width:"100%",placeholder:{id:"",text:e.data("field.relationship.text.placeholder")},allowClear:!0,templateSelection:function(e){var t=i(e.element).parent().attr("label");return(t?t+": ":"")+e.text}})}})}(jQuery,Bolt),function(o,n,i){"use strict";o.widget("bolt.fieldRepeater",o.bolt.baseField,{options:{minimum:1,maximum:1,name:""},_create:function(){var i=this;for(this._ui={add:i.element.find(".add-button"),slot:i.element.find(".repeater-slot")},this._template=o(i.element.find('script[type="text/template"]').html()),this._count=i._ui.slot.find("div.repeater-group").length,0===i.options.maximum&&(i.options.maximum=1/0),i._setCount(),i._ui.add.on("click",function(){i._append()}),i.element.on("click",".duplicate-button",function(){var e=o(this).closest(".repeater-group"),a=i._clone(i._template);o(e).find(":input").each(function(e){var t=o(this),i=t.attr("id"),n=t.val();t.hasClass("ckeditor")&&void 0!==CKEDITOR.instances[i]?o(a).find(":input").eq(e).val(CKEDITOR.instances[i].getData()):n&&o(a).find(":input").eq(e).val(n)}),e.after(a),i._setCount(1),i._renumber()}),i.element.find(".repeater-slot").sortable({cursor:"move",handle:".panel-heading",stop:function(e,t){i._renumber(),i._resetEditors(t.item)}}),i.element.on("click",".delete-button",function(){var t=o(this).closest(".repeater-group");bootbox.confirm(n.data("editcontent.deleteset"),function(e){o(".alert").alert(),!0===e&&(t.remove(),i._setCount(-1),i._renumber())})}),i.element.on("click",".move-up",function(){var e=o(this).closest(".repeater-group");e.insertBefore(e.prev(".repeater-group")),i._renumber(),i._resetEditors(e)}),i.element.on("click",".move-down",function(){var e=o(this).closest(".repeater-group");e.insertAfter(e.next(".repeater-group")),i._renumber(),i._resetEditors(e)}),i.element.on("click",".repeater-collapse",function(){var e=o(this).closest(".repeater-group").find(".panel-body");o(this).toggleClass("collapsed"),e.slideToggle()}),i.element.on("click",".hide-all-blocks",function(){var e=o(this).closest(".bolt-field-repeater"),t=e.find(".panel-body");e.find(".repeater-collapse").addClass("collapsed"),t.slideUp()}),i.element.on("click",".show-all-blocks",function(){var e=o(this).closest(".bolt-field-repeater"),t=e.find(".panel-body");e.find(".repeater-collapse").removeClass("collapsed"),t.slideDown()}),i.element.on("keyup change","input[type=text]",function(){var e,t,i,n;o(this).closest(".bolt-field-text").length&&(t=(e=o(this).closest(".repeater-group")).find(".bolt-field-text input:first"),n=(i=e.find(".repeater-heading")).data("default"),i.text(o(t).val().substring(0,60)||n))});i._count<i.options.minimum;)i._append()},_append:function(){var e=this._clone(this._template);this._ui.slot.append(e),this._setCount(1),this._renumber(),n.datetime.init(),n.ckeditor.init(),init.popOvers()},_clone:function(e){var i=o(e).clone();return i.find("[id]").each(function(){var e=o(this).attr("id"),t=n.app.buid();o(this).attr("id",t),i.find('[for="'+e+'"]').each(function(){o(this).attr("for",t)})}),n.app.initWidgets(i),i},_renumber:function(){var i=this.options.name,e=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("^"+e+"\\[(#|\\d+)\\]");this._ui.slot.find("div.repeater-group").each(function(e,t){o(t).find("[name]").each(function(){this.name=this.name.replace(n,i+"["+e+"]")}),o(t).is(":first-of-type")?o(t).find(".move-up").addClass("disabled"):o(t).find(".move-up").removeClass("disabled"),o(t).is(":last-of-type")?o(t).find(".move-down").addClass("disabled"):o(t).find(".move-down").removeClass("disabled")})},_resetEditors:function(e){e.find(".ckeditor").each(function(e,t){i.instances[t.id]&&i.instances[t.id].destroy(),i.replace(t.id)})},_setCount:function(e){this._count+=e||0,this._count>=this.options.maximum?(this._ui.add.addClass("disabled"),this._ui.add.prop("disabled","disabled"),this.element.find(".duplicate-button").addClass("disabled"),this.element.find(".duplicate-button").prop("disabled","disabled")):(this._ui.add.removeClass("disabled"),this._ui.add.prop("disabled",!1),this.element.find(".duplicate-button").removeClass("disabled"),this.element.find(".duplicate-button").prop("disabled",!1)),this._count<=this.options.minimum?(this.element.find(".delete-button").addClass("disabled"),this.element.find(".delete-button").prop("disabled","disabled")):(this.element.find(".delete-button").removeClass("disabled"),this.element.find(".delete-button").prop("disabled",!1))}})}(jQuery,Bolt,"undefined"!=typeof CKEDITOR?CKEDITOR:void 0),function(e,n){"use strict";e.widget("bolt.fieldSelect",e.bolt.baseField,{options:{autocomplete:!1},_create:function(){var e=this.element.find("select"),t=e.find("option[selected]");e.find("option").removeAttr("selected"),t.prop("selected","selected");var i={width:"100%",placeholder:{id:"",text:n.data("field.select.text.placeholder")},allowClear:!0,minimumResultsForSearch:this.options.autocomplete?0:1/0};this.options.sortable?e.select2Sortable(i):e.select2(i)}})}(jQuery,Bolt),function(a){"use strict";var o=1,s=2,l=3;a.widget("bolt.fieldSlug",a.bolt.baseField,{options:{contentId:null,key:"",slug:"",uses:[]},_create:function(){var e=this,t=this.element;this._ui={form:this.element.closest("form"),group:t.find(".input-group"),data:t.find("input"),uses:a()},a("[name]",e._ui.form).each(function(){0<=e.options.uses.indexOf(this.name.replace(/\[\]$/,""))&&(e._ui.uses=e._ui.uses.add(a(this)))}),this._timeout=0,this._mode=o,this._ui.group.hasClass("linked")?this._setMode(s):this._ui.group.hasClass("editable")&&(this._mode=l),this._on({"click li.lock":function(e){e.preventDefault(),this._setMode(o)},"click li.link":function(e){e.preventDefault(),this._setMode(s)},"click li.edit":function(e){e.preventDefault(),this._setMode(l),this.element.find("input").focus()},"focusout input":function(){this._mode===l&&this._setMode(o)}})},_destroy:function(){clearTimeout(this._timeout)},_setMode:function(e){var t=e===o,i=e===s,n=e===l;a("li.lock",this.element).toggleClass("disabled",t),a("li.link",this.element).toggleClass("disabled",i),a("li.edit",this.element).toggleClass("disabled",n),this._ui.group.toggleClass("locked",t).toggleClass("linked",i).toggleClass("edititable",n),a(".warning",this.element).toggleClass("hidden",!n),this._ui.data.prop("readonly",!n),i?(this._buildSlug(),this._on(this._ui.uses,{change:function(){this._buildSlug()},input:function(){this._buildSlug()}})):0<this._timeout&&(clearTimeout(this._timeout),this._timeout=0,this._off(this._ui.uses,"change"),this._off(this._ui.uses,"input")),this._mode=e},_buildSlug:function(){var i,e=this,n="";a.each(e.options.uses,function(e,t){(i=a("#"+t).val())&&(n+=("object"==typeof i?i.join(" "):i)+" ")}),clearTimeout(e._timeout),e._timeout=setTimeout(function(){e._getUri(n.trim())},200)},_getUri:function(e){var t=this,i={title:e,contenttypeslug:t.options.slug,id:t.options.contentId,slugfield:t.options.key,fulluri:!1};t._ui.group.addClass("loading"),a.get(t._ui.data.data("createSlugUrl"),i).done(function(e){t._mode===s&&t._ui.data.val(e)}).fail(function(){console.error("Failed to get URI for "+t.options.slug+"/"+t.options.contentId)}).always(function(){t._ui.group.removeClass("loading")})}})}(jQuery),function(s){"use strict";s.widget("bolt.fieldTags",s.bolt.baseField,{options:{allowSpaces:!1},_create:function(){var o=this.element.find("select"),i=this.element.find(".tagcloud"),e=[","],t=o.find("option[selected]");o.find("option").removeAttr("selected"),t.prop("selected","selected"),this.options.allowSpaces||e.push(" "),o.select2({width:"100%",tags:{},minimumInputLength:1,tokenSeparators:e}),s.ajax({url:this.element.data("tagsUrl"),dataType:"json",success:function(e){for(var t=o.val()||[],i=e.length,n="",a=0;a<i;a++)t.indexOf(e[a].slug)<0&&(t.push(e[a].slug),n+='<option value="'+e[a].slug+'">'+e[a].name+"</option>");o.append(s(n)).trigger("change")}}),i&&s.ajax({url:this.element.data("popularTagsUrl"),dataType:"json",data:{limit:40},success:function(e){0<e.length&&(s.each(e,function(e,t){i.append(s("<button/>",{type:"button",text:t.name,rel:t.count,value:t.slug})).append("")}),i.find("button").on("click",function(){var e=s(this).data("slug"),t=s(this).text(),i=o.find('option[value="'+e+'"]');0<i.length?i=i.not(":selected").attr("selected",!0).trigger("change"):o.append(s("<option/>",{value:e,text:t,selected:!0})).trigger("change")}),s.fn.tagcloud.defaults={size:{start:10,end:20,unit:"px"},color:{start:"#888",end:"#194770"}},i.find("button").tagcloud(),i.css("display","block"))}})}})}(jQuery),function(o,s){"use strict";o.widget("bolt.fieldTemplateselect",o.bolt.baseField,{options:{currentHas:!1,current:"",fieldTemplates:[]},_create:function(){var t=this,i=t.element.find("select"),n=t.element.find("p"),a=n.parent();i.select2({width:"100%",allowClear:!0,placeholder:{id:"",text:s.data("field.templateselect.text.default")},minimumResultsForSearch:1/0}),i.on("change",function(){var e;a.addClass("hidden"),n.html("").removeClass("text-danger"),i.val()!==t.options.current&&(t.options.currentHas?(n.html(s.data("field.templateselect.template.warning",{"%STATUS%":s.data("field.templateselect.message.status"),"%MESSAGE%":s.data("field.templateselect.message.warning")})),e=!0,o('[name^="templatefields"]').each(function(){"checkbox"!==o(this).attr("type")&&"SELECT"!==o(this).prop("tagName")&&""!==o(this).val()&&(e=!1),"checkbox"===o(this).attr("type")&&o(this).prop("checked")&&(e=!1)}),e?o("#tabindicator-tab-template").hide():(n.addClass("text-danger"),a.removeClass("hidden"))):-1<t.options.fieldTemplates.indexOf(i.val())&&(n.html(s.data("field.templateselect.message.change")),a.removeClass("hidden"),o("#tabindicator-tab-template").show()))})}})}(jQuery,Bolt),function(e){"use strict";e.widget("bolt.fieldText",e.bolt.baseField,{_create:function(){}})}(jQuery),function(e){"use strict";e.widget("bolt.fieldTextarea",e.bolt.baseField,{_create:function(){}})}(jQuery),function(a,o){"use strict";a.widget("bolt.fieldVideo",a.bolt.baseField,{_create:function(){var e=this,t=this.element,i=0;this._ui={url:t.find("input.url"),width:t.find("input.width"),height:t.find("input.height"),html:t.find("input.html"),ratio:t.find("input.ratio"),authorName:t.find("input.authorname"),authorUrl:t.find("input.authorurl"),title:t.find("input.title"),thumbnailUrl:t.find("input.thumbnailurl"),preview:t.find("img"),play:t.find(".imageholder button"),refresh:t.find("button.refresh"),spinner:t.find("button.refresh i")},e._ui.url.on("propertychange input",function(){clearTimeout(i),i=setTimeout(function(){e._update()},1e3)}),e._ui.width.on("propertychange input",function(){0<e._ui.ratio.val()&&e._ui.height.val(Math.round(e._ui.width.val()/e._ui.ratio.val()))}),e._ui.height.on("propertychange input",function(){0<e._ui.ratio.val()&&e._ui.width.val(Math.round(e._ui.height.val()*e._ui.ratio.val()))}),e._ui.refresh.on("click",function(){e._update()}),e._ui.play.on("click",function(){a("body").buicModal({size:"large",closer:!0,headline:e._ui.title.val(),body:e._ui.html.val()})})},_update:function(){var t=this,e=o.data("endpoint.embed"),i=a("#id").closest("form").find('input[name="content_edit[_token]"]').val(),n={format:"json",url:t._ui.url.val(),_token:i,provider:"oembed"};n.url.length<2?t._set({}):(this._ui.refresh.prop("disabled",!0),t._ui.spinner.addClass("fa-spin"),a.post(e,n).done(function(e){t._set(e)}).fail(function(){t._set({})}).always(function(){t._ui.spinner.removeClass("fa-spin")}))},_set:function(e){var t=e.thumbnail_url||this._ui.preview.data("defaultUrl");this._ui.html.val(e.html||""),this._ui.width.val(e.width||""),this._ui.height.val(e.height||""),this._ui.ratio.val(e.width&&e.height?e.width/e.height:""),this._ui.authorName.val(e.author_name||""),this._ui.authorUrl.val(e.author_url||""),this._ui.title.val(e.title||""),this._ui.thumbnailUrl.val(e.thumbnail_url||""),this._ui.preview.attr("src",t),e.html?this._ui.play.removeClass("hidden"):this._ui.play.addClass("hidden"),this._ui.refresh.prop("disabled",this._ui.url.val().length<=2||0<this._ui.html.val().length)}})}(jQuery,Bolt),function(n,a){"use strict";n.widget("bolt.panelActivity",n.bolt.baseInterval,{options:{delay:3e4},_create:function(){this._super()},_update:function(){var i=this;n.get(i.element.data("url")).done(function(e){var t=n(e);a.app.initWidgets(t),i.element.html(t)})}})}(jQuery,Bolt),Bolt.validation=function(){"use strict";function E(e){var t=!0,i=e.value,n=e.getAttribute("type"),a="checkbox"===n||"radio"===n,o=e.getAttribute("required"),s=e.getAttribute("minlength"),l=e.getAttribute("maxlength"),r=e.getAttribute("pattern");return e.disabled||(t=(t=t&&(!o||a&&e.checked||!a&&""!==i))&&(a||(!s||i.length>=s)&&(!l||i.length<=l)))&&r&&(t=(r=new RegExp("^(?:"+r+")$")).test(i)),t}function T(e,t){void 0!==e.willValidate?e.setCustomValidity(t):e.validity.valid=""===t}function o(e){var t,i,n,a,o,s,l,r,d,c,u=void 0!==e.willValidate,p=e.value,f="",h=$(e).data("validate");if(h){for(i in h)if(h.hasOwnProperty(i)){switch(n=h[i],i){case"float":f=""===(c=p)||c.match(/^[-+]?[0-9]*[,.]?[0-9]+([eE][-+]?[0-9]+)?$/)?"":Bolt.data("validation.float");break;case"required":d=p,f=!0===n&&""===d?Bolt.data("validation.required"):"";break;case"min":r=n,f=""!==(l=p)&&Number(l.replace(",","."))<r?Bolt.data("validation.min",{"%MINVAL%":r}):"";break;case"max":s=n,f=""!==(o=p)&&Number(o.replace(",","."))>s?Bolt.data("validation.max",{"%MAXVAL%":s}):"";break;default:console.error("UNKNOWN VALIDATION"+i+" -> "+n)}if(f)break}T(e,f)}else{u?("INPUT"===e.nodeName&&e.type!==e.getAttribute("type")&&e.setCustomValidity(E(e)?"":"error"),e.checkValidity()):(e.validity=e.validity||{},e.validity.valid=E(e)),!(t="TEXTAREA"===e.nodeName&&$(e).hasClass("ckeditor"))||(a=CKEDITOR.instances[e.id])&&T(e,!0===a._.required&&""===a.getData().trim()?"Required":"")}var m,g,v,b,_,k,w,y,x,C="notice--"+e.id;return $("#"+C).remove(),e.validity.valid?(y=e,x=t,$(y).removeClass("error"),x&&$("#cke_"+y.id).removeClass("cke_error"),!0):(k=e,w=t,$(k).addClass("error"),w&&$("#cke_"+k.id).addClass("cke_error"),m=C,g=e,v=f,b=(b=$('label[for="'+g.id+'"]').contents().first().text().trim()||g.name).replace(/(.*):+$/g,"$1"),_=Bolt.data("validation.alertbox",{"%NOTICE_ID%":m,"%FIELD_ID%":g.id,"%FIELD_NAME%":b,"%MESSAGE%":v||$(g).data("errortext")||Bolt.data("validation.generic_msg")}),$(_).hide().insertAfter(".page-header").slideDown("fast"),!1)}return{run:function(e){for(var t,i=e.elements.length,n=!0,a=0;a<i;a++)"INPUT"!==(t=e.elements[a]).nodeName&&"TEXTAREA"!==t.nodeName&&"SELECT"!==t.nodeName||("INPUT"===t.nodeName&&(t.value=t.value.trim()),!1===o(t)&&(n=!1));return n}}}();                usesvalue += " ";
            })
            clearTimeout(makeuritimeout);
            makeuritimeout = setTimeout( function(){ makeUriAjax(usesvalue, contenttypeslug, id, this, slugfield, fulluri); }, 200);
        }).trigger('change.bolt');
    });

    $(usesfields).each( function() {
        $('#'+this).unbind('propertychange.bolt input.bolt change.bolt');
    });

}

var makeuritimeout;

function makeUriAjax(text, contenttypeslug, id, usesfield, slugfield, fulluri) {
    $.ajax({
        url: asyncpath + 'makeuri',
        type: 'GET',

<MSG> merge master

<DFF> @@ -314,7 +314,7 @@ function makeUri(contenttypeslug, id, usesfields, slugfield, fulluri) {
                 usesvalue += " ";
             })
             clearTimeout(makeuritimeout);
-            makeuritimeout = setTimeout( function(){ makeUriAjax(usesvalue, contenttypeslug, id, this, slugfield, fulluri); }, 200);
+            makeuritimeout = setTimeout( function(){ makeUriAjax(usesvalue, contenttypeslug, id, slugfield, fulluri); }, 200);
         }).trigger('change.bolt');
     });
 
@@ -325,12 +325,13 @@ function stopMakeUri(usesfields) {
     $(usesfields).each( function() {
         $('#'+this).unbind('propertychange.bolt input.bolt change.bolt');
     });
+    clearTimeout(makeuritimeout);
 
 }
 
 var makeuritimeout;
 
-function makeUriAjax(text, contenttypeslug, id, usesfield, slugfield, fulluri) {
+function makeUriAjax(text, contenttypeslug, id, slugfield, fulluri) {
     $.ajax({
         url: asyncpath + 'makeuri',
         type: 'GET',

{'commit': 'diff --git a/.travis.yml b/.travis.yml\nindex 39a71ff66..cdd7c3a7a 100644\n--- a/.travis.yml\n+++ b/.travis.yml\n@@ -10,4 +10,5 @@ script:\n \n before_script:\n   - wget http://getcomposer.org/composer.phar\n+  - php composer.phar self-update\n   - php composer.phar install\ndiff --git a/app/classes/lib.php b/app/classes/lib.php\nindex 41f640668..b1ec4e45b 100644\n--- a/app/classes/lib.php\n+++ b/app/classes/lib.php\n@@ -668,7 +668,7 @@ function hackislyParseRegexTemplates($obj)\n \n \n \n-function getPaths($original = array())\n+function getPaths($original)\n {\n \n     // If we passed the entire $app, set the $config\n@@ -684,10 +684,18 @@ function getPaths($original = array())\n     // Make sure $config is not empty. This is for when this function is called\n     // from lowlevelError().\n     if (empty($config[\'general\'][\'theme\'])) {\n-        $config[\'general\'][\'theme\'] = \'base-2013\';\n+        if ($config instanceof \\Bolt\\Config) { // Temp fix! @todo: Fix this properly.\n+            $config->set(\'general/theme\', \'base-2013\');\n+        } else {\n+            $config[\'general\'][\'theme\'] = \'base-2013\';\n+        }\n     }\n-    if (empty($config[\'general\'][\'canonical\'])) {\n-        $config[\'general\'][\'canonical\'] = isset($_SERVER[\'HTTP_HOST\']) ? $_SERVER[\'HTTP_HOST\'] : \'\';\n+    if (empty($config[\'general\'][\'canonical\']) && isset($_SERVER[\'HTTP_HOST\'])) {\n+        if ($config instanceof \\Bolt\\Config) { // Temp fix! @todo: Fix this properly.\n+            $config->set(\'general/canonical\', $_SERVER[\'HTTP_HOST\']);\n+        } else {\n+            $config[\'general\'][\'canonical\'] = $_SERVER[\'HTTP_HOST\'];\n+        }\n     }\n \n     // Set the root\ndiff --git a/app/config/contenttypes.yml.dist b/app/config/contenttypes.yml.dist\nindex 15c09f14d..6effb2345 100644\n--- a/app/config/contenttypes.yml.dist\n+++ b/app/config/contenttypes.yml.dist\n@@ -93,6 +93,8 @@ kitchensink:\n         title:\r\n             type: text\r\n             class: large\r\n+            required: true\r\n+            pattern: "*{2,255}" # see: http://html5pattern.com/\r\n         slug:\r\n             type: slug\r\n             uses: [ selectfield, title ]\r\ndiff --git a/app/resources/translations/nl/messages.nl.yml b/app/resources/translations/nl/messages.nl.yml\nindex 326635fa7..3afb6975a 100644\n--- a/app/resources/translations/nl/messages.nl.yml\n+++ b/app/resources/translations/nl/messages.nl.yml\n@@ -176,6 +176,7 @@\n "Related content:": "Gerelateerde content"\r\n "Relationships": "Relaties"\r\n "Reset my password": "Reset mijn wachtwoord"\r\n+"Routing setup": "Route instellingen"\r\n "Save %contenttype%": "Sla %contenttype% op"\r\n "Save": "Opslaan"\r\n "Search results for <b> %search% </b>.": "Zoekresultaten voor <b> %search% </b>"\r\ndiff --git a/app/src/Bolt/Config.php b/app/src/Bolt/Config.php\nindex f325ebcd7..fa33aad31 100644\n--- a/app/src/Bolt/Config.php\n+++ b/app/src/Bolt/Config.php\n@@ -27,7 +27,7 @@ class Config extends \\Bolt\\RecursiveArrayAccess\n             // if we have to reload the config, we will also want to make sure the DB integrity is checked.\n             $this->app[\'session\']->set(\'database_checked\', 0);\n         }\n-        \n+\n         $this->setTwigPath();\n \n     }\n@@ -35,7 +35,7 @@ class Config extends \\Bolt\\RecursiveArrayAccess\n     private function parseConfigYaml($basename, $default = array())\n     {\n         static $yamlparser = false;\n-        \n+\n         if ($yamlparser === false) {\n             $yamlparser = new \\Symfony\\Component\\Yaml\\Parser();\n         }\n@@ -48,6 +48,93 @@ class Config extends \\Bolt\\RecursiveArrayAccess\n         return $default;\n     }\n \n+    /**\n+     * Set a config value, using a path. For example:\n+     *\n+     * $app[\'config\']->set(\'general/branding/name\', \'Bolt\');\n+     *\n+     * @param string $path\n+     * @param mixed $value\n+     * @return bool\n+     */\n+    public function set($path, $value)\n+    {\n+        $path = explode("/", $path);\n+\n+        // Only do something if we get at least one key.\n+        if (empty($path[0])) {\n+            $logline = "Config: can\'t set empty path to \'" . (string)$value ."\'";\n+            $this->app[\'log\']->add($logline, 3, \'\', \'config\');\n+            return false;\n+        }\n+\n+        // Set the base config, or initialize it.\n+        if (isset($this[ $path[0] ])) {\n+            $tempdata = $this[ $path[0] ];\n+        } else {\n+            $tempdata = array();\n+        }\n+\n+        // Set the correct value.\n+        if (count($path)==2) {\n+            $tempdata[ $path[1] ] = $value;\n+        } else if (count($path)==3) {\n+            $tempdata[ $path[1] ][ $path[2] ] = $value;\n+        } else if (count($path)==4) {\n+            $tempdata[ $path[1] ][ $path[2] ][ $path[3] ] = $value;\n+        } else if (count($path)==5) {\n+            $tempdata[ $path[1] ][ $path[2] ][ $path[3] ][ $path[4] ] = $value;\n+        } else {\n+            $logline = "Config: can\'t set path " . implode("/", $path) . " to \'" . (string)$value ."\'";\n+            $this->app[\'log\']->add($logline, 3, \'\', \'config\');\n+            return false;\n+        }\n+\n+        // Store it.\n+        $this[ $path[0] ] = $tempdata;\n+\n+        return true;\n+\n+    }\n+\n+    /**\n+     * Get a config value, using a path. For example:\n+     *\n+     * $var = $config->get(\'general/wysiwyg/ck/contentsCss\');\n+     *\n+     * @param string $path\n+     * @return mixed\n+     */\n+    function get(string $path)\n+    {\n+\n+        $path = explode("/", $path);\n+\n+        // Only do something if we get at least one key.\n+        if (empty($path[0]) || !isset($this[ $path[0] ]) ) {\n+            return false;\n+        }\n+\n+        $value = null;\n+\n+        // Get the correct value.\n+        if (count($path)==1) {\n+            $value = $this[ $path[0] ];\n+        } else if (count($path)==2) {\n+            $value = $this[ $path[0] ][ $path[1] ];\n+        } else if (count($path)==3) {\n+            $value = $this[ $path[0] ][ $path[1] ][ $path[2] ];\n+        } else if (count($path)==4) {\n+            $value = $this[ $path[0] ][ $path[1] ][ $path[2] ][ $path[3] ];\n+        } else if (count($path)==5) {\n+            $value = $this[ $path[0] ][ $path[1] ][ $path[2] ][ $path[3] ][ $path[4] ];\n+        }\n+\n+        return $value;\n+\n+    }\n+\n+\n     /**\n      * Load the configuration from the various YML files.\n      */\n@@ -377,11 +464,11 @@ class Config extends \\Bolt\\RecursiveArrayAccess\n         // We add these later, because the order is important: By having theme/ourtheme first,\n         // files in that folder will take precedence. For instance when overriding the menu template.\n         $twigpath[] = realpath(__DIR__.\'/../../theme_defaults\');\n-        \n+\n         $this[\'twigpath\'] = $twigpath;\n \n     }\n-    \n+\n \n     private function loadCache()\n     {\ndiff --git a/app/src/Bolt/Controllers/Backend.php b/app/src/Bolt/Controllers/Backend.php\nindex 927e11431..7729ab477 100644\n--- a/app/src/Bolt/Controllers/Backend.php\n+++ b/app/src/Bolt/Controllers/Backend.php\n@@ -1212,7 +1212,7 @@ class Backend implements ControllerProviderInterface\n \n         // If the users table is present, but there are no users, and we\'re on /bolt/useredit,\n         // we let the user stay, because they need to set up the first user.\n-        if ($app[\'storage\']->getIntegrityChecker()->checkUserTableIntegrity() && !$app[\'users\']->getUsers() && $request->get(\'_route\') != \'useredit\') {\n+        if ($app[\'storage\']->getIntegrityChecker()->checkUserTableIntegrity() && !$app[\'users\']->getUsers() && $route == \'useredit\') {\n             $app[\'twig\']->addGlobal(\'frontend\', false);\n             return;\n         }\ndiff --git a/app/src/Bolt/Storage.php b/app/src/Bolt/Storage.php\nindex 1a81f056a..28f77e89b 100644\n--- a/app/src/Bolt/Storage.php\n+++ b/app/src/Bolt/Storage.php\n@@ -784,9 +784,7 @@ class Storage\n         // Meh, InnoDB doesn\'t support full text search.\n         if (!empty($parameters[\'filter\'])) {\n \n-            //$filter = safeString($parameters[\'filter\']);\n-            // Russian characters was removed from the search query ;-(\n-            $filter = preg_replace("[^a-zA-Zа-яА-ЯЁё0-9 _.,-]", "", $parameters["filter"]);\n+            $filter = $this->app[\'db\']->quote($parameters[\'filter\']);\n \n             $filter_where = array();\n \n@@ -907,7 +905,7 @@ class Storage\n             // Meh, InnoDB doesn\'t support full text search.\n             if (!empty($parameters[\'filter\'])) {\n \n-                $filter = safeString($parameters[\'filter\']);\n+                $filter = $this->app[\'db\']->quote($parameters[\'filter\']);\n \n                 $filter_where = array();\n \n@@ -1161,9 +1159,6 @@ class Storage\n             }\n         }\n \n-        if (!isset($meta_parameters[\'limit\'])) {\n-            $meta_parameters[\'limit\'] = 100;\n-        }\n         if (!isset($meta_parameters[\'page\'])) {\n             $meta_parameters[\'page\'] = 1;\n         }\n@@ -1348,6 +1343,10 @@ class Storage\n                 }\n             }\n         }\n+\n+        if (!isset($meta_parameters[\'limit\'])) {\n+            $meta_parameters[\'limit\'] = 100;\n+        }\n     }\n \n     /**\n@@ -1469,7 +1468,7 @@ class Storage\n                     }\n \n                     if ($key == \'filter\') {\n-                        $filter = safeString($value);\n+                        $filter = $this->app[\'db\']->quote($value);\n \n                         $filter_where = array();\n                         foreach ($contenttype[\'fields\'] as $name => $fieldconfig) {\n@@ -2207,7 +2206,9 @@ class Storage\n         // Set the correct operator for the where clause\n         $operator = "=";\n \n-        if ($value[0] == "!") {\n+        $first = substr($value, 0, 1);\n+\n+        if ($first == "!") {\n             $operator = "!=";\n             $value = substr($value, 1);\n         } elseif (substr($value, 0, 2) == "<=") {\n@@ -2216,13 +2217,13 @@ class Storage\n         } elseif (substr($value, 0, 2) == ">=") {\n             $operator = ">=";\n             $value = substr($value, 2);\n-        } elseif ($value[0] == "<") {\n+        } elseif ($first == "<") {\n             $operator = "<";\n             $value = substr($value, 1);\n-        } elseif ($value[0] == ">") {\n+        } elseif ($first == ">") {\n             $operator = ">";\n             $value = substr($value, 1);\n-        } elseif ($value[0] == "%" || $value[strlen($value)-1] == "%" ) {\n+        } elseif ($first == "%" || substr($value, -1) == "%" ) {\n             $operator = "LIKE";\n         }\n \ndiff --git a/app/src/Bolt/TwigExtension.php b/app/src/Bolt/TwigExtension.php\nindex a688ef39b..278357c1d 100644\n--- a/app/src/Bolt/TwigExtension.php\n+++ b/app/src/Bolt/TwigExtension.php\n@@ -442,6 +442,7 @@ class TwigExtension extends \\Twig_Extension\n         $options = array();\n         if (!empty($relationoptions[\'order\'])) {\n             $options[\'order\'] = $relationoptions[\'order\'];\n+            $options[\'limit\'] = 10000;\n         }\n \n         // @todo Perhaps make something more lightweight for this?\ndiff --git a/app/view/_sub_editfields.twig b/app/view/_sub_editfields.twig\nindex a3bb4cba0..73b198f8d 100644\n--- a/app/view/_sub_editfields.twig\n+++ b/app/view/_sub_editfields.twig\n@@ -16,7 +16,10 @@\n </b></label>\n <input type="text" name="{{key}}" id="{{key}}"\n     value=\'{{ content.get(key) }}\'\n-    class=\'{% if field.class is defined %}{{ field.class }}{% endif %}\'>\n+    class=\'{% if field.class is defined %}{{ field.class }}{% endif %}\'\n+    {% if field.required is defined and field.required %}\n+        required="required" pattern="{% if field.pattern is defined %}{{ field.pattern }}{% else %}*{1,255}${% endif %}"\n+    {% endif %}>\n {% endif %}\n \n {% if field.type == "text" and field.variant is defined and field.variant == "inline" %}\n@@ -25,7 +28,10 @@\n </span></b></label>\n <input type="text" name="{{key}}" id="{{key}}"\n     value=\'{{ content.get(key) }}\'\n-    class=\'{% if field.class is defined %}{{ field.class }}{% endif %} narrow\'>\n+    class=\'{% if field.class is defined %}{{ field.class }}{% endif %} narrow\'\n+    {% if field.required is defined and field.required %}\n+    required="required" pattern="{% if field.pattern is defined %}{{ field.pattern }}{% else %}*{1,255}${% endif %}"\n+    {% endif %}>\n {% endif %}\n \n \n@@ -89,7 +95,7 @@\n <label class=\'permalink\'>{{ __(\'Permalink\') }}:\n     <code>/{{ content.contenttype.singular_slug }}/<span id=\'show-{{key}}\'>{{ content.get(key) }}</span></code>\n     <input type="text" name="{{key}}"  id="{{key}}" value=\'{{ content.get(key) }}\' class=\'editslug\'>\n-    <span class=\'sluglocker\'><i class=\'icon-lock\'></i></span>\n+    <span class=\'sluglocker\'><i class=\'icon-lock\'></i></span> <span class=\'slugedit\'><i class=\'icon-pencil\'></i></span>\n </label>\n \n \n@@ -105,6 +111,17 @@\n                stopMakeUri({{ field.uses|json_encode|raw }});\n            }\n         });\n+        $(\'.slugedit\').bind(\'click\', function() {\n+\n+            newslug = prompt("Set the slug to:");\n+\n+            $(\'.sluglocker i\').addClass(\'icon-lock\').removeClass(\'icon-unlock\');\n+            stopMakeUri({{ field.uses|json_encode|raw }});\n+\n+            makeUriAjax(newslug, \'{{ content.contenttype.slug }}\', \'{{ content.id }}\', \'{{key}}\', false)\n+\n+\n+        });\n     {% if content.get(key) is empty  %}\n         $(\'.sluglocker\').trigger(\'click\');\n     {% endif %}\n@@ -350,7 +367,7 @@\n             <span class="label info-pop" data-html="true" data-title="{% if field.label is defined %}{{field.label|trans}}{% else %}{{ key|ucfirst|trans}}{%endif%}"\n                   data-content="{{ app.translator.trans(\'info.upload.video\',{},\'infos\') }}">{{ __(\'Info\') }}</span>\n         </label>\n-        <label>{{ __(\'URL:\') }} <input type="text" name="{{key}}[url]" id="video-{{key}}"\n+        <label>{{ __(\'URL:\') }} <input type="url" name="{{key}}[url]" id="video-{{key}}"\n                value=\'{{ video.url }}\' style=\'width: 60%;\'>\n         </label>\n \n@@ -450,7 +467,8 @@\n {% if field.type == "html" %}\n <label><b>{% if field.label is defined %}{{field.label|trans}}{% else %}{{ key|ucfirst|trans}}{%endif%}</b></label>\n <textarea name="{{key}}" class=\'{% if field.class is defined %}{{ field.class }}{% endif %} ckeditor\'\n-    style=\'{% if field.height is defined %}height: {{ field.height }}{% endif %}\'>\n+    style=\'{% if field.height is defined %}height: {{ field.height }}{% endif %}\'\n+    {% if field.required is defined and field.required %}required{% endif %}>\n     {% if content.get(key) is defined %}{{ content.get(key) }}{% endif %}\n </textarea>\n {% endif %}\n@@ -460,7 +478,9 @@\n {% if field.type == "textarea" %}\n <label><b>{% if field.label is defined %}{{field.label|trans}}{% else %}{{ key|ucfirst|trans}}{%endif%}</b></label>\n <textarea name="{{key}}" class=\'{% if field.class is defined %}{{ field.class }}{% endif %}\'\n-    style=\'{% if field.height is defined %}height: {{ field.height }}{% endif %}\'>{% if content.get(key) is defined %}{{ content.get(key) }}{% endif %}</textarea>\n+    style=\'{% if field.height is defined %}height: {{ field.height }}{% endif %}\'\n+    {% if field.required is defined and field.required %}required{% endif %}\n+    >{% if content.get(key) is defined %}{{ content.get(key) }}{% endif %}</textarea>\n {% endif %}\n \n \n@@ -474,7 +494,8 @@\n \n     </label>\n     <textarea id="{{ key }}" name="{{key}}" class=\'{% if field.class is defined %}{{ field.class }}{% endif %}\'\n-              style=\'{% if field.height is defined %}height: {{ field.height }} !important;{% endif %}\'>{% if content.get(key) is defined %}{{ content.get(key) }}{% endif %}</textarea>\n+              style=\'{% if field.height is defined %}height: {{ field.height }} !important;{% endif %}\' {% if field.required is defined and field.required %}required{% endif %}\n+            >{% if content.get(key) is defined %}{{ content.get(key) }}{% endif %}</textarea>\n \n     <textarea id="jquery-catchpaste-textarea" style="position: absolute; width: 0 !important; height: 0; left: -10000px;"></textarea>\n \ndiff --git a/app/view/_sub_mainmenu.twig b/app/view/_sub_mainmenu.twig\nindex 7b79cdc4f..fbaec5e19 100644\n--- a/app/view/_sub_mainmenu.twig\n+++ b/app/view/_sub_mainmenu.twig\n@@ -1,8 +1,12 @@\n <div class="nav-collapse">\n     <ul class="nav pull-right">\n         {% if app.session.get(\'user\') is not null %}\n+\n+            {# Link to Dashboard  #}\n             <li class="{% if active in [\'\', \'dashboard\'] %}active {% endif %}"><a href="{{ path(\'dashboard\') }}">\n                 <i class="icon-home"></i> {{ __(\'Dashboard\') }}</a></li>\n+\n+            {# Menu with all Contenttypes #}\n             <li class="{% if active==\'content\' %}active {% endif %}dropdown">\n                 <a href="#" class="dropdown-toggle" data-toggle="dropdown">\n                     <i class="icon-sitemap"></i> {{ __(\'Content\') }} <b class="caret"></b>\n@@ -12,15 +16,18 @@\n                         {% if isallowed(\'contenttype:\' ~ slug) %}\n                             <li><a href="{{ path(\'overview\', { \'contenttypeslug\': slug }) }}">\n                                 <i class="icon-tasks"></i> {{ __(\'View %contenttypes%\', {\'%contenttypes%\': contenttype.name}) }}</a></li>\n+                            {% if loop.length < 5 %}\n                             <li><a href="{{ path(\'editcontent\', { \'contenttypeslug\': slug, \'id\': \'\' }) }}">\n                                 <i class="icon-plus"></i> {{ __(\'New %contenttype%\',{\'%contenttype%\': contenttype.singular_name}) }}</a></li>\n-                            {% if not loop.last %}<li class="divider"></li>{% endif %}\n+                                {% if not loop.last %}<li class="divider"></li>{% endif %}\n+                            {% endif %}\n                         {% endif %}\n                     {% endfor %}\n \n                 </ul>\n             </li>\n \n+            {# Menu with all settings #}\n             {% if isallowed(\'settings\') %}\n             <li class="{% if active==\'settings\' %}active {% endif %}dropdown">\n                 <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-cogs"></i> {{ __(\'Settings\') }}\n@@ -31,13 +38,15 @@\n                         <li class="nav-header">{{ __(\'Configuration\') }}</li>\n                         <li><a href="{{ path(\'users\') }}"><i class="icon-group"></i> {{ __(\'Users\') }}</a></li>\n                         <li><a href="{{ path(\'fileedit\', { \'file\': \'app/config/config.yml\'}) }}">\n-                                <i class="icon-cog"></i> {{ __(\'Configuration\') }}</a></li>\n+                            <i class="icon-cog"></i> {{ __(\'Configuration\') }}</a></li>\n                         <li><a href="{{ path(\'fileedit\', { \'file\': \'app/config/contenttypes.yml\'}) }}">\n-                                <i class="icon-cog"></i> {{ __(\'Contenttypes\') }}</a></li>\n-                        <li><a href="{{ path(\'fileedit\', { \'file\': \'app/config/menu.yml\'}) }}">\n-                                <i class="icon-cog"></i> {{ __(\'Menu setup\') }}</a></li>\n+                            <i class="icon-hdd"></i> {{ __(\'Contenttypes\') }}</a></li>\n                         <li><a href="{{ path(\'fileedit\', { \'file\': \'app/config/taxonomy.yml\'}) }}">\n-                                <i class="icon-tags"></i> {{ __(\'Taxonomy\') }}</a></li>\n+                            <i class="icon-tags"></i> {{ __(\'Taxonomy\') }}</a></li>\n+                        <li><a href="{{ path(\'fileedit\', { \'file\': \'app/config/menu.yml\'}) }}">\n+                            <i class="icon-list"></i> {{ __(\'Menu setup\') }}</a></li>\n+                        <li><a href="{{ path(\'fileedit\', { \'file\': \'app/config/routes.yml\'}) }}">\n+                            <i class="icon-random"></i> {{ __(\'Routing setup\') }}</a></li>\n                         <li class="divider"></li>\n                     {% endif %}\n \n@@ -88,15 +97,29 @@\n \n             <li class="divider-vertical"></li>\n \n-            <li><a href="{{ paths.root }}" target="_blank"><i class="icon-external-link"></i> {{ __(\'View site\') }}</a></li>\n+            {# View site #}\n+            <li>\n+                <a href="{{ paths.root }}" target="_blank"><i class="icon-external-link"></i> {{ __(\'View site\') }}</a>\n+            </li>\n+\n             <li class="divider-vertical"></li>\n+\n+            {# Logout #}\n             <li>\n                 <a href="{{ path(\'logout\') }}"><i class="icon-signout"></i> {{ __(\'Logout %name%\', {\'%name%\': user.displayname|trimtext(16)}) }}</a>\n             </li>\n         {% else %}\n+\n             <li class="divider-vertical"></li>\n-            <li><a href="{{ paths.root }}" target="_blank"><i class="icon-external-link"></i> {{ __(\'View site\') }}</a></li>\n+\n+            {# View site #}\n+            <li>\n+                <a href="{{ paths.root }}" target="_blank"><i class="icon-external-link"></i> {{ __(\'View site\') }}</a>\n+            </li>\n+\n             <li class="divider-vertical"></li>\n+\n+            {# Login #}\n             <li>\n                 <a href="{{ path(\'login\') }}"><i class="icon-signin"></i> {{ __(\'Login\') }}</a>\n             </li>\ndiff --git a/app/view/css/bolt.css b/app/view/css/bolt.css\nindex 3595b670d..768c6343f 100644\n--- a/app/view/css/bolt.css\n+++ b/app/view/css/bolt.css\n@@ -741,7 +741,9 @@ fieldset.checkbox div {\n     display: none;\n }\n \n-#editcontent .sluglocker {\n+#editcontent .sluglocker,\n+#editcontent .slugedit\n+{\n     color: #666;\n     display: inline-block;\n     padding: 0 3px;\ndiff --git a/app/view/editcontent.twig b/app/view/editcontent.twig\nindex 7d785fc4c..0cd6e7fc8 100644\n--- a/app/view/editcontent.twig\n+++ b/app/view/editcontent.twig\n@@ -97,9 +97,8 @@\n \n     <script>\n         // Save the page..\n-        $(\'#savebutton, #sidebarsavebutton\').bind(\'click\', function(e){\n-            e.preventDefault();\n-            $(\'#editcontent\').attr(\'action\', \'\').attr(\'target\', "_self").submit();\n+        $(\'#sidebarsavebutton\').bind(\'click\', function(e){\n+            $(\'#savebutton\').trigger(\'click\');\n         });\n \n         // To preview the page, we set the target of the form to a new URL, and open it in a new window.\n@@ -107,7 +106,7 @@\n             e.preventDefault();\n             var link = "{{ paths.root }}" + "preview" + "/{{ contenttype.singular_slug }}";\n             $(\'#editcontent\').attr(\'action\', link).attr(\'target\', "_blank").submit();\n-\n+            $(\'#editcontent\').attr(\'action\', link).attr(\'target\', "_self")\n         });\n     </script>\n \ndiff --git a/app/view/js/bolt.js b/app/view/js/bolt.js\nindex 618a372b9..5929db3e5 100644\n--- a/app/view/js/bolt.js\n+++ b/app/view/js/bolt.js\n@@ -314,7 +314,7 @@ function makeUri(contenttypeslug, id, usesfields, slugfield, fulluri) {\n                 usesvalue += " ";\n             })\n             clearTimeout(makeuritimeout);\n-            makeuritimeout = setTimeout( function(){ makeUriAjax(usesvalue, contenttypeslug, id, this, slugfield, fulluri); }, 200);\n+            makeuritimeout = setTimeout( function(){ makeUriAjax(usesvalue, contenttypeslug, id, slugfield, fulluri); }, 200);\n         }).trigger(\'change.bolt\');\n     });\n \n@@ -325,12 +325,13 @@ function stopMakeUri(usesfields) {\n     $(usesfields).each( function() {\n         $(\'#\'+this).unbind(\'propertychange.bolt input.bolt change.bolt\');\n     });\n+    clearTimeout(makeuritimeout);\n \n }\n \n var makeuritimeout;\n \n-function makeUriAjax(text, contenttypeslug, id, usesfield, slugfield, fulluri) {\n+function makeUriAjax(text, contenttypeslug, id, slugfield, fulluri) {\n     $.ajax({\n         url: asyncpath + \'makeuri\',\n         type: \'GET\',\n', 'commit_subject': 'merge master', 'repo_name': 'bolt/bolt', 'committer': {'name': 'Leonid Bobylev', 'email': 'd0a0f35ab14893e24d2054ec7ec53cdf4475f7a9@gmail.com', 'time_sec': '1377439977', 'tz_offset': '180', 'date': {'seconds': '1377439977'}}, 'commit_tree': '3e2b4f0eef97a0410411728123b7117a1aefda19', 'commit_message': 'merge master\n', 'language_name': 'JavaScript', 'license': 'mit', 'hunks': '@@ -314,7 +314,7 @@ function makeUri(contenttypeslug, id, usesfields, slugfield, fulluri) {\n                 usesvalue += " ";\n             })\n             clearTimeout(makeuritimeout);\n-            makeuritimeout = setTimeout( function(){ makeUriAjax(usesvalue, contenttypeslug, id, this, slugfield, fulluri); }, 200);\n+            makeuritimeout = setTimeout( function(){ makeUriAjax(usesvalue, contenttypeslug, id, slugfield, fulluri); }, 200);\n         }).trigger(\'change.bolt\');\n     });\n \n@@ -325,12 +325,13 @@ function stopMakeUri(usesfields) {\n     $(usesfields).each( function() {\n         $(\'#\'+this).unbind(\'propertychange.bolt input.bolt change.bolt\');\n     });\n+    clearTimeout(makeuritimeout);\n \n }\n \n var makeuritimeout;\n \n-function makeUriAjax(text, contenttypeslug, id, usesfield, slugfield, fulluri) {\n+function makeUriAjax(text, contenttypeslug, id, slugfield, fulluri) {\n     $.ajax({\n         url: asyncpath + \'makeuri\',\n         type: \'GET\',\n', 'addition_count': 3, 'deletion_count': 2, 'src_file': 'a/app/view/js/bolt.js', 'tgt_file': 'b/app/view/js/bolt.js', 'file_extension': '.js', 'before_file': '/**\n * These are Bolt’s COMPILED JS files!\n * Do not edit this file, because all changes will be lost. You can edit the \n * `*.js` files in `app/src/js/` and then run `yarn grunt updateBolt` to generate \n * this file. You will need to use the "Clone the Git Repository" installation method, to \n * get these files. See: https://docs.bolt.cm/core-development/install-git-clone, \n * as well as the `README.md` file in the `app/src/` folder.\n */\nString.prototype.subst=function(t){"use strict";return this.replace(/%[A-Z][A-Z0-9_]+%/g,function(e){return e in t?t[e]:e})};var init={depublishTracking:function(){"use strict";var i="dateDepublishNotice",n=$("#datedepublish").data("notice");$("#datedepublish, #statusselect").on("change",function(){var e=$("#statusselect").val(),t=$("#datedepublish").val();$("."+i).remove(),""!==t&&"published"===e&&moment(t+Bolt.conf("timezone.offset"))<moment()&&$(\'<div class="\'+i+\' alert alert-warning alert-dismissible"><button type="button" class="close" data-dismiss="alert">×</button>\'+n+"</div>").hide().insertAfter(".depublish-group").slideDown("fast")}),$("#datedepublish").trigger("change")},bindEditFile:function(e){"use strict";var n,t;"undefined"!=typeof CodeMirror&&(n=CodeMirror.fromTextArea(document.getElementById("file_edit_contents"),{lineNumbers:!0,autofocus:!0,foldGutter:{rangeFinder:CodeMirror.fold.indent},gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],extraKeys:{"Ctrl-Q":function(e){e.foldCode(e.getCursor(),{rangeFinder:CodeMirror.fold.indent,minFoldSize:3})},Tab:function(e){e.somethingSelected()?e.indentSelection("add"):e.replaceSelection(e.getOption("indentWithTabs")?"\\t":Array(e.getOption("indentUnit")+1).join(" "),"end","+input")},"Ctrl-S":function(){$("#file_edit_save").click()},"Ctrl-H":"replaceAll"},tabSize:4,indentUnit:4,indentWithTabs:!1,readOnly:e.readonly}),(t=$(window).height()-312)<200&&(t=200),n.setSize(null,t)),$("#file_edit_save").on("click",function(e){Bolt.events.fire("Bolt.File.Save.Start"),e.preventDefault(),n&&n.save();$("#file_edit_save").addClass("disabled"),$("#file_edit_save i").addClass("fa-spin fa-spinner"),$("p.lastsaved").text(Bolt.data("editcontent.msg.saving"));var t=$(e.target),i=$(\'form[name="file_edit"]\').serialize()+"&"+encodeURI(t.attr("name"))+"="+encodeURI(t.attr("value"));$.post("?returnto=ajax",i).done(function(e){e.ok?Bolt.events.fire("Bolt.File.Save.Done",e):(alert(e.msg),Bolt.events.fire("Bolt.File.Save.Fail",e)),$("p.lastsaved").html(e.msg)}).fail(function(){Bolt.events.fire("Bolt.File.Save.Fail"),alert("Not saved")}).always(function(){Bolt.events.fire("Bolt.File.Save.Always"),window.setTimeout(function(){$("#file_edit_save").removeClass("disabled").blur(),$("#file_edit_save i").removeClass("fa-spin fa-spinner")},300)})})},bindEditLocale:function(e){"use strict";CodeMirror.fromTextArea(document.getElementById("file_edit_contents"),{lineNumbers:!0,autofocus:!0,tabSize:4,indentUnit:4,indentWithTabs:!1,readOnly:e.readonly}).setSize(null,$(window).height()-276)},bindFileBrowser:function(){"use strict";$("#myTab a").click(function(e){e.preventDefault(),$(this).tab("show")});var e,t,i=(e=new RegExp("(?:[?&]|&)"+"CKEditorFuncNum"+"=([^&]+)","i"),(t=window.location.search.match(e))&&1<t.length?t[1]:null);$("a.filebrowserCallbackLink").bind("click",function(e){e.preventDefault();var t=$(this).attr("href");window.opener.CKEDITOR.tools.callFunction(i,t),window.close()}),$("a.filebrowserCloseLink").bind("click",function(){window.close()})},bindCkFileSelect:function(){"use strict";var e,t,i=(e=new RegExp("(?:[?&]|&)"+"CKEditorFuncNum"+"=([^&]+)","i"),(t=window.location.search.match(e))&&1<t.length?t[1]:null);$("a.filebrowserCallbackLink").bind("click",function(e){e.preventDefault();var t=$(this).attr("href");window.opener.CKEDITOR.tools.callFunction(i,t),window.close()})},bindPrefill:function(){"use strict";var e=$("#form_contenttypes").find(":checkbox");$("#prefill_check_all").on("click",function(){e.removeAttr("checked").trigger("click")}),$("#prefill_uncheck_all").on("click",function(){e.removeAttr("checked")})},confirmationDialogs:function(){"use strict";$(".confirm").on("click",function(){return confirm($(this).data("confirm"))})},dropDowns:function(){"use strict";$(\'[data-toggle="dropdown"]\').each(function(e,t){var a;"undefined"==typeof event?$(t).parent().click(function(e){a=e}):a=event,$(t).parent().on("show.bs.dropdown",function(){var e,t,i,n;null!=a&&(e=$(this).find(\'[data-toggle="dropdown"]\').next(".dropdown-menu"),t=a.pageY+20,i=e.height(),n=$(window).height()-t+i,20<t-i&&n<37&&e.css({top:"auto",bottom:"100%"}))})})},dropZone:function(){"use strict";$(document).bind("dragover",function(e){var t=$(".elm-dropzone"),i=window.dropZoneTimeout;i?clearTimeout(i):t.addClass("in"),e.target===t[0]?t.addClass("hover"):t.removeClass("hover"),window.dropZoneTimeout=setTimeout(function(){window.dropZoneTimeout=null,t.removeClass("in hover")},100)})},magnificPopup:function(){"use strict";$(".magnific, .fancybox").magnificPopup({type:"image",gallery:{enabled:!0},disableOn:400,closeBtnInside:!0,enableEscapeKey:!0,mainClass:"mfp-with-zoom",zoom:{enabled:!0,duration:300,easing:"ease-in-out",opener:function(e){return e.parent().parent().find("img")}}})},focusStatusSelect:function(){"use strict";$("#lastsavedstatus").click(function(e){e.preventDefault(),$(\'a[href="#tab-meta"]\').click(),$("#statusselect").focus()})},passwordInput:function(){"use strict";$(".togglepass").on("click",function(){$(this).hasClass("show-password")?($(\'input[name="user_login[password]"]\').attr("type","text"),$(".togglepass.show-password").hide(),$(".togglepass.hide-password").show()):($(\'input[name="user_login[password]"]\').attr("type","password"),$(".togglepass.show-password").show(),$(".togglepass.hide-password").hide())}),$(".login-forgot").bind("click",function(){$(".login-group, .password-group").hide(),$("#user_login_password").attr("required",!1),$(".reset-group").show()}),$(".login-remembered").bind("click",function(){$(".login-group, .password-group").show(),$("#user_login_password").attr("required",!0),$(".reset-group").hide()})},popOvers:function(){"use strict";$(".info-pop").popover({trigger:"hover",delay:{show:500,hide:200}})},sortables:function(){"use strict";$("tbody.sortable").sortable({items:"tr",opacity:"0.5",axis:"y",handle:".sorthandle",update:function(){var e=$(this).sortable("serialize");$.ajax({url:$("#baseurl").attr("value")+"content/sortcontent/"+$(this).parent("table").data("contenttype"),type:"POST",data:e,success:function(){}})}})}},Bolt={};!function(bolt,$){"use strict";var actions={init:function(){$("button, input[type=button], a").off("click.action"),$("[data-action]").on("click.action",function(e){var action=$(this).attr("data-action");void 0!==action&&""!==action&&(e.preventDefault(),eval(action),e.stopPropagation())}).on("click.popover",".popover",function(e){e.stopPropagation()}),$(".clickspinner").on("click.spinner",function(){$(this).addClass("disabled").blur(),$(this).find("i").addClass("fa-spin fa-spinner"),window.setTimeout(function(e){$(e).removeClass("disabled"),$(e).find("i").removeClass("fa-spin fa-spinner")},1e4,this)}),$(".submitspinner").on("submit.spinner",function(){$(this).find("button[type=submit]").addClass("disabled").blur(),$(this).find("button[type=submit] i").addClass("fa-spin fa-spinner"),window.setTimeout(function(e){$(e).removeClass("disabled"),$(e).find("i").removeClass("fa-spin fa-spinner")},1e4,$(this).find("button[type=submit]"))})},submit:function(e,t){$(\'<input type="hidden" />\').attr("name",t.name).val(1).appendTo(e),e.submit()}};bolt.actions=actions}(Bolt||{},jQuery),function(t,n,i,a){"use strict";var o,e={},s=1e4;e.gMapsApiReady=function(){o=!0,t.events.fire("Bolt.GoogleMapsAPI.Load.Done")},e.run=function(){var e;t.conf.init(),t.data.init(),s=t.conf("buid").match(/(\\d+)$/)[1],e=t.conf("locale.long"),n.fn.select2.defaults.set("language",e.replace("_","-")),i.locale(e),n.datepicker.setDefaults(n.datepicker.regional[e]),t.events.on("Bolt.GoogleMapsAPI.Load.Request",function(){var e;void 0===o?(o=!1,e="https://maps.google.com/maps/api/js?sensor=false&callback=Bolt.app.gMapsApiReady",Bolt.conf.get("google_api_key")&&(e=e+"&key="+Bolt.conf.get("google_api_key")),n.getScript(e).fail(function(){o=void 0,t.events.fire("Bolt.GoogleMapsAPI.Load.Fail")})):!0===o&&t.events.fire("Bolt.GoogleMapsAPI.Load.Done")}),t.actions.init(),t.secmenu.init(),t.stack.init(),t.omnisearch.init(),t.extend.init(),t.filemanager.init(),t.ckeditor.init(),t.datetime.init(),a.confirmationDialogs(),a.magnificPopup(),a.dropZone(),a.popOvers(),a.dropDowns(),a.passwordInput(),a.sortables(),a.focusStatusSelect(),a.depublishTracking(),n("[data-bind]").each(function(){var e=n(this).data("bind");switch(e.bind){case"editcontent":t.editcontent.init(e);break;case"editfile":a.bindEditFile(e);break;case"editlocale":a.bindEditLocale(e);break;case"filebrowser":a.bindFileBrowser();break;case"ckfileselect":a.bindCkFileSelect();break;case"prefill":a.bindPrefill()}}),t.app.initWidgets()},e.buid=function(){return"buid-"+s++},e.initWidgets=function(e){void 0===e&&(e=n(document.documentElement)),n("[data-bolt-widget]",e).each(function(){var i=n(this),e=i.data("bolt-widget"),t={};"string"==typeof e?t[e]={}:t=e,n.each(t,function(e,t){i[e](t).removeAttr("data-bolt-widget").removeData("bolt-widget")})})},n(document).ready(e.run),t.app=e}(Bolt||{},jQuery,moment,init),function(a,o,t){"use strict";var e={};function s(){var e,t=[];for(var i in arguments){1!==arguments[i].length&&!arguments[i][0]||("string"==typeof(e=arguments[i][arguments[i].length-1])&&"|"===e.substr(0,1)&&(e=e.substr(1),t=t.concat("-")),t=t.concat(e))}return t}e.init=function(){t=t&&e.initcke(t)},e.update=function(){if(t)for(var e in t.instances)t.instances.hasOwnProperty(e)&&t.instances[e].updateElement()},e.add=function(e){t&&t.replace(e)},e.initcke=function(e){return e.editorConfig=function(e){var t,i=o(this.element.$).data("param")||{},n=a.conf("ckeditor");for(t in e.language=a.conf("ckeditor.lang"),e.skin="moono-lisa",e.resize_enabled=!0,e.entities=!1,e.fillEmptyBlocks=!1,e.extraPlugins+=(e.extraPlugins?",":"")+"codemirror,abbr",e.baseFloatZIndex=100015,e.toolbar=s([{name:"clipboard",items:s([n.clipboard,"Undo"],[n.clipboard,"Redo"],[n.copypaste,"Cut"],[n.copypaste,"Copy"],[n.copypaste,"Paste"],[n.copypaste,"PasteFromWord"],[n.copypaste,"PasteText"])}],[{name:"styles",items:s(["Format"],[n.styles,"Styles"])}],[{name:"basicstyles",items:s(["Bold"],["Italic"],[n.underline,"Underline"],[n.strike,"Strike"])}],[{name:"paragraph",items:s(["NumberedList"],["BulletedList"],["Indent"],["Outdent"],[n.blockquote,"|Blockquote"])}],[{name:"links",items:s(["Link"],["Unlink"],[n.anchor,"|Anchor"],[n.abbr,"|Abbr"])}],[n.subsuper,{name:"subsuper",items:s(["Subscript"],["Superscript"])}],[n.images,{name:"image",items:s(["Image"])}],[n.embed,{name:"embed",items:s(["oembed"])}],[n.tables,{name:"table",items:s(["Table"])}],[n.ruler,{name:"ruler",items:s(["HorizontalRule"])}],[n.align,{name:"align",items:s(["JustifyLeft"],["JustifyCenter"],["JustifyRight"],["JustifyBlock"])}],[n.fontcolor,{name:"colors",items:s(["TextColor"],["BGColor"])}],[n.codesnippet,{name:"code",items:s(["|CodeSnippet"])}],[{name:"tools",items:s(["RemoveFormat"],["Maximize"],["|Source"],[n.specialchar,"|SpecialChar"])}]),n.embed&&(e.extraPlugins+=",oembed,widget",e.oembed_maxWidth="853",e.oembed_maxHeight="480"),e.height=250,e.autoGrow_onStartup=!0,e.autoGrow_minHeight=150,e.autoGrow_maxHeight=400,e.autoGrow_bottomSpace=24,e.removePlugins="elementspath",e.resize_dir="vertical",n.filebrowser?(n.filebrowser.browseUrl&&(e.filebrowserBrowseUrl=n.filebrowser.browseUrl),n.filebrowser.imageBrowseUrl&&(e.filebrowserImageBrowseUrl=n.filebrowser.imageBrowseUrl),n.filebrowser.uploadUrl&&(e.filebrowserUploadUrl=n.filebrowser.uploadUrl),n.filebrowser.imageUploadUrl&&(e.filebrowserImageUploadUrl=n.filebrowser.imageUploadUrl)):(e.filebrowserBrowseUrl="",e.filebrowserImageBrowseUrl="",e.filebrowserUploadUrl="",e.filebrowserImageUploadUrl=""),e.codemirror={theme:"default",lineNumbers:!0,lineWrapping:!0,matchBrackets:!0,autoCloseTags:!0,autoCloseBrackets:!0,enableSearchTools:!0,enableCodeFolding:!0,enableCodeFormatting:!0,autoFormatOnStart:!1,autoFormatOnUncomment:!1,autoFormatOnModeChange:!1,highlightActiveLine:!0,highlightMatches:!0,showFormatButton:!1,showCommentButton:!1,showUncommentButton:!1},n.ck)n.ck.hasOwnProperty(t)&&(e[t]=n.ck[t]);for(t in i.height&&(e.height=parseInt(i.height),e.autoGrow_minHeight=Math.max(e.autoGrow_minHeight,e.height),e.autoGrow_maxHeight=Math.max(e.autoGrow_maxHeight,e.height)),i.ckeditor)i.ckeditor.hasOwnProperty(t)&&(e[t]=i.ckeditor[t])},a.conf("ckeditor").ck.allowNbsp&&e.on("instanceReady",function(e){e.editor.on("paste",function(e){e.data.dataValue=e.data.dataValue.replace(/&nbsp;/g," "),e.data.dataValue=e.data.dataValue.replace(/<p> <\\/p>/g,"")},null,null,9)}),e},a.ckeditor=e}(Bolt||{},jQuery,"undefined"!=typeof CKEDITOR?CKEDITOR:void 0),function(e,t){"use strict";function i(e){for(var t=e.split("."),i=a,n=0;n<t.length;n++){if(void 0===i[t[n]])return;i=i[t[n]]}return i}var a={};(i.get=i).init=function(){a=t("script[data-config]").first().data("config")},e.conf=i}(Bolt||{},jQuery),function(e,t){"use strict";function i(e,t){for(var i=e.split("."),n=o,a=0;a<i.length;a++){if(void 0===n[i[a]])return;n=n[i[a]]}return t&&"string"==typeof n?n.subst(t):n}var o={};(i.get=i).init=function(){o=t("script[data-jsdata]").first().data("jsdata")||{}},e.data=i}(Bolt||{},jQuery),function(e,l,c){"use strict";var r,t={},a=[];function o(e){var t,i,n,a,o="",s="";"datedepublish"===e.data.attr("id")&&"1900-01-01 00:00:00"===e.data.val()&&e.data.val(""),(i=e.data.val().match(/^(\\d{4}-\\d{2}-\\d{2})(?: (\\d{2}:\\d{2}:\\d{2}))?$/))&&(o=i[1],s=i[2]||""),n=""===o||"0000-00-00"===o?"":l.datepicker.parseDate("yy-mm-dd",o),e.date.datepicker("setDate",n),e.time.exists&&"0000-00-00"!==o&&(s=""===s?""!==o?"00:00":"":r?e.data.val().slice(11,16):(a=(t=parseInt(s.slice(0,2)))<12?" AM":" PM",(t%12||12)+s.slice(2,5)+a),e.time.val(s)),e.data.trigger("change")}function s(e){var t,i,n,a,o,s,l=c(e.date.datepicker("getDate")),r=c([2001,11,24]),d=!1;e.time.exists&&(n="([0-5]?[0-9])",a=new RegExp("^(?:(?:([01]?[0-9]|2[0-3]))[:,.]([0-5]?[0-9])|(1[012]|0?[1-9])[:,.]([0-5]?[0-9])(?:\\\\s*([AP])[. ]?M\\\\.?))$"),(o=e.time.val().trim().toUpperCase().match(a))&&(t=parseInt(o[1]?o[1]:o[3]),i=parseInt(o[2]?o[2]:o[4]),"P"===o[5]&&12!==t?t+=12:"A"===o[5]&&12===t&&(t-=12),r=c([2001,11,24,t,i]),d=!0)),l.isValid()?(s=e.time.exists?" "+r.format("HH:mm:00"):"",e.data.val(l.format("YYYY-MM-DD")+s)):d?e.data.val(c().format("YYYY-MM-DD")+" "+r.format("HH:mm:00")):e.data.val("")}t.update=function(){for(var e in a)a.hasOwnProperty(e)&&o(a[e])},t.init=function(){r=!c.localeData()._longDateFormat.LT.replace(/\\[.+?\\]/gi,"").match(/A/),l("input.datetime").each(function(){var e,t,i,n=(e=l(this),t=e.closest(".datetime-container"),(i={}).data=e,i.date=t.find("input.datepicker"),i.time=t.find("input.timepicker"),i.show=t.find("button.btn-tertiary"),i.clear=t.find("button.btn-default"),i.time.exists=0<i.time.length,i);a.push(n),function(e){var t=e.date.data("field-options"),i={showOn:"none"};for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);e.date.datepicker(i),e.show.click(function(){e.date.datepicker("show")}),e.clear.click(function(){e.data.val(""),o(e)})}(n),o(n),n.date.change(function(){s(n),o(n)}),n.time.change(function(){s(n),o(n)})})},e.datetime=t}(Bolt||{},jQuery,moment),function(r,d,c,u,o,p){"use strict";var e={};function i(e){var t;return e.name&&(t=d(e).val(),"select-multiple"===e.type&&(t=JSON.stringify(t))),t}function f(){d(\'form[name="content_edit"]\').find("input, textarea, select").each(function(){var e;"textarea"===this.type&&d(this).hasClass("ckeditor")?p.instances[this.id].checkDirty()&&(p.instances[this.id].updateElement(),p.instances[this.id].resetDirty()):void 0!==(e=i(this))&&d(this).data("watch",e)}),c.onbeforeunload=function(){if(t=0,d(\'form[name="content_edit"]\').find("input, textarea, select").each(function(){var e;"content_edit[save]"!==d(this).attr("name")&&("textarea"===this.type&&d(this).hasClass("ckeditor")?p.instances[this.id].checkDirty()&&t++:void 0!==(e=i(this))&&d(this).data("watch")!==e&&t++)}),0<t||r.liveEditor.active)return r.data("editcontent.msg.change_quit");var t}}function s(){c.onbeforeunload=null}function h(){d("#sidebar_save, #content_edit_save, #live_editor_save").addClass("disabled"),d("#sidebar_save i, #content_edit_save i").addClass("fa-spin fa-spinner"),d("p.lastsaved").text(r.data("editcontent.msg.saving"))}e.init=function(e){var t,l,i,n,a;(t=d(\'form[name="content_edit"]\')).attr("novalidate","novalidate").on("submit",function(e){var t=r.validation.run(this);if(d(this).data("valid",t),!t)return e.preventDefault(),!1}),t.on("boltvalidate",function(){var e=r.validation.run(this);return d(this).data("valid",e),e}),l=e,d("#sidebar_save").bind("click",function(){d("#content_edit_save").trigger("click")}),d("#content_edit_save").bind("click",function(e){e.preventDefault();var n=d(\'form[name="content_edit"]\');if(n.trigger("boltvalidate"),!n.data("valid"))return!1;var t,i,a=l.newRecord,o=l.savedon,s=l.msgNotSaved;h(),a?(f(),r.liveEditor.active&&r.liveEditor.stop(),l.duplicate&&(c.onbeforeunload=null),r.actions.submit(n,this)):(f(),r.events.fire("Bolt.Content.Save.Start"),t=d(e.target),i=n.serialize()+"&"+encodeURI(t.attr("name"))+"="+encodeURI(t.attr("value")),d.post("",i).done(function(t){r.events.fire("Bolt.Content.Save.Done",{form:t}),c.onbeforeunload=null,d("p.lastsaved").removeClass("alert alert-danger").html(o).find("strong").text(u(t.datechanged).format("MMM D, HH:mm")).end().find(".buic-moment").buicMoment().buicMoment("set",t.datechanged);var e=d("#statusselect").find("option:selected");d("a#lastsavedstatus strong").html(\'<i class="fa fa-circle status-\'+e.val()+\'"></i> \'+e.text()),d("#sidebar_save i, #content_edit_save i").removeClass("fa-flag fa-spin fa-spinner fa-exclamation-triangle").addClass("fa-check"),"object"===d.type(t)&&(d.each(t,function(i,e){var t;"object"===d.type(e)?d.each(e,function(e,t){d(\':input[name="\'+i+"["+e+\']"]\').val(t)}):"array"===d.type(e)||("checkbox"===(t=d(n.name).find("[name="+i+"]")).attr("type")?t.prop("checked","1"===e):t.val(e),p&&p.instances[i]&&p.instances[i].setData(e,{callback:function(){this.resetDirty()}}))}),d("a[data-href-placeholder]").each(function(){var e=d(this).data("href-placeholder").replace("__replaceme",t.slug);d(this).attr("href",e)})),r.datetime.update(),f()}).fail(function(e){r.events.fire("Bolt.Content.Save.Fail");var t=d.parseJSON(e.responseText),i="<b>"+s+"</b><br><small>"+t.error.message+"</small>";d("p.lastsaved").html(i).addClass("alert alert-danger"),d("#sidebar_save i, #content_edit_save i").removeClass("fa-flag fa-spin fa-spinner").addClass("fa-exclamation-triangle")}).always(function(){r.events.fire("Bolt.Content.Save.Always"),c.setTimeout(function(){d("#sidebar_save, #content_edit_save, #live_editor_save").removeClass("disabled").blur()},1e3),c.setTimeout(function(){d("#sidebar_save i, #content_edit_save i").addClass("fa-flag")},5e3)}))}),d("#sidebar_save_return").bind("click",function(){d("#content_edit_save_return").trigger("click")}),d("#content_edit_save_return").bind("click",function(){h(),s()}),d("#sidebar_save_create").bind("click",function(){d("#content_edit_save_create").trigger("click")}),d("#content_edit_save_create").bind("click",function(){h(),s(),r.actions.submit(d(\'form[name="content_edit"]\'),this)}),(i=d(\'form[name="content_edit"]\')).find("#sidebar_preview").attr("disabled",!1),i.find("#content_edit_preview").attr("disabled",!1),d("#sidebar_preview").bind("click",function(){d("#content_edit_preview").trigger("click")}),d("#content_edit_preview").bind("click",function(e){var t=d(e.target).data("url");e.preventDefault(),i.attr("action",t).attr("target","_blank").submit(),i.attr("action","").attr("target","_self")}),d("#sidebar_delete").bind("click",function(){d("#content_edit_delete").trigger("click")}),d("#content_edit_delete").bind("click",function(e){e.preventDefault();var i=this;o.confirm(r.data("editcontent.delete"),function(e){var t;d(".alert").alert(),!0===e&&(t=d(\'form[name="content_edit"]\'),c.onbeforeunload=null,r.actions.submit(t,i))})}),n=c.location.hash,a=d("#filtertabs"),n&&a.find(\'a[href="#tab-\'+n.replace(/^#/,"")+\'"]\').tab("show"),a.find("a").click(function(){var e;d(this).tab("show"),e=d("body").scrollTop(),c.location.hash=this.hash.replace(/^#tab-/,""),d("html,body").scrollTop(e)}),r.liveEditor.init(e),c.setTimeout(function(){d("#content_edit_save").is("*")&&(d("body, input").bind("keydown","ctrl+s meta+s",function(e){e.preventDefault(),f(),d("#content_edit_save").trigger("click")}),c.setTimeout(function(){f()},1e3))},1e3)},r.editcontent=e}(Bolt||{},jQuery,window,moment,bootbox,"undefined"!=typeof CKEDITOR?CKEDITOR:void 0),function(I,R){"use strict";var A,t,e={};function D(e){return R(".extend-bolt-container").find(e)}function O(e){var t,i,n="",a="",o="";try{n=R.parseJSON(e.responseText)}catch(e){}void 0===n.error?(o="This was the received response:\\n\\n<textarea>"+(t=e.responseText,((i=R(t)).find("h1, h2, h3, p").text()||i.text()).trim().replace(/ +/g," ").replace(/\\s+\\n/g,"\\n"))+"</textarea>\\n\\nInspect the console output in the browser\'s Debug Inspector for more details.",a=I.data("extend.packages.error",{"%ERROR_TYPE%":"Unknown Error","%ERROR_MESSAGE%":o,"%ERROR_LOCATION%":""}),console.error(e)):a="Bolt\\\\Exception\\\\PackageManagerException"===n.error.type?(o=n.error.message.replace(/(<http)/g,\'<a href="http\').replace(/(\\w+>)/g,\'">this link</a>\'),I.data("extend.packages.error",{"%ERROR_TYPE%":"Composer Error","%ERROR_MESSAGE%":o,"%ERROR_LOCATION%":""})):"Bolt\\\\Exception\\\\ExtensionsInfoServiceException"===n.error.type?(o=n.error.message,I.data("extend.packages.error",{"%ERROR_TYPE%":"Extension Site Error","%ERROR_MESSAGE%":o,"%ERROR_LOCATION%":""})):I.data("extend.packages.error",{"%ERROR_TYPE%":"PHP Error","%ERROR_MESSAGE%":n.error.message,"%ERROR_LOCATION%":"File: "+n.error.file+"::"+n.error.line}),R(".modal").modal("hide"),bootbox.alert(a)}function $(){D(".installed-container").each(function(){var n=R(this).find(".installed-list");A=D(".installed-container .console"),R.get(I.data("extend.baseurl")+"installed",function(e){var t,i="";"object"==typeof e?(n.show(),n.find(".installed-list-items").html(""),D(".installed-container .console").hide(),t=!0,"object"==typeof e&&(i+=function(e){var t="";for(var i in e)if(e.hasOwnProperty(i)){var n=e[i],a=I.data("extend.packages"),o=[],s=[],l=0;if(n.authors&&0<n.authors.length)for(l=0;l<n.authors.length;l++)o.push(a.author.subst({"%AUTHOR%":n.authors[l].name}));if(o=o.length?a.authors.subst({"%AUTHORS%":o.join(", ")}):"",n.keywords&&0<n.keywords.length)for(l=0;l<n.keywords.length;l++)s.push(a.keyword.subst({"%KEYWORD%":n.keywords[l]}));s=s.length?a.keywords.subst({"%KEYWORDS%":s.join(" ")}):"","wikimedia/composer-merge-plugin"===n.name&&(n.title="Local Extension Helper");var r="",d={"%NAME%":n.name,"%VERSION%":n.version,"%BASEURL%":I.data("extend.baseurl"),"%MARKETPLACE_URL%":"https://market.bolt.cm/view/"+n.name,"%REPOSITORY_URL%":n.repositoryLink},r="installed"===n.status&&"composer-plugin"!==n.type?a.manage_dropdown_installed.subst(d):a.manage_dropdown_uninstalled.subst(d),c=a.left_buttons.subst({"%README%":null!==n.readmeLink?a.readme_button.subst({"%README%":n.readmeLink}):"","%CONFIG%":null!==n.configLink?a.config_button.subst({"%CONFIG%":n.configLink}):"","%THEME%":"bolt-theme"===n.type?a.theme_button.subst({"%NAME%":n.name}):""});t+=a.item.subst({"%TITLE%":n.title?n.title:n.name,"%NAME%":n.name,"%VERSION%":n.version,"%AUTHORS%":o,"%TYPE%":n.type,"%MANAGE%":r,"%DETAILS%":c,"%BASEURL%":I.data("extend.baseurl"),"%DESCRIPTION%":n.description?a.description.subst({"%DESCRIPTION%":n.description}):"","%KEYWORDS%":s,"%STATUS%":!1===n.valid?" — [INVALID] ":"","%ENABLED%":!1===n.enabled?" — [DISABLED] ":"","%CONSTRAINT%":null!==n.constraint?\'<i class="fa fa-cog fa-fw"></i> Requires Bolt \'+n.constraint:""})}return t}(e),t=!1),t&&(i=I.data("extend.packages.empty"),A.hide()),n.find(".installed-list-items").append(i)):A.html(I.data("extend.text.bad-json"))}).fail(function(e){O(e)})})}var i,B=(i=0,function(e,t){clearTimeout(i),i=setTimeout(e,t)});function M(e,t,i){var n=D(".update-container");e&&n.find(".update-output-title").html(e),t&&(n.find(".update-output-console").find(".console").html(t),n.find(".update-output-console").show()),i&&n.find(".update-output-notice").html(i).show(),n.show()}function F(e,t){var i=D(".update-container");e&&i.find(".update-output-console").find(".console").html(e).show(),t&&i.find(".update-output-notice").html(t).show()}function o(e){var t,i,n="";for(var a in e)e.hasOwnProperty(a)&&void 0!==(t=e[a])&&(i="approved"===t.buildStatus?" label-success":"",n+=I.data("extend.packages.versions",{"%NAME%":t.name,"%VERSION%":t.version,"%CLASS%%":i,"%BUILDSTATUS%":t.buildStatus}));return n}function U(e){A=D(".update-output"),R.get(I.data("extend.baseurl")+"installInfo?package="+e,function(e){var t=e.dev,i=e.beta,n=e.RC,a=e.stable;D(".dev-version-container .installed-version-item").html(""),0<a.length?(D(".stable-version-container .installed-version-item").html(""),D(".stable-version-container .installed-version-item").append(o(a)),D(".latest-version-container .installed-version-item").html(""),D(".latest-version-container .installed-version-item").append(o([e.stable[0]])),D(".install-latest-container").show()):D(".install-version-container").show(),0<n.length&&D(".dev-version-container .installed-version-item").append(o(n)),0<i.length&&D(".dev-version-container .installed-version-item").append(o(i)),0<t.length&&D(".dev-version-container .installed-version-item").append(o(t)),D("#installModal .loader").hide()}).fail(function(e){O(e)})}function P(e,t){R.get(I.data("extend.baseurl")+"packageInfo",{package:e,version:t}).done(function(e){var t,i,n;"bolt-extension"===e.type&&(t=e,D(".extension-postinstall").show(),D(".extension-postinstall .modal-success").show(),D(".postinstall-footer .ext-link").attr("href",t.source),D(".postinstall-footer").show()),"bolt-theme"===e.type&&(n=(i=e).name.split(/\\/+/).pop(),D(".install-response-container").hide(),D(".theme-postinstall").show(),D(".theme-generation-container").show(),D(".theme-postinstall .theme-generator").data("theme",i.name),D(".theme-postinstall #theme-name").val(n),D(".postinstall-footer").show())}).fail(function(e){O(e)})}var n=function(e){var t,i,n,a,o,s,l,r,d,c,u,p,f,h,m,g,v,b,_,k,w,y,x,C,E,T,S;switch(R(e.target).data("request")){case"update-check":D(".update-container").show(),S=D(".update-output-console").html(),D(".update-output-notice").html(S),D(".update-output-notice").find(".update-output-element").removeClass("update-output-element").addClass("update-output").show(),D(".update-list").hide(),(T=D(".update-list-items")).html(""),(A=D(".update-output")).html(I.data("extend.text.updating")),R.get(I.data("extend.baseurl")+"check",function(e){if(0<e.updates.length||0<e.installs.length){var t,i;for(t in e.installs)e.installs.hasOwnProperty(t)&&(i=e.installs[t],T.append(I.data("extend.packages.install_new",{"%PACKAGE%":i.name,"%VERSION%":i.version,"%PRETTYVERSION%":i.prettyversion})));for(t in e.updates)e.updates.hasOwnProperty(t)&&(i=e.updates[t],T.append(I.data("extend.packages.install_update",{"%PACKAGE%":i.name,"%VERSION%":i.version,"%PRETTYVERSION%":i.prettyversion})));A.hide(),D(".update-list").show()}else A.html(I.data("extend.text.updated"))}).fail(function(e){O(e)});break;case"update-run":M(I.data("extend.text.running-update-all"),I.data("extend.text.running-update"),!1),R.get(I.data("extend.baseurl")+"update",function(e){setTimeout(function(){D(".update-container").hide()},7e3),F(e),$()}).fail(function(e){O(e)});break;case"update-package":x=e.originalEvent,C=D(".update-output").html(I.data("extend.text.updating")),E=R(x.target).data("package"),C.show(),A=C,R.get(I.data("extend.baseurl")+"update?package="+E).success(function(e){D(".update-output").html(e),D(\'.update-list-items tr[data-package="\'+E+\'"]\').remove(),B(function(){A.hide()},4e3),D(".update-list-items tbody tr").length<1&&D(".update-container").hide(),$()}).fail(function(e){O(e)}),x.preventDefault();break;case"check-package":k=e.originalEvent,w=D(\'input[name="check-package"]\').val(),(y=D(\'input[name="check-package"]\').data("packagename"))&&(w=y),U(w),k.preventDefault();break;case"uninstall-package":!function(e){var t=D(".installed-container .console").html(I.data("extend.text.removing"));if(!1===confirm(I.data("extend.text.confirm-remove")))return e.stopPropagation(),e.preventDefault();t.show(),A=t,R.get(R(e.target).attr("href")).done(function(e){D(".installed-container .console").html(e),$(),B(function(){A.hide()},2e3)}).fail(function(e){O(e)}),e.preventDefault()}(e.originalEvent);break;case"install-package":v=e.originalEvent,b=R(v.target).data("package"),_=R(v.target).data("version"),D(".install-response-container").show(),D(".install-latest-container").hide(),D(".install-version-container").hide(),(A=D(".install-response-container .console")).html(I.data("extend.text.installing")),D("#installModal .loader .message").html(I.data("extend.text.installing")),R.get(I.data("extend.baseurl")+"install",{package:b,version:_}).done(function(){P(b,_),D(".install-response-container").hide(),D(".check-package").show(),D(\'input[name="check-package"]\').val(""),$()}).fail(function(e){O(e)}),v.preventDefault();break;case"prefill-package":m=e.originalEvent,g=R(m.target),D(\'input[name="check-package"]\').val(g.closest("a").text()),D(\'input[name="check-package"]\').data("packagename",g.data("packagename")),D(".auto-search").hide();break;case"install-run":h=e.originalEvent,M(I.data("extend.text.install-running"),I.data("extend.text.install-all"),!1),R.get(I.data("extend.baseurl")+"installAll",function(e){B(function(){D(".update-container").hide()},7e3),F(e),$()}).fail(function(e){O(e)}),h.stopPropagation(),h.preventDefault();break;case"autoload-dump":f=e.originalEvent,M(I.data("extend.text.autoloader-update"),I.data("extend.text.autoloader-start")+" …",!1),R.get(I.data("extend.baseurl")+"dumpAutoload",function(e){B(function(){D(".update-container").hide()},7e3),F(e)}).fail(function(e){O(e)}),f.stopPropagation(),f.preventDefault();break;case"generate-theme":c=e.originalEvent,u=R(c.target).data("theme"),p=D("#theme-name").val(),R.get(I.data("extend.baseurl")+"generateTheme",{theme:u,name:p}).done(function(e){D(".theme-generate-response").html("<p>"+e+"</p>").show(),D(".theme-generation-container").hide()}).fail(function(e){O(e)}),c.preventDefault();break;case"package-available":d=e.originalEvent,U(R(d.target).data("available"));break;case"package-copy":o=e.originalEvent,l=R(o.target).data("theme"),r=D("#theme-name").val(),confirm(I.data("extend.text.overwrite"))&&((s=D(".installed-container .console").html(I.data("extend.text.copying"))).show(),A=s,R.get(I.data("extend.baseurl")+"generateTheme",{theme:l,name:r}).done(function(e){A.html(e),B(function(){s.hide()},5e3)}).fail(function(e){O(e)})),o.preventDefault();break;case"package-readme":a=e.originalEvent,R.get(R(a.target).data("readme")).done(function(e){bootbox.dialog({message:e||"Readme is empty."})}).fail(function(e){O(e)}),a.preventDefault();break;case"package-depends":t=e.originalEvent,i=R(t.target).data("needle"),n=R(t.target).data("constraint"),D(".dependency-response-container").show(),D(".install-latest-container").hide(),D(".install-version-container").hide(),(A=D(".dependency-response-container .console")).html(""),R.get(I.data("extend.baseurl")+"depends",{needle:i,constraint:n}).done(function(e){D(".loader").hide(),D(".dependency-response-container").hide(),D(".check-package").show(),D(\'input[name="check-package"]\').val("");var t=D("#installModal .extension-dependencies-list");t.html(""),e.forEach(function(e){t.append("<li>"+e.link+"</li>")}),t.show(),D(".extension-dependencies").show(),D(".postinstall-footer").show()}).fail(function(e){O(e)}),t.preventDefault();break;case"show-all":e.originalEvent,D(".install-latest-container").hide(),D(".install-version-container").show()}};e.init=function(){var o,e=R(".extend-bolt-container");e.length&&(e.on("click",n),R(document).ajaxStart(function(){t=setInterval(function(){A&&A.append(".")},1e3)}).ajaxSuccess(function(){clearInterval(t)}).ajaxError(function(){clearInterval(t)}),$(),(o=D(\'input[name="check-package"]\')).on("keyup",function(){var e=R(this).val();e.length<3||B(function(){R.ajax({url:I.data("extend.siteurl")+"list.json",dataType:"jsonp",data:{name:e,bolt:I.data("extend.sitever")}}).success(function(e){if(e.packages.length){var t,i,n=o.parent().find(".auto-search");for(var a in n.html("").show(),e.packages){e.packages.hasOwnProperty(a)&&(i=\'data-request="prefill-package" data-packagename="\'+(t=e.packages[a]).name+\'"\',n.append(\'<a class="btn btn-block btn-default prefill-package" \'+i+\'style="text-align: left;">\'+t.title+" <small "+i+">("+t.authors+" - "+t.name+")</small></a>"))}o.on("blur",function(){n.fadeOut()})}})},500)}),R("#installModal").on("hide.bs.modal",function(){D(".latest-version-container .installed-version-item").html(\'<tr><td colspan="3"><strong>\'+I.data("extend.text.no-stable")+"</strong></td></tr>"),D(".stable-version-container .installed-version-item").html(\'<tr><td colspan="3"><strong>\'+I.data("extend.text.no-stable")+"</strong></td></tr>"),D(".dev-version-container .installed-version-item").html(\'<tr><td colspan="3"><strong>\'+I.data("extend.text.no-test")+"</strong></td></tr>"),D(".install-response-container .console").html(I.data("extend.text.installing")),D(".theme-postinstall").hide(),D(".theme-generate-response").hide(),D(".extension-postinstall").hide(),D(".install-response-container").hide(),D(".install-latest-container").hide(),D(".install-version-container").hide(),D(".postinstall-footer").hide(),D("#installModal .loader").show()}))},I.extend=e}(Bolt||{},jQuery),function(e,i){"use strict";var t={},n={},a=/^([a-zA-Z0-9_-]+)(?:\\.([a-zA-Z0-9_-]+))?(?:\\.([a-zA-Z0-9_-]+))?(?:\\.([a-zA-Z0-9_-]+))?$/;t.fire=function(e,t){var i=a.exec(e);if(i&&void 0!==i[4])for(;e;)n[e]&&n[e].fire({namespace:i[1],domain:i[2],event:i[3],status:i[4]},t),e=e.replace(/\\.?[a-zA-Z0-9_-]+$/,"")},t.on=function(e,t){a.exec(e)&&(n[e]||(n[e]=i.Callbacks("unique")),n[e].add(t))},t.off=function(e,t){a.exec(e)&&n[e]&&n[e].remove(t)},e.events=t}(Bolt||{},jQuery),function(o,s){"use strict";var e={};function l(e,t,i,n){var a={url:e,type:"POST",data:t,success:function(){document.location.reload()},error:function(e){alert(e.responseText),console.error(i)}};n&&(a.success=n),s.ajax(a)}e.createFile=function(e,t,i){var n=window.prompt(o.data("files.msg.create_file"));n.length&&l(o.data("url.file.create"),{filename:n,parentPath:t,namespace:e,token:i},"Something went wrong creating this file!")},e.renameFile=function(e,t,i,n){var a=window.prompt(o.data("files.msg.rename_file"),i);a.length&&a!==i&&l(o.data("url.file.rename"),{namespace:e,parent:t,oldname:i,newname:a,token:n},"Something went wrong renaming this file!")},e.deleteFile=function(e,t,i,n){confirm(o.data("files.msg.delete_file",{"%FILENAME%":t}))&&l(o.data("url.file.delete"),{namespace:e,filename:t,token:i},"Failed to delete the file from the server",function(){null!==n&&s(n).closest("tr").slideUp()})},e.duplicateFile=function(e,t,i){l(o.data("url.file.duplicate"),{namespace:e,filename:t,token:i},"Something went wrong duplicating this file!")},e.createFolder=function(e,t,i){var n=window.prompt(o.data("files.msg.create_folder"));n.length&&l(o.data("url.folder.create"),{parent:t,foldername:n,namespace:e,token:i},"Something went wrong renaming this folder!")},e.renameFolder=function(e,t,i,n){var a=window.prompt(o.data("files.msg.rename_folder"),i);a.length&&a!==i&&l(o.data("url.folder.rename"),{namespace:e,parent:t,oldname:i,newname:a,token:n},"Something went wrong renaming this folder!")},e.deleteFolder=function(e,t,i,n){window.confirm(o.data("files.msg.delete_folder",{"%FOLDERNAME%":i}))&&l(o.data("url.folder.delete"),{namespace:e,parent:t,foldername:i,token:n},"Something went wrong renaming this folder!")},o.files=e}(Bolt||{},jQuery),function(i,a,n){"use strict";var e={};function t(){var n=a(this).val();a(".dashboardlisting").find("[data-bolt-browse-name]").each(function(){var i=a(this).data("bolt-browse-name"),e=i.search(n)<0;a(this).toggleClass("hidden",e),e||a(this).find(".name").each(function(){var e,t;a(this).html((t="<mark>"+(e=n)+"</mark>",i.replace(new RegExp(e.replace(/([.*+?^=!:${}()|\\[\\]\\/\\\\])/g,"\\\\$1"),"g"),t))),0===n.length&&a(this).html(i)})})}function o(){for(var e=document.querySelectorAll("img[data-src]"),t=0;t<e.length;t++)e[t].getAttribute("data-src")&&(e[t].setAttribute("src",e[t].getAttribute("data-src")),e[t].removeAttribute("data-src"))}function s(){var e=a(\'form[name="file_upload"]\').find("#file_upload__token").val(),t=new n(document.body,{url:i.conf("uploadConfig.url"),previewsContainer:"#dropzone-preview",acceptedFiles:"."+i.conf("uploadConfig.acceptFileTypes").join(",."),uploadMultiple:"true",enqueueForUpload:"true",hiddenInputContainer:".form-horizontal",paramName:"file_upload[select]",clickable:!1,autoProcessQueue:!0,params:{"file_upload[_token]":e},init:function(){var e,t,i;e=this,t=a("body"),i=0,t.bind({dragenter:function(e){e.preventDefault(),i++,a(this).addClass("dropzone-active")},dragleave:function(){0===--i&&a(this).removeClass("dropzone-active")}}),e.on("drop",function(){t.removeClass("dropzone-active")})}});t.on("sending",function(){a(".panel-uploadprogress").removeClass("hidden")}),t.on("complete",function(e){t.removeFile(e)}),t.on("totaluploadprogress",function(e){100===e&&window.setTimeout(function(){location.reload()},200)})}e.init=function(){n.autoDiscover=!1,null!==document.querySelector("div.file-manager")&&(s(),document.getElementById("file-manager-search").addEventListener("keyup",t),a("#file_upload_select").addClass("btn-secondary").bootstrapFileInput(),document.getElementById("file_upload_select").addEventListener("change",function(){document.getElementById("file_upload_upload").removeAttribute("disabled")}),window.addEventListener("load",o))},i.filemanager=e}(Bolt||{},jQuery,Dropzone),function(d,c,o){"use strict";var u={},p=["text","html","textarea"],a=null;u.init=function(e){u.previewUrl=e.previewUrl,Modernizr.contenteditable?(c("#sidebar_live_edit, #content_edit_live_edit").bind("click",u.start),c(".close-live-editor").bind("click",u.stop),c(".save-live-editor").bind("click",u.save)):c(".live-editor, #sidebar_live_editor, #content_edit_live_edit").remove()},u.start=function(){var e,t,i,l,n,r=c(\'form[name="content_edit"]\');d.validation.run(r[0])&&(e=r.find("*[name=_live-editor-preview]"),t=c("#navpage-primary").find(".navbar-header a"),i=c("#live-editor-iframe"),l=function(e){e.preventDefault()},n=function(){var e=i[0],n=e.contentWindow||e,a=n.document,t=c(a);t.on("click","a",l);var o=d.ckeditor.initcke(n.CKEDITOR),s=o.editorConfig;o.editorConfig=function(e){for(var t in s.bind(this)(e),e.toolbar){var i;"tools"!==e.toolbar[t].name||-1<(i=e.toolbar[t].items.indexOf("Source"))&&delete e.toolbar[t].items[i]}},o.disableAutoInline=!1,t.find("[data-bolt-field]").each(function(){var e,t,i=r.find("*[name="+u.escapejQuery(c(this).data("bolt-field"))+"]").closest("[data-bolt-fieldset]").data("bolt-fieldset");c(this).addClass("bolt-editable"),c(this).data("no-edit")||-1===p.indexOf(i)||(c(this).attr("contenteditable",!0),"html"===i?(e=o.inline(this,{allowedContent:""}),t=d.utils.debounce(function(){e.element.data("src",e.getData())},500),e.on("instanceReady",t),e.on("change",t)):(c(this).on("paste",function(e){var t;e.preventDefault(),e.originalEvent.clipboardData?(t=e.originalEvent.clipboardData.getData("text/plain"),a.execCommand("insertText",!1,t)):n.clipboardData&&(t=n.clipboardData.getData("Text"),n.getSelection&&n.getSelection().getRangeAt(0).insertNode(a.createTextNode(t)))}),"textarea"===i?c(this).on("keypress",function(e){13===e.which&&(e.preventDefault(),a.execCommand("insertHTML",!1,"<br><br>"))}):c(this).on("keypress",function(e){return 13!==e.which}).on("focus blur",function(){c(this).html(c(this).text())})))})},i.on("load",n),d.liveEditor.active=!0,c("body").addClass("live-editor-active"),t.on("click",l),e.val("yes"),r.attr("action",u.previewUrl).attr("target","live-editor-iframe").submit(),r.attr("action","").attr("target","_self"),e.val(""),a=function(){i.off("load",n),t.off("click",l)})},u.save=function(){u.extractText(),c("#content_edit_save").trigger("click")},u.stop=function(){var e=c("#live-editor-iframe")[0];u.extractText(),c(e).attr("src",""),d.liveEditor.active=!1,c("body").removeClass("live-editor-active"),a()},u.extractText=function(){var e=c("#live-editor-iframe")[0],t=(e.contentWindow||e).document;c(t).find("[data-bolt-field]").each(function(){var e,t=c(\'form[name="content_edit"]\'),i=c(this).data("bolt-field"),n=t.find("[name="+u.escapejQuery(i)+"]"),a=n.closest("[data-bolt-fieldset]").data("bolt-fieldset");"html"===a?(e=n.attr("id"),o.instances.hasOwnProperty(e)&&o.instances[e].setData(c(this).data("src"))):n.val(u.cleanText(c(this),a))})},u.cleanText=function(e,t){return"textarea"===t&&e.html(e.html().replace(/&nbsp;/g," ").replace(/\\s?<br.*?>\\s?/g,"\\n")),e.text()},u.escapejQuery=function(e){return e.replace(/[:\\.\\[\\],]/g,"\\\\$1")},u.active=!1,u.previewUrl=null,d.liveEditor=u}(Bolt||{},jQuery,(window,"undefined"!=typeof CKEDITOR?CKEDITOR:void 0)),function(t,n,i){"use strict";var e={init:function(){var e=n(".omnisearch select");e.select2({width:"100%",placeholder:t.data("omnisearch.placeholder"),minimumInputLength:3,multiple:!0,ajax:{delay:600,url:e.data("omnisearchUrl"),dataType:"json",data:function(e){return{q:e.term}},processResults:function(e){var i=[];return n.each(e,function(e,t){i.push({id:t.path,path:t.path,text:t.label})}),{results:i}}},templateResult:function(e){var t=e.path?"<small>"+e.path+"</small>":"";return"<div>"+(e.loading?\'<i class="fa fa-spinner fa-spin"></i> \':"")+e.text+"</div>"+t},templateSelection:function(e){return i.location.href=e.path,null},escapeMarkup:function(e){return e}})}};t.omnisearch=e}(Bolt||{},jQuery,window),function(e,s,l){"use strict";var t={},n=0;function r(){var e=s("#navpage-content").outerHeight(),t=s("#navpage-secondary"),i=t.outerHeight(),n=s(document).height()-t.position().top,a=Math.max(e,n),o=5e3;i!==a&&(t.outerHeight(a),o=500),l.setTimeout(r,o)}t.init=function(){var e=!s(".navbar-toggle").is(":visible");s(".navbar-toggle").on("click",function(){var e=s("#navpage-wrapper");e.hasClass("nav-secondary-opened")?e.removeClass("nav-secondary-opened nav-secondary-collapsed"):e.removeClass("nav-secondary-collapsed").addClass("nav-secondary-opened")}),s(".nav-secondary-collapse a").on("click",function(){return s("#navpage-wrapper").removeClass("nav-secondary-opened").addClass("nav-secondary-collapsed"),setTimeout(function(){s("#navpage-wrapper").addClass("nav-secondary-collapsed-hoverable")},300),s.cookie("sidebar","collapsed",{expires:21,path:"/"}),s("#bolt-footer").addClass("bolt-footer-hidden"),!1}),s(".nav-secondary-expand a").on("click",function(){return s("#navpage-wrapper").removeClass("nav-secondary-collapsed nav-secondary-opened nav-secondary-collapsed-hoverable"),s.removeCookie("sidebar",{path:"/"}),s("#bolt-footer").removeClass("bolt-footer-hidden"),!1}),s("#navpage-secondary").length&&r(),e?s("#navpage-secondary").find("a.menu-pop").each(function(){var e=s(this),t="";e.nextAll(".submenu").children().each(function(){s(this).hasClass("subdivider")&&(t+="<hr>"),t+=s(this).html().trim().replace(/[ \\n]+/g," ").replace(/(>) | (<)/g,"$1$2")}),e.popover({trigger:"manual",content:t,html:!0}),e.on("mouseover focus click dblclick",function(e){var t=this,i=300;"click"!==e.type||s(t).next().hasClass("popover")||(e.preventDefault(),i=0),l.clearTimeout(n),n=l.setTimeout(function(){s("#navpage-secondary a.menu-pop").not(t).popover("hide"),s(t).popover("show")},i)})}).end().on("mouseenter focus",".popover",function(){l.clearTimeout(n)}).on("mouseleave blur","a.menu-pop, .popover",function(){l.clearTimeout(n),n=l.setTimeout(function(){s("#navpage-secondary a.menu-pop").popover("hide")},300)}):s("#navpage-secondary a.menu-pop").on("click",function(e){var t=s(this).nextAll(".submenu");e.preventDefault(),t.hasClass("show")?t.removeClass("show"):(s("#navpage-secondary .submenu").removeClass("show"),t.addClass("show"))})},e.secmenu=t}(Bolt||{},jQuery,window),function(t,n){"use strict";var a={init:function(){n("a[data-bolt-addtostack]").each(function(){n(this).on("click",function(e){var t=n(e.currentTarget),i=t.data("bolt-addtostack");e.preventDefault(),a.addToStack(i,t)})})},addToStack:function(e,i){n.post(t.conf("stackAddUrl"),{filename:e}).done(function(t){i&&n(i).addClass("disabled"),n(":bolt-buicStack").buicStack("prepend",t.panel,t.removed),t.removed&&n(".select-from-stack [data-file]").each(function(){n(this).data("file").fullPath===t.removed&&n(this).remove()}),n(".select-from-stack").each(function(){var e=n(this).data("type");e&&t.type!==e||n(this).prepend(t.list)})}).fail(function(){console.error("Failed to add file to stack")})}};t.stack=a}(Bolt||{},jQuery),function(i){"use strict";var e={humanBytes:function(e){for(var t=-1;++t<8&&1e3<=Math.abs(e);)e/=1e3;return(e="object"==typeof Intl&&Intl&&"function"==typeof Intl.NumberFormat?e.toLocaleString(i.conf("locale.long").replace(/_/g,"-"),{maximumSignificantDigits:3}):e.toFixed(2))+" "+" kMGTPEZY"[t].trim()+"B"},filterInt:function(e,t){return/^(\\-|\\+)?([0-9]+|Infinity)$/.test(e)?Number(e):t||NaN},debounce:function(n,a,o){var s;return function(){var e=this,t=arguments,i=o&&!s;clearTimeout(s),s=setTimeout(function(){s=null,o||n.apply(e,t)},a),i&&n.apply(e,t)}}};i.utils=e}(Bolt||{}),function(){"use strict";jQuery.widget("bolt.baseField",{_create:function(){}})}(),function(a){"use strict";var o={};a.widget("bolt.baseInterval",{options:{delay:1e4},_create:function(){var e,t,i=this,n=this.widgetName;o[n]||(e=a.Callbacks(),t=setInterval(e.fire,this.options.delay),o[n]={id:t,delay:this.options.delay,callbacks:e}),this._fncUpdate=function(){i._update()},o[n].callbacks.add(this._fncUpdate)},_destroy:function(){var e=this.widgetName;o[e].callbacks.remove(this._fncUpdate),o[e].callbacks.has()||(clearInterval(o[e].id),delete o[e])}})}(jQuery),function(l){"use strict";l.widget("bolt.buicBrowser",{options:{url:"",multiselect:!1},_create:function(){this._url=this.options.url,this._on({click:function(){this._browse()}})},_browse:function(){var a=this,e={multiselect:this.options.multiselect},o=[],s=!1;l("body").buicModal({size:"large",remote:{url:a._url,data:e},loaded:function(e,n){var i=n.footer.find("[data-fbrowser-add-checked]");n.header.on("click.bolt","[data-fbrowser-chdir]",function(e){e.preventDefault(),a._url=l(this).data("fbrowser-chdir"),a._browse()}),n.body.on("click.bolt","[data-fbrowser-chdir]",function(e){e.preventDefault(),a._url=l(this).data("fbrowser-chdir"),a._browse()}).on("click.bolt","[data-file] a",function(e){e.preventDefault();var t=l(this).closest("[data-file]").data("file");a._trigger("selected",null,t),n.close()}).on("click.bolt","[aria-pressed]",function(e){var t="false"===l(this).attr("aria-pressed"),i=this.className.replace("toogle-","");l(this).attr("aria-pressed",t?"true":"false"),n.body.find("tbody."+i).toggleClass("hidden",!t),0<e.clientX&&this.blur()}).on("change",\'select[name="ext"]\',function(){a._filter(n)}).keyup(\'input[name="filter"]\',function(){a._filter(n)}).on("change","[data-fbrowser-check]",function(){var e=l(this).closest("[data-file]").data("file"),t=o.indexOf(e.fullPath);-1<t?(o.splice(t,1),s=!1,0===o.length&&i.addClass("disabled")):(o.push(e.fullPath),i.removeClass("disabled"))}),n.footer.on("click.bolt",".toggle-all",function(e){e.preventDefault(),s?(n.body.find("[data-fbrowser-check]").each(function(){l(this).prop("checked",!1)}),o.length=0,s=!1,i.addClass("disabled")):(n.body.find("[data-fbrowser-check]").each(function(){l(this).prop("checked",!0);var e=l(this).closest("[data-file]").data("file");o.push(e.fullPath)}),s=!0,i.removeClass("disabled"))}).on("click.bolt","[data-fbrowser-add-checked]:not(.disabled)",function(e){e.preventDefault(),n.body.find("[data-fbrowser-check]").each(function(){var e;l(this).prop("checked")&&(e=l(this).closest("[data-file]").data("file"),a._trigger("selected",null,e))}),n.close()})}})},_filter:function(e){var t,i,n=e.body.find(\'input[name="filter"]\').val(),a=e.body.find(\'select[name="ext"]\').val();e.body.find("[data-file],[data-folder]").each(function(){t=l(this).data("file")||l(this).data("folder"),i=""!==a&&t.extension!==a||""!==n&&t.filename.search(n)<0,l(this).toggleClass("hidden",i),i||l(this).find("a, span").each(function(){l(this).html(t.filename.replace(n,"<mark>"+n+"</mark>"))})})}})}(jQuery),function(){"use strict";jQuery.widget("bolt.buicCheckbox",{_create:function(){var e=this.element.find("button"),t=this.element.find("input");this._on(e,{click:function(){t.prop("checked",!t.prop("checked"))}})}})}(),function(l,r){"use strict";l.widget("bolt.buicListing",{_create:function(){this.csrfToken=this.element.data("bolt_csrf_token"),this.contentType=this.element.data("contenttype"),this.contentTypeName=this.element.data("contenttype-name"),this.element.find("table.listing tbody").buicListingPart()},modifyRecords:function(e,t,i){var n,a=this,o={},s={delete:{safe:!1,name:r.data("recordlisting.action.delete",{"%CTNAME%":this.contentTypeName}),cmd:{delete:null}},publish:{safe:!0,name:r.data("recordlisting.action.publish",{"%CTNAME%":this.contentTypeName}),cmd:{modify:{status:"published"}}},depublish:{safe:!0,name:r.data("recordlisting.action.depublish"),cmd:{modify:{status:"held"}}},draft:{safe:!0,name:r.data("recordlisting.action.draft"),cmd:{modify:{status:"draft"}}}};o[a.contentType]={},l(t).each(function(){o[a.contentType][this]=s[e].cmd}),n=(n=1===t.length?r.data("recordlisting.confirm.one"):r.data("recordlisting.confirm.multi",{"%NUMBER%":"<b>"+t.length+"</b>"}))+"<br><br><b>"+r.data("recordlisting.confirm.no-undo")+"</b>",s[e].safe?a._sendModifyRecordsQuery(o):bootbox.dialog({message:n,title:s[e].name,buttons:{cancel:{label:r.data("recordlisting.action.cancel"),className:"btn-default"},ok:{label:i,className:"btn-danger",callback:function(){a._sendModifyRecordsQuery(o)}}}})},_sendModifyRecordsQuery:function(e){var t=this;l.ajax({url:r.conf("contentActionUrl"),type:"POST",data:{bolt_csrf_token:t.csrfToken,contenttype:t.contentType,actions:e},success:function(e){t.element.html(e),t.element.find("table.listing tbody").buicListingPart()},error:function(e,t,i){console.error(e.status+" ("+i+"):"),console.error(JSON.parse(e.responseText))},dataType:"html"})}})}(jQuery,Bolt),function(a){"use strict";a.widget("bolt.buicListingPart",{_create:function(){var t=this;this.listing=this.element.closest(":bolt-buicListing"),this.toolbar=this.element.find("tr.selectiontoolbar"),this.toolbarCount=this.toolbar.find("div.count"),this.menu=this.element.find("tr.header th.menu"),this.menuOnlyOnSelection=this.menu.find("li:not(.select-all)"),this.menuSelectionCount=this.menu.find("li.dropdown-header"),this.menuSelectionCountTemplate=this.menuSelectionCount.text(),this.selectedIds=[],this.menu.find("li.select-all, li.select-none").on("click",function(){var e=a(this).hasClass("select-all");t.element.find(\'td input:checkbox[name="checkRow"]\').each(function(){this.checked=e,t._update(this)})}),this.element.find(\'td input:checkbox[name="checkRow"]\').on("click",function(){t._update(this)}),this.toolbar.find(\'button[data-stb-cmd^="record:"]\').on("click",function(){t._modifyRecords(a(this).data("stb-cmd"),t.selectedIds,a(this).html())}),this.element.find(\'a[data-listing-cmd^="record:"]\').on("click",function(){t._modifyRecords(a(this).data("listing-cmd"),[a(this).parents("tr").attr("id").substr(5)],a(this).html())})},_modifyRecords:function(e,t,i){0<t.length&&this.listing.buicListing("modifyRecords",e.replace(/^record:/,""),t,i)},_update:function(e){var t,i=a(e).closest("tr"),n=i.attr("id").substr(5);e.checked?(-1===this.selectedIds.indexOf(n)&&this.selectedIds.push(n),i.addClass("row-selected")):(this.selectedIds.splice(this.selectedIds.indexOf(n),1),i.removeClass("row-selected")),(t=this.selectedIds.length)?(this.toolbar.removeClass("hidden"),this.menuOnlyOnSelection.removeClass("hidden")):(this.toolbar.addClass("hidden"),this.menuOnlyOnSelection.addClass("hidden")),this.toolbarCount.text(t),this.menuSelectionCount.text(this.menuSelectionCountTemplate.replace("(#)","("+t+")"))}})}(jQuery),function(l){"use strict";l.widget("bolt.buicModal",{options:{size:void 0,closer:!1,classname:void 0,headline:void 0,header:void 0,body:void 0,footer:void 0,remote:void 0,loaded:void 0},_create:function(){var e=this,t=l(\'<div class="modal-header hidden"/>\'),i=l("<div class=modal-body/>"),n=l(\'<div class="modal-footer hidden"/>\'),a=l("<div class=modal-content/>").append(t,i,n),o=l("<div class=modal-dialog role=document/>").append(a),s=l(\'<div tabindex=-1 role=dialog class="modal fade buic-modal"/>\').append(o);this._ui={header:t,body:i,footer:n,content:a,dialog:o,modal:s},this._on(this.element,{"click .modal-retry":function(){e._load()}}),e.element.prepend(e._ui.modal),e._ui.modal.on("show.bs.modal",function(){e._fire("show")}).on("shown.bs.modal",function(){e._fire("shown")}).on("hide.bs.modal",function(){e._fire("hide")}).on("hidden.bs.modal",function(){e._fire("hidden"),e.destroy()}).modal("show")},_destroy:function(){this._ui.modal.data("modal",null).remove()},_fire:function(e){var t=this;t._trigger(e,null,{close:function(){t._ui.modal.modal("hide")},header:t._ui.header,body:t._ui.body,footer:t._ui.footer})},_init:function(){this._ui.dialog.toggleClass("modal-sm","small"===this.options.size).toggleClass("modal-lg","large"===this.options.size),this.options.remote?this._load():this._update()},_load:function(){var a=this;a._ui.content.addClass("modal-loading"),l.get(a.options.remote.url,a.options.remote.data||{}).done(function(n){a.options.classname=l(n)[0].className,l.each(["header","body","footer"],function(e,t){var i=l(n).children(t.replace("body","main"))[0];a.options[t]=i?i.innerHTML:void 0}),a._update(),a._fire("loaded")}).fail(function(){a.options.header=void 0,a.options.body=\'<button type=button class="btn btn-default modal-retry"><i class="fa fa-refresh"></i></button>\',a.options.footer=void 0,a._update()}).always(function(){a._ui.content.removeClass("modal-loading")})},_update:function(){var i,n=this;void 0!==this.options.headline&&(this.options.header=l(),this.options.closer&&(this.options.header=this.options.header.add(\'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>\')),this.options.header=this.options.header.add(l(\'<h4 class="modal-title"/>\').append(this.options.headline))),this._ui.content.attr("class","modal-content").addClass(this.options.classname),l.each(["header","body","footer"],function(e,t){i=l("<div>").append(n.options[t]).html()||"",n._ui[t].off().toggleClass("hidden",!i.length).html(i)}),this._ui.modal.modal("handleUpdate")}})}(jQuery),function(e,t){"use strict";e.widget("bolt.buicMoment",e.bolt.baseInterval,{options:{delay:15e3,titleFormat:"YYYY-MM-DD HH:mm:ss ZZ"},_create:function(){this.set(),this._super()},_update:function(){this.element.html(t(this.element.attr("datetime")).fromNow())},set:function(e){e?this.element.attr("datetime",t(e).format()):e=this.element.attr("datetime"),this.element.attr("title",t(e).format(this.options.titleFormat)),this._update()}})}(jQuery,moment),function(n){"use strict";n.widget("bolt.buicProgress",{_create:function(){this.bars={},this.element.addClass("buic-progress")},_set:function(e,t){t=parseFloat(t),t=isNaN(t)?0:Math.min(100,Math.max(0,Math.round(100*t))),this.bars[e]&&this.bars[e].find(".progress-bar").attr("aria-valuenow",t).css("width",t+"%")},add:function(e,t,i){this.bars[e]||(this.bars[e]=n(\'<div class="progress"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div></div>\'),this.bars[e].attr("data-label",i||e).find(".progress-bar").text(i||e),this._set(e,t),this.element.append(this.bars[e]).show(),this.bars[e].show(300))},remove:function(e){var t,i;this.bars[e]&&(i=(t=this).bars[e],delete this.bars[e],i.hide(300,function(){i.remove(),0===Object.keys(t.bars).length&&t.element.hide()}))},set:function(e,t){this._set(e,t)}})}(jQuery),function(){"use strict";jQuery.widget("bolt.buicSelect",{_create:function(){this.select=this.element.find("select"),this.buttonAll=this.element.find(".select-all"),this.buttonNone=this.element.find(".select-none"),this.buttonAll.prop("title",this.buttonAll.text().trim()),this._on(this.buttonAll,{click:function(){this.all()}}),this.buttonNone.prop("title",this.buttonNone.text().trim()),this._on(this.buttonNone,{click:function(){this.none()}}),this._update(),this._on(this.select,{change:function(){this._update()}})},_update:function(){var e=this.select.find("option"),t=e.length,i=e.filter(":selected").length,n=this.select.prop("multiple")?0===i:""===this.select.val();this.buttonAll.prop("disabled",i===t),this.buttonNone.prop("disabled",n)},all:function(){this.select.find("option").prop("selected",!0).trigger("change")},none:function(){this.select.val(null).trigger("change")}})}(),function(i,n){"use strict";i.widget("bolt.buicStack",{_addPath:function(e,t){n.stack.addToStack(t.path)},_create:function(){var e=this.element;this._ui={holder:e.find(".stackholder")},this._on({buicbrowserselected:this._addPath,buicuploaduploaded:this._addPath}),e.on("inserted.bs.popover",".stackitem",function(){n.app.initWidgets()}),e.buicUpload()},prepend:function(e,t){t&&this._ui.holder.find("[data-file]").each(function(){i(this).data("file").fullPath===t&&i(this).remove()}),this._ui.holder.find(".empty").remove(),this._ui.holder.prepend(e),this._ui.holder.find(".info-pop").popover({trigger:"hover",delay:{show:500,hide:200}})}})}(jQuery,Bolt),function(l,r){"use strict";l.widget("bolt.buicUpload",{_create:function(){var e,t=this.element,i=l("input[type=file]",t),n=l(".elm-dropzone",t),a=l(i).attr("accept"),o=a?a.replace(/^\\./,"").split(/,\\./):[],s=new RegExp("(\\\\.|\\\\/)("+o.join("|")+")$","i");null===this.options.maxSize&&(e=Math.floor(r.conf("uploadConfig.maxSize")),this.options.maxSize=r.utils.filterInt(e,2e6)),this._ui={progress:null},i.fileupload({dataType:"json",dropZone:n,pasteZone:null,maxFileSize:0<this.options.maxSize?this.options.maxSize:void 0,minFileSize:void 0,acceptFileTypes:a?s:void 0,maxNumberOfFiles:void 0,messages:{maxFileSize:">:"+r.utils.humanBytes(this.options.maxSize),minFileSize:"<",acceptFileTypes:"T:."+o.join(", ."),maxNumberOfFiles:"#"}}),this._on({fileuploadprocessfail:this._onProcessFail,fileuploadsubmit:this._onUploadSubmit,fileuploadprogress:this._onUploadProgress,fileuploadalways:this._onUploadAlways,fileuploaddone:this._onUploadDone})},_onProcessFail:function(e,t){var i,n=t.files[t.index],a=n.error.substr(0,1),o={"%FILENAME%":n.name,"%FILESIZE%":r.utils.humanBytes(n.size),"%FILETYPE%":n.type,"%ALLOWED%":n.error.substr(2)};switch(a){case">":i=r.data("field.uploads.template.large-file",o);break;case"T":i=r.data("field.uploads.template.wrong-type",o);break;default:i="<p>"+n.error+"</p>"}bootbox.alert(i)},_onUploadSubmit:function(e,t){this._progress("add",t.files)},_onUploadProgress:function(e,t){this._progress("set",t.files,t.loaded/t.total)},_onUploadAlways:function(e,t){this._progress("remove",t.files)},_onUploadDone:function(i,e){var n=this;l.each(e.result,function(e,t){t.error?bootbox.alert(r.data("field.uploads.template.error",{"%ERROR%":t.error})):n._trigger("uploaded",i,t)})},_progress:function(e,t,i){var n=this;null===n._ui.progress&&(n._ui.progress=l(":bolt-buicProgress",n.element)),l.each(t,function(){n._ui.progress.buicProgress(e,this.name,i)})},options:{maxSize:null}})}(jQuery,Bolt),function(a,o,i){"use strict";a.widget("bolt.fieldBlock",a.bolt.baseField,{options:{name:""},_create:function(){var i=this;this._ui={add:i.element.find(".block-add .add-button"),slot:i.element.find(".block-slot")},this._templates=i.element.find(\'script[type="text/template"]\'),i._ui.add.on("click",function(e){i._append(e)}),i.element.find(".block-slot").sortable({cursor:"move",handle:".panel-heading",stop:function(e,t){i._renumber(),i._resetEditors(t.item)}}),i.element.on("click",".delete-button",function(){var t=a(this).closest(".block-group");bootbox.confirm(o.data("editcontent.deleteset"),function(e){a(".alert").alert(),!0===e&&(t.remove(),i._renumber())})}),i.element.on("click",".move-up",function(){var e=a(this).closest(".block-group");e.insertBefore(e.prev(".block-group")),i._renumber(),i._resetEditors(e)}),i.element.on("click",".move-down",function(){var e=a(this).closest(".block-group");e.insertAfter(e.next(".block-group")),i._renumber(),i._resetEditors(e)}),i.element.on("click",".repeater-collapse",function(){var e=a(this).closest(".block-group").find(".panel-body");a(this).toggleClass("collapsed"),e.slideToggle()}),i.element.on("click",".hide-all-blocks",function(){var e=a(this).closest(".bolt-field-block"),t=e.find(".panel-body");e.find(".repeater-collapse").addClass("collapsed"),t.slideUp()}),i.element.on("click",".show-all-blocks",function(){var e=a(this).closest(".bolt-field-block"),t=e.find(".panel-body");e.find(".repeater-collapse").removeClass("collapsed"),t.slideDown()}),i.element.on("keyup change","input[type=text]",function(){var e,t,i,n;a(this).closest(".bolt-field-text").length&&(t=(e=a(this).closest(".block-group")).find(".bolt-field-text input:first"),n=(i=e.find(".block-heading")).data("default"),i.text(a(t).val().substring(0,60)||n))})},_append:function(e){var i,n=a(e.target).data("block-type");a.each(this._templates,function(e,t){a(t).data("block-type")===n&&(i=a(t).html())});var t=this._clone(i);t.data("block-type",n),this._ui.slot.append(t),this._renumber(),o.datetime.init(),o.ckeditor.init(),init.popOvers()},_clone:function(e){var i=a(e).clone();return i.find("[id]").each(function(){var e=a(this).attr("id"),t=o.app.buid();a(this).attr("id",t),i.find(\'[for="\'+e+\'"]\').each(function(){a(this).attr("for",t)})}),o.app.initWidgets(i),i},_renumber:function(){var i=new RegExp("^([^\\\\[]+\\\\[)([#|\\\\d]+)(\\\\].*)$","gi");this._ui.slot.find("div.block-group").each(function(e,t){a(t).find("[name]").each(function(){this.name=this.name.replace(i,"$1"+e+"$3")}),a(t).is(":first-of-type")?a(t).find(".move-up").addClass("disabled"):a(t).find(".move-up").removeClass("disabled"),a(t).is(":last-of-type")?a(t).find(".move-down").addClass("disabled"):a(t).find(".move-down").removeClass("disabled")})},_resetEditors:function(e){e.find(".ckeditor").each(function(e,t){i.instances[t.id]&&i.instances[t.id].destroy(),i.replace(t.id)})}})}(jQuery,Bolt,"undefined"!=typeof CKEDITOR?CKEDITOR:void 0),function(e,t){"use strict";e.widget("bolt.fieldCategories",e.bolt.baseField,{_create:function(){this.element.find("select").select2({width:"100%",allowClear:!0,placeholder:{id:"",text:t.data("field.categories.text.placeholder")}})}})}(jQuery,Bolt),function(a,o){"use strict";a.widget("bolt.fieldEmbed",a.bolt.baseField,{_create:function(){var e=this,t=this.element,i=0;this._ui={url:t.find("input.url"),width:t.find("input.width"),height:t.find("input.height"),html:t.find("input.html"),ratio:t.find("input.ratio"),authorName:t.find("input.author_name"),authorUrl:t.find("input.author_url"),provider_name:t.find("input.provider_name"),thumbnailUrl:t.find("input.thumbnail_url"),preview:t.find("img"),play:t.find("button.preview"),refresh:t.find("button.refresh"),spinner:t.find("button.refresh i")},e._ui.url.on("propertychange input",function(){clearTimeout(i),i=setTimeout(function(){e._update()},1e3)}),e._ui.width.on("propertychange input",function(){0<e._ui.ratio.val()&&e._ui.height.val(Math.round(e._ui.width.val()/e._ui.ratio.val()))}),e._ui.height.on("propertychange input",function(){0<e._ui.ratio.val()&&e._ui.width.val(Math.round(e._ui.height.val()*e._ui.ratio.val()))}),e._ui.refresh.on("click",function(){e._update()}),e._ui.play.on("click",function(){a("body").buicModal({size:"large",closer:!0,headline:e._ui.provider_name.val(),body:e._ui.html.val()})})},_update:function(){var t=this,e=o.data("endpoint.embed"),i=a("#id").closest("form").find(\'input[name="content_edit[_token]"]\').val(),n={format:"json",url:t._ui.url.val(),_token:i,provider:"oembed"};n.url.length<2?t._set({}):(this._ui.refresh.prop("disabled",!0),t._ui.spinner.addClass("fa-spin"),a.post(e,n).done(function(e){t._set(e)}).fail(function(){t._set({})}).always(function(){t._ui.spinner.removeClass("fa-spin")}))},_set:function(e){this._ui.html.val(e.html||""),this._ui.width.val(e.width||""),this._ui.height.val(e.height||""),this._ui.authorName.val(e.author_name||""),this._ui.authorUrl.val(e.author_url||""),this._ui.provider_name.val(e.provider_name||""),this._ui.thumbnailUrl.val(e.thumbnail_url||this._ui.preview.data("defaultUrl")),this._ui.refresh.prop("disabled",this._ui.url.val().length<=2||0<this._ui.html.val().length)}})}(jQuery,Bolt),function(n,i){"use strict";n.widget("bolt.fieldFile",n.bolt.baseField,{_create:function(){var i=this,e=this.element,t=n("input.path",e);t.data("selected",{path:t.val()}),t.autocomplete({source:e.find("[data-autocomplete-url]").data("autocompleteUrl"),minLength:2,focus:function(e,t){return i._onPreview(e,t.item),!1},select:function(e,t){return i._onSelect(e,t.item),!1},close:function(){i._onClose()}}).autocomplete("instance")._renderItem=function(e,t){return n("<li>").append(t.path).appendTo(e)},t.on("change",function(){n(this).data("changeWithoutSelection",!0)}),t.on("blur",function(){n(this).data("changeWithoutSelection")&&(""===n(this).val()?i._onClear():i._onClose())}),i._on({"click.select-from-stack a":i._onSelectFromStack,buicbrowserselected:i._onSelect,buicuploaduploaded:i._onSelect}),e.buicUpload()},_onPreview:function(e,t){n("input.path",this.element).val(t.path)},_onSelectFromStack:function(e){var t=n(e.target),i=t.parent("[data-file]");t.closest(".btn-group").removeClass("open"),this._onSelect(e,i.data("file")),e.preventDefault()},_onSelect:function(e,t){n("input.path",this.element).data("changeWithoutSelection",!1).data("selected",t).val(t.path).trigger("change"),"click"!==e.type&&i.stack.addToStack(t.path)},_onClose:function(){var e=n("input.path",this.element);e.val(e.data("selected").path)},_onClear:function(){var e=n("input.path",this.element);e.val(""),e.data("selected",{})}})}(jQuery,Bolt),function(d,o){"use strict";d.widget("bolt.fieldFilelist",d.bolt.baseField,{_create:function(){var e=this,r=this.element;this._ui={data:r.find("textarea"),list:r.find(".list")},this._lastClickIndex=0,e.options.isImage=this.options.isImage||!1,e._ui.list.sortable({helper:function(e,t){return t.addClass("selected"),d("<div/>")},start:function(e,t){var i=d(".selected",r).not(".ui-sortable-placeholder"),n=i.length,a=t.placeholder,o=a.outerHeight(!0),s=a.height(),l=parseInt(a.css("margin-top"))+parseInt(a.css("margin-bottom"));i.hide(),a.height(s+(n-1)*o-l),t.item.data("items",i)},beforeStop:function(e,t){t.item.before(t.item.data("items"))},stop:function(){d(".selected",r).show(),e._serialize()},axis:"y",delay:100,distance:5}),e._on(e._ui.list,{"click.item":e._onSelect,"click.remove":e._onRemove,"change input":e._serialize}),d("input.title",e._ui.list).on("keyup",e._updateTitle),e._on({"click.select-from-stack a":e._onSelectFromStack,buicbrowserselected:e._onAddPath,buicuploaduploaded:e._onAddPath}),r.buicUpload()},_onAddPath:function(e,t){d(">p",this._ui.list).remove(),this._ui.list.append(d(Bolt.data(this.options.isImage?"field.imagelist.template.item":"field.filelist.template.item",{"%TITLE_A%":t.path.replace(/\\.[a-z0-9]+$/,""),"%FILEPATH_E%":d("<div>").text(t.path).html(),"%FILEPATH_A%":t.path,"%EXT_E%":t.extension.toUpperCase(),"%PREVIEW_A%":t.previewListUrl,"%URL_A%":t.url}))),this._serialize()},_onRemove:function(e){var t=d(e.target).closest(".item"),i=t.hasClass("selected")?d(".selected",this._ui.list):t,n=this.options.isImage?"field.imagelist.message.remove":"field.filelist.message.remove",a=this.options.isImage?"field.imagelist.message.removeMulti":"field.filelist.message.removeMulti";i.addClass("zombie"),confirm(o.data(1<i.length?a:n))?(d(e.target).closest(".item").remove(),this._serialize()):i.removeClass("zombie"),e.preventDefault(),e.stopPropagation()},_onSelect:function(e){var i,n,t,a=d(e.target);a.hasClass("item")&&(e.shiftKey?(i=Math.min(this._lastClickIndex,a.index()),n=Math.max(this._lastClickIndex,a.index()),this._ui.list.children().each(function(e,t){d(t).toggleClass("selected",i<=e&&e<=n)})):(e.ctrlKey||e.metaKey?a.toggleClass("selected"):((t=this._ui.list.children(".selected").not(a)).removeClass("selected"),a.toggleClass("selected",0<t.length||null)),this._lastClickIndex=a.index()))},_onSelectFromStack:function(e){var t=d(e.target),i=t.closest("[data-file]");t.closest(".btn-group").removeClass("open"),this._onAddPath(e,i.data("file")),e.preventDefault()},_serialize:function(){var e=this.options.isImage?"field.imagelist.template.empty":"field.filelist.template.empty",t=[];d(".item",this._ui.list).each(function(){t.push({filename:d("input.filename",this).val(),title:d("input.title",this).val()})}),this._ui.data.val(JSON.stringify(t)),0===t.length&&this._ui.list.html(o.data(e))},_updateTitle:function(e){var t=d(e.target).closest(".item");d("a",t).attr("title",d(".title",t).val())}})}(jQuery,Bolt),function(a,o){"use strict";a.widget("bolt.fieldGeolocation",a.bolt.baseField,{options:{latitude:"",longitude:""},_create:function(){var e=this,t=e.element;this._ui={address:t.find(".address"),matched:t.find(".matched"),mapholder:t.find(".mapholder"),spinner:t.find(".mapholder i"),latitude:t.find(".latitude"),longitude:t.find(".longitude"),snap:t.find(".snap")},this._map=null,this._marker=null,this._timeout=0,e._on({"click.expand":e._onExpand,"click.compress":e._onExpand});var i=function(){o.events.off("Bolt.GoogleMapsAPI.Load.Done",i),e._initGoogleMap(e.options.latitude,e.options.longitude)};o.events.on("Bolt.GoogleMapsAPI.Load.Done",i),o.events.on("Bolt.GoogleMapsAPI.Load.Fail",function(){e._ui.spinner.removeClass("fa-spinner fa-spin").addClass("fa-refresh").one("click",function(){e._ui.spinner.removeClass("fa-refresh").addClass("fa-spinner fa-spin"),o.events.fire("Bolt.GoogleMapsAPI.Load.Request")})}),o.events.fire("Bolt.GoogleMapsAPI.Load.Request")},_geoCode:function(n){var a=this;n&&(new google.maps.Geocoder).geocode(n,function(e,t){var i;t===google.maps.GeocoderStatus.OK&&(i=n.latLng&&!a._ui.snap.is(":checked")?n.latLng:e[0].geometry.location,a._display(e[0].formatted_address,i.lat(),i.lng()),a._marker.setPosition(i),a._map.setCenter(i))}),a._display()},_display:function(e,t,i){this._ui.matched.val(e||""),this._ui.latitude.val(t||""),this._ui.longitude.val(i||"")},_initGoogleMap:function(e,t){var i=this,n={zoom:15,mapTypeId:google.maps.MapTypeId.ROADMAP,center:new google.maps.LatLng(e,t),streetViewControl:!1};i._map=new google.maps.Map(i._ui.mapholder[0],n),i._marker=new google.maps.Marker({map:i._map,position:n.center,title:o.data("field.geolocation.marker"),draggable:!0,animation:google.maps.Animation.DROP,icon:i.element.data("pin-icon")}),google.maps.event.addListener(i._marker,"mouseup",function(){i._geoCode({latLng:i._marker.getPosition()})}),i._ui.address.on("propertychange input",function(){clearTimeout(i._timeout),i._timeout=setTimeout(function(){var e=i._ui.address.val();i._geoCode(2<e.length?{address:e}:void 0)},800)}),a(\'a[data-toggle="tab"]\').on("shown.bs.tab",function(){i._ui.mapholder.closest("div.tab-pane").hasClass("active")&&google.maps.event.trigger(i._map,"resize")})},_onExpand:function(){var e=this._marker.getPosition();this._ui.mapholder.parent().toggleClass("expanded"),google.maps.event.trigger(this._map,"resize"),this._map.setCenter(e)}})}(jQuery,Bolt),function(e,t){"use strict";e.widget("bolt.fieldHtml",e.bolt.baseField,{_create:function(){t.ckeditor.add(this.element.find(".ckeditor")[0])}})}(jQuery,Bolt),function(t){"use strict";t.widget("bolt.fieldImage",t.bolt.fieldFile,{_create:function(){this._super(),t("input.path",this.element).data("selected").previewUrl=this.element.find("img").attr("src")},_onPreview:function(e,t){this._super(e,t),this.element.find("img").attr("src",t.previewUrl)},_onSelect:function(e,t){this._super(e,t),this.element.find("img").attr("src",t.previewUrl)},_onClose:function(){this._super();var e=t("input.path",this.element);this.element.find("img").attr("src",e.data("selected").previewUrl)},_onClear:function(){this._super();var e=this.element.find("img");e.attr("src",e.data("defaultUrl"))}})}(jQuery),function(e){"use strict";e.widget("bolt.fieldImagelist",e.bolt.fieldFilelist,{_create:function(){this.options.isImage=!0,this._super()}})}(jQuery),function(e,t){"use strict";e.widget("bolt.fieldMarkdown",e.bolt.baseField,{_create:function(){t.$("textarea[data-uk-htmleditor]",this.element).each(function(){var e=t.$(this);e.data("htmleditor")||t.htmleditor(e,t.Utils.options(e.attr("data-uk-htmleditor")))})}})}(jQuery,"undefined"!=typeof UIkit?UIkit:void 0),function(e){"use strict";e.widget("bolt.fieldMeta",e.bolt.baseField,{_create:function(){var e=this.element.find("#statusselect"),t=this.element.find("#ownerid");e.select2({width:"50%",minimumResultsForSearch:1/0}),t.select2({width:"50%",minimumResultsForSearch:1/0})}})}(jQuery),function(i,e){"use strict";i.widget("bolt.fieldRelationship",i.bolt.baseField,{_create:function(){this.element.find("select").select2({width:"100%",placeholder:{id:"",text:e.data("field.relationship.text.placeholder")},allowClear:!0,templateSelection:function(e){var t=i(e.element).parent().attr("label");return(t?t+": ":"")+e.text}})}})}(jQuery,Bolt),function(o,n,i){"use strict";o.widget("bolt.fieldRepeater",o.bolt.baseField,{options:{minimum:1,maximum:1,name:""},_create:function(){var i=this;for(this._ui={add:i.element.find(".add-button"),slot:i.element.find(".repeater-slot")},this._template=o(i.element.find(\'script[type="text/template"]\').html()),this._count=i._ui.slot.find("div.repeater-group").length,0===i.options.maximum&&(i.options.maximum=1/0),i._setCount(),i._ui.add.on("click",function(){i._append()}),i.element.on("click",".duplicate-button",function(){var e=o(this).closest(".repeater-group"),a=i._clone(i._template);o(e).find(":input").each(function(e){var t=o(this),i=t.attr("id"),n=t.val();t.hasClass("ckeditor")&&void 0!==CKEDITOR.instances[i]?o(a).find(":input").eq(e).val(CKEDITOR.instances[i].getData()):n&&o(a).find(":input").eq(e).val(n)}),e.after(a),i._setCount(1),i._renumber()}),i.element.find(".repeater-slot").sortable({cursor:"move",handle:".panel-heading",stop:function(e,t){i._renumber(),i._resetEditors(t.item)}}),i.element.on("click",".delete-button",function(){var t=o(this).closest(".repeater-group");bootbox.confirm(n.data("editcontent.deleteset"),function(e){o(".alert").alert(),!0===e&&(t.remove(),i._setCount(-1),i._renumber())})}),i.element.on("click",".move-up",function(){var e=o(this).closest(".repeater-group");e.insertBefore(e.prev(".repeater-group")),i._renumber(),i._resetEditors(e)}),i.element.on("click",".move-down",function(){var e=o(this).closest(".repeater-group");e.insertAfter(e.next(".repeater-group")),i._renumber(),i._resetEditors(e)}),i.element.on("click",".repeater-collapse",function(){var e=o(this).closest(".repeater-group").find(".panel-body");o(this).toggleClass("collapsed"),e.slideToggle()}),i.element.on("click",".hide-all-blocks",function(){var e=o(this).closest(".bolt-field-repeater"),t=e.find(".panel-body");e.find(".repeater-collapse").addClass("collapsed"),t.slideUp()}),i.element.on("click",".show-all-blocks",function(){var e=o(this).closest(".bolt-field-repeater"),t=e.find(".panel-body");e.find(".repeater-collapse").removeClass("collapsed"),t.slideDown()}),i.element.on("keyup change","input[type=text]",function(){var e,t,i,n;o(this).closest(".bolt-field-text").length&&(t=(e=o(this).closest(".repeater-group")).find(".bolt-field-text input:first"),n=(i=e.find(".repeater-heading")).data("default"),i.text(o(t).val().substring(0,60)||n))});i._count<i.options.minimum;)i._append()},_append:function(){var e=this._clone(this._template);this._ui.slot.append(e),this._setCount(1),this._renumber(),n.datetime.init(),n.ckeditor.init(),init.popOvers()},_clone:function(e){var i=o(e).clone();return i.find("[id]").each(function(){var e=o(this).attr("id"),t=n.app.buid();o(this).attr("id",t),i.find(\'[for="\'+e+\'"]\').each(function(){o(this).attr("for",t)})}),n.app.initWidgets(i),i},_renumber:function(){var i=this.options.name,e=i.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&"),n=new RegExp("^"+e+"\\\\[(#|\\\\d+)\\\\]");this._ui.slot.find("div.repeater-group").each(function(e,t){o(t).find("[name]").each(function(){this.name=this.name.replace(n,i+"["+e+"]")}),o(t).is(":first-of-type")?o(t).find(".move-up").addClass("disabled"):o(t).find(".move-up").removeClass("disabled"),o(t).is(":last-of-type")?o(t).find(".move-down").addClass("disabled"):o(t).find(".move-down").removeClass("disabled")})},_resetEditors:function(e){e.find(".ckeditor").each(function(e,t){i.instances[t.id]&&i.instances[t.id].destroy(),i.replace(t.id)})},_setCount:function(e){this._count+=e||0,this._count>=this.options.maximum?(this._ui.add.addClass("disabled"),this._ui.add.prop("disabled","disabled"),this.element.find(".duplicate-button").addClass("disabled"),this.element.find(".duplicate-button").prop("disabled","disabled")):(this._ui.add.removeClass("disabled"),this._ui.add.prop("disabled",!1),this.element.find(".duplicate-button").removeClass("disabled"),this.element.find(".duplicate-button").prop("disabled",!1)),this._count<=this.options.minimum?(this.element.find(".delete-button").addClass("disabled"),this.element.find(".delete-button").prop("disabled","disabled")):(this.element.find(".delete-button").removeClass("disabled"),this.element.find(".delete-button").prop("disabled",!1))}})}(jQuery,Bolt,"undefined"!=typeof CKEDITOR?CKEDITOR:void 0),function(e,n){"use strict";e.widget("bolt.fieldSelect",e.bolt.baseField,{options:{autocomplete:!1},_create:function(){var e=this.element.find("select"),t=e.find("option[selected]");e.find("option").removeAttr("selected"),t.prop("selected","selected");var i={width:"100%",placeholder:{id:"",text:n.data("field.select.text.placeholder")},allowClear:!0,minimumResultsForSearch:this.options.autocomplete?0:1/0};this.options.sortable?e.select2Sortable(i):e.select2(i)}})}(jQuery,Bolt),function(a){"use strict";var o=1,s=2,l=3;a.widget("bolt.fieldSlug",a.bolt.baseField,{options:{contentId:null,key:"",slug:"",uses:[]},_create:function(){var e=this,t=this.element;this._ui={form:this.element.closest("form"),group:t.find(".input-group"),data:t.find("input"),uses:a()},a("[name]",e._ui.form).each(function(){0<=e.options.uses.indexOf(this.name.replace(/\\[\\]$/,""))&&(e._ui.uses=e._ui.uses.add(a(this)))}),this._timeout=0,this._mode=o,this._ui.group.hasClass("linked")?this._setMode(s):this._ui.group.hasClass("editable")&&(this._mode=l),this._on({"click li.lock":function(e){e.preventDefault(),this._setMode(o)},"click li.link":function(e){e.preventDefault(),this._setMode(s)},"click li.edit":function(e){e.preventDefault(),this._setMode(l),this.element.find("input").focus()},"focusout input":function(){this._mode===l&&this._setMode(o)}})},_destroy:function(){clearTimeout(this._timeout)},_setMode:function(e){var t=e===o,i=e===s,n=e===l;a("li.lock",this.element).toggleClass("disabled",t),a("li.link",this.element).toggleClass("disabled",i),a("li.edit",this.element).toggleClass("disabled",n),this._ui.group.toggleClass("locked",t).toggleClass("linked",i).toggleClass("edititable",n),a(".warning",this.element).toggleClass("hidden",!n),this._ui.data.prop("readonly",!n),i?(this._buildSlug(),this._on(this._ui.uses,{change:function(){this._buildSlug()},input:function(){this._buildSlug()}})):0<this._timeout&&(clearTimeout(this._timeout),this._timeout=0,this._off(this._ui.uses,"change"),this._off(this._ui.uses,"input")),this._mode=e},_buildSlug:function(){var i,e=this,n="";a.each(e.options.uses,function(e,t){(i=a("#"+t).val())&&(n+=("object"==typeof i?i.join(" "):i)+" ")}),clearTimeout(e._timeout),e._timeout=setTimeout(function(){e._getUri(n.trim())},200)},_getUri:function(e){var t=this,i={title:e,contenttypeslug:t.options.slug,id:t.options.contentId,slugfield:t.options.key,fulluri:!1};t._ui.group.addClass("loading"),a.get(t._ui.data.data("createSlugUrl"),i).done(function(e){t._mode===s&&t._ui.data.val(e)}).fail(function(){console.error("Failed to get URI for "+t.options.slug+"/"+t.options.contentId)}).always(function(){t._ui.group.removeClass("loading")})}})}(jQuery),function(s){"use strict";s.widget("bolt.fieldTags",s.bolt.baseField,{options:{allowSpaces:!1},_create:function(){var o=this.element.find("select"),i=this.element.find(".tagcloud"),e=[","],t=o.find("option[selected]");o.find("option").removeAttr("selected"),t.prop("selected","selected"),this.options.allowSpaces||e.push(" "),o.select2({width:"100%",tags:{},minimumInputLength:1,tokenSeparators:e}),s.ajax({url:this.element.data("tagsUrl"),dataType:"json",success:function(e){for(var t=o.val()||[],i=e.length,n="",a=0;a<i;a++)t.indexOf(e[a].slug)<0&&(t.push(e[a].slug),n+=\'<option value="\'+e[a].slug+\'">\'+e[a].name+"</option>");o.append(s(n)).trigger("change")}}),i&&s.ajax({url:this.element.data("popularTagsUrl"),dataType:"json",data:{limit:40},success:function(e){0<e.length&&(s.each(e,function(e,t){i.append(s("<button/>",{type:"button",text:t.name,rel:t.count,value:t.slug})).append("")}),i.find("button").on("click",function(){var e=s(this).data("slug"),t=s(this).text(),i=o.find(\'option[value="\'+e+\'"]\');0<i.length?i=i.not(":selected").attr("selected",!0).trigger("change"):o.append(s("<option/>",{value:e,text:t,selected:!0})).trigger("change")}),s.fn.tagcloud.defaults={size:{start:10,end:20,unit:"px"},color:{start:"#888",end:"#194770"}},i.find("button").tagcloud(),i.css("display","block"))}})}})}(jQuery),function(o,s){"use strict";o.widget("bolt.fieldTemplateselect",o.bolt.baseField,{options:{currentHas:!1,current:"",fieldTemplates:[]},_create:function(){var t=this,i=t.element.find("select"),n=t.element.find("p"),a=n.parent();i.select2({width:"100%",allowClear:!0,placeholder:{id:"",text:s.data("field.templateselect.text.default")},minimumResultsForSearch:1/0}),i.on("change",function(){var e;a.addClass("hidden"),n.html("").removeClass("text-danger"),i.val()!==t.options.current&&(t.options.currentHas?(n.html(s.data("field.templateselect.template.warning",{"%STATUS%":s.data("field.templateselect.message.status"),"%MESSAGE%":s.data("field.templateselect.message.warning")})),e=!0,o(\'[name^="templatefields"]\').each(function(){"checkbox"!==o(this).attr("type")&&"SELECT"!==o(this).prop("tagName")&&""!==o(this).val()&&(e=!1),"checkbox"===o(this).attr("type")&&o(this).prop("checked")&&(e=!1)}),e?o("#tabindicator-tab-template").hide():(n.addClass("text-danger"),a.removeClass("hidden"))):-1<t.options.fieldTemplates.indexOf(i.val())&&(n.html(s.data("field.templateselect.message.change")),a.removeClass("hidden"),o("#tabindicator-tab-template").show()))})}})}(jQuery,Bolt),function(e){"use strict";e.widget("bolt.fieldText",e.bolt.baseField,{_create:function(){}})}(jQuery),function(e){"use strict";e.widget("bolt.fieldTextarea",e.bolt.baseField,{_create:function(){}})}(jQuery),function(a,o){"use strict";a.widget("bolt.fieldVideo",a.bolt.baseField,{_create:function(){var e=this,t=this.element,i=0;this._ui={url:t.find("input.url"),width:t.find("input.width"),height:t.find("input.height"),html:t.find("input.html"),ratio:t.find("input.ratio"),authorName:t.find("input.authorname"),authorUrl:t.find("input.authorurl"),title:t.find("input.title"),thumbnailUrl:t.find("input.thumbnailurl"),preview:t.find("img"),play:t.find(".imageholder button"),refresh:t.find("button.refresh"),spinner:t.find("button.refresh i")},e._ui.url.on("propertychange input",function(){clearTimeout(i),i=setTimeout(function(){e._update()},1e3)}),e._ui.width.on("propertychange input",function(){0<e._ui.ratio.val()&&e._ui.height.val(Math.round(e._ui.width.val()/e._ui.ratio.val()))}),e._ui.height.on("propertychange input",function(){0<e._ui.ratio.val()&&e._ui.width.val(Math.round(e._ui.height.val()*e._ui.ratio.val()))}),e._ui.refresh.on("click",function(){e._update()}),e._ui.play.on("click",function(){a("body").buicModal({size:"large",closer:!0,headline:e._ui.title.val(),body:e._ui.html.val()})})},_update:function(){var t=this,e=o.data("endpoint.embed"),i=a("#id").closest("form").find(\'input[name="content_edit[_token]"]\').val(),n={format:"json",url:t._ui.url.val(),_token:i,provider:"oembed"};n.url.length<2?t._set({}):(this._ui.refresh.prop("disabled",!0),t._ui.spinner.addClass("fa-spin"),a.post(e,n).done(function(e){t._set(e)}).fail(function(){t._set({})}).always(function(){t._ui.spinner.removeClass("fa-spin")}))},_set:function(e){var t=e.thumbnail_url||this._ui.preview.data("defaultUrl");this._ui.html.val(e.html||""),this._ui.width.val(e.width||""),this._ui.height.val(e.height||""),this._ui.ratio.val(e.width&&e.height?e.width/e.height:""),this._ui.authorName.val(e.author_name||""),this._ui.authorUrl.val(e.author_url||""),this._ui.title.val(e.title||""),this._ui.thumbnailUrl.val(e.thumbnail_url||""),this._ui.preview.attr("src",t),e.html?this._ui.play.removeClass("hidden"):this._ui.play.addClass("hidden"),this._ui.refresh.prop("disabled",this._ui.url.val().length<=2||0<this._ui.html.val().length)}})}(jQuery,Bolt),function(n,a){"use strict";n.widget("bolt.panelActivity",n.bolt.baseInterval,{options:{delay:3e4},_create:function(){this._super()},_update:function(){var i=this;n.get(i.element.data("url")).done(function(e){var t=n(e);a.app.initWidgets(t),i.element.html(t)})}})}(jQuery,Bolt),Bolt.validation=function(){"use strict";function E(e){var t=!0,i=e.value,n=e.getAttribute("type"),a="checkbox"===n||"radio"===n,o=e.getAttribute("required"),s=e.getAttribute("minlength"),l=e.getAttribute("maxlength"),r=e.getAttribute("pattern");return e.disabled||(t=(t=t&&(!o||a&&e.checked||!a&&""!==i))&&(a||(!s||i.length>=s)&&(!l||i.length<=l)))&&r&&(t=(r=new RegExp("^(?:"+r+")$")).test(i)),t}function T(e,t){void 0!==e.willValidate?e.setCustomValidity(t):e.validity.valid=""===t}function o(e){var t,i,n,a,o,s,l,r,d,c,u=void 0!==e.willValidate,p=e.value,f="",h=$(e).data("validate");if(h){for(i in h)if(h.hasOwnProperty(i)){switch(n=h[i],i){case"float":f=""===(c=p)||c.match(/^[-+]?[0-9]*[,.]?[0-9]+([eE][-+]?[0-9]+)?$/)?"":Bolt.data("validation.float");break;case"required":d=p,f=!0===n&&""===d?Bolt.data("validation.required"):"";break;case"min":r=n,f=""!==(l=p)&&Number(l.replace(",","."))<r?Bolt.data("validation.min",{"%MINVAL%":r}):"";break;case"max":s=n,f=""!==(o=p)&&Number(o.replace(",","."))>s?Bolt.data("validation.max",{"%MAXVAL%":s}):"";break;default:console.error("UNKNOWN VALIDATION"+i+" -> "+n)}if(f)break}T(e,f)}else{u?("INPUT"===e.nodeName&&e.type!==e.getAttribute("type")&&e.setCustomValidity(E(e)?"":"error"),e.checkValidity()):(e.validity=e.validity||{},e.validity.valid=E(e)),!(t="TEXTAREA"===e.nodeName&&$(e).hasClass("ckeditor"))||(a=CKEDITOR.instances[e.id])&&T(e,!0===a._.required&&""===a.getData().trim()?"Required":"")}var m,g,v,b,_,k,w,y,x,C="notice--"+e.id;return $("#"+C).remove(),e.validity.valid?(y=e,x=t,$(y).removeClass("error"),x&&$("#cke_"+y.id).removeClass("cke_error"),!0):(k=e,w=t,$(k).addClass("error"),w&&$("#cke_"+k.id).addClass("cke_error"),m=C,g=e,v=f,b=(b=$(\'label[for="\'+g.id+\'"]\').contents().first().text().trim()||g.name).replace(/(.*):+$/g,"$1"),_=Bolt.data("validation.alertbox",{"%NOTICE_ID%":m,"%FIELD_ID%":g.id,"%FIELD_NAME%":b,"%MESSAGE%":v||$(g).data("errortext")||Bolt.data("validation.generic_msg")}),$(_).hide().insertAfter(".page-header").slideDown("fast"),!1)}return{run:function(e){for(var t,i=e.elements.length,n=!0,a=0;a<i;a++)"INPUT"!==(t=e.elements[a]).nodeName&&"TEXTAREA"!==t.nodeName&&"SELECT"!==t.nodeName||("INPUT"===t.nodeName&&(t.value=t.value.trim()),!1===o(t)&&(n=!1));return n}}}();                usesvalue += " ";\n            })\n            clearTimeout(makeuritimeout);\n            makeuritimeout = setTimeout( function(){ makeUriAjax(usesvalue, contenttypeslug, id, this, slugfield, fulluri); }, 200);\n        }).trigger(\'change.bolt\');\n    });\n\n    $(usesfields).each( function() {\n        $(\'#\'+this).unbind(\'propertychange.bolt input.bolt change.bolt\');\n    });\n\n}\n\nvar makeuritimeout;\n\nfunction makeUriAjax(text, contenttypeslug, id, usesfield, slugfield, fulluri) {\n    $.ajax({\n        url: asyncpath + \'makeuri\',\n        type: \'GET\',\n', 'message': 'merge master\n', 'author_name': 'Leonid Bobylev', 'lang': 'js'}