silverstripe-framework/admin/client/dist/js/bundle-legacy.js

5 lines
77 KiB
JavaScript

!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";require("../legacy/LeftAndMain.Layout.js"),require("../legacy/LeftAndMain.js"),require("../legacy/LeftAndMain.ActionTabSet.js"),require("../legacy/LeftAndMain.Panel.js"),require("../legacy/LeftAndMain.Tree.js"),require("../legacy/LeftAndMain.Content.js"),require("../legacy/LeftAndMain.EditForm.js"),require("../legacy/LeftAndMain.Menu.js"),require("../legacy/LeftAndMain.Preview.js"),require("../legacy/LeftAndMain.BatchActions.js"),require("../legacy/LeftAndMain.FieldHelp.js"),require("../legacy/LeftAndMain.FieldDescriptionToggle.js"),require("../legacy/LeftAndMain.TreeDropdownField.js"),require("../legacy/AddToCampaignForm.js")},{"../legacy/AddToCampaignForm.js":2,"../legacy/LeftAndMain.ActionTabSet.js":3,"../legacy/LeftAndMain.BatchActions.js":4,"../legacy/LeftAndMain.Content.js":5,"../legacy/LeftAndMain.EditForm.js":6,"../legacy/LeftAndMain.FieldDescriptionToggle.js":7,"../legacy/LeftAndMain.FieldHelp.js":8,"../legacy/LeftAndMain.Layout.js":9,"../legacy/LeftAndMain.Menu.js":10,"../legacy/LeftAndMain.Panel.js":11,"../legacy/LeftAndMain.Preview.js":12,"../legacy/LeftAndMain.Tree.js":13,"../legacy/LeftAndMain.TreeDropdownField.js":14,"../legacy/LeftAndMain.js":15}],2:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].entwine("ss",function($){$(".add-to-campaign-action, #add-to-campaign__action").entwine({onclick:function(){var dialog=$("#add-to-campaign__dialog");dialog.length?dialog.open():(dialog=$('<div id="add-to-campaign__dialog" class="add-to-campaign__dialog" />'),$("body").append(dialog)),0===dialog.children().length&&dialog.addClass("loading");var form=this.closest("form"),button=this,formData=form.serializeArray();return formData.push({name:button.attr("name"),value:"1"}),$.ajax({url:form.attr("action"),data:formData,type:"POST",global:!1,complete:function(){dialog.removeClass("loading")},success:function(data,status,xhr){if(0===xhr.getResponseHeader("Content-Type").indexOf("text/plain")){var container=$('<div class="add-to-campaign__response add-to-campaign__response--good"><span></span></div>');container.find("span").text(data),dialog.append(container)}else dialog.html(data)},error:function error(xhr){var error=xhr.responseText||"Something went wrong. Please try again in a few minutes.",container=$('<div class="add-to-campaign__response add-to-campaign__response--error"><span></span></div>');container.find("span").text(error),dialog.append(container)}}),!1}}),$("#add-to-campaign__dialog").entwine({onadd:function(){this.is(".ui-dialog-content")||this.ssdialog({autoOpen:!0,minHeight:200,maxHeight:200,minWidth:200,maxWidth:500}),this._super()},open:function(){this.ssdialog("open")},close:function(){this.ssdialog("close")},onssdialogclose:function(){this.empty()},"onchosen:showing_dropdown":function(){this.css({overflow:"visible"})},"onchosen:hiding_dropdown":function(){this.css({overflow:""})}})})},{jQuery:"jQuery"}],3:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].entwine("ss",function($){$(".ss-tabset.ss-ui-action-tabset").entwine({IgnoreTabState:!0,onadd:function(){this._super(),this.tabs({collapsible:!0,active:!1})},onremove:function(){var frame=$(".cms-container").find("iframe");frame.each(function(index,iframe){try{$(iframe).contents().off("click.ss-ui-action-tabset")}catch(e){console.warn("Unable to access iframe, possible https mis-match")}}),$(document).off("click.ss-ui-action-tabset"),this._super()},ontabsbeforeactivate:function(event,ui){this.riseUp(event,ui)},onclick:function(event,ui){this.attachCloseHandler(event,ui)},attachCloseHandler:function(event,ui){var _closeHandler,that=this,frame=$(".cms-container").find("iframe");_closeHandler=function(event){var panel,frame;panel=$(event.target).closest(".ss-ui-action-tabset .ui-tabs-panel"),$(event.target).closest(that).length||panel.length||(that.tabs("option","active",!1),frame=$(".cms-container").find("iframe"),frame.each(function(index,iframe){$(iframe).contents().off("click.ss-ui-action-tabset",_closeHandler)}),$(document).off("click.ss-ui-action-tabset",_closeHandler))},$(document).on("click.ss-ui-action-tabset",_closeHandler),frame.length>0&&frame.each(function(index,iframe){$(iframe).contents().on("click.ss-ui-action-tabset",_closeHandler)})},riseUp:function(event,ui){var elHeight,trigger,endOfWindow,elPos,activePanel,activeTab,topPosition,containerSouth,padding;return elHeight=$(this).find(".ui-tabs-panel").outerHeight(),trigger=$(this).find(".ui-tabs-nav").outerHeight(),endOfWindow=$(window).height()+$(document).scrollTop()-trigger,elPos=$(this).find(".ui-tabs-nav").offset().top,activePanel=ui.newPanel,activeTab=ui.newTab,elPos+elHeight>=endOfWindow&&elPos-elHeight>0?(this.addClass("rise-up"),null!==activeTab.position()&&(topPosition=-activePanel.outerHeight(),containerSouth=activePanel.parents(".toolbar--south"),containerSouth&&(padding=activeTab.offset().top-containerSouth.offset().top,topPosition-=padding),$(activePanel).css("top",topPosition+"px"))):(this.removeClass("rise-up"),null!==activeTab.position()&&$(activePanel).css("bottom","100%")),!1}}),$(".cms-content-actions .ss-tabset.ss-ui-action-tabset").entwine({ontabsbeforeactivate:function(event,ui){this._super(event,ui),$(ui.newPanel).length>0&&$(ui.newPanel).css("left",ui.newTab.position().left+"px")}}),$(".cms-actions-row.ss-tabset.ss-ui-action-tabset").entwine({ontabsbeforeactivate:function(event,ui){this._super(event,ui),$(this).closest(".ss-ui-action-tabset").removeClass("tabset-open tabset-open-last")}}),$(".cms-content-fields .ss-tabset.ss-ui-action-tabset").entwine({ontabsbeforeactivate:function(event,ui){this._super(event,ui),$(ui.newPanel).length>0&&($(ui.newTab).hasClass("last")?($(ui.newPanel).css({left:"auto",right:"0px"}),$(ui.newPanel).parent().addClass("tabset-open-last")):($(ui.newPanel).css("left",ui.newTab.position().left+"px"),$(ui.newTab).hasClass("first")&&($(ui.newPanel).css("left","0px"),$(ui.newPanel).parent().addClass("tabset-open"))))}}),$(".cms-tree-view-sidebar .cms-actions-row.ss-tabset.ss-ui-action-tabset").entwine({"from .ui-tabs-nav li":{onhover:function(e){$(e.target).parent().find("li .active").removeClass("active"),$(e.target).find("a").addClass("active")}},ontabsbeforeactivate:function(event,ui){this._super(event,ui),$(ui.newPanel).css({left:"auto",right:"auto"}),$(ui.newPanel).length>0&&$(ui.newPanel).parent().addClass("tabset-open")}})})},{jQuery:"jQuery"}],4:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery),_i18n=require("i18n"),_i18n2=_interopRequireDefault(_i18n);_jQuery2["default"].entwine("ss.tree",function($){$("#Form_BatchActionsForm").entwine({Actions:[],getTree:function(){return $(".cms-tree")},fromTree:{oncheck_node:function(e,data){this.serializeFromTree()},onuncheck_node:function(e,data){this.serializeFromTree()}},onmatch:function(){var self=this;self.getTree().bind("load_node.jstree",function(e,data){self.refreshSelected()})},onunmatch:function(){var self=this;self.getTree().unbind("load_node.jstree")},registerDefault:function(){this.register(ss.config.adminUrl+"pages/batchactions/publish",function(ids){var confirmed=confirm(_i18n2["default"].inject(_i18n2["default"]._t("CMSMAIN.BATCH_PUBLISH_PROMPT","You have {num} page(s) selected.\n\nDo you really want to publish?"),{num:ids.length}));return confirmed?ids:!1}),this.register(ss.config.adminUrl+"pages/batchactions/unpublish",function(ids){var confirmed=confirm(_i18n2["default"].inject(_i18n2["default"]._t("CMSMAIN.BATCH_UNPUBLISH_PROMPT","You have {num} page(s) selected.\n\nDo you really want to unpublish"),{num:ids.length}));return confirmed?ids:!1}),this.register(ss.config.adminUrl+"pages/batchactions/delete",function(ids){var confirmed=confirm(_i18n2["default"].inject(_i18n2["default"]._t("CMSMAIN.BATCH_DELETE_PROMPT","You have {num} page(s) selected.\n\nDo you really want to delete?"),{num:ids.length}));return confirmed?ids:!1}),this.register(ss.config.adminUrl+"pages/batchactions/archive",function(ids){var confirmed=confirm(_i18n2["default"].inject(_i18n2["default"]._t("CMSMAIN.BATCH_ARCHIVE_PROMPT","You have {num} page(s) selected.\n\nAre you sure you want to archive these pages?\n\nThese pages and all of their children pages will be unpublished and sent to the archive."),{num:ids.length}));return confirmed?ids:!1}),this.register(ss.config.adminUrl+"pages/batchactions/restore",function(ids){var confirmed=confirm(_i18n2["default"].inject(_i18n2["default"]._t("CMSMAIN.BATCH_RESTORE_PROMPT","You have {num} page(s) selected.\n\nDo you really want to restore to stage?\n\nChildren of archived pages will be restored to the root level, unless those pages are also being restored."),{num:ids.length}));return confirmed?ids:!1}),this.register(ss.config.adminUrl+"pages/batchactions/deletefromlive",function(ids){var confirmed=confirm(_i18n2["default"].inject(_i18n2["default"]._t("CMSMAIN.BATCH_DELETELIVE_PROMPT","You have {num} page(s) selected.\n\nDo you really want to delete these pages from live?"),{num:ids.length}));return confirmed?ids:!1})},onadd:function(){this.registerDefault(),this._super()},register:function(type,callback){this.trigger("register",{type:type,callback:callback});var actions=this.getActions();actions[type]=callback,this.setActions(actions)},unregister:function(type){this.trigger("unregister",{type:type});var actions=this.getActions();actions[type]&&delete actions[type],this.setActions(actions)},refreshSelected:function(rootNode){var self=this,st=this.getTree(),ids=this.getIDs(),allIds=[],viewMode=$(".cms-content-batchactions-button"),actionUrl=this.find(":input[name=Action]").val();null==rootNode&&(rootNode=st);for(var idx in ids)$($(st).getNodeByID(idx)).addClass("selected").attr("selected","selected");if(!actionUrl||-1==actionUrl||!viewMode.hasClass("active"))return void $(rootNode).find("li").each(function(){$(this).setEnabled(!0)});$(rootNode).find("li").each(function(){allIds.push($(this).data("id")),$(this).addClass("treeloading").setEnabled(!1)});var actionUrlParts=$.path.parseUrl(actionUrl),applicablePagesUrl=actionUrlParts.hrefNoSearch+"/applicablepages/";applicablePagesUrl=$.path.addSearchParams(applicablePagesUrl,actionUrlParts.search),applicablePagesUrl=$.path.addSearchParams(applicablePagesUrl,{csvIDs:allIds.join(",")}),jQuery.getJSON(applicablePagesUrl,function(applicableIDs){jQuery(rootNode).find("li").each(function(){$(this).removeClass("treeloading");var id=$(this).data("id");0==id||$.inArray(id,applicableIDs)>=0?$(this).setEnabled(!0):($(this).removeClass("selected").setEnabled(!1),$(this).prop("selected",!1))}),self.serializeFromTree()})},serializeFromTree:function(){var tree=this.getTree(),ids=tree.getSelectedIDs();return this.setIDs(ids),!0},setIDs:function(ids){this.find(":input[name=csvIDs]").val(ids?ids.join(","):null)},getIDs:function(){var value=this.find(":input[name=csvIDs]").val();return value?value.split(","):[]},onsubmit:function(e){var self=this,ids=this.getIDs(),tree=this.getTree(),actions=this.getActions();if(!ids||!ids.length)return alert(_i18n2["default"]._t("CMSMAIN.SELECTONEPAGE","Please select at least one page")),e.preventDefault(),!1;var type=this.find(":input[name=Action]").val();if(actions[type]&&(ids=this.getActions()[type].apply(this,[ids])),!ids||!ids.length)return e.preventDefault(),!1;this.setIDs(ids),tree.find("li").removeClass("failed");var button=this.find(":submit:first");return button.addClass("loading"),jQuery.ajax({url:type,type:"POST",data:this.serializeArray(),complete:function(xmlhttp,status){button.removeClass("loading"),tree.jstree("refresh",-1),self.setIDs([]),self.find(":input[name=Action]").val("").change();var msg=xmlhttp.getResponseHeader("X-Status");msg&&statusMessage(decodeURIComponent(msg),"success"==status?"good":"bad")},success:function(data,status){var id,node;if(data.modified){var modifiedNodes=[];for(id in data.modified)node=tree.getNodeByID(id),tree.jstree("set_text",node,data.modified[id].TreeTitle),modifiedNodes.push(node);$(modifiedNodes).effect("highlight")}if(data.deleted)for(id in data.deleted)node=tree.getNodeByID(id),node.length&&tree.jstree("delete_node",node);if(data.error)for(id in data.error)node=tree.getNodeByID(id),$(node).addClass("failed")},dataType:"json"}),e.preventDefault(),!1}}),$(".cms-content-batchactions-button").entwine({onmatch:function(){this._super(),this.updateTree()},onunmatch:function(){this._super()},onclick:function(e){this.updateTree()},updateTree:function(){var tree=$(".cms-tree"),form=$("#Form_BatchActionsForm");this._super(),this.data("active")?(tree.addClass("multiple"),tree.removeClass("draggable"),form.serializeFromTree()):(tree.removeClass("multiple"),tree.addClass("draggable")),$("#Form_BatchActionsForm").refreshSelected()}}),$("#Form_BatchActionsForm select[name=Action]").entwine({onchange:function(e){var form=$(e.target.form),btn=form.find(":submit"),selected=$(e.target).val();selected&&-1!=selected?btn.removeAttr("disabled").button("refresh"):btn.attr("disabled","disabled").button("refresh"),$("#Form_BatchActionsForm").refreshSelected(),this.trigger("chosen:updated"),this._super(e)}})})},{i18n:"i18n",jQuery:"jQuery"}],5:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].entwine("ss",function($){$(".cms-content").entwine({onadd:function(){this.find(".cms-tabset").redrawTabs(),this._super()},redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.add(this.find(".cms-tabset")).redrawTabs(),this.find(".cms-content-header").redraw(),this.find(".cms-content-actions").redraw()}}),$(".cms-content .cms-tree").entwine({onadd:function(){var self=this;this._super(),this.bind("select_node.jstree",function(e,data){var node=data.rslt.obj,loadedNodeID=self.find(":input[name=ID]").val(),origEvent=data.args[2],container=$(".cms-container");if(!origEvent)return!1;if($(node).hasClass("disabled"))return!1;if($(node).data("id")!=loadedNodeID){var url=$(node).find("a:first").attr("href");url&&"#"!=url?(url=url.split("?")[0],self.jstree("deselect_all"),self.jstree("uncheck_all"),$.path.isExternal($(node).find("a:first"))&&(url=url=$.path.makeUrlAbsolute(url,$("base").attr("href"))),document.location.search&&(url=$.path.addSearchParams(url,document.location.search.replace(/^\?/,""))),container.loadPanel(url)):self.removeForm()}})}}),$(".cms-content .cms-content-fields").entwine({redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0))}}),$(".cms-content .cms-content-header, .cms-content .cms-content-actions").entwine({redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.height("auto"),this.height(this.innerHeight()-this.css("padding-top")-this.css("padding-bottom"))}})})},{jQuery:"jQuery"}],6:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery),_i18n=require("i18n"),_i18n2=_interopRequireDefault(_i18n);window.onbeforeunload=function(e){var form=(0,_jQuery2["default"])(".cms-edit-form");return form.trigger("beforesubmitform"),form.is(".changed")&&!form.is(".discardchanges")?_i18n2["default"]._t("LeftAndMain.CONFIRMUNSAVEDSHORT"):void 0},_jQuery2["default"].entwine("ss",function($){$(".cms-edit-form").entwine({PlaceholderHtml:"",ChangeTrackerOptions:{ignoreFieldSelector:".no-change-track, .ss-upload :input, .cms-navigator :input"},ValidationErrorShown:!1,onadd:function(){this.attr("autocomplete","off"),this._setupChangeTracker();for(var overrideAttr in{action:!0,method:!0,enctype:!0,name:!0}){var el=this.find(":input[name=_form_"+overrideAttr+"]");el&&(this.attr(overrideAttr,el.val()),el.remove())}this.setValidationErrorShown(!1),this._super()},"from .cms-tabset":{onafterredrawtabs:function(){if(this.hasClass("validationerror")){var tabError=this.find(".message.validation, .message.required").first().closest(".tab");$(".cms-container").clearCurrentTabState();var $tabSet=tabError.closest(".ss-tabset");$tabSet.length||($tabSet=tabError.closest(".cms-tabset")),$tabSet.length?$tabSet.tabs("option","active",tabError.index(".tab")):this.getValidationErrorShown()||(this.setValidationErrorShown(!0),errorMessage(ss.i18n._t("ModelAdmin.VALIDATIONERROR","Validation Error")))}}},onremove:function(){this.changetracker("destroy"),this._super()},onmatch:function(){this._super()},onunmatch:function(){this._super()},redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.add(this.find(".cms-tabset")).redrawTabs(),this.find(".cms-content-header").redraw()},_setupChangeTracker:function(){this.changetracker(this.getChangeTrackerOptions())},confirmUnsavedChanges:function(){if(this.trigger("beforesubmitform"),!this.is(".changed")||this.is(".discardchanges"))return!0;var confirmed=confirm(_i18n2["default"]._t("LeftAndMain.CONFIRMUNSAVED"));return confirmed&&this.addClass("discardchanges"),confirmed},onsubmit:function(e,button){return"_blank"!=this.prop("target")?(button&&this.closest(".cms-container").submitForm(this,button),!1):void 0},validate:function(){var isValid=!0;return this.trigger("validate",{isValid:isValid}),isValid},"from .htmleditor":{oneditorinit:function(e){var self=this,field=$(e.target).closest(".field.htmleditor"),editor=field.find("textarea.htmleditor").getEditor().getInstance();editor.onClick.add(function(e){self.saveFieldFocus(field.attr("id"))})}},"from .cms-edit-form :input:not(:submit)":{onclick:function(e){this.saveFieldFocus($(e.target).attr("id"))},onfocus:function(e){this.saveFieldFocus($(e.target).attr("id"))}},"from .cms-edit-form .treedropdown *":{onfocusin:function(e){var field=$(e.target).closest(".field.treedropdown");this.saveFieldFocus(field.attr("id"))}},"from .cms-edit-form .dropdown .chosen-container a":{onfocusin:function(e){var field=$(e.target).closest(".field.dropdown");this.saveFieldFocus(field.attr("id"))}},"from .cms-container":{ontabstaterestored:function(e){this.restoreFieldFocus()}},saveFieldFocus:function(selected){if("undefined"!=typeof window.sessionStorage&&null!==window.sessionStorage){var id=$(this).attr("id"),focusElements=[];if(focusElements.push({id:id,selected:selected}),focusElements)try{window.sessionStorage.setItem(id,JSON.stringify(focusElements))}catch(err){if(err.code===DOMException.QUOTA_EXCEEDED_ERR&&0===window.sessionStorage.length)return;throw err}}},restoreFieldFocus:function(){if("undefined"!=typeof window.sessionStorage&&null!==window.sessionStorage){var elementID,activeTab,elementTab,toggleComposite,scrollY,self=this,hasSessionStorage="undefined"!=typeof window.sessionStorage&&window.sessionStorage,sessionData=hasSessionStorage?window.sessionStorage.getItem(this.attr("id")):null,sessionStates=sessionData?JSON.parse(sessionData):!1,tabbed=0!==this.find(".ss-tabset").length;if(hasSessionStorage&&sessionStates.length>0){if($.each(sessionStates,function(i,sessionState){self.is("#"+sessionState.id)&&(elementID=$("#"+sessionState.selected))}),$(elementID).length<1)return void this.focusFirstInput();if(activeTab=$(elementID).closest(".ss-tabset").find(".ui-tabs-nav .ui-tabs-active .ui-tabs-anchor").attr("id"),elementTab="tab-"+$(elementID).closest(".ss-tabset .ui-tabs-panel").attr("id"),tabbed&&elementTab!==activeTab)return;toggleComposite=$(elementID).closest(".togglecomposite"),toggleComposite.length>0&&toggleComposite.accordion("activate",toggleComposite.find(".ui-accordion-header")),scrollY=$(elementID).position().top,$(elementID).is(":visible")||(elementID="#"+$(elementID).closest(".field").attr("id"),scrollY=$(elementID).position().top),$(elementID).focus(),scrollY>$(window).height()/2&&self.find(".cms-content-fields").scrollTop(scrollY)}else this.focusFirstInput()}},focusFirstInput:function(){this.find(':input:not(:submit)[data-skip-autofocus!="true"]').filter(":visible:first").focus()}}),$(".cms-edit-form .btn-toolbar input.action[type=submit], .cms-edit-form .btn-toolbar button.action").entwine({onclick:function(e){return this.hasClass("gridfield-button-delete")&&!confirm(_i18n2["default"]._t("TABLEFIELD.DELETECONFIRMMESSAGE"))?(e.preventDefault(),!1):(this.is(":disabled")||this.parents("form").trigger("submit",[this]),e.preventDefault(),!1)}}),$(".cms-edit-form .btn-toolbar input.action[type=submit].ss-ui-action-cancel, .cms-edit-form .btn-toolbar button.action.ss-ui-action-cancel").entwine({onclick:function(e){window.history.length>1?window.history.back():this.parents("form").trigger("submit",[this]),e.preventDefault()}}),$(".cms-edit-form .ss-tabset").entwine({onmatch:function(){if(!this.hasClass("ss-ui-action-tabset")){var tabs=this.find("> ul:first");1==tabs.children("li").length&&tabs.hide().parent().addClass("ss-tabset-tabshidden")}this._super()},onunmatch:function(){this._super()}})});var errorMessage=function(text){jQuery.noticeAdd({text:text,type:"error",stayTime:5e3,inEffect:{left:"0",opacity:"show"}})}},{i18n:"i18n",jQuery:"jQuery"}],7:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].entwine("ss",function($){$(".cms-description-toggle").entwine({onadd:function(){var shown=!1,fieldId=this.prop("id").substr(0,this.prop("id").indexOf("_Holder")),$trigger=this.find(".cms-description-trigger"),$description=this.find(".description");this.hasClass("description-toggle-enabled")||(0===$trigger.length&&($trigger=this.find(".middleColumn").first().after('<label class="right" for="'+fieldId+'"><a class="cms-description-trigger" href="javascript:void(0)"><span class="btn-icon-information"></span></a></label>').next()),this.addClass("description-toggle-enabled"),$trigger.on("click",function(){$description[shown?"hide":"show"](),shown=!shown}),$description.hide())}})})},{jQuery:"jQuery"}],8:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].entwine("ss",function($){$(".cms .field.cms-description-tooltip").entwine({onmatch:function(){this._super();var descriptionEl=this.find(".description");descriptionEl.length&&(this.attr("title",descriptionEl.text()).tooltip({content:descriptionEl.html()}),descriptionEl.remove())}}),$(".cms .field.cms-description-tooltip :input").entwine({onfocusin:function(e){this.closest(".field").tooltip("open")},onfocusout:function(e){this.closest(".field").tooltip("close")}})})},{jQuery:"jQuery"}],9:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].fn.layout.defaults.resize=!1,jLayout="undefined"==typeof jLayout?{}:jLayout,jLayout.threeColumnCompressor=function(spec,options){function typeLayout(type){var func=type+"Size";return function(container){var menuSize=menu[func](),contentSize=content[func](),previewSize=preview[func](),insets=container.insets();return width=menuSize.width+contentSize.width+previewSize.width,height=Math.max(menuSize.height,contentSize.height,previewSize.height),{width:insets.left+insets.right+width,height:insets.top+insets.bottom+height}}}if("undefined"==typeof spec.menu||"undefined"==typeof spec.content||"undefined"==typeof spec.preview)throw'Spec is invalid. Please provide "menu", "content" and "preview" elements.';if("undefined"==typeof options.minContentWidth||"undefined"==typeof options.minPreviewWidth||"undefined"==typeof options.mode)throw'Spec is invalid. Please provide "minContentWidth", "minPreviewWidth", "mode"';if("split"!==options.mode&&"content"!==options.mode&&"preview"!==options.mode)throw'Spec is invalid. "mode" should be either "split", "content" or "preview"';var obj={options:options},menu=_jQuery2["default"].jLayoutWrap(spec.menu),content=_jQuery2["default"].jLayoutWrap(spec.content),preview=_jQuery2["default"].jLayoutWrap(spec.preview);return obj.layout=function(container){var size=container.bounds(),insets=container.insets(),top=insets.top,bottom=size.height-insets.bottom,left=insets.left,right=size.width-insets.right,menuWidth=spec.menu.width(),contentWidth=0,previewWidth=0;"preview"===this.options.mode?(contentWidth=0,previewWidth=right-left-menuWidth):"content"===this.options.mode?(contentWidth=right-left-menuWidth,previewWidth=0):(contentWidth=(right-left-menuWidth)/2,previewWidth=right-left-(menuWidth+contentWidth),contentWidth<this.options.minContentWidth?(contentWidth=this.options.minContentWidth,previewWidth=right-left-(menuWidth+contentWidth)):previewWidth<this.options.minPreviewWidth&&(previewWidth=this.options.minPreviewWidth,contentWidth=right-left-(menuWidth+previewWidth)),(contentWidth<this.options.minContentWidth||previewWidth<this.options.minPreviewWidth)&&(contentWidth=right-left-menuWidth,previewWidth=0));var prehidden={content:spec.content.hasClass("column-hidden"),preview:spec.preview.hasClass("column-hidden")},posthidden={content:0===contentWidth,preview:0===previewWidth};return spec.content.toggleClass("column-hidden",posthidden.content),spec.preview.toggleClass("column-hidden",posthidden.preview),menu.bounds({x:left,y:top,height:bottom-top,width:menuWidth}),menu.doLayout(),left+=menuWidth,content.bounds({x:left,y:top,height:bottom-top,width:contentWidth}),posthidden.content||content.doLayout(),left+=contentWidth,preview.bounds({x:left,y:top,height:bottom-top,width:previewWidth}),posthidden.preview||preview.doLayout(),posthidden.content!==prehidden.content&&spec.content.trigger("columnvisibilitychanged"),posthidden.preview!==prehidden.preview&&spec.preview.trigger("columnvisibilitychanged"),contentWidth+previewWidth<options.minContentWidth+options.minPreviewWidth?spec.preview.trigger("disable"):spec.preview.trigger("enable"),container},obj.preferred=typeLayout("preferred"),obj.minimum=typeLayout("minimum"),obj.maximum=typeLayout("maximum"),obj}},{jQuery:"jQuery"}],10:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].entwine("ss",function($){$(".cms-panel.cms-menu").entwine({togglePanel:function(doExpand,silent,doSaveState){$(".cms-menu-list").children("li").each(function(){doExpand?$(this).children("ul").each(function(){$(this).removeClass("collapsed-flyout"),$(this).data("collapse")&&($(this).removeData("collapse"),$(this).addClass("collapse"))}):$(this).children("ul").each(function(){$(this).addClass("collapsed-flyout"),$(this).hasClass("collapse"),$(this).removeClass("collapse"),$(this).data("collapse",!0)})}),this.toggleFlyoutState(doExpand),this._super(doExpand,silent,doSaveState)},toggleFlyoutState:function(bool){if(bool)$(".collapsed").find("li").show(),$(".cms-menu-list").find(".child-flyout-indicator").hide();else{$(".collapsed-flyout").find("li").each(function(){$(this).hide()});var par=$(".cms-menu-list ul.collapsed-flyout").parent();0===par.children(".child-flyout-indicator").length&&par.append('<span class="child-flyout-indicator"></span>').fadeIn(),par.children(".child-flyout-indicator").fadeIn()}},siteTreePresent:function(){return $("#cms-content-tools-CMSMain").length>0},getPersistedStickyState:function(){var persistedState,cookieValue;return void 0!==$.cookie&&(cookieValue=$.cookie("cms-menu-sticky"),void 0!==cookieValue&&null!==cookieValue&&(persistedState="true"===cookieValue)),persistedState},setPersistedStickyState:function(isSticky){void 0!==$.cookie&&$.cookie("cms-menu-sticky",isSticky,{path:"/",expires:31})},getEvaluatedCollapsedState:function(){var shouldCollapse,manualState=this.getPersistedCollapsedState(),menuIsSticky=$(".cms-menu").getPersistedStickyState(),automaticState=this.siteTreePresent();return shouldCollapse=void 0===manualState?automaticState:manualState!==automaticState&&menuIsSticky?manualState:automaticState},onadd:function(){var self=this;setTimeout(function(){self.togglePanel(!self.getEvaluatedCollapsedState(),!1,!1)},0),$(window).on("ajaxComplete",function(e){setTimeout(function(){self.togglePanel(!self.getEvaluatedCollapsedState(),!1,!1)},0)}),this._super()}}),$(".cms-menu-list").entwine({onmatch:function(){this.find("li.current").select(),this.updateItems(),this._super()},onunmatch:function(){this._super()},updateMenuFromResponse:function(xhr){var controller=xhr.getResponseHeader("X-Controller");if(controller){var item=this.find("li#Menu-"+controller.replace(/\\/g,"-").replace(/[^a-zA-Z0-9\-_:.]+/,""));item.hasClass("current")||item.select()}this.updateItems()},"from .cms-container":{onafterstatechange:function(e,data){this.updateMenuFromResponse(data.xhr)},onaftersubmitform:function(e,data){this.updateMenuFromResponse(data.xhr)}},"from .cms-edit-form":{onrelodeditform:function(e,data){this.updateMenuFromResponse(data.xmlhttp)}},getContainingPanel:function(){return this.closest(".cms-panel")},fromContainingPanel:{ontoggle:function(e){this.toggleClass("collapsed",$(e.target).hasClass("collapsed")),$(".cms-container").trigger("windowresize"),this.hasClass("collapsed")&&this.find("li.children.opened").removeClass("opened"),this.hasClass("collapsed")||$(".toggle-children.opened").closest("li").addClass("opened")}},updateItems:function(){var editPageItem=this.find("#Menu-CMSMain");editPageItem[editPageItem.is(".current")?"show":"hide"]();var currentID=$(".cms-content input[name=ID]").val();currentID&&this.find("li").each(function(){$.isFunction($(this).setRecordID)&&$(this).setRecordID(currentID)})}}),$(".cms-menu-list li").entwine({toggleFlyout:function(bool){var fly=$(this);if(fly.children("ul").first().hasClass("collapsed-flyout"))if(bool){if(!fly.children("ul").first().children("li").first().hasClass("clone")){var li=fly.clone();li.addClass("clone").css({}),li.children("ul").first().remove(),li.find("span").not(".text").remove(),li.find("a").first().unbind("click"),fly.children("ul").prepend(li)}$(".collapsed-flyout").show(),fly.addClass("opened"),fly.children("ul").find("li").fadeIn("fast")}else li&&li.remove(),$(".collapsed-flyout").hide(),fly.removeClass("opened"),fly.find("toggle-children").removeClass("opened"),fly.children("ul").find("li").hide()}}),$(".cms-menu-list li").hoverIntent(function(){$(this).toggleFlyout(!0)},function(){$(this).toggleFlyout(!1)}),$(".cms-menu-list .toggle").entwine({onclick:function(e){e.preventDefault(),$(this).toogleFlyout(!0)}}),$(".cms-menu-list li").entwine({onmatch:function(){this.find("ul").length&&this.find("a:first").append('<span class="toggle-children"><span class="toggle-children-icon"></span></span>'),this._super()},onunmatch:function(){this._super()},toggle:function(){this[this.hasClass("opened")?"close":"open"]()},open:function(){var parent=this.getMenuItem();parent&&parent.open(),this.find("li.clone")&&this.find("li.clone").remove(),
this.addClass("opened").find("ul").show(),this.find(".toggle-children").addClass("opened")},close:function(){this.removeClass("opened").find("ul").hide(),this.find(".toggle-children").removeClass("opened")},select:function(){var parent=this.getMenuItem();if(this.addClass("current").open(),this.siblings().removeClass("current").close(),this.siblings().find("li").removeClass("current"),parent){var parentSiblings=parent.siblings();parent.addClass("current"),parentSiblings.removeClass("current").close(),parentSiblings.find("li").removeClass("current").close()}this.getMenu().updateItems(),this.trigger("select")}}),$(".cms-menu-list *").entwine({getMenu:function(){return this.parents(".cms-menu-list:first")}}),$(".cms-menu-list li *").entwine({getMenuItem:function(){return this.parents("li:first")}}),$(".cms-menu-list li a").entwine({onclick:function(e){var isExternal=$.path.isExternal(this.attr("href"));if(!(e.which>1||isExternal)&&"_blank"!=this.attr("target")){e.preventDefault();var item=this.getMenuItem(),url=this.attr("href");isExternal||(url=$("base").attr("href")+url);var children=item.find("li");children.length?children.first().find("a").click():document.location.href=url,item.select()}}}),$(".cms-menu-list li .toggle-children").entwine({onclick:function(e){var li=this.closest("li");return li.toggle(),!1}}),$(".cms .profile-link").entwine({onclick:function(){return $(".cms-container").loadPanel(this.attr("href")),$(".cms-menu-list li").removeClass("current").close(),!1}}),$(".cms-menu .sticky-toggle").entwine({onadd:function(){var isSticky=!!$(".cms-menu").getPersistedStickyState();this.toggleCSS(isSticky),this.toggleIndicator(isSticky),this._super()},toggleCSS:function(isSticky){this[isSticky?"addClass":"removeClass"]("active")},toggleIndicator:function(isSticky){this.next(".sticky-status-indicator").text(isSticky?"fixed":"auto")},onclick:function(){var $menu=this.closest(".cms-menu"),persistedCollapsedState=$menu.getPersistedCollapsedState(),persistedStickyState=$menu.getPersistedStickyState(),newStickyState=void 0===persistedStickyState?!this.hasClass("active"):!persistedStickyState;void 0===persistedCollapsedState?$menu.setPersistedCollapsedState($menu.hasClass("collapsed")):void 0!==persistedCollapsedState&&newStickyState===!1&&$menu.clearPersistedCollapsedState(),$menu.setPersistedStickyState(newStickyState),this.toggleCSS(newStickyState),this.toggleIndicator(newStickyState),this._super()}})})},{jQuery:"jQuery"}],11:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].entwine("ss",function($){$.entwine.warningLevel=$.entwine.WARN_LEVEL_BESTPRACTISE,$(".cms-panel").entwine({WidthExpanded:null,WidthCollapsed:null,canSetCookie:function(){return void 0!==$.cookie&&void 0!==this.attr("id")},getPersistedCollapsedState:function(){var isCollapsed,cookieValue;return this.canSetCookie()&&(cookieValue=$.cookie("cms-panel-collapsed-"+this.attr("id")),void 0!==cookieValue&&null!==cookieValue&&(isCollapsed="true"===cookieValue)),isCollapsed},setPersistedCollapsedState:function(newState){this.canSetCookie()&&$.cookie("cms-panel-collapsed-"+this.attr("id"),newState,{path:"/",expires:31})},clearPersistedCollapsedState:function(){this.canSetCookie()&&$.cookie("cms-panel-collapsed-"+this.attr("id"),"",{path:"/",expires:-1})},getInitialCollapsedState:function(){var isCollapsed=this.getPersistedCollapsedState();return void 0===isCollapsed&&(isCollapsed=this.hasClass("collapsed")),isCollapsed},onadd:function(){var collapsedContent,container;if(!this.find(".cms-panel-content").length)throw new Exception('Content panel for ".cms-panel" not found');this.find(".cms-panel-toggle").length||(container=$("<div class='cms-panel-toggle south'></div>").append('<a class="toggle-expand" href="#"><span>&raquo;</span></a>').append('<a class="toggle-collapse" href="#"><span>&laquo;</span></a>'),this.append(container)),this.setWidthExpanded(this.find(".cms-panel-content").innerWidth()),collapsedContent=this.find(".cms-panel-content-collapsed"),this.setWidthCollapsed(collapsedContent.length?collapsedContent.innerWidth():this.find(".toggle-expand").innerWidth()),this.togglePanel(!this.getInitialCollapsedState(),!0,!1),this._super()},togglePanel:function(doExpand,silent,doSaveState){var newWidth,collapsedContent;silent||(this.trigger("beforetoggle.sspanel",doExpand),this.trigger(doExpand?"beforeexpand":"beforecollapse")),this.toggleClass("collapsed",!doExpand),newWidth=doExpand?this.getWidthExpanded():this.getWidthCollapsed(),this.width(newWidth),collapsedContent=this.find(".cms-panel-content-collapsed"),collapsedContent.length&&(this.find(".cms-panel-content")[doExpand?"show":"hide"](),this.find(".cms-panel-content-collapsed")[doExpand?"hide":"show"]()),doSaveState!==!1&&this.setPersistedCollapsedState(!doExpand),this.trigger("toggle",doExpand),this.trigger(doExpand?"expand":"collapse")},expandPanel:function(force){(force||this.hasClass("collapsed"))&&this.togglePanel(!0)},collapsePanel:function(force){!force&&this.hasClass("collapsed")||this.togglePanel(!1)}}),$(".cms-panel.collapsed .cms-panel-toggle").entwine({onclick:function(e){this.expandPanel(),e.preventDefault()}}),$(".cms-panel *").entwine({getPanel:function(){return this.parents(".cms-panel:first")}}),$(".cms-panel .toggle-expand").entwine({onclick:function(e){e.preventDefault(),e.stopPropagation(),this.getPanel().expandPanel(),this._super(e)}}),$(".cms-panel .toggle-collapse").entwine({onclick:function(e){e.preventDefault(),e.stopPropagation(),this.getPanel().collapsePanel(),this._super(e)}}),$(".cms-content-tools.collapsed").entwine({onclick:function(e){this.expandPanel(),this._super(e)}})})},{jQuery:"jQuery"}],12:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery),_i18n=require("i18n"),_i18n2=_interopRequireDefault(_i18n);_jQuery2["default"].entwine("ss.preview",function($){$(".cms-preview").entwine({AllowedStates:["StageLink","LiveLink","ArchiveLink"],CurrentStateName:null,CurrentSizeName:"auto",IsPreviewEnabled:!1,DefaultMode:"split",Sizes:{auto:{width:"100%",height:"100%"},mobile:{width:"335px",height:"568px"},mobileLandscape:{width:"583px",height:"320px"},tablet:{width:"783px",height:"1024px"},tabletLandscape:{width:"1039px",height:"768px"},desktop:{width:"1024px",height:"800px"}},changeState:function(stateName,save){var self=this,states=this._getNavigatorStates();return save!==!1&&$.each(states,function(index,state){self.saveState("state",stateName)}),this.setCurrentStateName(stateName),this._loadCurrentState(),this.redraw(),this},changeMode:function(modeName,save){var container=$(".cms-container");if("split"==modeName)container.entwine(".ss").splitViewMode(),this.setIsPreviewEnabled(!0),this._loadCurrentState();else if("content"==modeName)container.entwine(".ss").contentViewMode(),this.setIsPreviewEnabled(!1);else{if("preview"!=modeName)throw"Invalid mode: "+modeName;container.entwine(".ss").previewMode(),this.setIsPreviewEnabled(!0),this._loadCurrentState()}return save!==!1&&this.saveState("mode",modeName),this.redraw(),this},changeSize:function(sizeName){var sizes=this.getSizes();return this.setCurrentSizeName(sizeName),this.removeClass("auto desktop tablet mobile").addClass(sizeName),this.find(".preview-device-outer").width(sizes[sizeName].width).height(sizes[sizeName].height),this.find(".preview-device-inner").width(sizes[sizeName].width),this.saveState("size",sizeName),this.redraw(),this},redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0));var currentStateName=this.getCurrentStateName();currentStateName&&this.find(".cms-preview-states").changeVisibleState(currentStateName);var layoutOptions=$(".cms-container").entwine(".ss").getLayoutOptions();layoutOptions&&$(".preview-mode-selector").changeVisibleMode(layoutOptions.mode);var currentSizeName=this.getCurrentSizeName();return currentSizeName&&this.find(".preview-size-selector").changeVisibleSize(this.getCurrentSizeName()),this},saveState:function(name,value){this._supportsLocalStorage()&&window.localStorage.setItem("cms-preview-state-"+name,value)},loadState:function(name){return this._supportsLocalStorage()?window.localStorage.getItem("cms-preview-state-"+name):void 0},disablePreview:function(){return this.setPendingURL(null),this._loadUrl("about:blank"),this._block(),this.changeMode("content",!1),this.setIsPreviewEnabled(!1),this},enablePreview:function(){return this.getIsPreviewEnabled()||(this.setIsPreviewEnabled(!0),$.browser.msie&&$.browser.version.slice(0,3)<=7?this.changeMode("content"):this.changeMode(this.getDefaultMode(),!1)),this},getOrAppendFontFixStyleElement:function(){var style=$("#FontFixStyleElement");return style.length||(style=$('<style type="text/css" id="FontFixStyleElement" disabled="disabled">:before,:after{content:none !important}</style>').appendTo("head")),style},onadd:function(){var self=this,iframe=(this.parent(),this.find("iframe"));iframe.addClass("center"),iframe.bind("load",function(){self._adjustIframeForPreview(),self._loadCurrentPage(),$(this).removeClass("loading")}),$.browser.msie&&8===parseInt($.browser.version,10)&&iframe.bind("readystatechange",function(e){"interactive"==iframe[0].readyState&&(self.getOrAppendFontFixStyleElement().removeAttr("disabled"),setTimeout(function(){self.getOrAppendFontFixStyleElement().attr("disabled","disabled")},0))}),this.append('<div class="cms-preview-overlay ui-widget-overlay-light"></div>'),this.find(".cms-preview-overlay").hide(),this.disablePreview(),this._super()},_supportsLocalStorage:function(){var storage,result,uid=new Date;try{return(storage=window.localStorage).setItem(uid,uid),result=storage.getItem(uid)==uid,storage.removeItem(uid),result&&storage}catch(exception){console.warn("localStorge is not available due to current browser / system settings.")}},onenable:function(){var $viewModeSelector=$(".preview-mode-selector");$viewModeSelector.removeClass("split-disabled"),$viewModeSelector.find(".disabled-tooltip").hide()},ondisable:function(){var $viewModeSelector=$(".preview-mode-selector");$viewModeSelector.addClass("split-disabled"),$viewModeSelector.find(".disabled-tooltip").show()},_block:function(){return this.addClass("blocked"),this.find(".cms-preview-overlay").show(),this},_unblock:function(){return this.removeClass("blocked"),this.find(".cms-preview-overlay").hide(),this},_initialiseFromContent:function(){var mode,size;return $(".cms-previewable").length?(mode=this.loadState("mode"),size=this.loadState("size"),this._moveNavigator(),mode&&"content"==mode||(this.enablePreview(),this._loadCurrentState()),this.redraw(),mode&&this.changeMode(mode),size&&this.changeSize(size)):this.disablePreview(),this},"from .cms-container":{onafterstatechange:function(e,data){data.xhr.getResponseHeader("X-ControllerURL")||this._initialiseFromContent()}},PendingURL:null,oncolumnvisibilitychanged:function(){var url=this.getPendingURL();url&&!this.is(".column-hidden")&&(this.setPendingURL(null),this._loadUrl(url),this._unblock())},"from .cms-container .cms-edit-form":{onaftersubmitform:function(){this._initialiseFromContent()}},_loadUrl:function(url){return this.find("iframe").addClass("loading").attr("src",url),this},_getNavigatorStates:function(){var urlMap=$.map(this.getAllowedStates(),function(name){var stateLink=$(".cms-preview-states .state-name[data-name="+name+"]");return stateLink.length?{name:name,url:stateLink.attr("href"),active:stateLink.hasClass("active")}:null});return urlMap},_loadCurrentState:function(){if(!this.getIsPreviewEnabled())return this;var states=this._getNavigatorStates(),currentStateName=this.getCurrentStateName(),currentState=null;states&&(currentState=$.grep(states,function(state,index){return currentStateName===state.name||!currentStateName&&state.active}));var url=null;return currentState[0]?url=currentState[0].url:states.length?(this.setCurrentStateName(states[0].name),url=states[0].url):this.setCurrentStateName(null),url&&(url+=(-1===url.indexOf("?")?"?":"&")+"CMSPreview=1"),this.is(".column-hidden")?(this.setPendingURL(url),this._loadUrl("about:blank"),this._block()):(this.setPendingURL(null),url?(this._loadUrl(url),this._unblock()):this._block()),this},_moveNavigator:function(){var previewEl=$(".cms-preview .cms-preview-controls"),navigatorEl=$(".cms-edit-form .cms-navigator");navigatorEl.length&&previewEl.length?previewEl.html($(".cms-edit-form .cms-navigator").detach()):this._block()},_loadCurrentPage:function(){if(this.getIsPreviewEnabled()){var doc;$(".cms-container");try{doc=this.find("iframe")[0].contentDocument}catch(e){console.warn("Unable to access iframe, possible https mis-match")}if(doc){var id=$(doc).find("meta[name=x-page-id]").attr("content"),editLink=$(doc).find("meta[name=x-cms-edit-link]").attr("content"),contentPanel=$(".cms-content");id&&contentPanel.find(":input[name=ID]").val()!=id&&$(".cms-container").entwine(".ss").loadPanel(editLink)}}},_adjustIframeForPreview:function(){var doc,iframe=this.find("iframe")[0];if(iframe){try{doc=iframe.contentDocument}catch(e){console.warn("Unable to access iframe, possible https mis-match")}if(doc){for(var links=doc.getElementsByTagName("A"),i=0;i<links.length;i++){var href=links[i].getAttribute("href");href&&href.match(/^http:\/\//)&&links[i].setAttribute("target","_blank")}var navi=doc.getElementById("SilverStripeNavigator");navi&&(navi.style.display="none");var naviMsg=doc.getElementById("SilverStripeNavigatorMessage");naviMsg&&(naviMsg.style.display="none"),this.trigger("afterIframeAdjustedForPreview",[doc])}}}}),$(".cms-edit-form").entwine({onadd:function(){this._super(),$(".cms-preview")._initialiseFromContent()}}),$(".cms-preview-states").entwine({changeVisibleState:function(state){this.find('[data-name="'+state+'"]').addClass("active").siblings().removeClass("active")}}),$(".cms-preview-states .state-name").entwine({onclick:function(e){if(1==e.which){var targetStateName=$(this).attr("data-name");this.addClass("active").siblings().removeClass("active"),$(".cms-preview").changeState(targetStateName),e.preventDefault()}}}),$(".preview-mode-selector").entwine({changeVisibleMode:function(mode){this.find("select").val(mode).trigger("chosen:updated")._addIcon()}}),$(".preview-mode-selector select").entwine({onchange:function(e){this._super(e),e.preventDefault();var targetStateName=$(this).val();$(".cms-preview").changeMode(targetStateName)}}),$(".cms-preview.column-hidden").entwine({onmatch:function(){$("#preview-mode-dropdown-in-content").show(),$(".cms-preview .result-selected").hasClass("font-icon-columns")&&statusMessage(_i18n2["default"]._t("LeftAndMain.DISABLESPLITVIEW","Screen too small to show site preview in split mode"),"error"),this._super()},onunmatch:function(){$("#preview-mode-dropdown-in-content").hide(),this._super()}}),$("#preview-mode-dropdown-in-content").entwine({onmatch:function(){$(".cms-preview").is(".column-hidden")?this.show():this.hide(),this._super()},onunmatch:function(){this._super()}}),$(".preview-size-selector").entwine({changeVisibleSize:function(size){this.find("select").val(size).trigger("chosen:updated")._addIcon()}}),$(".preview-size-selector select").entwine({onchange:function(e){e.preventDefault();var targetSizeName=$(this).val();$(".cms-preview").changeSize(targetSizeName)}}),$(".preview-selector select.preview-dropdown").entwine({"onchosen:ready":function(){this._super(),this._addIcon()},_addIcon:function(){var selected=this.find(":selected"),iconClass=selected.attr("data-icon"),target=this.parent().find(".chosen-container a.chosen-single"),oldIcon=target.attr("data-icon");return"undefined"!=typeof oldIcon&&target.removeClass(oldIcon),target.addClass(iconClass),target.attr("data-icon",iconClass),this}}),$(".preview-mode-selector .chosen-drop li:last-child").entwine({onmatch:function(){$(".preview-mode-selector").hasClass("split-disabled")?this.parent().append('<div class="disabled-tooltip"></div>'):this.parent().append('<div class="disabled-tooltip" style="display: none;"></div>')}}),$(".preview-device-outer").entwine({onclick:function(){this.toggleClass("rotate")}})})},{i18n:"i18n",jQuery:"jQuery"}],13:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].entwine("ss.tree",function($){$(".cms-tree").entwine({Hints:null,IsUpdatingTree:!1,IsLoaded:!1,onadd:function(){if(this._super(),!$.isNumeric(this.data("jstree_instance_id"))){var hints=this.attr("data-hints");hints&&this.setHints($.parseJSON(hints));var self=this;this.jstree(this.getTreeConfig()).bind("loaded.jstree",function(e,data){self.setIsLoaded(!0),data.inst._set_settings({html_data:{ajax:{url:self.data("urlTree"),data:function(node){var params=self.data("searchparams")||[];return params=$.grep(params,function(n,i){return"ID"!=n.name&&"value"!=n.name}),params.push({name:"ID",value:$(node).data("id")?$(node).data("id"):0}),params.push({name:"ajax",value:1}),params}}}}),self.updateFromEditForm(),self.css("visibility","visible"),data.inst.hide_checkboxes()}).bind("before.jstree",function(e,data){if("start_drag"==data.func&&(!self.hasClass("draggable")||self.hasClass("multiselect")))return e.stopImmediatePropagation(),!1;if($.inArray(data.func,["check_node","uncheck_node"])){var node=$(data.args[0]).parents("li:first"),allowedChildren=node.find("li:not(.disabled)");if(node.hasClass("disabled")&&0==allowedChildren)return e.stopImmediatePropagation(),!1}}).bind("move_node.jstree",function(e,data){if(!self.getIsUpdatingTree()){var movedNode=data.rslt.o,newParentNode=data.rslt.np,newParentID=(data.inst._get_parent(movedNode),$(newParentNode).data("id")||0),nodeID=$(movedNode).data("id"),siblingIDs=$.map($(movedNode).siblings().andSelf(),function(el){return $(el).data("id")});$.ajax({url:$.path.addSearchParams(self.data("urlSavetreenode"),self.data("extraParams")),type:"POST",data:{ID:nodeID,ParentID:newParentID,SiblingIDs:siblingIDs},success:function(){$(".cms-edit-form :input[name=ID]").val()==nodeID&&$(".cms-edit-form :input[name=ParentID]").val(newParentID),self.updateNodesFromServer([nodeID])},statusCode:{403:function(){$.jstree.rollback(data.rlbk)}}})}}).bind("select_node.jstree check_node.jstree uncheck_node.jstree",function(e,data){$(document).triggerHandler(e,data)})}},onremove:function(){this.jstree("destroy"),this._super()},"from .cms-container":{onafterstatechange:function(e){this.updateFromEditForm()}},"from .cms-container form":{onaftersubmitform:function(e){var id=$(".cms-edit-form :input[name=ID]").val();this.updateNodesFromServer([id])}},getTreeConfig:function(){var self=this;return{core:{initially_open:["record-0"],animation:0,html_titles:!0},html_data:{},ui:{select_limit:1,initially_select:[this.find(".current").attr("id")]},crrm:{move:{check_move:function(data){var movedNode=$(data.o),newParent=$(data.np),isMovedOntoContainer=data.ot.get_container()[0]==data.np[0],movedNodeClass=movedNode.getClassname(),newParentClass=newParent.getClassname(),hints=self.getHints(),disallowedChildren=[],hintKey=newParentClass?newParentClass:"Root",hint=hints&&"undefined"!=typeof hints[hintKey]?hints[hintKey]:null;hint&&movedNode.attr("class").match(/VirtualPage-([^\s]*)/)&&(movedNodeClass=RegExp.$1),hint&&(disallowedChildren="undefined"!=typeof hint.disallowedChildren?hint.disallowedChildren:[]);var isAllowed=!(0===movedNode.data("id")||movedNode.hasClass("status-archived")||isMovedOntoContainer&&"inside"!=data.p||newParent.hasClass("nochildren")||disallowedChildren.length&&-1!=$.inArray(movedNodeClass,disallowedChildren));return isAllowed}}},dnd:{drop_target:!1,drag_target:!1},checkbox:{two_state:!0},themes:{theme:"apple",url:$("body").data("frameworkpath")+"/thirdparty/jstree/themes/apple/style.css"},plugins:["html_data","ui","dnd","crrm","themes","checkbox"]}},search:function(params,callback){params?this.data("searchparams",params):this.removeData("searchparams"),this.jstree("refresh",-1,callback)},getNodeByID:function(id){return this.find("*[data-id="+id+"]")},createNode:function(html,data,callback){var self=this,parentNode=void 0!==data.ParentID?self.getNodeByID(data.ParentID):!1,newNode=$(html),properties={data:""};newNode.hasClass("jstree-open")?properties.state="open":newNode.hasClass("jstree-closed")&&(properties.state="closed"),this.jstree("create_node",parentNode.length?parentNode:-1,"last",properties,function(node){for(var origClasses=node.attr("class"),i=0;i<newNode[0].attributes.length;i++){var attr=newNode[0].attributes[i];node.attr(attr.name,attr.value)}node.addClass(origClasses).html(newNode.html()),callback(node)})},updateNode:function(node,html,data){var newNode=$(html),nextNode=data.NextID?this.getNodeByID(data.NextID):!1,prevNode=data.PrevID?this.getNodeByID(data.PrevID):!1,parentNode=data.ParentID?this.getNodeByID(data.ParentID):!1;$.each(["id","style","class","data-pagetype"],function(i,attrName){node.attr(attrName,newNode.attr(attrName))});var origChildren=node.children("ul").detach();node.html(newNode.html()).append(origChildren),nextNode&&nextNode.length?this.jstree("move_node",node,nextNode,"before"):prevNode&&prevNode.length?this.jstree("move_node",node,prevNode,"after"):this.jstree("move_node",node,parentNode.length?parentNode:-1)},updateFromEditForm:function(){var node,id=$(".cms-edit-form :input[name=ID]").val();id?(node=this.getNodeByID(id),node.length?(this.jstree("deselect_all"),this.jstree("select_node",node)):this.updateNodesFromServer([id])):this.jstree("deselect_all")},updateNodesFromServer:function(ids){if(!this.getIsUpdatingTree()&&this.getIsLoaded()){var self=this,includesNewNode=!1;this.setIsUpdatingTree(!0),self.jstree("save_selected");var correctStateFn=function(node){self.getNodeByID(node.data("id")).not(node).remove(),self.jstree("deselect_all"),self.jstree("select_node",node)};self.jstree("open_node",this.getNodeByID(0)),self.jstree("save_opened"),self.jstree("save_selected"),$.ajax({url:$.path.addSearchParams(this.data("urlUpdatetreenodes"),"ids="+ids.join(",")),dataType:"json",success:function(data,xhr){$.each(data,function(nodeId,nodeData){var node=self.getNodeByID(nodeId);return nodeData?void(node.length?(self.updateNode(node,nodeData.html,nodeData),setTimeout(function(){correctStateFn(node)},500)):(includesNewNode=!0,nodeData.ParentID&&!self.find("li[data-id="+nodeData.ParentID+"]").length?self.jstree("load_node",-1,function(){newNode=self.find("li[data-id="+nodeId+"]"),correctStateFn(newNode)}):self.createNode(nodeData.html,nodeData,function(newNode){correctStateFn(newNode)}))):void self.jstree("delete_node",node)}),includesNewNode||(self.jstree("deselect_all"),self.jstree("reselect"),self.jstree("reopen"))},complete:function(){self.setIsUpdatingTree(!1)}})}}}),$(".cms-tree.multiple").entwine({onmatch:function(){this._super(),this.jstree("show_checkboxes")},onunmatch:function(){this._super(),this.jstree("uncheck_all"),this.jstree("hide_checkboxes")},getSelectedIDs:function(){return $(this).jstree("get_checked").not(".disabled").map(function(){return $(this).data("id")}).get()}}),$(".cms-tree li").entwine({setEnabled:function(bool){this.toggleClass("disabled",!bool)},getClassname:function(){var matches=this.attr("class").match(/class-([^\s]*)/i);return matches?matches[1]:""},getID:function(){return this.data("id")}})})},{jQuery:"jQuery"}],14:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].entwine("ss",function($){$(".TreeDropdownField").entwine({"from .cms-container form":{onaftersubmitform:function(e){this.find(".tree-holder").empty(),this._super()}}})})},{jQuery:"jQuery"}],15:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery),windowWidth,windowHeight;_jQuery2["default"].noConflict(),window.ss=window.ss||{},window.ss.debounce=function(func,wait,immediate){var timeout,context,args,later=function(){timeout=null,immediate||func.apply(context,args)};return function(){var callNow=immediate&&!timeout;context=this,args=arguments,clearTimeout(timeout),timeout=setTimeout(later,wait),callNow&&func.apply(context,args)}},(0,_jQuery2["default"])(window).bind("resize.leftandmain",function(e){(0,_jQuery2["default"])(".cms-container").trigger("windowresize")}),_jQuery2["default"].entwine.warningLevel=_jQuery2["default"].entwine.WARN_LEVEL_BESTPRACTISE,_jQuery2["default"].entwine("ss",function($){$(window).on("message",function(e){var target,event=e.originalEvent,data="object"===_typeof(event.data)?event.data:JSON.parse(event.data);if($.path.parseUrl(window.location.href).domain===$.path.parseUrl(event.origin).domain)switch(target=$("undefined"==typeof data.target?window:data.target),data.type){case"event":target.trigger(data.event,data.data);break;case"callback":target[data.callback].call(target,data.data)}});var positionLoadingSpinner=function(){var offset=120,spinner=$(".ss-loading-screen .loading-animation"),top=($(window).height()-spinner.height())/2;spinner.css("top",top+offset),spinner.show()},applyChosen=function applyChosen(el){el.is(":visible")?el.addClass("has-chosen").chosen({allow_single_deselect:!0,disable_search_threshold:20,display_disabled_options:!0}):setTimeout(function(){el.show(),applyChosen(el)},500)},isSameUrl=function(url1,url2){var baseUrl=$("base").attr("href");url1=$.path.isAbsoluteUrl(url1)?url1:$.path.makeUrlAbsolute(url1,baseUrl),url2=$.path.isAbsoluteUrl(url2)?url2:$.path.makeUrlAbsolute(url2,baseUrl);var url1parts=$.path.parseUrl(url1),url2parts=$.path.parseUrl(url2);return url1parts.pathname.replace(/\/*$/,"")==url2parts.pathname.replace(/\/*$/,"")&&url1parts.search==url2parts.search},ajaxCompleteEvent=window.ss.debounce(function(){$(window).trigger("ajaxComplete")},1e3,!0);$(window).bind("resize",positionLoadingSpinner).trigger("resize"),$(document).ajaxComplete(function(e,xhr,settings){var origUrl=document.URL,url=xhr.getResponseHeader("X-ControllerURL"),destUrl=settings.url,msg=null!==xhr.getResponseHeader("X-Status")?xhr.getResponseHeader("X-Status"):xhr.statusText,msgType=xhr.status<200||xhr.status>399?"bad":"good",ignoredMessages=["OK","success","HTTP/2.0 200"];return null===url||isSameUrl(origUrl,url)&&isSameUrl(destUrl,url)||window.ss.router.show(url,{id:(new Date).getTime()+String(Math.random()).replace(/\D/g,""),pjax:xhr.getResponseHeader("X-Pjax")?xhr.getResponseHeader("X-Pjax"):settings.headers["X-Pjax"]}),xhr.getResponseHeader("X-Reauthenticate")?void $(".cms-container").showLoginDialog():(0!==xhr.status&&msg&&-1===$.inArray(msg,ignoredMessages)&&statusMessage(decodeURIComponent(msg),msgType),void ajaxCompleteEvent(this))}),$(".cms-container").entwine({StateChangeXHR:null,FragmentXHR:{},StateChangeCount:0,LayoutOptions:{minContentWidth:940,minPreviewWidth:400,mode:"content"},onadd:function(){return $.browser.msie&&parseInt($.browser.version,10)<8?($(".ss-loading-screen").append('<p class="ss-loading-incompat-warning"><span class="notice">Your browser is not compatible with the CMS interface. Please use Internet Explorer 8+, Google Chrome or Mozilla Firefox.</span></p>').css("z-index",$(".ss-loading-screen").css("z-index")+1),$(".loading-animation").remove(),void this._super()):(this.redraw(),$(".ss-loading-screen").hide(),$("body").removeClass("loading"),$(window).unbind("resize",positionLoadingSpinner),this.restoreTabState(),void this._super())},onwindowresize:function(){this.redraw()},"from .cms-panel":{ontoggle:function(){this.redraw()}},"from .cms-container":{onaftersubmitform:function(){this.redraw()}},"from .cms-menu-list li a":{onclick:function(e){var href=$(e.target).attr("href");e.which>1||href==this._tabStateUrl()||this.splitViewMode()}},updateLayoutOptions:function(newSpec){var spec=this.getLayoutOptions(),dirty=!1;for(var k in newSpec)spec[k]!==newSpec[k]&&(spec[k]=newSpec[k],dirty=!0);dirty&&this.redraw()},splitViewMode:function(){this.updateLayoutOptions({mode:"split"})},contentViewMode:function(){this.updateLayoutOptions({mode:"content"})},previewMode:function(){this.updateLayoutOptions({mode:"preview"})},RedrawSuppression:!1,redraw:function(){this.getRedrawSuppression()||(window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.data("jlayout",jLayout.threeColumnCompressor({menu:this.children(".cms-menu"),content:this.children(".cms-content"),preview:this.children(".cms-preview")},this.getLayoutOptions())),this.layout(),this.find(".cms-panel-layout").redraw(),this.find(".cms-content-fields[data-layout-type]").redraw(),this.find(".cms-edit-form[data-layout-type]").redraw(),this.find(".cms-preview").redraw(),this.find(".cms-content").redraw())},checkCanNavigate:function(selectors){var contentEls=this._findFragments(selectors||["Content"]),trackedEls=contentEls.find(":data(changetracker)").add(contentEls.filter(":data(changetracker)")),safe=!0;return trackedEls.length?(trackedEls.each(function(){$(this).confirmUnsavedChanges()||(safe=!1)}),safe):!0},loadPanel:function(url){var data=(arguments.length<=1||void 0===arguments[1]?"":arguments[1],arguments.length<=2||void 0===arguments[2]?{}:arguments[2]),forceReload=arguments[3],forceReferer=arguments.length<=4||void 0===arguments[4]?document.URL:arguments[4];this.checkCanNavigate(data.pjax?data.pjax.split(","):["Content"])&&(this.saveTabState(),data.__forceReferer=forceReferer,forceReload&&(data.__forceReload=1+Math.random()),window.ss.router.show(url,data))},reloadCurrentPanel:function(){this.loadPanel(document.URL,null,null,!0)},submitForm:function(form,button,callback,ajaxOptions){var self=this;button||(button=this.find(".btn-toolbar :submit[name=action_save]")),button||(button=this.find(".btn-toolbar :submit:first")),form.trigger("beforesubmitform"),this.trigger("submitform",{form:form,button:button}),$(button).addClass("loading");var validationResult=form.validate();if("undefined"!=typeof validationResult&&!validationResult)return statusMessage("Validation failed.","bad"),$(button).removeClass("loading"),!1;var formData=form.serializeArray();return formData.push({name:$(button).attr("name"),value:"1"}),formData.push({name:"BackURL",value:document.URL.replace(/\/$/,"")}),this.saveTabState(),jQuery.ajax(jQuery.extend({headers:{"X-Pjax":"CurrentForm,Breadcrumbs"},url:form.attr("action"),data:formData,type:"POST",complete:function(){$(button).removeClass("loading")},success:function(data,status,xhr){form.removeClass("changed"),callback&&callback(data,status,xhr);var newContentEls=self.handleAjaxResponse(data,status,xhr);newContentEls&&newContentEls.filter("form").trigger("aftersubmitform",{status:status,xhr:xhr,formData:formData})}},ajaxOptions)),!1},LastState:null,PauseState:!1,handleStateChange:function(event){var historyState=arguments.length<=1||void 0===arguments[1]?window.history.state:arguments[1];if(!this.getPauseState()){this.getStateChangeXHR()&&this.getStateChangeXHR().abort();var self=this,fragments=historyState.pjax||"Content",headers={},fragmentsArr=fragments.split(","),contentEls=this._findFragments(fragmentsArr);if(this.setStateChangeCount(this.getStateChangeCount()+1),!this.checkCanNavigate()){var lastState=this.getLastState();return this.setPauseState(!0),lastState&&lastState.path?window.ss.router.show(lastState.path):window.ss.router.back(),void this.setPauseState(!1)}if(this.setLastState(historyState),contentEls.length<fragmentsArr.length&&(fragments="Content",
fragmentsArr=["Content"],contentEls=this._findFragments(fragmentsArr)),this.trigger("beforestatechange",{state:historyState,element:contentEls}),headers["X-Pjax"]=fragments,"undefined"!=typeof historyState.__forceReferer){var url=historyState.__forceReferer;try{url=decodeURI(url)}catch(e){}finally{headers["X-Backurl"]=encodeURI(url)}}contentEls.addClass("loading");var promise=$.ajax({headers:headers,url:historyState.path||document.URL}).done(function(data,status,xhr){var els=self.handleAjaxResponse(data,status,xhr,historyState);self.trigger("afterstatechange",{data:data,status:status,xhr:xhr,element:els,state:historyState})}).always(function(){self.setStateChangeXHR(null),contentEls.removeClass("loading")});return this.setStateChangeXHR(promise),promise}},loadFragment:function(url,pjaxFragments){var xhr,self=this,headers={},baseUrl=$("base").attr("href"),fragmentXHR=this.getFragmentXHR();return"undefined"!=typeof fragmentXHR[pjaxFragments]&&null!==fragmentXHR[pjaxFragments]&&(fragmentXHR[pjaxFragments].abort(),fragmentXHR[pjaxFragments]=null),url=$.path.isAbsoluteUrl(url)?url:$.path.makeUrlAbsolute(url,baseUrl),headers["X-Pjax"]=pjaxFragments,xhr=$.ajax({headers:headers,url:url,success:function(data,status,xhr){var elements=self.handleAjaxResponse(data,status,xhr,null);self.trigger("afterloadfragment",{data:data,status:status,xhr:xhr,elements:elements})},error:function(xhr,status,_error){self.trigger("loadfragmenterror",{xhr:xhr,status:status,error:_error})},complete:function(){var fragmentXHR=self.getFragmentXHR();"undefined"!=typeof fragmentXHR[pjaxFragments]&&null!==fragmentXHR[pjaxFragments]&&(fragmentXHR[pjaxFragments]=null)}}),fragmentXHR[pjaxFragments]=xhr,xhr},handleAjaxResponse:function(data,status,xhr,state){var url,guessFragment,fragment,$data;if(xhr.getResponseHeader("X-Reload")&&xhr.getResponseHeader("X-ControllerURL")){var baseUrl=$("base").attr("href"),rawURL=xhr.getResponseHeader("X-ControllerURL"),url=$.path.isAbsoluteUrl(rawURL)?rawURL:$.path.makeUrlAbsolute(rawURL,baseUrl);return void(document.location.href=url)}if(data){var title=xhr.getResponseHeader("X-Title");title&&(document.title=decodeURIComponent(title.replace(/\+/g," ")));var newContentEls,newFragments={};xhr.getResponseHeader("Content-Type").match(/^((text)|(application))\/json[ \t]*;?/i)?newFragments=data:(fragment=document.createDocumentFragment(),jQuery.clean([data],document,fragment,[]),$data=$(jQuery.merge([],fragment.childNodes)),guessFragment="Content",$data.is("form")&&!$data.is("[data-pjax-fragment~=Content]")&&(guessFragment="CurrentForm"),newFragments[guessFragment]=$data),this.setRedrawSuppression(!0);try{$.each(newFragments,function(newFragment,html){var contentEl=$("[data-pjax-fragment]").filter(function(){return-1!=$.inArray(newFragment,$(this).data("pjaxFragment").split(" "))}),newContentEl=$(html);if(newContentEls?newContentEls.add(newContentEl):newContentEls=newContentEl,newContentEl.find(".cms-container").length)throw'Content loaded via ajax is not allowed to contain tags matching the ".cms-container" selector to avoid infinite loops';var origStyle=contentEl.attr("style"),origParent=contentEl.parent(),origParentLayoutApplied="undefined"!=typeof origParent.data("jlayout"),layoutClasses=["east","west","center","north","south","column-hidden"],elemClasses=contentEl.attr("class"),origLayoutClasses=[];elemClasses&&(origLayoutClasses=$.grep(elemClasses.split(" "),function(val){return $.inArray(val,layoutClasses)>=0})),newContentEl.removeClass(layoutClasses.join(" ")).addClass(origLayoutClasses.join(" ")),origStyle&&newContentEl.attr("style",origStyle);var styles=newContentEl.find("style").detach();styles.length&&$(document).find("head").append(styles),contentEl.replaceWith(newContentEl),!origParent.is(".cms-container")&&origParentLayoutApplied&&origParent.layout()});var newForm=newContentEls.filter("form");newForm.hasClass("cms-tabset")&&newForm.removeClass("cms-tabset").addClass("cms-tabset")}finally{this.setRedrawSuppression(!1)}return this.redraw(),this.restoreTabState(state&&"undefined"!=typeof state.tabState?state.tabState:null),newContentEls}},_findFragments:function(fragments){return $("[data-pjax-fragment]").filter(function(){var i,nodeFragments=$(this).data("pjaxFragment").split(" ");for(i in fragments)if(-1!=$.inArray(fragments[i],nodeFragments))return!0;return!1})},refresh:function(){$(window).trigger("statechange"),$(this).redraw()},saveTabState:function(){if("undefined"!=typeof window.sessionStorage&&null!==window.sessionStorage){var selectedTabs=[],url=this._tabStateUrl();if(this.find(".cms-tabset,.ss-tabset").each(function(i,el){var id=$(el).attr("id");id&&$(el).data("tabs")&&($(el).data("ignoreTabState")||$(el).getIgnoreTabState()||selectedTabs.push({id:id,selected:$(el).tabs("option","selected")}))}),selectedTabs){var tabsUrl="tabs-"+url;try{window.sessionStorage.setItem(tabsUrl,JSON.stringify(selectedTabs))}catch(err){if(err.code===DOMException.QUOTA_EXCEEDED_ERR&&0===window.sessionStorage.length)return;throw err}}}},restoreTabState:function(overrideStates){var self=this,url=this._tabStateUrl(),hasSessionStorage="undefined"!=typeof window.sessionStorage&&window.sessionStorage,sessionData=hasSessionStorage?window.sessionStorage.getItem("tabs-"+url):null,sessionStates=sessionData?JSON.parse(sessionData):!1;this.find(".cms-tabset, .ss-tabset").each(function(){var index,tab,tabset=$(this),tabsetId=tabset.attr("id"),forcedTab=tabset.children("ul").children("li.ss-tabs-force-active");tabset.data("tabs")&&(tabset.tabs("refresh"),forcedTab.length?index=forcedTab.first().index():overrideStates&&overrideStates[tabsetId]?(tab=tabset.find(overrideStates[tabsetId].tabSelector),tab.length&&(index=tab.index())):sessionStates&&$.each(sessionStates,function(i,state){tabsetId==state.id&&(index=state.selected)}),null!==index&&(tabset.tabs("option","active",index),self.trigger("tabstaterestored")))})},clearTabState:function(url){if("undefined"!=typeof window.sessionStorage){var s=window.sessionStorage;if(url)s.removeItem("tabs-"+url);else for(var i=0;i<s.length;i++)s.key(i).match(/^tabs-/)&&s.removeItem(s.key(i))}},clearCurrentTabState:function(){this.clearTabState(this._tabStateUrl())},_tabStateUrl:function(){return window.location.href.replace(/\?.*/,"").replace(/#.*/,"").replace($("base").attr("href"),"")},showLoginDialog:function(){var tempid=$("body").data("member-tempid"),dialog=$(".leftandmain-logindialog"),url="CMSSecurity/login";dialog.length&&dialog.remove(),url=$.path.addSearchParams(url,{tempid:tempid,BackURL:window.location.href}),dialog=$('<div class="leftandmain-logindialog"></div>'),dialog.attr("id",(new Date).getTime()),dialog.data("url",url),$("body").append(dialog)}}),$(".leftandmain-logindialog").entwine({onmatch:function(){this._super(),this.ssdialog({iframeUrl:this.data("url"),dialogClass:"leftandmain-logindialog-dialog",autoOpen:!0,minWidth:500,maxWidth:500,minHeight:370,maxHeight:400,closeOnEscape:!1,open:function(){$(".ui-widget-overlay").addClass("leftandmain-logindialog-overlay")},close:function(){$(".ui-widget-overlay").removeClass("leftandmain-logindialog-overlay")}})},onunmatch:function(){this._super()},open:function(){this.ssdialog("open")},close:function(){this.ssdialog("close")},toggle:function(bool){this.is(":visible")?this.close():this.open()},reauthenticate:function(data){"undefined"!=typeof data.SecurityID&&$(":input[name=SecurityID]").val(data.SecurityID),"undefined"!=typeof data.TempID&&$("body").data("member-tempid",data.TempID),this.close()}}),$("form.loading,.cms-content.loading,.cms-content-fields.loading,.cms-content-view.loading").entwine({onmatch:function(){this.append('<div class="cms-content-loading-overlay ui-widget-overlay-light"></div><div class="cms-content-loading-spinner"></div>'),this._super()},onunmatch:function(){this.find(".cms-content-loading-overlay,.cms-content-loading-spinner").remove(),this._super()}}),$('.cms input[type="submit"], .cms button, .cms input[type="reset"], .cms .ss-ui-button').entwine({onadd:function(){this.addClass("ss-ui-button"),this.data("button")||this.button(),this._super()},onremove:function(){this.data("button")&&this.button("destroy"),this._super()}}),$(".cms .cms-panel-link").entwine({onclick:function(e){if($(this).hasClass("external-link"))return void e.stopPropagation();var href=this.attr("href"),url=href&&!href.match(/^#/)?href:this.data("href"),data={pjax:this.data("pjaxTarget")};$(".cms-container").loadPanel(url,null,data),e.preventDefault()}}),$(".cms .ss-ui-button-ajax").entwine({onclick:function onclick(e){$(this).removeClass("ui-button-text-only"),$(this).addClass("ss-ui-button-loading ui-button-text-icons");var loading=$(this).find(".ss-ui-loading-icon");loading.length<1&&(loading=$("<span></span>").addClass("ss-ui-loading-icon ui-button-icon-primary ui-icon"),$(this).prepend(loading)),loading.show();var href=this.attr("href"),url=href?href:this.data("href");jQuery.ajax({url:url,complete:function complete(xmlhttp,status){var msg=xmlhttp.getResponseHeader("X-Status")?xmlhttp.getResponseHeader("X-Status"):xmlhttp.responseText;try{"undefined"!=typeof msg&&null!==msg&&eval(msg)}catch(e){}loading.hide(),$(".cms-container").refresh(),$(this).removeClass("ss-ui-button-loading ui-button-text-icons"),$(this).addClass("ui-button-text-only")},dataType:"html"}),e.preventDefault()}}),$(".cms .ss-ui-dialog-link").entwine({UUID:null,onmatch:function(){this._super(),this.setUUID((new Date).getTime())},onunmatch:function(){this._super()},onclick:function(){this._super();var id="ss-ui-dialog-"+this.getUUID(),dialog=$("#"+id);dialog.length||(dialog=$('<div class="ss-ui-dialog" id="'+id+'" />'),$("body").append(dialog));var extraClass=this.data("popupclass")?this.data("popupclass"):"";return dialog.ssdialog({iframeUrl:this.attr("href"),autoOpen:!0,dialogExtraClass:extraClass}),!1}}),$(".cms-content .btn-toolbar").entwine({onmatch:function(){this.find(".ss-ui-button").click(function(){var form=this.form;form&&(form.clickedButton=this,setTimeout(function(){form.clickedButton=null},10))}),this.redraw(),this._super()},onunmatch:function(){this._super()},redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.contents().filter(function(){return 3==this.nodeType&&!/\S/.test(this.nodeValue)}).remove(),this.find(".ss-ui-button").each(function(){$(this).data("button")||$(this).button()}),this.find(".ss-ui-buttonset").buttonset()}}),$(".cms .field.date input.text").entwine({onmatch:function(){var holder=$(this).parents(".field.date:first"),config=holder.data();return config.showcalendar?(config.showOn="button",config.locale&&$.datepicker.regional[config.locale]&&(config=$.extend(config,$.datepicker.regional[config.locale],{})),this.prop("disabled")||this.prop("readonly")||$(this).datepicker(config),void this._super()):void this._super()},onunmatch:function(){this._super()}}),$(".cms .field.dropdown select, .cms .field select[multiple], .form__fieldgroup-item select.dropdown").entwine({onmatch:function(){return this.is(".no-chosen")?void this._super():(this.data("placeholder")||this.data("placeholder"," "),this.removeClass("has-chosen").chosen("destroy"),this.siblings(".chosen-container").remove(),applyChosen(this),void this._super())},onunmatch:function(){this._super()}}),$(".cms-panel-layout").entwine({redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0))}}),$(".cms .grid-field").entwine({showDetailView:function(url){var params=window.location.search.replace(/^\?/,"");params&&(url=$.path.addSearchParams(url,params)),$(".cms-container").loadPanel(url)}}),$(".cms-search-form").entwine({onsubmit:function(e){var nonEmptyInputs,url;nonEmptyInputs=this.find(":input:not(:submit)").filter(function(){var vals=$.grep($(this).fieldValue(),function(val){return val});return vals.length}),url=this.attr("action"),nonEmptyInputs.length&&(url=$.path.addSearchParams(url,nonEmptyInputs.serialize().replace("+","%20")));var container=this.closest(".cms-container");return container.find(".cms-edit-form").tabs("select",0),container.loadPanel(url,"",{},!0),!1}}),$(".cms-search-form button[type=reset], .cms-search-form input[type=reset]").entwine({onclick:function(e){e.preventDefault();var form=$(this).parents("form");form.clearForm(),form.find(".dropdown select").prop("selectedIndex",0).trigger("chosen:updated"),form.submit()}}),window._panelDeferredCache={},$(".cms-panel-deferred").entwine({onadd:function(){this._super(),this.redraw()},onremove:function(){window.debug&&console.log("saving",this.data("url"),this),this.data("deferredNoCache")||(window._panelDeferredCache[this.data("url")]=this.html()),this._super()},redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0));var self=this,url=this.data("url");if(!url)throw'Elements of class .cms-panel-deferred need a "data-url" attribute';this._super(),this.children().length||(this.data("deferredNoCache")||"undefined"==typeof window._panelDeferredCache[url]?(this.addClass("loading"),$.ajax({url:url,complete:function(){self.removeClass("loading")},success:function(data,status,xhr){self.html(data)}})):this.html(window._panelDeferredCache[url]))}}),$(".cms-tabset").entwine({onadd:function(){this.redrawTabs(),this._super()},onremove:function(){this.data("tabs")&&this.tabs("destroy"),this._super()},redrawTabs:function(){this.rewriteHashlinks();var activeTab=(this.attr("id"),this.find("ul:first .ui-tabs-active"));this.data("uiTabs")||this.tabs({active:-1!=activeTab.index()?activeTab.index():0,beforeLoad:function(e,ui){return!1},activate:function(e,ui){var actions=$(this).closest("form").find(".btn-toolbar");$(ui.newTab).closest("li").hasClass("readonly")?actions.fadeOut():actions.show()}}),this.trigger("afterredrawtabs")},rewriteHashlinks:function(){$(this).find("ul a").each(function(){if($(this).attr("href")){var matches=$(this).attr("href").match(/#.*/);matches&&$(this).attr("href",document.location.href.replace(/#.*/,"")+matches[0])}})}}),$("#filters-button").entwine({onmatch:function(){this._super(),this.data("collapsed",!0),this.data("animating",!1)},onunmatch:function(){this._super()},showHide:function(){var self=this,$filters=$(".cms-content-filters").first(),collapsed=this.data("collapsed");this.data("animating")||(this.toggleClass("active"),this.data("animating",!0),$filters[collapsed?"slideDown":"slideUp"]({complete:function(){self.data("collapsed",!collapsed),self.data("animating",!1)}}))},onclick:function(){this.showHide()}})});var statusMessage=function(text,type){text=jQuery("<div/>").text(text).html(),jQuery.noticeAdd({text:text,type:type,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})}},{jQuery:"jQuery"}]},{},[1]);
//# sourceMappingURL=bundle-legacy.js.map