diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 4821037d0..430ad3130 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -webpackJsonp([0],{1e3:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0?u.default.createElement(f.default,{data:{placement:"top"},id:"campaign-preview-popver"},this.props.moreActions):null;return u.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview"},e,u.default.createElement("div",{className:"toolbar toolbar--south"},i,u.default.createElement("div",{className:"btn-toolbar"},o,a)))}}]),t}(l.Component);h.propTypes={itemLinks:u.default.PropTypes.object,itemId:u.default.PropTypes.number,onBack:u.default.PropTypes.func,moreActions:u.default.PropTypes.arrayOf(u.default.PropTypes.element)},t.default=h},1004:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0;var s=function(){function e(e,t){for(var n=0;n1}},{key:"handleChange",value:function(e){"function"==typeof this.props.onChange&&this.props.onChange(e,{id:this.props.id,value:e.target.value})}},{key:"render",value:function(){return u.default.createElement(p.FormControl,this.getInputProps())}}]),t}(l.Component);f.propTypes={extraClass:u.default.PropTypes.string,id:u.default.PropTypes.string,name:u.default.PropTypes.string.isRequired,onChange:u.default.PropTypes.func,value:u.default.PropTypes.oneOfType([u.default.PropTypes.string,u.default.PropTypes.number]),readOnly:u.default.PropTypes.bool,disabled:u.default.PropTypes.bool,placeholder:u.default.PropTypes.string,type:u.default.PropTypes.string,autoFocus:u.default.PropTypes.bool,attributes:u.default.PropTypes.oneOfType([u.default.PropTypes.object,u.default.PropTypes.array])},f.defaultProps={value:"",extraClass:"",className:"",type:"text",attributes:{}},t.Component=f,t.default=(0,d.default)(f)},1005:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:this.props.visible,t=[];if(!e)return t;var n=this.props.tree,r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var l=a.value;if("break"===function(e){return n.children&&(n=n.children.find(function(t){return t.id===e}))?void t.push(n):"break"}(l))break}}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return t}},{key:"getDropdownOptions",value:function(){var e=this.props.value,t=this.getVisibleTree(),n=t?[].concat(o(t.children)):[],r=this.props.selectedValues.filter(function(t){return t.id===e||Array.isArray(e)&&e.find(function(e){return e===t.id})});return!this.state.opened&&this.props.data.showSelectedPath?n=r.map(function(e){return c({},e,{title:e.titlePath||e.title})}):r.length&&(n=[].concat(o(r.filter(function(e){return!n.find(function(t){return t.id===e.id})})),o(n))),n.unshift({id:this.props.data.multiple?"":A,title:this.props.data.hasEmptyDefault?this.props.data.emptyString:null,disabled:!n.length||!this.props.data.hasEmptyDefault}),n}},{key:"getPath",value:function(e){var t=this.props.findTreePath(this.props.tree,e);return this.getBreadcrumbs(t).reduce(function(e,t){return""+e+(t.contextString||"")+t.title+"/"},"")}},{key:"callFetch",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props,r=k.default.parse(n.data.urlTree,!0);n.data.showSearch&&t.length&&(r.query.search=t,r.query.flatList="1"),e.length&&(r.query.ID=e[e.length-1]),r.query.format="json",r.search=null;var o=k.default.format(r);return(0,g.default)(o,{credentials:"same-origin"}).then(function(e){return e.json()})}},{key:"lazyLoad",value:function(e){var t=this;if(e.find(function(e){return t.props.loading.indexOf(e)>-1||t.props.failed.indexOf(e)>-1}))return Promise.resolve({});var n=this.props.findTreeByPath(this.props.tree,e);return n&&(0===n.count||n.children.length)?Promise.resolve({}):this.loadTree(e)}},{key:"loadTree",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props;return n.actions.treeDropdownField.beginTreeUpdating(n.id,e),this.callFetch(e,t,n).then(function(t){return n.actions.treeDropdownField.updateTree(n.id,e,t),t}).catch(function(t){if(n.actions.treeDropdownField.updateTreeFailed(n.id,e),"function"==typeof n.onLoadingError)return n.onLoadingError({errors:[{value:t.message,type:"error"}]});throw t})}},{key:"hasSearch",value:function(){return this.props.data.showSearch&&Boolean(this.props.search)}},{key:"filterOptions",value:function(e){var t=this,n=this.getVisibleTree();return e.filter(function(e){if((e.id===A||""===e.id)&&(!t.props.data.hasEmptyDefault||t.props.visible.length||t.hasSearch()))return!1;var r=e.title&&e.title.toLocaleLowerCase(),o=t.props.search.toLocaleLowerCase();return o?r&&r.includes(o):!n||!e.id||n.children.find(function(t){return t.id===e.id})})}},{key:"handleOpen",value:function(){this.setState({opened:!0}),this.handleSearchReset()}},{key:"handleClose",value:function(){this.setState({opened:!1})}},{key:"handleSearchReset",value:function(){clearTimeout(this.searchTimer),this.props.actions.treeDropdownField.setSearch(this.props.id,"")}},{key:"handleSearchChange",value:function(e){var t=this;clearTimeout(this.searchTimer),this.searchTimer=setTimeout(function(){t.props.actions.treeDropdownField.setSearch(t.props.id,e)},500)}},{key:"handleChange",value:function(e){var t=null;if(this.handleSearchReset(),this.props.data.multiple){if(t=D,e&&e.length){var n=e&&e.filter(function(t,n){return e.findIndex(function(e){return e.id===t.id})===n});t=n.map(function(e){return e.id}),this.props.actions.treeDropdownField.addSelectedValues(this.props.id,n)}}else{var r=e?e.id:null,o=this.getVisibleTree()||this.props.tree,i=o.children.find(function(e){return e.id===r});i&&(this.props.data.showSelectedPath&&(i=c({},i,{titlePath:this.getPath(r)})),this.props.actions.treeDropdownField.addSelectedValues(this.props.id,[i])),t=r||A}"function"==typeof this.props.onChange&&this.props.onChange(t)}},{key:"handleNavigate",value:function(e,t){if(e.stopPropagation(),e.preventDefault(),!this.hasSearch()){var n=this.props.findTreePath(this.props.tree,t);n||(n=this.props.visible.slice(0),n.push(t)),this.lazyLoad(n),this.props.actions.treeDropdownField.setVisible(this.props.id,n)}}},{key:"handleKeyDown",value:function(e){if(this.hasSearch())return void(27===e.keyCode&&this.handleSearchReset(e));var t=this.selectField.getFocusedOption();if(t)switch(e.keyCode){case 37:this.handleBack(e);break;case 39:t.count&&this.handleNavigate(e,t.id)}}},{key:"handleBack",value:function(e){if(e.stopPropagation(),e.preventDefault(),!this.hasSearch()){var t=this.props.visible;t.length&&(t=t.slice(0,t.length-1)),this.lazyLoad(t),this.props.actions.treeDropdownField.setVisible(this.props.id,t)}}},{key:"renderMenu",value:function(e){var t=this.getVisibleTree()||{},n=this.props.loading.indexOf(t.id||0)>-1,r=this.props.failed.indexOf(t.id||0)>-1,o=this.getBreadcrumbs();return f.default.createElement(O.default,{loading:n,failed:r,tree:t,breadcrumbs:o,renderMenuOptions:e,onBack:this.handleBack,search:this.hasSearch(),value:this.props.value})}},{key:"renderOption",value:function(e){var t=this,n=null;if(e.count&&!this.hasSearch()){var r=function(n){return t.handleNavigate(n,e.id)};n=f.default.createElement("button",{className:"treedropdownfield__option-button fill-width",onClick:r,onMouseDown:r,onTouchStart:r},f.default.createElement("span",{className:"treedropdownfield__option-count-icon font-icon-right-open-big"}))}var o=function(e){var t=e.children;return f.default.createElement("span",{className:"treedropdownfield__option-title--highlighted"},t)},i=this.props.search.length?(0,x.mapHighlight)(e.title,this.props.search,o):e.title,a=null;return this.hasSearch()&&((a=e.contextString)||!this.props.data.hasEmptyDefault||this.props.visible.length||(a=this.props.data.emptyString)),f.default.createElement("div",{className:"treedropdownfield__option fill-width"},f.default.createElement("div",{className:"treedropdownfield__option-title-box flexbox-area-grow fill-height"},f.default.createElement("span",{className:"treedropdownfield__option-title"},i),a&&f.default.createElement("span",{className:"treedropdownfield__option-context"},a)),n)}},{key:"renderReadOnly",value:function(){var e=this,t={id:this.props.id,readOnly:this.props.readOnly,disabled:this.props.disabled},n=this.props.extraClass?"treedropdownfield "+this.props.extraClass:"treedropdownfield",r=this.props.data.hasEmptyDefault?this.props.data.emptyString:"",o=this.props.selectedValues;if(this.props.data.multiple)r=this.props.value.map(function(e){return o.find(function(t){return t.id===e})||e}).map(function(e){return e.title}).join(", ");else{var i=o.find(function(t){return t.id===e.props.value});r=this.props.value,i&&"string"==typeof i.title&&(r=i.title)}return f.default.createElement("div",{className:n},f.default.createElement("span",{className:"treedropdownfield__title"},r),f.default.createElement(R.FormControl,c({type:"hidden",name:this.props.name,value:this.props.value},t)))}},{key:"render",value:function(){var e=this;if(this.props.readOnly||this.props.disabled)return this.renderReadOnly();var t={id:this.props.id},n=this.props.extraClass?"treedropdownfield "+this.props.extraClass:"treedropdownfield",r=this.getDropdownOptions(),o=this.props.value;this.props.data.multiple&&(o=this.props.value?this.props.selectedValues.filter(function(e){return o.includes(e.id)}):[]);var i=this.props.data.hasEmptyDefault&&!this.props.visible.length?"":null,a=void 0!==this.props.data.showSearch&&this.props.data.showSearch;return f.default.createElement(w.default,{searchable:a,multi:this.props.data.multiple,className:n,name:this.props.name,options:r,inputProps:t,menuRenderer:this.renderMenu,filterOptions:this.filterOptions,optionRenderer:this.renderOption,onChange:this.handleChange,onOpen:this.handleOpen,onClose:this.handleClose,onBlurResetsInput:!0,onInputKeyDown:this.handleKeyDown,onInputChange:this.handleSearchChange,isLoading:Boolean(this.props.loading.length),value:o,resetValue:i,joinValues:!0,ref:function(t){e.selectField=t},placeholder:this.props.data.emptyString,labelKey:"title",valueKey:"id"})}}]),t}(p.Component);I.propTypes={extraClass:p.PropTypes.string,id:p.PropTypes.string,name:p.PropTypes.string.isRequired,onChange:p.PropTypes.func,value:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.number,p.PropTypes.array]),readOnly:p.PropTypes.bool,disabled:p.PropTypes.bool,tree:p.PropTypes.shape(j.default.propTypes),findTreeByPath:p.PropTypes.func,findTreePath:p.PropTypes.func,visible:p.PropTypes.array,loading:p.PropTypes.array,failed:p.PropTypes.array,selectedValues:p.PropTypes.array,data:p.PropTypes.shape({cacheKey:p.PropTypes.string,urlTree:p.PropTypes.string.isRequired,emptyString:p.PropTypes.string,valueObject:p.PropTypes.shape(j.default.propTypes),valueObjects:p.PropTypes.arrayOf(p.PropTypes.shape(j.default.propTypes)),hasEmptyDefault:p.PropTypes.bool,showSearch:p.PropTypes.bool,multiple:p.PropTypes.bool,showSelectedPath:p.PropTypes.bool}),onLoadingError:p.PropTypes.func,search:p.PropTypes.string,actions:p.PropTypes.shape({treeDropdownField:p.PropTypes.object})},I.defaultProps={value:"",extraClass:"",className:"",tree:{},visible:[],loading:[],failed:[],findTreeByPath:M.findTreeByPath,findTreePath:M.findTreePath};var F=(0,h.connect)(l,u)(I);t.Component=I,t.ConnectedTreeDropdownField=F,t.MULTI_EMPTY_VALUE=D,t.SINGLE_EMPTY_VALUE=A,t.findTreePath=M.findTreePath,t.findTreeByID=M.findTreeByID,t.findTreeByPath=M.findTreeByPath,t.default=(0,v.default)(F)},1007:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:this.props)}},{key:"handleSubmit",value:function(e,t,n){var r=this,o=null,i=function(){return n().then(function(e){var t=e;if(t){var n=void 0!==t.state;if(t=r.reduceSchemaErrors(t),r.props.actions.schema.setSchema(r.props.schemaUrl,t,r.getIdentifier()),n){var o=t.schema||r.props.schema.schema,i=(0,C.default)(o,t.state);r.props.actions.reduxForm.initialize(r.getIdentifier(),i)}}return t})};if(!(o="function"==typeof this.props.onSubmit?this.props.onSubmit(e,t,i):i()))throw new Error("Promise was not returned for submitting");return o.then(function(e){if(!e||!e.state)return e;var t=r.getMessages(e.state);if(Object.keys(t).length)throw new T.SubmissionError(t);return e})}},{key:"reduceSchemaErrors",value:function(e){if(!e.errors)return e;var t=Object.assign({},e);return t.state||(t=Object.assign({},t,{state:this.props.schema.state})),t=Object.assign({},t,{state:Object.assign({},t.state,{fields:t.state.fields.map(function(t){return Object.assign({},t,{message:e.errors.find(function(e){return e.field===t.name})})}),messages:e.errors.filter(function(e){return!e.field})})}),delete t.errors,(0,w.default)(t)}},{key:"overrideStateData",value:function(e){if(!this.props.stateOverrides||!e)return e;var t=this.props.stateOverrides.fields,n=e.fields;return t&&n&&(n=n.map(function(e){var n=t.find(function(t){return t.name===e.name});return n?S.default.recursive(!0,e,n):e})),Object.assign({},e,this.props.stateOverrides,{fields:n})}},{key:"callFetch",value:function(e){return(0,g.default)(this.props.schemaUrl,{headers:{"X-FormSchema-Request":e.join(","),Accept:"application/json"},credentials:"same-origin"}).then(function(e){return e.status>=200&&e.status<300?e.json():new Promise(function(t,n){return e.json().then(function(t){n({status:e.status,statusText:e.statusText,json:t})}).catch(function(){n({status:e.status,statusText:e.statusText,json:{}})})})})}},{key:"fetch",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.props.loading)return Promise.resolve({});var o=["auto",e&&"schema",n&&"state",r&&"errors"].filter(function(e){return e});return this.props.actions.schema.setSchemaLoading(this.props.schemaUrl,!0),"function"==typeof this.props.onFetchingSchema&&this.props.onFetchingSchema(),this.callFetch(o).then(function(e){if(t.props.actions.schema.setSchemaLoading(t.props.schemaUrl,!1),e.errors?"function"==typeof t.props.onLoadingError&&t.props.onLoadingError(e):"function"==typeof t.props.onLoadingSuccess&&t.props.onLoadingSuccess(),void 0!==e.id&&e.state){var n=Object.assign({},e,{state:t.overrideStateData(e.state)});t.props.actions.schema.setSchema(t.props.schemaUrl,n,s(c({},t.props,{schema:c({},t.props.schema,n)})));var r=e.schema||t.props.schema.schema,o=(0,C.default)(r,n.state);return t.props.actions.reduxForm.initialize(t.getIdentifier(),o,!1,{keepSubmitSucceeded:!0}),n}return e}).catch(function(e){if(t.props.actions.schema.setSchemaLoading(t.props.schemaUrl,!1),"function"==typeof t.props.onLoadingError)return t.props.onLoadingError(t.normaliseError(e));throw e})}},{key:"normaliseError",value:function(e){return e.json&&e.json.errors?e.json:e.status&&e.statusText?{errors:[{code:e.status,value:e.statusText,type:"error"}]}:{errors:[{value:e.message||f.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred."),type:"error"}]}}},{key:"handleAutofill",value:function(e,t){this.props.actions.reduxForm.autofill(this.getIdentifier(),e,t)}},{key:"render",value:function(){if(!this.props.schema||!this.props.schema.schema||this.props.loading)return null;var e=Object.assign({},this.props,{form:this.getIdentifier(),onSubmitSuccess:this.props.onSubmitSuccess,onSubmit:this.handleSubmit,onAutofill:this.handleAutofill});return m.default.createElement(R.default,e)}}]),t}(h.Component);F.propTypes=Object.assign({},k.basePropTypes,{actions:h.PropTypes.shape({schema:h.PropTypes.object,reduxFrom:h.PropTypes.object}),identifier:h.PropTypes.string.isRequired,schemaUrl:h.PropTypes.string.isRequired,schema:k.schemaPropType,form:h.PropTypes.string,submitting:h.PropTypes.bool,onFetchingSchema:h.PropTypes.func}),t.Component=F,t.default=(0,v.compose)((0,D.inject)(["ReduxForm","ReduxFormField"],function(e,t){return{baseFormComponent:e,baseFieldComponent:t}},function(e){return e.identifier}),(0,y.connect)(l,u))(F)},1010:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return{actions:{schema:(0,d.bindActionCreators)(b,e)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.createInsertLinkModal=t.InsertLinkModal=void 0;var l=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null;if(e){if(e.schemaUrl){var t=Object.assign({},e.fileAttributes);delete t.ID;var n={fields:Object.entries(t).map(function(e){var t=u(e,2);return{name:t[0],value:t[1]}})};this.props.actions.schema.setSchemaStateOverrides(e.schemaUrl,n)}}else{var r=this.props.schemaUrl;r&&this.props.actions.schema.setSchemaStateOverrides(r,null)}}},{key:"render",value:function(){var e=this.props.Component,t=Object.assign({},this.props);return delete t.Component,p.default.createElement(e,l({setOverrides:this.setOverrides},t))}}]),t}(d.Component);v.propTypes={fileAttributes:d.PropTypes.object,Component:d.PropTypes.oneOfType([d.PropTypes.element,d.PropTypes.func]),schemaUrl:d.PropTypes.string,actions:d.PropTypes.object};var b=(0,y.connect)(function(){return{}},a())(v);t.FileSchemaHandler=v,t.ConnectedFileSchemaHandler=b,t.default=s},1013:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){var t=null;if(!(e.status>=200&&e.status<300))throw t=new Error(e.statusText),t.response=e,t;return e}function s(e){var t=null;if(e instanceof FormData||"string"==typeof e)t=e;else{if(!e||"object"!==(void 0===e?"undefined":m(e)))throw new Error("Invalid body type");t=JSON.stringify(e)}return t}function l(e,t){switch(e){case"application/x-www-form-urlencoded":return w.default.stringify(t);case"application/json":case"application/x-json":case"application/x-javascript":case"text/javascript":case"text/x-javascript":case"text/x-json":return JSON.stringify(t);default:throw new Error("Can't encode format: "+e)}}function u(e,t){switch(e){case"application/x-www-form-urlencoded":return w.default.parse(t);case"application/json":case"application/x-json":case"application/x-javascript":case"text/javascript":case"text/x-javascript":case"text/x-json":return JSON.parse(t);default:throw new Error("Can't decode format: "+e)}}function c(e,t){return""===t?e:e.match(/\?/)?e+"&"+t:e+"?"+t}function d(e){return e.text().then(function(t){return u(e.headers.get("Content-Type"),t)})}function p(e,t){return Object.keys(t).reduce(function(n,r){var o=e[r];return!o||!0!==o.remove&&!0!==o.querystring?Object.assign(n,i({},r,t[r])):n},{})}function f(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{setFromData:!1},o=t;return o=c(o,l("application/x-www-form-urlencoded",Object.keys(n).reduce(function(t,o){var a=e[o],s=!0===r.setFromData&&!(a&&!0===a.remove),l=a&&!0===a.querystring&&!0!==a.remove;return s||l?Object.assign(t,i({},o,n[o])):t},{}))),o=Object.keys(e).reduce(function(t,r){var o=e[r].urlReplacement;return o?t.replace(o,n[r]):t},o)}Object.defineProperty(t,"__esModule",{value:!0});var h=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=Object.assign({},r,{Accept:n.responseFormat,"Content-Type":n.payloadFormat}),i=P.default.recursive({},n.defaultData,e),a=f(n.payloadSchema,n.url,i,{setFromData:"get"===n.method.toLowerCase()}),s="get"!==n.method.toLowerCase()?l(n.payloadFormat,p(n.payloadSchema,i)):"",u="get"===n.method.toLowerCase()?[a,o]:[a,s,o];return t[n.method.toLowerCase()].apply(t,u).then(d)}}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch(e,{method:"get",credentials:"same-origin",headers:t}).then(a)}},{key:"post",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={"Content-Type":"application/x-www-form-urlencoded"};return this.fetch(e,{method:"post",credentials:"same-origin",body:s(t),headers:Object.assign({},r,n)}).then(a)}},{key:"put",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.fetch(e,{method:"put",credentials:"same-origin",body:s(t),headers:n}).then(a)}},{key:"delete",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.fetch(e,{method:"delete",credentials:"same-origin",body:s(t),headers:n}).then(a)}}]),e}(),O=new C;t.default=O},1014:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[],n=this.findChildRoute(t),r=Object.assign({},{childRoutes:[]},e),o=r.childRoutes[r.childRoutes.length-1];o&&"**"===o.path||(o={path:"**"},r.childRoutes.push(o));var i=n.findIndex(function(t){return t.path===e.path});i>=0?n[i]=r:n.unshift(r)}},{key:"findChildRoute",value:function(e){var t=this.childRoutes;return e&&e.forEach(function(e){var n=t.find(function(t){return t.path===e});if(!n)throw new Error("Parent path "+e+" could not be found.");t=n.childRoutes}),t}},{key:"getRootRoute",value:function(){return this.rootRoute}},{key:"getChildRoutes",value:function(){return this.childRoutes}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this.findChildRoute(t),r=n.findIndex(function(t){return t.path===e});return r<0?null:n.splice(r,1)[0]}}]),e}();window.ss=window.ss||{},window.ss.routeRegister=window.ss.routeRegister||new i,t.default=window.ss.routeRegister},1018:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=u.default.getAbsoluteBase(),n=d.default.resolve(t,e);return 0!==n.indexOf(t)?n:n.substring(t.length-1)}function i(e){return new u.default.Route(e).match(u.default.current,{})}function a(){return u.default.absoluteBaseURL}function s(e){u.default.absoluteBaseURL=e;var t=document.createElement("a");t.href=e;var n=t.pathname;n=n.replace(/\/$/,""),n.match(/^[^\/]/)&&(n="/"+n),u.default.base(n)}Object.defineProperty(t,"__esModule",{value:!0});var l=n(1926),u=r(l),c=n(757),d=r(c);u.default.oldshow||(u.default.oldshow=u.default.show),u.default.setAbsoluteBase=s.bind(u.default),u.default.getAbsoluteBase=a.bind(u.default),u.default.resolveURLToBase=o.bind(u.default),u.default.show=function(e){return function(t,n,r,o){return e(u.default.resolveURLToBase(t),n,r,o)}}(u.default.oldshow),u.default.routeAppliesToCurrentLocation=i,window.ss=window.ss||{},window.ss.router=window.ss.router||u.default,t.default=window.ss.router},1019:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=n(23),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a=function(e){return e.toString().slice(1,-1)},s=a(/((?:[,\s]+(?:[a-z0-9\-_]+)=(?:(?:[a-z0-9\-_]+)|(?:\d+\.\d+)|(?:'[^']*')|(?:"[^"]*")))*)/),l=/[,\s]+([a-z0-9\-_]+)=(?:([a-z0-9\-_]+)|(\d+\.\d+)|(?:'([^']*)')|(?:"([^"]*)"))/,u=a(/\[%s/),c=a(/\[\s*\/\s*%s\s*]/),d=a(/((?:.|\n|)*?)/),p=a(/\s*/),f={match:function(e,t,n){var r=i.default.sprintf(u,e),o=""+r+s+p+"\\]";t&&(o=""+o+d+i.default.sprintf(c,e));var a=new RegExp(o,"i"),l=a.exec(n);return l?{name:e,wrapped:t,properties:this.parseProperties(l[1]),original:l[0],content:t?l[2]:null}:null},parseProperties:function(e){for(var t=e,n={},r=t.match(l);r;){var o=r[1]||"",i=r[2]||r[3]||r[4]||r[5]||"";o&&(n[o]=i);var a=t.indexOf(r[0]);t=t.substr(a+r[0].length),r=t.match(l)}return n},serialise:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t?{sep:",",quote:"",replacer:/[^a-z0-9\-_.]/gi}:{sep:" ",quote:'"',replacer:/"/g},o=Object.entries(e.properties).map(function(e){var t=r(e,2),o=t[0],i=t[1];return i?""+n.sep+o+"="+n.quote+(""+i).replace(n.replacer,"")+n.quote:null}).filter(function(e){return null!==e}).join("");return e.wrapped?"["+e.name+o+"]"+e.content+"[/"+e.name+"]":"["+e.name+o+"]"}};t.default=f},1020:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;nt.text.toLocaleLowerCase()})}},{key:"addCommandWithUrlTest",value:function(e,t){return this.editorCommandsToUrlTestsMap[e]=t,this}},{key:"setDefaultCommand",value:function(e){return this.defaultCommand=e,this}},{key:"getDefaultCommand",value:function(){return this.defaultCommand}},{key:"getEditorCommandFromUrl",value:function(e){var t=this,n=this.getDefaultCommand(),r=Object.keys(this.editorCommandsToUrlTestsMap),o=r.find(function(n){return t.editorCommandsToUrlTestsMap[n]&&t.editorCommandsToUrlTestsMap[n].test(e)});return o&&(n=o),n}}]),e}();window.ss=window.ss||{},window.ss.tinymceactions=window.ss.tinymceactions||new a,t.default=window.ss.tinymceactions},1022:function(e,t,n){"use strict";function r(e){var t=Number(e);return null!==e&&t>=0&&t<10?[i.default._t("Admin.WRITTEN_NUMBER_ZERO","zero"),i.default._t("Admin.WRITTEN_NUMBER_ONE","one"),i.default._t("Admin.WRITTEN_NUMBER_TWO","two"),i.default._t("Admin.WRITTEN_NUMBER_THREE","three"),i.default._t("Admin.WRITTEN_NUMBER_FOUR","four"),i.default._t("Admin.WRITTEN_NUMBER_FIVE","five"),i.default._t("Admin.WRITTEN_NUMBER_SIX","six"),i.default._t("Admin.WRITTEN_NUMBER_SEVEN","seven"),i.default._t("Admin.WRITTEN_NUMBER_EIGHT","eight"),i.default._t("Admin.WRITTEN_NUMBER_NINE","nine")][t]:t?String(t):null}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(23),i=function(e){return e&&e.__esModule?e:{default:e}}(o)},1023:function(e,t,n){"use strict";function r(e){return e.form&&e.form.formState||{}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},1024:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(o){if(!t.payload.fieldId)throw new Error("Invalid fieldId");var i=e.fields||{},s=i[t.payload.fieldId]?e.fields[t.payload.fieldId]:n;return(0,a.default)(Object.assign({},e,{fields:Object.assign({},i,r({},t.payload.fieldId,Object.assign({},s,o(s))))}))}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=n(82),a=function(e){return e&&e.__esModule?e:{default:e}}(i)},1025:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return void 0===t?e:l.default.recursive(!0,e,t)}function i(e,t){return e?e.reduce(function(e,n){return e||i(n.children,t)},e.find(function(e){return e.name===t})):null}function a(e,t){return t?t.fields.reduce(function(t,n){var o=i(e.fields,n.name);return o?"Structural"===o.type||!0===o.readOnly?t:Object.assign({},t,r({},o.name,n.value)):t},{}):{}}Object.defineProperty(t,"__esModule",{value:!0}),t.schemaMerge=o,t.findField=i,t.default=a;var s=n(245),l=function(e){return e&&e.__esModule?e:{default:e}}(s)},1026:function(e,t,n){"use strict";function r(e){return{type:i.default.SET_BREADCRUMBS,payload:{breadcrumbs:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.setBreadcrumbs=r;var o=n(411),i=function(e){return e&&e.__esModule?e:{default:e}}(o)},1027:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={FETCH_RECORDS_REQUEST:"FETCH_RECORDS_REQUEST",FETCH_RECORDS_FAILURE:"FETCH_RECORDS_FAILURE",FETCH_RECORDS_SUCCESS:"FETCH_RECORDS_SUCCESS",FETCH_RECORD_REQUEST:"FETCH_RECORD_REQUEST",FETCH_RECORD_FAILURE:"FETCH_RECORD_FAILURE",FETCH_RECORD_SUCCESS:"FETCH_RECORD_SUCCESS",DELETE_RECORD_REQUEST:"DELETE_RECORD_REQUEST",DELETE_RECORD_FAILURE:"DELETE_RECORD_FAILURE",DELETE_RECORD_SUCCESS:"DELETE_RECORD_SUCCESS"}},1028:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return Object.keys(t).reduce(function(e,n){return e.replace(":"+n,t[n])},e)}function i(e,t,n){var r={recordType:e},i={Accept:"text/json"},a=t.toLowerCase();return function(t){t({type:d.default.FETCH_RECORDS_REQUEST,payload:r});var s="get"===a?[o(n,r),i]:[o(n,r),{},i];return u.default[a].apply(u.default,s).then(function(e){return e.json()}).then(function(n){t({type:d.default.FETCH_RECORDS_SUCCESS,payload:{recordType:e,data:n}})}).catch(function(n){throw t({type:d.default.FETCH_RECORDS_FAILURE,payload:{error:n,recordType:e}}),n})}}function a(e,t,n){var r={recordType:e},i={Accept:"text/json"},a=t.toLowerCase();return function(t){t({type:d.default.FETCH_RECORD_REQUEST,payload:r});var s="get"===a?[o(n,r),i]:[o(n,r),{},i];return u.default[a].apply(u.default,s).then(function(e){return e.json()}).then(function(n){t({type:d.default.FETCH_RECORD_SUCCESS,payload:{recordType:e,data:n}})}).catch(function(n){throw t({type:d.default.FETCH_RECORD_FAILURE,payload:{error:n,recordType:e}}),n})}}function s(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a={recordType:e,id:t},s=n.toLowerCase(),l="get"===s?[o(r,a),i]:[o(r,a),{},i];return function(n){return n({type:d.default.DELETE_RECORD_REQUEST,payload:a}),u.default[s].apply(u.default,l).then(function(){n({type:d.default.DELETE_RECORD_SUCCESS,payload:{recordType:e,id:t}})}).catch(function(r){throw n({type:d.default.DELETE_RECORD_FAILURE,payload:{error:r,recordType:e,id:t}}),r})}}Object.defineProperty(t,"__esModule",{value:!0}),t.fetchRecords=i,t.fetchRecord=a,t.deleteRecord=s;var l=n(770),u=r(l),c=n(415),d=r(c)},1029:function(e,t,n){"use strict";function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];return{type:l.default.SET_SCHEMA,payload:a({},t,{id:e,name:n})}}function o(e,t){return{type:l.default.SET_SCHEMA_STATE_OVERRIDES,payload:{id:e,stateOverride:t}}}function i(e,t){return{type:l.default.SET_SCHEMA_LOADING,payload:{id:e,loading:t}}}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t399?"bad":"good",l=["OK","success","HTTP/2.0 200"];if(null===o||isSameUrl(r,o)&&isSameUrl(i,o)||window.ss.router.show(o,{id:(new Date).getTime()+String(Math.random()).replace(/\D/g,""),pjax:t.getResponseHeader("X-Pjax")?t.getResponseHeader("X-Pjax"):n.headers["X-Pjax"]}),t.getResponseHeader("X-Reauthenticate"))return void $(".cms-container").showLoginDialog();0!==t.status&&a&&-1===$.inArray(a,l)&&statusMessage(decodeURIComponent(a),s),ajaxCompleteEvent(this)}),$(".cms-container").entwine({StateChangeXHR:null,FragmentXHR:{},StateChangeCount:0,LayoutOptions:{minContentWidth:940,minPreviewWidth:400,mode:"content"},onadd:function(){if($.browser.msie&&parseInt($.browser.version,10)<8)return $(".ss-loading-screen").append('

Your browser is not compatible with the CMS interface. Please use Internet Explorer 8+, Google Chrome or Mozilla Firefox.

').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(),this._super()},onwindowresize:function(){this.redraw()},"from .cms-panel":{ontoggle:function(){this.redraw()}},"from .cms-container":{onaftersubmitform:function(){this.redraw()}},updateLayoutOptions:function(e){var t=this.getLayoutOptions(),n=!1;for(var r in e)t[r]!==e[r]&&(t[r]=e[r],n=!0);n&&this.redraw()},clearViewMode:function(){this.removeClass("cms-container--split-mode"),this.removeClass("cms-container--preview-mode"),this.removeClass("cms-container--content-mode")},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.setProperMode()||(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()))},setProperMode:function(){var e=this.getLayoutOptions(),t=e.mode;this.clearViewMode();var n=this.find(".cms-content"),r=this.find(".cms-preview");if(n.css({"min-width":0}),r.css({"min-width":0}),n.width()+r.width()>=e.minContentWidth+e.minPreviewWidth)n.css({"min-width":e.minContentWidth}),r.css({"min-width":e.minPreviewWidth}),r.trigger("enable");else if(r.trigger("disable"),"split"==t)return r.trigger("forcecontent"),!0;return this.addClass("cms-container--"+t+"-mode"),!1},checkCanNavigate:function(e){var t=this._findFragments(e||["Content"]),n=t.find(":data(changetracker)").add(t.filter(":data(changetracker)")),r=!0;return!n.length||(n.each(function(){$(this).confirmUnsavedChanges()||(r=!1)}),r)},loadPanel:function(e){var t=(arguments.length>1&&void 0!==arguments[1]&&arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),n=arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:document.URL;this.checkCanNavigate(t.pjax?t.pjax.split(","):["Content"])&&(this.saveTabState(),t.__forceReferer=r,n&&(t.__forceReload=1+Math.random()),window.ss.router.show(e,t))},reloadCurrentPanel:function(){this.loadPanel(document.URL,null,null,!0)},submitForm:function(e,t,n,r){var o=this;t||(t=this.find(".btn-toolbar :submit[name=action_save]")),t||(t=this.find(".btn-toolbar :submit:first")),e.trigger("beforesubmitform"),this.trigger("submitform",{form:e,button:t}),$(t).addClass("btn--loading loading"),$(t).is("button")&&($(t).data("original-text",$(t).text()),$(t).append($('
')),$(t).css($(t).outerWidth()+"px"));var i=e.validate(),a=function(){$(t).removeClass("btn--loading loading"),$(t).find(".btn__loading-icon").remove(),$(t).css("width","auto"),$(t).text($(t).data("original-text"))};void 0===i||i||(statusMessage("Validation failed.","bad"),a());var s=e.serializeArray();return s.push({name:$(t).attr("name"),value:"1"}),s.push({name:"BackURL",value:document.URL.replace(/\/$/,"")}),this.saveTabState(),jQuery.ajax(jQuery.extend({headers:{"X-Pjax":"CurrentForm,Breadcrumbs"},url:e.attr("action"),data:s,type:"POST",complete:function(){a()},success:function(t,r,i){a(),e.removeClass("changed"),n&&n(t,r,i);var l=o.handleAjaxResponse(t,r,i);l&&l.filter("form").trigger("aftersubmitform",{status:r,xhr:i,formData:s})}},r)),!1},LastState:null,PauseState:!1,handleStateChange:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.history.state;if(!this.getPauseState()){this.getStateChangeXHR()&&this.getStateChangeXHR().abort();var n=this,r=t.pjax||"Content",o={},i=r.split(","),a=this._findFragments(i);if(this.setStateChangeCount(this.getStateChangeCount()+1),!this.checkCanNavigate()){var s=this.getLastState();return this.setPauseState(!0),s&&s.path?window.ss.router.show(s.path):window.ss.router.back(),void this.setPauseState(!1)}if(this.setLastState(t),a.length=0})),r.removeClass(i.join(" ")).addClass(s.join(" ")),o&&r.attr("style",o);var l=r.find("style").detach();l.length&&$(document).find("head").append(l),n.replaceWith(r)});var f=d.filter("form");f.hasClass("cms-tabset")&&f.removeClass("cms-tabset").addClass("cms-tabset")}finally{this.setRedrawSuppression(!1)}return this.redraw(),this.restoreTabState(r&&void 0!==r.tabState?r.tabState:null),d}},_findFragments:function(e){return $("[data-pjax-fragment]").filter(function(){var t,n=$(this).data("pjaxFragment").split(" ");for(t in e)if(-1!=$.inArray(e[t],n))return!0;return!1})},refresh:function(){$(window).trigger("statechange"),$(this).redraw()},saveTabState:function(){if(void 0!==window.sessionStorage&&null!==window.sessionStorage){var e=[],t=this._tabStateUrl();if(this.find(".cms-tabset,.ss-tabset").each(function(t,n){var r=$(n).attr("id");r&&$(n).data("tabs")&&($(n).data("ignoreTabState")||$(n).getIgnoreTabState()||e.push({id:r,selected:$(n).tabs("option","selected")}))}),e){var n="tabs-"+t;try{window.sessionStorage.setItem(n,JSON.stringify(e))}catch(e){if(e.code===DOMException.QUOTA_EXCEEDED_ERR&&0===window.sessionStorage.length)return;throw e}}}},restoreTabState:function(e){var t=this,n=this._tabStateUrl(),r=void 0!==window.sessionStorage&&window.sessionStorage,o=r?window.sessionStorage.getItem("tabs-"+n):null,i=!!o&&JSON.parse(o);this.find(".cms-tabset, .ss-tabset").each(function(){var n,r,o=$(this),a=o.attr("id"),s=o.children("ul").children("li.ss-tabs-force-active");o.data("tabs")&&(o.tabs("refresh"),s.length?n=s.first().index():e&&e[a]?(r=o.find(e[a].tabSelector),r.length&&(n=r.index())):i&&$.each(i,function(e,t){a==t.id&&(n=t.selected)}),null!==n&&(o.tabs("option","active",n),t.trigger("tabstaterestored")))})},clearTabState:function(e){if(void 0!==window.sessionStorage){var t=window.sessionStorage;if(e)t.removeItem("tabs-"+e);else for(var n=0;n