@clickview/curator 1.0.3-rc.0 → 1.0.4-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/curator-app.js +1 -1
- package/dist/curator-app.js.map +1 -1
- package/package.json +46 -46
package/dist/curator-app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("Formik"),require("ReactBootstrap"),require("ReactRedux"),require("Backbone"),require("SortableHOC"),require("Cropper"),require("Handlebars")):"function"==typeof define&&define.amd?define(["React","@clickview/shared","@clickview/common","Yup","Formik","ReactBootstrap","ReactRedux","Backbone","SortableHOC","Cropper","Handlebars"],t):"object"==typeof exports?exports["@clickview/curator"]=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("Formik"),require("ReactBootstrap"),require("ReactRedux"),require("Backbone"),require("SortableHOC"),require("Cropper"),require("Handlebars")):e["@clickview/curator"]=t(e.React,e["@clickview/shared"],e["@clickview/common"],e.Yup,e.Formik,e.ReactBootstrap,e.ReactRedux,e.Backbone,e.SortableHOC,e.Cropper,e.Handlebars)}(window,(function(e,t,n,r,i,a,o,c,s,u,l){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=22)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=r},function(e,t){e.exports=i},function(e,t){e.exports=a},function(e,t,n){"use strict";var r=n(13);n.o(r,"DomainOptionKind")&&n.d(t,"DomainOptionKind",(function(){return r.DomainOptionKind})),n.o(r,"DomainOptionType")&&n.d(t,"DomainOptionType",(function(){return r.DomainOptionType}));var i=n(15);n.d(t,"DomainOptionKind",(function(){return i.a})),n.d(t,"DomainOptionType",(function(){return i.b}))},function(e,t){e.exports=o},function(e,t,n){e.exports={tree:"_1abau",text:"f13wK",chevron:"_25eVA",disabled:"_1qyCo",parentOfSelected:"_1fgN6",selected:"cVZit",actions:"_2BGWp",node:"rJVbQ",collapsed:"vc2by"}},function(e,t){e.exports=c},function(e,t,n){e.exports={draggableVideoItem:"_1JMCe",draggedVideoItem:"_3jjle"}},function(e,t){e.exports=s},function(e,t,n){e.exports={curatorLayout:"XayF7",topNavRegion:"_3ewaZ",leftNavRegion:"_2c2o6"}},function(e,t,n){"use strict";var r=n(14);n.o(r,"DomainOptionKind")&&n.d(t,"DomainOptionKind",(function(){return r.DomainOptionKind})),n.o(r,"DomainOptionType")&&n.d(t,"DomainOptionType",(function(){return r.DomainOptionType}))},function(e,t){},function(e,t,n){"use strict";var r,i;!function(e){e.Boolean="System.Boolean",e.String="System.String",e.StaffRequest="ClickView.DomainApi.Models.Options.Enums.StaffRequestOption, ClickView.DomainApi.Models, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null",e.Long="System.Int64"}(r||(r={})),function(e){e[e.Permanent=0]="Permanent",e[e.Temporary=1]="Temporary"}(i||(i={})),n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}))},function(e,t,n){var r=n(21);e.exports=(r.default||r).template({compiler:[8,">= 4.3.0"],main:function(e,t,n,r,i){return'<div class="layout-region"></div>'},useData:!0})},function(e,t){e.exports=u},function(e,t,n){e.exports={navContainer:"_11O8h"}},function(e,t,n){e.exports={navContainer:"_3vLoN"}},function(e){e.exports=JSON.parse("{}")},function(e,t){e.exports=l},function(e,t,n){"use strict";n.r(t);n(20);var r={UPLOAD_IMAGE:"upload:image"},i={Subjects:Object.assign({SUBJECTS:"subjects",NEW_SUBJECT:"new:subject",EDIT_SUBJECT:"edit:subject",EDIT_SUBJECT_PLAYLISTS:"edit:subject:playlists",EDIT_SUBJECT_SERIES:"edit:subject:series",EDIT_SUBJECT_VIDEOS:"edit:subject:videos",SUBJECT_CLASSIFICATIONS:"subject:classifications",DELETE_SUBJECT:"delete:subject",ADD_SUBJECT_MEMBERS:"add:subject:members",REMOVE_SUBJECT_MEMBER:"remove:subject:member",CLASSIFICATIONS:"classifications",PRESENTATION_CLASSIFICATIONS:"presentation:classifications",NEW_CLASSIFICATION:"new:classification",EDIT_CLASSIFICATION:"edit:classification",EDIT_CLASSIFICATION_PLAYLISTS:"edit:classification:playlists",EDIT_CLASSIFICATION_SERIES:"edit:classification:series",EDIT_CLASSIFICATION_VIDEOS:"edit:classification:videos",DELETE_CLASSIFICATION:"delete:classification",REMOVE_CLASSIFICATION_MEMBER:"remove:classification:member",LEVELS:"levels",NEW_LEVEL:"new:level",EDIT_LEVEL:"edit:level",AUDIENCES:"audiences",PRESENTATION_AUDIENCES:"presentation:audiences",NEW_AUDIENCE:"new:audience",EDIT_AUDIENCE:"edit:audience",DELETE_AUDIENCE:"delete:audience",PRESENTATIONS:"presentations",NEW_PRESENTATION:"new:presentation",EDIT_PRESENTATION:"edit:presentation"},r),Playlists:Object.assign({PLAYLISTS:"index",NEW_PLAYLIST:"new:playlist",EDIT_PLAYLIST:"edit:playlist",EDIT_PLAYLIST_VIDEOS:"edit:playlist:videos",EDIT_PLAYLIST_SUBJECTS:"edit:playlist:subjects",EDIT_PLAYLIST_AUDIENCES:"edit:playlist:audiences",DELETE_PLAYLIST:"delete:playlist",REMOVE_VIDEO:"remove:video",REMOVE_FROM_SUBJECT:"remove:from:subject"},r),Series:Object.assign({EDIT_SERIES:"edit:series",EDIT_SERIES_VIDEOS:"edit:series:videos",EDIT_SERIES_SUBJECTS:"edit:series:subjects",EDIT_SERIES_AUDIENCES:"edit:series:audiences"},r),Videos:{EDIT_VIDEO:"edit:video",EDIT_VIDEO_AUDIENCES:"edit:video:audiences",EDIT_VIDEO_SUBJECTS:"edit:video:subjects"},DomainOptions:{DOMAIN_OPTIONS:"domain:options",NEW_DOMAIN_OPTION:"new:domain:option",EDIT_DOMAIN_OPTION:"edit:domain:option",DELETE_DOMAIN_OPTION:"delete:domain:option"},People:{PEOPLE:"people",NEW_PERSON:"new:person",EDIT_PERSON:"edit:person"},Companies:{COMPANIES:"companies",NEW_COMPANY:"new:company",EDIT_COMPANY:"edit:company"}},a={SUBJECT:"subject",SUBJECTS:"subjects",UPDATE_SUBJECT:"update:subject",DELETE_SUBJECT:"delete:subject",UPDATE_OBJECT_SUBJECTS:"update:object:subjects",ADD_TO_SUBJECT:"add:to:subject",REMOVE_FROM_SUBJECT:"remove:from:subject",CLASSIFICATION:"classification",CLASSIFICATIONS:"classifications",UPDATE_CLASSIFICATION:"update:classification",DELETE_CLASSIFICATION:"delete:classification",UPDATE_OBJECT_CLASSIFICATIONS:"update:object:classifications",ADD_TO_CLASSIFICATION:"add:to:classification",REMOVE_FROM_CLASSIFICATION:"remove:from:classification",PRESENTATION:"presentation",PRESENTATIONS:"presentations",UPDATE_PRESENTATION:"update:presentation",LEVEL:"level",LEVELS:"levels",UPDATE_LEVEL:"update:level",ADD_TO_LEVEL:"add:to:level",REMOVE_FROM_LEVEL:"remove:from:level",UPDATE_OBJECT_LEVELS:"update:object:levels",AUDIENCE:"audience",AUDIENCES:"audiences",UPDATE_AUDIENCE:"update:audience",DELETE_AUDIENCE:"delete:audience",UPDATE_OBJECT_AUDIENCES:"update:object:audiences",PLAYLIST:"playlist",PLAYLISTS:"playlists",UPDATE_PLAYLIST:"update:playlist",DELETE_PLAYLIST:"delete:playlist",PLAYLIST_VIDEOS:"playlist:videos",REORDER_PLAYLIST_VIDEOS:"reorder:playlist:videos",REMOVE_PLAYLIST_VIDEO:"remove:playlist:video",VIDEO:"video",SERIES:"series",SERIES_BY_ID:"series:by:id",UPDATE_SERIES:"update:series",CURRENT_USER:"current:user",UPLOAD_IMAGE:"upload:image",LOCALE:"locale",PHRASES:"PHRASES"},o={IMAGES:".".concat(["jpg","tif","png","bmp","gif","jpeg"].join(",."))},c={CURATOR_LAYOUT:"CuratorLayout"},s={COMPANIES:"companies:application",DOMAIN_OPTIONS:"domain:options:application",PEOPLE:"people:application",PLAYLISTS:"playlists:application",SERIES:"series:application",SUBJECTS:"subjects:application",VIDEOS:"videos:application"},u={IMAGE_UPLOAD:"image:upload:data:service",PLAYLIST:"playlist:data:service",SERIES:"series:data:service",SUBJECT:"subject:data:service",USER:"user:data:service",VIDEO:"video:data:service",LANGUAGE:"language:data:service"},l={IMAGE_UPLOAD:"ImageUploadDataService",PLAYLIST:"PlaylistDataService",SUBJECT:"SubjectDataService",USER:"UserDataService",VIDEO:"VideoDataService",SERIES:"SeriesDataService",LANGUAGE:"LanguageDataService"},p=n(0),f=n(2),m=n(1),d=n(16),b=n.n(d),y=n(12),v=n.n(y);function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t){return!t||"object"!==S(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function g(e,t,n){return(g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=O(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var T=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=h(this,O(t).call(this,e))).childComponents={},n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&j(e,t)}(t,e),n=t,i=[{key:"getCacheKey",value:function(e){var t="".concat(this.name),n=[];return Object.keys(e).forEach((function(t){n.push("".concat(t,":").concat(e[t]))})),n.length&&(n.sort(),t+=":".concat(n.join(":"))),t}}],(r=[{key:"regions",value:function(){return{layout:".layout-region"}}},{key:"getChildComponents",value:function(){return{topNav:{component:this.childComponents[m.LayoutRegions.TOP_NAV],className:v.a.topNavRegion},leftNav:{component:this.childComponents[m.LayoutRegions.LEFT_NAV],className:"py-3 ".concat(v.a.leftNavRegion)},content:{component:this.childComponents[m.LayoutRegions.CONTENT],className:"position-relative container py-3"},popup:{component:this.childComponents[m.LayoutRegions.POPUP]},alert:{component:this.childComponents[m.LayoutRegions.ALERT]}}}},{key:"unsetRegion",value:function(e){delete this.childComponents[e],this.renderLayout()}},{key:"renderTopNav",value:function(){f.FunctionHelper.isFunction(this.options.getTopNavView)&&(this.childComponents[m.LayoutRegions.TOP_NAV]=this.options.getTopNavView(f.Core.AppLinkHelper.getCurrentAppLink()))}},{key:"hideLeftNav",value:function(){this.unsetRegion(m.LayoutRegions.LEFT_NAV)}},{key:"closePopup",value:function(){this.unsetRegion(m.LayoutRegions.POPUP)}},{key:"showChildView",value:function(e,t){this.childComponents[e]=t,this.renderTopNav(),this.renderLayout()}},{key:"renderLayout",value:function(){var e=Object.assign({provider:this.options.provider},this.getChildComponents());g(O(t.prototype),"showChildView",this).call(this,"layout",this.wrapWithStore(p.createElement(L,Object.assign({},e))))}},{key:"title",get:function(){return!1}},{key:"name",get:function(){return"CuratorLayoutView"}},{key:"template",get:function(){return b.a}},{key:"className",get:function(){return"container-fluid ".concat(v.a.curatorLayout)}}])&&E(n.prototype,r),i&&E(n,i),t}(f.ReactLayoutView),C=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},I=function(e){var t=e.className,n=e.children;return p.createElement("div",{className:t},n)},A=function(e,t){return"".concat(e).concat(t?" ".concat(t):"")},P=function(e){var t=e.topNav,n=e.leftNav,r=e.content,i=e.popup,a=e.alert;return p.createElement(p.Fragment,null,p.createElement("div",{className:"position-relative"},!!t.component&&p.createElement(I,{className:A("top-nav-region",t.className)},t.component),!!n.component&&p.createElement(I,{className:A("left-nav-region",n.className)},n.component),!!r.component&&p.createElement("div",{className:"content-container"},p.createElement(I,{className:A("content-region",r.className)},r.component))),!!i.component&&p.createElement(I,{className:A("popup-region",i.className)},i.component),!!a.component&&p.createElement(I,{className:A("alert-region",a.className)},a.component))},L=function(e){var t=e.provider,n=C(e,["provider"]);return t?p.createElement(t,null,p.createElement(P,Object.assign({},n))):p.createElement(P,Object.assign({},n))};function N(e){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function F(e,t){return!t||"object"!==N(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var x=function(e){function t(){return w(this,t),F(this,_(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&R(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.listenTo(f.CommonChannels.SHELL,f.Core.EventNames.ROUTING_END,this.updateNav)}},{key:"updateNav",value:function(){var e=this,t=f.Core.AppLinkHelper.getCurrentAppLink().application;if(t!==this.currentApplication){this.currentApplication=t;var n=this.options.navItemMappings[t];if(n){var r=document.querySelector(this.options.navSelector);r&&r.children&&k(r.children).forEach((function(t){var r=t.querySelector("a");r&&(r.classList.remove(e.options.currentItemClassName),r.text===n&&r.classList.add(e.options.currentItemClassName))}))}}}},{key:"name",get:function(){return"CuratorAppNavService"}}])&&D(n.prototype,r),i&&D(n,i),t}(f.Core.Service);function U(e){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function J(e,t){return!t||"object"!==U(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e,t){return(H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Y=function(e){function t(){return V(this,t),J(this,M(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&H(e,t)}(t,e),n=t,(r=[{key:"uploadBase64Image",value:function(e,t,n,r){return this.create({resource:"/api/image/upload?type=".concat(t),eventPrefix:a.UPLOAD_IMAGE,data:e,callback:n,errorCallback:r})}},{key:"name",get:function(){return l.IMAGE_UPLOAD}},{key:"channelName",get:function(){return u.IMAGE_UPLOAD}}])&&B(n.prototype,r),i&&B(n,i),t}(f.BaseDataService);function q(e){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function W(e,t){return!t||"object"!==q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Q=function(e){function t(){return K(this,t),W(this,G(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Z(e,t)}(t,e),n=t,(r=[{key:"getCurrentUser",value:function(e,t){return this.get({resource:"/api/currentuser",eventPrefix:a.CURRENT_USER,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"name",get:function(){return l.USER}},{key:"channelName",get:function(){return u.USER}}])&&z(n.prototype,r),i&&z(n,i),t}(f.BaseDataService),X={dataServiceName:l.USER,dataChannelName:u.USER},$={getCurrentUserFetchOptions:function(e,t){return Object.assign(Object.assign({},X),{eventPrefix:a.CURRENT_USER,fetchData:function(e){return e.getCurrentUser()},setData:e,onError:t})}};function ee(e){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function te(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ne(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function re(e,t){return!t||"object"!==ee(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e,t){return(ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var oe=function(e){function t(){return te(this,t),re(this,ie(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ae(e,t)}(t,e),n=t,(r=[{key:"getLanguageConfig",value:function(e){var t={locale:"en",phrases:{}},n=new f.ConcurrencyHelper(3),r=function(){n.decrement(),n.getValue()>0||e(t)};this.get({resource:"/api/locale",eventPrefix:a.LOCALE,expiryTime:m.CacheDurations.STANDARD,callback:function(e){t.locale=e,r()}}),this.get({resource:"/api/phrases/shared",eventPrefix:"".concat(a.PHRASES,":shared"),expiryTime:m.CacheDurations.STANDARD,callback:function(e){null===e.shared&&(e.shared={}),t.phrases=Object.assign(Object.assign({},t.phrases),e),r()}}),this.get({resource:"/api/phrases/subjects",eventPrefix:"".concat(a.PHRASES,":subjects"),expiryTime:m.CacheDurations.STANDARD,callback:function(e){null===e.subjects&&(e.subjects={}),t.phrases=Object.assign(Object.assign({},t.phrases),e),r()}})}},{key:"name",get:function(){return l.LANGUAGE}},{key:"channelName",get:function(){return u.LANGUAGE}}])&&ne(n.prototype,r),i&&ne(n,i),t}(f.BaseDataService),ce=n(7),se=function(e){var t="/api/master/v2/companies";return e?"".concat(t,"?cursor=").concat(e):t},ue=function(e){return"/api/master/v2/objects/".concat(e)},le=function(){return"/api/master/v2/companies"},pe=function(e){return"/api/master/v2/objects/".concat(e)},fe="companies",me="company",de="update:company",be=function(e){return{key:"".concat(fe).concat(e?":".concat(e):""),url:se(e)}},ye=function(e){return{key:"".concat(me,":").concat(e),url:ue(e)}},ve=function(e,t,n){return{key:me,url:le(),data:e,type:f.HttpVerbs.POST,success:t,error:n,invalidationKeys:[fe]}},Se=function(e,t,n){return{key:"".concat(de,":").concat(e),url:pe(e),data:t,type:f.HttpVerbs.PUT,always:n}},Ee=n(3),he=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),ge=n(4);function Oe(e){var t=Object(ge.useFormikContext)();return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this company",autoFocus:!0}),p.createElement(m.FormButtons,{isNew:e.isNew}))}function je(e){return p.createElement(m.FormWrapper,{initialValues:e.company,validationSchema:he,onSubmit:e.saveCompany},p.createElement(Oe,{isNew:!(e.company&&e.company.id)}))}function Te(e){var t=Object(ce.useDispatch)(),n=f.Flight.useBasicFetch(ye(e.id));return p.createElement(p.Fragment,null,!!n.data&&p.createElement(je,{company:n.data,saveCompany:function(n,r){return f.Flight.fetch(t,Se(e.id,n,r))}}))}function Ce(){var e=Object(ce.useDispatch)();return p.createElement(je,{saveCompany:function(t,n){f.Flight.fetch(e,ve(t,(function(e){n(),f.Core.AppLinkHelper.trigger({application:s.PEOPLE,action:i.Companies.EDIT_COMPANY,args:[e.id]})}),n))}})}function Ie(e){var t=e.backToName,n=e.appLink;return p.createElement(m.AppLink,{appLink:n,className:"d-inline-flex align-items-center"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.ArrowLeft,size:m.SvgContainerSize.Small}),p.createElement("span",{className:"ml-1"},"Back to ".concat(t)))}var Ae=n(5);function Pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Le=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Ne(e){var t=e.selected,n=e.onToggle,r=Le(e,["selected","onToggle"]),i=Pe(p.useState(t),2),a=i[0],o=i[1];p.useEffect((function(){return o(t)}),[t]);return p.createElement(Ae.Form.Check,Object.assign({type:"checkbox",id:"checkbox-".concat(f.RandomHelper.getRandomInt()),checked:a,onChange:function(){o(!a),n(!a)}},r))}var ke=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function we(e){var t=e.onFileSelect,n=e.acceptMultiple,r=e.mimeType,i=e.label,a=e.error,o=e.touched,c=ke(e,["onFileSelect","acceptMultiple","mimeType","label","error","touched"]),s="custom-file-input cursor-pointer";a&&o&&(s+=" is-invalid");var u=Object.assign({type:"file",className:s,onChange:function(e){var n=e.currentTarget.files;n&&n.length&&f.FunctionHelper.isFunction(t)&&t(n)},autoComplete:"off",value:"",multiple:!!n},r?{accept:r}:{});return p.createElement("div",{className:"form-group"},p.createElement("div",{className:"custom-file"},p.createElement(ge.Field,Object.assign({},u,c),e.children),p.createElement(Ae.Form.Label,{className:"custom-file-label",htmlFor:c.id},i)))}var De,Fe={onFileSelect:function(e,t,n){if(t&&t.length){var r=new FileReader;r.addEventListener("load",(function(){return Fe.onReaderLoad(r,e,n)})),r.readAsDataURL(t[0])}},onReaderLoad:function(e,t,n){var r=new Image;r.src=e.result;var i=m.ImageMinDimensions[t].width,a=m.ImageMinDimensions[t].height;r.addEventListener("load",(function(){Fe.isImageValid(t,r)&&f.FunctionHelper.isFunction(n)?n(r):alert("Image too small: minimum dimensions are ".concat(i," x ").concat(a))}))},isImageValid:function(e,t){var n=m.ImageMinDimensions[e].width,r=m.ImageMinDimensions[e].height;return!(n&&t.width<n)&&!(r&&t.height<r)}},_e={isItemActive:function(e,t){return t||(t=f.Core.AppLinkHelper.getCurrentAppLink()),t.application===e.appLink.application&&(Array.isArray(e.activeActions)?e.activeActions.includes(t.action):t.action===e.appLink.action)}};!function(e){e.Developer="Curator Devs",e.Curator="Curators",e.Support="Support",e.SalesSupport="Sales Support"}(De||(De={}));var Re=function(){return[{value:"protected",access:"r"}]},xe=function(e){return He.getGroupNames(e).includes(De.Developer)},Ue=function(e){return Object.values(e).every((function(e){return!!e}))},Ve=function(e,t){return!!e&&!!t&&e.toString()===t.toString()},Be=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function Je(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var Me={find:function(e,t){if(e&&e.children&&e.children.length)for(var n=function e(n){if(Ve(n.id,t))return n;var r=n.children;if(r&&r.length)for(var i=0;i<r.length;i++){var a=e(r[i]);if(a)return a}},r=0;r<e.children.length;r++){var i=n(e.children[r]);if(i)return i}},getPath:function(e,t){for(var n=[t],r=function(e){return e.hasOwnProperty("parentIds")&&Array.isArray(e.parentIds)&&e.parentIds.length?e.parentIds[0]:e.hasOwnProperty("parentId")?e.parentId:null},i=r(t);i;){var a=Me.find(e,i);a&&(n=[a].concat(Je(n))),i=a?r(a):null}return n}},He={getGroupNames:function(e){return e&&e.groups?e.groups.map((function(e){return e.name})):[]}};function Ye(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var qe=p.createContext(void 0),Ke=function(e){var t=e.children,n=Ye(p.useState(),2),r=n[0],i=n[1],a=Ye(p.useState(!1),2),o=a[0],c=a[1],s=Ye(p.useState(),2),u=s[0],l=s[1],f={getDataUrl:function(){var e=r;return i(null),e},setDataUrl:i,imageUploaded:o,getImage:function(){var e=u;return l(null),c(!1),e},setImage:function(e){l(e),c(!0)}};return p.createElement(qe.Provider,{value:f},t)};function ze(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var We,Ge=p.createContext(void 0);function Ze(e){var t=e.children,n=ze(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(m.UserDataServiceHelper.getCurrentUserFetchOptions(i),[]),p.createElement(Ge.Provider,{value:r},t)}function Qe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $e=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},et=(Xe(We={},m.ImageType.Thumbnails,"Thumbnail"),Xe(We,m.ImageType.Banners,"Banner"),Xe(We,m.ImageType.Avatars,"Avatar"),Xe(We,m.ImageType.Logos,"Logo"),Xe(We,m.ImageType.Covers,"Cover"),Xe(We,m.ImageType.Posters,"Poster"),We);function tt(e){var t=e.imageType,n=e.currentImage,r=e.setNewImage,i=e.application,a=e.uploadAction,c=$e(e,["imageType","currentImage","setNewImage","application","uploadAction"]),s=p.useContext(qe),u=s.setDataUrl,l=s.getImage,d=s.imageUploaded,b=Qe(p.useState(!1),2),y=b[0],v=b[1],S=Qe(p.useState(n),2),E=S[0],h=S[1],g=Qe(p.useState(!1),2),O=g[0],j=g[1],T=function(e){v(!0),u(e.src),f.Core.AppLinkHelper.trigger({application:i,action:a,args:[t]})};return p.useEffect((function(){if(y){var e=l();e&&(v(!1),h(e),r({fileId:e.id,fileIdType:m.FileIdType.ImageAPIv2}))}}),[d]),p.createElement("div",{className:"form-group"},p.createElement("div",{className:"form-control h-auto py-2"},p.createElement("label",null,et[t]),p.createElement(we,Object.assign({label:"Choose a ".concat(et[t].toLowerCase()),name:"image",mimeType:o.IMAGES,onFileSelect:function(e){return Fe.onFileSelect(t,e,T)}},c)),!!E&&!!E.url&&p.createElement(p.Fragment,null,!O&&p.createElement("div",{className:"pb-2 ".concat(t===m.ImageType.Banners?"w-100":"w-50")},p.createElement("img",{src:m.ImageHelper.createUrl(E.url),className:"img img-fluid"})),p.createElement("div",{className:"d-flex justify-content-center"},p.createElement(m.SvgContainer,{svgName:O?m.cvSvgLibrary.ChevronDown:m.cvSvgLibrary.ChevronUp,size:m.SvgContainerSize.Large,className:"svg-container cursor-pointer",onClick:function(){return j(!O)},title:O?"Show image":"Hide image",tooltipPlacement:"top"})))))}var nt,rt=n(17),it=n.n(rt);function at(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}!function(e){e[e.NoRestrictions=0]="NoRestrictions",e[e.RestrictToCanvas=1]="RestrictToCanvas"}(nt||(nt={}));var ot=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function ct(e){var t=e.dataUrl,n=e.minHeight,r=e.minWidth,i=e.onCrop,a=e.onCancel,o=p.useRef(),c=p.useRef(),s=at(p.useState(!1),2),u=s[0],l=s[1],d=at(p.useState(!1),2),b=d[0],y=d[1];return p.useEffect((function(){var e=new Image;e.src=t;var i=o.current.offsetWidth/e.width;return c.current=new it.a(o.current,{viewMode:nt.RestrictToCanvas,autoCropArea:1,aspectRatio:r/n,minCropBoxWidth:r*i,minCropBoxHeight:n*i,ready:function(){return l(!0)}}),function(){return c.current.destroy()}}),[]),p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement("img",{ref:o,src:t,className:"img img-fluid mw-100"})),p.createElement("div",{className:"d-flex justify-content-end border-top pt-3"},p.createElement(Ae.Button,{variant:"link",onClick:a},"Cancel"),p.createElement(m.SpinnerButton,{onClick:function(){if(u){y(!0);var e=c.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(ot);if(t)return t[1]}(t));f.FunctionHelper.isFunction(i)&&i(e)}},disabled:!u,showSpinner:b},"Crop")))}function st(e){if(!e.collection)return p.createElement(p.Fragment,null);var t=e.collection,n=t.data,r=t.pagination;return p.createElement(p.Fragment,null,!!n&&p.createElement(pt,{objects:n,getObjectAppLink:e.getObjectAppLink,newObjectAppLink:e.newObjectAppLink,objectName:e.objectName}),!!r&&!!r.cursors&&p.createElement(m.Pagination,{cursors:r.cursors,appLink:e.collectionAppLink}))}function ut(e){var t=e.object,n=e.actions;return p.createElement("div",{className:"d-flex justify-content-between py-2"},!!t&&p.createElement("h5",null,t.name),!!n&&p.createElement("span",null,p.createElement(m.Actions,{actions:n})))}function lt(e){return p.createElement("tr",null,p.createElement("td",null,p.createElement(m.AppLink,{appLink:e.appLink},e.object.name)),p.createElement("td",null))}function pt(e){return p.createElement(Ae.Table,{responsive:!0},p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,"Name"),p.createElement("th",null,p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.AppLink,{appLink:e.newObjectAppLink},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New ".concat(e.objectName))))))),p.createElement("tbody",null,e.objects.map((function(t){return p.createElement(lt,{key:t.id,object:t,appLink:e.getObjectAppLink(t)})}))))}function ft(e){var t=e.objects,n=e.getAppLink,r=e.emptyMessage;return t?t.length?p.createElement("ul",{className:"list-unstyled"},t.map((function(e,t){return p.createElement("li",{key:t,className:"border rounded mb-3"},p.createElement(m.AppLink,{appLink:n(e),className:"d-block p-3"},e.name))}))):p.createElement("div",{className:"py-3"},p.createElement("p",null,r)):p.createElement(p.Fragment,null)}ft.defaultProps={emptyMessage:"There is nothing here."};function mt(e){var t=Object(ge.useFormikContext)();return p.createElement(m.FormField,{as:"select",label:"Rating",name:"rating",id:"rating",value:t.values.rating&&t.values.rating.id,onChange:function(e){return t.setFieldValue("rating",e.target.value?{id:e.target.value}:{})}},p.createElement(p.Fragment,null,p.createElement("option",{value:""},"Please select a rating"),e.ratings.map((function(e,t){return p.createElement("option",{key:t,value:e.id},function(e){return"".concat(e.name).concat(e.code?" (".concat(e.code,")"):"")}(e))}))))}function dt(e){var t=e.tabs,n=e.isItemActive;return p.createElement(Ae.Nav,{fill:!0,variant:"tabs"},t.map((function(e,t){return p.createElement(Ae.Nav.Item,{key:t},p.createElement(Ae.Nav.Link,{as:m.AppLink,appLink:e.appLink,active:n(e)},e.label))})))}dt.defaultProps={isItemActive:_e.isItemActive};var bt=n(8),yt=n.n(bt);function vt(e){var t=e.name,n=e.appLink,r=e.onSelect,i=e.isDisabled,a=e.className,o=e.actions,c=yt.a.text;return a&&(c+=" ".concat(a)),i?p.createElement("a",{className:"".concat(c," text-muted ").concat(yt.a.disabled)},t):p.createElement(p.Fragment,null,n?p.createElement(m.AppLink,{appLink:n,className:c},t):p.createElement("a",{onClick:r,className:c},t),!!o&&p.createElement(m.Actions,{className:yt.a.actions,actions:o}))}function St(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Et(e){var t=e.tree,n=e.selectedIds,r=e.getAppLink,i=e.onSelect,a=e.isDisabled,o=e.actions,c=Array.isArray(n)&&n.some((function(e){return Ve(t.id,e)})),s=p.useMemo((function(){return Array.isArray(n)&&n.some((function(e){return Me.find(t,e)}))}),[t,n]),u=St(p.useState(s),2),l=u[0],d=u[1],b=!!t.children&&!!t.children.length,y={name:t.name,appLink:f.FunctionHelper.isFunction(r)?r(t):null,onSelect:f.FunctionHelper.isFunction(i)?function(){return i(t)}:null,isDisabled:!!f.FunctionHelper.isFunction(a)&&a(t),className:c&&yt.a.selected||s&&yt.a.parentOfSelected,actions:!!o&&o.map((function(e){return Object.assign(Object.assign({},e),{appLink:e.getAppLink(t)})}))};return p.createElement("li",{className:"position-relative".concat(l?"":" ".concat(yt.a.collapsed))},p.createElement("div",{className:"position-relative"},p.createElement("span",{className:yt.a.node},b&&p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.ChevronDown,size:m.SvgContainerSize.Small,className:"svg-container ".concat(yt.a.chevron),onClick:function(){return d(!l)}}),p.createElement(vt,Object.assign({},y))),l&&p.createElement(gt,Object.assign({},e))))}var ht=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function gt(e){var t=e.tree,n=ht(e,["tree"]);return t&&t.children?p.createElement("ul",{className:"m-0 p-0 ".concat(yt.a.tree)},t.children.map((function(e){return p.createElement(Et,Object.assign({key:e.id,tree:e},n))}))):p.createElement(p.Fragment,null)}var Ot={getChord:function(e,t){return Me.getPath(e,t).map((function(e){return e.name})).join(" -> ")},getState:function(e,t){var n={};return Array.isArray(e)&&e.forEach((function(e){var r,i,a,o=Me.find(t,e);o&&(n=Object.assign((r={},i=e,a=Ot.getChord(t,o),i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r),n))})),n}};function jt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Tt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Ct(e){var t=e.onSelect,n=e.label,r=e.hideCollapseBtn,i=e.collapse,a=e.noSelectionMessage,o=e.isNodeDisabled,c=e.getSelectedItemAppLink,s=Tt(e,["onSelect","label","hideCollapseBtn","collapse","noSelectionMessage","isNodeDisabled","getSelectedItemAppLink"]),u=s.tree,l=s.selectedIds,d=jt(p.useState(Ot.getState(l,u)),2),b=d[0],y=d[1];p.useEffect((function(){return y(Ot.getState(l,u))}),[l,u]);var v=jt(p.useState(!!i),2),S=v[0],E=v[1];p.useEffect((function(){return E(!!i)}),[i]);var h=!r||!!n;return p.createElement(p.Fragment,null,h&&p.createElement("div",{className:"pb-2"},!!n&&p.createElement("label",{className:"m-0"},n),!r&&p.createElement("a",{className:"float-right cursor-pointer",onClick:function(){return E(!S)}},S?"Expand":"Collapse")),!S&&p.createElement("div",{className:"py-2 border-top"},p.createElement(gt,Object.assign({onSelect:function(e){return f.FunctionHelper.isFunction(t)&&t(e)},isDisabled:o},s))),(!f.ObjectHelper.isEmpty(b)||!!a)&&p.createElement("div",{className:"py-2 border-top"},p.createElement("label",null,"Selected:"),p.createElement("ul",{className:"m-0"},f.ObjectHelper.isEmpty(b)?p.createElement("li",null,a):Object.keys(b).map((function(e,t){return p.createElement("li",{key:t},f.FunctionHelper.isFunction(c)?p.createElement(m.AppLink,{appLink:c(e)},b[e]):b[e])})))))}var It=n(11),At=function(e){var t="bg-white";return e&&(t+=" ".concat(e)),t};function Pt(e){var t=e.video,n=e.getVideoAppLink,r=e.getVideoActions,i=e.className,a=void 0===i?"":i,o=e.itemNumber,c=f.FunctionHelper.isFunction(n)&&n(t);return p.createElement("tr",{className:At(a)},!!o&&p.createElement("td",null,p.createElement("span",null,o)),p.createElement("td",null,c?p.createElement(m.AppLink,{appLink:c},t.name):t.name),f.FunctionHelper.isFunction(r)&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(m.Actions,{actions:r(t)}))))}var Lt=Object(It.SortableElement)((function(e){return p.createElement(Pt,Object.assign({sortable:!0},e))})),Nt=n(10),kt=n.n(Nt),wt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Dt=function(e){var t=e.sortable,n=e.getVideoActions;return p.createElement("thead",null,p.createElement("tr",null,!!t&&p.createElement("th",null,"#"),p.createElement("th",null,"Name"),!!n&&p.createElement("th",null)))},Ft=p.forwardRef((function(e,t){var n=e.videos,r=e.sortable,i=wt(e,["videos","sortable"]);return p.createElement("tbody",{ref:t},!m.CollectionHelper.isEmpty(n)&&n.data.map((function(e,t){return r?p.createElement(Lt,Object.assign({key:e.id,index:t,itemNumber:t+1,video:e,className:kt.a.draggableVideoItem},i)):p.createElement(Pt,Object.assign({video:e},i))})))}));var _t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Rt=Object(It.SortableContainer)((function(e){var t=e.forwardedRef,n=_t(e,["forwardedRef"]);return p.createElement(Ft,Object.assign({sortable:!0,ref:t},n))})),xt=function(e){return function(t){var n=t.node,r=e.current;if(r){r.classList.add(kt.a.sortingContainer);var i=r.querySelector(".".concat(kt.a.draggedVideoItem));n.childNodes.forEach((function(e,t){return i.childNodes[t].style.width="".concat(e.offsetWidth,"px")}))}}},Ut=function(e,t){return function(n){var r=e.current;r&&r.classList.remove(kt.a.sortingContainer),t(n.oldIndex,n.newIndex)}};function Vt(e){var t=e.onSortEnd,n=e.emptyMessage,r=_t(e,["onSortEnd","emptyMessage"]),i=p.useRef();return m.CollectionHelper.isEmpty(e.videos)?p.createElement("div",null,n):p.createElement(Ae.Table,{responsive:!0},p.createElement(Dt,Object.assign({sortable:!0},e)),p.createElement(Rt,Object.assign({forwardedRef:i,onSortStart:xt(i),onSortEnd:Ut(i,t),lockAxis:"y",lockToContainerEdges:!0,distance:1,helperClass:kt.a.draggedVideoItem,helperContainer:function(){return i.current}},r)))}Vt.defaultProps={emptyMessage:"There are no videos in this list."};var Bt=s.COMPANIES,Jt=function(e){return{application:Bt,action:i.Companies.EDIT_COMPANY,args:[e.id]}};function Mt(e){var t=f.Flight.useBasicFetch(be(e.cursor));return p.createElement(st,{collection:t&&t.data,collectionAppLink:{application:Bt,action:i.Companies.COMPANIES},newObjectAppLink:{application:Bt,action:i.Companies.NEW_COMPANY},getObjectAppLink:Jt,objectName:"Company"})}function Ht(e){return(Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Yt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Kt(e,t,n){return t&&qt(e.prototype,t),n&&qt(e,n),e}function zt(e,t){return!t||"object"!==Ht(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Wt(e){return(Wt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Gt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Zt(e,t)}function Zt(e,t){return(Zt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Qt=function(e){function t(){return Yt(this,t),zt(this,Wt(t).apply(this,arguments))}return Gt(t,e),Kt(t,[{key:"channelName",get:function(){return s.COMPANIES}},{key:"appRoutes",get:function(){return{"manage/companies(/)":"companies","manage/companies/new(/)":"newCompany","manage/companies/:id(/)":"editCompany"}}}]),t}(f.Core.AppRouter),Xt=function(e){function t(){return Yt(this,t),zt(this,Wt(t).apply(this,arguments))}return Gt(t,e),Kt(t,[{key:"companies",value:function(e){var t=e.cursor;this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Mt,{cursor:t}))}},{key:"newCompany",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ce,null))}},{key:"editCompany",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Te,{id:e}))}},{key:"name",get:function(){return"Companies Application"}},{key:"channelName",get:function(){return s.COMPANIES}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return Qt}}]),t}(f.Core.Application),$t=n(9),en=n(6),tn={namespace:"domain_options"},nn=function(){return"/api/domain/v3/settings/types"},rn=function(e){return"/api/domain/v3/settings/types/".concat(e)},an=function(){return"/api/domain/v3/settings/types"},on=function(e){return"/api/domain/v3/settings/types/".concat(e)},cn=function(e){return"/api/domain/v3/settings/types/".concat(e)},sn="domain:options",un="domain:option",ln="update:domain:option",pn="delete:domain:option",fn=function(){return{key:sn,url:nn(),normalizeOptions:tn}},mn=function(e){return{key:"".concat(un,":").concat(e),url:rn(e),normalizeOptions:tn}},dn=function(e,t,n){return e.type===en.DomainOptionType.String&&(e=vn(e)),{key:un,url:an(),data:e,type:f.HttpVerbs.POST,success:t,error:n,invalidationKeys:[sn],normalizeOptions:tn}},bn=function(e,t){return e.type===en.DomainOptionType.String&&(e=vn(e)),{key:"".concat(ln,":").concat(e.id),url:on(e.id),data:e,type:f.HttpVerbs.PUT,always:t,formatData:function(){return e},normalizeOptions:tn}},yn=function(e,t){return{key:"".concat(pn,":").concat(e),url:cn(e),type:f.HttpVerbs.DELETE,invalidationKeys:[sn],normalizeOptions:tn,success:t}};function vn(e){var t=e.defaultValue;if('"'===t)return Object.assign(Object.assign({},e),{defaultValue:'"'.concat(t,'"')});var n=t.charAt(0),r=t.charAt(t.length-1);return'"'!==n&&(t='"'.concat(t)),'"'!==r&&(t="".concat(t,'"')),Object.assign(Object.assign({},e),{defaultValue:t})}function Sn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function En(e){var t=Sn(p.useState(!1),2),n=t[0],r=t[1],a=f.Flight.useBasicFetch(mn(e.optionId)),o=Object(ce.useDispatch)(),c=function(){e.closePopup(),f.Core.AppLinkHelper.trigger({application:s.DOMAIN_OPTIONS,action:i.DomainOptions.DOMAIN_OPTIONS})};return p.createElement(m.Popup,{title:"Delete Domain Option",closePopup:e.closePopup,showLoadingSpinner:!a.data},a.data&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.data.name),"?")),p.createElement(m.PopupButtons,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){r(!0),f.Flight.fetch(o,yn(e.optionId,c))},buttonText:"Yes, delete this domain option",isSpinnerButton:!0,showSpinner:n}]})))}var hn=function(e){return{application:s.DOMAIN_OPTIONS,action:i.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]}},gn={application:s.DOMAIN_OPTIONS,action:i.DomainOptions.NEW_DOMAIN_OPTION};function On(){var e=f.Flight.useBasicFetch(fn());if(!e.data)return p.createElement(p.Fragment,null);var t=e.data.map((function(e){return e.displayName&&(e.name=e.displayName),e}));return p.createElement(p.Fragment,null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a domain option type to edit:"),p.createElement(m.AppLink,{appLink:gn,className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Domain Option"))),p.createElement(ft,{objects:t,getAppLink:hn}))}var jn=Ee.object().shape({id:Ee.string(),name:Ee.string().trim().max(64,"Name is too long").required("Name is required").default(""),displayName:Ee.string().trim().max(255,"Display name is too long").default(""),type:Ee.mixed().required("Type is required").default(en.DomainOptionType.Boolean),entityType:Ee.mixed().required("Entity type is required").default(m.MasterType.Customer),kind:Ee.mixed().required("Kind is required").default(en.DomainOptionKind.Temporary),defaultValue:Ee.mixed().required("Default value is required").default("false")}).noUnknown();function Tn(e){var t=e.type,n=e.defaultValue;if(!t)return p.createElement(p.Fragment,null);var r={label:"Default Value",name:"defaultValue",id:"defaultValue",value:n};return t===en.DomainOptionType.Boolean?p.createElement(m.FormField,Object.assign({as:"select"},r),p.createElement("option",{value:"true"},"True"),p.createElement("option",{value:"false"},"False")):t===en.DomainOptionType.Long||t===en.DomainOptionType.StaffRequest?p.createElement(m.FormField,Object.assign({as:"input",type:"number"},r)):t===en.DomainOptionType.String?p.createElement(m.FormField,Object.assign({as:"input"},r)):void 0}var Cn=[m.MasterType.Customer,m.MasterType.User];function In(e){var t=null===e.id||void 0===e.id,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name (snake_case)",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this domain option",autoFocus:!0}),p.createElement(m.FormField,{label:"Display Name",type:"text",name:"displayName",id:"displayName",value:n.values.displayName,placeholder:"Enter a display name for this domain option"}),p.createElement(m.FormField,{as:"select",label:"Kind",name:"kind",id:"kind",value:n.values.kind},f.ObjectHelper.getEnumKeys(en.DomainOptionKind).map((function(e){return p.createElement("option",{key:e,value:en.DomainOptionKind[e]},e)}))),p.createElement(m.FormField,{as:"select",label:"Entity",name:"entityType",id:"entityType",value:n.values.entityType},f.ObjectHelper.getEnumKeys(m.MasterType).filter((function(e){return Cn.includes(m.MasterType[e])})).map((function(e){return p.createElement("option",{key:e,value:m.MasterType[e]},e)}))),p.createElement(m.FormField,{as:"select",label:"Type",name:"type",id:"type",value:n.values.type},f.ObjectHelper.getEnumKeys(en.DomainOptionType).map((function(e){return p.createElement("option",{key:e,value:en.DomainOptionType[e]},e)}))),p.createElement(Tn,{type:n.values.type,defaultValue:n.values.defaultValue}),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.DOMAIN_OPTIONS,action:i.DomainOptions.DELETE_DOMAIN_OPTION,args:[e.id]}},"Delete")))}function An(e){return p.createElement(m.FormWrapper,{initialValues:e.domainOption,validationSchema:jn,onSubmit:e.saveDomainOption},p.createElement(In,{id:e.domainOption&&e.domainOption.id}))}function Pn(){var e=Object(ce.useDispatch)();return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Domain Option"),p.createElement(An,{saveDomainOption:function(t,n){f.Flight.fetch(e,dn(t,(function(e){n(),f.Core.AppLinkHelper.trigger({application:s.DOMAIN_OPTIONS,action:i.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]})}),n))}}))}function Ln(e){var t=e.optionId,n=f.Flight.useBasicFetch(mn(t)),r=Object(ce.useDispatch)();return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Domain Option"),n.data&&p.createElement(An,{domainOption:n.data,saveDomainOption:function(e,t){return f.Flight.fetch(r,bn(e,t))}}))}function Nn(e){return(Nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function kn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Dn(e,t,n){return t&&wn(e.prototype,t),n&&wn(e,n),e}function Fn(e,t){return!t||"object"!==Nn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _n(e){return(_n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Rn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xn(e,t)}function xn(e,t){return(xn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Un=function(e){function t(){return kn(this,t),Fn(this,_n(t).apply(this,arguments))}return Rn(t,e),Dn(t,[{key:"channelName",get:function(){return s.DOMAIN_OPTIONS}},{key:"appRoutes",get:function(){return{"developer/options(/)":"domainOptions","developer/options/new(/)":"newDomainOption","developer/options/:id(/)":"editDomainOption"}}},{key:"appLinks",get:function(){return["deleteDomainOption"]}}]),t}(f.Core.AppRouter),Vn=function(e){function t(){return kn(this,t),Fn(this,_n(t).apply(this,arguments))}return Rn(t,e),Dn(t,[{key:"domainOptions",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(On,null))}},{key:"newDomainOption",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Pn,null))}},{key:"editDomainOption",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ln,{optionId:e}))}},{key:"deleteDomainOption",value:function(e){this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(En,Object.assign({optionId:e},this.getPopupProps())))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return $t.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Domain Options Application"}},{key:"channelName",get:function(){return s.DOMAIN_OPTIONS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return Un}}]),t}(f.Core.Application),Bn=function(e){return e?"".concat("/api/master/v2/people","?cursor=").concat(e):"/api/master/v2/people"},Jn=function(e){return"/api/master/v2/objects/".concat(e)},Mn=function(){return"/api/master/v2/people"},Hn=function(e){return"/api/master/v2/objects/".concat(e)},Yn="people",qn="person",Kn="update:person",zn=function(e){return{key:"".concat(Yn).concat(e?":".concat(e):""),url:Bn(e)}},Wn=function(e){return{key:"".concat(qn,":").concat(e),url:Jn(e)}},Gn=function(e,t,n){return{key:qn,url:Mn(),data:e,type:f.HttpVerbs.POST,success:t,error:n,invalidationKeys:[Yn]}},Zn=function(e,t,n){return{key:"".concat(Kn,":").concat(e),url:Hn(e),data:t,type:f.HttpVerbs.PUT,always:n}},Qn=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown();function Xn(e){var t=Object(ge.useFormikContext)();return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this person",autoFocus:!0}),p.createElement(m.FormButtons,{isNew:e.isNew}))}function $n(e){return p.createElement(m.FormWrapper,{initialValues:e.person,validationSchema:Qn,onSubmit:e.savePerson},p.createElement(Xn,{isNew:!(e.person&&e.person.id)}))}function er(e){var t=Object(ce.useDispatch)(),n=f.Flight.useBasicFetch(Wn(e.id));return p.createElement(p.Fragment,null,!!n.data&&p.createElement($n,{person:n.data,savePerson:function(n,r){return f.Flight.fetch(t,Zn(e.id,n,r))}}))}function tr(){var e=Object(ce.useDispatch)();return p.createElement($n,{savePerson:function(t,n){f.Flight.fetch(e,Gn(t,(function(e){n(),f.Core.AppLinkHelper.trigger({application:s.PEOPLE,action:i.People.EDIT_PERSON,args:[e.id]})}),n))}})}var nr=s.PEOPLE,rr=function(e){return{application:nr,action:i.People.EDIT_PERSON,args:[e.id]}};function ir(e){var t=f.Flight.useBasicFetch(zn(e.cursor));return p.createElement(st,{collection:t&&t.data,collectionAppLink:{application:nr,action:i.People.PEOPLE},newObjectAppLink:{application:nr,action:i.People.NEW_PERSON},getObjectAppLink:rr,objectName:"Person"})}function ar(e){return(ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function or(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function sr(e,t,n){return t&&cr(e.prototype,t),n&&cr(e,n),e}function ur(e,t){return!t||"object"!==ar(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function lr(e){return(lr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fr(e,t)}function fr(e,t){return(fr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var mr=function(e){function t(){return or(this,t),ur(this,lr(t).apply(this,arguments))}return pr(t,e),sr(t,[{key:"channelName",get:function(){return s.PEOPLE}},{key:"appRoutes",get:function(){return{"manage/people(/)":"people","manage/people/new(/)":"newPerson","manage/people/:id(/)":"editPerson"}}}]),t}(f.Core.AppRouter),dr=function(e){function t(){return or(this,t),ur(this,lr(t).apply(this,arguments))}return pr(t,e),sr(t,[{key:"people",value:function(e){var t=e.cursor;this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(ir,{cursor:t}))}},{key:"newPerson",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(tr,null))}},{key:"editPerson",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(er,{id:e}))}},{key:"name",get:function(){return"People Application"}},{key:"channelName",get:function(){return s.PEOPLE}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return mr}}]),t}(f.Core.Application);function br(e){return(br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Sr(e,t){return!t||"object"!==br(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Er(e){return(Er=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function hr(e,t){return(hr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var gr,Or=function(e){return"/api/master/v2/objects/".concat(e,"?query=cover,banner")},jr=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},Tr=function(e){return"/api/master/v2/objects/".concat(e,"/playlists")},Cr=function(e){return"/api/master/v2/objects/".concat(e)},Ir=function(e){return"/api/master/v1/playlists/".concat(e)},Ar=function(e,t,n){var r="/api/master/v2/objects/".concat(e,"/").concat(t);return n&&(r+="?query=".concat(n)),r},Pr=function(e){return"/api/master/v1/objects/".concat(e,"/videos/reorder")},Lr=function(e,t){return"/api/master/v1/playlists/".concat(e,"/dissociate/").concat(t)};!function(e){e.Videos="videos"}(gr||(gr={}));var Nr=function(e){function t(){return yr(this,t),Sr(this,Er(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&hr(e,t)}(t,e),n=t,(r=[{key:"getPlaylist",value:function(e,t,n){return this.get({resource:Or(e),eventPrefix:"".concat(a.PLAYLIST,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getPlaylistsById",value:function(e,t,n){return this.get({resource:jr(e),eventPrefix:"".concat(a.PLAYLISTS,":").concat(e.join(",")),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPlaylist",value:function(e,t,n,r){return this.create({resource:Tr(t),data:Object.assign(Object.assign({},e),{permissions:Re()}),callback:n,errorCallback:r,eventPrefix:a.PLAYLIST,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created playlist."),errorHandler:this.alertService.error("Failed to create playlist.")})}},{key:"updatePlaylist",value:function(e,t,n,r){return this.update({resource:Cr(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PLAYLIST,":").concat(e),invalidationKeys:["".concat(a.PLAYLIST,":").concat(e),a.PLAYLISTS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated playlist"),errorHandler:this.alertService.error("Failed to update playlist")})}},{key:"deletePlaylist",value:function(e,t,n){return this.delete({resource:Ir(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_PLAYLIST,invalidationKeys:["".concat(a.PLAYLIST,":").concat(e)],successHandler:this.alertService.success("Successfully deleted playlist"),errorHandler:this.alertService.error("Failed to delete playlist.")})}},{key:"getPlaylistVideos",value:function(e,t,n){return this.get({resource:Ar(e,gr.Videos,"{orderBy:orderindex,limit:100}"),callback:t,errorCallback:n,eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(gr.Videos),expiryTime:m.CacheDurations.STANDARD})}},{key:"reorderVideos",value:function(e,t,n){return this.update({resource:Pr(e),data:Object.assign({ownerId:e},t),eventPrefix:a.REORDER_PLAYLIST_VIDEOS,expiryTime:m.CacheDurations.STANDARD,invalidationKeys:["".concat(a.PLAYLIST,":").concat(e,":videos")],callback:n,errorHandler:this.alertService.error("Failed to update playlist order.")})}},{key:"removeVideoFromPlaylist",value:function(e,t,n,r){return this.delete({resource:Lr(e,t),eventPrefix:"".concat(a.REMOVE_PLAYLIST_VIDEO,":").concat(e,":").concat(t),invalidationKeys:["".concat(a.PLAYLIST,":").concat(e,":videos")],callback:n,errorCallback:r})}},{key:"name",get:function(){return l.PLAYLIST}},{key:"channelName",get:function(){return u.PLAYLIST}}])&&vr(n.prototype,r),i&&vr(n,i),t}(f.BaseDataService),kr={dataServiceName:l.PLAYLIST,dataChannelName:u.PLAYLIST},wr={getPlaylistFetchOptions:function(e,t,n){return Object.assign(Object.assign({},kr),{eventPrefix:"".concat(a.PLAYLIST,":").concat(e),fetchData:function(t){return t.getPlaylist(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_PLAYLIST})},getPlaylistsByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},kr),{eventPrefix:"".concat(a.PLAYLISTS,":").concat(e.join(",")),fetchData:function(t){return t.getPlaylistsById(e)},setData:t,onError:n})},getPlaylistVideosFetchOptions:function(e,t,n){return Object.assign(Object.assign({},kr),{eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(gr.Videos),fetchData:function(t){return t.getPlaylistVideos(e)},setData:t,onError:n})}};function Dr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Fr(e){var t=e.imageType,n=e.closePopup,r=p.useContext(qe),i=r.getDataUrl,a=r.setImage,o=Dr(p.useState(i()),1)[0],c=Dr(p.useState(!1),2),s=c[0],u=c[1],d=Object(f.useService)(l.IMAGE_UPLOAD),b=function(e){a(e),n()},y={dataUrl:o,imageType:t,minWidth:m.ImageMinDimensions[t].width,minHeight:m.ImageMinDimensions[t].height,onCrop:function(e){return d.uploadBase64Image(e,t,b,n)},onCancel:n};return p.createElement(m.Popup,{title:"Crop Image",closePopup:n,onEntered:function(){return u(!0)}},s&&p.createElement(ct,Object.assign({},y)))}var _r=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Ke,null,t))};function Rr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function xr(e){var t=e.playlistId,n=e.closePopup,r=Rr(p.useState(),2),a=r[0],o=r[1],c=Rr(p.useState(!1),2),u=c[0],d=c[1],b=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)(wr.getPlaylistFetchOptions(t,o),[t]);var y=p.useCallback((function(){n(),f.Core.AppLinkHelper.trigger({application:s.PLAYLISTS,action:i.Playlists.PLAYLISTS})}),[]),v=p.useCallback((function(){d(!0),b.deletePlaylist(t,y,n)}),[t]),S=[{variant:"link",onClick:n,buttonText:"Cancel"},{variant:"danger",onClick:v,buttonText:"Yes, delete playlist",isSpinnerButton:!0,showSpinner:u}],E=!!a;return p.createElement(m.Popup,{title:"Delete Playlist",closePopup:n,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?"),p.createElement("p",null,"Please ensure it is not being used in any widgets.")),p.createElement(m.PopupButtons,{buttons:S})))}var Ur=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Ee.string().trim().max(65535,"Description is too long").default(""),cover:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown(),banner:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown()}).noUnknown(),Vr=function(e,t,n,r){if(f.FunctionHelper.isFunction(r)){if(t!==n){var i=f.ArrayHelper.moveItem(e,t,n),a=n<e.length-1?i[n+1].id:null;r(i,{sourceMemberId:i[n].id,destinationMemberId:a})}}else f.Core.ErrorHelper.throw(new f.DevError("A callback function must be passed to onSort"))},Br=function(e,t){var n=s.PLAYLISTS,r=i.Playlists,a=[{label:"Edit Playlist Details",appLink:{application:n,action:r.EDIT_PLAYLIST,args:[t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_PLAYLIST_VIDEOS,args:[t]}}];return xe(e)&&a.push.apply(a,[{label:"Subjects",appLink:{application:n,action:r.EDIT_PLAYLIST_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_PLAYLIST_AUDIENCES,args:[t]}}]),a};function Jr(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this playlist",autoFocus:!0}),p.createElement(m.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this playlist here"}),p.createElement(tt,{imageType:m.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.PLAYLISTS,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement(tt,{imageType:m.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.PLAYLISTS,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between align-items-center"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(m.Actions,{actions:e.actions})))}function Mr(e){var t,n=e.playlist&&e.playlist.id;return p.createElement(m.FormWrapper,{initialValues:e.playlist,validationSchema:Ur,onSubmit:e.savePlaylist},p.createElement(Jr,{id:n,actions:!!n&&(t=n,[{label:"Delete playlist",appLink:{application:s.PLAYLISTS,action:i.Playlists.DELETE_PLAYLIST,args:[t]},className:"text-danger"}])}))}var Hr,Yr,qr,Kr,zr=function(e){return function(t){return t.appLink.action===e}};function Wr(e){var t=e.playlistId,n=e.activeAction,r=p.useContext(Ge);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(dt,{tabs:Br(r,t),isItemActive:zr(n)}))}function Gr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Zr(e){var t=e.playlistId,n=Gr(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)(wr.getPlaylistFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(Wr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST}),!!r&&p.createElement(Mr,{playlist:r,savePlaylist:function(e,n){return o.updatePlaylist(t,e,n,n)}}))}!function(e){e[e.Subject=0]="Subject",e[e.Classification=1]="Classification"}(Hr||(Hr={})),function(e){e.Playlists="playlists",e.Series="series",e.Videos="videos"}(Yr||(Yr={})),function(e){e.Root="0"}(qr||(qr={})),function(e){e.Root="root"}(Kr||(Kr={}));var Qr=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),levelIds:Ee.array().of(Ee.string()).required("A level is required").default([])}).noUnknown(),Xr=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentIds:Ee.array().of(Ee.string()).default([Kr.Root]),subjectIds:Ee.array().of(Ee.string()).min(1,"A classification must be mapped to at least one subject").required("A classification must be mapped to at least one subject").default([]),type:Ee.mixed().required("Type is required").default(m.ClassificationType.Subject),emphasize:Ee.boolean().default(!1),cover:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown(),banner:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown()}).noUnknown(),$r=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),ei=Ee.object().shape({name:Ee.string().max(255,"Name is too long").required("Name is required"),description:Ee.string().max(65535,"Description is too long").required("Description is required")}),ti=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentId:Ee.string().default(qr.Root)}).noUnknown(),ni={singularizeMemberType:function(e){switch(e){case Yr.Playlists:return"playlist";case Yr.Series:return"series";case Yr.Videos:return"video"}},getMemberAppLink:function(e,t){var n=[t];switch(e){case Yr.Playlists:return{application:s.PLAYLISTS,action:i.Playlists.EDIT_PLAYLIST,args:n};case Yr.Series:return{application:s.SERIES,action:i.Series.EDIT_SERIES,args:n};case Yr.Videos:return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:n}}},getMemberActions:function(e,t,n,r){return[{label:"Remove ".concat(ni.singularizeMemberType(n)),appLink:{application:s.SUBJECTS,action:t===Hr.Subject?i.Subjects.REMOVE_SUBJECT_MEMBER:i.Subjects.REMOVE_CLASSIFICATION_MEMBER,args:[e,r,n]},className:"text-danger"}]}},ri=function(){var e=s.SUBJECTS,t=i.Subjects;return[{label:"Classifications",appLink:{application:e,action:t.CLASSIFICATIONS},activeActions:[t.CLASSIFICATIONS,t.PRESENTATION_CLASSIFICATIONS,t.NEW_CLASSIFICATION,t.EDIT_CLASSIFICATION,t.EDIT_CLASSIFICATION_PLAYLISTS,t.EDIT_CLASSIFICATION_SERIES,t.EDIT_CLASSIFICATION_VIDEOS,t.DELETE_CLASSIFICATION,t.REMOVE_CLASSIFICATION_MEMBER]},{label:"Subjects",appLink:{application:e,action:t.SUBJECTS},activeActions:[t.SUBJECTS,t.NEW_SUBJECT,t.EDIT_SUBJECT,t.EDIT_SUBJECT_PLAYLISTS,t.EDIT_SUBJECT_SERIES,t.EDIT_SUBJECT_VIDEOS,t.SUBJECT_CLASSIFICATIONS,t.DELETE_SUBJECT,t.ADD_SUBJECT_MEMBERS,t.REMOVE_SUBJECT_MEMBER]},{label:"Audiences",appLink:{application:e,action:t.AUDIENCES},activeActions:[t.AUDIENCES,t.PRESENTATION_AUDIENCES,t.NEW_AUDIENCE,t.EDIT_AUDIENCE]},{label:"Levels",appLink:{application:e,action:t.LEVELS},activeActions:[t.LEVELS,t.NEW_LEVEL,t.EDIT_LEVEL]},{label:"Presentations",appLink:{application:e,action:t.PRESENTATIONS},activeActions:[t.PRESENTATIONS,t.NEW_PRESENTATION,t.EDIT_PRESENTATION]}]},ii=function(e){var t=s.SUBJECTS,n=i.Subjects;return[{label:"Edit Subject Details",appLink:{application:t,action:n.EDIT_SUBJECT,args:[e]}},{label:"Classifications",appLink:{application:t,action:n.SUBJECT_CLASSIFICATIONS,args:[e]}},{label:"Playlists",appLink:{application:t,action:n.EDIT_SUBJECT_PLAYLISTS,args:[e]}},{label:"Series",appLink:{application:t,action:n.EDIT_SUBJECT_SERIES,args:[e]}},{label:"Videos",appLink:{application:t,action:n.EDIT_SUBJECT_VIDEOS,args:[e]}}]},ai=function(e,t){var n=s.SUBJECTS,r=i.Subjects;return[{label:"Edit Classification Details",appLink:{application:n,action:r.EDIT_CLASSIFICATION,args:[e,t]}},{label:"Playlists",appLink:{application:n,action:r.EDIT_CLASSIFICATION_PLAYLISTS,args:[e,t]}},{label:"Series",appLink:{application:n,action:r.EDIT_CLASSIFICATION_SERIES,args:[e,t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_CLASSIFICATION_VIDEOS,args:[e,t]}}]};function oi(e){return(oi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ci(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function si(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ui(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function li(e,t){return!t||"object"!==oi(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pi(e){return(pi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fi(e,t){return(fi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var mi=function(){return"/api/subjects/v1/subjects/tree"},di=function(e){return"/api/subjects/v1/subjects/".concat(e)},bi=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/").concat(t,"?query={limit:100}")},yi=function(e,t,n){var r="/api/subjects/v1/subjects/".concat(e,"/classifications"),i=[];return t&&i.push("presentationId=".concat(t)),n&&i.push("query=".concat(n,"{limit:100}")),i.length?"".concat(r,"?").concat(i.join("&")):r},vi=function(){return"/api/subjects/v1/subjects"},Si=function(e){return"/api/subjects/v1/subjects/".concat(e)},Ei=function(e){return"/api/subjects/v1/subjects/".concat(e)},hi=function(e){return"/api/subjects/v1/objects/".concat(e,"/subjects")},gi=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/subjects?addToClassifications=").concat(!!t)},Oi=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?addToClassifications=").concat(!!t)},ji=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Ti=function(){return"/api/subjects/v1/presentations"},Ci=function(e){return"/api/subjects/v1/presentations/".concat(e)},Ii=function(){return"/api/subjects/v1/presentations"},Ai=function(e){return"/api/subjects/v1/presentations/".concat(e)},Pi=function(e){return"/api/subjects/v1/presentations/".concat(e,"/classifications/tree")},Li=function(e){return"/api/subjects/v1/classifications/".concat(e,"?query=cover,banner")},Ni=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/").concat(t,"?query={limit:100}")},ki=function(){return"/api/subjects/v1/classifications"},wi=function(e){return"/api/subjects/v1/classifications/".concat(e)},Di=function(e){return"/api/subjects/v1/classifications/".concat(e)},Fi=function(e){return"/api/subjects/v1/objects/".concat(e,"/classifications")},_i=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/classifications?presentationId=").concat(t)},Ri=function(e){return"/api/subjects/v1/classifications/".concat(e,"/objects")},xi=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Ui=function(){return"/api/subjects/v1/levels"},Vi=function(e){return"/api/subjects/v1/levels/".concat(e)},Bi=function(){return"/api/subjects/v1/levels"},Ji=function(e){return"/api/subjects/v1/levels/".concat(e)},Mi=function(e){return"/api/subjects/v1/objects/".concat(e,"/levels")},Hi=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/levels?addToAudiences=").concat(!!t)},Yi=function(e){return"/api/subjects/v1/presentations/".concat(e,"/audiences")},qi=function(e){return"/api/subjects/v1/audiences/".concat(e)},Ki=function(){return"/api/subjects/v1/audiences"},zi=function(e){return"/api/subjects/v1/audiences/".concat(e)},Wi=function(e){return"/api/subjects/v1/audiences/".concat(e)},Gi=function(e){return"/api/subjects/v1/objects/".concat(e,"/audiences")},Zi=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/audiences?presentationId=").concat(t)},Qi=function(e,t,n){var r="".concat(a.SUBJECT,":").concat(e);return t&&(r+=":".concat(t)),r+=":".concat(a.CLASSIFICATIONS),n&&(r+=":".concat(n)),r},Xi=function(e){function t(){return si(this,t),li(this,pi(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fi(e,t)}(t,e),n=t,(r=[{key:"getPresentations",value:function(e,t){return this.get({resource:Ti(),eventPrefix:a.PRESENTATIONS,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getPresentation",value:function(e,t,n){return this.get({resource:Ci(e),eventPrefix:"".concat(a.PRESENTATION,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPresentation",value:function(e,t,n){return this.create({resource:Ii(),data:e,callback:t,errorCallback:n,eventPrefix:a.PRESENTATION,invalidationKeys:[a.PRESENTATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created presentation."),errorHandler:this.alertService.error("Failed to create presentation.")})}},{key:"updatePresentation",value:function(e,t,n,r){return this.update({resource:Ai(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PRESENTATION,":").concat(e),invalidationKeys:["".concat(a.PRESENTATION,":").concat(e),a.PRESENTATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated presentation."),errorHandler:this.alertService.error("Failed to update presentation.")})}},{key:"getSubjectTree",value:function(e,t){return this.get({resource:mi(),formatData:function(e){return{children:e,name:qr.Root,id:null}},eventPrefix:a.SUBJECTS,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getSubject",value:function(e,t,n){return this.get({resource:di(e),eventPrefix:"".concat(a.SUBJECT,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSubjectMemberIds",value:function(e,t,n,r){return this.get({resource:bi(e,t),eventPrefix:"".concat(a.SUBJECT,":").concat(e,":").concat(t),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"getSubjectClassifications",value:function(e,t,n,r,i){return this.get({resource:yi(e,t,n),eventPrefix:Qi(e,t,n),expiryTime:m.CacheDurations.STANDARD,callback:r,errorCallback:i})}},{key:"createSubject",value:function(e,t,n){return this.create({resource:vi(),data:e,callback:t,errorCallback:n,eventPrefix:a.SUBJECT,invalidationKeys:[a.SUBJECTS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created subject."),errorHandler:this.alertService.error("Failed to create subject.")})}},{key:"updateSubject",value:function(e,t,n,r){return this.update({resource:Si(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_SUBJECT,":").concat(e),invalidationKeys:["".concat(a.SUBJECT,":").concat(e),a.SUBJECTS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated subject."),errorHandler:this.alertService.error("Failed to save subject.")})}},{key:"deleteSubject",value:function(e,t,n){return this.delete({resource:Ei(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_SUBJECT,invalidationKeys:["".concat(a.SUBJECT,":").concat(e),a.SUBJECTS],successHandler:this.alertService.success("Successfully deleted subject"),errorHandler:this.alertService.error("Failed to delete subject")})}},{key:"getObjectSubjects",value:function(e,t,n,r){return this.get({resource:hi(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.SUBJECTS),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectSubjects",value:function(e,t,n,r,i,o){var c=ni.singularizeMemberType(n),s=["".concat(n,":").concat(e,":").concat(a.SUBJECTS)];return r&&s.push("".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)),s.push.apply(s,ci(t.map((function(e){return"".concat(a.SUBJECTS,":").concat(e,":").concat(n)})))),this.update({resource:gi(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_SUBJECTS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," subjects.")),errorHandler:this.alertService.error("Failed to update ".concat(c," subjects."))})}},{key:"addObjectsToSubject",value:function(e,t,n,r,i,o){var c=1===t.length?ni.singularizeMemberType(n):n,s=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(ci(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))),ci(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)}))));return this.create({resource:Oi(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.ADD_TO_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:s,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(c," to subject.")),errorHandler:this.alertService.error("Failed to add ".concat(c," to subject."))})}},{key:"removeObjectsFromSubject",value:function(e,t,n,r,i){var o=1===t.length?ni.singularizeMemberType(n):n,c=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(ci(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))));return this.delete({resource:ji(e,t),callback:r,errorCallback:i,eventPrefix:"".concat(a.REMOVE_FROM_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:c,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(o," from subject.")),errorHandler:this.alertService.error("Failed to remove ".concat(o," from subject."))})}},{key:"getClassificationTree",value:function(e,t,n){return this.get({resource:Pi(e),formatData:function(e){return{children:e,name:Kr.Root,id:null}},eventPrefix:"".concat(a.CLASSIFICATIONS,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassification",value:function(e,t,n){return this.get({resource:Li(e),eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassificationMembers",value:function(e,t,n,r){return this.get({resource:Ni(e,t),eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e,":").concat(t),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"createClassification",value:function(e,t,n){return this.create({resource:ki(),data:e,callback:t,errorCallback:n,eventPrefix:a.CLASSIFICATION,invalidationKeys:[a.CLASSIFICATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created classification."),errorHandler:this.alertService.error("Failed to create classification.")})}},{key:"updateClassification",value:function(e,t,n,r){return this.update({resource:wi(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_CLASSIFICATION,":").concat(e),invalidationKeys:["".concat(a.CLASSIFICATION,":").concat(e),a.CLASSIFICATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated classification."),errorHandler:this.alertService.error("Failed to save classification.")})}},{key:"deleteClassification",value:function(e,t,n){return this.delete({resource:Di(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_CLASSIFICATION,invalidationKeys:["".concat(a.CLASSIFICATION,":").concat(e),a.CLASSIFICATIONS],successHandler:this.alertService.success("Successfully deleted classification"),errorHandler:this.alertService.error("Failed to delete classification")})}},{key:"getObjectClassifications",value:function(e,t,n,r){return this.get({resource:Fi(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.CLASSIFICATIONS),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectClassifications",value:function(e,t,n,r,i,o){var c=ni.singularizeMemberType(r),s=["".concat(r,":").concat(e,":").concat(a.CLASSIFICATIONS)];return s.push.apply(s,ci(n.map((function(e){return"".concat(a.CLASSIFICATION,":").concat(e,":").concat(r)})))),this.update({resource:_i(e,t),data:n,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_CLASSIFICATIONS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," classifications.")),errorHandler:this.alertService.error("Failed to update ".concat(c," classifications."))})}},{key:"addObjectsToClassification",value:function(e,t,n,r,i,o,c){var s=1===t.length?ni.singularizeMemberType(n):n,u=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&u.push(Qi(r,i,n)),u.push.apply(u,ci(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.create({resource:Ri(e),data:t,callback:o,errorCallback:c,eventPrefix:"".concat(a.ADD_TO_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:u,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(s," to classification.")),errorHandler:this.alertService.error("Failed to add ".concat(s," to classification."))})}},{key:"removeObjectsFromClassification",value:function(e,t,n,r,i,o,c){var s=1===t.length?ni.singularizeMemberType(n):n,u=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&u.push(Qi(r,i,n)),u.push.apply(u,ci(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.delete({resource:xi(e,t),callback:o,errorCallback:c,eventPrefix:"".concat(a.REMOVE_FROM_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:u,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(s," from classification.")),errorHandler:this.alertService.error("Failed to remove ".concat(s," from classification."))})}},{key:"getLevels",value:function(e,t){return this.get({resource:Ui(),eventPrefix:a.LEVELS,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getLevel",value:function(e,t,n){return this.get({resource:Vi(e),eventPrefix:"".concat(a.LEVEL,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createLevel",value:function(e,t,n){return this.create({resource:Bi(),data:e,callback:t,errorCallback:n,eventPrefix:a.LEVEL,invalidationKeys:[a.LEVELS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created level."),errorHandler:this.alertService.error("Failed to create level.")})}},{key:"updateLevel",value:function(e,t,n,r){return this.update({resource:Ji(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_LEVEL,":").concat(e),invalidationKeys:["".concat(a.LEVEL,":").concat(e),a.LEVELS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated level."),errorHandler:this.alertService.error("Failed to save level.")})}},{key:"getObjectLevels",value:function(e,t,n,r){return this.get({resource:Mi(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.LEVELS),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectLevels",value:function(e,t,n,r,i,o){var c=ni.singularizeMemberType(n),s=["".concat(n,":").concat(e,":").concat(a.LEVELS)];return r&&s.push("".concat(n,":").concat(e,":").concat(a.AUDIENCES)),this.update({resource:Hi(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_LEVELS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," levels.")),errorHandler:this.alertService.error("Failed to update ".concat(c," levels."))})}},{key:"getAudiences",value:function(e,t,n){return this.get({resource:Yi(e),callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCES,":").concat(e),expiryTime:m.CacheDurations.STANDARD})}},{key:"getAudience",value:function(e,t,n){return this.get({resource:qi(e),callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCE,":").concat(e),expiryTime:m.CacheDurations.STANDARD})}},{key:"createAudience",value:function(e,t,n){return this.create({resource:Ki(),data:e,callback:t,errorCallback:n,eventPrefix:a.AUDIENCE,invalidationKeys:[a.AUDIENCES],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created audience."),errorHandler:this.alertService.error("Failed to create audience.")})}},{key:"updateAudience",value:function(e,t,n,r){return this.update({resource:zi(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_AUDIENCE,":").concat(e),invalidationKeys:["".concat(a.AUDIENCE,":").concat(e),a.AUDIENCES],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated audience."),errorHandler:this.alertService.error("Failed to update audience.")})}},{key:"deleteAudience",value:function(e,t,n){return this.delete({resource:Wi(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_AUDIENCE,invalidationKeys:["".concat(a.AUDIENCE,":").concat(e),a.AUDIENCES],successHandler:this.alertService.success("Successfully deleted audience"),errorHandler:this.alertService.error("Failed to delete audience")})}},{key:"getObjectAudiences",value:function(e,t,n,r){return this.get({resource:Gi(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectAudiences",value:function(e,t,n,r,i,o){var c=ni.singularizeMemberType(r);return this.update({resource:Zi(e,t),data:n,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_AUDIENCES,":").concat(e),invalidationKeys:["".concat(r,":").concat(e,":").concat(a.AUDIENCES)],successHandler:this.alertService.success("Successfully updated ".concat(c," audiences.")),errorHandler:this.alertService.error("Failed to update ".concat(c," audiences."))})}},{key:"name",get:function(){return l.SUBJECT}},{key:"channelName",get:function(){return u.SUBJECT}}])&&ui(n.prototype,r),i&&ui(n,i),t}(f.BaseDataService),$i={dataServiceName:l.SUBJECT,dataChannelName:u.SUBJECT},ea={getSubjectTreeFetchOptions:function(e,t){return Object.assign(Object.assign({},$i),{eventPrefix:a.SUBJECTS,fetchData:function(e){return e.getSubjectTree()},setData:e,onError:t})},getSubjectFetchOptions:function(e,t,n){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(a.SUBJECT,":").concat(e),fetchData:function(t){return t.getSubject(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_SUBJECT})},getSubjectMemberIdsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(a.SUBJECT,":").concat(e,":").concat(t),fetchData:function(n){return n.getSubjectMemberIds(e,t)},setData:n,onError:r})},getSubjectClassificationFetchOptions:function(e,t,n,r,i){return Object.assign(Object.assign({},$i),{eventPrefix:Qi(e,n,r),fetchData:function(t){return t.getSubjectClassifications(e,n,r)},setData:t,onError:i})},getObjectSubjectsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.SUBJECTS),fetchData:function(n){return n.getObjectSubjects(e,t)},setData:n,onError:r})},getPresentationsFetchOptions:function(e,t){return Object.assign(Object.assign({},$i),{eventPrefix:a.PRESENTATIONS,fetchData:function(e){return e.getPresentations()},setData:e,onError:t})},getPresentationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(a.PRESENTATION,":").concat(e),fetchData:function(t){return t.getPresentation(e)},setData:t,onError:n})},getClassificationTreeFetchOptions:function(e,t,n){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(a.CLASSIFICATIONS,":").concat(e),fetchData:function(t){return t.getClassificationTree(e)},setData:t,onError:n})},getClassificationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e),fetchData:function(t){return t.getClassification(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_CLASSIFICATION})},getClassificationMembersFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e,":").concat(t),fetchData:function(n){return n.getClassificationMembers(e,t)},setData:n,onError:r})},getObjectClassificationsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.CLASSIFICATIONS),fetchData:function(n){return n.getObjectClassifications(e,t)},setData:n,onError:r})},getLevelsFetchOptions:function(e,t){return Object.assign(Object.assign({},$i),{eventPrefix:a.LEVELS,fetchData:function(e){return e.getLevels()},setData:e,onError:t})},getLevelFetchOptions:function(e,t,n){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(a.LEVEL,":").concat(e),fetchData:function(t){return t.getLevel(e)},setData:t,onError:n})},getObjectLevelsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.LEVELS),fetchData:function(n){return n.getObjectLevels(e,t)},setData:n,onError:r})},getAudiencesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(a.AUDIENCES,":").concat(e),fetchData:function(t){return t.getAudiences(e)},setData:t,onError:n})},getAudienceFetchOptions:function(e,t,n){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(a.AUDIENCE,":").concat(e),fetchData:function(t){return t.getAudience(e)},setData:t,onError:n})},getObjectAudiencesFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},$i),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),fetchData:function(n){return n.getObjectAudiences(e,t)},setData:n,onError:r})}},ta=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},na=function(e,t){var n=e.levelIds;return t.filter((function(e){return n.includes(e.id)}))};function ra(e){var t=e.showLevels;return p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,"Audiences"),!!t&&p.createElement("th",null,"Mapped Level(s)")))}function ia(e){var t,n=e.audience,r=e.levels;return p.createElement("tr",null,p.createElement("td",null,p.createElement(m.AppLink,{appLink:(t=n,{application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[t.presentationId,t.masterId]})},n.name)),p.createElement("td",null,r.map((function(e){return p.createElement(m.AppLink,{key:e.id,appLink:ta(e),className:"mr-2"},e.name)}))))}function aa(e){var t=e.audiences,n=e.levels;return p.createElement(Ae.Table,{responsive:!0,bordered:!0},p.createElement(ra,{showLevels:!!t.length}),p.createElement("tbody",null,t.length?t.map((function(e){return p.createElement(ia,{key:e.masterId,audience:e,levels:na(e,n)})})):p.createElement("tr",null,p.createElement("td",null,"This presentation has no audiences."))))}function oa(e){var t=null===e.masterId||void 0===e.masterId,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this audience",autoFocus:!0}),p.createElement(m.FormField,{label:"Mapped Level(s)",as:"select",name:"levelIds",id:"level-ids",multiple:!0,size:e.levels.length,value:n.values.levelIds},e.levels.map((function(e){return p.createElement("option",{key:e.id,value:e.id},e.name)}))),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_AUDIENCE,args:[e.presentationId,e.masterId]}},"Delete")))}function ca(e){return p.createElement(m.FormWrapper,{initialValues:e.audience,validationSchema:Qr,onSubmit:e.saveAudience},p.createElement(oa,{masterId:e.audience&&e.audience.masterId,presentationId:e.presentationId,levels:e.levels}))}function sa(e){var t=e.objectAudiences,n=e.presentationAudiences;return t.filter((function(e){return n.some((function(t){return t.masterId===e.masterId}))}))}function ua(e){var t,n,r,i,a,o=ni.singularizeMemberType(e.memberType),c=(n=(t=e).presentationAudiences,r=t.objectLevels,i=t.objectAudiences,a=r.map((function(e){return e.id})),n.filter((function(e){return f.ArrayHelper.intersection(e.levelIds,a).length||i.some((function(t){return t.masterId===e.masterId}))})));return p.createElement(p.Fragment,null,p.createElement("div",{className:"border-bottom pb-3 mb-3"},p.createElement("h6",null,"Levels"),p.createElement("p",null,"Select which levels this ".concat(o," is mapped to.")),p.createElement("p",null,"To see how levels correspond to audiences, scroll down to the audience-level mappings table."),p.createElement(Aa,{initialValues:{levelIds:e.objectLevels.map((function(e){return e.id})),addToAudiences:!0},saveLevels:e.saveLevels,levels:e.levels,memberType:e.memberType})),p.createElement("h6",null,"Audiences"),p.createElement("p",null,"Select a presentation to view its audiences and map them to this ".concat(o,".")),p.createElement("div",{className:"w-50 pb-3"},p.createElement(Na,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),p.createElement("p",null,"Audience to level mappings for this presentation are displayed below."),p.createElement(aa,{levels:e.levels,audiences:e.presentationAudiences}),p.createElement("p",null,"Only the audiences which are mapped to a level that this"+" ".concat(o," is mapped to are displayed below.")),!!c.length&&p.createElement(pa,{initialValues:{audienceIds:sa(e).map((function(e){return e.masterId}))},saveAudiences:e.saveAudiences,audiences:c}))}function la(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Audience(s)",as:"select",name:"audienceIds",id:"audience-ids",multiple:!0,size:e.audiences.length,value:t.values.audienceIds},e.audiences.map((function(e){return p.createElement("option",{key:e.masterId,value:e.masterId},e.name)}))),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Audiences")))}function pa(e){return p.createElement(m.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.audienceIds;return e.saveAudiences(r,n)},enableReinitialize:!0},p.createElement(la,{audiences:e.audiences}))}function fa(e){var t=e.item,n=e.getItemAppLink,r=e.actions,i=e.pinState;return p.createElement("tr",null,p.createElement("td",null,p.createElement(m.AppLink,{appLink:n(t)},t.name)),i.isPinnable&&p.createElement("td",null,p.createElement(Ne,{selected:parseInt(t.id)===parseInt(i.currentPinnedVideo),onToggle:function(e){return i.onChange(e,t.id)},id:t.id})),r&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(m.Actions,{actions:r}))))}function ma(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function da(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ba(e){var t=e.items,n=e.memberType,r=e.classification,i=e.getItemAppLink,a=e.getActions,o=e.updatePinnedVideo,c=da(p.useState(!1),2),s=c[0],u=c[1],l=function(e,t){var n=e.pinnedVideoMasterId||null,r=ma(p.useState(n),2),i=r[0],a=r[1];return{currentPinnedVideo:i,onChange:function(e,t){a(e?t:null)},canSubmit:n!==i,isPinnable:t===Yr.Videos}}(r,n);if(!t.length)return p.createElement("div",{className:"py-5"},"No ".concat(n," in this classification."));var d="".concat(Be(ni.singularizeMemberType(n))," Name");return p.createElement(p.Fragment,null,p.createElement(Ae.Table,{responsive:!0},p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,d),l.isPinnable&&p.createElement("th",null,"Pinned"),f.FunctionHelper.isFunction(a)&&p.createElement("th",null))),p.createElement("tbody",null,t.map((function(e){return p.createElement(fa,{item:e,key:e.id,getItemAppLink:i,actions:f.FunctionHelper.isFunction(a)&&a(e),pinState:l})})))),l.isPinnable&&p.createElement(m.SpinnerButton,{showSpinner:s,onClick:function(){u(!0),o(l.currentPinnedVideo,(function(){return u(!1)}))},disabled:!l.canSubmit||s},"Save"))}function ya(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var va=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}};function Sa(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t),r=null===e.id||void 0===e.id,a=!r||!(!t.values.parentIds||!t.values.parentIds.length),o=ya(p.useState(a),2),c=o[0],u=o[1];p.useEffect((function(){return u(a)}),[e.id,t.values.parentIds]),p.useEffect((function(){t.values.subjectIds.length&&!t.touched.subjectIds&&t.setFieldTouched("subjectIds",!0)}),[t.values.subjectIds]);var l=function(e){return t.setFieldValue("parentIds",f.ArrayHelper.addOrRemove(t.values.parentIds.map((function(e){return e.toString()})),e.id.toString()))},d=function(e){return t.setFieldValue("subjectIds",f.ArrayHelper.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),e.id.toString()))},b=function(e){return"".concat(m.FormHelper.getCustomFormControlClassName(t.errors,t.touched,e)," h-auto py-2")};return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this classification",autoFocus:!0}),p.createElement(m.FormField,{as:"select",label:"Type",name:"type",id:"type",value:t.values.type},f.ObjectHelper.getEnumKeys(m.ClassificationType).map((function(e){return p.createElement("option",{key:e,value:m.ClassificationType[e]},e)}))),p.createElement(m.FormField,{label:"Emphasize",name:"emphasize",id:"emphasize",type:"checkbox",checked:t.values.emphasize}),p.createElement(m.FormField,{name:"parentIds"},(function(){return p.createElement("div",{className:b("parentIds")},p.createElement(Ct,{label:"Parent Classification(s)",tree:e.classificationTree,selectedIds:t.values.parentIds,onSelect:l,collapse:c,noSelectionMessage:"No parent selected, this will be a root classification.",isNodeDisabled:(n=e.classificationTree,r=e.id,function(e){if(e.id===r)return!0;var t=Me.find(n,r);return!!Me.find(t,e.id)})}));var n,r})),p.createElement(m.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:b("subjectIds")},p.createElement(Ct,{label:"Mapped Subject(s)",tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:d,collapse:!r,getSelectedItemAppLink:va}))})),p.createElement(tt,{imageType:m.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.SUBJECTS,uploadAction:i.Subjects.UPLOAD_IMAGE}),p.createElement(tt,{imageType:m.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.SUBJECTS,uploadAction:i.Subjects.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},r?"Create":"Save"),!r&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e.presentationId,e.id]}},"Delete")))}function Ea(e){return p.createElement(m.FormWrapper,{initialValues:e.classification,validationSchema:Xr,onSubmit:e.saveClassification},p.createElement(Sa,{id:e.classification&&e.classification.id,presentationId:e.presentationId,classificationTree:e.classificationTree,subjectTree:e.subjectTree}))}var ha=function(e){return function(t){if(!e)return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION;switch(e){case Yr.Playlists:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;case Yr.Series:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_SERIES;case Yr.Videos:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_VIDEOS}}};function ga(e){var t=e.presentation,n=e.classificationId,r=e.memberType;return t?p.createElement(p.Fragment,null,p.createElement("h6",null,"Presentation: ".concat(!!t&&t.name)),p.createElement("div",{className:"py-2"},p.createElement(dt,{tabs:ai(t.id,n),isItemActive:ha(r)}))):p.createElement(p.Fragment,null)}function Oa(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t),r=function(e){return t.setFieldValue("classificationIds",f.ArrayHelper.addOrRemove(t.values.classificationIds.map((function(e){return e.toString()})),e.id.toString()))},a="".concat(m.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"classificationIds")," h-auto py-2");return p.createElement(ge.Form,null,p.createElement(m.FormField,{name:"classificationIds"},(function(){return p.createElement("div",{className:a},p.createElement(Ct,{label:"Mapped Classification(s)",tree:e.classificationTree,selectedIds:t.values.classificationIds,onSelect:r,getSelectedItemAppLink:(n=e.presentationId,function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[n,e]}}),isNodeDisabled:e.isClassificationDisabled}));var n})),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Classifications")))}function ja(e){return p.createElement(m.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.classificationIds;return e.saveClassifications(r,n)},enableReinitialize:!0},p.createElement(Oa,{presentationId:e.presentationId,classificationTree:e.classificationTree,isClassificationDisabled:e.isClassificationDisabled}))}function Ta(e){var t=null===e.id||void 0===e.id,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this level",autoFocus:!0}),p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"))}function Ca(e){return p.createElement(m.FormWrapper,{initialValues:e.level,validationSchema:$r,onSubmit:e.saveLevel},p.createElement(Ta,{id:e.level&&e.level.id}))}function Ia(e){var t=ni.singularizeMemberType(e.memberType),n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Level(s)",as:"select",name:"levelIds",id:"level-ids",multiple:!0,size:e.levels.length,value:n.values.levelIds},e.levels.map((function(e){return p.createElement("option",{key:e.id,value:e.id},e.name)}))),p.createElement(m.FormField,{label:"Automatically add to audiences*",name:"addToAudiences",id:"add-to-audiences",type:"checkbox",checked:n.values.addToAudiences}),p.createElement("p",null,p.createElement("em",null,"*If selected, when adding a ".concat(t," to a level, all of that level's")+" audiences across all presentations will also be added to.")),p.createElement("p",null,p.createElement("strong",null,"Note:")," When removing a ".concat(t," from a level, that level's audiences "),p.createElement("strong",null,"will not")," be automatically removed from."),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},"Save Levels")))}function Aa(e){return p.createElement(m.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.levelIds,i=t.addToAudiences;return e.saveLevels(r,i,n)}},p.createElement(Ia,{levels:e.levels,memberType:e.memberType}))}function Pa(e){var t=e.values,n=t.name,r=t.description,i=e.id,a=e.isSubmitting,o=!i;return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n,placeholder:"Enter a name for this presentation",autoFocus:!0}),p.createElement(m.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:r,placeholder:"Describe this presentation here"}),p.createElement(m.SpinnerButton,{showSpinner:a,type:"submit"},o?"Create":"Save"))}function La(e){var t=e.presentation,n=(t=void 0===t?{}:t).id,r=void 0===n?null:n,i=t.name,a=void 0===i?"":i,o=t.description,c=void 0===o?"":o,s=e.savePresentation;return p.createElement(ge.Formik,{initialValues:{name:a,description:c},validationSchema:ei,onSubmit:s},(function(e){return p.createElement(Pa,Object.assign({id:r},e))}))}function Na(e){var t=e.presentations,n=e.currentPresentation,r=e.setCurrentPresentation,i=e.label,a=function(e){var n,i,a=(n=e,i=t,f.ArrayHelper.first(i.filter((function(e){return e.id.toString()===n.toString()}))));r(a)};return p.useEffect((function(){t&&!n&&r(t[0])}),[t]),p.createElement(p.Fragment,null,!!n&&p.createElement(p.Fragment,null,p.createElement(Ae.Form.Label,null,i),p.createElement(Ae.Form.Control,{as:"select",value:n.id,onChange:function(e){return a(e.target.value)},className:"cursor-pointer"},t.map((function(e){return p.createElement("option",{value:e.id,key:e.id},e.name)})))))}function ka(e){return p.createElement(p.Fragment,null,p.createElement("h4",null,"".concat(Be(e.memberType))),p.createElement(Ae.Table,{responsive:!0},p.createElement("tbody",null,e.objects&&e.objects.map((function(t){return p.createElement("tr",{key:t.id},p.createElement("td",null,p.createElement(m.AppLink,{appLink:ni.getMemberAppLink(e.memberType,t.id)},t.name)))})))),p.createElement(Ja,{initialValues:{subjectIds:[],addToClassifications:!0},subjectTree:e.subjectTree,saveSubjects:e.onClickAddToSubject,memberType:e.memberType,saveBtnText:"Add to subject",subjectRequired:!0}))}function wa(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Da(e){var t=ni.singularizeMemberType(e.memberType),n=[].concat(wa(e.objectClassifications),wa(e.objectSubjectClassifications)).map((function(e){return e.id}));return p.createElement(p.Fragment,null,p.createElement("div",{className:"border-bottom pb-3 mb-3"},p.createElement("h6",null,"Subjects"),p.createElement("p",null,"Select which subjects this ".concat(t," is mapped to.")),p.createElement(Ja,{initialValues:{subjectIds:e.objectSubjects.map((function(e){return e.id}))},subjectTree:e.subjectTree,saveSubjects:e.saveSubjects,memberType:e.memberType,saveBtnText:"Save Subjects",allowMultiple:!0})),p.createElement("h6",null,"Classifications"),p.createElement("p",null,"Select a presentation to view its classifications and map them to this ".concat(t,".")),p.createElement("div",{className:"w-50 pb-3"},p.createElement(Na,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),e.currentPresentation&&e.classificationTree&&e.classificationTree.children.length?p.createElement(p.Fragment,null,p.createElement("p",null,"Only classifications which are mapped to one of the subjects selected above can be selected."),p.createElement(ja,{initialValues:{classificationIds:e.objectClassifications.map((function(e){return e.id}))},presentationId:e.currentPresentation.id,classificationTree:e.classificationTree,saveClassifications:e.saveClassifications,isClassificationDisabled:function(e){return!n.includes(e.id)}})):p.createElement("p",null,"This presentation has no classifications."))}function Fa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}Na.defaultProps={label:"Presentation"};function _a(e){var t=!e.id,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n),a=!t||!!n.values.parentId,o=Fa(p.useState(a),2),c=o[0],u=o[1];p.useEffect((function(){return u(a)}),[e.id,n.values.parentId]);var l=function(e){var t=e.id===n.values.parentId?null:e.id;n.setFieldValue("parentId",t)},f="".concat(m.FormHelper.getCustomFormControlClassName(n.errors,n.touched,"parentId")," h-auto py-2");return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this subject",autoFocus:!0}),p.createElement(m.FormField,{name:"parentId"},(function(){return p.createElement("div",{className:f},p.createElement(Ct,{label:"Parent Subject",tree:e.subjectTree,selectedIds:[n.values.parentId],onSelect:l,collapse:c,noSelectionMessage:"No parent selected, this will be a root subject.",isNodeDisabled:(t=e.subjectTree,r=e.id,function(e){if(e.id===r)return!0;var n=Me.find(t,r);return!!Me.find(n,e.id)})}));var t,r})),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_SUBJECT,args:[e.id]}},"Delete")))}function Ra(e){return p.createElement(m.FormWrapper,{initialValues:e.subject,validationSchema:ti,onSubmit:e.saveSubject},p.createElement(_a,{id:e.subject&&e.subject.id,subjectTree:e.subjectTree}))}var xa=function(e){return function(t){return t.appLink.action===e}};function Ua(e){var t=e.subjectId,n=e.activeAction;return p.createElement(p.Fragment,null,p.createElement(Ae.Alert,{variant:"danger"},"Warning: You are editing the backbone subjects."),p.createElement("div",{className:"py-2"},p.createElement(dt,{tabs:ii(t),isItemActive:xa(n)})))}var Va=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}};function Ba(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t),r=function(n){var r=e.allowMultiple?f.ArrayHelper.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),n.id.toString()):[n.id];t.setFieldValue("subjectIds",r)},i=ni.singularizeMemberType(e.memberType),a="".concat(m.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"subjectIds")," h-auto py-2");return p.createElement(ge.Form,null,p.createElement(m.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:a},p.createElement(Ct,{label:"Mapped Subject".concat(e.allowMultiple?"(s)":""),tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:r,collapse:!!t.initialValues.subjectIds.length,getSelectedItemAppLink:Va}))})),p.createElement(m.FormField,{label:"Automatically add to classifications*",name:"addToClassifications",id:"add-to-classifications",type:"checkbox",checked:t.values.addToClassifications}),p.createElement("p",null,p.createElement("em",null,"*If selected, when adding a ".concat(i," to a subject, all of that subject's")+" mapped classifications across all presentations will also be added to.")),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.saveBtnText)))}function Ja(e){var t;return p.createElement(m.FormWrapper,{initialValues:e.initialValues,validationSchema:(t=e.subjectRequired,Ee.object().shape({subjectIds:t?Ee.array().of(Ee.string()).min(1,"A subject is required").required("A subject is required"):Ee.array().of(Ee.string()),addToClassifications:Ee.boolean().default(!0)}).noUnknown()),onSubmit:function(t,n){var r=t.subjectIds,i=t.addToClassifications;return e.saveSubjects(r,i,n)}},p.createElement(Ba,{subjectTree:e.subjectTree,memberType:e.memberType,allowMultiple:e.allowMultiple,saveBtnText:e.saveBtnText}))}Ba.defaultProps={saveBtnText:"Save"};var Ma=function(e){return p.createElement("div",{className:"border rounded p-2 mb-3"},p.createElement("h6",{className:"border-bottom pb-1"},e.presentation.name),e.classifications&&e.classifications.length?p.createElement("ul",{className:"list-unstyled mb-0"},e.classifications.map((function(t){return p.createElement("li",{key:t.id,className:"py-1"},p.createElement(m.AppLink,{appLink:(n=e.presentation.id,r=t.id,{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[n,r]})},t.name));var n,r}))):p.createElement("p",null,p.createElement("em",null,"There are no classifications mapped to this subject in this presentation.")))},Ha=function(e){return p.createElement(p.Fragment,null,!!e.presentations&&!!e.classificationDictionary&&e.presentations.map((function(t){return p.createElement(Ma,{key:t.id,presentation:t,classifications:e.classificationDictionary[t.id]})})))},Ya=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function qa(e){return p.createElement(p.Fragment,null,e.classifications.map((function(t){return p.createElement("th",{key:t.id},p.createElement("span",{className:"d-inline-block"},p.createElement(Ne,{selected:e.getIsClassificationSelected(t),onToggle:function(n){return e.onToggleClassification(t.id,n)}})),p.createElement(m.AppLink,{appLink:e.getClassificationAppLink(t.id)},function(e,t){return t?e.name:"Classification: ".concat(e.name)}(t,e.showClassificationSubHeader)))})))}function Ka(e){var t=e.memberType,n=e.hasActions,r=e.classifications,i=Ya(e,["memberType","hasActions","classifications"]),a="".concat(Be(ni.singularizeMemberType(t))," Name"),o=!!r&&!!r.length,c=o&&r.length>1,s=o?2:1,u=Object.assign({classifications:r,showClassificationSubHeader:c},i);return p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",{rowSpan:s},a),o&&(c?p.createElement("th",{colSpan:r.length,className:"text-center"},"Classifications"):p.createElement(qa,Object.assign({},u))),n&&p.createElement("th",{rowSpan:s})),o&&c&&p.createElement("tr",null,p.createElement(qa,Object.assign({},u))))}function za(e){var t=e.member,n=t.id,r=t.name,i=t.classifications,a=void 0===i?[]:i,o=e.getMemberAppLink,c=e.onToggleClassification,s=e.actions,u=f.FunctionHelper.isFunction(o)&&o(n);return a.length&&!f.FunctionHelper.isFunction(c)&&f.Core.ErrorHelper.throw(new f.DevError("onToggleClassification must be passed to SubjectMemberItem")),p.createElement("tr",null,p.createElement("td",null,u?p.createElement(m.AppLink,{appLink:o(n)},r):r),!!a.length&&a.map((function(e){return p.createElement("td",{key:e.id},p.createElement(Ne,{selected:e.selected,onToggle:function(t){return c(e.id,t,n)}}))})),s&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(m.Actions,{actions:s}))))}var Wa=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Ga(e,t){return function(n){var r=n[e],i=m.CollectionHelper.length(r);return!!i&&i===t.length}}function Za(e){var t=e.members,n=e.memberType,r=e.getActions,i=e.classifications,a=e.getClassificationAppLink,o=e.onToggleClassification,c=Wa(e,["members","memberType","getActions","classifications","getClassificationAppLink","onToggleClassification"]);if(!t.length)return p.createElement("div",{className:"py-5"},"No ".concat(n," in this subject."));var s=f.FunctionHelper.isFunction(r),u={memberType:n,classifications:i,getClassificationAppLink:a,getIsClassificationSelected:Ga(n,t),onToggleClassification:o,hasActions:s};return p.createElement(Ae.Table,{responsive:!0,bordered:!0},p.createElement(Ka,Object.assign({},u)),p.createElement("tbody",null,t.map((function(e,t){return p.createElement(za,Object.assign({key:t,member:e,actions:s&&r(e.id),onToggleClassification:o},c))}))))}function Qa(e){var t=e.navItems,n=e.currentAppLink;return p.createElement(Ae.Container,null,p.createElement(Ae.Navbar,{className:"justify-content-between align-items-center"},p.createElement(Ae.Nav,null,!!t&&t.map((function(e,t){return p.createElement(Ae.Nav.Item,{key:t},p.createElement(Ae.Nav.Link,{as:m.AppLink,appLink:e.appLink,active:_e.isItemActive(e,n),className:_e.isItemActive(e,n)?"text-primary":""},e.label))})))))}function Xa(e,t){p.useEffect((function(){e.presentations&&!e.currentPresentation&&m.StateHelper.getSetStateByKey(t,"currentPresentation")(f.ArrayHelper.first(e.presentations))}),[e.presentations])}function $a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function eo(e){var t=e.playlistId,n=$a(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([wr.getPlaylistFetchOptions(e,r("playlist")),ea.getObjectLevelsFetchOptions(e,Yr.Playlists,r("playlistLevels"))],[e]),Object(f.useFetch)(ea.getObjectAudiencesFetchOptions(e,Yr.Playlists,r("playlistAudiences")),[e,t.playlistLevels]),Object(f.useBulkFetch)([ea.getPresentationsFetchOptions(r("presentations")),ea.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&ea.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),Xa(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.playlistLevels&&r.playlistAudiences);return p.createElement(p.Fragment,null,p.createElement(Wr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_AUDIENCES}),p.createElement(ut,{object:r.playlist}),!!c&&p.createElement(ua,{objectLevels:r.playlistLevels,objectAudiences:r.playlistAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Yr.Playlists,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Yr.Playlists,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Yr.Playlists,n,n)}}))}function to(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function no(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function ro(e){var t=e.playlistId,n=to(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([ea.getSubjectTreeFetchOptions(r("subjectTree")),ea.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([wr.getPlaylistFetchOptions(e,r("playlist")),ea.getObjectSubjectsFetchOptions(e,Yr.Playlists,r("playlistSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&ea.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.playlistSubjects]);var i=function(e,t){return[].concat(no(t.subjectClassifications||[]),no(e))},a=t.playlistSubjects&&t.playlistSubjects.map((function(e){return ea.getSubjectClassificationFetchOptions(e.id,m.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.playlistSubjects],!!a),Object(f.useFetch)(ea.getObjectClassificationsFetchOptions(e,Yr.Playlists,r("playlistClassifications")),[e,t.playlistSubjects])}(t,r,a),Xa(r,a);var c=!!(r.playlistSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.playlistClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(Wr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_SUBJECTS}),p.createElement(ut,{object:r.playlist}),c&&p.createElement(Da,{objectSubjects:r.playlistSubjects,subjectTree:r.subjectTree,memberType:Yr.Playlists,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.playlistClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Yr.Playlists,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Yr.Playlists,n,n)}}))}function io(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var ao=function(e){return function(t){return[{label:"Remove video",appLink:{application:s.PLAYLISTS,action:i.Playlists.REMOVE_VIDEO,args:[e.toString(),t.id.toString()]},className:"text-danger"}]}},oo=function(e){return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:[e.id]}};function co(e){var t=e.playlistId,n=io(p.useState(),2),r=n[0],a=n[1],o=io(p.useState(),2),c=o[0],s=o[1],u=Object(f.useService)(l.PLAYLIST);!function(e,t,n){Object(f.useBulkFetch)([wr.getPlaylistFetchOptions(e,t),wr.getPlaylistVideosFetchOptions(e,n)],[e])}(t,a,s);return p.createElement(p.Fragment,null,p.createElement(Wr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_VIDEOS}),p.createElement(ut,{object:r}),!!c&&p.createElement(Vt,{onSortEnd:function(e,n){if(c.data&&c.data[e]){Vr(c.data,e,n,(function(e,n){u.reorderVideos(t,n),s((function(t){return{data:e,pagination:t.pagination}}))}))}},videos:c,getVideoAppLink:oo,getVideoActions:ao(t),emptyMessage:"There are no videos in this playlist."}))}function so(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function uo(){var e=so(p.useState(),2),t=e[0],n=e[1],r=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)($.getCurrentUserFetchOptions(n),[]);return p.createElement(p.Fragment,null,!!t&&p.createElement(Mr,{savePlaylist:function(e,n){return r.createPlaylist(e,t.id,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.PLAYLISTS,action:i.Playlists.EDIT_PLAYLIST,args:[t.id]})}}(n),n)}}))}function lo(e){return(lo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function po(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function mo(e,t){return!t||"object"!==lo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function bo(e){return(bo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function yo(e,t){return(yo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var vo=function(e){return"/api/master/v2/objects/".concat(e)},So=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},Eo=function(e){function t(){return po(this,t),mo(this,bo(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&yo(e,t)}(t,e),n=t,(r=[{key:"getVideo",value:function(e,t,n){return this.get({resource:vo(e),eventPrefix:"".concat(a.VIDEO,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getVideosById",value:function(e,t,n){return this.get({resource:So(e),eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"name",get:function(){return l.VIDEO}},{key:"channelName",get:function(){return u.VIDEO}}])&&fo(n.prototype,r),i&&fo(n,i),t}(f.BaseDataService),ho={dataServiceName:l.VIDEO,dataChannelName:u.VIDEO},go={getVideoFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ho),{eventPrefix:"".concat(a.VIDEO,":").concat(e),fetchData:function(t){return t.getVideo(e)},setData:t,onError:n})},getVideosByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ho),{eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),fetchData:function(t){return t.getVideosById(e)},setData:t,onError:n})}};function Oo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function jo(e){var t=e.videoId,n=e.playlistId,r=e.closePopup,i=Oo(p.useState(),2),a=i[0],o=i[1],c=Oo(p.useState(),2),s=c[0],u=c[1],d=Oo(p.useState(!1),2),b=d[0],y=d[1],v=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)(go.getVideoFetchOptions(t,o),[t]),Object(f.useFetch)(wr.getPlaylistFetchOptions(n,u),[n]);var S=p.useCallback((function(){y(!0),v.removeVideoFromPlaylist(n,t,r,r)}),[t,n]),E=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:S,buttonText:"Yes, remove video",isSpinnerButton:!0,showSpinner:b}],h=s&&a;return p.createElement(m.Popup,{title:"Remove Video",closePopup:r,showLoadingSpinner:!h},!!h&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,a.name)," from ",p.createElement("strong",null,s.name),"?")),p.createElement(m.PopupButtons,{buttons:E})))}function To(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Co=function(e,t,n){return[{variant:"link",onClick:t,buttonText:"Cancel"},{variant:"danger",onClick:e,buttonText:"Yes, delete this audience",isSpinnerButton:!0,showSpinner:n}]};function Io(e){var t=e.id,n=e.routeToOnDelete,r=e.closePopup,i=To(p.useState(),2),a=i[0],o=i[1],c=To(p.useState(!1),2),s=c[0],u=c[1],d=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(ea.getAudienceFetchOptions(t,o),[t]);return p.createElement(m.Popup,{title:"Delete Audience",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?")),p.createElement(m.PopupButtons,{buttons:Co((function(){u(!0);d.deleteAudience(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)}),r,s)})))}function Ao(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Po=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function Lo(e){var t=e.presentationId,n=e.audienceId,r=Ao(p.useState(),2),i=r[0],a=r[1],o=Ao(p.useState(),2),c=o[0],s=o[1],u=Ao(p.useState(),2),m=u[0],d=u[1],b=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(ea.getAudienceFetchOptions(n,a),[n]),Object(f.useFetch)(ea.getLevelsFetchOptions(s),[]),Object(f.useFetch)(ea.getPresentationFetchOptions(t,d),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(Ie,{appLink:Po(t),backToName:"audiences"})),!!m&&p.createElement("h6",null,"Presentation: ".concat(m.name)),!!i&&!!c&&p.createElement(ca,{audience:i,levels:c,saveAudience:function(e,r){return b.updateAudience(n,Object.assign(Object.assign({},e),{presentationId:t}),r,r)},presentationId:t}))}function No(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var ko=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e,t.masterId]}}},wo=function(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_AUDIENCE,args:[e]}},Do={application:s.SUBJECTS,action:i.Subjects.AUDIENCES};function Fo(e){var t=e.presentationId,n=No(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(ea.getAudiencesFetchOptions(t,i),[]),p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(Ie,{appLink:Do,backToName:"presentations"})),p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select an audience to edit:"),p.createElement(m.AppLink,{appLink:wo(t),className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Audience"))),p.createElement(ft,{objects:r,getAppLink:ko(e.presentationId),emptyMessage:"There are no audiences in this presentation yet. Click '+ New Audience' to create one."}))}function _o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Ro=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function xo(e){var t=e.presentationId,n=_o(p.useState(),2),r=n[0],a=n[1],o=_o(p.useState(),2),c=o[0],u=o[1],m=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(ea.getLevelsFetchOptions(a),[]),Object(f.useFetch)(ea.getPresentationFetchOptions(t,u),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2"},p.createElement(Ie,{appLink:Ro(t),backToName:"audiences"})),!!c&&p.createElement("h6",null,"Presentation: ".concat(c.name)),!!r&&p.createElement(ca,{levels:r,presentationId:t,saveAudience:function(e,n){return m.createAudience(Object.assign(Object.assign({},e),{presentationId:t}),function(e,t){return function(n){t(),f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e,n.masterId]})}}(t,n),n)}}))}function Uo(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]}}function Vo(e){return[{label:"Add child",getAppLink:function(t){return Object.assign(Object.assign({},Uo(e)),{args:[e],params:{parentId:t.id}})}},{label:"Delete classification",getAppLink:function(t){return{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e,t.id]}},className:"text-danger"}]}var Bo=n(18),Jo=n.n(Bo);function Mo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ho(e){var t=e.presentationId,n=e.selectedClassificationId,r=Mo(p.useState(),2),a=r[0],o=r[1],c=Mo(p.useState(),2),u=c[0],l=c[1];return function(e,t,n){var r=ea.getClassificationTreeFetchOptions(e,t),i=ea.getPresentationFetchOptions(e,n);Object(f.useBulkFetch)([r,i],[e])}(t,o,l),p.createElement("div",{className:"".concat(Jo.a.navContainer," h-auto pr-2 border-right")},!!u&&p.createElement("h6",{className:"border-bottom pb-2"},"Classifications (".concat(u.name,")")),p.createElement(m.AppLink,{appLink:Uo(t),className:"d-inline-block pb-2"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Classification")),!!a&&p.createElement("div",{className:"border-top pt-1"},p.createElement(gt,{tree:a,getAppLink:function(e){return function(e,t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,t.id]}}(t,e)},selectedIds:[n],actions:Vo(t)})))}function Yo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function qo(e){var t=e.classificationId,n=e.routeToOnDelete,r=e.closePopup,i=Yo(p.useState(),2),a=i[0],o=i[1],c=Yo(p.useState(!1),2),s=c[0],u=c[1];Object(f.useFetch)(ea.getClassificationFetchOptions(t,o),[]);var d=Object(f.useService)(l.SUBJECT),b=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){u(!0);d.deleteClassification(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)},buttonText:"Yes, delete this classification",isSpinnerButton:!0,showSpinner:s}];return p.createElement(m.Popup,{title:"Delete Classification",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?")),p.createElement(m.PopupButtons,{buttons:b})))}function Ko(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function zo(e){var t=e.presentationId,n=e.classificationId,r=Ko(p.useState(),2),i=r[0],a=r[1],o=Ko(p.useState(),2),c=o[0],s=o[1],u=Ko(p.useState(),2),m=u[0],d=u[1],b=Ko(p.useState(),2),y=b[0],v=b[1],S=Object(f.useService)(l.SUBJECT),E=ea.getClassificationFetchOptions(n,a),h=ea.getPresentationFetchOptions(t,s),g=ea.getClassificationTreeFetchOptions(t,d),O=ea.getSubjectTreeFetchOptions(v);Object(f.useFetch)(O,[]),Object(f.useFetch)(E,[n]),Object(f.useBulkFetch)([h,g],[t]);return p.createElement("div",null,p.createElement(ga,{presentation:c,classificationId:n}),!!i&&!!m&&!!y&&p.createElement(Ea,{classification:i,presentationId:t,subjectTree:y,classificationTree:m,saveClassification:function(e,t){return S.updateClassification(n,e,t,t)}}))}function Wo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Go(e){var t=e.presentationId,n=e.classificationId,r=e.memberType,i=Wo(p.useState(),2),a=i[0],o=i[1],c=Wo(p.useState(),2),s=c[0],u=c[1],m=Wo(p.useState(),2),d=m[0],b=m[1];Object(f.useFetch)(ea.getPresentationFetchOptions(t,o),[]),Object(f.useFetch)(ea.getClassificationFetchOptions(n,u),[n]),Object(f.useFetch)(ea.getClassificationMembersFetchOptions(n,r,b),[n,r]);var y=Object(f.useService)(l.SUBJECT),v={items:d&&d.data,memberType:r,classification:s,updatePinnedVideo:function(e,t){var r=Object.assign(Object.assign({},s),{pinnedVideoMasterId:e});y.updateClassification(n,r,t)},getItemAppLink:function(e){return ni.getMemberAppLink(r,e.id)},getActions:function(e){return ni.getMemberActions(n,Hr.Classification,r,e.id)}},S={presentation:a,classificationId:n},E=Ue(v);return p.createElement(p.Fragment,null,p.createElement(ga,Object.assign({},S,{memberType:r})),E&&p.createElement(ba,Object.assign({},v)))}function Zo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Qo(e){var t=e.presentationId,n=e.parentId,r=Zo(p.useState(),2),a=r[0],o=r[1],c=Zo(p.useState(),2),u=c[0],m=c[1],d=Object(f.useService)(l.SUBJECT),b=ea.getClassificationTreeFetchOptions(t,o),y=ea.getSubjectTreeFetchOptions(m);Object(f.useFetch)(y,[]),Object(f.useFetch)(b,[t]);return p.createElement("div",null,p.createElement("h4",{className:"py-2"},"Create New Classification"),!!u&&!!a&&p.createElement(Ea,{classification:n?{parentIds:[n]}:{},presentationId:t,subjectTree:u,classificationTree:a,saveClassification:function(e,n){return d.createClassification(Object.assign(Object.assign({},e),{presentationId:t}),function(e,t){return function(n){t(),n&&n.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]})}}(t,n),n)}}))}function Xo(e){return(Xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ec(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function tc(e,t){return!t||"object"!==Xo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function nc(e){return(nc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function rc(e,t){return(rc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ic=function(e){return"/api/master/v2/objects/".concat(e,"?query=thumbnail,poster,banner,rating")},ac=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},oc=function(){return"/api/master/v2/series"},cc=function(e){return"/api/master/v2/objects/".concat(e)},sc=function(e){function t(){return $o(this,t),tc(this,nc(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&rc(e,t)}(t,e),n=t,(r=[{key:"getSeries",value:function(e,t,n){return this.get({resource:ic(e),eventPrefix:"".concat(a.SERIES,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSeriesById",value:function(e,t,n){return this.get({resource:ac(e),eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createSeries",value:function(e,t,n){var r,i=this;this.chain().create({resource:oc(),data:e,callback:function(e){return r=e},errorCallback:n,eventPrefix:a.SERIES,expiryTime:m.CacheDurations.STANDARD,errorHandler:this.alertService.error("Failed to create series.")}).func((function(){r&&r.id&&i.update({resource:cc(r.id),data:{permissions:Re()},callback:t,eventPrefix:a.SERIES,successHandler:i.alertService.success("Successfully created series")})})).run()}},{key:"updateSeries",value:function(e,t,n,r){this.update({resource:cc(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_SERIES,":").concat(e),invalidationKeys:["".concat(a.SERIES,":").concat(e),a.SERIES_BY_ID],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated series"),errorHandler:this.alertService.error("Failed to update series")})}},{key:"name",get:function(){return l.SERIES}},{key:"channelName",get:function(){return u.SERIES}}])&&ec(n.prototype,r),i&&ec(n,i),t}(f.BaseDataService),uc={dataServiceName:l.SERIES,dataChannelName:u.SERIES},lc={getSeriesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},uc),{eventPrefix:"".concat(a.SERIES,":").concat(e),fetchData:function(t){return t.getSeries(e)},setData:t,onError:n})},getSeriesByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},uc),{eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),fetchData:function(t){return t.getSeriesById(e)},setData:t,onError:n})}};function pc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var fc=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(ni.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function mc(e){var t=e.classificationId,n=e.memberId,r=e.memberType,i=e.closePopup,a=pc(p.useState(),2),o=a[0],c=a[1],s=pc(p.useState(),2),u=s[0],d=s[1],b=pc(p.useState(!1),2),y=b[0],v=b[1],S=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(function(e,t,n){switch(e){case Yr.Playlists:return wr.getPlaylistFetchOptions(t,n);case Yr.Series:return lc.getSeriesFetchOptions(t,n);case Yr.Videos:return go.getVideoFetchOptions(t,n)}}(r,n,d),[n]),Object(f.useFetch)(ea.getClassificationFetchOptions(t,c),[t]);var E=!!o&&!!u,h="Remove ".concat(Be(ni.singularizeMemberType(r)));return p.createElement(m.Popup,{title:h,closePopup:i,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,u.name)," from ",p.createElement("strong",null,o.name),"?"),p.createElement("p",null,"This will not remove it from the backbone subject.")),p.createElement(m.PopupButtons,{buttons:fc(i,(function(){v(!0),S.removeObjectsFromClassification(t,[n],r,null,null,i,i),o.pinnedVideoMasterId===n&&S.updateClassification(t,Object.assign(Object.assign({},o),{pinnedVideoMasterId:null}))}),r,y)})))}function dc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function bc(e){var t=e.id,n=dc(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(ea.getLevelFetchOptions(t,i),[t]);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Level"),!!r&&p.createElement(Ca,{level:r,saveLevel:function(e,n){return a.updateLevel(t,e,n,n)}}))}function yc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var vc=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},Sc={application:s.SUBJECTS,action:i.Subjects.NEW_LEVEL};function Ec(){var e=yc(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(ea.getLevelsFetchOptions(n),[]),p.createElement("div",null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a level to edit:"),p.createElement(m.AppLink,{appLink:Sc,className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Level"))),p.createElement(ft,{objects:t,getAppLink:vc}))}function hc(){var e=Object(f.useService)(l.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Level"),p.createElement(Ca,{saveLevel:function(t,n){return e.createLevel(t,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[t.id]})}}(n),n)}}))}function gc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Oc(e){var t=e.id,n=gc(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(ea.getPresentationFetchOptions(t,i),[t]);var o={presentation:r,savePresentation:function(e,n){var r=n.setSubmitting;return a.updatePresentation(t,e,(function(){return r(!1)}),(function(){return r(!1)}))}},c=Ue(o);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Presentation"),!!c&&p.createElement(La,Object.assign({},o)))}function jc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Tc=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_PRESENTATION,args:[e.id]}},Cc={application:s.SUBJECTS,action:i.Subjects.NEW_PRESENTATION};function Ic(){var e=jc(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(ea.getPresentationsFetchOptions(n),[]),p.createElement("div",null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a presentation to edit:"),p.createElement(m.AppLink,{appLink:Cc,className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Presentation"))),p.createElement(ft,{objects:t,getAppLink:Tc}))}function Ac(){var e=Object(f.useService)(l.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Presentation"),p.createElement(La,{savePresentation:function(t,n){var r=n.setSubmitting;e.createPresentation(t,(function(e){return function(e,t){t(!1),e&&e.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_PRESENTATION,args:[e.id]})}(e,r)}),(function(){return r(!1)}))}}))}function Pc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Lc(e){var t=e.objectType,n=e.getAppLink,r=Pc(p.useState(),2),i=r[0],a=r[1];return Object(f.useFetch)(ea.getPresentationsFetchOptions(a),[]),p.createElement("div",null,p.createElement("h5",null,p.createElement(m.Text,{namespace:"subjects.selectPresentation",phrase:"heading",options:{objectType:t}})),p.createElement(ft,{objects:i,getAppLink:n}))}function Nc(e,t){return m.StateHelper.getSetStateByKey(e,t)}function kc(e,t){var n=e.memberType,r=e.objectIds,i=ea.getSubjectTreeFetchOptions(Nc(t,"subjectTree"));Object(f.useFetch)(i,[]);var a=function(e,t,n){switch(e){case Yr.Playlists:return wr.getPlaylistsByIdFetchOptions(t,n);case Yr.Series:return lc.getSeriesByIdFetchOptions(t,n);case Yr.Videos:return go.getVideosByIdFetchOptions(t,n)}}(n,r,Nc(t,"objects"));Object(f.useFetch)(a,[n,r])}function wc(e,t,n,r){var a=n.selectedSubject,o=n.objects,c=function(){return Nc(r,"showConfirmationPopup")(!1)};e.addObjectsToSubject(a.id,o.map((function(e){return e.id})),t.memberType,n.addToClassifications,(function(){c(),f.Core.AppLinkHelper.trigger(function(e,t){var n={application:s.SUBJECTS,args:[e]};switch(t){case Yr.Playlists:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_PLAYLISTS});case Yr.Series:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_SERIES});case Yr.Videos:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_VIDEOS})}}(a.id,t.memberType))}),c)}function Dc(e,t,n){if(t&&n){var r=1===t.length?"this ".concat(ni.singularizeMemberType(e)):"these ".concat(e);return"Add ".concat(r," to ").concat(n.name)}}function Fc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var _c=function(e,t){return function(n,r,i){i(),Nc(t,"selectedSubject")(Me.find(e.subjectTree,f.ArrayHelper.first(n))),Nc(t,"addToClassifications")(r),Nc(t,"showConfirmationPopup")(!0)}};function Rc(e){var t=Fc(p.useState({}),2),n=t[0],r=t[1],i=Object(f.useService)(l.SUBJECT);kc(e,r);var a;return p.createElement(p.Fragment,null,!!n.objects&&!!n.subjectTree&&p.createElement(ka,{memberType:e.memberType,objects:n.objects,subjectTree:n.subjectTree,onClickAddToSubject:_c(n,r)}),n.showConfirmationPopup&&p.createElement(m.ConfirmationPopup,{title:Dc(e.memberType,n.objects,n.selectedSubject),onClickConfirm:function(){return wc(i,e,n,r)},closePopup:function(){return e=!1,Nc(r,"showConfirmationPopup")(e);var e}},p.createElement("p",null,"The following ".concat(e.memberType," will be added to "),p.createElement("strong",null,n.selectedSubject.name),n.addToClassifications?" and its mapped classifications:":":"),p.createElement("ul",null,n.objects.map((function(e){return p.createElement("li",{key:e.id},e.name)}))),!n.addToClassifications&&p.createElement("p",null,"".concat(1===n.objects.length?"It":"They"," will not be added to its mapped classifications.")),p.createElement("p",null,"".concat((a=e.memberType,Be(ni.singularizeMemberType(a)))," to classification mappings can be managed from the "),p.createElement("strong",null,"Edit Subject ".concat(Be(e.memberType)," ")),"page.")))}function xc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Uc(e){var t=e.subjectId,n=e.routeToOnDelete,r=e.closePopup,i=xc(p.useState(),2),a=i[0],o=i[1],c=xc(p.useState(!1),2),s=c[0],u=c[1];Object(f.useFetch)(ea.getSubjectFetchOptions(t,o),[]);var d=Object(f.useService)(l.SUBJECT),b=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){u(!0);d.deleteSubject(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)},buttonText:"Yes, delete this subject",isSpinnerButton:!0,showSpinner:s}];return p.createElement(m.Popup,{title:"Delete Subject",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?"),p.createElement("p",null,"Subjects that have mapped classifications cannot be deleted.")),p.createElement(m.PopupButtons,{buttons:b})))}function Vc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Bc(e){var t=e.subjectId,n=Vc(p.useState(),2),r=n[0],a=n[1],o=Vc(p.useState(),2),c=o[0],s=o[1],u=Object(f.useService)(l.SUBJECT),m=ea.getSubjectFetchOptions(t,a),d=ea.getSubjectTreeFetchOptions(s);Object(f.useFetch)(d,[]),Object(f.useFetch)(m,[t]);return p.createElement(p.Fragment,null,p.createElement(Ua,{subjectId:t,activeAction:i.Subjects.EDIT_SUBJECT}),!!r&&!!c&&p.createElement(Ra,{subject:r,subjectTree:c,saveSubject:function(e,n){return u.updateSubject(t,e,n,n)}}))}function Jc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Mc=p.createContext(void 0);function Hc(e){var t=e.children,n=Jc(p.useState(),2),r=n[0],i=n[1];return p.createElement(Mc.Provider,{value:[r,i]},t)}var Yc=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Hc,null,p.createElement(Ke,null,t)))};function qc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Kc(e,t){return m.StateHelper.getSetStateByKey(e,t)}function zc(e,t,n){var r=e.subjectId,i=e.memberType,a=t.memberIds,o=qc(p.useContext(Mc),1)[0];Object(f.useFetch)(ea.getPresentationsFetchOptions(Kc(n,"presentations")),[]),Object(f.useFetch)(ea.getSubjectMemberIdsFetchOptions(r,i,Kc(n,"memberIds")),[r,i]),Object(f.useFetch)(function(e,t,n){if(!t||!t.length)return;switch(e){case Yr.Playlists:return wr.getPlaylistsByIdFetchOptions(t,n);case Yr.Series:return lc.getSeriesByIdFetchOptions(t,n);case Yr.Videos:return go.getVideosByIdFetchOptions(t,n)}}(i,a,Kc(n,"members")),[i,a],!!a&&!!a.length),Object(f.useFetch)(!!o&&ea.getSubjectClassificationFetchOptions(r,Kc(n,"classifications"),o.id,i),[r,i,o],!!o)}var Wc=function(e,t){return function(n){var r,a=s.SUBJECTS,o=[t,n];switch(e){case Yr.Playlists:r=i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;break;case Yr.Series:r=i.Subjects.EDIT_CLASSIFICATION_SERIES;break;case Yr.Videos:r=i.Subjects.EDIT_CLASSIFICATION_VIDEOS}return{application:a,action:r,args:o}}};function Gc(e){switch(e){case Yr.Playlists:return i.Subjects.EDIT_SUBJECT_PLAYLISTS;case Yr.Series:return i.Subjects.EDIT_SUBJECT_SERIES;case Yr.Videos:return i.Subjects.EDIT_SUBJECT_VIDEOS}}function Zc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Qc(e){var t=e.subjectId,n=e.memberType,r=Zc(p.useState({}),2),i=r[0],a=r[1],o=i.presentations,c=i.classifications,s=i.memberIds,u=i.membersWithClassifications,m=Zc(p.useContext(Mc),2),d=m[0],b=m[1],y=Object(f.useService)(l.SUBJECT);zc(e,i,a),function(e,t,n){var r=t.memberIds,i=t.members,a=t.classifications;p.useEffect((function(){Kc(n,"membersWithClassifications")(function(e,t,n){if(!t||!n)return;return t.map((function(t){return{id:t.id,name:t.name,classifications:n.map((function(n){return{id:n.id,selected:(r=t,i=n,!!i[e]&&!!i[e].data.filter((function(e){return e.id===r.id})).length)};var r,i}))}}))}(e.memberType,i,a))}),[i,a]),p.useEffect((function(){i&&i.length&&r&&!r.length&&Kc(n,"members")([])}),[r])}(e,i,a);var v={presentations:o,currentPresentation:d,setCurrentPresentation:b},S={members:u||[],memberType:n,getMemberAppLink:function(e){return ni.getMemberAppLink(n,e)},getActions:function(e){return ni.getMemberActions(t,Hr.Subject,n,e)},classifications:c,getClassificationAppLink:d&&Wc(n,d.id),onToggleClassification:function(e,r,i){return function(e,t,n,r,i,a,o){(o?e.addObjectsToClassification.bind(e):e.removeObjectsFromClassification.bind(e))(a,n,t,r,i)}(y,n,i?[i]:s,t,d&&d.id,e,r)}},E=!!d&&!!c;return p.createElement(p.Fragment,null,p.createElement(Ua,{subjectId:t,activeAction:Gc(n)}),p.createElement(Ae.Alert,{variant:"info",className:"m-0"},"Select which ".concat(n," are shown for each classification in this subject.")+" Change the selected presentation to view different classifications."),p.createElement("div",{className:"w-50 py-2"},!!o&&p.createElement(Na,Object.assign({},v))),E&&p.createElement(Za,Object.assign({},S)))}function Xc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function $c(e){var t=e.parentId,n=Xc(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT),c=ea.getSubjectTreeFetchOptions(a);Object(f.useFetch)(c,[]);var u={application:s.SUBJECTS,action:i.Subjects.PRESENTATIONS};return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2 border-bottom"},p.createElement(Ie,{backToName:"Presentations",appLink:u})),p.createElement("h4",{className:"py-2"},"Create New Subject"),!!r&&p.createElement(Ra,{subject:{parentId:t},subjectTree:r,saveSubject:function(e,t){return o.createSubject(e,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[t.id]})}}(t),t)}}))}function es(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var ts=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(ni.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function ns(e){var t=e.subjectId,n=e.memberId,r=e.memberType,i=e.closePopup,a=es(p.useState(),2),o=a[0],c=a[1],s=es(p.useState(),2),u=s[0],d=s[1],b=es(p.useState(!1),2),y=b[0],v=b[1],S=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(function(e,t,n){switch(e){case Yr.Playlists:return wr.getPlaylistFetchOptions(t,n);case Yr.Series:return lc.getSeriesFetchOptions(t,n);case Yr.Videos:return go.getVideoFetchOptions(t,n)}}(r,n,d),[n]),Object(f.useFetch)(ea.getSubjectFetchOptions(t,c),[t]);var E=!!o&&!!u,h="Remove ".concat(Be(ni.singularizeMemberType(r)));return p.createElement(m.Popup,{title:h,closePopup:i,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,u.name)," from ",p.createElement("strong",null,o.name),"?"),p.createElement("p",null,"Please ensure that it is not in any classifications before removing.")),p.createElement(m.PopupButtons,{buttons:ts(i,(function(){v(!0),S.removeObjectsFromSubject(t,[n],r,i,i)}),r,y)})))}function rs(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function is(e){var t=e.subjectId,n=rs(p.useState({}),2),r=n[0];return function(e,t){var n=function(e){return m.StateHelper.getSetStateByKey(t,e)};Object(f.useFetch)(ea.getSubjectClassificationFetchOptions(e,n("classifications")),[e]),Object(f.useFetch)(ea.getPresentationsFetchOptions(n("presentations")),[])}(t,n[1]),p.createElement(p.Fragment,null,p.createElement(Ua,{subjectId:t,activeAction:i.Subjects.SUBJECT_CLASSIFICATIONS}),p.createElement(Ha,{presentations:r.presentations,classificationDictionary:f.ArrayHelper.groupBy(r.classifications,"presentationId")}))}var as=n(19),os=n.n(as);function cs(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ss(e){var t=e.selectedSubjectId,n=cs(p.useState(),2),r=n[0],a=n[1];Object(f.useFetch)(ea.getSubjectTreeFetchOptions(a),[]);var o=p.useCallback((function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e.id]}}),[]),c={application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT},u=[{label:"Add child",getAppLink:function(e){return Object.assign(Object.assign({},c),{params:{parentId:e.id}})}},{label:"Delete subject",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.DELETE_SUBJECT,args:[e.id]}},className:"text-danger"}];return p.createElement("div",{className:"".concat(os.a.navContainer," h-auto pr-2 border-right")},p.createElement("h5",{className:"border-bottom pb-2"},"Subjects"),p.createElement(m.AppLink,{appLink:c,className:"d-inline-block pb-2"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Subject")),!!r&&p.createElement("div",{className:"border-top pt-1"},p.createElement(gt,{tree:r,getAppLink:o,selectedIds:[t],actions:u})))}function us(e){var t=e.currentAppLink;return p.createElement(Qa,{navItems:ri(),currentAppLink:t})}function ls(e){return(ls="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ps(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ms(e,t,n){return t&&fs(e.prototype,t),n&&fs(e,n),e}function ds(e,t){return!t||"object"!==ls(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function bs(e){return(bs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ys(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vs(e,t)}function vs(e,t){return(vs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ss=function(e){function t(){return ps(this,t),ds(this,bs(t).apply(this,arguments))}return ys(t,e),ms(t,[{key:"channelName",get:function(){return s.PLAYLISTS}},{key:"appRoutes",get:function(){return{"manage/playlists(/)":"index","manage/playlists/new(/)":"newPlaylist","manage/playlists/:id(/)":"editPlaylist","manage/playlists/:id/videos(/)":"editPlaylistVideos","manage/playlists/:id/subjects(/)":"editPlaylistSubjects","manage/playlists/:id/audiences(/)":"editPlaylistAudiences"}}},{key:"appLinks",get:function(){return["deletePlaylist","removeVideo","uploadImage","removeFromSubject"]}}]),t}(f.Core.AppRouter),Es=function(e){function t(){return ps(this,t),ds(this,bs(t).apply(this,arguments))}return ys(t,e),ms(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"index",value:function(){this.navigate("/dashboards/playlists")}},{key:"newPlaylist",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(uo,null))}},{key:"editPlaylist",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Zr,{key:e,playlistId:e}))}},{key:"editPlaylistVideos",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(co,{key:e,playlistId:e}))}},{key:"editPlaylistSubjects",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(ro,{key:e,playlistId:e}))}},{key:"editPlaylistAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(eo,{key:e,playlistId:e}))}},{key:"deletePlaylist",value:function(e){var t=Object.assign({playlistId:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(xr,Object.assign({},t)))}},{key:"removeVideo",value:function(e,t){var n=Object.assign({playlistId:e,videoId:t},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(jo,Object.assign({},n)))}},{key:"removeFromSubject",value:function(e,t){var n=Object.assign({subjectId:t,memberId:e,memberType:Yr.Playlists},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(ns,Object.assign({},n)))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Fr,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return $t.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"navigate",value:function(e){f.Core.LocationUtils.PageLoad(e)}},{key:"name",get:function(){return"Playlists Application"}},{key:"channelName",get:function(){return s.PLAYLISTS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:_r}}}}],[{key:"router",get:function(){return Ss}}]),t}(f.Core.Application),hs=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Ke,null,t))},gs=function(){return"/api/domain/v2/me/ratings"},Os="ratings",js=function(){return{url:gs(),key:Os}},Ts=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Ee.string().trim().max(65535,"Description is too long").default(""),rating:Ee.object().shape({id:Ee.string()}).default({}).noUnknown(),poster:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown(),banner:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown()}).noUnknown(),Cs=function(e,t){var n=s.SERIES,r=i.Series,a=[{label:"Edit Series Details",appLink:{application:n,action:r.EDIT_SERIES,args:[t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_SERIES_VIDEOS,args:[t]}}];return xe(e)&&a.push.apply(a,[{label:"Subjects",appLink:{application:n,action:r.EDIT_SERIES_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_SERIES_AUDIENCES,args:[t]}}]),a};function Is(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this series",autoFocus:!0}),p.createElement(m.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this series here"}),p.createElement(mt,{ratings:e.ratings}),p.createElement(tt,{imageType:m.ImageType.Posters,currentImage:t.values.poster,setNewImage:function(e){return t.setFieldValue("poster",e)},application:s.SERIES,uploadAction:i.Series.UPLOAD_IMAGE}),p.createElement(tt,{imageType:m.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.SERIES,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between align-items-center"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(m.Actions,{actions:e.actions})))}function As(e){return p.createElement(m.FormWrapper,{initialValues:e.series,validationSchema:Ts,onSubmit:e.saveSeries},p.createElement(Is,{id:e.series&&e.series.id,ratings:e.ratings}))}var Ps=function(e){return function(t){return t.appLink.action===e}};function Ls(e){var t=e.seriesId,n=e.activeAction,r=p.useContext(Ge);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(dt,{tabs:Cs(r,t),isItemActive:Ps(n)}))}function Ns(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ks(e){var t=e.seriesId,n=Ns(p.useState(),2),r=n[0],a=n[1],o=f.Flight.useBasicFetch(js()),c=Object(f.useService)(l.SERIES);Object(f.useFetch)(lc.getSeriesFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(Ls,{seriesId:t,activeAction:i.Series.EDIT_SERIES}),!!r&&!!o.data&&p.createElement(As,{series:r,saveSeries:function(e,n){return c.updateSeries(t,e,n,n)},ratings:o.data}))}function ws(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ds(e){var t=e.seriesId,n=ws(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([lc.getSeriesFetchOptions(e,r("series")),ea.getObjectLevelsFetchOptions(e,Yr.Series,r("seriesLevels"))],[e]),Object(f.useFetch)(ea.getObjectAudiencesFetchOptions(e,Yr.Series,r("seriesAudiences")),[e,t.seriesLevels]),Object(f.useBulkFetch)([ea.getPresentationsFetchOptions(r("presentations")),ea.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&ea.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),Xa(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.seriesLevels&&r.seriesAudiences);return p.createElement(p.Fragment,null,p.createElement(Ls,{seriesId:t,activeAction:i.Series.EDIT_SERIES_AUDIENCES}),p.createElement(ut,{object:r.series}),!!c&&p.createElement(ua,{objectLevels:r.seriesLevels,objectAudiences:r.seriesAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Yr.Series,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Yr.Series,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Yr.Series,n,n)}}))}function Fs(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function _s(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Rs(e){var t=e.seriesId,n=Fs(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([ea.getSubjectTreeFetchOptions(r("subjectTree")),ea.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([lc.getSeriesFetchOptions(e,r("series")),ea.getObjectSubjectsFetchOptions(e,Yr.Series,r("seriesSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&ea.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.seriesSubjects]);var i=function(e,t){return[].concat(_s(t.subjectClassifications||[]),_s(e))},a=t.seriesSubjects&&t.seriesSubjects.map((function(e){return ea.getSubjectClassificationFetchOptions(e.id,m.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.seriesSubjects],!!a),Object(f.useFetch)(ea.getObjectClassificationsFetchOptions(e,Yr.Series,r("seriesClassifications")),[e,t.seriesSubjects])}(t,r,a),Xa(r,a);var c=!!(r.seriesSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.seriesClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(Ls,{seriesId:t,activeAction:i.Series.EDIT_SERIES_SUBJECTS}),p.createElement(ut,{object:r.series}),c&&p.createElement(Da,{objectSubjects:r.seriesSubjects,subjectTree:r.subjectTree,memberType:Yr.Series,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.seriesClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Yr.Series,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Yr.Series,n,n)}}))}function xs(){var e=f.Flight.useBasicFetch(js()),t=Object(f.useService)(l.SERIES);return p.createElement(p.Fragment,null,!!e.data&&p.createElement(As,{saveSeries:function(e,n){return t.createSeries(e,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SERIES,action:i.Series.EDIT_SERIES,args:[t.id]})}}(n),n)},ratings:e.data}))}function Us(e){return(Us="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Vs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Js(e,t,n){return t&&Bs(e.prototype,t),n&&Bs(e,n),e}function Ms(e,t){return!t||"object"!==Us(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Hs(e){return(Hs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ys(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&qs(e,t)}function qs(e,t){return(qs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ks=function(e){function t(){return Vs(this,t),Ms(this,Hs(t).apply(this,arguments))}return Ys(t,e),Js(t,[{key:"channelName",get:function(){return s.SERIES}},{key:"appRoutes",get:function(){return{"manage/series/new(/)":"newSeries","manage/series/:id(/)":"editSeries","manage/series/:id/videos(/)":"editSeriesVideos","manage/series/:id/subjects(/)":"editSeriesSubjects","manage/series/:id/audiences(/)":"editSeriesAudiences"}}},{key:"appLinks",get:function(){return["uploadImage"]}}]),t}(f.Core.AppRouter),zs=function(e){function t(){return Vs(this,t),Ms(this,Hs(t).apply(this,arguments))}return Ys(t,e),Js(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"newSeries",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(xs,null))}},{key:"editSeries",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(ks,{seriesId:e}))}},{key:"editSeriesVideos",value:function(e){f.Core.LocationUtils.Redirect("/manage/legacy/series/".concat(e),!0)}},{key:"editSeriesSubjects",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Rs,{seriesId:e}))}},{key:"editSeriesAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ds,{seriesId:e}))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Fr,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return $t.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Series Application"}},{key:"channelName",get:function(){return s.SERIES}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:hs}}}}],[{key:"router",get:function(){return Ks}}]),t}(f.Core.Application);function Ws(e){return(Ws="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Gs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Qs(e,t,n){return t&&Zs(e.prototype,t),n&&Zs(e,n),e}function Xs(e,t){return!t||"object"!==Ws(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function $s(e){return($s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eu(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tu(e,t)}function tu(e,t){return(tu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var nu=function(e){function t(){return Gs(this,t),Xs(this,$s(t).apply(this,arguments))}return eu(t,e),Qs(t,[{key:"channelName",get:function(){return s.SUBJECTS}},{key:"appRoutes",get:function(){return{"manage/subjects(/)":"subjects","manage/subjects/add-objects(/)":"addSubjectMembers","manage/subjects/new(/)":"newSubject","manage/subjects/:id/edit(/)":"editSubject","manage/subjects/:id/edit/playlists(/)":"editSubjectPlaylists","manage/subjects/:id/edit/series(/)":"editSubjectSeries","manage/subjects/:id/edit/videos(/)":"editSubjectVideos","manage/subjects/:id/classifications(/)":"subjectClassifications","manage/subjects/classifications(/)":"classifications","manage/subjects/presentations/:id/classifications(/)":"presentationClassifications","manage/subjects/presentations/:id/classifications/new(/)":"newClassification","manage/subjects/presentations/:id/classifications/:id/edit(/)":"editClassification","manage/subjects/presentations/:id/classifications/:id/edit/playlists(/)":"editClassificationPlaylists","manage/subjects/presentations/:id/classifications/:id/edit/series(/)":"editClassificationSeries","manage/subjects/presentations/:id/classifications/:id/edit/videos(/)":"editClassificationVideos","manage/subjects/levels(/)":"levels","manage/subjects/levels/new(/)":"newLevel","manage/subjects/levels/:id(/)":"editLevel","manage/subjects/audiences(/)":"audiences","manage/subjects/presentations/:id/audiences(/)":"presentationAudiences","manage/subjects/presentations/:id/audiences/new(/)":"newAudience","manage/subjects/presentations/:id/audiences/:id/edit(/)":"editAudience","manage/subjects/presentations(/)":"presentations","manage/subjects/presentations/new":"newPresentation","manage/subjects/presentations/:id(/)":"editPresentation"}}},{key:"appLinks",get:function(){return["deleteClassification","removeClassificationMember","deleteSubject","removeSubjectMember","deleteAudience","uploadImage"]}}]),t}(f.Core.AppRouter),ru=function(e){function t(){return Gs(this,t),Xs(this,$s(t).apply(this,arguments))}return eu(t,e),Qs(t,[{key:"initialize",value:function(){var e=this;this.subjectDataService=f.InstanceManager.getInstance(l.SUBJECT,this),f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"subjects",value:function(){this.subjectDataService.getSubjectTree((function(e){var t=!!e.children&&e.children[0];t?f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[t.id]},{replace:!0}):f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT},{replace:!0})}))}},{key:"newSubject",value:function(e){var t={parentId:e.parentId};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement($c,Object.assign({key:e.parentId},t))),this.renderSubjectsLeftNav()}},{key:"editSubject",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Bc,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"editSubjectPlaylists",value:function(e){var t={subjectId:e,memberType:Yr.Playlists};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Qc,Object.assign({key:"".concat(e,":playlists")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectSeries",value:function(e){var t={subjectId:e,memberType:Yr.Series};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Qc,Object.assign({key:"".concat(e,":series")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectVideos",value:function(e){var t={subjectId:e,memberType:Yr.Videos};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Qc,Object.assign({key:"".concat(e,":videos")},t))),this.renderSubjectsLeftNav(e)}},{key:"subjectClassifications",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(is,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"addSubjectMembers",value:function(e){var t=e.memberType,n=e.objectIds;if(t&&n){var r={memberType:t,objectIds:Array.isArray(n)?n:[n]};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Rc,Object.assign({},r))),this.hideLeftNav()}}},{key:"removeSubjectMember",value:function(e,t,n){var r=Object.assign({subjectId:e,memberId:t,memberType:n},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(ns,Object.assign({},r)))}},{key:"deleteSubject",value:function(e){var t=e.toString()===this.currentLeftNavId.toString()?{application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT}:null,n=Object.assign({subjectId:e,routeToOnDelete:t||null},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Uc,Object.assign({},n)))}},{key:"classifications",value:function(){var e={objectType:"classifications",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_CLASSIFICATIONS,args:[e.id]}}};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Lc,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationClassifications",value:function(e){this.subjectDataService.getClassificationTree(e,(function(t){var n=!!t.children&&t.children[0];n?f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]},{replace:!0}):f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]},{replace:!0})}))}},{key:"newClassification",value:function(e,t){var n={presentationId:e,parentId:t.parentId};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Qo,Object.assign({key:t.parentId},n))),this.renderClassificationLeftNav(e)}},{key:"editClassification",value:function(e,t){var n={presentationId:e,classificationId:t};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(zo,Object.assign({key:t},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationPlaylists",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Yr.Playlists};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Go,Object.assign({key:"".concat(t,":playlists")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationSeries",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Yr.Series};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Go,Object.assign({key:"".concat(t,":series")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationVideos",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Yr.Videos};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Go,Object.assign({key:"".concat(t,":videos")},n))),this.renderClassificationLeftNav(e,t)}},{key:"removeClassificationMember",value:function(e,t,n){var r=Object.assign({classificationId:e,memberId:t,memberType:n},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(mc,Object.assign({},r)))}},{key:"deleteClassification",value:function(e,t){var n=t===this.currentLeftNavId?{application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]}:null,r=Object.assign({classificationId:t,routeToOnDelete:n||null},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(qo,Object.assign({},r)))}},{key:"levels",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ec,null)),this.hideLeftNav()}},{key:"newLevel",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(hc,null)),this.hideLeftNav()}},{key:"editLevel",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(bc,{key:e,id:e})),this.hideLeftNav()}},{key:"audiences",value:function(){var e={objectType:"audiences",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e.id]}}};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Lc,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Fo,{presentationId:e})),this.hideLeftNav()}},{key:"newAudience",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(xo,{presentationId:e})),this.hideLeftNav()}},{key:"editAudience",value:function(e,t){var n={presentationId:e,audienceId:t};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Lo,Object.assign({key:t},n))),this.hideLeftNav()}},{key:"deleteAudience",value:function(e,t){var n={application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]},r=Object.assign({id:t,routeToOnDelete:n},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Io,Object.assign({},r)))}},{key:"presentations",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ic,null)),this.hideLeftNav()}},{key:"newPresentation",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ac,null))}},{key:"editPresentation",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Oc,{key:e,id:e})),this.hideLeftNav()}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Fr,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return $t.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"renderClassificationLeftNav",value:function(e,t){this.setCurrentLeftNavItem(t);var n={presentationId:e,selectedClassificationId:t};this.layout.showChildView(m.LayoutRegions.LEFT_NAV,p.createElement(Ho,Object.assign({},n)))}},{key:"renderSubjectsLeftNav",value:function(e){this.setCurrentLeftNavItem(e),this.layout.showChildView(m.LayoutRegions.LEFT_NAV,p.createElement(ss,{selectedSubjectId:e}))}},{key:"setCurrentLeftNavItem",value:function(e){this.currentLeftNavId=e||null}},{key:"hideLeftNav",value:function(){this.setCurrentLeftNavItem(),this.layout.hideLeftNav()}},{key:"getTopNav",value:function(e){return p.createElement(us,{currentAppLink:e})}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Subjects Application"}},{key:"channelName",get:function(){return s.SUBJECTS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:Yc,getTopNavView:this.getTopNav}}}}],[{key:"router",get:function(){return nu}}]),t}(f.Core.Application),iu=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Ke,null,t))},au=function(e){var t=s.VIDEOS,n=i.Videos;return[{label:"Edit Video Details",appLink:{application:t,action:n.EDIT_VIDEO,args:[e]}},{label:"Subjects",appLink:{application:t,action:n.EDIT_VIDEO_SUBJECTS,args:[e]}},{label:"Audiences",appLink:{application:t,action:n.EDIT_VIDEO_AUDIENCES,args:[e]}}]},ou=function(e){return function(t){return t.appLink.action===e}};function cu(e){var t=e.videoId,n=e.activeAction;return p.createElement("div",{className:"py-2"},p.createElement(dt,{tabs:au(t),isItemActive:ou(n)}))}function su(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function uu(e){var t=e.videoId,n=su(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([go.getVideoFetchOptions(e,r("video")),ea.getObjectLevelsFetchOptions(e,Yr.Videos,r("videoLevels"))],[e]),Object(f.useFetch)(ea.getObjectAudiencesFetchOptions(e,Yr.Videos,r("videoAudiences")),[e,t.videoLevels]),Object(f.useBulkFetch)([ea.getPresentationsFetchOptions(r("presentations")),ea.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&ea.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),Xa(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.videoLevels&&r.videoAudiences);return p.createElement(p.Fragment,null,p.createElement(cu,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_AUDIENCES}),p.createElement(ut,{object:r.video}),!!c&&p.createElement(ua,{objectLevels:r.videoLevels,objectAudiences:r.videoAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Yr.Videos,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Yr.Videos,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Yr.Videos,n,n)}}))}function lu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function pu(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function fu(e){var t=e.videoId,n=lu(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([ea.getSubjectTreeFetchOptions(r("subjectTree")),ea.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([go.getVideoFetchOptions(e,r("video")),ea.getObjectSubjectsFetchOptions(e,Yr.Videos,r("videoSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&ea.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.videoSubjects]);var i=function(e,t){return[].concat(pu(t.subjectClassifications||[]),pu(e))},a=t.videoSubjects&&t.videoSubjects.map((function(e){return ea.getSubjectClassificationFetchOptions(e.id,m.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.videoSubjects],!!a),Object(f.useFetch)(ea.getObjectClassificationsFetchOptions(e,Yr.Videos,r("videoClassifications")),[e,t.videoSubjects])}(t,r,a),Xa(r,a);var c=!!(r.videoSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.videoClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(cu,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_SUBJECTS}),p.createElement(ut,{object:r.video}),c&&p.createElement(Da,{objectSubjects:r.videoSubjects,subjectTree:r.subjectTree,memberType:Yr.Videos,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.videoClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Yr.Videos,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Yr.Videos,n,n)}}))}function mu(e){return(mu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function du(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yu(e,t,n){return t&&bu(e.prototype,t),n&&bu(e,n),e}function vu(e,t){return!t||"object"!==mu(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Su(e){return(Su=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Eu(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&hu(e,t)}function hu(e,t){return(hu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var gu=function(e){function t(){return du(this,t),vu(this,Su(t).apply(this,arguments))}return Eu(t,e),yu(t,[{key:"channelName",get:function(){return s.VIDEOS}},{key:"appRoutes",get:function(){return{"manage/videos/:id(/)":"editVideo","manage/videos/:id/audiences(/)":"editVideoAudiences","manage/videos/:id/subjects(/)":"editVideoSubjects"}}}]),t}(f.Core.AppRouter),Ou=function(e){function t(){return du(this,t),vu(this,Su(t).apply(this,arguments))}return Eu(t,e),yu(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"editVideo",value:function(e){f.Core.LocationUtils.Redirect("/tools/programlookup/".concat(e))}},{key:"editVideoAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(uu,{videoId:e}))}},{key:"editVideoSubjects",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(fu,{videoId:e}))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return $t.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"name",get:function(){return"Videos Application"}},{key:"channelName",get:function(){return s.VIDEOS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:iu}}}}],[{key:"router",get:function(){return gu}}]),t}(f.Core.Application);n.d(t,"Actions",(function(){return i})),n.d(t,"DataPrefixes",(function(){return a})),n.d(t,"FileExtensions",(function(){return o})),n.d(t,"Layouts",(function(){return c})),n.d(t,"AppChannels",(function(){return s})),n.d(t,"DataChannels",(function(){return u})),n.d(t,"DataServices",(function(){return l})),n.d(t,"CuratorLayoutView",(function(){return T})),n.d(t,"LayoutComponent",(function(){return L})),n.d(t,"CuratorAppNavService",(function(){return x})),n.d(t,"ImageUploadDataService",(function(){return Y})),n.d(t,"UserDataService",(function(){return Q})),n.d(t,"UserDataServiceHelper",(function(){return $})),n.d(t,"LanguageDataService",(function(){return oe})),n.d(t,"CompaniesApplication",(function(){return Xt})),n.d(t,"DomainOptionsApplication",(function(){return Vn})),n.d(t,"PeopleApplication",(function(){return dr})),n.d(t,"PlaylistDataService",(function(){return Nr})),n.d(t,"PlaylistDataServiceHelper",(function(){return wr})),n.d(t,"PlaylistsApplication",(function(){return Es})),n.d(t,"SeriesDataService",(function(){return sc})),n.d(t,"SeriesDataServiceHelper",(function(){return lc})),n.d(t,"SeriesApplication",(function(){return zs})),n.d(t,"SubjectDataService",(function(){return Xi})),n.d(t,"SubjectDataServiceHelper",(function(){return ea})),n.d(t,"SubjectsApplication",(function(){return ru})),n.d(t,"VideoDataService",(function(){return Eo})),n.d(t,"VideoDataServiceHelper",(function(){return go})),n.d(t,"VideosApplication",(function(){return Ou}))}])}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("Formik"),require("ReactBootstrap"),require("ReactRedux"),require("Backbone"),require("SortableHOC"),require("Cropper"),require("Handlebars")):"function"==typeof define&&define.amd?define(["React","@clickview/shared","@clickview/common","Yup","Formik","ReactBootstrap","ReactRedux","Backbone","SortableHOC","Cropper","Handlebars"],t):"object"==typeof exports?exports["@clickview/curator"]=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("Formik"),require("ReactBootstrap"),require("ReactRedux"),require("Backbone"),require("SortableHOC"),require("Cropper"),require("Handlebars")):e["@clickview/curator"]=t(e.React,e["@clickview/shared"],e["@clickview/common"],e.Yup,e.Formik,e.ReactBootstrap,e.ReactRedux,e.Backbone,e.SortableHOC,e.Cropper,e.Handlebars)}(window,(function(e,t,n,r,i,a,o,c,s,u,l){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=22)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=r},function(e,t){e.exports=i},function(e,t){e.exports=a},function(e,t,n){"use strict";var r=n(13);n.o(r,"DomainOptionKind")&&n.d(t,"DomainOptionKind",(function(){return r.DomainOptionKind})),n.o(r,"DomainOptionType")&&n.d(t,"DomainOptionType",(function(){return r.DomainOptionType}));var i=n(15);n.d(t,"DomainOptionKind",(function(){return i.a})),n.d(t,"DomainOptionType",(function(){return i.b}))},function(e,t){e.exports=o},function(e,t,n){e.exports={tree:"_1abau",text:"f13wK",chevron:"_25eVA",disabled:"_1qyCo",parentOfSelected:"_1fgN6",selected:"cVZit",actions:"_2BGWp",node:"rJVbQ",collapsed:"vc2by"}},function(e,t){e.exports=c},function(e,t,n){e.exports={draggableVideoItem:"_1JMCe",draggedVideoItem:"_3jjle"}},function(e,t){e.exports=s},function(e,t,n){e.exports={curatorLayout:"XayF7",topNavRegion:"_3ewaZ",leftNavRegion:"_2c2o6"}},function(e,t,n){"use strict";var r=n(14);n.o(r,"DomainOptionKind")&&n.d(t,"DomainOptionKind",(function(){return r.DomainOptionKind})),n.o(r,"DomainOptionType")&&n.d(t,"DomainOptionType",(function(){return r.DomainOptionType}))},function(e,t){},function(e,t,n){"use strict";var r,i;!function(e){e.Boolean="System.Boolean",e.String="System.String",e.StaffRequest="ClickView.DomainApi.Models.Options.Enums.StaffRequestOption, ClickView.DomainApi.Models, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null",e.Long="System.Int64"}(r||(r={})),function(e){e[e.Permanent=0]="Permanent",e[e.Temporary=1]="Temporary"}(i||(i={})),n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}))},function(e,t,n){var r=n(21);e.exports=(r.default||r).template({compiler:[8,">= 4.3.0"],main:function(e,t,n,r,i){return'<div class="layout-region"></div>'},useData:!0})},function(e,t){e.exports=u},function(e,t,n){e.exports={navContainer:"_11O8h"}},function(e,t,n){e.exports={navContainer:"_3vLoN"}},function(e){e.exports=JSON.parse("{}")},function(e,t){e.exports=l},function(e,t,n){"use strict";n.r(t);n(20);var r={UPLOAD_IMAGE:"upload:image"},i={Subjects:Object.assign({SUBJECTS:"subjects",NEW_SUBJECT:"new:subject",EDIT_SUBJECT:"edit:subject",EDIT_SUBJECT_PLAYLISTS:"edit:subject:playlists",EDIT_SUBJECT_SERIES:"edit:subject:series",EDIT_SUBJECT_VIDEOS:"edit:subject:videos",SUBJECT_CLASSIFICATIONS:"subject:classifications",DELETE_SUBJECT:"delete:subject",ADD_SUBJECT_MEMBERS:"add:subject:members",REMOVE_SUBJECT_MEMBER:"remove:subject:member",CLASSIFICATIONS:"classifications",PRESENTATION_CLASSIFICATIONS:"presentation:classifications",NEW_CLASSIFICATION:"new:classification",EDIT_CLASSIFICATION:"edit:classification",EDIT_CLASSIFICATION_PLAYLISTS:"edit:classification:playlists",EDIT_CLASSIFICATION_SERIES:"edit:classification:series",EDIT_CLASSIFICATION_VIDEOS:"edit:classification:videos",DELETE_CLASSIFICATION:"delete:classification",REMOVE_CLASSIFICATION_MEMBER:"remove:classification:member",LEVELS:"levels",NEW_LEVEL:"new:level",EDIT_LEVEL:"edit:level",AUDIENCES:"audiences",PRESENTATION_AUDIENCES:"presentation:audiences",NEW_AUDIENCE:"new:audience",EDIT_AUDIENCE:"edit:audience",DELETE_AUDIENCE:"delete:audience",PRESENTATIONS:"presentations",NEW_PRESENTATION:"new:presentation",EDIT_PRESENTATION:"edit:presentation"},r),Playlists:Object.assign({PLAYLISTS:"index",NEW_PLAYLIST:"new:playlist",EDIT_PLAYLIST:"edit:playlist",EDIT_PLAYLIST_VIDEOS:"edit:playlist:videos",EDIT_PLAYLIST_SUBJECTS:"edit:playlist:subjects",EDIT_PLAYLIST_AUDIENCES:"edit:playlist:audiences",DELETE_PLAYLIST:"delete:playlist",REMOVE_VIDEO:"remove:video",REMOVE_FROM_SUBJECT:"remove:from:subject"},r),Series:Object.assign({EDIT_SERIES:"edit:series",EDIT_SERIES_VIDEOS:"edit:series:videos",EDIT_SERIES_SUBJECTS:"edit:series:subjects",EDIT_SERIES_AUDIENCES:"edit:series:audiences"},r),Videos:{EDIT_VIDEO:"edit:video",EDIT_VIDEO_AUDIENCES:"edit:video:audiences",EDIT_VIDEO_SUBJECTS:"edit:video:subjects"},DomainOptions:{DOMAIN_OPTIONS:"domain:options",NEW_DOMAIN_OPTION:"new:domain:option",EDIT_DOMAIN_OPTION:"edit:domain:option",DELETE_DOMAIN_OPTION:"delete:domain:option"},People:{PEOPLE:"people",NEW_PERSON:"new:person",EDIT_PERSON:"edit:person"},Companies:{COMPANIES:"companies",NEW_COMPANY:"new:company",EDIT_COMPANY:"edit:company"}},a={SUBJECT:"subject",SUBJECTS:"subjects",UPDATE_SUBJECT:"update:subject",DELETE_SUBJECT:"delete:subject",UPDATE_OBJECT_SUBJECTS:"update:object:subjects",ADD_TO_SUBJECT:"add:to:subject",REMOVE_FROM_SUBJECT:"remove:from:subject",CLASSIFICATION:"classification",CLASSIFICATIONS:"classifications",UPDATE_CLASSIFICATION:"update:classification",DELETE_CLASSIFICATION:"delete:classification",UPDATE_OBJECT_CLASSIFICATIONS:"update:object:classifications",ADD_TO_CLASSIFICATION:"add:to:classification",REMOVE_FROM_CLASSIFICATION:"remove:from:classification",PRESENTATION:"presentation",PRESENTATIONS:"presentations",UPDATE_PRESENTATION:"update:presentation",LEVEL:"level",LEVELS:"levels",UPDATE_LEVEL:"update:level",ADD_TO_LEVEL:"add:to:level",REMOVE_FROM_LEVEL:"remove:from:level",UPDATE_OBJECT_LEVELS:"update:object:levels",AUDIENCE:"audience",AUDIENCES:"audiences",UPDATE_AUDIENCE:"update:audience",DELETE_AUDIENCE:"delete:audience",UPDATE_OBJECT_AUDIENCES:"update:object:audiences",PLAYLIST:"playlist",PLAYLISTS:"playlists",UPDATE_PLAYLIST:"update:playlist",DELETE_PLAYLIST:"delete:playlist",PLAYLIST_VIDEOS:"playlist:videos",REORDER_PLAYLIST_VIDEOS:"reorder:playlist:videos",REMOVE_PLAYLIST_VIDEO:"remove:playlist:video",VIDEO:"video",SERIES:"series",SERIES_BY_ID:"series:by:id",UPDATE_SERIES:"update:series",CURRENT_USER:"current:user",UPLOAD_IMAGE:"upload:image",LOCALE:"locale",PHRASES:"PHRASES"},o={IMAGES:".".concat(["jpg","tif","png","bmp","gif","jpeg"].join(",."))},c={CURATOR_LAYOUT:"CuratorLayout"},s={COMPANIES:"companies:application",DOMAIN_OPTIONS:"domain:options:application",PEOPLE:"people:application",PLAYLISTS:"playlists:application",SERIES:"series:application",SUBJECTS:"subjects:application",VIDEOS:"videos:application"},u={IMAGE_UPLOAD:"image:upload:data:service",PLAYLIST:"playlist:data:service",SERIES:"series:data:service",SUBJECT:"subject:data:service",USER:"user:data:service",VIDEO:"video:data:service",LANGUAGE:"language:data:service"},l={IMAGE_UPLOAD:"ImageUploadDataService",PLAYLIST:"PlaylistDataService",SUBJECT:"SubjectDataService",USER:"UserDataService",VIDEO:"VideoDataService",SERIES:"SeriesDataService",LANGUAGE:"LanguageDataService"},p=n(0),f=n(2),m=n(1),d=n(16),b=n.n(d),y=n(12),v=n.n(y);function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t){return!t||"object"!==S(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function g(e,t,n){return(g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=O(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var T=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=h(this,O(t).call(this,e))).childComponents={},n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&j(e,t)}(t,e),n=t,i=[{key:"getCacheKey",value:function(e){var t="".concat(this.name),n=[];return Object.keys(e).forEach((function(t){n.push("".concat(t,":").concat(e[t]))})),n.length&&(n.sort(),t+=":".concat(n.join(":"))),t}}],(r=[{key:"regions",value:function(){return{layout:".layout-region"}}},{key:"getChildComponents",value:function(){return{topNav:{component:this.childComponents[m.LayoutRegions.TOP_NAV],className:v.a.topNavRegion},leftNav:{component:this.childComponents[m.LayoutRegions.LEFT_NAV],className:"py-3 ".concat(v.a.leftNavRegion)},content:{component:this.childComponents[m.LayoutRegions.CONTENT],className:"position-relative container py-3"},popup:{component:this.childComponents[m.LayoutRegions.POPUP]},alert:{component:this.childComponents[m.LayoutRegions.ALERT]}}}},{key:"unsetRegion",value:function(e){delete this.childComponents[e],this.renderLayout()}},{key:"renderTopNav",value:function(){f.FunctionHelper.isFunction(this.options.getTopNavView)&&(this.childComponents[m.LayoutRegions.TOP_NAV]=this.options.getTopNavView(f.Core.AppLinkHelper.getCurrentAppLink()))}},{key:"hideLeftNav",value:function(){this.unsetRegion(m.LayoutRegions.LEFT_NAV)}},{key:"closePopup",value:function(){this.unsetRegion(m.LayoutRegions.POPUP)}},{key:"showChildView",value:function(e,t){this.childComponents[e]=t,this.renderTopNav(),this.renderLayout()}},{key:"renderLayout",value:function(){var e=Object.assign({provider:this.options.provider},this.getChildComponents());g(O(t.prototype),"showChildView",this).call(this,"layout",this.wrapWithStore(p.createElement(L,Object.assign({},e))))}},{key:"title",get:function(){return!1}},{key:"name",get:function(){return"CuratorLayoutView"}},{key:"template",get:function(){return b.a}},{key:"className",get:function(){return"container-fluid ".concat(v.a.curatorLayout)}}])&&E(n.prototype,r),i&&E(n,i),t}(f.ReactLayoutView),C=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},I=function(e){var t=e.className,n=e.children;return p.createElement("div",{className:t},n)},A=function(e,t){return"".concat(e).concat(t?" ".concat(t):"")},P=function(e){var t=e.topNav,n=e.leftNav,r=e.content,i=e.popup,a=e.alert;return p.createElement(p.Fragment,null,p.createElement("div",{className:"position-relative"},!!t.component&&p.createElement(I,{className:A("top-nav-region",t.className)},t.component),!!n.component&&p.createElement(I,{className:A("left-nav-region",n.className)},n.component),!!r.component&&p.createElement("div",{className:"content-container"},p.createElement(I,{className:A("content-region",r.className)},r.component))),!!i.component&&p.createElement(I,{className:A("popup-region",i.className)},i.component),!!a.component&&p.createElement(I,{className:A("alert-region",a.className)},a.component))},L=function(e){var t=e.provider,n=C(e,["provider"]);return t?p.createElement(t,null,p.createElement(P,Object.assign({},n))):p.createElement(P,Object.assign({},n))};function N(e){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function F(e,t){return!t||"object"!==N(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var x=function(e){function t(){return w(this,t),F(this,_(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&R(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.listenTo(f.CommonChannels.SHELL,f.Core.EventNames.ROUTING_END,this.updateNav)}},{key:"updateNav",value:function(){var e=this,t=f.Core.AppLinkHelper.getCurrentAppLink().application;if(t!==this.currentApplication){this.currentApplication=t;var n=this.options.navItemMappings[t];if(n){var r=document.querySelector(this.options.navSelector);r&&r.children&&k(r.children).forEach((function(t){var r=t.querySelector("a");r&&(r.classList.remove(e.options.currentItemClassName),r.text===n&&r.classList.add(e.options.currentItemClassName))}))}}}},{key:"name",get:function(){return"CuratorAppNavService"}}])&&D(n.prototype,r),i&&D(n,i),t}(f.Core.Service);function U(e){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function M(e,t){return!t||"object"!==U(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function J(e){return(J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e,t){return(H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Y=function(e){function t(){return V(this,t),M(this,J(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&H(e,t)}(t,e),n=t,(r=[{key:"uploadBase64Image",value:function(e,t,n,r){return this.create({resource:"/api/image/upload?type=".concat(t),eventPrefix:a.UPLOAD_IMAGE,data:e,callback:n,errorCallback:r})}},{key:"name",get:function(){return l.IMAGE_UPLOAD}},{key:"channelName",get:function(){return u.IMAGE_UPLOAD}}])&&B(n.prototype,r),i&&B(n,i),t}(f.BaseDataService);function q(e){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function W(e,t){return!t||"object"!==q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Q=function(e){function t(){return K(this,t),W(this,G(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Z(e,t)}(t,e),n=t,(r=[{key:"getCurrentUser",value:function(e,t){return this.get({resource:"/api/currentuser",eventPrefix:a.CURRENT_USER,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"name",get:function(){return l.USER}},{key:"channelName",get:function(){return u.USER}}])&&z(n.prototype,r),i&&z(n,i),t}(f.BaseDataService),X={dataServiceName:l.USER,dataChannelName:u.USER},$={getCurrentUserFetchOptions:function(e,t){return Object.assign(Object.assign({},X),{eventPrefix:a.CURRENT_USER,fetchData:function(e){return e.getCurrentUser()},setData:e,onError:t})}};function ee(e){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function te(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ne(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function re(e,t){return!t||"object"!==ee(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e,t){return(ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var oe=function(e){function t(){return te(this,t),re(this,ie(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ae(e,t)}(t,e),n=t,(r=[{key:"getLanguageConfig",value:function(e){var t={locale:"en",phrases:{}},n=new f.ConcurrencyHelper(3),r=function(){n.decrement(),n.getValue()>0||e(t)};this.get({resource:"/api/locale",eventPrefix:a.LOCALE,expiryTime:m.CacheDurations.STANDARD,callback:function(e){t.locale=e,r()}}),this.get({resource:"/api/phrases/shared",eventPrefix:"".concat(a.PHRASES,":shared"),expiryTime:m.CacheDurations.STANDARD,callback:function(e){null===e.shared&&(e.shared={}),t.phrases=Object.assign(Object.assign({},t.phrases),e),r()}}),this.get({resource:"/api/phrases/subjects",eventPrefix:"".concat(a.PHRASES,":subjects"),expiryTime:m.CacheDurations.STANDARD,callback:function(e){null===e.subjects&&(e.subjects={}),t.phrases=Object.assign(Object.assign({},t.phrases),e),r()}})}},{key:"name",get:function(){return l.LANGUAGE}},{key:"channelName",get:function(){return u.LANGUAGE}}])&&ne(n.prototype,r),i&&ne(n,i),t}(f.BaseDataService),ce=n(7),se=function(e){var t="/api/master/v2/companies";return e?"".concat(t,"?cursor=").concat(e):t},ue=function(e){return"/api/master/v2/objects/".concat(e)},le=function(){return"/api/master/v2/companies"},pe=function(e){return"/api/master/v2/objects/".concat(e)},fe="companies",me="company",de="update:company",be=function(e){return{key:"".concat(fe).concat(e?":".concat(e):""),url:se(e)}},ye=function(e){return{key:"".concat(me,":").concat(e),url:ue(e)}},ve=function(e,t,n){return{key:me,url:le(),data:e,type:f.HttpVerbs.POST,success:t,error:n,invalidationKeys:[fe]}},Se=function(e,t,n){return{key:"".concat(de,":").concat(e),url:pe(e),data:t,type:f.HttpVerbs.PUT,always:n}},Ee=n(3),he=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),ge=n(4);function Oe(e){var t=Object(ge.useFormikContext)();return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this company",autoFocus:!0}),p.createElement(m.FormButtons,{isNew:e.isNew}))}function je(e){return p.createElement(m.FormWrapper,{initialValues:e.company,validationSchema:he,onSubmit:e.saveCompany},p.createElement(Oe,{isNew:!(e.company&&e.company.id)}))}function Te(e){var t=Object(ce.useDispatch)(),n=f.Flight.useBasicFetch(ye(e.id));return p.createElement(p.Fragment,null,!!n.data&&p.createElement(je,{company:n.data,saveCompany:function(n,r){return f.Flight.fetch(t,Se(e.id,n,r))}}))}function Ce(){var e=Object(ce.useDispatch)();return p.createElement(je,{saveCompany:function(t,n){f.Flight.fetch(e,ve(t,(function(e){n(),f.Core.AppLinkHelper.trigger({application:s.PEOPLE,action:i.Companies.EDIT_COMPANY,args:[e.id]})}),n))}})}function Ie(e){var t=e.backToName,n=e.appLink;return p.createElement(m.AppLink,{appLink:n,className:"d-inline-flex align-items-center"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.ArrowLeft,size:m.SvgContainerSize.Small}),p.createElement("span",{className:"ml-1"},"Back to ".concat(t)))}var Ae=n(5);function Pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Le=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Ne(e){var t=e.selected,n=e.onToggle,r=Le(e,["selected","onToggle"]),i=Pe(p.useState(t),2),a=i[0],o=i[1];p.useEffect((function(){return o(t)}),[t]);return p.createElement(Ae.Form.Check,Object.assign({type:"checkbox",id:"checkbox-".concat(f.RandomHelper.getRandomInt()),checked:a,onChange:function(){o(!a),n(!a)}},r))}var ke=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function we(e){var t=e.onFileSelect,n=e.acceptMultiple,r=e.mimeType,i=e.label,a=e.error,o=e.touched,c=ke(e,["onFileSelect","acceptMultiple","mimeType","label","error","touched"]),s="custom-file-input cursor-pointer";a&&o&&(s+=" is-invalid");var u=Object.assign({type:"file",className:s,onChange:function(e){var n=e.currentTarget.files;n&&n.length&&f.FunctionHelper.isFunction(t)&&t(n)},autoComplete:"off",value:"",multiple:!!n},r?{accept:r}:{});return p.createElement("div",{className:"form-group"},p.createElement("div",{className:"custom-file"},p.createElement(ge.Field,Object.assign({},u,c),e.children),p.createElement(Ae.Form.Label,{className:"custom-file-label",htmlFor:c.id},i)))}var De,Fe={onFileSelect:function(e,t,n){if(t&&t.length){var r=new FileReader;r.addEventListener("load",(function(){return Fe.onReaderLoad(r,e,n)})),r.readAsDataURL(t[0])}},onReaderLoad:function(e,t,n){var r=new Image;r.src=e.result;var i=m.ImageMinDimensions[t].width,a=m.ImageMinDimensions[t].height;r.addEventListener("load",(function(){Fe.isImageValid(t,r)&&f.FunctionHelper.isFunction(n)?n(r):alert("Image too small: minimum dimensions are ".concat(i," x ").concat(a))}))},isImageValid:function(e,t){var n=m.ImageMinDimensions[e].width,r=m.ImageMinDimensions[e].height;return!(n&&t.width<n)&&!(r&&t.height<r)}},_e={isItemActive:function(e,t){return t||(t=f.Core.AppLinkHelper.getCurrentAppLink()),t.application===e.appLink.application&&(Array.isArray(e.activeActions)?e.activeActions.includes(t.action):t.action===e.appLink.action)}};!function(e){e.Developer="Curator Devs",e.Curator="Curators",e.Support="Support",e.SalesSupport="Sales Support"}(De||(De={}));var Re=function(){return[{value:"protected",access:"r"}]},xe=function(e){return He.getGroupNames(e).includes(De.Developer)},Ue=function(e){return Object.values(e).every((function(e){return!!e}))},Ve=function(e,t){return!!e&&!!t&&e.toString()===t.toString()},Be=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function Me(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var Je={find:function(e,t){if(e&&e.children&&e.children.length)for(var n=function e(n){if(Ve(n.id,t))return n;var r=n.children;if(r&&r.length)for(var i=0;i<r.length;i++){var a=e(r[i]);if(a)return a}},r=0;r<e.children.length;r++){var i=n(e.children[r]);if(i)return i}},getPath:function(e,t){for(var n=[t],r=function(e){return e.hasOwnProperty("parentIds")&&Array.isArray(e.parentIds)&&e.parentIds.length?e.parentIds[0]:e.hasOwnProperty("parentId")?e.parentId:null},i=r(t);i;){var a=Je.find(e,i);a&&(n=[a].concat(Me(n))),i=a?r(a):null}return n}},He={getGroupNames:function(e){return e&&e.groups?e.groups.map((function(e){return e.name})):[]}};function Ye(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var qe=p.createContext(void 0),Ke=function(e){var t=e.children,n=Ye(p.useState(),2),r=n[0],i=n[1],a=Ye(p.useState(!1),2),o=a[0],c=a[1],s=Ye(p.useState(),2),u=s[0],l=s[1],f={getDataUrl:function(){var e=r;return i(null),e},setDataUrl:i,imageUploaded:o,getImage:function(){var e=u;return l(null),c(!1),e},setImage:function(e){l(e),c(!0)}};return p.createElement(qe.Provider,{value:f},t)};function ze(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var We,Ge=p.createContext(void 0);function Ze(e){var t=e.children,n=ze(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(m.UserDataServiceHelper.getCurrentUserFetchOptions(i),[]),p.createElement(Ge.Provider,{value:r},t)}function Qe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $e=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},et=(Xe(We={},m.ImageType.Thumbnails,"Thumbnail"),Xe(We,m.ImageType.Banners,"Banner"),Xe(We,m.ImageType.Avatars,"Avatar"),Xe(We,m.ImageType.Logos,"Logo"),Xe(We,m.ImageType.Covers,"Cover"),Xe(We,m.ImageType.Posters,"Poster"),Xe(We,m.ImageType.TallPosters,"Poster"),We);function tt(e){var t=e.imageType,n=e.currentImage,r=e.setNewImage,i=e.application,a=e.uploadAction,c=$e(e,["imageType","currentImage","setNewImage","application","uploadAction"]),s=p.useContext(qe),u=s.setDataUrl,l=s.getImage,d=s.imageUploaded,b=Qe(p.useState(!1),2),y=b[0],v=b[1],S=Qe(p.useState(n),2),E=S[0],h=S[1],g=Qe(p.useState(!1),2),O=g[0],j=g[1],T=function(e){v(!0),u(e.src),f.Core.AppLinkHelper.trigger({application:i,action:a,args:[t]})};return p.useEffect((function(){if(y){var e=l();e&&(v(!1),h(e),r({fileId:e.id,fileIdType:m.FileIdType.ImageAPIv2}))}}),[d]),p.createElement("div",{className:"form-group"},p.createElement("div",{className:"form-control h-auto py-2"},p.createElement("label",null,et[t]),p.createElement("em",{className:"ml-1 text-muted"},"(Minimum dimensions are ".concat(m.ImageMinDimensions[t].width,"px")+" x ".concat(m.ImageMinDimensions[t].height,"px)")),p.createElement(we,Object.assign({label:"Choose a ".concat(et[t].toLowerCase()),name:"image",mimeType:o.IMAGES,onFileSelect:function(e){return Fe.onFileSelect(t,e,T)}},c)),!!E&&!!E.url&&p.createElement(p.Fragment,null,!O&&p.createElement("div",{className:"pb-2 ".concat(t===m.ImageType.Banners?"w-100":"w-50")},p.createElement("img",{src:m.ImageHelper.createUrl(E.url),className:"img img-fluid"})),p.createElement("div",{className:"d-flex justify-content-center"},p.createElement(m.SvgContainer,{svgName:O?m.cvSvgLibrary.ChevronDown:m.cvSvgLibrary.ChevronUp,size:m.SvgContainerSize.Large,className:"svg-container cursor-pointer",onClick:function(){return j(!O)},title:O?"Show image":"Hide image",tooltipPlacement:"top"})))))}var nt,rt=n(17),it=n.n(rt);function at(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}!function(e){e[e.NoRestrictions=0]="NoRestrictions",e[e.RestrictToCanvas=1]="RestrictToCanvas"}(nt||(nt={}));var ot=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function ct(e){var t=e.dataUrl,n=e.minHeight,r=e.minWidth,i=e.onCrop,a=e.onCancel,o=p.useRef(),c=p.useRef(),s=at(p.useState(!1),2),u=s[0],l=s[1],d=at(p.useState(!1),2),b=d[0],y=d[1];return p.useEffect((function(){var e=new Image;e.src=t;var i=o.current.offsetWidth/e.width;return c.current=new it.a(o.current,{viewMode:nt.RestrictToCanvas,autoCropArea:1,aspectRatio:r/n,minCropBoxWidth:r*i,minCropBoxHeight:n*i,ready:function(){return l(!0)}}),function(){return c.current.destroy()}}),[]),p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement("img",{ref:o,src:t,className:"img img-fluid mw-100"})),p.createElement("div",{className:"d-flex justify-content-end border-top pt-3"},p.createElement(Ae.Button,{variant:"link",onClick:a},"Cancel"),p.createElement(m.SpinnerButton,{onClick:function(){if(u){y(!0);var e=c.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(ot);if(t)return t[1]}(t));f.FunctionHelper.isFunction(i)&&i(e)}},disabled:!u,showSpinner:b},"Crop")))}function st(e){if(!e.collection)return p.createElement(p.Fragment,null);var t=e.collection,n=t.data,r=t.pagination;return p.createElement(p.Fragment,null,!!n&&p.createElement(pt,{objects:n,getObjectAppLink:e.getObjectAppLink,newObjectAppLink:e.newObjectAppLink,objectName:e.objectName}),!!r&&!!r.cursors&&p.createElement(m.Pagination,{cursors:r.cursors,appLink:e.collectionAppLink}))}function ut(e){var t=e.object,n=e.actions;return p.createElement("div",{className:"d-flex justify-content-between py-2"},!!t&&p.createElement("h5",null,t.name),!!n&&p.createElement("span",null,p.createElement(m.Actions,{actions:n})))}function lt(e){return p.createElement("tr",null,p.createElement("td",null,p.createElement(m.AppLink,{appLink:e.appLink},e.object.name)),p.createElement("td",null))}function pt(e){return p.createElement(Ae.Table,{responsive:!0},p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,"Name"),p.createElement("th",null,p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.AppLink,{appLink:e.newObjectAppLink},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New ".concat(e.objectName))))))),p.createElement("tbody",null,e.objects.map((function(t){return p.createElement(lt,{key:t.id,object:t,appLink:e.getObjectAppLink(t)})}))))}function ft(e){var t=e.objects,n=e.getAppLink,r=e.emptyMessage;return t?t.length?p.createElement("ul",{className:"list-unstyled"},t.map((function(e,t){return p.createElement("li",{key:t,className:"border rounded mb-3"},p.createElement(m.AppLink,{appLink:n(e),className:"d-block p-3"},e.name))}))):p.createElement("div",{className:"py-3"},p.createElement("p",null,r)):p.createElement(p.Fragment,null)}ft.defaultProps={emptyMessage:"There is nothing here."};function mt(e){var t=Object(ge.useFormikContext)();return p.createElement(m.FormField,{as:"select",label:"Rating",name:"rating",id:"rating",value:t.values.rating&&t.values.rating.id,onChange:function(e){return t.setFieldValue("rating",e.target.value?{id:e.target.value}:{})}},p.createElement(p.Fragment,null,p.createElement("option",{value:""},"Please select a rating"),e.ratings.map((function(e,t){return p.createElement("option",{key:t,value:e.id},function(e){return"".concat(e.name).concat(e.code?" (".concat(e.code,")"):"")}(e))}))))}function dt(e){var t=e.tabs,n=e.isItemActive;return p.createElement(Ae.Nav,{fill:!0,variant:"tabs"},t.map((function(e,t){return p.createElement(Ae.Nav.Item,{key:t},p.createElement(Ae.Nav.Link,{as:m.AppLink,appLink:e.appLink,active:n(e)},e.label))})))}dt.defaultProps={isItemActive:_e.isItemActive};var bt=n(8),yt=n.n(bt);function vt(e){var t=e.name,n=e.appLink,r=e.onSelect,i=e.isDisabled,a=e.className,o=e.actions,c=yt.a.text;return a&&(c+=" ".concat(a)),i?p.createElement("a",{className:"".concat(c," text-muted ").concat(yt.a.disabled)},t):p.createElement(p.Fragment,null,n?p.createElement(m.AppLink,{appLink:n,className:c},t):p.createElement("a",{onClick:r,className:c},t),!!o&&p.createElement(m.Actions,{className:yt.a.actions,actions:o}))}function St(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Et(e){var t=e.tree,n=e.selectedIds,r=e.getAppLink,i=e.onSelect,a=e.isDisabled,o=e.actions,c=Array.isArray(n)&&n.some((function(e){return Ve(t.id,e)})),s=p.useMemo((function(){return Array.isArray(n)&&n.some((function(e){return Je.find(t,e)}))}),[t,n]),u=St(p.useState(s),2),l=u[0],d=u[1],b=!!t.children&&!!t.children.length,y={name:t.name,appLink:f.FunctionHelper.isFunction(r)?r(t):null,onSelect:f.FunctionHelper.isFunction(i)?function(){return i(t)}:null,isDisabled:!!f.FunctionHelper.isFunction(a)&&a(t),className:c&&yt.a.selected||s&&yt.a.parentOfSelected,actions:!!o&&o.map((function(e){return Object.assign(Object.assign({},e),{appLink:e.getAppLink(t)})}))};return p.createElement("li",{className:"position-relative".concat(l?"":" ".concat(yt.a.collapsed))},p.createElement("div",{className:"position-relative"},p.createElement("span",{className:yt.a.node},b&&p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.ChevronDown,size:m.SvgContainerSize.Small,className:"svg-container ".concat(yt.a.chevron),onClick:function(){return d(!l)}}),p.createElement(vt,Object.assign({},y))),l&&p.createElement(gt,Object.assign({},e))))}var ht=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function gt(e){var t=e.tree,n=ht(e,["tree"]);return t&&t.children?p.createElement("ul",{className:"m-0 p-0 ".concat(yt.a.tree)},t.children.map((function(e){return p.createElement(Et,Object.assign({key:e.id,tree:e},n))}))):p.createElement(p.Fragment,null)}var Ot={getChord:function(e,t){return Je.getPath(e,t).map((function(e){return e.name})).join(" -> ")},getState:function(e,t){var n={};return Array.isArray(e)&&e.forEach((function(e){var r,i,a,o=Je.find(t,e);o&&(n=Object.assign((r={},i=e,a=Ot.getChord(t,o),i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r),n))})),n}};function jt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Tt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Ct(e){var t=e.onSelect,n=e.label,r=e.hideCollapseBtn,i=e.collapse,a=e.noSelectionMessage,o=e.isNodeDisabled,c=e.getSelectedItemAppLink,s=Tt(e,["onSelect","label","hideCollapseBtn","collapse","noSelectionMessage","isNodeDisabled","getSelectedItemAppLink"]),u=s.tree,l=s.selectedIds,d=jt(p.useState(Ot.getState(l,u)),2),b=d[0],y=d[1];p.useEffect((function(){return y(Ot.getState(l,u))}),[l,u]);var v=jt(p.useState(!!i),2),S=v[0],E=v[1];p.useEffect((function(){return E(!!i)}),[i]);var h=!r||!!n;return p.createElement(p.Fragment,null,h&&p.createElement("div",{className:"pb-2"},!!n&&p.createElement("label",{className:"m-0"},n),!r&&p.createElement("a",{className:"float-right cursor-pointer",onClick:function(){return E(!S)}},S?"Expand":"Collapse")),!S&&p.createElement("div",{className:"py-2 border-top"},p.createElement(gt,Object.assign({onSelect:function(e){return f.FunctionHelper.isFunction(t)&&t(e)},isDisabled:o},s))),(!f.ObjectHelper.isEmpty(b)||!!a)&&p.createElement("div",{className:"py-2 border-top"},p.createElement("label",null,"Selected:"),p.createElement("ul",{className:"m-0"},f.ObjectHelper.isEmpty(b)?p.createElement("li",null,a):Object.keys(b).map((function(e,t){return p.createElement("li",{key:t},f.FunctionHelper.isFunction(c)?p.createElement(m.AppLink,{appLink:c(e)},b[e]):b[e])})))))}var It=n(11),At=function(e){var t="bg-white";return e&&(t+=" ".concat(e)),t};function Pt(e){var t=e.video,n=e.getVideoAppLink,r=e.getVideoActions,i=e.className,a=void 0===i?"":i,o=e.itemNumber,c=f.FunctionHelper.isFunction(n)&&n(t);return p.createElement("tr",{className:At(a)},!!o&&p.createElement("td",null,p.createElement("span",null,o)),p.createElement("td",null,c?p.createElement(m.AppLink,{appLink:c},t.name):t.name),f.FunctionHelper.isFunction(r)&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(m.Actions,{actions:r(t)}))))}var Lt=Object(It.SortableElement)((function(e){return p.createElement(Pt,Object.assign({sortable:!0},e))})),Nt=n(10),kt=n.n(Nt),wt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Dt=function(e){var t=e.sortable,n=e.getVideoActions;return p.createElement("thead",null,p.createElement("tr",null,!!t&&p.createElement("th",null,"#"),p.createElement("th",null,"Name"),!!n&&p.createElement("th",null)))},Ft=p.forwardRef((function(e,t){var n=e.videos,r=e.sortable,i=wt(e,["videos","sortable"]);return p.createElement("tbody",{ref:t},!m.CollectionHelper.isEmpty(n)&&n.data.map((function(e,t){return r?p.createElement(Lt,Object.assign({key:e.id,index:t,itemNumber:t+1,video:e,className:kt.a.draggableVideoItem},i)):p.createElement(Pt,Object.assign({video:e},i))})))}));var _t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Rt=Object(It.SortableContainer)((function(e){var t=e.forwardedRef,n=_t(e,["forwardedRef"]);return p.createElement(Ft,Object.assign({sortable:!0,ref:t},n))})),xt=function(e){return function(t){var n=t.node,r=e.current;if(r){r.classList.add(kt.a.sortingContainer);var i=r.querySelector(".".concat(kt.a.draggedVideoItem));n.childNodes.forEach((function(e,t){return i.childNodes[t].style.width="".concat(e.offsetWidth,"px")}))}}},Ut=function(e,t){return function(n){var r=e.current;r&&r.classList.remove(kt.a.sortingContainer),t(n.oldIndex,n.newIndex)}};function Vt(e){var t=e.onSortEnd,n=e.emptyMessage,r=_t(e,["onSortEnd","emptyMessage"]),i=p.useRef();return m.CollectionHelper.isEmpty(e.videos)?p.createElement("div",null,n):p.createElement(Ae.Table,{responsive:!0},p.createElement(Dt,Object.assign({sortable:!0},e)),p.createElement(Rt,Object.assign({forwardedRef:i,onSortStart:xt(i),onSortEnd:Ut(i,t),lockAxis:"y",lockToContainerEdges:!0,distance:1,helperClass:kt.a.draggedVideoItem,helperContainer:function(){return i.current}},r)))}Vt.defaultProps={emptyMessage:"There are no videos in this list."};var Bt=s.COMPANIES,Mt=function(e){return{application:Bt,action:i.Companies.EDIT_COMPANY,args:[e.id]}},Jt=function(e){return f.Core.AppLinkHelper.trigger(Mt(e))};function Ht(e){var t=f.Flight.useBasicFetch(be(e.cursor));return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3 w-50"},p.createElement(m.SearchBar,{placeholder:"Search for a company",onSuggestionSelected:Jt,getRemoteUrl:function(e){return"".concat("/api/domain/v1/search/companies/instant/raw","?q=").concat(e)},activationLength:2})),p.createElement(st,{collection:t&&t.data,collectionAppLink:{application:Bt,action:i.Companies.COMPANIES},newObjectAppLink:{application:Bt,action:i.Companies.NEW_COMPANY},getObjectAppLink:Mt,objectName:"Company"}))}function Yt(e){return(Yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function qt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function zt(e,t,n){return t&&Kt(e.prototype,t),n&&Kt(e,n),e}function Wt(e,t){return!t||"object"!==Yt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Gt(e){return(Gt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Zt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qt(e,t)}function Qt(e,t){return(Qt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Xt=function(e){function t(){return qt(this,t),Wt(this,Gt(t).apply(this,arguments))}return Zt(t,e),zt(t,[{key:"channelName",get:function(){return s.COMPANIES}},{key:"appRoutes",get:function(){return{"manage/companies(/)":"companies","manage/companies/new(/)":"newCompany","manage/companies/:id(/)":"editCompany"}}}]),t}(f.Core.AppRouter),$t=function(e){function t(){return qt(this,t),Wt(this,Gt(t).apply(this,arguments))}return Zt(t,e),zt(t,[{key:"companies",value:function(e){var t=e.cursor;this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ht,{cursor:t}))}},{key:"newCompany",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ce,null))}},{key:"editCompany",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Te,{id:e}))}},{key:"name",get:function(){return"Companies Application"}},{key:"channelName",get:function(){return s.COMPANIES}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return Xt}}]),t}(f.Core.Application),en=n(9),tn=n(6),nn={namespace:"domain_options"},rn=function(){return"/api/domain/v3/settings/types"},an=function(e){return"/api/domain/v3/settings/types/".concat(e)},on=function(){return"/api/domain/v3/settings/types"},cn=function(e){return"/api/domain/v3/settings/types/".concat(e)},sn=function(e){return"/api/domain/v3/settings/types/".concat(e)},un="domain:options",ln="domain:option",pn="update:domain:option",fn="delete:domain:option",mn=function(){return{key:un,url:rn(),normalizeOptions:nn}},dn=function(e){return{key:"".concat(ln,":").concat(e),url:an(e),normalizeOptions:nn}},bn=function(e,t,n){return e.type===tn.DomainOptionType.String&&(e=Sn(e)),{key:ln,url:on(),data:e,type:f.HttpVerbs.POST,success:t,error:n,invalidationKeys:[un],normalizeOptions:nn}},yn=function(e,t){return e.type===tn.DomainOptionType.String&&(e=Sn(e)),{key:"".concat(pn,":").concat(e.id),url:cn(e.id),data:e,type:f.HttpVerbs.PUT,always:t,formatData:function(){return e},normalizeOptions:nn}},vn=function(e,t){return{key:"".concat(fn,":").concat(e),url:sn(e),type:f.HttpVerbs.DELETE,invalidationKeys:[un],normalizeOptions:nn,success:t}};function Sn(e){var t=e.defaultValue;if('"'===t)return Object.assign(Object.assign({},e),{defaultValue:'"'.concat(t,'"')});var n=t.charAt(0),r=t.charAt(t.length-1);return'"'!==n&&(t='"'.concat(t)),'"'!==r&&(t="".concat(t,'"')),Object.assign(Object.assign({},e),{defaultValue:t})}function En(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function hn(e){var t=En(p.useState(!1),2),n=t[0],r=t[1],a=f.Flight.useBasicFetch(dn(e.optionId)),o=Object(ce.useDispatch)(),c=function(){e.closePopup(),f.Core.AppLinkHelper.trigger({application:s.DOMAIN_OPTIONS,action:i.DomainOptions.DOMAIN_OPTIONS})};return p.createElement(m.Popup,{title:"Delete Domain Option",closePopup:e.closePopup,showLoadingSpinner:!a.data},a.data&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.data.name),"?")),p.createElement(m.PopupButtons,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){r(!0),f.Flight.fetch(o,vn(e.optionId,c))},buttonText:"Yes, delete this domain option",isSpinnerButton:!0,showSpinner:n}]})))}var gn=function(e){return{application:s.DOMAIN_OPTIONS,action:i.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]}},On={application:s.DOMAIN_OPTIONS,action:i.DomainOptions.NEW_DOMAIN_OPTION};function jn(){var e=f.Flight.useBasicFetch(mn());if(!e.data)return p.createElement(p.Fragment,null);var t=e.data.map((function(e){return e.displayName&&(e.name=e.displayName),e}));return p.createElement(p.Fragment,null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a domain option type to edit:"),p.createElement(m.AppLink,{appLink:On,className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Domain Option"))),p.createElement(ft,{objects:t,getAppLink:gn}))}var Tn=Ee.object().shape({id:Ee.string(),name:Ee.string().trim().max(64,"Name is too long").required("Name is required").default(""),displayName:Ee.string().trim().max(255,"Display name is too long").default(""),type:Ee.mixed().required("Type is required").default(tn.DomainOptionType.Boolean),entityType:Ee.mixed().required("Entity type is required").default(m.MasterType.Customer),kind:Ee.mixed().required("Kind is required").default(tn.DomainOptionKind.Temporary),defaultValue:Ee.mixed().required("Default value is required").default("false")}).noUnknown();function Cn(e){var t=e.type,n=e.defaultValue;if(!t)return p.createElement(p.Fragment,null);var r={label:"Default Value",name:"defaultValue",id:"defaultValue",value:n};return t===tn.DomainOptionType.Boolean?p.createElement(m.FormField,Object.assign({as:"select"},r),p.createElement("option",{value:"true"},"True"),p.createElement("option",{value:"false"},"False")):t===tn.DomainOptionType.Long||t===tn.DomainOptionType.StaffRequest?p.createElement(m.FormField,Object.assign({as:"input",type:"number"},r)):t===tn.DomainOptionType.String?p.createElement(m.FormField,Object.assign({as:"input"},r)):void 0}var In=[m.MasterType.Customer,m.MasterType.User];function An(e){var t=null===e.id||void 0===e.id,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name (snake_case)",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this domain option",autoFocus:!0}),p.createElement(m.FormField,{label:"Display Name",type:"text",name:"displayName",id:"displayName",value:n.values.displayName,placeholder:"Enter a display name for this domain option"}),p.createElement(m.FormField,{as:"select",label:"Kind",name:"kind",id:"kind",value:n.values.kind},f.ObjectHelper.getEnumKeys(tn.DomainOptionKind).map((function(e){return p.createElement("option",{key:e,value:tn.DomainOptionKind[e]},e)}))),p.createElement(m.FormField,{as:"select",label:"Entity",name:"entityType",id:"entityType",value:n.values.entityType},f.ObjectHelper.getEnumKeys(m.MasterType).filter((function(e){return In.includes(m.MasterType[e])})).map((function(e){return p.createElement("option",{key:e,value:m.MasterType[e]},e)}))),p.createElement(m.FormField,{as:"select",label:"Type",name:"type",id:"type",value:n.values.type},f.ObjectHelper.getEnumKeys(tn.DomainOptionType).map((function(e){return p.createElement("option",{key:e,value:tn.DomainOptionType[e]},e)}))),p.createElement(Cn,{type:n.values.type,defaultValue:n.values.defaultValue}),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.DOMAIN_OPTIONS,action:i.DomainOptions.DELETE_DOMAIN_OPTION,args:[e.id]}},"Delete")))}function Pn(e){return p.createElement(m.FormWrapper,{initialValues:e.domainOption,validationSchema:Tn,onSubmit:e.saveDomainOption},p.createElement(An,{id:e.domainOption&&e.domainOption.id}))}function Ln(){var e=Object(ce.useDispatch)();return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Domain Option"),p.createElement(Pn,{saveDomainOption:function(t,n){f.Flight.fetch(e,bn(t,(function(e){n(),f.Core.AppLinkHelper.trigger({application:s.DOMAIN_OPTIONS,action:i.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]})}),n))}}))}function Nn(e){var t=e.optionId,n=f.Flight.useBasicFetch(dn(t)),r=Object(ce.useDispatch)();return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Domain Option"),n.data&&p.createElement(Pn,{domainOption:n.data,saveDomainOption:function(e,t){return f.Flight.fetch(r,yn(e,t))}}))}function kn(e){return(kn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function wn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Fn(e,t,n){return t&&Dn(e.prototype,t),n&&Dn(e,n),e}function _n(e,t){return!t||"object"!==kn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Rn(e){return(Rn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Un(e,t)}function Un(e,t){return(Un=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Vn=function(e){function t(){return wn(this,t),_n(this,Rn(t).apply(this,arguments))}return xn(t,e),Fn(t,[{key:"channelName",get:function(){return s.DOMAIN_OPTIONS}},{key:"appRoutes",get:function(){return{"developer/options(/)":"domainOptions","developer/options/new(/)":"newDomainOption","developer/options/:id(/)":"editDomainOption"}}},{key:"appLinks",get:function(){return["deleteDomainOption"]}}]),t}(f.Core.AppRouter),Bn=function(e){function t(){return wn(this,t),_n(this,Rn(t).apply(this,arguments))}return xn(t,e),Fn(t,[{key:"domainOptions",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(jn,null))}},{key:"newDomainOption",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ln,null))}},{key:"editDomainOption",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Nn,{optionId:e}))}},{key:"deleteDomainOption",value:function(e){this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(hn,Object.assign({optionId:e},this.getPopupProps())))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return en.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Domain Options Application"}},{key:"channelName",get:function(){return s.DOMAIN_OPTIONS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return Vn}}]),t}(f.Core.Application),Mn=function(e){return e?"".concat("/api/master/v2/people","?cursor=").concat(e):"/api/master/v2/people"},Jn=function(e){return"/api/master/v2/objects/".concat(e)},Hn=function(){return"/api/master/v2/people"},Yn=function(e){return"/api/master/v2/objects/".concat(e)},qn="people",Kn="person",zn="update:person",Wn=function(e){return{key:"".concat(qn).concat(e?":".concat(e):""),url:Mn(e)}},Gn=function(e){return{key:"".concat(Kn,":").concat(e),url:Jn(e)}},Zn=function(e,t,n){return{key:Kn,url:Hn(),data:e,type:f.HttpVerbs.POST,success:t,error:n,invalidationKeys:[qn]}},Qn=function(e,t,n){return{key:"".concat(zn,":").concat(e),url:Yn(e),data:t,type:f.HttpVerbs.PUT,always:n}},Xn=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown();function $n(e){var t=Object(ge.useFormikContext)();return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this person",autoFocus:!0}),p.createElement(m.FormButtons,{isNew:e.isNew}))}function er(e){return p.createElement(m.FormWrapper,{initialValues:e.person,validationSchema:Xn,onSubmit:e.savePerson},p.createElement($n,{isNew:!(e.person&&e.person.id)}))}function tr(e){var t=Object(ce.useDispatch)(),n=f.Flight.useBasicFetch(Gn(e.id));return p.createElement(p.Fragment,null,!!n.data&&p.createElement(er,{person:n.data,savePerson:function(n,r){return f.Flight.fetch(t,Qn(e.id,n,r))}}))}function nr(){var e=Object(ce.useDispatch)();return p.createElement(er,{savePerson:function(t,n){f.Flight.fetch(e,Zn(t,(function(e){n(),f.Core.AppLinkHelper.trigger({application:s.PEOPLE,action:i.People.EDIT_PERSON,args:[e.id]})}),n))}})}var rr=s.PEOPLE,ir=function(e){return{application:rr,action:i.People.EDIT_PERSON,args:[e.id]}},ar=function(e){return f.Core.AppLinkHelper.trigger(ir(e))};function or(e){var t=f.Flight.useBasicFetch(Wn(e.cursor));return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3 w-50"},p.createElement(m.SearchBar,{placeholder:"Search for a person",onSuggestionSelected:ar,getRemoteUrl:function(e){return"".concat("/api/domain/v1/search/people/instant/raw","?q=").concat(e)},activationLength:2})),p.createElement(st,{collection:t&&t.data,collectionAppLink:{application:rr,action:i.People.PEOPLE},newObjectAppLink:{application:rr,action:i.People.NEW_PERSON},getObjectAppLink:ir,objectName:"Person"}))}function cr(e){return(cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function sr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ur(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function lr(e,t,n){return t&&ur(e.prototype,t),n&&ur(e,n),e}function pr(e,t){return!t||"object"!==cr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function fr(e){return(fr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function mr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dr(e,t)}function dr(e,t){return(dr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var br=function(e){function t(){return sr(this,t),pr(this,fr(t).apply(this,arguments))}return mr(t,e),lr(t,[{key:"channelName",get:function(){return s.PEOPLE}},{key:"appRoutes",get:function(){return{"manage/people(/)":"people","manage/people/new(/)":"newPerson","manage/people/:id(/)":"editPerson"}}}]),t}(f.Core.AppRouter),yr=function(e){function t(){return sr(this,t),pr(this,fr(t).apply(this,arguments))}return mr(t,e),lr(t,[{key:"people",value:function(e){var t=e.cursor;this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(or,{cursor:t}))}},{key:"newPerson",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(nr,null))}},{key:"editPerson",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(tr,{id:e}))}},{key:"name",get:function(){return"People Application"}},{key:"channelName",get:function(){return s.PEOPLE}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return br}}]),t}(f.Core.Application);function vr(e){return(vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Sr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Er(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function hr(e,t){return!t||"object"!==vr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function gr(e){return(gr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Or(e,t){return(Or=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var jr,Tr=function(e){return"/api/master/v2/objects/".concat(e,"?query=cover,banner")},Cr=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},Ir=function(e){return"/api/master/v2/objects/".concat(e,"/playlists")},Ar=function(e){return"/api/master/v2/objects/".concat(e)},Pr=function(e){return"/api/master/v1/playlists/".concat(e)},Lr=function(e,t,n){var r="/api/master/v2/objects/".concat(e,"/").concat(t);return n&&(r+="?query=".concat(n)),r},Nr=function(e){return"/api/master/v1/objects/".concat(e,"/videos/reorder")},kr=function(e,t){return"/api/master/v1/playlists/".concat(e,"/dissociate/").concat(t)};!function(e){e.Videos="videos"}(jr||(jr={}));var wr=function(e){function t(){return Sr(this,t),hr(this,gr(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Or(e,t)}(t,e),n=t,(r=[{key:"getPlaylist",value:function(e,t,n){return this.get({resource:Tr(e),eventPrefix:"".concat(a.PLAYLIST,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getPlaylistsById",value:function(e,t,n){return this.get({resource:Cr(e),eventPrefix:"".concat(a.PLAYLISTS,":").concat(e.join(",")),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPlaylist",value:function(e,t,n,r){return this.create({resource:Ir(t),data:Object.assign(Object.assign({},e),{permissions:Re()}),callback:n,errorCallback:r,eventPrefix:a.PLAYLIST,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created playlist."),errorHandler:this.alertService.error("Failed to create playlist.")})}},{key:"updatePlaylist",value:function(e,t,n,r){return this.update({resource:Ar(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PLAYLIST,":").concat(e),invalidationKeys:["".concat(a.PLAYLIST,":").concat(e),a.PLAYLISTS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated playlist"),errorHandler:this.alertService.error("Failed to update playlist")})}},{key:"deletePlaylist",value:function(e,t,n){return this.delete({resource:Pr(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_PLAYLIST,invalidationKeys:["".concat(a.PLAYLIST,":").concat(e)],successHandler:this.alertService.success("Successfully deleted playlist"),errorHandler:this.alertService.error("Failed to delete playlist.")})}},{key:"getPlaylistVideos",value:function(e,t,n){return this.get({resource:Lr(e,jr.Videos,"{orderBy:orderindex,limit:100}"),callback:t,errorCallback:n,eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(jr.Videos),expiryTime:m.CacheDurations.STANDARD})}},{key:"reorderVideos",value:function(e,t,n){return this.update({resource:Nr(e),data:Object.assign({ownerId:e},t),eventPrefix:a.REORDER_PLAYLIST_VIDEOS,expiryTime:m.CacheDurations.STANDARD,invalidationKeys:["".concat(a.PLAYLIST,":").concat(e,":videos")],callback:n,errorHandler:this.alertService.error("Failed to update playlist order.")})}},{key:"removeVideoFromPlaylist",value:function(e,t,n,r){return this.delete({resource:kr(e,t),eventPrefix:"".concat(a.REMOVE_PLAYLIST_VIDEO,":").concat(e,":").concat(t),invalidationKeys:["".concat(a.PLAYLIST,":").concat(e,":videos")],callback:n,errorCallback:r})}},{key:"name",get:function(){return l.PLAYLIST}},{key:"channelName",get:function(){return u.PLAYLIST}}])&&Er(n.prototype,r),i&&Er(n,i),t}(f.BaseDataService),Dr={dataServiceName:l.PLAYLIST,dataChannelName:u.PLAYLIST},Fr={getPlaylistFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Dr),{eventPrefix:"".concat(a.PLAYLIST,":").concat(e),fetchData:function(t){return t.getPlaylist(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_PLAYLIST})},getPlaylistsByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Dr),{eventPrefix:"".concat(a.PLAYLISTS,":").concat(e.join(",")),fetchData:function(t){return t.getPlaylistsById(e)},setData:t,onError:n})},getPlaylistVideosFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Dr),{eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(jr.Videos),fetchData:function(t){return t.getPlaylistVideos(e)},setData:t,onError:n})}};function _r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Rr(e){var t=e.imageType,n=e.closePopup,r=p.useContext(qe),i=r.getDataUrl,a=r.setImage,o=_r(p.useState(i()),1)[0],c=_r(p.useState(!1),2),s=c[0],u=c[1],d=Object(f.useService)(l.IMAGE_UPLOAD),b=function(e){a(e),n()},y={dataUrl:o,imageType:t,minWidth:m.ImageMinDimensions[t].width,minHeight:m.ImageMinDimensions[t].height,onCrop:function(e){return d.uploadBase64Image(e,t,b,n)},onCancel:n};return p.createElement(m.Popup,{title:"Crop Image",closePopup:n,onEntered:function(){return u(!0)}},s&&p.createElement(ct,Object.assign({},y)))}var xr=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Ke,null,t))};function Ur(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Vr(e){var t=e.playlistId,n=e.closePopup,r=Ur(p.useState(),2),a=r[0],o=r[1],c=Ur(p.useState(!1),2),u=c[0],d=c[1],b=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)(Fr.getPlaylistFetchOptions(t,o),[t]);var y=p.useCallback((function(){n(),f.Core.AppLinkHelper.trigger({application:s.PLAYLISTS,action:i.Playlists.PLAYLISTS})}),[]),v=p.useCallback((function(){d(!0),b.deletePlaylist(t,y,n)}),[t]),S=[{variant:"link",onClick:n,buttonText:"Cancel"},{variant:"danger",onClick:v,buttonText:"Yes, delete playlist",isSpinnerButton:!0,showSpinner:u}],E=!!a;return p.createElement(m.Popup,{title:"Delete Playlist",closePopup:n,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?"),p.createElement("p",null,"Please ensure it is not being used in any widgets.")),p.createElement(m.PopupButtons,{buttons:S})))}var Br=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Ee.string().trim().max(65535,"Description is too long").default(""),cover:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown(),banner:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown()}).noUnknown(),Mr=function(e,t,n,r){if(f.FunctionHelper.isFunction(r)){if(t!==n){var i=f.ArrayHelper.moveItem(e,t,n),a=n<e.length-1?i[n+1].id:null;r(i,{sourceMemberId:i[n].id,destinationMemberId:a})}}else f.Core.ErrorHelper.throw(new f.DevError("A callback function must be passed to onSort"))},Jr=function(e,t){var n=s.PLAYLISTS,r=i.Playlists,a=[{label:"Edit Playlist Details",appLink:{application:n,action:r.EDIT_PLAYLIST,args:[t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_PLAYLIST_VIDEOS,args:[t]}}];return xe(e)&&a.push.apply(a,[{label:"Subjects",appLink:{application:n,action:r.EDIT_PLAYLIST_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_PLAYLIST_AUDIENCES,args:[t]}}]),a};function Hr(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this playlist",autoFocus:!0}),p.createElement(m.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this playlist here"}),p.createElement(tt,{imageType:m.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.PLAYLISTS,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement(tt,{imageType:m.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.PLAYLISTS,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between align-items-center"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(m.Actions,{actions:e.actions})))}function Yr(e){var t,n=e.playlist&&e.playlist.id;return p.createElement(m.FormWrapper,{initialValues:e.playlist,validationSchema:Br,onSubmit:e.savePlaylist},p.createElement(Hr,{id:n,actions:!!n&&(t=n,[{label:"Delete playlist",appLink:{application:s.PLAYLISTS,action:i.Playlists.DELETE_PLAYLIST,args:[t]},className:"text-danger"}])}))}var qr,Kr,zr,Wr,Gr=function(e){return function(t){return t.appLink.action===e}};function Zr(e){var t=e.playlistId,n=e.activeAction,r=p.useContext(Ge);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(dt,{tabs:Jr(r,t),isItemActive:Gr(n)}))}function Qr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Xr(e){var t=e.playlistId,n=Qr(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)(Fr.getPlaylistFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(Zr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST}),!!r&&p.createElement(Yr,{playlist:r,savePlaylist:function(e,n){return o.updatePlaylist(t,e,n,n)}}))}!function(e){e[e.Subject=0]="Subject",e[e.Classification=1]="Classification"}(qr||(qr={})),function(e){e.Playlists="playlists",e.Series="series",e.Videos="videos"}(Kr||(Kr={})),function(e){e.Root="0"}(zr||(zr={})),function(e){e.Root="root"}(Wr||(Wr={}));var $r=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),levelIds:Ee.array().of(Ee.string()).required("A level is required").default([])}).noUnknown(),ei=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentIds:Ee.array().of(Ee.string()).default([Wr.Root]),subjectIds:Ee.array().of(Ee.string()).min(1,"A classification must be mapped to at least one subject").required("A classification must be mapped to at least one subject").default([]),type:Ee.mixed().required("Type is required").default(m.ClassificationType.Subject),emphasize:Ee.boolean().default(!1),cover:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown(),banner:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown()}).noUnknown(),ti=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),ni=Ee.object().shape({name:Ee.string().max(255,"Name is too long").required("Name is required"),description:Ee.string().max(65535,"Description is too long").required("Description is required")}),ri=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentId:Ee.string().default(zr.Root)}).noUnknown(),ii={singularizeMemberType:function(e){switch(e){case Kr.Playlists:return"playlist";case Kr.Series:return"series";case Kr.Videos:return"video"}},getMemberAppLink:function(e,t){var n=[t];switch(e){case Kr.Playlists:return{application:s.PLAYLISTS,action:i.Playlists.EDIT_PLAYLIST,args:n};case Kr.Series:return{application:s.SERIES,action:i.Series.EDIT_SERIES,args:n};case Kr.Videos:return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:n}}},getMemberActions:function(e,t,n,r){return[{label:"Remove ".concat(ii.singularizeMemberType(n)),appLink:{application:s.SUBJECTS,action:t===qr.Subject?i.Subjects.REMOVE_SUBJECT_MEMBER:i.Subjects.REMOVE_CLASSIFICATION_MEMBER,args:[e,r,n]},className:"text-danger"}]}},ai=function(){var e=s.SUBJECTS,t=i.Subjects;return[{label:"Classifications",appLink:{application:e,action:t.CLASSIFICATIONS},activeActions:[t.CLASSIFICATIONS,t.PRESENTATION_CLASSIFICATIONS,t.NEW_CLASSIFICATION,t.EDIT_CLASSIFICATION,t.EDIT_CLASSIFICATION_PLAYLISTS,t.EDIT_CLASSIFICATION_SERIES,t.EDIT_CLASSIFICATION_VIDEOS,t.DELETE_CLASSIFICATION,t.REMOVE_CLASSIFICATION_MEMBER]},{label:"Subjects",appLink:{application:e,action:t.SUBJECTS},activeActions:[t.SUBJECTS,t.NEW_SUBJECT,t.EDIT_SUBJECT,t.EDIT_SUBJECT_PLAYLISTS,t.EDIT_SUBJECT_SERIES,t.EDIT_SUBJECT_VIDEOS,t.SUBJECT_CLASSIFICATIONS,t.DELETE_SUBJECT,t.ADD_SUBJECT_MEMBERS,t.REMOVE_SUBJECT_MEMBER]},{label:"Audiences",appLink:{application:e,action:t.AUDIENCES},activeActions:[t.AUDIENCES,t.PRESENTATION_AUDIENCES,t.NEW_AUDIENCE,t.EDIT_AUDIENCE]},{label:"Levels",appLink:{application:e,action:t.LEVELS},activeActions:[t.LEVELS,t.NEW_LEVEL,t.EDIT_LEVEL]},{label:"Presentations",appLink:{application:e,action:t.PRESENTATIONS},activeActions:[t.PRESENTATIONS,t.NEW_PRESENTATION,t.EDIT_PRESENTATION]}]},oi=function(e){var t=s.SUBJECTS,n=i.Subjects;return[{label:"Edit Subject Details",appLink:{application:t,action:n.EDIT_SUBJECT,args:[e]}},{label:"Classifications",appLink:{application:t,action:n.SUBJECT_CLASSIFICATIONS,args:[e]}},{label:"Playlists",appLink:{application:t,action:n.EDIT_SUBJECT_PLAYLISTS,args:[e]}},{label:"Series",appLink:{application:t,action:n.EDIT_SUBJECT_SERIES,args:[e]}},{label:"Videos",appLink:{application:t,action:n.EDIT_SUBJECT_VIDEOS,args:[e]}}]},ci=function(e,t){var n=s.SUBJECTS,r=i.Subjects;return[{label:"Edit Classification Details",appLink:{application:n,action:r.EDIT_CLASSIFICATION,args:[e,t]}},{label:"Playlists",appLink:{application:n,action:r.EDIT_CLASSIFICATION_PLAYLISTS,args:[e,t]}},{label:"Series",appLink:{application:n,action:r.EDIT_CLASSIFICATION_SERIES,args:[e,t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_CLASSIFICATION_VIDEOS,args:[e,t]}}]};function si(e){return(si="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ui(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function li(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fi(e,t){return!t||"object"!==si(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function mi(e){return(mi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function di(e,t){return(di=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var bi=function(){return"/api/subjects/v1/subjects/tree"},yi=function(e){return"/api/subjects/v1/subjects/".concat(e)},vi=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/").concat(t,"?query={limit:100}")},Si=function(e,t,n){var r="/api/subjects/v1/subjects/".concat(e,"/classifications"),i=[];return t&&i.push("presentationId=".concat(t)),n&&i.push("query=".concat(n,"{limit:100}")),i.length?"".concat(r,"?").concat(i.join("&")):r},Ei=function(){return"/api/subjects/v1/subjects"},hi=function(e){return"/api/subjects/v1/subjects/".concat(e)},gi=function(e){return"/api/subjects/v1/subjects/".concat(e)},Oi=function(e){return"/api/subjects/v1/objects/".concat(e,"/subjects")},ji=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/subjects?addToClassifications=").concat(!!t)},Ti=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?addToClassifications=").concat(!!t)},Ci=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Ii=function(){return"/api/subjects/v1/presentations"},Ai=function(e){return"/api/subjects/v1/presentations/".concat(e)},Pi=function(){return"/api/subjects/v1/presentations"},Li=function(e){return"/api/subjects/v1/presentations/".concat(e)},Ni=function(e){return"/api/subjects/v1/presentations/".concat(e,"/classifications/tree")},ki=function(e){return"/api/subjects/v1/classifications/".concat(e,"?query=cover,banner")},wi=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/").concat(t,"?query={limit:100}")},Di=function(){return"/api/subjects/v1/classifications"},Fi=function(e){return"/api/subjects/v1/classifications/".concat(e)},_i=function(e){return"/api/subjects/v1/classifications/".concat(e)},Ri=function(e){return"/api/subjects/v1/objects/".concat(e,"/classifications")},xi=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/classifications?presentationId=").concat(t)},Ui=function(e){return"/api/subjects/v1/classifications/".concat(e,"/objects")},Vi=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Bi=function(){return"/api/subjects/v1/levels"},Mi=function(e){return"/api/subjects/v1/levels/".concat(e)},Ji=function(){return"/api/subjects/v1/levels"},Hi=function(e){return"/api/subjects/v1/levels/".concat(e)},Yi=function(e){return"/api/subjects/v1/objects/".concat(e,"/levels")},qi=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/levels?addToAudiences=").concat(!!t)},Ki=function(e){return"/api/subjects/v1/presentations/".concat(e,"/audiences")},zi=function(e){return"/api/subjects/v1/audiences/".concat(e)},Wi=function(){return"/api/subjects/v1/audiences"},Gi=function(e){return"/api/subjects/v1/audiences/".concat(e)},Zi=function(e){return"/api/subjects/v1/audiences/".concat(e)},Qi=function(e){return"/api/subjects/v1/objects/".concat(e,"/audiences")},Xi=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/audiences?presentationId=").concat(t)},$i=function(e,t,n){var r="".concat(a.SUBJECT,":").concat(e);return t&&(r+=":".concat(t)),r+=":".concat(a.CLASSIFICATIONS),n&&(r+=":".concat(n)),r},ea=function(e){function t(){return li(this,t),fi(this,mi(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&di(e,t)}(t,e),n=t,(r=[{key:"getPresentations",value:function(e,t){return this.get({resource:Ii(),eventPrefix:a.PRESENTATIONS,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getPresentation",value:function(e,t,n){return this.get({resource:Ai(e),eventPrefix:"".concat(a.PRESENTATION,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPresentation",value:function(e,t,n){return this.create({resource:Pi(),data:e,callback:t,errorCallback:n,eventPrefix:a.PRESENTATION,invalidationKeys:[a.PRESENTATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created presentation."),errorHandler:this.alertService.error("Failed to create presentation.")})}},{key:"updatePresentation",value:function(e,t,n,r){return this.update({resource:Li(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PRESENTATION,":").concat(e),invalidationKeys:["".concat(a.PRESENTATION,":").concat(e),a.PRESENTATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated presentation."),errorHandler:this.alertService.error("Failed to update presentation.")})}},{key:"getSubjectTree",value:function(e,t){return this.get({resource:bi(),formatData:function(e){return{children:e,name:zr.Root,id:null}},eventPrefix:a.SUBJECTS,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getSubject",value:function(e,t,n){return this.get({resource:yi(e),eventPrefix:"".concat(a.SUBJECT,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSubjectMemberIds",value:function(e,t,n,r){return this.get({resource:vi(e,t),eventPrefix:"".concat(a.SUBJECT,":").concat(e,":").concat(t),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"getSubjectClassifications",value:function(e,t,n,r,i){return this.get({resource:Si(e,t,n),eventPrefix:$i(e,t,n),expiryTime:m.CacheDurations.STANDARD,callback:r,errorCallback:i})}},{key:"createSubject",value:function(e,t,n){return this.create({resource:Ei(),data:e,callback:t,errorCallback:n,eventPrefix:a.SUBJECT,invalidationKeys:[a.SUBJECTS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created subject."),errorHandler:this.alertService.error("Failed to create subject.")})}},{key:"updateSubject",value:function(e,t,n,r){return this.update({resource:hi(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_SUBJECT,":").concat(e),invalidationKeys:["".concat(a.SUBJECT,":").concat(e),a.SUBJECTS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated subject."),errorHandler:this.alertService.error("Failed to save subject.")})}},{key:"deleteSubject",value:function(e,t,n){return this.delete({resource:gi(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_SUBJECT,invalidationKeys:["".concat(a.SUBJECT,":").concat(e),a.SUBJECTS],successHandler:this.alertService.success("Successfully deleted subject"),errorHandler:this.alertService.error("Failed to delete subject")})}},{key:"getObjectSubjects",value:function(e,t,n,r){return this.get({resource:Oi(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.SUBJECTS),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectSubjects",value:function(e,t,n,r,i,o){var c=ii.singularizeMemberType(n),s=["".concat(n,":").concat(e,":").concat(a.SUBJECTS)];return r&&s.push("".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)),s.push.apply(s,ui(t.map((function(e){return"".concat(a.SUBJECTS,":").concat(e,":").concat(n)})))),this.update({resource:ji(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_SUBJECTS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," subjects.")),errorHandler:this.alertService.error("Failed to update ".concat(c," subjects."))})}},{key:"addObjectsToSubject",value:function(e,t,n,r,i,o){var c=1===t.length?ii.singularizeMemberType(n):n,s=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(ui(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))),ui(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)}))));return this.create({resource:Ti(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.ADD_TO_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:s,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(c," to subject.")),errorHandler:this.alertService.error("Failed to add ".concat(c," to subject."))})}},{key:"removeObjectsFromSubject",value:function(e,t,n,r,i){var o=1===t.length?ii.singularizeMemberType(n):n,c=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(ui(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))));return this.delete({resource:Ci(e,t),callback:r,errorCallback:i,eventPrefix:"".concat(a.REMOVE_FROM_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:c,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(o," from subject.")),errorHandler:this.alertService.error("Failed to remove ".concat(o," from subject."))})}},{key:"getClassificationTree",value:function(e,t,n){return this.get({resource:Ni(e),formatData:function(e){return{children:e,name:Wr.Root,id:null}},eventPrefix:"".concat(a.CLASSIFICATIONS,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassification",value:function(e,t,n){return this.get({resource:ki(e),eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassificationMembers",value:function(e,t,n,r){return this.get({resource:wi(e,t),eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e,":").concat(t),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"createClassification",value:function(e,t,n){return this.create({resource:Di(),data:e,callback:t,errorCallback:n,eventPrefix:a.CLASSIFICATION,invalidationKeys:[a.CLASSIFICATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created classification."),errorHandler:this.alertService.error("Failed to create classification.")})}},{key:"updateClassification",value:function(e,t,n,r){return this.update({resource:Fi(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_CLASSIFICATION,":").concat(e),invalidationKeys:["".concat(a.CLASSIFICATION,":").concat(e),a.CLASSIFICATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated classification."),errorHandler:this.alertService.error("Failed to save classification.")})}},{key:"deleteClassification",value:function(e,t,n){return this.delete({resource:_i(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_CLASSIFICATION,invalidationKeys:["".concat(a.CLASSIFICATION,":").concat(e),a.CLASSIFICATIONS],successHandler:this.alertService.success("Successfully deleted classification"),errorHandler:this.alertService.error("Failed to delete classification")})}},{key:"getObjectClassifications",value:function(e,t,n,r){return this.get({resource:Ri(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.CLASSIFICATIONS),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectClassifications",value:function(e,t,n,r,i,o){var c=ii.singularizeMemberType(r),s=["".concat(r,":").concat(e,":").concat(a.CLASSIFICATIONS)];return s.push.apply(s,ui(n.map((function(e){return"".concat(a.CLASSIFICATION,":").concat(e,":").concat(r)})))),this.update({resource:xi(e,t),data:n,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_CLASSIFICATIONS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," classifications.")),errorHandler:this.alertService.error("Failed to update ".concat(c," classifications."))})}},{key:"addObjectsToClassification",value:function(e,t,n,r,i,o,c){var s=1===t.length?ii.singularizeMemberType(n):n,u=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&u.push($i(r,i,n)),u.push.apply(u,ui(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.create({resource:Ui(e),data:t,callback:o,errorCallback:c,eventPrefix:"".concat(a.ADD_TO_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:u,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(s," to classification.")),errorHandler:this.alertService.error("Failed to add ".concat(s," to classification."))})}},{key:"removeObjectsFromClassification",value:function(e,t,n,r,i,o,c){var s=1===t.length?ii.singularizeMemberType(n):n,u=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&u.push($i(r,i,n)),u.push.apply(u,ui(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.delete({resource:Vi(e,t),callback:o,errorCallback:c,eventPrefix:"".concat(a.REMOVE_FROM_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:u,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(s," from classification.")),errorHandler:this.alertService.error("Failed to remove ".concat(s," from classification."))})}},{key:"getLevels",value:function(e,t){return this.get({resource:Bi(),eventPrefix:a.LEVELS,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getLevel",value:function(e,t,n){return this.get({resource:Mi(e),eventPrefix:"".concat(a.LEVEL,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createLevel",value:function(e,t,n){return this.create({resource:Ji(),data:e,callback:t,errorCallback:n,eventPrefix:a.LEVEL,invalidationKeys:[a.LEVELS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created level."),errorHandler:this.alertService.error("Failed to create level.")})}},{key:"updateLevel",value:function(e,t,n,r){return this.update({resource:Hi(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_LEVEL,":").concat(e),invalidationKeys:["".concat(a.LEVEL,":").concat(e),a.LEVELS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated level."),errorHandler:this.alertService.error("Failed to save level.")})}},{key:"getObjectLevels",value:function(e,t,n,r){return this.get({resource:Yi(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.LEVELS),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectLevels",value:function(e,t,n,r,i,o){var c=ii.singularizeMemberType(n),s=["".concat(n,":").concat(e,":").concat(a.LEVELS)];return r&&s.push("".concat(n,":").concat(e,":").concat(a.AUDIENCES)),this.update({resource:qi(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_LEVELS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," levels.")),errorHandler:this.alertService.error("Failed to update ".concat(c," levels."))})}},{key:"getAudiences",value:function(e,t,n){return this.get({resource:Ki(e),callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCES,":").concat(e),expiryTime:m.CacheDurations.STANDARD})}},{key:"getAudience",value:function(e,t,n){return this.get({resource:zi(e),callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCE,":").concat(e),expiryTime:m.CacheDurations.STANDARD})}},{key:"createAudience",value:function(e,t,n){return this.create({resource:Wi(),data:e,callback:t,errorCallback:n,eventPrefix:a.AUDIENCE,invalidationKeys:[a.AUDIENCES],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created audience."),errorHandler:this.alertService.error("Failed to create audience.")})}},{key:"updateAudience",value:function(e,t,n,r){return this.update({resource:Gi(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_AUDIENCE,":").concat(e),invalidationKeys:["".concat(a.AUDIENCE,":").concat(e),a.AUDIENCES],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated audience."),errorHandler:this.alertService.error("Failed to update audience.")})}},{key:"deleteAudience",value:function(e,t,n){return this.delete({resource:Zi(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_AUDIENCE,invalidationKeys:["".concat(a.AUDIENCE,":").concat(e),a.AUDIENCES],successHandler:this.alertService.success("Successfully deleted audience"),errorHandler:this.alertService.error("Failed to delete audience")})}},{key:"getObjectAudiences",value:function(e,t,n,r){return this.get({resource:Qi(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectAudiences",value:function(e,t,n,r,i,o){var c=ii.singularizeMemberType(r);return this.update({resource:Xi(e,t),data:n,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_AUDIENCES,":").concat(e),invalidationKeys:["".concat(r,":").concat(e,":").concat(a.AUDIENCES)],successHandler:this.alertService.success("Successfully updated ".concat(c," audiences.")),errorHandler:this.alertService.error("Failed to update ".concat(c," audiences."))})}},{key:"name",get:function(){return l.SUBJECT}},{key:"channelName",get:function(){return u.SUBJECT}}])&&pi(n.prototype,r),i&&pi(n,i),t}(f.BaseDataService),ta={dataServiceName:l.SUBJECT,dataChannelName:u.SUBJECT},na={getSubjectTreeFetchOptions:function(e,t){return Object.assign(Object.assign({},ta),{eventPrefix:a.SUBJECTS,fetchData:function(e){return e.getSubjectTree()},setData:e,onError:t})},getSubjectFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(a.SUBJECT,":").concat(e),fetchData:function(t){return t.getSubject(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_SUBJECT})},getSubjectMemberIdsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(a.SUBJECT,":").concat(e,":").concat(t),fetchData:function(n){return n.getSubjectMemberIds(e,t)},setData:n,onError:r})},getSubjectClassificationFetchOptions:function(e,t,n,r,i){return Object.assign(Object.assign({},ta),{eventPrefix:$i(e,n,r),fetchData:function(t){return t.getSubjectClassifications(e,n,r)},setData:t,onError:i})},getObjectSubjectsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.SUBJECTS),fetchData:function(n){return n.getObjectSubjects(e,t)},setData:n,onError:r})},getPresentationsFetchOptions:function(e,t){return Object.assign(Object.assign({},ta),{eventPrefix:a.PRESENTATIONS,fetchData:function(e){return e.getPresentations()},setData:e,onError:t})},getPresentationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(a.PRESENTATION,":").concat(e),fetchData:function(t){return t.getPresentation(e)},setData:t,onError:n})},getClassificationTreeFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(a.CLASSIFICATIONS,":").concat(e),fetchData:function(t){return t.getClassificationTree(e)},setData:t,onError:n})},getClassificationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e),fetchData:function(t){return t.getClassification(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_CLASSIFICATION})},getClassificationMembersFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e,":").concat(t),fetchData:function(n){return n.getClassificationMembers(e,t)},setData:n,onError:r})},getObjectClassificationsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.CLASSIFICATIONS),fetchData:function(n){return n.getObjectClassifications(e,t)},setData:n,onError:r})},getLevelsFetchOptions:function(e,t){return Object.assign(Object.assign({},ta),{eventPrefix:a.LEVELS,fetchData:function(e){return e.getLevels()},setData:e,onError:t})},getLevelFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(a.LEVEL,":").concat(e),fetchData:function(t){return t.getLevel(e)},setData:t,onError:n})},getObjectLevelsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.LEVELS),fetchData:function(n){return n.getObjectLevels(e,t)},setData:n,onError:r})},getAudiencesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(a.AUDIENCES,":").concat(e),fetchData:function(t){return t.getAudiences(e)},setData:t,onError:n})},getAudienceFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(a.AUDIENCE,":").concat(e),fetchData:function(t){return t.getAudience(e)},setData:t,onError:n})},getObjectAudiencesFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},ta),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),fetchData:function(n){return n.getObjectAudiences(e,t)},setData:n,onError:r})}},ra=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},ia=function(e,t){var n=e.levelIds;return t.filter((function(e){return n.includes(e.id)}))};function aa(e){var t=e.showLevels;return p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,"Audiences"),!!t&&p.createElement("th",null,"Mapped Level(s)")))}function oa(e){var t,n=e.audience,r=e.levels;return p.createElement("tr",null,p.createElement("td",null,p.createElement(m.AppLink,{appLink:(t=n,{application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[t.presentationId,t.masterId]})},n.name)),p.createElement("td",null,r.map((function(e){return p.createElement(m.AppLink,{key:e.id,appLink:ra(e),className:"mr-2"},e.name)}))))}function ca(e){var t=e.audiences,n=e.levels;return p.createElement(Ae.Table,{responsive:!0,bordered:!0},p.createElement(aa,{showLevels:!!t.length}),p.createElement("tbody",null,t.length?t.map((function(e){return p.createElement(oa,{key:e.masterId,audience:e,levels:ia(e,n)})})):p.createElement("tr",null,p.createElement("td",null,"This presentation has no audiences."))))}function sa(e){var t=null===e.masterId||void 0===e.masterId,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this audience",autoFocus:!0}),p.createElement(m.FormField,{label:"Mapped Level(s)",as:"select",name:"levelIds",id:"level-ids",multiple:!0,size:e.levels.length,value:n.values.levelIds},e.levels.map((function(e){return p.createElement("option",{key:e.id,value:e.id},e.name)}))),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_AUDIENCE,args:[e.presentationId,e.masterId]}},"Delete")))}function ua(e){return p.createElement(m.FormWrapper,{initialValues:e.audience,validationSchema:$r,onSubmit:e.saveAudience},p.createElement(sa,{masterId:e.audience&&e.audience.masterId,presentationId:e.presentationId,levels:e.levels}))}function la(e){var t=e.objectAudiences,n=e.presentationAudiences;return t.filter((function(e){return n.some((function(t){return t.masterId===e.masterId}))}))}function pa(e){var t,n,r,i,a,o=ii.singularizeMemberType(e.memberType),c=(n=(t=e).presentationAudiences,r=t.objectLevels,i=t.objectAudiences,a=r.map((function(e){return e.id})),n.filter((function(e){return f.ArrayHelper.intersection(e.levelIds,a).length||i.some((function(t){return t.masterId===e.masterId}))})));return p.createElement(p.Fragment,null,p.createElement("div",{className:"border-bottom pb-3 mb-3"},p.createElement("h6",null,"Levels"),p.createElement("p",null,"Select which levels this ".concat(o," is mapped to.")),p.createElement("p",null,"To see how levels correspond to audiences, scroll down to the audience-level mappings table."),p.createElement(La,{initialValues:{levelIds:e.objectLevels.map((function(e){return e.id})),addToAudiences:!0},saveLevels:e.saveLevels,levels:e.levels,memberType:e.memberType})),p.createElement("h6",null,"Audiences"),p.createElement("p",null,"Select a presentation to view its audiences and map them to this ".concat(o,".")),p.createElement("div",{className:"w-50 pb-3"},p.createElement(wa,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),p.createElement("p",null,"Audience to level mappings for this presentation are displayed below."),p.createElement(ca,{levels:e.levels,audiences:e.presentationAudiences}),p.createElement("p",null,"Only the audiences which are mapped to a level that this"+" ".concat(o," is mapped to are displayed below.")),!!c.length&&p.createElement(ma,{initialValues:{audienceIds:la(e).map((function(e){return e.masterId}))},saveAudiences:e.saveAudiences,audiences:c}))}function fa(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Audience(s)",as:"select",name:"audienceIds",id:"audience-ids",multiple:!0,size:e.audiences.length,value:t.values.audienceIds},e.audiences.map((function(e){return p.createElement("option",{key:e.masterId,value:e.masterId},e.name)}))),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Audiences")))}function ma(e){return p.createElement(m.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.audienceIds;return e.saveAudiences(r,n)},enableReinitialize:!0},p.createElement(fa,{audiences:e.audiences}))}function da(e){var t=e.item,n=e.getItemAppLink,r=e.actions,i=e.pinState;return p.createElement("tr",null,p.createElement("td",null,p.createElement(m.AppLink,{appLink:n(t)},t.name)),i.isPinnable&&p.createElement("td",null,p.createElement(Ne,{selected:parseInt(t.id)===parseInt(i.currentPinnedVideo),onToggle:function(e){return i.onChange(e,t.id)},id:t.id})),r&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(m.Actions,{actions:r}))))}function ba(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ya(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function va(e){var t=e.items,n=e.memberType,r=e.classification,i=e.getItemAppLink,a=e.getActions,o=e.updatePinnedVideo,c=ya(p.useState(!1),2),s=c[0],u=c[1],l=function(e,t){var n=e.pinnedVideoMasterId||null,r=ba(p.useState(n),2),i=r[0],a=r[1];return{currentPinnedVideo:i,onChange:function(e,t){a(e?t:null)},canSubmit:n!==i,isPinnable:t===Kr.Videos}}(r,n);if(!t.length)return p.createElement("div",{className:"py-5"},"No ".concat(n," in this classification."));var d="".concat(Be(ii.singularizeMemberType(n))," Name");return p.createElement(p.Fragment,null,p.createElement(Ae.Table,{responsive:!0},p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,d),l.isPinnable&&p.createElement("th",null,"Pinned"),f.FunctionHelper.isFunction(a)&&p.createElement("th",null))),p.createElement("tbody",null,t.map((function(e){return p.createElement(da,{item:e,key:e.id,getItemAppLink:i,actions:f.FunctionHelper.isFunction(a)&&a(e),pinState:l})})))),l.isPinnable&&p.createElement(m.SpinnerButton,{showSpinner:s,onClick:function(){u(!0),o(l.currentPinnedVideo,(function(){return u(!1)}))},disabled:!l.canSubmit||s},"Save"))}function Sa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Ea=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}};function ha(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t),r=null===e.id||void 0===e.id,a=!r||!(!t.values.parentIds||!t.values.parentIds.length),o=Sa(p.useState(a),2),c=o[0],u=o[1];p.useEffect((function(){return u(a)}),[e.id,t.values.parentIds]),p.useEffect((function(){t.values.subjectIds.length&&!t.touched.subjectIds&&t.setFieldTouched("subjectIds",!0)}),[t.values.subjectIds]);var l=function(e){return t.setFieldValue("parentIds",f.ArrayHelper.addOrRemove(t.values.parentIds.map((function(e){return e.toString()})),e.id.toString()))},d=function(e){return t.setFieldValue("subjectIds",f.ArrayHelper.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),e.id.toString()))},b=function(e){return"".concat(m.FormHelper.getCustomFormControlClassName(t.errors,t.touched,e)," h-auto py-2")};return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this classification",autoFocus:!0}),p.createElement(m.FormField,{as:"select",label:"Type",name:"type",id:"type",value:t.values.type},f.ObjectHelper.getEnumKeys(m.ClassificationType).map((function(e){return p.createElement("option",{key:e,value:m.ClassificationType[e]},e)}))),p.createElement(m.FormField,{label:"Emphasize",name:"emphasize",id:"emphasize",type:"checkbox",checked:t.values.emphasize}),p.createElement(m.FormField,{name:"parentIds"},(function(){return p.createElement("div",{className:b("parentIds")},p.createElement(Ct,{label:"Parent Classification(s)",tree:e.classificationTree,selectedIds:t.values.parentIds,onSelect:l,collapse:c,noSelectionMessage:"No parent selected, this will be a root classification.",isNodeDisabled:(n=e.classificationTree,r=e.id,function(e){if(e.id===r)return!0;var t=Je.find(n,r);return!!Je.find(t,e.id)})}));var n,r})),p.createElement(m.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:b("subjectIds")},p.createElement(Ct,{label:"Mapped Subject(s)",tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:d,collapse:!r,getSelectedItemAppLink:Ea}))})),p.createElement(tt,{imageType:m.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.SUBJECTS,uploadAction:i.Subjects.UPLOAD_IMAGE}),p.createElement(tt,{imageType:m.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.SUBJECTS,uploadAction:i.Subjects.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},r?"Create":"Save"),!r&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e.presentationId,e.id]}},"Delete")))}function ga(e){return p.createElement(m.FormWrapper,{initialValues:e.classification,validationSchema:ei,onSubmit:e.saveClassification},p.createElement(ha,{id:e.classification&&e.classification.id,presentationId:e.presentationId,classificationTree:e.classificationTree,subjectTree:e.subjectTree}))}var Oa=function(e){return function(t){if(!e)return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION;switch(e){case Kr.Playlists:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;case Kr.Series:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_SERIES;case Kr.Videos:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_VIDEOS}}};function ja(e){var t=e.presentation,n=e.classificationId,r=e.memberType;return t?p.createElement(p.Fragment,null,p.createElement("h6",null,"Presentation: ".concat(!!t&&t.name)),p.createElement("div",{className:"py-2"},p.createElement(dt,{tabs:ci(t.id,n),isItemActive:Oa(r)}))):p.createElement(p.Fragment,null)}function Ta(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t),r=function(e){return t.setFieldValue("classificationIds",f.ArrayHelper.addOrRemove(t.values.classificationIds.map((function(e){return e.toString()})),e.id.toString()))},a="".concat(m.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"classificationIds")," h-auto py-2");return p.createElement(ge.Form,null,p.createElement(m.FormField,{name:"classificationIds"},(function(){return p.createElement("div",{className:a},p.createElement(Ct,{label:"Mapped Classification(s)",tree:e.classificationTree,selectedIds:t.values.classificationIds,onSelect:r,getSelectedItemAppLink:(n=e.presentationId,function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[n,e]}}),isNodeDisabled:e.isClassificationDisabled}));var n})),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Classifications")))}function Ca(e){return p.createElement(m.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.classificationIds;return e.saveClassifications(r,n)},enableReinitialize:!0},p.createElement(Ta,{presentationId:e.presentationId,classificationTree:e.classificationTree,isClassificationDisabled:e.isClassificationDisabled}))}function Ia(e){var t=null===e.id||void 0===e.id,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this level",autoFocus:!0}),p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"))}function Aa(e){return p.createElement(m.FormWrapper,{initialValues:e.level,validationSchema:ti,onSubmit:e.saveLevel},p.createElement(Ia,{id:e.level&&e.level.id}))}function Pa(e){var t=ii.singularizeMemberType(e.memberType),n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Level(s)",as:"select",name:"levelIds",id:"level-ids",multiple:!0,size:e.levels.length,value:n.values.levelIds},e.levels.map((function(e){return p.createElement("option",{key:e.id,value:e.id},e.name)}))),p.createElement(m.FormField,{label:"Automatically add to audiences*",name:"addToAudiences",id:"add-to-audiences",type:"checkbox",checked:n.values.addToAudiences}),p.createElement("p",null,p.createElement("em",null,"*If selected, when adding a ".concat(t," to a level, all of that level's")+" audiences across all presentations will also be added to.")),p.createElement("p",null,p.createElement("strong",null,"Note:")," When removing a ".concat(t," from a level, that level's audiences "),p.createElement("strong",null,"will not")," be automatically removed from."),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},"Save Levels")))}function La(e){return p.createElement(m.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.levelIds,i=t.addToAudiences;return e.saveLevels(r,i,n)}},p.createElement(Pa,{levels:e.levels,memberType:e.memberType}))}function Na(e){var t=e.values,n=t.name,r=t.description,i=e.id,a=e.isSubmitting,o=!i;return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n,placeholder:"Enter a name for this presentation",autoFocus:!0}),p.createElement(m.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:r,placeholder:"Describe this presentation here"}),p.createElement(m.SpinnerButton,{showSpinner:a,type:"submit"},o?"Create":"Save"))}function ka(e){var t=e.presentation,n=(t=void 0===t?{}:t).id,r=void 0===n?null:n,i=t.name,a=void 0===i?"":i,o=t.description,c=void 0===o?"":o,s=e.savePresentation;return p.createElement(ge.Formik,{initialValues:{name:a,description:c},validationSchema:ni,onSubmit:s},(function(e){return p.createElement(Na,Object.assign({id:r},e))}))}function wa(e){var t=e.presentations,n=e.currentPresentation,r=e.setCurrentPresentation,i=e.label,a=function(e){var n,i,a=(n=e,i=t,f.ArrayHelper.first(i.filter((function(e){return e.id.toString()===n.toString()}))));r(a)};return p.useEffect((function(){t&&!n&&r(t[0])}),[t]),p.createElement(p.Fragment,null,!!n&&p.createElement(p.Fragment,null,p.createElement(Ae.Form.Label,null,i),p.createElement(Ae.Form.Control,{as:"select",value:n.id,onChange:function(e){return a(e.target.value)},className:"cursor-pointer"},t.map((function(e){return p.createElement("option",{value:e.id,key:e.id},e.name)})))))}function Da(e){return p.createElement(p.Fragment,null,p.createElement("h4",null,"".concat(Be(e.memberType))),p.createElement(Ae.Table,{responsive:!0},p.createElement("tbody",null,e.objects&&e.objects.map((function(t){return p.createElement("tr",{key:t.id},p.createElement("td",null,p.createElement(m.AppLink,{appLink:ii.getMemberAppLink(e.memberType,t.id)},t.name)))})))),p.createElement(Ha,{initialValues:{subjectIds:[],addToClassifications:!0},subjectTree:e.subjectTree,saveSubjects:e.onClickAddToSubject,memberType:e.memberType,saveBtnText:"Add to subject",subjectRequired:!0}))}function Fa(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function _a(e){var t=ii.singularizeMemberType(e.memberType),n=[].concat(Fa(e.objectClassifications),Fa(e.objectSubjectClassifications)).map((function(e){return e.id}));return p.createElement(p.Fragment,null,p.createElement("div",{className:"border-bottom pb-3 mb-3"},p.createElement("h6",null,"Subjects"),p.createElement("p",null,"Select which subjects this ".concat(t," is mapped to.")),p.createElement(Ha,{initialValues:{subjectIds:e.objectSubjects.map((function(e){return e.id}))},subjectTree:e.subjectTree,saveSubjects:e.saveSubjects,memberType:e.memberType,saveBtnText:"Save Subjects",allowMultiple:!0})),p.createElement("h6",null,"Classifications"),p.createElement("p",null,"Select a presentation to view its classifications and map them to this ".concat(t,".")),p.createElement("div",{className:"w-50 pb-3"},p.createElement(wa,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),e.currentPresentation&&e.classificationTree&&e.classificationTree.children.length?p.createElement(p.Fragment,null,p.createElement("p",null,"Only classifications which are mapped to one of the subjects selected above can be selected."),p.createElement(Ca,{initialValues:{classificationIds:e.objectClassifications.map((function(e){return e.id}))},presentationId:e.currentPresentation.id,classificationTree:e.classificationTree,saveClassifications:e.saveClassifications,isClassificationDisabled:function(e){return!n.includes(e.id)}})):p.createElement("p",null,"This presentation has no classifications."))}function Ra(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}wa.defaultProps={label:"Presentation"};function xa(e){var t=!e.id,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n),a=!t||!!n.values.parentId,o=Ra(p.useState(a),2),c=o[0],u=o[1];p.useEffect((function(){return u(a)}),[e.id,n.values.parentId]);var l=function(e){var t=e.id===n.values.parentId?null:e.id;n.setFieldValue("parentId",t)},f="".concat(m.FormHelper.getCustomFormControlClassName(n.errors,n.touched,"parentId")," h-auto py-2");return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this subject",autoFocus:!0}),p.createElement(m.FormField,{name:"parentId"},(function(){return p.createElement("div",{className:f},p.createElement(Ct,{label:"Parent Subject",tree:e.subjectTree,selectedIds:[n.values.parentId],onSelect:l,collapse:c,noSelectionMessage:"No parent selected, this will be a root subject.",isNodeDisabled:(t=e.subjectTree,r=e.id,function(e){if(e.id===r)return!0;var n=Je.find(t,r);return!!Je.find(n,e.id)})}));var t,r})),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_SUBJECT,args:[e.id]}},"Delete")))}function Ua(e){return p.createElement(m.FormWrapper,{initialValues:e.subject,validationSchema:ri,onSubmit:e.saveSubject},p.createElement(xa,{id:e.subject&&e.subject.id,subjectTree:e.subjectTree}))}var Va=function(e){return function(t){return t.appLink.action===e}};function Ba(e){var t=e.subjectId,n=e.activeAction;return p.createElement(p.Fragment,null,p.createElement(Ae.Alert,{variant:"danger"},"Warning: You are editing the backbone subjects."),p.createElement("div",{className:"py-2"},p.createElement(dt,{tabs:oi(t),isItemActive:Va(n)})))}var Ma=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}};function Ja(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t),r=function(n){var r=e.allowMultiple?f.ArrayHelper.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),n.id.toString()):[n.id];t.setFieldValue("subjectIds",r)},i=ii.singularizeMemberType(e.memberType),a="".concat(m.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"subjectIds")," h-auto py-2");return p.createElement(ge.Form,null,p.createElement(m.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:a},p.createElement(Ct,{label:"Mapped Subject".concat(e.allowMultiple?"(s)":""),tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:r,collapse:!!t.initialValues.subjectIds.length,getSelectedItemAppLink:Ma}))})),p.createElement(m.FormField,{label:"Automatically add to classifications*",name:"addToClassifications",id:"add-to-classifications",type:"checkbox",checked:t.values.addToClassifications}),p.createElement("p",null,p.createElement("em",null,"*If selected, when adding a ".concat(i," to a subject, all of that subject's")+" mapped classifications across all presentations will also be added to.")),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.saveBtnText)))}function Ha(e){var t;return p.createElement(m.FormWrapper,{initialValues:e.initialValues,validationSchema:(t=e.subjectRequired,Ee.object().shape({subjectIds:t?Ee.array().of(Ee.string()).min(1,"A subject is required").required("A subject is required"):Ee.array().of(Ee.string()),addToClassifications:Ee.boolean().default(!0)}).noUnknown()),onSubmit:function(t,n){var r=t.subjectIds,i=t.addToClassifications;return e.saveSubjects(r,i,n)}},p.createElement(Ja,{subjectTree:e.subjectTree,memberType:e.memberType,allowMultiple:e.allowMultiple,saveBtnText:e.saveBtnText}))}Ja.defaultProps={saveBtnText:"Save"};var Ya=function(e){return p.createElement("div",{className:"border rounded p-2 mb-3"},p.createElement("h6",{className:"border-bottom pb-1"},e.presentation.name),e.classifications&&e.classifications.length?p.createElement("ul",{className:"list-unstyled mb-0"},e.classifications.map((function(t){return p.createElement("li",{key:t.id,className:"py-1"},p.createElement(m.AppLink,{appLink:(n=e.presentation.id,r=t.id,{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[n,r]})},t.name));var n,r}))):p.createElement("p",null,p.createElement("em",null,"There are no classifications mapped to this subject in this presentation.")))},qa=function(e){return p.createElement(p.Fragment,null,!!e.presentations&&!!e.classificationDictionary&&e.presentations.map((function(t){return p.createElement(Ya,{key:t.id,presentation:t,classifications:e.classificationDictionary[t.id]})})))},Ka=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function za(e){return p.createElement(p.Fragment,null,e.classifications.map((function(t){return p.createElement("th",{key:t.id},p.createElement("span",{className:"d-inline-block"},p.createElement(Ne,{selected:e.getIsClassificationSelected(t),onToggle:function(n){return e.onToggleClassification(t.id,n)}})),p.createElement(m.AppLink,{appLink:e.getClassificationAppLink(t.id)},function(e,t){return t?e.name:"Classification: ".concat(e.name)}(t,e.showClassificationSubHeader)))})))}function Wa(e){var t=e.memberType,n=e.hasActions,r=e.classifications,i=Ka(e,["memberType","hasActions","classifications"]),a="".concat(Be(ii.singularizeMemberType(t))," Name"),o=!!r&&!!r.length,c=o&&r.length>1,s=o?2:1,u=Object.assign({classifications:r,showClassificationSubHeader:c},i);return p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",{rowSpan:s},a),o&&(c?p.createElement("th",{colSpan:r.length,className:"text-center"},"Classifications"):p.createElement(za,Object.assign({},u))),n&&p.createElement("th",{rowSpan:s})),o&&c&&p.createElement("tr",null,p.createElement(za,Object.assign({},u))))}function Ga(e){var t=e.member,n=t.id,r=t.name,i=t.classifications,a=void 0===i?[]:i,o=e.getMemberAppLink,c=e.onToggleClassification,s=e.actions,u=f.FunctionHelper.isFunction(o)&&o(n);return a.length&&!f.FunctionHelper.isFunction(c)&&f.Core.ErrorHelper.throw(new f.DevError("onToggleClassification must be passed to SubjectMemberItem")),p.createElement("tr",null,p.createElement("td",null,u?p.createElement(m.AppLink,{appLink:o(n)},r):r),!!a.length&&a.map((function(e){return p.createElement("td",{key:e.id},p.createElement(Ne,{selected:e.selected,onToggle:function(t){return c(e.id,t,n)}}))})),s&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(m.Actions,{actions:s}))))}var Za=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Qa(e,t){return function(n){var r=n[e],i=m.CollectionHelper.length(r);return!!i&&i===t.length}}function Xa(e){var t=e.members,n=e.memberType,r=e.getActions,i=e.classifications,a=e.getClassificationAppLink,o=e.onToggleClassification,c=Za(e,["members","memberType","getActions","classifications","getClassificationAppLink","onToggleClassification"]);if(!t.length)return p.createElement("div",{className:"py-5"},"No ".concat(n," in this subject."));var s=f.FunctionHelper.isFunction(r),u={memberType:n,classifications:i,getClassificationAppLink:a,getIsClassificationSelected:Qa(n,t),onToggleClassification:o,hasActions:s};return p.createElement(Ae.Table,{responsive:!0,bordered:!0},p.createElement(Wa,Object.assign({},u)),p.createElement("tbody",null,t.map((function(e,t){return p.createElement(Ga,Object.assign({key:t,member:e,actions:s&&r(e.id),onToggleClassification:o},c))}))))}function $a(e){var t=e.navItems,n=e.currentAppLink;return p.createElement(Ae.Container,null,p.createElement(Ae.Navbar,{className:"justify-content-between align-items-center"},p.createElement(Ae.Nav,null,!!t&&t.map((function(e,t){return p.createElement(Ae.Nav.Item,{key:t},p.createElement(Ae.Nav.Link,{as:m.AppLink,appLink:e.appLink,active:_e.isItemActive(e,n),className:_e.isItemActive(e,n)?"text-primary":""},e.label))})))))}function eo(e,t){p.useEffect((function(){e.presentations&&!e.currentPresentation&&m.StateHelper.getSetStateByKey(t,"currentPresentation")(f.ArrayHelper.first(e.presentations))}),[e.presentations])}function to(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function no(e){var t=e.playlistId,n=to(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Fr.getPlaylistFetchOptions(e,r("playlist")),na.getObjectLevelsFetchOptions(e,Kr.Playlists,r("playlistLevels"))],[e]),Object(f.useFetch)(na.getObjectAudiencesFetchOptions(e,Kr.Playlists,r("playlistAudiences")),[e,t.playlistLevels]),Object(f.useBulkFetch)([na.getPresentationsFetchOptions(r("presentations")),na.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&na.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),eo(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.playlistLevels&&r.playlistAudiences);return p.createElement(p.Fragment,null,p.createElement(Zr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_AUDIENCES}),p.createElement(ut,{object:r.playlist}),!!c&&p.createElement(pa,{objectLevels:r.playlistLevels,objectAudiences:r.playlistAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Kr.Playlists,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Kr.Playlists,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Kr.Playlists,n,n)}}))}function ro(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function io(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function ao(e){var t=e.playlistId,n=ro(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([na.getSubjectTreeFetchOptions(r("subjectTree")),na.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([Fr.getPlaylistFetchOptions(e,r("playlist")),na.getObjectSubjectsFetchOptions(e,Kr.Playlists,r("playlistSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&na.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.playlistSubjects]);var i=function(e,t){return[].concat(io(t.subjectClassifications||[]),io(e))},a=t.playlistSubjects&&t.playlistSubjects.map((function(e){return na.getSubjectClassificationFetchOptions(e.id,m.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.playlistSubjects],!!a),Object(f.useFetch)(na.getObjectClassificationsFetchOptions(e,Kr.Playlists,r("playlistClassifications")),[e,t.playlistSubjects])}(t,r,a),eo(r,a);var c=!!(r.playlistSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.playlistClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(Zr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_SUBJECTS}),p.createElement(ut,{object:r.playlist}),c&&p.createElement(_a,{objectSubjects:r.playlistSubjects,subjectTree:r.subjectTree,memberType:Kr.Playlists,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.playlistClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Kr.Playlists,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Kr.Playlists,n,n)}}))}function oo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var co=function(e){return function(t){return[{label:"Remove video",appLink:{application:s.PLAYLISTS,action:i.Playlists.REMOVE_VIDEO,args:[e.toString(),t.id.toString()]},className:"text-danger"}]}},so=function(e){return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:[e.id]}};function uo(e){var t=e.playlistId,n=oo(p.useState(),2),r=n[0],a=n[1],o=oo(p.useState(),2),c=o[0],s=o[1],u=Object(f.useService)(l.PLAYLIST);!function(e,t,n){Object(f.useBulkFetch)([Fr.getPlaylistFetchOptions(e,t),Fr.getPlaylistVideosFetchOptions(e,n)],[e])}(t,a,s);return p.createElement(p.Fragment,null,p.createElement(Zr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_VIDEOS}),p.createElement(ut,{object:r}),!!c&&p.createElement(Vt,{onSortEnd:function(e,n){if(c.data&&c.data[e]){Mr(c.data,e,n,(function(e,n){u.reorderVideos(t,n),s((function(t){return{data:e,pagination:t.pagination}}))}))}},videos:c,getVideoAppLink:so,getVideoActions:co(t),emptyMessage:"There are no videos in this playlist."}))}function lo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function po(){var e=lo(p.useState(),2),t=e[0],n=e[1],r=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)($.getCurrentUserFetchOptions(n),[]);return p.createElement(p.Fragment,null,!!t&&p.createElement(Yr,{savePlaylist:function(e,n){return r.createPlaylist(e,t.id,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.PLAYLISTS,action:i.Playlists.EDIT_PLAYLIST,args:[t.id]})}}(n),n)}}))}function fo(e){return(fo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function mo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yo(e,t){return!t||"object"!==fo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function vo(e){return(vo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function So(e,t){return(So=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Eo=function(e){return"/api/master/v2/objects/".concat(e)},ho=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},go=function(e){function t(){return mo(this,t),yo(this,vo(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&So(e,t)}(t,e),n=t,(r=[{key:"getVideo",value:function(e,t,n){return this.get({resource:Eo(e),eventPrefix:"".concat(a.VIDEO,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getVideosById",value:function(e,t,n){return this.get({resource:ho(e),eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"name",get:function(){return l.VIDEO}},{key:"channelName",get:function(){return u.VIDEO}}])&&bo(n.prototype,r),i&&bo(n,i),t}(f.BaseDataService),Oo={dataServiceName:l.VIDEO,dataChannelName:u.VIDEO},jo={getVideoFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Oo),{eventPrefix:"".concat(a.VIDEO,":").concat(e),fetchData:function(t){return t.getVideo(e)},setData:t,onError:n})},getVideosByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Oo),{eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),fetchData:function(t){return t.getVideosById(e)},setData:t,onError:n})}};function To(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Co(e){var t=e.videoId,n=e.playlistId,r=e.closePopup,i=To(p.useState(),2),a=i[0],o=i[1],c=To(p.useState(),2),s=c[0],u=c[1],d=To(p.useState(!1),2),b=d[0],y=d[1],v=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)(jo.getVideoFetchOptions(t,o),[t]),Object(f.useFetch)(Fr.getPlaylistFetchOptions(n,u),[n]);var S=p.useCallback((function(){y(!0),v.removeVideoFromPlaylist(n,t,r,r)}),[t,n]),E=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:S,buttonText:"Yes, remove video",isSpinnerButton:!0,showSpinner:b}],h=s&&a;return p.createElement(m.Popup,{title:"Remove Video",closePopup:r,showLoadingSpinner:!h},!!h&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,a.name)," from ",p.createElement("strong",null,s.name),"?")),p.createElement(m.PopupButtons,{buttons:E})))}function Io(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Ao=function(e,t,n){return[{variant:"link",onClick:t,buttonText:"Cancel"},{variant:"danger",onClick:e,buttonText:"Yes, delete this audience",isSpinnerButton:!0,showSpinner:n}]};function Po(e){var t=e.id,n=e.routeToOnDelete,r=e.closePopup,i=Io(p.useState(),2),a=i[0],o=i[1],c=Io(p.useState(!1),2),s=c[0],u=c[1],d=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(na.getAudienceFetchOptions(t,o),[t]);return p.createElement(m.Popup,{title:"Delete Audience",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?")),p.createElement(m.PopupButtons,{buttons:Ao((function(){u(!0);d.deleteAudience(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)}),r,s)})))}function Lo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var No=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function ko(e){var t=e.presentationId,n=e.audienceId,r=Lo(p.useState(),2),i=r[0],a=r[1],o=Lo(p.useState(),2),c=o[0],s=o[1],u=Lo(p.useState(),2),m=u[0],d=u[1],b=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(na.getAudienceFetchOptions(n,a),[n]),Object(f.useFetch)(na.getLevelsFetchOptions(s),[]),Object(f.useFetch)(na.getPresentationFetchOptions(t,d),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(Ie,{appLink:No(t),backToName:"audiences"})),!!m&&p.createElement("h6",null,"Presentation: ".concat(m.name)),!!i&&!!c&&p.createElement(ua,{audience:i,levels:c,saveAudience:function(e,r){return b.updateAudience(n,Object.assign(Object.assign({},e),{presentationId:t}),r,r)},presentationId:t}))}function wo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Do=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e,t.masterId]}}},Fo=function(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_AUDIENCE,args:[e]}},_o={application:s.SUBJECTS,action:i.Subjects.AUDIENCES};function Ro(e){var t=e.presentationId,n=wo(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(na.getAudiencesFetchOptions(t,i),[]),p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(Ie,{appLink:_o,backToName:"presentations"})),p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select an audience to edit:"),p.createElement(m.AppLink,{appLink:Fo(t),className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Audience"))),p.createElement(ft,{objects:r,getAppLink:Do(e.presentationId),emptyMessage:"There are no audiences in this presentation yet. Click '+ New Audience' to create one."}))}function xo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Uo=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function Vo(e){var t=e.presentationId,n=xo(p.useState(),2),r=n[0],a=n[1],o=xo(p.useState(),2),c=o[0],u=o[1],m=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(na.getLevelsFetchOptions(a),[]),Object(f.useFetch)(na.getPresentationFetchOptions(t,u),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2"},p.createElement(Ie,{appLink:Uo(t),backToName:"audiences"})),!!c&&p.createElement("h6",null,"Presentation: ".concat(c.name)),!!r&&p.createElement(ua,{levels:r,presentationId:t,saveAudience:function(e,n){return m.createAudience(Object.assign(Object.assign({},e),{presentationId:t}),function(e,t){return function(n){t(),f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e,n.masterId]})}}(t,n),n)}}))}function Bo(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]}}function Mo(e){return[{label:"Add child",getAppLink:function(t){return Object.assign(Object.assign({},Bo(e)),{args:[e],params:{parentId:t.id}})}},{label:"Delete classification",getAppLink:function(t){return{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e,t.id]}},className:"text-danger"}]}var Jo=n(18),Ho=n.n(Jo);function Yo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function qo(e){var t=e.presentationId,n=e.selectedClassificationId,r=Yo(p.useState(),2),a=r[0],o=r[1],c=Yo(p.useState(),2),u=c[0],l=c[1];return function(e,t,n){var r=na.getClassificationTreeFetchOptions(e,t),i=na.getPresentationFetchOptions(e,n);Object(f.useBulkFetch)([r,i],[e])}(t,o,l),p.createElement("div",{className:"".concat(Ho.a.navContainer," h-auto pr-2 border-right")},!!u&&p.createElement("h6",{className:"border-bottom pb-2"},"Classifications (".concat(u.name,")")),p.createElement(m.AppLink,{appLink:Bo(t),className:"d-inline-block pb-2"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Classification")),!!a&&p.createElement("div",{className:"border-top pt-1"},p.createElement(gt,{tree:a,getAppLink:function(e){return function(e,t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,t.id]}}(t,e)},selectedIds:[n],actions:Mo(t)})))}function Ko(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function zo(e){var t=e.classificationId,n=e.routeToOnDelete,r=e.closePopup,i=Ko(p.useState(),2),a=i[0],o=i[1],c=Ko(p.useState(!1),2),s=c[0],u=c[1];Object(f.useFetch)(na.getClassificationFetchOptions(t,o),[]);var d=Object(f.useService)(l.SUBJECT),b=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){u(!0);d.deleteClassification(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)},buttonText:"Yes, delete this classification",isSpinnerButton:!0,showSpinner:s}];return p.createElement(m.Popup,{title:"Delete Classification",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?")),p.createElement(m.PopupButtons,{buttons:b})))}function Wo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Go(e){var t=e.presentationId,n=e.classificationId,r=Wo(p.useState(),2),i=r[0],a=r[1],o=Wo(p.useState(),2),c=o[0],s=o[1],u=Wo(p.useState(),2),m=u[0],d=u[1],b=Wo(p.useState(),2),y=b[0],v=b[1],S=Object(f.useService)(l.SUBJECT),E=na.getClassificationFetchOptions(n,a),h=na.getPresentationFetchOptions(t,s),g=na.getClassificationTreeFetchOptions(t,d),O=na.getSubjectTreeFetchOptions(v);Object(f.useFetch)(O,[]),Object(f.useFetch)(E,[n]),Object(f.useBulkFetch)([h,g],[t]);return p.createElement("div",null,p.createElement(ja,{presentation:c,classificationId:n}),!!i&&!!m&&!!y&&p.createElement(ga,{classification:i,presentationId:t,subjectTree:y,classificationTree:m,saveClassification:function(e,t){return S.updateClassification(n,e,t,t)}}))}function Zo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Qo(e){var t=e.presentationId,n=e.classificationId,r=e.memberType,i=Zo(p.useState(),2),a=i[0],o=i[1],c=Zo(p.useState(),2),s=c[0],u=c[1],m=Zo(p.useState(),2),d=m[0],b=m[1];Object(f.useFetch)(na.getPresentationFetchOptions(t,o),[]),Object(f.useFetch)(na.getClassificationFetchOptions(n,u),[n]),Object(f.useFetch)(na.getClassificationMembersFetchOptions(n,r,b),[n,r]);var y=Object(f.useService)(l.SUBJECT),v={items:d&&d.data,memberType:r,classification:s,updatePinnedVideo:function(e,t){var r=Object.assign(Object.assign({},s),{pinnedVideoMasterId:e});y.updateClassification(n,r,t)},getItemAppLink:function(e){return ii.getMemberAppLink(r,e.id)},getActions:function(e){return ii.getMemberActions(n,qr.Classification,r,e.id)}},S={presentation:a,classificationId:n},E=Ue(v);return p.createElement(p.Fragment,null,p.createElement(ja,Object.assign({},S,{memberType:r})),E&&p.createElement(va,Object.assign({},v)))}function Xo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function $o(e){var t=e.presentationId,n=e.parentId,r=Xo(p.useState(),2),a=r[0],o=r[1],c=Xo(p.useState(),2),u=c[0],m=c[1],d=Object(f.useService)(l.SUBJECT),b=na.getClassificationTreeFetchOptions(t,o),y=na.getSubjectTreeFetchOptions(m);Object(f.useFetch)(y,[]),Object(f.useFetch)(b,[t]);return p.createElement("div",null,p.createElement("h4",{className:"py-2"},"Create New Classification"),!!u&&!!a&&p.createElement(ga,{classification:n?{parentIds:[n]}:{},presentationId:t,subjectTree:u,classificationTree:a,saveClassification:function(e,n){return d.createClassification(Object.assign(Object.assign({},e),{presentationId:t}),function(e,t){return function(n){t(),n&&n.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]})}}(t,n),n)}}))}function ec(e){return(ec="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function rc(e,t){return!t||"object"!==ec(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ic(e){return(ic=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ac(e,t){return(ac=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var oc=function(e){return"/api/master/v2/objects/".concat(e,"?query=thumbnail,poster,banner,rating")},cc=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},sc=function(){return"/api/master/v2/series"},uc=function(e){return"/api/master/v2/objects/".concat(e)},lc=function(e){function t(){return tc(this,t),rc(this,ic(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ac(e,t)}(t,e),n=t,(r=[{key:"getSeries",value:function(e,t,n){return this.get({resource:oc(e),eventPrefix:"".concat(a.SERIES,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSeriesById",value:function(e,t,n){return this.get({resource:cc(e),eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createSeries",value:function(e,t,n){var r,i=this;this.chain().create({resource:sc(),data:e,callback:function(e){return r=e},errorCallback:n,eventPrefix:a.SERIES,expiryTime:m.CacheDurations.STANDARD,errorHandler:this.alertService.error("Failed to create series.")}).func((function(){r&&r.id&&i.update({resource:uc(r.id),data:{permissions:Re()},callback:t,eventPrefix:a.SERIES,successHandler:i.alertService.success("Successfully created series")})})).run()}},{key:"updateSeries",value:function(e,t,n,r){this.update({resource:uc(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_SERIES,":").concat(e),invalidationKeys:["".concat(a.SERIES,":").concat(e),a.SERIES_BY_ID],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated series"),errorHandler:this.alertService.error("Failed to update series")})}},{key:"name",get:function(){return l.SERIES}},{key:"channelName",get:function(){return u.SERIES}}])&&nc(n.prototype,r),i&&nc(n,i),t}(f.BaseDataService),pc={dataServiceName:l.SERIES,dataChannelName:u.SERIES},fc={getSeriesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},pc),{eventPrefix:"".concat(a.SERIES,":").concat(e),fetchData:function(t){return t.getSeries(e)},setData:t,onError:n})},getSeriesByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},pc),{eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),fetchData:function(t){return t.getSeriesById(e)},setData:t,onError:n})}};function mc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var dc=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(ii.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function bc(e){var t=e.classificationId,n=e.memberId,r=e.memberType,i=e.closePopup,a=mc(p.useState(),2),o=a[0],c=a[1],s=mc(p.useState(),2),u=s[0],d=s[1],b=mc(p.useState(!1),2),y=b[0],v=b[1],S=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(function(e,t,n){switch(e){case Kr.Playlists:return Fr.getPlaylistFetchOptions(t,n);case Kr.Series:return fc.getSeriesFetchOptions(t,n);case Kr.Videos:return jo.getVideoFetchOptions(t,n)}}(r,n,d),[n]),Object(f.useFetch)(na.getClassificationFetchOptions(t,c),[t]);var E=!!o&&!!u,h="Remove ".concat(Be(ii.singularizeMemberType(r)));return p.createElement(m.Popup,{title:h,closePopup:i,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,u.name)," from ",p.createElement("strong",null,o.name),"?"),p.createElement("p",null,"This will not remove it from the backbone subject.")),p.createElement(m.PopupButtons,{buttons:dc(i,(function(){v(!0),S.removeObjectsFromClassification(t,[n],r,null,null,i,i),o.pinnedVideoMasterId===n&&S.updateClassification(t,Object.assign(Object.assign({},o),{pinnedVideoMasterId:null}))}),r,y)})))}function yc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function vc(e){var t=e.id,n=yc(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(na.getLevelFetchOptions(t,i),[t]);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Level"),!!r&&p.createElement(Aa,{level:r,saveLevel:function(e,n){return a.updateLevel(t,e,n,n)}}))}function Sc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Ec=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},hc={application:s.SUBJECTS,action:i.Subjects.NEW_LEVEL};function gc(){var e=Sc(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(na.getLevelsFetchOptions(n),[]),p.createElement("div",null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a level to edit:"),p.createElement(m.AppLink,{appLink:hc,className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Level"))),p.createElement(ft,{objects:t,getAppLink:Ec}))}function Oc(){var e=Object(f.useService)(l.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Level"),p.createElement(Aa,{saveLevel:function(t,n){return e.createLevel(t,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[t.id]})}}(n),n)}}))}function jc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Tc(e){var t=e.id,n=jc(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(na.getPresentationFetchOptions(t,i),[t]);var o={presentation:r,savePresentation:function(e,n){var r=n.setSubmitting;return a.updatePresentation(t,e,(function(){return r(!1)}),(function(){return r(!1)}))}},c=Ue(o);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Presentation"),!!c&&p.createElement(ka,Object.assign({},o)))}function Cc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Ic=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_PRESENTATION,args:[e.id]}},Ac={application:s.SUBJECTS,action:i.Subjects.NEW_PRESENTATION};function Pc(){var e=Cc(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(na.getPresentationsFetchOptions(n),[]),p.createElement("div",null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a presentation to edit:"),p.createElement(m.AppLink,{appLink:Ac,className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Presentation"))),p.createElement(ft,{objects:t,getAppLink:Ic}))}function Lc(){var e=Object(f.useService)(l.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Presentation"),p.createElement(ka,{savePresentation:function(t,n){var r=n.setSubmitting;e.createPresentation(t,(function(e){return function(e,t){t(!1),e&&e.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_PRESENTATION,args:[e.id]})}(e,r)}),(function(){return r(!1)}))}}))}function Nc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function kc(e){var t=e.objectType,n=e.getAppLink,r=Nc(p.useState(),2),i=r[0],a=r[1];return Object(f.useFetch)(na.getPresentationsFetchOptions(a),[]),p.createElement("div",null,p.createElement("h5",null,p.createElement(m.Text,{namespace:"subjects.selectPresentation",phrase:"heading",options:{objectType:t}})),p.createElement(ft,{objects:i,getAppLink:n}))}function wc(e,t){return m.StateHelper.getSetStateByKey(e,t)}function Dc(e,t){var n=e.memberType,r=e.objectIds,i=na.getSubjectTreeFetchOptions(wc(t,"subjectTree"));Object(f.useFetch)(i,[]);var a=function(e,t,n){switch(e){case Kr.Playlists:return Fr.getPlaylistsByIdFetchOptions(t,n);case Kr.Series:return fc.getSeriesByIdFetchOptions(t,n);case Kr.Videos:return jo.getVideosByIdFetchOptions(t,n)}}(n,r,wc(t,"objects"));Object(f.useFetch)(a,[n,r])}function Fc(e,t,n,r){var a=n.selectedSubject,o=n.objects,c=function(){return wc(r,"showConfirmationPopup")(!1)};e.addObjectsToSubject(a.id,o.map((function(e){return e.id})),t.memberType,n.addToClassifications,(function(){c(),f.Core.AppLinkHelper.trigger(function(e,t){var n={application:s.SUBJECTS,args:[e]};switch(t){case Kr.Playlists:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_PLAYLISTS});case Kr.Series:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_SERIES});case Kr.Videos:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_VIDEOS})}}(a.id,t.memberType))}),c)}function _c(e,t,n){if(t&&n){var r=1===t.length?"this ".concat(ii.singularizeMemberType(e)):"these ".concat(e);return"Add ".concat(r," to ").concat(n.name)}}function Rc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var xc=function(e,t){return function(n,r,i){i(),wc(t,"selectedSubject")(Je.find(e.subjectTree,f.ArrayHelper.first(n))),wc(t,"addToClassifications")(r),wc(t,"showConfirmationPopup")(!0)}};function Uc(e){var t=Rc(p.useState({}),2),n=t[0],r=t[1],i=Object(f.useService)(l.SUBJECT);Dc(e,r);var a;return p.createElement(p.Fragment,null,!!n.objects&&!!n.subjectTree&&p.createElement(Da,{memberType:e.memberType,objects:n.objects,subjectTree:n.subjectTree,onClickAddToSubject:xc(n,r)}),n.showConfirmationPopup&&p.createElement(m.ConfirmationPopup,{title:_c(e.memberType,n.objects,n.selectedSubject),onClickConfirm:function(){return Fc(i,e,n,r)},closePopup:function(){return e=!1,wc(r,"showConfirmationPopup")(e);var e}},p.createElement("p",null,"The following ".concat(e.memberType," will be added to "),p.createElement("strong",null,n.selectedSubject.name),n.addToClassifications?" and its mapped classifications:":":"),p.createElement("ul",null,n.objects.map((function(e){return p.createElement("li",{key:e.id},e.name)}))),!n.addToClassifications&&p.createElement("p",null,"".concat(1===n.objects.length?"It":"They"," will not be added to its mapped classifications.")),p.createElement("p",null,"".concat((a=e.memberType,Be(ii.singularizeMemberType(a)))," to classification mappings can be managed from the "),p.createElement("strong",null,"Edit Subject ".concat(Be(e.memberType)," ")),"page.")))}function Vc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Bc(e){var t=e.subjectId,n=e.routeToOnDelete,r=e.closePopup,i=Vc(p.useState(),2),a=i[0],o=i[1],c=Vc(p.useState(!1),2),s=c[0],u=c[1];Object(f.useFetch)(na.getSubjectFetchOptions(t,o),[]);var d=Object(f.useService)(l.SUBJECT),b=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){u(!0);d.deleteSubject(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)},buttonText:"Yes, delete this subject",isSpinnerButton:!0,showSpinner:s}];return p.createElement(m.Popup,{title:"Delete Subject",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?"),p.createElement("p",null,"Subjects that have mapped classifications cannot be deleted.")),p.createElement(m.PopupButtons,{buttons:b})))}function Mc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Jc(e){var t=e.subjectId,n=Mc(p.useState(),2),r=n[0],a=n[1],o=Mc(p.useState(),2),c=o[0],s=o[1],u=Object(f.useService)(l.SUBJECT),m=na.getSubjectFetchOptions(t,a),d=na.getSubjectTreeFetchOptions(s);Object(f.useFetch)(d,[]),Object(f.useFetch)(m,[t]);return p.createElement(p.Fragment,null,p.createElement(Ba,{subjectId:t,activeAction:i.Subjects.EDIT_SUBJECT}),!!r&&!!c&&p.createElement(Ua,{subject:r,subjectTree:c,saveSubject:function(e,n){return u.updateSubject(t,e,n,n)}}))}function Hc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Yc=p.createContext(void 0);function qc(e){var t=e.children,n=Hc(p.useState(),2),r=n[0],i=n[1];return p.createElement(Yc.Provider,{value:[r,i]},t)}var Kc=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(qc,null,p.createElement(Ke,null,t)))};function zc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Wc(e,t){return m.StateHelper.getSetStateByKey(e,t)}function Gc(e,t,n){var r=e.subjectId,i=e.memberType,a=t.memberIds,o=zc(p.useContext(Yc),1)[0];Object(f.useFetch)(na.getPresentationsFetchOptions(Wc(n,"presentations")),[]),Object(f.useFetch)(na.getSubjectMemberIdsFetchOptions(r,i,Wc(n,"memberIds")),[r,i]),Object(f.useFetch)(function(e,t,n){if(!t||!t.length)return;switch(e){case Kr.Playlists:return Fr.getPlaylistsByIdFetchOptions(t,n);case Kr.Series:return fc.getSeriesByIdFetchOptions(t,n);case Kr.Videos:return jo.getVideosByIdFetchOptions(t,n)}}(i,a,Wc(n,"members")),[i,a],!!a&&!!a.length),Object(f.useFetch)(!!o&&na.getSubjectClassificationFetchOptions(r,Wc(n,"classifications"),o.id,i),[r,i,o],!!o)}var Zc=function(e,t){return function(n){var r,a=s.SUBJECTS,o=[t,n];switch(e){case Kr.Playlists:r=i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;break;case Kr.Series:r=i.Subjects.EDIT_CLASSIFICATION_SERIES;break;case Kr.Videos:r=i.Subjects.EDIT_CLASSIFICATION_VIDEOS}return{application:a,action:r,args:o}}};function Qc(e){switch(e){case Kr.Playlists:return i.Subjects.EDIT_SUBJECT_PLAYLISTS;case Kr.Series:return i.Subjects.EDIT_SUBJECT_SERIES;case Kr.Videos:return i.Subjects.EDIT_SUBJECT_VIDEOS}}function Xc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function $c(e){var t=e.subjectId,n=e.memberType,r=Xc(p.useState({}),2),i=r[0],a=r[1],o=i.presentations,c=i.classifications,s=i.memberIds,u=i.membersWithClassifications,m=Xc(p.useContext(Yc),2),d=m[0],b=m[1],y=Object(f.useService)(l.SUBJECT);Gc(e,i,a),function(e,t,n){var r=t.memberIds,i=t.members,a=t.classifications;p.useEffect((function(){Wc(n,"membersWithClassifications")(function(e,t,n){if(!t||!n)return;return t.map((function(t){return{id:t.id,name:t.name,classifications:n.map((function(n){return{id:n.id,selected:(r=t,i=n,!!i[e]&&!!i[e].data.filter((function(e){return e.id===r.id})).length)};var r,i}))}}))}(e.memberType,i,a))}),[i,a]),p.useEffect((function(){i&&i.length&&r&&!r.length&&Wc(n,"members")([])}),[r])}(e,i,a);var v={presentations:o,currentPresentation:d,setCurrentPresentation:b},S={members:u||[],memberType:n,getMemberAppLink:function(e){return ii.getMemberAppLink(n,e)},getActions:function(e){return ii.getMemberActions(t,qr.Subject,n,e)},classifications:c,getClassificationAppLink:d&&Zc(n,d.id),onToggleClassification:function(e,r,i){return function(e,t,n,r,i,a,o){(o?e.addObjectsToClassification.bind(e):e.removeObjectsFromClassification.bind(e))(a,n,t,r,i)}(y,n,i?[i]:s,t,d&&d.id,e,r)}},E=!!d&&!!c;return p.createElement(p.Fragment,null,p.createElement(Ba,{subjectId:t,activeAction:Qc(n)}),p.createElement(Ae.Alert,{variant:"info",className:"m-0"},"Select which ".concat(n," are shown for each classification in this subject.")+" Change the selected presentation to view different classifications."),p.createElement("div",{className:"w-50 py-2"},!!o&&p.createElement(wa,Object.assign({},v))),E&&p.createElement(Xa,Object.assign({},S)))}function es(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ts(e){var t=e.parentId,n=es(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT),c=na.getSubjectTreeFetchOptions(a);Object(f.useFetch)(c,[]);var u={application:s.SUBJECTS,action:i.Subjects.PRESENTATIONS};return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2 border-bottom"},p.createElement(Ie,{backToName:"Presentations",appLink:u})),p.createElement("h4",{className:"py-2"},"Create New Subject"),!!r&&p.createElement(Ua,{subject:{parentId:t},subjectTree:r,saveSubject:function(e,t){return o.createSubject(e,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[t.id]})}}(t),t)}}))}function ns(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var rs=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(ii.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function is(e){var t=e.subjectId,n=e.memberId,r=e.memberType,i=e.closePopup,a=ns(p.useState(),2),o=a[0],c=a[1],s=ns(p.useState(),2),u=s[0],d=s[1],b=ns(p.useState(!1),2),y=b[0],v=b[1],S=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(function(e,t,n){switch(e){case Kr.Playlists:return Fr.getPlaylistFetchOptions(t,n);case Kr.Series:return fc.getSeriesFetchOptions(t,n);case Kr.Videos:return jo.getVideoFetchOptions(t,n)}}(r,n,d),[n]),Object(f.useFetch)(na.getSubjectFetchOptions(t,c),[t]);var E=!!o&&!!u,h="Remove ".concat(Be(ii.singularizeMemberType(r)));return p.createElement(m.Popup,{title:h,closePopup:i,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,u.name)," from ",p.createElement("strong",null,o.name),"?"),p.createElement("p",null,"Please ensure that it is not in any classifications before removing.")),p.createElement(m.PopupButtons,{buttons:rs(i,(function(){v(!0),S.removeObjectsFromSubject(t,[n],r,i,i)}),r,y)})))}function as(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function os(e){var t=e.subjectId,n=as(p.useState({}),2),r=n[0];return function(e,t){var n=function(e){return m.StateHelper.getSetStateByKey(t,e)};Object(f.useFetch)(na.getSubjectClassificationFetchOptions(e,n("classifications")),[e]),Object(f.useFetch)(na.getPresentationsFetchOptions(n("presentations")),[])}(t,n[1]),p.createElement(p.Fragment,null,p.createElement(Ba,{subjectId:t,activeAction:i.Subjects.SUBJECT_CLASSIFICATIONS}),p.createElement(qa,{presentations:r.presentations,classificationDictionary:f.ArrayHelper.groupBy(r.classifications,"presentationId")}))}var cs=n(19),ss=n.n(cs);function us(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ls(e){var t=e.selectedSubjectId,n=us(p.useState(),2),r=n[0],a=n[1];Object(f.useFetch)(na.getSubjectTreeFetchOptions(a),[]);var o=p.useCallback((function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e.id]}}),[]),c={application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT},u=[{label:"Add child",getAppLink:function(e){return Object.assign(Object.assign({},c),{params:{parentId:e.id}})}},{label:"Delete subject",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.DELETE_SUBJECT,args:[e.id]}},className:"text-danger"}];return p.createElement("div",{className:"".concat(ss.a.navContainer," h-auto pr-2 border-right")},p.createElement("h5",{className:"border-bottom pb-2"},"Subjects"),p.createElement(m.AppLink,{appLink:c,className:"d-inline-block pb-2"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Subject")),!!r&&p.createElement("div",{className:"border-top pt-1"},p.createElement(gt,{tree:r,getAppLink:o,selectedIds:[t],actions:u})))}function ps(e){var t=e.currentAppLink;return p.createElement($a,{navItems:ai(),currentAppLink:t})}function fs(e){return(fs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ms(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ds(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function bs(e,t,n){return t&&ds(e.prototype,t),n&&ds(e,n),e}function ys(e,t){return!t||"object"!==fs(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function vs(e){return(vs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ss(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Es(e,t)}function Es(e,t){return(Es=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var hs=function(e){function t(){return ms(this,t),ys(this,vs(t).apply(this,arguments))}return Ss(t,e),bs(t,[{key:"channelName",get:function(){return s.PLAYLISTS}},{key:"appRoutes",get:function(){return{"manage/playlists(/)":"index","manage/playlists/new(/)":"newPlaylist","manage/playlists/:id(/)":"editPlaylist","manage/playlists/:id/videos(/)":"editPlaylistVideos","manage/playlists/:id/subjects(/)":"editPlaylistSubjects","manage/playlists/:id/audiences(/)":"editPlaylistAudiences"}}},{key:"appLinks",get:function(){return["deletePlaylist","removeVideo","uploadImage","removeFromSubject"]}}]),t}(f.Core.AppRouter),gs=function(e){function t(){return ms(this,t),ys(this,vs(t).apply(this,arguments))}return Ss(t,e),bs(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"index",value:function(){this.navigate("/dashboards/playlists")}},{key:"newPlaylist",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(po,null))}},{key:"editPlaylist",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Xr,{key:e,playlistId:e}))}},{key:"editPlaylistVideos",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(uo,{key:e,playlistId:e}))}},{key:"editPlaylistSubjects",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(ao,{key:e,playlistId:e}))}},{key:"editPlaylistAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(no,{key:e,playlistId:e}))}},{key:"deletePlaylist",value:function(e){var t=Object.assign({playlistId:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Vr,Object.assign({},t)))}},{key:"removeVideo",value:function(e,t){var n=Object.assign({playlistId:e,videoId:t},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Co,Object.assign({},n)))}},{key:"removeFromSubject",value:function(e,t){var n=Object.assign({subjectId:t,memberId:e,memberType:Kr.Playlists},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(is,Object.assign({},n)))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Rr,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return en.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"navigate",value:function(e){f.Core.LocationUtils.PageLoad(e)}},{key:"name",get:function(){return"Playlists Application"}},{key:"channelName",get:function(){return s.PLAYLISTS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:xr}}}}],[{key:"router",get:function(){return hs}}]),t}(f.Core.Application),Os=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Ke,null,t))},js=function(){return"/api/domain/v2/me/ratings"},Ts="ratings",Cs=function(){return{url:js(),key:Ts}},Is=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Ee.string().trim().max(65535,"Description is too long").default(""),rating:Ee.object().shape({id:Ee.string()}).default({}).noUnknown(),poster:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown(),banner:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown()}).noUnknown(),As=function(e,t){var n=s.SERIES,r=i.Series,a=[{label:"Edit Series Details",appLink:{application:n,action:r.EDIT_SERIES,args:[t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_SERIES_VIDEOS,args:[t]}}];return xe(e)&&a.push.apply(a,[{label:"Subjects",appLink:{application:n,action:r.EDIT_SERIES_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_SERIES_AUDIENCES,args:[t]}}]),a};function Ps(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this series",autoFocus:!0}),p.createElement(m.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this series here"}),p.createElement(mt,{ratings:e.ratings}),p.createElement(tt,{imageType:m.ImageType.TallPosters,currentImage:t.values.poster,setNewImage:function(e){return t.setFieldValue("poster",e)},application:s.SERIES,uploadAction:i.Series.UPLOAD_IMAGE}),p.createElement(tt,{imageType:m.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.SERIES,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between align-items-center"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(m.Actions,{actions:e.actions})))}function Ls(e){return p.createElement(m.FormWrapper,{initialValues:e.series,validationSchema:Is,onSubmit:e.saveSeries},p.createElement(Ps,{id:e.series&&e.series.id,ratings:e.ratings}))}var Ns=function(e){return function(t){return t.appLink.action===e}};function ks(e){var t=e.seriesId,n=e.activeAction,r=p.useContext(Ge);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(dt,{tabs:As(r,t),isItemActive:Ns(n)}))}function ws(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ds(e){var t=e.seriesId,n=ws(p.useState(),2),r=n[0],a=n[1],o=f.Flight.useBasicFetch(Cs()),c=Object(f.useService)(l.SERIES);Object(f.useFetch)(fc.getSeriesFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(ks,{seriesId:t,activeAction:i.Series.EDIT_SERIES}),!!r&&!!o.data&&p.createElement(Ls,{series:r,saveSeries:function(e,n){return c.updateSeries(t,e,n,n)},ratings:o.data}))}function Fs(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function _s(e){var t=e.seriesId,n=Fs(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([fc.getSeriesFetchOptions(e,r("series")),na.getObjectLevelsFetchOptions(e,Kr.Series,r("seriesLevels"))],[e]),Object(f.useFetch)(na.getObjectAudiencesFetchOptions(e,Kr.Series,r("seriesAudiences")),[e,t.seriesLevels]),Object(f.useBulkFetch)([na.getPresentationsFetchOptions(r("presentations")),na.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&na.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),eo(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.seriesLevels&&r.seriesAudiences);return p.createElement(p.Fragment,null,p.createElement(ks,{seriesId:t,activeAction:i.Series.EDIT_SERIES_AUDIENCES}),p.createElement(ut,{object:r.series}),!!c&&p.createElement(pa,{objectLevels:r.seriesLevels,objectAudiences:r.seriesAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Kr.Series,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Kr.Series,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Kr.Series,n,n)}}))}function Rs(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function xs(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Us(e){var t=e.seriesId,n=Rs(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([na.getSubjectTreeFetchOptions(r("subjectTree")),na.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([fc.getSeriesFetchOptions(e,r("series")),na.getObjectSubjectsFetchOptions(e,Kr.Series,r("seriesSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&na.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.seriesSubjects]);var i=function(e,t){return[].concat(xs(t.subjectClassifications||[]),xs(e))},a=t.seriesSubjects&&t.seriesSubjects.map((function(e){return na.getSubjectClassificationFetchOptions(e.id,m.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.seriesSubjects],!!a),Object(f.useFetch)(na.getObjectClassificationsFetchOptions(e,Kr.Series,r("seriesClassifications")),[e,t.seriesSubjects])}(t,r,a),eo(r,a);var c=!!(r.seriesSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.seriesClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(ks,{seriesId:t,activeAction:i.Series.EDIT_SERIES_SUBJECTS}),p.createElement(ut,{object:r.series}),c&&p.createElement(_a,{objectSubjects:r.seriesSubjects,subjectTree:r.subjectTree,memberType:Kr.Series,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.seriesClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Kr.Series,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Kr.Series,n,n)}}))}function Vs(){var e=f.Flight.useBasicFetch(Cs()),t=Object(f.useService)(l.SERIES);return p.createElement(p.Fragment,null,!!e.data&&p.createElement(Ls,{saveSeries:function(e,n){return t.createSeries(e,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SERIES,action:i.Series.EDIT_SERIES,args:[t.id]})}}(n),n)},ratings:e.data}))}function Bs(e){return(Bs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ms(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Js(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Hs(e,t,n){return t&&Js(e.prototype,t),n&&Js(e,n),e}function Ys(e,t){return!t||"object"!==Bs(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function qs(e){return(qs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ks(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zs(e,t)}function zs(e,t){return(zs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ws=function(e){function t(){return Ms(this,t),Ys(this,qs(t).apply(this,arguments))}return Ks(t,e),Hs(t,[{key:"channelName",get:function(){return s.SERIES}},{key:"appRoutes",get:function(){return{"manage/series/new(/)":"newSeries","manage/series/:id(/)":"editSeries","manage/series/:id/videos(/)":"editSeriesVideos","manage/series/:id/subjects(/)":"editSeriesSubjects","manage/series/:id/audiences(/)":"editSeriesAudiences"}}},{key:"appLinks",get:function(){return["uploadImage"]}}]),t}(f.Core.AppRouter),Gs=function(e){function t(){return Ms(this,t),Ys(this,qs(t).apply(this,arguments))}return Ks(t,e),Hs(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"newSeries",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Vs,null))}},{key:"editSeries",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ds,{seriesId:e}))}},{key:"editSeriesVideos",value:function(e){f.Core.LocationUtils.Redirect("/manage/legacy/series/".concat(e),!0)}},{key:"editSeriesSubjects",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Us,{seriesId:e}))}},{key:"editSeriesAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(_s,{seriesId:e}))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Rr,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return en.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Series Application"}},{key:"channelName",get:function(){return s.SERIES}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:Os}}}}],[{key:"router",get:function(){return Ws}}]),t}(f.Core.Application);function Zs(e){return(Zs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $s(e,t,n){return t&&Xs(e.prototype,t),n&&Xs(e,n),e}function eu(e,t){return!t||"object"!==Zs(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function tu(e){return(tu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function nu(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ru(e,t)}function ru(e,t){return(ru=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var iu=function(e){function t(){return Qs(this,t),eu(this,tu(t).apply(this,arguments))}return nu(t,e),$s(t,[{key:"channelName",get:function(){return s.SUBJECTS}},{key:"appRoutes",get:function(){return{"manage/subjects(/)":"subjects","manage/subjects/add-objects(/)":"addSubjectMembers","manage/subjects/new(/)":"newSubject","manage/subjects/:id/edit(/)":"editSubject","manage/subjects/:id/edit/playlists(/)":"editSubjectPlaylists","manage/subjects/:id/edit/series(/)":"editSubjectSeries","manage/subjects/:id/edit/videos(/)":"editSubjectVideos","manage/subjects/:id/classifications(/)":"subjectClassifications","manage/subjects/classifications(/)":"classifications","manage/subjects/presentations/:id/classifications(/)":"presentationClassifications","manage/subjects/presentations/:id/classifications/new(/)":"newClassification","manage/subjects/presentations/:id/classifications/:id/edit(/)":"editClassification","manage/subjects/presentations/:id/classifications/:id/edit/playlists(/)":"editClassificationPlaylists","manage/subjects/presentations/:id/classifications/:id/edit/series(/)":"editClassificationSeries","manage/subjects/presentations/:id/classifications/:id/edit/videos(/)":"editClassificationVideos","manage/subjects/levels(/)":"levels","manage/subjects/levels/new(/)":"newLevel","manage/subjects/levels/:id(/)":"editLevel","manage/subjects/audiences(/)":"audiences","manage/subjects/presentations/:id/audiences(/)":"presentationAudiences","manage/subjects/presentations/:id/audiences/new(/)":"newAudience","manage/subjects/presentations/:id/audiences/:id/edit(/)":"editAudience","manage/subjects/presentations(/)":"presentations","manage/subjects/presentations/new":"newPresentation","manage/subjects/presentations/:id(/)":"editPresentation"}}},{key:"appLinks",get:function(){return["deleteClassification","removeClassificationMember","deleteSubject","removeSubjectMember","deleteAudience","uploadImage"]}}]),t}(f.Core.AppRouter),au=function(e){function t(){return Qs(this,t),eu(this,tu(t).apply(this,arguments))}return nu(t,e),$s(t,[{key:"initialize",value:function(){var e=this;this.subjectDataService=f.InstanceManager.getInstance(l.SUBJECT,this),f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"subjects",value:function(){this.subjectDataService.getSubjectTree((function(e){var t=!!e.children&&e.children[0];t?f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[t.id]},{replace:!0}):f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT},{replace:!0})}))}},{key:"newSubject",value:function(e){var t={parentId:e.parentId};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(ts,Object.assign({key:e.parentId},t))),this.renderSubjectsLeftNav()}},{key:"editSubject",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Jc,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"editSubjectPlaylists",value:function(e){var t={subjectId:e,memberType:Kr.Playlists};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement($c,Object.assign({key:"".concat(e,":playlists")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectSeries",value:function(e){var t={subjectId:e,memberType:Kr.Series};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement($c,Object.assign({key:"".concat(e,":series")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectVideos",value:function(e){var t={subjectId:e,memberType:Kr.Videos};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement($c,Object.assign({key:"".concat(e,":videos")},t))),this.renderSubjectsLeftNav(e)}},{key:"subjectClassifications",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(os,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"addSubjectMembers",value:function(e){var t=e.memberType,n=e.objectIds;if(t&&n){var r={memberType:t,objectIds:Array.isArray(n)?n:[n]};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Uc,Object.assign({},r))),this.hideLeftNav()}}},{key:"removeSubjectMember",value:function(e,t,n){var r=Object.assign({subjectId:e,memberId:t,memberType:n},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(is,Object.assign({},r)))}},{key:"deleteSubject",value:function(e){var t=e.toString()===this.currentLeftNavId.toString()?{application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT}:null,n=Object.assign({subjectId:e,routeToOnDelete:t||null},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Bc,Object.assign({},n)))}},{key:"classifications",value:function(){var e={objectType:"classifications",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_CLASSIFICATIONS,args:[e.id]}}};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(kc,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationClassifications",value:function(e){this.subjectDataService.getClassificationTree(e,(function(t){var n=!!t.children&&t.children[0];n?f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]},{replace:!0}):f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]},{replace:!0})}))}},{key:"newClassification",value:function(e,t){var n={presentationId:e,parentId:t.parentId};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement($o,Object.assign({key:t.parentId},n))),this.renderClassificationLeftNav(e)}},{key:"editClassification",value:function(e,t){var n={presentationId:e,classificationId:t};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Go,Object.assign({key:t},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationPlaylists",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Kr.Playlists};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Qo,Object.assign({key:"".concat(t,":playlists")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationSeries",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Kr.Series};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Qo,Object.assign({key:"".concat(t,":series")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationVideos",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Kr.Videos};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Qo,Object.assign({key:"".concat(t,":videos")},n))),this.renderClassificationLeftNav(e,t)}},{key:"removeClassificationMember",value:function(e,t,n){var r=Object.assign({classificationId:e,memberId:t,memberType:n},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(bc,Object.assign({},r)))}},{key:"deleteClassification",value:function(e,t){var n=t===this.currentLeftNavId?{application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]}:null,r=Object.assign({classificationId:t,routeToOnDelete:n||null},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(zo,Object.assign({},r)))}},{key:"levels",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(gc,null)),this.hideLeftNav()}},{key:"newLevel",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Oc,null)),this.hideLeftNav()}},{key:"editLevel",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(vc,{key:e,id:e})),this.hideLeftNav()}},{key:"audiences",value:function(){var e={objectType:"audiences",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e.id]}}};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(kc,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ro,{presentationId:e})),this.hideLeftNav()}},{key:"newAudience",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Vo,{presentationId:e})),this.hideLeftNav()}},{key:"editAudience",value:function(e,t){var n={presentationId:e,audienceId:t};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(ko,Object.assign({key:t},n))),this.hideLeftNav()}},{key:"deleteAudience",value:function(e,t){var n={application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]},r=Object.assign({id:t,routeToOnDelete:n},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Po,Object.assign({},r)))}},{key:"presentations",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Pc,null)),this.hideLeftNav()}},{key:"newPresentation",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Lc,null))}},{key:"editPresentation",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Tc,{key:e,id:e})),this.hideLeftNav()}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Rr,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return en.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"renderClassificationLeftNav",value:function(e,t){this.setCurrentLeftNavItem(t);var n={presentationId:e,selectedClassificationId:t};this.layout.showChildView(m.LayoutRegions.LEFT_NAV,p.createElement(qo,Object.assign({},n)))}},{key:"renderSubjectsLeftNav",value:function(e){this.setCurrentLeftNavItem(e),this.layout.showChildView(m.LayoutRegions.LEFT_NAV,p.createElement(ls,{selectedSubjectId:e}))}},{key:"setCurrentLeftNavItem",value:function(e){this.currentLeftNavId=e||null}},{key:"hideLeftNav",value:function(){this.setCurrentLeftNavItem(),this.layout.hideLeftNav()}},{key:"getTopNav",value:function(e){return p.createElement(ps,{currentAppLink:e})}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Subjects Application"}},{key:"channelName",get:function(){return s.SUBJECTS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:Kc,getTopNavView:this.getTopNav}}}}],[{key:"router",get:function(){return iu}}]),t}(f.Core.Application),ou=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Ke,null,t))},cu=function(e){var t=s.VIDEOS,n=i.Videos;return[{label:"Edit Video Details",appLink:{application:t,action:n.EDIT_VIDEO,args:[e]}},{label:"Subjects",appLink:{application:t,action:n.EDIT_VIDEO_SUBJECTS,args:[e]}},{label:"Audiences",appLink:{application:t,action:n.EDIT_VIDEO_AUDIENCES,args:[e]}}]},su=function(e){return function(t){return t.appLink.action===e}};function uu(e){var t=e.videoId,n=e.activeAction;return p.createElement("div",{className:"py-2"},p.createElement(dt,{tabs:cu(t),isItemActive:su(n)}))}function lu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function pu(e){var t=e.videoId,n=lu(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([jo.getVideoFetchOptions(e,r("video")),na.getObjectLevelsFetchOptions(e,Kr.Videos,r("videoLevels"))],[e]),Object(f.useFetch)(na.getObjectAudiencesFetchOptions(e,Kr.Videos,r("videoAudiences")),[e,t.videoLevels]),Object(f.useBulkFetch)([na.getPresentationsFetchOptions(r("presentations")),na.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&na.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),eo(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.videoLevels&&r.videoAudiences);return p.createElement(p.Fragment,null,p.createElement(uu,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_AUDIENCES}),p.createElement(ut,{object:r.video}),!!c&&p.createElement(pa,{objectLevels:r.videoLevels,objectAudiences:r.videoAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Kr.Videos,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Kr.Videos,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Kr.Videos,n,n)}}))}function fu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function mu(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function du(e){var t=e.videoId,n=fu(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([na.getSubjectTreeFetchOptions(r("subjectTree")),na.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([jo.getVideoFetchOptions(e,r("video")),na.getObjectSubjectsFetchOptions(e,Kr.Videos,r("videoSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&na.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.videoSubjects]);var i=function(e,t){return[].concat(mu(t.subjectClassifications||[]),mu(e))},a=t.videoSubjects&&t.videoSubjects.map((function(e){return na.getSubjectClassificationFetchOptions(e.id,m.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.videoSubjects],!!a),Object(f.useFetch)(na.getObjectClassificationsFetchOptions(e,Kr.Videos,r("videoClassifications")),[e,t.videoSubjects])}(t,r,a),eo(r,a);var c=!!(r.videoSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.videoClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(uu,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_SUBJECTS}),p.createElement(ut,{object:r.video}),c&&p.createElement(_a,{objectSubjects:r.videoSubjects,subjectTree:r.subjectTree,memberType:Kr.Videos,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.videoClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Kr.Videos,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Kr.Videos,n,n)}}))}function bu(e){return(bu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Su(e,t,n){return t&&vu(e.prototype,t),n&&vu(e,n),e}function Eu(e,t){return!t||"object"!==bu(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function hu(e){return(hu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gu(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ou(e,t)}function Ou(e,t){return(Ou=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ju=function(e){function t(){return yu(this,t),Eu(this,hu(t).apply(this,arguments))}return gu(t,e),Su(t,[{key:"channelName",get:function(){return s.VIDEOS}},{key:"appRoutes",get:function(){return{"manage/videos/:id(/)":"editVideo","manage/videos/:id/audiences(/)":"editVideoAudiences","manage/videos/:id/subjects(/)":"editVideoSubjects"}}}]),t}(f.Core.AppRouter),Tu=function(e){function t(){return yu(this,t),Eu(this,hu(t).apply(this,arguments))}return gu(t,e),Su(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"editVideo",value:function(e){f.Core.LocationUtils.Redirect("/tools/programlookup/".concat(e))}},{key:"editVideoAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(pu,{videoId:e}))}},{key:"editVideoSubjects",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(du,{videoId:e}))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return en.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"name",get:function(){return"Videos Application"}},{key:"channelName",get:function(){return s.VIDEOS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:ou}}}}],[{key:"router",get:function(){return ju}}]),t}(f.Core.Application);n.d(t,"Actions",(function(){return i})),n.d(t,"DataPrefixes",(function(){return a})),n.d(t,"FileExtensions",(function(){return o})),n.d(t,"Layouts",(function(){return c})),n.d(t,"AppChannels",(function(){return s})),n.d(t,"DataChannels",(function(){return u})),n.d(t,"DataServices",(function(){return l})),n.d(t,"CuratorLayoutView",(function(){return T})),n.d(t,"LayoutComponent",(function(){return L})),n.d(t,"CuratorAppNavService",(function(){return x})),n.d(t,"ImageUploadDataService",(function(){return Y})),n.d(t,"UserDataService",(function(){return Q})),n.d(t,"UserDataServiceHelper",(function(){return $})),n.d(t,"LanguageDataService",(function(){return oe})),n.d(t,"CompaniesApplication",(function(){return $t})),n.d(t,"DomainOptionsApplication",(function(){return Bn})),n.d(t,"PeopleApplication",(function(){return yr})),n.d(t,"PlaylistDataService",(function(){return wr})),n.d(t,"PlaylistDataServiceHelper",(function(){return Fr})),n.d(t,"PlaylistsApplication",(function(){return gs})),n.d(t,"SeriesDataService",(function(){return lc})),n.d(t,"SeriesDataServiceHelper",(function(){return fc})),n.d(t,"SeriesApplication",(function(){return Gs})),n.d(t,"SubjectDataService",(function(){return ea})),n.d(t,"SubjectDataServiceHelper",(function(){return na})),n.d(t,"SubjectsApplication",(function(){return au})),n.d(t,"VideoDataService",(function(){return go})),n.d(t,"VideoDataServiceHelper",(function(){return jo})),n.d(t,"VideosApplication",(function(){return Tu}))}])}));
|