@clickview/curator 1.0.0-rc.0 → 1.0.0-rc.1
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/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("ReactBootstrap"),require("Formik"),require("Backbone"),require("SortableHOC"),require("Cropper"),require("Handlebars")):"function"==typeof define&&define.amd?define(["React","@clickview/shared","@clickview/common","Yup","ReactBootstrap","Formik","Backbone","SortableHOC","Cropper","Handlebars"],t):"object"==typeof exports?exports["@clickview/curator"]=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("ReactBootstrap"),require("Formik"),require("Backbone"),require("SortableHOC"),require("Cropper"),require("Handlebars")):e["@clickview/curator"]=t(e.React,e["@clickview/shared"],e["@clickview/common"],e.Yup,e.ReactBootstrap,e.Formik,e.Backbone,e.SortableHOC,e.Cropper,e.Handlebars)}(window,(function(e,t,n,r,i,a,o,c,s,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=17)}([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){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=o},function(e,t,n){e.exports={draggableVideoItem:"_1JMCe",draggedVideoItem:"_3jjle"}},function(e,t){e.exports=c},function(e,t,n){e.exports={curatorLayout:"XayF7",topNavRegion:"_3ewaZ",leftNavRegion:"_2c2o6"}},function(e,t,n){e.exports={dropdown:"_3SSd3",dropdownToggle:"GL7MR"}},function(e,t,n){var r=n(16);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=s},function(e,t,n){e.exports={navContainer:"_11O8h"}},function(e,t,n){e.exports={navContainer:"_3vLoN"}},function(e,t){e.exports=l},function(e,t,n){"use strict";n.r(t);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"}},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"},o={IMAGES:".".concat(["jpg","tif","png","bmp","gif","jpeg"].join(",."))},c={CURATOR_LAYOUT:"CuratorLayout"},s={DOMAIN_OPTIONS:"domain:options:application",PLAYLISTS:"playlists:application",SERIES:"series:application",SUBJECTS:"subjects:application",VIDEOS:"videos:application"},l={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"},u={IMAGE_UPLOAD:"ImageUploadDataService",PLAYLIST:"PlaylistDataService",SUBJECT:"SubjectDataService",USER:"UserDataService",VIDEO:"VideoDataService",SERIES:"SeriesDataService"},p=n(0),f=n(2),d=n(1),m=n(12),b=n.n(m),y=n(10),S=n.n(y);function v(e){return(v="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"!==v(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=j(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 j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t){return(T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var O=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,j(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&&T(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[d.LayoutRegions.TOP_NAV],className:S.a.topNavRegion},leftNav:{component:this.childComponents[d.LayoutRegions.LEFT_NAV],className:"py-3 ".concat(S.a.leftNavRegion)},content:{component:this.childComponents[d.LayoutRegions.CONTENT],className:"position-relative container py-3"},popup:{component:this.childComponents[d.LayoutRegions.POPUP]},alert:{component:this.childComponents[d.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[d.LayoutRegions.TOP_NAV]=this.options.getTopNavView(f.Core.AppLinkHelper.getCurrentAppLink()))}},{key:"hideLeftNav",value:function(){this.unsetRegion(d.LayoutRegions.LEFT_NAV)}},{key:"closePopup",value:function(){this.unsetRegion(d.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(j(t.prototype),"showChildView",this).call(this,"layout",p.createElement(P,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(S.a.curatorLayout)}}])&&E(n.prototype,r),i&&E(n,i),t}(f.Core.LayoutView),I=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},C=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):"")},L=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(C,{className:A("top-nav-region",t.className)},t.component),!!n.component&&p.createElement(C,{className:A("left-nav-region",n.className)},n.component),!!r.component&&p.createElement("div",{className:"content-container"},p.createElement(C,{className:A("content-region",r.className)},r.component))),!!i.component&&p.createElement(C,{className:A("popup-region",i.className)},i.component),!!a.component&&p.createElement(C,{className:A("alert-region",a.className)},a.component))},P=function(e){var t=e.provider,n=I(e,["provider"]);return t?p.createElement(t,null,p.createElement(L,Object.assign({},n))):p.createElement(L,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 x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var R=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&&x(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 B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V(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 H(e){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t){return(M=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Y=function(e){function t(){return B(this,t),J(this,H(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&&M(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 u.IMAGE_UPLOAD}},{key:"channelName",get:function(){return l.IMAGE_UPLOAD}}])&&V(n.prototype,r),i&&V(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 z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K(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,X=function(e){function t(){return z(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:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"name",get:function(){return u.USER}},{key:"channelName",get:function(){return l.USER}}])&&K(n.prototype,r),i&&K(n,i),t}(f.BaseDataService),$={dataServiceName:u.USER,dataChannelName:l.USER},ee={getCurrentUserFetchOptions:function(e,t){return Object.assign(Object.assign({},$),{eventPrefix:a.CURRENT_USER,fetchData:function(e){return e.getCurrentUser()},setData:e,onError:t})}},te={onFileSelect:function(e,t,n){if(t&&t.length){var r=new FileReader;r.addEventListener("load",(function(){return te.onReaderLoad(r,e,n)})),r.readAsDataURL(t[0])}},onReaderLoad:function(e,t,n){var r=new Image;r.src=e.result;var i=d.ImageMinDimensions[t].width,a=d.ImageMinDimensions[t].height;r.addEventListener("load",(function(){te.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=d.ImageMinDimensions[e].width,r=d.ImageMinDimensions[e].height;return!(n&&t.width<n)&&!(r&&t.height<r)}},ne={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"}(Q||(Q={}));var re=function(){return[{value:"protected",access:"r"}]},ie=function(e){return ue.getGroupNames(e).includes(Q.Developer)},ae=function(e){return Object.values(e).every((function(e){return!!e}))},oe=function(e,t){return!!e&&!!t&&e.toString()===t.toString()},ce=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function se(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 le={find:function(e,t){if(e&&e.children&&e.children.length)for(var n=function e(n){if(oe(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=le.find(e,i);a&&(n=[a].concat(se(n))),i=a?r(a):null}return n}},ue={getGroupNames:function(e){return e&&e.groups?e.groups.map((function(e){return e.name})):[]}};function pe(e){return(pe="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 fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function de(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 me(e,t){return!t||"object"!==pe(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 be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ye(e,t){return(ye=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Se=function(e){return"/api/master/v2/objects/".concat(e,"?query=thumbnail,poster,banner")},ve=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},Ee=function(){return"/api/master/v2/series"},he=function(e){return"/api/master/v2/objects/".concat(e)},ge=function(e){function t(){return fe(this,t),me(this,be(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&&ye(e,t)}(t,e),n=t,(r=[{key:"getSeries",value:function(e,t,n){return this.get({resource:Se(e),eventPrefix:"".concat(a.SERIES,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSeriesById",value:function(e,t,n){return this.get({resource:ve(e),eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createSeries",value:function(e,t,n){var r,i=this;this.chain().create({resource:Ee(),data:e,callback:function(e){return r=e},errorCallback:n,eventPrefix:a.SERIES,expiryTime:d.CacheDurations.STANDARD,errorHandler:this.alertService.error("Failed to create series.")}).func((function(){r&&r.id&&i.update({resource:he(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:he(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:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated series"),errorHandler:this.alertService.error("Failed to update series")})}},{key:"name",get:function(){return u.SERIES}},{key:"channelName",get:function(){return l.SERIES}}])&&de(n.prototype,r),i&&de(n,i),t}(f.BaseDataService),je={dataServiceName:u.SERIES,dataChannelName:l.SERIES},Te={getSeriesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},je),{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({},je),{eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),fetchData:function(t){return t.getSeriesById(e)},setData:t,onError:n})}},Oe=n(7);function Ie(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 Ce=p.createContext(void 0),Ae=function(e){var t=e.children,n=Ie(p.useState(),2),r=n[0],i=n[1],a=Ie(p.useState(!1),2),o=a[0],c=a[1],s=Ie(p.useState(),2),l=s[0],u=s[1],f={getDataUrl:function(){var e=r;return i(null),e},setDataUrl:i,imageUploaded:o,getImage:function(){var e=l;return u(null),c(!1),e},setImage:function(e){u(e),c(!0)}};return p.createElement(Ce.Provider,{value:f},t)};function Le(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 Pe=p.createContext(void 0);function Ne(e){var t=e.children,n=Le(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(d.UserDataServiceHelper.getCurrentUserFetchOptions(i),[]),p.createElement(Pe.Provider,{value:r},t)}var ke=n(4),we=n(11),De=n.n(we);function Fe(e){var t=e.className,n=void 0===t?"":t,r=e.actions,i=e.alignLeft;if(!r||!r.length)return p.createElement(p.Fragment,null);var a="".concat(De.a.dropdown," cursor-pointer rounded-circle");n&&(a+=" ".concat(n));var o="actions-dropdown-".concat(f.RandomHelper.getRandomInt());return p.createElement(ke.Dropdown,{className:a,alignRight:!i},p.createElement(ke.Dropdown.Toggle,{as:"a",id:o,className:De.a.dropdownToggle},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.More,size:d.SvgContainerSize.Standard})),p.createElement(ke.Dropdown.Menu,null,r.map((function(e,t){return p.createElement(ke.Dropdown.Item,{key:t,as:d.AppLink,appLink:e.appLink,className:e.className||""},e.name)}))))}function _e(e){var t=e.backToName,n=e.appLink;return p.createElement(d.AppLink,{appLink:n,className:"d-inline-flex align-items-center"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.ArrowLeft,size:d.SvgContainerSize.Small}),p.createElement("span",{className:"ml-1"},"Back to ".concat(t)))}function xe(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 Re=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 Ue(e){var t=e.selected,n=e.onToggle,r=Re(e,["selected","onToggle"]),i=xe(p.useState(t),2),a=i[0],o=i[1];p.useEffect((function(){return o(t)}),[t]);return p.createElement(ke.Form.Check,Object.assign({type:"checkbox",id:"checkbox-".concat(f.RandomHelper.getRandomInt()),checked:a,onChange:function(){o(!a),n(!a)}},r))}function Be(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 Ve(e){var t=e.title,n=e.onClickConfirm,r=e.confirmButtonText,i=e.cancelButtonText,a=e.closePopup,o=Be(p.useState(!1),2),c=o[0],s=o[1],l=[{variant:"link",onClick:a,buttonText:i},{variant:"primary",onClick:function(){s(!0),n()},buttonText:r,isSpinnerButton:!0,showSpinner:c}];return p.createElement(it,{title:t,closePopup:a},p.createElement(p.Fragment,null,e.children,p.createElement(ct,{buttons:l})))}Ve.defaultProps={confirmButtonText:"Confirm",cancelButtonText:"Cancel"};var Je,He=n(5),Me=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 Ye(e){var t=e.onFileSelect,n=e.acceptMultiple,r=e.mimeType,i=e.label,a=e.error,o=e.touched,c=Me(e,["onFileSelect","acceptMultiple","mimeType","label","error","touched"]),s="custom-file-input cursor-pointer";a&&o&&(s+=" is-invalid");var l=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(He.Field,Object.assign({},l,c),e.children),p.createElement(ke.Form.Label,{className:"custom-file-label",htmlFor:c.id},i)))}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 ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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},We=(ze(Je={},d.ImageType.Thumbnails,"Thumbnail"),ze(Je,d.ImageType.Banners,"Banner"),ze(Je,d.ImageType.Avatars,"Avatar"),ze(Je,d.ImageType.Logos,"Logo"),ze(Je,d.ImageType.Covers,"Cover"),ze(Je,d.ImageType.Posters,"Poster"),Je);function Ge(e){var t=e.imageType,n=e.currentImage,r=e.setNewImage,i=e.application,a=e.uploadAction,c=Ke(e,["imageType","currentImage","setNewImage","application","uploadAction"]),s=p.useContext(Ce),l=s.setDataUrl,u=s.getImage,m=s.imageUploaded,b=qe(p.useState(!1),2),y=b[0],S=b[1],v=qe(p.useState(n),2),E=v[0],h=v[1],g=qe(p.useState(!1),2),j=g[0],T=g[1],O=function(e){S(!0),l(e.src),f.Core.AppLinkHelper.trigger({application:i,action:a,args:[t]})};return p.useEffect((function(){if(y){var e=u();e&&(S(!1),h(e),r({fileId:e.id,fileIdType:d.FileIdType.ImageAPIv2}))}}),[m]),p.createElement("div",{className:"form-group"},p.createElement("div",{className:"form-control h-auto py-2"},p.createElement("label",null,We[t]),p.createElement(Ye,Object.assign({label:"Choose a ".concat(We[t].toLowerCase()),name:"image",mimeType:o.IMAGES,onFileSelect:function(e){return te.onFileSelect(t,e,O)}},c)),!!E&&!!E.url&&p.createElement(p.Fragment,null,!j&&p.createElement("div",{className:"pb-2 ".concat(t===d.ImageType.Banners?"w-100":"w-50")},p.createElement("img",{src:d.ImageHelper.createUrl(E.url),className:"img img-fluid"})),p.createElement("div",{className:"d-flex justify-content-center"},p.createElement(d.SvgContainer,{svgName:j?d.cvSvgLibrary.ChevronDown:d.cvSvgLibrary.ChevronUp,size:d.SvgContainerSize.Large,className:"svg-container cursor-pointer",onClick:function(){return T(!j)},title:j?"Show image":"Hide image",tooltipPlacement:"top"})))))}var Ze,Qe=n(13),Xe=n.n(Qe);function $e(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"}(Ze||(Ze={}));var et=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function tt(e){var t=e.dataUrl,n=e.minHeight,r=e.minWidth,i=e.onCrop,a=e.onCancel,o=p.useRef(),c=p.useRef(),s=$e(p.useState(!1),2),l=s[0],u=s[1],m=$e(p.useState(!1),2),b=m[0],y=m[1];return p.useEffect((function(){var e=new Image;e.src=t;var i=o.current.offsetWidth/e.width;return c.current=new Xe.a(o.current,{viewMode:Ze.RestrictToCanvas,autoCropArea:1,aspectRatio:r/n,minCropBoxWidth:r*i,minCropBoxHeight:n*i,ready:function(){return u(!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(ke.Button,{variant:"link",onClick:a},"Cancel"),p.createElement(d.SpinnerButton,{onClick:function(){if(l){y(!0);var e=c.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(et);if(t)return t[1]}(t));f.FunctionHelper.isFunction(i)&&i(e)}},disabled:!l,showSpinner:b},"Crop")))}function nt(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(Fe,{actions:n})))}function rt(){return p.createElement("div",{className:"text-center p-5"},p.createElement(ke.Spinner,{as:"div",animation:"border",role:"status"}))}function it(e){var t=e.title,n=e.closeButton,r=void 0===n||n,i=e.closePopup,a=e.onEntered,o=e.showLoadingSpinner,c=Object.assign({show:!0,onHide:i},f.FunctionHelper.isFunction(a)?{onEntered:a}:{});return p.createElement(ke.Modal,Object.assign({},c),!!t&&p.createElement(ke.Modal.Header,{closeButton:r},p.createElement(ke.Modal.Title,null,t)),o?p.createElement(rt,null):p.createElement(ke.Modal.Body,null,e.children))}var at,ot=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(e){e.Button="button",e.Reset="reset",e.Submit="submit"}(at||(at={}));function ct(e){var t=e.buttons;return p.createElement("div",{className:"d-flex justify-content-end border-top pt-3 px-3 mx-n3"},t.map((function(e,t){return function(e,t){var n=e.buttonText,r=e.type,i=void 0===r?at.Button:r,a=e.isSpinnerButton,o=e.showSpinner,c=void 0!==o&&o,s=e.className,l=ot(e,["buttonText","type","isSpinnerButton","showSpinner","className"]),u=Object.assign({key:t,type:i,className:"ml-2".concat(s?" ".concat(s):"")},l);return a?p.createElement(d.SpinnerButton,Object.assign({showSpinner:c},u),n):p.createElement(ke.Button,Object.assign({},u),n)}(e,t)})))}function st(e){var t=e.tabs,n=e.isItemActive;return p.createElement(ke.Nav,{fill:!0,variant:"tabs"},t.map((function(e,t){return p.createElement(ke.Nav.Item,{key:t},p.createElement(ke.Nav.Link,{as:d.AppLink,appLink:e.appLink,active:n(e)},e.label))})))}st.defaultProps={isItemActive:ne.isItemActive};var lt=n(6),ut=n.n(lt);function pt(e){var t=e.name,n=e.appLink,r=e.onSelect,i=e.isDisabled,a=e.className,o=e.actions,c=ut.a.text;return a&&(c+=" ".concat(a)),i?p.createElement("a",{className:"".concat(c," text-muted ").concat(ut.a.disabled)},t):p.createElement(p.Fragment,null,n?p.createElement(d.AppLink,{appLink:n,className:c},t):p.createElement("a",{onClick:r,className:c},t),!!o&&p.createElement(Fe,{className:ut.a.actions,actions:o}))}function ft(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 dt(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 oe(t.id,e)})),s=p.useMemo((function(){return Array.isArray(n)&&n.some((function(e){return le.find(t,e)}))}),[t,n]),l=ft(p.useState(s),2),u=l[0],m=l[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&&ut.a.selected||s&&ut.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(u?"":" ".concat(ut.a.collapsed))},p.createElement("div",{className:"position-relative"},p.createElement("span",{className:ut.a.node},b&&p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.ChevronDown,size:d.SvgContainerSize.Small,className:"svg-container ".concat(ut.a.chevron),onClick:function(){return m(!u)}}),p.createElement(pt,Object.assign({},y))),u&&p.createElement(bt,Object.assign({},e))))}var mt=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 bt(e){var t=e.tree,n=mt(e,["tree"]);return t&&t.children?p.createElement("ul",{className:"m-0 p-0 ".concat(ut.a.tree)},t.children.map((function(e){return p.createElement(dt,Object.assign({key:e.id,tree:e},n))}))):p.createElement(p.Fragment,null)}var yt={getChord:function(e,t){return le.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=le.find(t,e);o&&(n=Object.assign((r={},i=e,a=yt.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 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")}()}var vt=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 Et(e){var t=e.onSelect,n=e.label,r=e.hideCollapseBtn,i=e.collapse,a=e.noSelectionMessage,o=e.isNodeDisabled,c=e.getSelectedItemAppLink,s=vt(e,["onSelect","label","hideCollapseBtn","collapse","noSelectionMessage","isNodeDisabled","getSelectedItemAppLink"]),l=s.tree,u=s.selectedIds,m=St(p.useState(yt.getState(u,l)),2),b=m[0],y=m[1];p.useEffect((function(){return y(yt.getState(u,l))}),[u,l]);var S=St(p.useState(!!i),2),v=S[0],E=S[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(!v)}},v?"Expand":"Collapse")),!v&&p.createElement("div",{className:"py-2 border-top"},p.createElement(bt,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(d.AppLink,{appLink:c(e)},b[e]):b[e])})))))}var ht=n(9),gt=function(e){var t="bg-white";return e&&(t+=" ".concat(e)),t};function jt(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:gt(a)},!!o&&p.createElement("td",null,p.createElement("span",null,o)),p.createElement("td",null,c?p.createElement(d.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(Fe,{actions:r(t)}))))}var Tt=Object(ht.SortableElement)((function(e){return p.createElement(jt,Object.assign({sortable:!0},e))})),Ot=n(8),It=n.n(Ot),Ct=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},At=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)))},Lt=p.forwardRef((function(e,t){var n=e.videos,r=e.sortable,i=Ct(e,["videos","sortable"]);return p.createElement("tbody",{ref:t},!d.CollectionHelper.isEmpty(n)&&n.data.map((function(e,t){return r?p.createElement(Tt,Object.assign({key:e.id,index:t,itemNumber:t+1,video:e,className:It.a.draggableVideoItem},i)):p.createElement(jt,Object.assign({video:e},i))})))}));var Pt=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},Nt=Object(ht.SortableContainer)((function(e){var t=e.forwardedRef,n=Pt(e,["forwardedRef"]);return p.createElement(Lt,Object.assign({sortable:!0,ref:t},n))})),kt=function(e){return function(t){var n=t.node,r=e.current;if(r){r.classList.add(It.a.sortingContainer);var i=r.querySelector(".".concat(It.a.draggedVideoItem));n.childNodes.forEach((function(e,t){return i.childNodes[t].style.width="".concat(e.offsetWidth,"px")}))}}},wt=function(e,t){return function(n){var r=e.current;r&&r.classList.remove(It.a.sortingContainer),t(n.oldIndex,n.newIndex)}};function Dt(e){var t=e.onSortEnd,n=e.emptyMessage,r=Pt(e,["onSortEnd","emptyMessage"]),i=p.useRef();return d.CollectionHelper.isEmpty(e.videos)?p.createElement("div",null,n):p.createElement(ke.Table,{responsive:!0},p.createElement(At,Object.assign({sortable:!0},e)),p.createElement(Nt,Object.assign({forwardedRef:i,onSortStart:kt(i),onSortEnd:wt(i,t),lockAxis:"y",lockToContainerEdges:!0,distance:1,helperClass:It.a.draggedVideoItem,helperContainer:function(){return i.current}},r)))}function Ft(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 _t(e){var t=e.imageType,n=e.closePopup,r=p.useContext(Ce),i=r.getDataUrl,a=r.setImage,o=Ft(p.useState(i()),1)[0],c=Ft(p.useState(!1),2),s=c[0],l=c[1],m=Object(f.useService)(u.IMAGE_UPLOAD),b=function(e){a(e),n()},y={dataUrl:o,imageType:t,minWidth:d.ImageMinDimensions[t].width,minHeight:d.ImageMinDimensions[t].height,onCrop:function(e){return m.uploadBase64Image(e,t,b,n)},onCancel:n};return p.createElement(it,{title:"Crop Image",closePopup:n,onEntered:function(){return l(!0)}},s&&p.createElement(tt,Object.assign({},y)))}Dt.defaultProps={emptyMessage:"There are no videos in this list."};var xt=function(e){var t=e.children;return p.createElement(Ne,null,p.createElement(Ae,null,t))},Rt=n(3),Ut=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Rt.string().trim().max(65535,"Description is too long").default(""),poster:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown(),banner:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown()}).noUnknown(),Bt=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 ie(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 Vt(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 Jt(e){var t=Vt(p.useState(!1),2),n=t[0],r=t[1];return p.useEffect((function(){e.isValid&&e.dirty?r(!0):r(!1)}),[e.isValid,e.dirty,e.values]),p.useEffect((function(){e.isSubmitting&&r(!1)}),[e.isSubmitting]),n}function Ht(e){var t=Object(He.useFormikContext)(),n=Jt(t);return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this series",autoFocus:!0}),p.createElement(d.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this series here"}),p.createElement(Ge,{imageType:d.ImageType.Posters,currentImage:t.values.poster,setNewImage:function(e){return t.setFieldValue("poster",e)},application:s.SERIES,uploadAction:i.Series.UPLOAD_IMAGE}),p.createElement(Ge,{imageType:d.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(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(Fe,{actions:e.actions})))}function Mt(e){return p.createElement(d.FormWrapper,{initialValues:e.series,validationSchema:Ut,onSubmit:e.saveSeries},p.createElement(Ht,{id:e.series&&e.series.id}))}var Yt,qt,zt,Kt,Wt=function(e){return function(t){return t.appLink.action===e}};function Gt(e){var t=e.seriesId,n=e.activeAction,r=p.useContext(Pe);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(st,{tabs:Bt(r,t),isItemActive:Wt(n)}))}function Zt(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 Qt(e){var t=e.seriesId,n=Zt(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(u.SERIES);Object(f.useFetch)(Te.getSeriesFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(Gt,{seriesId:t,activeAction:i.Series.EDIT_SERIES}),!!r&&p.createElement(Mt,{series:r,saveSeries:function(e,n){return o.updateSeries(t,e,n,n)}}))}!function(e){e[e.Subject=0]="Subject",e[e.Classification=1]="Classification"}(Yt||(Yt={})),function(e){e.Playlists="playlists",e.Series="series",e.Videos="videos"}(qt||(qt={})),function(e){e.Root="0"}(zt||(zt={})),function(e){e.Root="root"}(Kt||(Kt={}));var Xt=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default(""),levelIds:Rt.array().of(Rt.string()).required("A level is required").default([])}).noUnknown(),$t=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentIds:Rt.array().of(Rt.string()).default([Kt.Root]),subjectIds:Rt.array().of(Rt.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:Rt.mixed().required("Type is required").default(d.ClassificationType.Subject),emphasize:Rt.boolean().default(!1),cover:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown(),banner:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown()}).noUnknown(),en=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),tn=Rt.object().shape({name:Rt.string().max(255,"Name is too long").required("Name is required"),description:Rt.string().max(65535,"Description is too long").required("Description is required")}),nn=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentId:Rt.string().default(zt.Root)}).noUnknown(),rn={singularizeMemberType:function(e){switch(e){case qt.Playlists:return"playlist";case qt.Series:return"series";case qt.Videos:return"video"}},getMemberAppLink:function(e,t){var n=[t];switch(e){case qt.Playlists:return{application:s.PLAYLISTS,action:i.Playlists.EDIT_PLAYLIST,args:n};case qt.Series:return{application:s.SERIES,action:i.Series.EDIT_SERIES,args:n};case qt.Videos:return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:n}}},getMemberActions:function(e,t,n,r){return[{name:"Remove ".concat(rn.singularizeMemberType(n)),appLink:{application:s.SUBJECTS,action:t===Yt.Subject?i.Subjects.REMOVE_SUBJECT_MEMBER:i.Subjects.REMOVE_CLASSIFICATION_MEMBER,args:[e,r,n]},className:"text-danger"}]}},an=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]}]},on=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]}}]},cn=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 sn(e){return(sn="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 ln(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 un(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pn(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){return!t||"object"!==sn(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 dn(e){return(dn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function mn(e,t){return(mn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var bn=function(){return"/api/subjects/v1/subjects/tree"},yn=function(e){return"/api/subjects/v1/subjects/".concat(e)},Sn=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/").concat(t,"?query={limit:100}")},vn=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},En=function(){return"/api/subjects/v1/subjects"},hn=function(e){return"/api/subjects/v1/subjects/".concat(e)},gn=function(e){return"/api/subjects/v1/subjects/".concat(e)},jn=function(e){return"/api/subjects/v1/objects/".concat(e,"/subjects")},Tn=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/subjects?addToClassifications=").concat(!!t)},On=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?addToClassifications=").concat(!!t)},In=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Cn=function(){return"/api/subjects/v1/presentations"},An=function(e){return"/api/subjects/v1/presentations/".concat(e)},Ln=function(){return"/api/subjects/v1/presentations"},Pn=function(e){return"/api/subjects/v1/presentations/".concat(e)},Nn=function(e){return"/api/subjects/v1/presentations/".concat(e,"/classifications/tree")},kn=function(e){return"/api/subjects/v1/classifications/".concat(e,"?query=cover,banner")},wn=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/").concat(t,"?query={limit:100}")},Dn=function(){return"/api/subjects/v1/classifications"},Fn=function(e){return"/api/subjects/v1/classifications/".concat(e)},_n=function(e){return"/api/subjects/v1/classifications/".concat(e)},xn=function(e){return"/api/subjects/v1/objects/".concat(e,"/classifications")},Rn=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/classifications?presentationId=").concat(t)},Un=function(e){return"/api/subjects/v1/classifications/".concat(e,"/objects")},Bn=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Vn=function(){return"/api/subjects/v1/levels"},Jn=function(e){return"/api/subjects/v1/levels/".concat(e)},Hn=function(){return"/api/subjects/v1/levels"},Mn=function(e){return"/api/subjects/v1/levels/".concat(e)},Yn=function(e){return"/api/subjects/v1/objects/".concat(e,"/levels")},qn=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/levels?addToAudiences=").concat(!!t)},zn=function(e){return"/api/subjects/v1/presentations/".concat(e,"/audiences")},Kn=function(e){return"/api/subjects/v1/audiences/".concat(e)},Wn=function(){return"/api/subjects/v1/audiences"},Gn=function(e){return"/api/subjects/v1/audiences/".concat(e)},Zn=function(e){return"/api/subjects/v1/audiences/".concat(e)},Qn=function(e){return"/api/subjects/v1/objects/".concat(e,"/audiences")},Xn=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/audiences?presentationId=").concat(t)},$n=function(e){return e.data},er=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},tr=function(e){function t(){return un(this,t),fn(this,dn(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&&mn(e,t)}(t,e),n=t,(r=[{key:"getPresentations",value:function(e,t){return this.get({resource:Cn(),formatData:$n,eventPrefix:a.PRESENTATIONS,expiryTime:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getPresentation",value:function(e,t,n){return this.get({resource:An(e),formatData:$n,eventPrefix:"".concat(a.PRESENTATION,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPresentation",value:function(e,t,n){return this.create({resource:Ln(),data:e,formatData:$n,callback:t,errorCallback:n,eventPrefix:a.PRESENTATION,invalidationKeys:[a.PRESENTATIONS],expiryTime:d.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:Pn(e),data:t,formatData:$n,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PRESENTATION,":").concat(e),invalidationKeys:["".concat(a.PRESENTATION,":").concat(e),a.PRESENTATIONS],expiryTime:d.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:bn(),formatData:function(e){return{children:e.data,name:zt.Root,id:null}},eventPrefix:a.SUBJECTS,expiryTime:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getSubject",value:function(e,t,n){return this.get({resource:yn(e),formatData:$n,eventPrefix:"".concat(a.SUBJECT,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSubjectMemberIds",value:function(e,t,n,r){return this.get({resource:Sn(e,t),formatData:$n,eventPrefix:"".concat(a.SUBJECT,":").concat(e,":").concat(t),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"getSubjectClassifications",value:function(e,t,n,r,i){return this.get({resource:vn(e,t,n),eventPrefix:er(e,t,n),expiryTime:d.CacheDurations.STANDARD,callback:r,errorCallback:i})}},{key:"createSubject",value:function(e,t,n){return this.create({resource:En(),data:e,formatData:$n,callback:t,errorCallback:n,eventPrefix:a.SUBJECT,invalidationKeys:[a.SUBJECTS],expiryTime:d.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:hn(e),data:t,formatData:$n,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_SUBJECT,":").concat(e),invalidationKeys:["".concat(a.SUBJECT,":").concat(e),a.SUBJECTS],expiryTime:d.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:gn(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:jn(e),formatData:$n,eventPrefix:"".concat(t,":").concat(e,":").concat(a.SUBJECTS),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectSubjects",value:function(e,t,n,r,i,o){var c=rn.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,ln(t.map((function(e){return"".concat(a.SUBJECTS,":").concat(e,":").concat(n)})))),this.update({resource:Tn(e,r),data:t,formatData:$n,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?rn.singularizeMemberType(n):n,s=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(ln(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))),ln(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)}))));return this.create({resource:On(e,r),data:t,formatData:$n,callback:i,errorCallback:o,eventPrefix:"".concat(a.ADD_TO_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:s,expiryTime:d.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?rn.singularizeMemberType(n):n,c=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(ln(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))));return this.delete({resource:In(e,t),callback:r,errorCallback:i,eventPrefix:"".concat(a.REMOVE_FROM_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:c,expiryTime:d.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:Nn(e),formatData:function(e){return{children:e.data,name:Kt.Root,id:null}},eventPrefix:"".concat(a.CLASSIFICATIONS,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassification",value:function(e,t,n){return this.get({resource:kn(e),formatData:$n,eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassificationMembers",value:function(e,t,n,r){return this.get({resource:wn(e,t),formatData:$n,eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e,":").concat(t),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"createClassification",value:function(e,t,n){return this.create({resource:Dn(),data:e,formatData:$n,callback:t,errorCallback:n,eventPrefix:a.CLASSIFICATION,invalidationKeys:[a.CLASSIFICATIONS],expiryTime:d.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:Fn(e),data:t,formatData:$n,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_CLASSIFICATION,":").concat(e),invalidationKeys:["".concat(a.CLASSIFICATION,":").concat(e),a.CLASSIFICATIONS],expiryTime:d.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:_n(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:xn(e),formatData:$n,eventPrefix:"".concat(t,":").concat(e,":").concat(a.CLASSIFICATIONS),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectClassifications",value:function(e,t,n,r,i,o){var c=rn.singularizeMemberType(r),s=["".concat(r,":").concat(e,":").concat(a.CLASSIFICATIONS)];return s.push.apply(s,ln(n.map((function(e){return"".concat(a.CLASSIFICATION,":").concat(e,":").concat(r)})))),this.update({resource:Rn(e,t),data:n,formatData:$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?rn.singularizeMemberType(n):n,l=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&l.push(er(r,i,n)),l.push.apply(l,ln(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.create({resource:Un(e),data:t,formatData:$n,callback:o,errorCallback:c,eventPrefix:"".concat(a.ADD_TO_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:l,expiryTime:d.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?rn.singularizeMemberType(n):n,l=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&l.push(er(r,i,n)),l.push.apply(l,ln(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.delete({resource:Bn(e,t),callback:o,errorCallback:c,eventPrefix:"".concat(a.REMOVE_FROM_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:l,expiryTime:d.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:Vn(),formatData:$n,eventPrefix:a.LEVELS,expiryTime:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getLevel",value:function(e,t,n){return this.get({resource:Jn(e),formatData:$n,eventPrefix:"".concat(a.LEVEL,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createLevel",value:function(e,t,n){return this.create({resource:Hn(),data:e,formatData:$n,callback:t,errorCallback:n,eventPrefix:a.LEVEL,invalidationKeys:[a.LEVELS],expiryTime:d.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:Mn(e),data:t,formatData:$n,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_LEVEL,":").concat(e),invalidationKeys:["".concat(a.LEVEL,":").concat(e),a.LEVELS],expiryTime:d.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:Yn(e),formatData:$n,eventPrefix:"".concat(t,":").concat(e,":").concat(a.LEVELS),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectLevels",value:function(e,t,n,r,i,o){var c=rn.singularizeMemberType(n),s=["".concat(n,":").concat(e,":").concat(a.LEVELS)];return r&&s.push("".concat(n,":").concat(e,":").concat(a.AUDIENCES)),this.update({resource:qn(e,r),data:t,formatData:$n,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:zn(e),formatData:$n,callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCES,":").concat(e),expiryTime:d.CacheDurations.STANDARD})}},{key:"getAudience",value:function(e,t,n){return this.get({resource:Kn(e),formatData:$n,callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCE,":").concat(e),expiryTime:d.CacheDurations.STANDARD})}},{key:"createAudience",value:function(e,t,n){return this.create({resource:Wn(),data:e,formatData:$n,callback:t,errorCallback:n,eventPrefix:a.AUDIENCE,invalidationKeys:[a.AUDIENCES],expiryTime:d.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:Gn(e),data:t,formatData:$n,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_AUDIENCE,":").concat(e),invalidationKeys:["".concat(a.AUDIENCE,":").concat(e),a.AUDIENCES],expiryTime:d.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:Zn(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:Qn(e),formatData:$n,eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectAudiences",value:function(e,t,n,r,i,o){var c=rn.singularizeMemberType(r);return this.update({resource:Xn(e,t),data:n,formatData:$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 u.SUBJECT}},{key:"channelName",get:function(){return l.SUBJECT}}])&&pn(n.prototype,r),i&&pn(n,i),t}(f.BaseDataService),nr={dataServiceName:u.SUBJECT,dataChannelName:l.SUBJECT},rr={getSubjectTreeFetchOptions:function(e,t){return Object.assign(Object.assign({},nr),{eventPrefix:a.SUBJECTS,fetchData:function(e){return e.getSubjectTree()},setData:e,onError:t})},getSubjectFetchOptions:function(e,t,n){return Object.assign(Object.assign({},nr),{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({},nr),{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({},nr),{eventPrefix:er(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({},nr),{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({},nr),{eventPrefix:a.PRESENTATIONS,fetchData:function(e){return e.getPresentations()},setData:e,onError:t})},getPresentationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},nr),{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({},nr),{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({},nr),{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({},nr),{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({},nr),{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({},nr),{eventPrefix:a.LEVELS,fetchData:function(e){return e.getLevels()},setData:e,onError:t})},getLevelFetchOptions:function(e,t,n){return Object.assign(Object.assign({},nr),{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({},nr),{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({},nr),{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({},nr),{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({},nr),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),fetchData:function(n){return n.getObjectAudiences(e,t)},setData:n,onError:r})}};function ir(e,t){p.useEffect((function(){e.presentations&&!e.currentPresentation&&d.StateHelper.getSetStateByKey(t,"currentPresentation")(f.ArrayHelper.first(e.presentations))}),[e.presentations])}var ar=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},or=function(e,t){var n=e.levelIds;return t.filter((function(e){return n.includes(e.id)}))};function cr(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 sr(e){var t,n=e.audience,r=e.levels;return p.createElement("tr",null,p.createElement("td",null,p.createElement(d.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(d.AppLink,{key:e.id,appLink:ar(e),className:"mr-2"},e.name)}))))}function lr(e){var t=e.audiences,n=e.levels;return p.createElement(ke.Table,{responsive:!0,bordered:!0},p.createElement(cr,{showLevels:!!t.length}),p.createElement("tbody",null,t.length?t.map((function(e){return p.createElement(sr,{key:e.masterId,audience:e,levels:or(e,n)})})):p.createElement("tr",null,p.createElement("td",null,"This presentation has no audiences."))))}function ur(e){var t=null===e.masterId||void 0===e.masterId,n=Object(He.useFormikContext)(),r=Jt(n);return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this audience",autoFocus:!0}),p.createElement(d.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(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(ke.Button,{as:d.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_AUDIENCE,args:[e.presentationId,e.masterId]}},"Delete")))}function pr(e){return p.createElement(d.FormWrapper,{initialValues:e.audience,validationSchema:Xt,onSubmit:e.saveAudience},p.createElement(ur,{masterId:e.audience&&e.audience.masterId,presentationId:e.presentationId,levels:e.levels}))}function fr(e){var t=e.objectAudiences,n=e.presentationAudiences;return t.filter((function(e){return n.some((function(t){return t.masterId===e.masterId}))}))}function dr(e){var t,n,r,i,a,o=rn.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(Pr,{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(Dr,{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(lr,{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(br,{initialValues:{audienceIds:fr(e).map((function(e){return e.masterId}))},saveAudiences:e.saveAudiences,audiences:c}))}function mr(e){var t=Object(He.useFormikContext)(),n=Jt(t);return p.createElement(He.Form,null,p.createElement(d.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(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Audiences")))}function br(e){return p.createElement(d.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.audienceIds;return e.saveAudiences(r,n)},enableReinitialize:!0},p.createElement(mr,{audiences:e.audiences}))}function yr(e){var t=e.item,n=e.getItemAppLink,r=e.actions;return p.createElement("tr",null,p.createElement("td",null,p.createElement(d.AppLink,{appLink:n(t)},t.name)),r&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(Fe,{actions:r}))))}function Sr(e){var t=e.items,n=e.memberType,r=e.getItemAppLink,i=e.getActions;if(!t.length)return p.createElement("div",{className:"py-5"},"No ".concat(n," in this classification."));var a="".concat(ce(rn.singularizeMemberType(n))," Name");return p.createElement(ke.Table,{responsive:!0},p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,a),f.FunctionHelper.isFunction(i)&&p.createElement("th",null))),p.createElement("tbody",null,t.map((function(e){return p.createElement(yr,{item:e,key:e.id,getItemAppLink:r,actions:f.FunctionHelper.isFunction(i)&&i(e)})}))))}function vr(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 Er=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}};function hr(e){var t=Object(He.useFormikContext)(),n=Jt(t),r=null===e.id||void 0===e.id,a=!r||!(!t.values.parentIds||!t.values.parentIds.length),o=vr(p.useState(a),2),c=o[0],l=o[1];p.useEffect((function(){return l(a)}),[e.id,t.values.parentIds]),p.useEffect((function(){t.values.subjectIds.length&&!t.touched.subjectIds&&t.setFieldTouched("subjectIds",!0)}),[t.values.subjectIds]);var u=function(e){return t.setFieldValue("parentIds",f.ArrayHelper.addOrRemove(t.values.parentIds.map((function(e){return e.toString()})),e.id.toString()))},m=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(d.FormHelper.getCustomFormControlClassName(t.errors,t.touched,e)," h-auto py-2")};return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this classification",autoFocus:!0}),p.createElement(d.FormField,{as:"select",label:"Type",name:"type",id:"type",value:t.values.type},f.ObjectHelper.getEnumKeys(d.ClassificationType).map((function(e){return p.createElement("option",{key:e,value:d.ClassificationType[e]},e)}))),p.createElement(d.FormField,{label:"Emphasize",name:"emphasize",id:"emphasize",type:"checkbox",checked:t.values.emphasize}),p.createElement(d.FormField,{name:"parentIds"},(function(){return p.createElement("div",{className:b("parentIds")},p.createElement(Et,{label:"Parent Classification(s)",tree:e.classificationTree,selectedIds:t.values.parentIds,onSelect:u,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=le.find(n,r);return!!le.find(t,e.id)})}));var n,r})),p.createElement(d.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:b("subjectIds")},p.createElement(Et,{label:"Mapped Subject(s)",tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:m,collapse:!r,getSelectedItemAppLink:Er}))})),p.createElement(Ge,{imageType:d.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.SUBJECTS,uploadAction:i.Subjects.UPLOAD_IMAGE}),p.createElement(Ge,{imageType:d.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(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},r?"Create":"Save"),!r&&p.createElement(ke.Button,{as:d.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e.presentationId,e.id]}},"Delete")))}function gr(e){return p.createElement(d.FormWrapper,{initialValues:e.classification,validationSchema:$t,onSubmit:e.saveClassification},p.createElement(hr,{id:e.classification&&e.classification.id,presentationId:e.presentationId,classificationTree:e.classificationTree,subjectTree:e.subjectTree}))}var jr=function(e){return function(t){if(!e)return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION;switch(e){case qt.Playlists:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;case qt.Series:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_SERIES;case qt.Videos:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_VIDEOS}}};function Tr(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(st,{tabs:cn(t.id,n),isItemActive:jr(r)}))):p.createElement(p.Fragment,null)}function Or(e){var t=Object(He.useFormikContext)(),n=Jt(t),r=p.useContext(d.AppLinkContext),i=r&&r.getClassificationAppLink,a=function(e){return t.setFieldValue("classificationIds",f.ArrayHelper.addOrRemove(t.values.classificationIds.map((function(e){return e.toString()})),e.id.toString()))},o="".concat(d.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"classificationIds")," h-auto py-2");return p.createElement(He.Form,null,p.createElement(d.FormField,{name:"classificationIds"},(function(){return p.createElement("div",{className:o},p.createElement(Et,{label:"Mapped Classification(s)",tree:e.classificationTree,selectedIds:t.values.classificationIds,onSelect:a,getSelectedItemAppLink:i,isNodeDisabled:e.isClassificationDisabled}))})),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Classifications")))}function Ir(e){return p.createElement(d.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.classificationIds;return e.saveClassifications(r,n)},enableReinitialize:!0},p.createElement(Or,{classificationTree:e.classificationTree,isClassificationDisabled:e.isClassificationDisabled}))}function Cr(e){var t=null===e.id||void 0===e.id,n=Object(He.useFormikContext)(),r=Jt(n);return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this level",autoFocus:!0}),p.createElement(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"))}function Ar(e){return p.createElement(d.FormWrapper,{initialValues:e.level,validationSchema:en,onSubmit:e.saveLevel},p.createElement(Cr,{id:e.level&&e.level.id}))}function Lr(e){var t=rn.singularizeMemberType(e.memberType),n=Object(He.useFormikContext)(),r=Jt(n);return p.createElement(He.Form,null,p.createElement(d.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(d.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(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},"Save Levels")))}function Pr(e){return p.createElement(d.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.levelIds,i=t.addToAudiences;return e.saveLevels(r,i,n)}},p.createElement(Lr,{levels:e.levels,memberType:e.memberType}))}function Nr(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(d.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)}function kr(e){var t=e.values,n=t.name,r=t.description,i=e.id,a=e.isSubmitting,o=!i;return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n,placeholder:"Enter a name for this presentation",autoFocus:!0}),p.createElement(d.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:r,placeholder:"Describe this presentation here"}),p.createElement(d.SpinnerButton,{showSpinner:a,type:"submit"},o?"Create":"Save"))}function wr(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(He.Formik,{initialValues:{name:a,description:c},validationSchema:tn,onSubmit:s},(function(e){return p.createElement(kr,Object.assign({id:r},e))}))}Nr.defaultProps={emptyMessage:"There is nothing here."};function Dr(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(ke.Form.Label,null,i),p.createElement(ke.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 Fr(e){return p.createElement(p.Fragment,null,p.createElement("h4",null,"".concat(ce(e.memberType))),p.createElement(ke.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(d.AppLink,{appLink:rn.getMemberAppLink(e.memberType,t.id)},t.name)))})))),p.createElement(Mr,{initialValues:{subjectIds:[],addToClassifications:!0},subjectTree:e.subjectTree,saveSubjects:e.onClickAddToSubject,memberType:e.memberType,saveBtnText:"Add to subject",subjectRequired:!0}))}function _r(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 xr(e){var t=rn.singularizeMemberType(e.memberType),n=[].concat(_r(e.objectClassifications),_r(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(Mr,{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(Dr,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),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(Ir,{initialValues:{classificationIds:e.objectClassifications.map((function(e){return e.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 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")}()}Dr.defaultProps={label:"Presentation"};function Ur(e){var t=!e.id,n=Object(He.useFormikContext)(),r=Jt(n),a=!t||!!n.values.parentId,o=Rr(p.useState(a),2),c=o[0],l=o[1];p.useEffect((function(){return l(a)}),[e.id,n.values.parentId]);var u=function(e){var t=e.id===n.values.parentId?null:e.id;n.setFieldValue("parentId",t)},f="".concat(d.FormHelper.getCustomFormControlClassName(n.errors,n.touched,"parentId")," h-auto py-2");return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this subject",autoFocus:!0}),p.createElement(d.FormField,{name:"parentId"},(function(){return p.createElement("div",{className:f},p.createElement(Et,{label:"Parent Subject",tree:e.subjectTree,selectedIds:[n.values.parentId],onSelect:u,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=le.find(t,r);return!!le.find(n,e.id)})}));var t,r})),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(ke.Button,{as:d.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_SUBJECT,args:[e.id]}},"Delete")))}function Br(e){return p.createElement(d.FormWrapper,{initialValues:e.subject,validationSchema:nn,onSubmit:e.saveSubject},p.createElement(Ur,{id:e.subject&&e.subject.id,subjectTree:e.subjectTree}))}var Vr=function(e){return function(t){return t.appLink.action===e}};function Jr(e){var t=e.subjectId,n=e.activeAction;return p.createElement(p.Fragment,null,p.createElement(ke.Alert,{variant:"danger"},"Warning: You are editing the backbone subjects."),p.createElement("div",{className:"py-2"},p.createElement(st,{tabs:on(t),isItemActive:Vr(n)})))}function Hr(e){var t=Object(He.useFormikContext)(),n=Jt(t),r=p.useContext(d.AppLinkContext),i=r&&r.getSubjectAppLink,a=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)},o=rn.singularizeMemberType(e.memberType),c="".concat(d.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"subjectIds")," h-auto py-2");return p.createElement(He.Form,null,p.createElement(d.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:c},p.createElement(Et,{label:"Mapped Subject".concat(e.allowMultiple?"(s)":""),tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:a,collapse:!!t.initialValues.subjectIds.length,getSelectedItemAppLink:i}))})),p.createElement(d.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(o," 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(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.saveBtnText)))}function Mr(e){var t;return p.createElement(d.FormWrapper,{initialValues:e.initialValues,validationSchema:(t=e.subjectRequired,Rt.object().shape({subjectIds:t?Rt.array().of(Rt.string()).min(1,"A subject is required").required("A subject is required"):Rt.array().of(Rt.string()),addToClassifications:Rt.boolean().default(!0)}).noUnknown()),onSubmit:function(t,n){var r=t.subjectIds,i=t.addToClassifications;return e.saveSubjects(r,i,n)}},p.createElement(Hr,{subjectTree:e.subjectTree,memberType:e.memberType,allowMultiple:e.allowMultiple,saveBtnText:e.saveBtnText}))}Hr.defaultProps={saveBtnText:"Save"};var Yr=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(d.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.")))},qr=function(e){return p.createElement(p.Fragment,null,!!e.presentations&&!!e.classificationDictionary&&e.presentations.map((function(t){return p.createElement(Yr,{key:t.id,presentation:t,classifications:e.classificationDictionary[t.id]})})))},zr=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 Kr(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(Ue,{selected:e.getIsClassificationSelected(t),onToggle:function(n){return e.onToggleClassification(t.id,n)}})),p.createElement(d.AppLink,{appLink:e.getClassificationAppLink(t.id)},function(e,t){return t?e.name:"Classification: ".concat(e.name)}(t,e.showClassificationSubHeader)))})))}function Wr(e){var t=e.memberType,n=e.hasActions,r=e.classifications,i=zr(e,["memberType","hasActions","classifications"]),a="".concat(ce(rn.singularizeMemberType(t))," Name"),o=!!r&&!!r.length,c=o&&r.length>1,s=o?2:1,l=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(Kr,Object.assign({},l))),n&&p.createElement("th",{rowSpan:s})),o&&c&&p.createElement("tr",null,p.createElement(Kr,Object.assign({},l))))}function Gr(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,l=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,l?p.createElement(d.AppLink,{appLink:o(n)},r):r),!!a.length&&a.map((function(e){return p.createElement("td",{key:e.id},p.createElement(Ue,{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(Fe,{actions:s}))))}var Zr=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 Qr(e,t){return function(n){var r=n[e],i=d.CollectionHelper.length(r);return!!i&&i===t.length}}function Xr(e){var t=e.members,n=e.memberType,r=e.getActions,i=e.classifications,a=e.getClassificationAppLink,o=e.onToggleClassification,c=Zr(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),l={memberType:n,classifications:i,getClassificationAppLink:a,getIsClassificationSelected:Qr(n,t),onToggleClassification:o,hasActions:s};return p.createElement(ke.Table,{responsive:!0,bordered:!0},p.createElement(Wr,Object.assign({},l)),p.createElement("tbody",null,t.map((function(e,t){return p.createElement(Gr,Object.assign({key:t,member:e,actions:s&&r(e.id),onToggleClassification:o},c))}))))}function $r(e){var t=e.navItems,n=e.currentAppLink;return p.createElement(ke.Container,null,p.createElement(ke.Navbar,{className:"justify-content-between align-items-center"},p.createElement(ke.Nav,null,!!t&&t.map((function(e,t){return p.createElement(ke.Nav.Item,{key:t},p.createElement(ke.Nav.Link,{as:d.AppLink,appLink:e.appLink,active:ne.isItemActive(e,n),className:ne.isItemActive(e,n)?"text-primary":""},e.label))})))))}function ei(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 ti(e){var t=e.seriesId,n=ei(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Te.getSeriesFetchOptions(e,r("series")),rr.getObjectLevelsFetchOptions(e,qt.Series,r("seriesLevels"))],[e]),Object(f.useFetch)(rr.getObjectAudiencesFetchOptions(e,qt.Series,r("seriesAudiences")),[e,t.seriesLevels]),Object(f.useBulkFetch)([rr.getPresentationsFetchOptions(r("presentations")),rr.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&rr.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),ir(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.seriesLevels&&r.seriesAudiences);return p.createElement(p.Fragment,null,p.createElement(Gt,{seriesId:t,activeAction:i.Series.EDIT_SERIES_AUDIENCES}),p.createElement(nt,{object:r.series}),!!c&&p.createElement(dr,{objectLevels:r.seriesLevels,objectAudiences:r.seriesAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:qt.Series,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,qt.Series,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,qt.Series,n,n)}}))}function ni(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 ri(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 ii=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT_SERIES,args:[e]}},ai=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION_SERIES,args:[e.currentPresentation.id,t]}}};function oi(e){var t=e.seriesId,n=ni(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([rr.getSubjectTreeFetchOptions(r("subjectTree")),rr.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([Te.getSeriesFetchOptions(e,r("series")),rr.getObjectSubjectsFetchOptions(e,qt.Series,r("seriesSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&rr.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(ri(t.subjectClassifications||[]),ri(e))},a=t.seriesSubjects&&t.seriesSubjects.map((function(e){return rr.getSubjectClassificationFetchOptions(e.id,d.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.seriesSubjects],!!a),Object(f.useFetch)(rr.getObjectClassificationsFetchOptions(e,qt.Series,r("seriesClassifications")),[e,t.seriesSubjects])}(t,r,a),ir(r,a);var c=!!(r.seriesSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.seriesClassifications&&r.subjectClassifications);return p.createElement(d.AppLinkContext.Provider,{value:{getSubjectAppLink:ii,getClassificationAppLink:ai(r)}},p.createElement(Gt,{seriesId:t,activeAction:i.Series.EDIT_SERIES_SUBJECTS}),p.createElement(nt,{object:r.series}),c&&p.createElement(xr,{objectSubjects:r.seriesSubjects,subjectTree:r.subjectTree,memberType:qt.Series,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.seriesClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,qt.Series,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,qt.Series,n,n)}}))}function ci(){var e=Object(f.useService)(u.SERIES);return p.createElement(Mt,{saveSeries:function(t,n){return e.createSeries(t,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)}})}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 li(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 pi(e,t,n){return t&&ui(e.prototype,t),n&&ui(e,n),e}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 di(e){return(di=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function mi(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&&bi(e,t)}function bi(e,t){return(bi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var yi=function(e){function t(){return li(this,t),fi(this,di(t).apply(this,arguments))}return mi(t,e),pi(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),Si=function(e){function t(){return li(this,t),fi(this,di(t).apply(this,arguments))}return mi(t,e),pi(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(u).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"newSeries",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ci,null))}},{key:"editSeries",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Qt,{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(d.LayoutRegions.CONTENT,p.createElement(oi,{seriesId:e}))}},{key:"editSeriesAudiences",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ti,{seriesId:e}))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(_t,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 Oe.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.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:xt}}}}],[{key:"router",get:function(){return yi}}]),t}(f.Core.Application);function vi(e){return(vi="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 Ei(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hi(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 gi(e,t){return!t||"object"!==vi(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 ji(e){return(ji=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ti(e,t){return(Ti=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Oi,Ii=function(e){return"/api/master/v2/objects/".concat(e,"?query=cover,banner")},Ci=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},Ai=function(e){return"/api/master/v2/objects/".concat(e,"/playlists")},Li=function(e){return"/api/master/v2/objects/".concat(e)},Pi=function(e){return"/api/master/v1/playlists/".concat(e)},Ni=function(e,t,n){var r="/api/master/v2/objects/".concat(e,"/").concat(t);return n&&(r+="?query=".concat(n)),r},ki=function(e){return"/api/master/v1/objects/".concat(e,"/videos/reorder")},wi=function(e,t){return"/api/master/v1/playlists/".concat(e,"/dissociate/").concat(t)};!function(e){e.Videos="videos"}(Oi||(Oi={}));var Di=function(e){function t(){return Ei(this,t),gi(this,ji(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&&Ti(e,t)}(t,e),n=t,(r=[{key:"getPlaylist",value:function(e,t,n){return this.get({resource:Ii(e),eventPrefix:"".concat(a.PLAYLIST,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getPlaylistsById",value:function(e,t,n){return this.get({resource:Ci(e),eventPrefix:"".concat(a.PLAYLISTS,":").concat(e.join(",")),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPlaylist",value:function(e,t,n,r){return this.create({resource:Ai(t),data:Object.assign(Object.assign({},e),{permissions:re()}),callback:n,errorCallback:r,eventPrefix:a.PLAYLIST,expiryTime:d.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:Li(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PLAYLIST,":").concat(e),invalidationKeys:["".concat(a.PLAYLIST,":").concat(e),a.PLAYLISTS],expiryTime:d.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:Pi(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:Ni(e,Oi.Videos,"{orderBy:orderindex,limit:100}"),callback:t,errorCallback:n,eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(Oi.Videos),expiryTime:d.CacheDurations.STANDARD})}},{key:"reorderVideos",value:function(e,t,n){return this.update({resource:ki(e),data:Object.assign({ownerId:e},t),eventPrefix:a.REORDER_PLAYLIST_VIDEOS,expiryTime:d.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:wi(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 u.PLAYLIST}},{key:"channelName",get:function(){return l.PLAYLIST}}])&&hi(n.prototype,r),i&&hi(n,i),t}(f.BaseDataService),Fi={dataServiceName:u.PLAYLIST,dataChannelName:l.PLAYLIST},_i={getPlaylistFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Fi),{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({},Fi),{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({},Fi),{eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(Oi.Videos),fetchData:function(t){return t.getPlaylistVideos(e)},setData:t,onError:n})}},xi=function(e){var t=e.children;return p.createElement(Ne,null,p.createElement(Ae,null,t))};function Ri(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 Ui(e){var t=e.playlistId,n=e.closePopup,r=Ri(p.useState(),2),a=r[0],o=r[1],c=Ri(p.useState(!1),2),l=c[0],d=c[1],m=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(_i.getPlaylistFetchOptions(t,o),[t]);var b=p.useCallback((function(){n(),f.Core.AppLinkHelper.trigger({application:s.PLAYLISTS,action:i.Playlists.PLAYLISTS})}),[]),y=p.useCallback((function(){d(!0),m.deletePlaylist(t,b,n)}),[t]),S=[{variant:"link",onClick:n,buttonText:"Cancel"},{variant:"danger",onClick:y,buttonText:"Yes, delete playlist",isSpinnerButton:!0,showSpinner:l}],v=!!a;return p.createElement(it,{title:"Delete Playlist",closePopup:n,showLoadingSpinner:!v},v&&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(ct,{buttons:S})))}var Bi=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Rt.string().trim().max(65535,"Description is too long").default(""),cover:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown(),banner:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown()}).noUnknown(),Vi=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"))},Ji=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 ie(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 Hi(e){var t=Object(He.useFormikContext)(),n=Jt(t);return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this playlist",autoFocus:!0}),p.createElement(d.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this playlist here"}),p.createElement(Ge,{imageType:d.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.PLAYLISTS,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement(Ge,{imageType:d.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(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(Fe,{actions:e.actions})))}function Mi(e){var t,n=e.playlist&&e.playlist.id;return p.createElement(d.FormWrapper,{initialValues:e.playlist,validationSchema:Bi,onSubmit:e.savePlaylist},p.createElement(Hi,{id:n,actions:!!n&&(t=n,[{name:"Delete playlist",appLink:{application:s.PLAYLISTS,action:i.Playlists.DELETE_PLAYLIST,args:[t]},className:"text-danger"}])}))}var Yi=function(e){return function(t){return t.appLink.action===e}};function qi(e){var t=e.playlistId,n=e.activeAction,r=p.useContext(Pe);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(st,{tabs:Ji(r,t),isItemActive:Yi(n)}))}function zi(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 Ki(e){var t=e.playlistId,n=zi(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(_i.getPlaylistFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(qi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST}),!!r&&p.createElement(Mi,{playlist:r,savePlaylist:function(e,n){return o.updatePlaylist(t,e,n,n)}}))}function Wi(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 Gi(e){var t=e.playlistId,n=Wi(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([_i.getPlaylistFetchOptions(e,r("playlist")),rr.getObjectLevelsFetchOptions(e,qt.Playlists,r("playlistLevels"))],[e]),Object(f.useFetch)(rr.getObjectAudiencesFetchOptions(e,qt.Playlists,r("playlistAudiences")),[e,t.playlistLevels]),Object(f.useBulkFetch)([rr.getPresentationsFetchOptions(r("presentations")),rr.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&rr.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),ir(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.playlistLevels&&r.playlistAudiences);return p.createElement(p.Fragment,null,p.createElement(qi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_AUDIENCES}),p.createElement(nt,{object:r.playlist}),!!c&&p.createElement(dr,{objectLevels:r.playlistLevels,objectAudiences:r.playlistAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:qt.Playlists,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,qt.Playlists,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,qt.Playlists,n,n)}}))}function Zi(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 Qi(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 Xi=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT_PLAYLISTS,args:[e]}},$i=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS,args:[e.currentPresentation.id,t]}}};function ea(e){var t=e.playlistId,n=Zi(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([rr.getSubjectTreeFetchOptions(r("subjectTree")),rr.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([_i.getPlaylistFetchOptions(e,r("playlist")),rr.getObjectSubjectsFetchOptions(e,qt.Playlists,r("playlistSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&rr.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(Qi(t.subjectClassifications||[]),Qi(e))},a=t.playlistSubjects&&t.playlistSubjects.map((function(e){return rr.getSubjectClassificationFetchOptions(e.id,d.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.playlistSubjects],!!a),Object(f.useFetch)(rr.getObjectClassificationsFetchOptions(e,qt.Playlists,r("playlistClassifications")),[e,t.playlistSubjects])}(t,r,a),ir(r,a);var c=!!(r.playlistSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.playlistClassifications&&r.subjectClassifications);return p.createElement(d.AppLinkContext.Provider,{value:{getSubjectAppLink:Xi,getClassificationAppLink:$i(r)}},p.createElement(qi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_SUBJECTS}),p.createElement(nt,{object:r.playlist}),c&&p.createElement(xr,{objectSubjects:r.playlistSubjects,subjectTree:r.subjectTree,memberType:qt.Playlists,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.playlistClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,qt.Playlists,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,qt.Playlists,n,n)}}))}function ta(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 na=function(e){return function(t){return[{name:"Remove video",appLink:{application:s.PLAYLISTS,action:i.Playlists.REMOVE_VIDEO,args:[e.toString(),t.id.toString()]},className:"text-danger"}]}},ra=function(e){return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:[e.id]}};function ia(e){var t=e.playlistId,n=ta(p.useState(),2),r=n[0],a=n[1],o=ta(p.useState(),2),c=o[0],s=o[1],l=Object(f.useService)(u.PLAYLIST);!function(e,t,n){Object(f.useBulkFetch)([_i.getPlaylistFetchOptions(e,t),_i.getPlaylistVideosFetchOptions(e,n)],[e])}(t,a,s);return p.createElement(p.Fragment,null,p.createElement(qi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_VIDEOS}),p.createElement(nt,{object:r}),!!c&&p.createElement(Dt,{onSortEnd:function(e,n){if(c.data&&c.data[e]){Vi(c.data,e,n,(function(e,n){l.reorderVideos(t,n),s((function(t){return{data:e,pagination:t.pagination}}))}))}},videos:c,getVideoAppLink:ra,getVideoActions:na(t),emptyMessage:"There are no videos in this playlist."}))}function aa(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 oa(){var e=aa(p.useState(),2),t=e[0],n=e[1],r=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(ee.getCurrentUserFetchOptions(n),[]);return p.createElement(p.Fragment,null,!!t&&p.createElement(Mi,{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 ca(e){return(ca="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 sa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function la(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 ua(e,t){return!t||"object"!==ca(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 pa(e){return(pa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fa(e,t){return(fa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var da,ma=function(e){return"/api/master/v2/objects/".concat(e)},ba=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},ya=function(e,t,n){var r="/api/master/v2/objects/".concat(e,"/").concat(t);return n&&(r+="?".concat(n)),r};!function(e){e.Audiences="subjectpresentationaudiences"}(da||(da={}));var Sa=function(e){function t(){return sa(this,t),ua(this,pa(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&&fa(e,t)}(t,e),n=t,(r=[{key:"getVideo",value:function(e,t,n){return this.get({resource:ma(e),eventPrefix:"".concat(a.VIDEO,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getVideosById",value:function(e,t,n){return this.get({resource:ba(e),eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getVideoAudiences",value:function(e,t,n){return this.get({resource:ya(e,da.Audiences),callback:t,errorCallback:n,eventPrefix:"".concat(a.VIDEO,":").concat(e,":").concat(da.Audiences),expiryTime:d.CacheDurations.STANDARD})}},{key:"name",get:function(){return u.VIDEO}},{key:"channelName",get:function(){return l.VIDEO}}])&&la(n.prototype,r),i&&la(n,i),t}(f.BaseDataService),va={dataServiceName:u.VIDEO,dataChannelName:l.VIDEO},Ea={getVideoFetchOptions:function(e,t,n){return Object.assign(Object.assign({},va),{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({},va),{eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),fetchData:function(t){return t.getVideosById(e)},setData:t,onError:n})},getVideoAudiencesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},va),{eventPrefix:"".concat(a.VIDEO,":").concat(e,":").concat(da.Audiences),fetchData:function(t){return t.getVideoAudiences(e)},setData:t,onError:n})}};function ha(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 ga(e){var t=e.videoId,n=e.playlistId,r=e.closePopup,i=ha(p.useState(),2),a=i[0],o=i[1],c=ha(p.useState(),2),s=c[0],l=c[1],d=ha(p.useState(!1),2),m=d[0],b=d[1],y=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(Ea.getVideoFetchOptions(t,o),[t]),Object(f.useFetch)(_i.getPlaylistFetchOptions(n,l),[n]);var S=p.useCallback((function(){b(!0),y.removeVideoFromPlaylist(n,t,r,r)}),[t,n]),v=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:S,buttonText:"Yes, remove video",isSpinnerButton:!0,showSpinner:m}],E=s&&a;return p.createElement(it,{title:"Remove Video",closePopup:r,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,a.name)," from ",p.createElement("strong",null,s.name),"?")),p.createElement(ct,{buttons:v})))}function ja(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 Ta=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 Oa(e){var t=e.id,n=e.routeToOnDelete,r=e.closePopup,i=ja(p.useState(),2),a=i[0],o=i[1],c=ja(p.useState(!1),2),s=c[0],l=c[1],d=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(rr.getAudienceFetchOptions(t,o),[t]);return p.createElement(it,{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(ct,{buttons:Ta((function(){l(!0);d.deleteAudience(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)}),r,s)})))}function Ia(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 Ca=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function Aa(e){var t=e.presentationId,n=e.audienceId,r=Ia(p.useState(),2),i=r[0],a=r[1],o=Ia(p.useState(),2),c=o[0],s=o[1],l=Ia(p.useState(),2),d=l[0],m=l[1],b=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(rr.getAudienceFetchOptions(n,a),[n]),Object(f.useFetch)(rr.getLevelsFetchOptions(s),[]),Object(f.useFetch)(rr.getPresentationFetchOptions(t,m),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(_e,{appLink:Ca(t),backToName:"audiences"})),!!d&&p.createElement("h6",null,"Presentation: ".concat(d.name)),!!i&&!!c&&p.createElement(pr,{audience:i,levels:c,saveAudience:function(e,r){return b.updateAudience(n,Object.assign(Object.assign({},e),{presentationId:t}),r,r)},presentationId:t}))}function La(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 Pa=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e,t.masterId]}}},Na=function(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_AUDIENCE,args:[e]}},ka={application:s.SUBJECTS,action:i.Subjects.AUDIENCES};function wa(e){var t=e.presentationId,n=La(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(rr.getAudiencesFetchOptions(t,i),[]),p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(_e,{appLink:ka,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(d.AppLink,{appLink:Na(t),className:"d-block"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Audience"))),p.createElement(Nr,{objects:r,getAppLink:Pa(e.presentationId),emptyMessage:"There are no audiences in this presentation yet. Click '+ New Audience' to create one."}))}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")}()}var Fa=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function _a(e){var t=e.presentationId,n=Da(p.useState(),2),r=n[0],a=n[1],o=Da(p.useState(),2),c=o[0],l=o[1],d=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(rr.getLevelsFetchOptions(a),[]),Object(f.useFetch)(rr.getPresentationFetchOptions(t,l),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2"},p.createElement(_e,{appLink:Fa(t),backToName:"audiences"})),!!c&&p.createElement("h6",null,"Presentation: ".concat(c.name)),!!r&&p.createElement(pr,{levels:r,presentationId:t,saveAudience:function(e,n){return d.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 xa(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]}}function Ra(e){return[{name:"Add child",getAppLink:function(t){return Object.assign(Object.assign({},xa(e)),{args:[e],params:{parentId:t.id}})}},{name:"Delete classification",getAppLink:function(t){return{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e,t.id]}},className:"text-danger"}]}var Ua=n(14),Ba=n.n(Ua);function Va(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 Ja(e){var t=e.presentationId,n=e.selectedClassificationId,r=Va(p.useState(),2),a=r[0],o=r[1],c=Va(p.useState(),2),l=c[0],u=c[1];return function(e,t,n){var r=rr.getClassificationTreeFetchOptions(e,t),i=rr.getPresentationFetchOptions(e,n);Object(f.useBulkFetch)([r,i],[e])}(t,o,u),p.createElement("div",{className:"".concat(Ba.a.navContainer," h-auto pr-2 border-right")},!!l&&p.createElement("h6",{className:"border-bottom pb-2"},"Classifications (".concat(l.name,")")),p.createElement(d.AppLink,{appLink:xa(t),className:"d-inline-block pb-2"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Classification")),!!a&&p.createElement("div",{className:"border-top pt-1"},p.createElement(bt,{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:Ra(t)})))}function Ha(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 Ma(e){var t=e.classificationId,n=e.routeToOnDelete,r=e.closePopup,i=Ha(p.useState(),2),a=i[0],o=i[1],c=Ha(p.useState(!1),2),s=c[0],l=c[1];Object(f.useFetch)(rr.getClassificationFetchOptions(t,o),[]);var d=Object(f.useService)(u.SUBJECT),m=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){l(!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(it,{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(ct,{buttons:m})))}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 qa(e){var t=e.presentationId,n=e.classificationId,r=Ya(p.useState(),2),i=r[0],a=r[1],o=Ya(p.useState(),2),c=o[0],s=o[1],l=Ya(p.useState(),2),d=l[0],m=l[1],b=Ya(p.useState(),2),y=b[0],S=b[1],v=Object(f.useService)(u.SUBJECT),E=rr.getClassificationFetchOptions(n,a),h=rr.getPresentationFetchOptions(t,s),g=rr.getClassificationTreeFetchOptions(t,m),j=rr.getSubjectTreeFetchOptions(S);Object(f.useFetch)(j,[]),Object(f.useFetch)(E,[n]),Object(f.useBulkFetch)([h,g],[t]);return p.createElement("div",null,p.createElement(Tr,{presentation:c,classificationId:n}),!!i&&!!d&&!!y&&p.createElement(gr,{classification:i,presentationId:t,subjectTree:y,classificationTree:d,saveClassification:function(e,t){return v.updateClassification(n,e,t,t)}}))}function za(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 Ka(e){var t=e.presentationId,n=e.classificationId,r=e.memberType,i=za(p.useState(),2),a=i[0],o=i[1],c=za(p.useState(),2),s=c[0],l=c[1];Object(f.useFetch)(rr.getPresentationFetchOptions(t,o),[]),Object(f.useFetch)(rr.getClassificationMembersFetchOptions(n,r,l),[n,r]);var u={items:s&&s.data,memberType:r,getItemAppLink:function(e){return rn.getMemberAppLink(r,e.id)},getActions:function(e){return rn.getMemberActions(n,Yt.Classification,r,e.id)}},d={presentation:a,classificationId:n},m=ae(u);return p.createElement(p.Fragment,null,p.createElement(Tr,Object.assign({},d,{memberType:r})),m&&p.createElement(Sr,Object.assign({},u)))}function Wa(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 Ga(e){var t=e.presentationId,n=e.parentId,r=Wa(p.useState(),2),a=r[0],o=r[1],c=Wa(p.useState(),2),l=c[0],d=c[1],m=Object(f.useService)(u.SUBJECT),b=rr.getClassificationTreeFetchOptions(t,o),y=rr.getSubjectTreeFetchOptions(d);Object(f.useFetch)(y,[]),Object(f.useFetch)(b,[t]);return p.createElement("div",null,p.createElement("h4",{className:"py-2"},"Create New Classification"),!!l&&!!a&&p.createElement(gr,{classification:n?{parentIds:[n]}:{},presentationId:t,subjectTree:l,classificationTree:a,saveClassification:function(e,n){return m.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 Za(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 Qa=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(rn.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function Xa(e){var t=e.classificationId,n=e.memberId,r=e.memberType,i=e.closePopup,a=Za(p.useState(),2),o=a[0],c=a[1],s=Za(p.useState(),2),l=s[0],d=s[1],m=Za(p.useState(!1),2),b=m[0],y=m[1],S=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(function(e,t,n){switch(e){case qt.Playlists:return _i.getPlaylistFetchOptions(t,n);case qt.Series:return Te.getSeriesFetchOptions(t,n);case qt.Videos:return Ea.getVideoFetchOptions(t,n)}}(r,n,d),[n]),Object(f.useFetch)(rr.getClassificationFetchOptions(t,c),[t]);var v=!!o&&!!l,E="Remove ".concat(ce(rn.singularizeMemberType(r)));return p.createElement(it,{title:E,closePopup:i,showLoadingSpinner:!v},v&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,l.name)," from ",p.createElement("strong",null,o.name),"?"),p.createElement("p",null,"This will not remove it from the backbone subject.")),p.createElement(ct,{buttons:Qa(i,(function(){y(!0),S.removeObjectsFromClassification(t,[n],r,null,null,i,i)}),r,b)})))}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.id,n=$a(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(rr.getLevelFetchOptions(t,i),[t]);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Level"),!!r&&p.createElement(Ar,{level:r,saveLevel:function(e,n){return a.updateLevel(t,e,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")}()}var no=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},ro={application:s.SUBJECTS,action:i.Subjects.NEW_LEVEL};function io(){var e=to(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(rr.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(d.AppLink,{appLink:ro,className:"d-block"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Level"))),p.createElement(Nr,{objects:t,getAppLink:no}))}function ao(){var e=Object(f.useService)(u.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Level"),p.createElement(Ar,{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 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 co(e){var t=e.id,n=oo(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(rr.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=ae(o);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Presentation"),!!c&&p.createElement(wr,Object.assign({},o)))}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")}()}var lo=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_PRESENTATION,args:[e.id]}},uo={application:s.SUBJECTS,action:i.Subjects.NEW_PRESENTATION};function po(){var e=so(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(rr.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(d.AppLink,{appLink:uo,className:"d-block"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Presentation"))),p.createElement(Nr,{objects:t,getAppLink:lo}))}function fo(){var e=Object(f.useService)(u.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Presentation"),p.createElement(wr,{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 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 bo(e){var t=e.objectType,n=e.getAppLink,r=mo(p.useState(),2),i=r[0],a=r[1];return Object(f.useFetch)(rr.getPresentationsFetchOptions(a),[]),p.createElement("div",null,p.createElement("h5",null,"Select a presentation to view its ".concat(t,":")),p.createElement(Nr,{objects:i,getAppLink:n}))}function yo(e,t){return d.StateHelper.getSetStateByKey(e,t)}function So(e,t){var n=e.memberType,r=e.objectIds,i=rr.getSubjectTreeFetchOptions(yo(t,"subjectTree"));Object(f.useFetch)(i,[]);var a=function(e,t,n){switch(e){case qt.Playlists:return _i.getPlaylistsByIdFetchOptions(t,n);case qt.Series:return Te.getSeriesByIdFetchOptions(t,n);case qt.Videos:return Ea.getVideosByIdFetchOptions(t,n)}}(n,r,yo(t,"objects"));Object(f.useFetch)(a,[n,r])}function vo(e,t,n,r){var a=n.selectedSubject,o=n.objects,c=function(){return yo(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 qt.Playlists:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_PLAYLISTS});case qt.Series:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_SERIES});case qt.Videos:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_VIDEOS})}}(a.id,t.memberType))}),c)}function Eo(e,t,n){if(t&&n){var r=1===t.length?"this ".concat(rn.singularizeMemberType(e)):"these ".concat(e);return"Add ".concat(r," to ").concat(n.name)}}function ho(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 go=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}},jo=function(e,t){return function(n,r,i){i(),yo(t,"selectedSubject")(le.find(e.subjectTree,f.ArrayHelper.first(n))),yo(t,"addToClassifications")(r),yo(t,"showConfirmationPopup")(!0)}};function To(e){var t=ho(p.useState({}),2),n=t[0],r=t[1],i=Object(f.useService)(u.SUBJECT);So(e,r);var a;return p.createElement(d.AppLinkContext.Provider,{value:{getSubjectAppLink:go}},!!n.objects&&!!n.subjectTree&&p.createElement(Fr,{memberType:e.memberType,objects:n.objects,subjectTree:n.subjectTree,onClickAddToSubject:jo(n,r)}),n.showConfirmationPopup&&p.createElement(Ve,{title:Eo(e.memberType,n.objects,n.selectedSubject),onClickConfirm:function(){return vo(i,e,n,r)},closePopup:function(){return e=!1,yo(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,ce(rn.singularizeMemberType(a)))," to classification mappings can be managed from the "),p.createElement("strong",null,"Edit Subject ".concat(ce(e.memberType)," ")),"page.")))}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 Io(e){var t=e.subjectId,n=e.routeToOnDelete,r=e.closePopup,i=Oo(p.useState(),2),a=i[0],o=i[1],c=Oo(p.useState(!1),2),s=c[0],l=c[1];Object(f.useFetch)(rr.getSubjectFetchOptions(t,o),[]);var d=Object(f.useService)(u.SUBJECT),m=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){l(!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(it,{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(ct,{buttons:m})))}function Co(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 Ao(e){var t=e.subjectId,n=Co(p.useState(),2),r=n[0],a=n[1],o=Co(p.useState(),2),c=o[0],s=o[1],l=Object(f.useService)(u.SUBJECT),d=rr.getSubjectFetchOptions(t,a),m=rr.getSubjectTreeFetchOptions(s);Object(f.useFetch)(m,[]),Object(f.useFetch)(d,[t]);return p.createElement(p.Fragment,null,p.createElement(Jr,{subjectId:t,activeAction:i.Subjects.EDIT_SUBJECT}),!!r&&!!c&&p.createElement(Br,{subject:r,subjectTree:c,saveSubject:function(e,n){return l.updateSubject(t,e,n,n)}}))}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 Po=p.createContext(void 0);function No(e){var t=e.children,n=Lo(p.useState(),2),r=n[0],i=n[1];return p.createElement(Po.Provider,{value:[r,i]},t)}var ko=function(e){var t=e.children;return p.createElement(Ne,null,p.createElement(No,null,p.createElement(Ae,null,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 Do(e,t){return d.StateHelper.getSetStateByKey(e,t)}function Fo(e,t,n){var r=e.subjectId,i=e.memberType,a=t.memberIds,o=wo(p.useContext(Po),1)[0];Object(f.useFetch)(rr.getPresentationsFetchOptions(Do(n,"presentations")),[]),Object(f.useFetch)(rr.getSubjectMemberIdsFetchOptions(r,i,Do(n,"memberIds")),[r,i]),Object(f.useFetch)(function(e,t,n){if(!t||!t.length)return;switch(e){case qt.Playlists:return _i.getPlaylistsByIdFetchOptions(t,n);case qt.Series:return Te.getSeriesByIdFetchOptions(t,n);case qt.Videos:return Ea.getVideosByIdFetchOptions(t,n)}}(i,a,Do(n,"members")),[i,a],!!a&&!!a.length),Object(f.useFetch)(!!o&&rr.getSubjectClassificationFetchOptions(r,Do(n,"classifications"),o.id,i),[r,i,o],!!o)}var _o=function(e,t){return function(n){var r,a=s.SUBJECTS,o=[t,n];switch(e){case qt.Playlists:r=i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;break;case qt.Series:r=i.Subjects.EDIT_CLASSIFICATION_SERIES;break;case qt.Videos:r=i.Subjects.EDIT_CLASSIFICATION_VIDEOS}return{application:a,action:r,args:o}}};function xo(e){switch(e){case qt.Playlists:return i.Subjects.EDIT_SUBJECT_PLAYLISTS;case qt.Series:return i.Subjects.EDIT_SUBJECT_SERIES;case qt.Videos:return i.Subjects.EDIT_SUBJECT_VIDEOS}}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 Uo(e){var t=e.subjectId,n=e.memberType,r=Ro(p.useState({}),2),i=r[0],a=r[1],o=i.presentations,c=i.classifications,s=i.memberIds,l=i.membersWithClassifications,d=Ro(p.useContext(Po),2),m=d[0],b=d[1],y=Object(f.useService)(u.SUBJECT);Fo(e,i,a),function(e,t,n){var r=t.memberIds,i=t.members,a=t.classifications;p.useEffect((function(){Do(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&&Do(n,"members")([])}),[r])}(e,i,a);var S={presentations:o,currentPresentation:m,setCurrentPresentation:b},v={members:l||[],memberType:n,getMemberAppLink:function(e){return rn.getMemberAppLink(n,e)},getActions:function(e){return rn.getMemberActions(t,Yt.Subject,n,e)},classifications:c,getClassificationAppLink:m&&_o(n,m.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,m&&m.id,e,r)}},E=!!m&&!!c;return p.createElement(p.Fragment,null,p.createElement(Jr,{subjectId:t,activeAction:xo(n)}),p.createElement(ke.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(Dr,Object.assign({},S))),E&&p.createElement(Xr,Object.assign({},v)))}function Bo(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 Vo(e){var t=e.parentId,n=Bo(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT),c=rr.getSubjectTreeFetchOptions(a);Object(f.useFetch)(c,[]);var l={application:s.SUBJECTS,action:i.Subjects.PRESENTATIONS};return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2 border-bottom"},p.createElement(_e,{backToName:"Presentations",appLink:l})),p.createElement("h4",{className:"py-2"},"Create New Subject"),!!r&&p.createElement(Br,{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 Jo(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 Ho=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(rn.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function Mo(e){var t=e.subjectId,n=e.memberId,r=e.memberType,i=e.closePopup,a=Jo(p.useState(),2),o=a[0],c=a[1],s=Jo(p.useState(),2),l=s[0],d=s[1],m=Jo(p.useState(!1),2),b=m[0],y=m[1],S=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(function(e,t,n){switch(e){case qt.Playlists:return _i.getPlaylistFetchOptions(t,n);case qt.Series:return Te.getSeriesFetchOptions(t,n);case qt.Videos:return Ea.getVideoFetchOptions(t,n)}}(r,n,d),[n]),Object(f.useFetch)(rr.getSubjectFetchOptions(t,c),[t]);var v=!!o&&!!l,E="Remove ".concat(ce(rn.singularizeMemberType(r)));return p.createElement(it,{title:E,closePopup:i,showLoadingSpinner:!v},v&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,l.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(ct,{buttons:Ho(i,(function(){y(!0),S.removeObjectsFromSubject(t,[n],r,i,i)}),r,b)})))}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.subjectId,n=Yo(p.useState({}),2),r=n[0];return function(e,t){var n=function(e){return d.StateHelper.getSetStateByKey(t,e)};Object(f.useFetch)(rr.getSubjectClassificationFetchOptions(e,n("classifications")),[e]),Object(f.useFetch)(rr.getPresentationsFetchOptions(n("presentations")),[])}(t,n[1]),p.createElement(p.Fragment,null,p.createElement(Jr,{subjectId:t,activeAction:i.Subjects.SUBJECT_CLASSIFICATIONS}),p.createElement(qr,{presentations:r.presentations,classificationDictionary:f.ArrayHelper.groupBy(r.classifications,"presentationId")}))}var zo=n(15),Ko=n.n(zo);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.selectedSubjectId,n=Wo(p.useState(),2),r=n[0],a=n[1];Object(f.useFetch)(rr.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},l=[{name:"Add child",getAppLink:function(e){return Object.assign(Object.assign({},c),{params:{parentId:e.id}})}},{name:"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(Ko.a.navContainer," h-auto pr-2 border-right")},p.createElement("h5",{className:"border-bottom pb-2"},"Subjects"),p.createElement(d.AppLink,{appLink:c,className:"d-inline-block pb-2"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Subject")),!!r&&p.createElement("div",{className:"border-top pt-1"},p.createElement(bt,{tree:r,getAppLink:o,selectedIds:[t],actions:l})))}function Zo(e){var t=e.currentAppLink;return p.createElement($r,{navItems:an(),currentAppLink:t})}function Qo(e){return(Qo="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 Xo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $o(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 ec(e,t,n){return t&&$o(e.prototype,t),n&&$o(e,n),e}function tc(e,t){return!t||"object"!==Qo(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){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&&ic(e,t)}function ic(e,t){return(ic=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ac=function(e){function t(){return Xo(this,t),tc(this,nc(t).apply(this,arguments))}return rc(t,e),ec(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),oc=function(e){function t(){return Xo(this,t),tc(this,nc(t).apply(this,arguments))}return rc(t,e),ec(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(u).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"index",value:function(){this.navigate("/dashboards/playlists")}},{key:"newPlaylist",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(oa,null))}},{key:"editPlaylist",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ki,{key:e,playlistId:e}))}},{key:"editPlaylistVideos",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ia,{key:e,playlistId:e}))}},{key:"editPlaylistSubjects",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ea,{key:e,playlistId:e}))}},{key:"editPlaylistAudiences",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Gi,{key:e,playlistId:e}))}},{key:"deletePlaylist",value:function(e){var t=Object.assign({playlistId:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(Ui,Object.assign({},t)))}},{key:"removeVideo",value:function(e,t){var n=Object.assign({playlistId:e,videoId:t},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(ga,Object.assign({},n)))}},{key:"removeFromSubject",value:function(e,t){var n=Object.assign({subjectId:t,memberId:e,memberType:qt.Playlists},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(Mo,Object.assign({},n)))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(_t,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 Oe.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.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:xi}}}}],[{key:"router",get:function(){return ac}}]),t}(f.Core.Application);function cc(e){return(cc="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 sc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lc(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 uc(e,t,n){return t&&lc(e.prototype,t),n&&lc(e,n),e}function pc(e,t){return!t||"object"!==cc(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 fc(e){return(fc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function dc(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&&mc(e,t)}function mc(e,t){return(mc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var bc=function(e){function t(){return sc(this,t),pc(this,fc(t).apply(this,arguments))}return dc(t,e),uc(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),yc=function(e){function t(){return sc(this,t),pc(this,fc(t).apply(this,arguments))}return dc(t,e),uc(t,[{key:"initialize",value:function(){var e=this;this.subjectDataService=f.InstanceManager.getInstance(u.SUBJECT,this),f.ObjectHelper.values(u).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(d.LayoutRegions.CONTENT,p.createElement(Vo,Object.assign({key:e.parentId},t))),this.renderSubjectsLeftNav()}},{key:"editSubject",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ao,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"editSubjectPlaylists",value:function(e){var t={subjectId:e,memberType:qt.Playlists};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Uo,Object.assign({key:"".concat(e,":playlists")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectSeries",value:function(e){var t={subjectId:e,memberType:qt.Series};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Uo,Object.assign({key:"".concat(e,":series")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectVideos",value:function(e){var t={subjectId:e,memberType:qt.Videos};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Uo,Object.assign({key:"".concat(e,":videos")},t))),this.renderSubjectsLeftNav(e)}},{key:"subjectClassifications",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(qo,{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(d.LayoutRegions.CONTENT,p.createElement(To,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(d.LayoutRegions.POPUP,p.createElement(Mo,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(d.LayoutRegions.POPUP,p.createElement(Io,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(d.LayoutRegions.CONTENT,p.createElement(bo,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(d.LayoutRegions.CONTENT,p.createElement(Ga,Object.assign({key:t.parentId},n))),this.renderClassificationLeftNav(e)}},{key:"editClassification",value:function(e,t){var n={presentationId:e,classificationId:t};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(qa,Object.assign({key:t},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationPlaylists",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:qt.Playlists};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ka,Object.assign({key:"".concat(t,":playlists")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationSeries",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:qt.Series};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ka,Object.assign({key:"".concat(t,":series")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationVideos",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:qt.Videos};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ka,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(d.LayoutRegions.POPUP,p.createElement(Xa,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(d.LayoutRegions.POPUP,p.createElement(Ma,Object.assign({},r)))}},{key:"levels",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(io,null)),this.hideLeftNav()}},{key:"newLevel",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ao,null)),this.hideLeftNav()}},{key:"editLevel",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(eo,{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(d.LayoutRegions.CONTENT,p.createElement(bo,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationAudiences",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(wa,{presentationId:e})),this.hideLeftNav()}},{key:"newAudience",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(_a,{presentationId:e})),this.hideLeftNav()}},{key:"editAudience",value:function(e,t){var n={presentationId:e,audienceId:t};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Aa,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(d.LayoutRegions.POPUP,p.createElement(Oa,Object.assign({},r)))}},{key:"presentations",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(po,null)),this.hideLeftNav()}},{key:"newPresentation",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(fo,null))}},{key:"editPresentation",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(co,{key:e,id:e})),this.hideLeftNav()}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(_t,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 Oe.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.AlertList,{alerts:n,removeAlert:r}))}},{key:"renderClassificationLeftNav",value:function(e,t){this.setCurrentLeftNavItem(t);var n={presentationId:e,selectedClassificationId:t};this.layout.showChildView(d.LayoutRegions.LEFT_NAV,p.createElement(Ja,Object.assign({},n)))}},{key:"renderSubjectsLeftNav",value:function(e){this.setCurrentLeftNavItem(e),this.layout.showChildView(d.LayoutRegions.LEFT_NAV,p.createElement(Go,{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(Zo,{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:ko,getTopNavView:this.getTopNav}}}}],[{key:"router",get:function(){return bc}}]),t}(f.Core.Application),Sc=function(e){var t=e.children;return p.createElement(Ne,null,p.createElement(Ae,null,t))},vc=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]}}]},Ec=function(e){return function(t){return t.appLink.action===e}};function hc(e){var t=e.videoId,n=e.activeAction;return p.createElement("div",{className:"py-2"},p.createElement(st,{tabs:vc(t),isItemActive:Ec(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 jc(e){var t=e.videoId,n=gc(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Ea.getVideoFetchOptions(e,r("video")),rr.getObjectLevelsFetchOptions(e,qt.Videos,r("videoLevels"))],[e]),Object(f.useFetch)(Ea.getVideoAudiencesFetchOptions(e,r("videoAudiences")),[e,t.videoLevels]),Object(f.useBulkFetch)([rr.getPresentationsFetchOptions(r("presentations")),rr.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&rr.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),ir(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.videoLevels&&r.videoAudiences);return p.createElement(p.Fragment,null,p.createElement(hc,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_AUDIENCES}),p.createElement(nt,{object:r.video}),!!c&&p.createElement(dr,{objectLevels:r.videoLevels,objectAudiences:r.videoAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:qt.Videos,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,qt.Videos,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,qt.Videos,n,n)}}))}function Tc(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){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 Ic=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT_VIDEOS,args:[e]}},Cc=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION_VIDEOS,args:[e.currentPresentation.id,t]}}};function Ac(e){var t=e.videoId,n=Tc(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([rr.getSubjectTreeFetchOptions(r("subjectTree")),rr.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([Ea.getVideoFetchOptions(e,r("video")),rr.getObjectSubjectsFetchOptions(e,qt.Videos,r("videoSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&rr.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(Oc(t.subjectClassifications||[]),Oc(e))},a=t.videoSubjects&&t.videoSubjects.map((function(e){return rr.getSubjectClassificationFetchOptions(e.id,d.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.videoSubjects],!!a),Object(f.useFetch)(rr.getObjectClassificationsFetchOptions(e,qt.Videos,r("videoClassifications")),[e,t.videoSubjects])}(t,r,a),ir(r,a);var c=!!(r.videoSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.videoClassifications&&r.subjectClassifications);return p.createElement(d.AppLinkContext.Provider,{value:{getSubjectAppLink:Ic,getClassificationAppLink:Cc(r)}},p.createElement(hc,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_SUBJECTS}),p.createElement(nt,{object:r.video}),c&&p.createElement(xr,{objectSubjects:r.videoSubjects,subjectTree:r.subjectTree,memberType:qt.Videos,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.videoClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,qt.Videos,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,qt.Videos,n,n)}}))}function Lc(e){return(Lc="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 Pc(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 kc(e,t,n){return t&&Nc(e.prototype,t),n&&Nc(e,n),e}function wc(e,t){return!t||"object"!==Lc(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 Dc(e){return(Dc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fc(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&&_c(e,t)}function _c(e,t){return(_c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var xc=function(e){function t(){return Pc(this,t),wc(this,Dc(t).apply(this,arguments))}return Fc(t,e),kc(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),Rc=function(e){function t(){return Pc(this,t),wc(this,Dc(t).apply(this,arguments))}return Fc(t,e),kc(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(u).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(d.LayoutRegions.CONTENT,p.createElement(jc,{videoId:e}))}},{key:"editVideoSubjects",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ac,{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 Oe.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.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:Sc}}}}],[{key:"router",get:function(){return xc}}]),t}(f.Core.Application);function Uc(){return p.createElement(p.Fragment,null,"Domain Options")}function Bc(){return p.createElement(p.Fragment,null,"New Domain Options")}function Vc(e){var t=e.optionId;return p.createElement(p.Fragment,null,t)}function Jc(e){return(Jc="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 Hc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mc(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 Yc(e,t,n){return t&&Mc(e.prototype,t),n&&Mc(e,n),e}function qc(e,t){return!t||"object"!==Jc(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 zc(e){return(zc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Kc(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&&Wc(e,t)}function Wc(e,t){return(Wc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Gc=function(e){function t(){return Hc(this,t),qc(this,zc(t).apply(this,arguments))}return Kc(t,e),Yc(t,[{key:"channelName",get:function(){return s.DOMAIN_OPTIONS}},{key:"appRoutes",get:function(){return{"developer/options(/)":"domainOptions","developer/options/new(/)":"newDomainOptions","developer/options/:id(/)":"editDomainOptions"}}}]),t}(f.Core.AppRouter),Zc=function(e){function t(){return Hc(this,t),qc(this,zc(t).apply(this,arguments))}return Kc(t,e),Yc(t,[{key:"domainOptions",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Uc,null))}},{key:"newDomainOptions",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Bc,null))}},{key:"editDomainOptions",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Vc,{optionId: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 Oe.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.AlertList,{alerts:n,removeAlert:r}))}},{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 Gc}}]),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 l})),n.d(t,"DataServices",(function(){return u})),n.d(t,"CuratorLayoutView",(function(){return O})),n.d(t,"LayoutComponent",(function(){return P})),n.d(t,"CuratorAppNavService",(function(){return R})),n.d(t,"ImageUploadDataService",(function(){return Y})),n.d(t,"UserDataService",(function(){return X})),n.d(t,"UserDataServiceHelper",(function(){return ee})),n.d(t,"SeriesDataService",(function(){return ge})),n.d(t,"SeriesDataServiceHelper",(function(){return Te})),n.d(t,"SeriesApplication",(function(){return Si})),n.d(t,"PlaylistDataService",(function(){return Di})),n.d(t,"PlaylistDataServiceHelper",(function(){return _i})),n.d(t,"PlaylistsApplication",(function(){return oc})),n.d(t,"SubjectDataService",(function(){return tr})),n.d(t,"SubjectDataServiceHelper",(function(){return rr})),n.d(t,"SubjectsApplication",(function(){return yc})),n.d(t,"VideoDataService",(function(){return Sa})),n.d(t,"VideoDataServiceHelper",(function(){return Ea})),n.d(t,"VideosApplication",(function(){return Rc})),n.d(t,"DomainOptionsApplication",(function(){return Zc}))}])}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("ReactBootstrap"),require("Formik"),require("Backbone"),require("SortableHOC"),require("Cropper"),require("Handlebars")):"function"==typeof define&&define.amd?define(["React","@clickview/shared","@clickview/common","Yup","ReactBootstrap","Formik","Backbone","SortableHOC","Cropper","Handlebars"],t):"object"==typeof exports?exports["@clickview/curator"]=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("ReactBootstrap"),require("Formik"),require("Backbone"),require("SortableHOC"),require("Cropper"),require("Handlebars")):e["@clickview/curator"]=t(e.React,e["@clickview/shared"],e["@clickview/common"],e.Yup,e.ReactBootstrap,e.Formik,e.Backbone,e.SortableHOC,e.Cropper,e.Handlebars)}(window,(function(e,t,n,r,i,a,o,c,s,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=17)}([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){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=o},function(e,t,n){e.exports={draggableVideoItem:"_1JMCe",draggedVideoItem:"_3jjle"}},function(e,t){e.exports=c},function(e,t,n){e.exports={curatorLayout:"XayF7",topNavRegion:"_3ewaZ",leftNavRegion:"_2c2o6"}},function(e,t,n){e.exports={dropdown:"_3SSd3",dropdownToggle:"GL7MR"}},function(e,t,n){var r=n(16);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=s},function(e,t,n){e.exports={navContainer:"_11O8h"}},function(e,t,n){e.exports={navContainer:"_3vLoN"}},function(e,t){e.exports=l},function(e,t,n){"use strict";n.r(t);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"}},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"},o={IMAGES:".".concat(["jpg","tif","png","bmp","gif","jpeg"].join(",."))},c={CURATOR_LAYOUT:"CuratorLayout"},s={DOMAIN_OPTIONS:"domain:options:application",PLAYLISTS:"playlists:application",SERIES:"series:application",SUBJECTS:"subjects:application",VIDEOS:"videos:application"},l={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"},u={IMAGE_UPLOAD:"ImageUploadDataService",PLAYLIST:"PlaylistDataService",SUBJECT:"SubjectDataService",USER:"UserDataService",VIDEO:"VideoDataService",SERIES:"SeriesDataService"},p=n(0),f=n(2),d=n(1),m=n(12),b=n.n(m),y=n(10),S=n.n(y);function v(e){return(v="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"!==v(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=j(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 j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t){return(T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var O=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,j(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&&T(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[d.LayoutRegions.TOP_NAV],className:S.a.topNavRegion},leftNav:{component:this.childComponents[d.LayoutRegions.LEFT_NAV],className:"py-3 ".concat(S.a.leftNavRegion)},content:{component:this.childComponents[d.LayoutRegions.CONTENT],className:"position-relative container py-3"},popup:{component:this.childComponents[d.LayoutRegions.POPUP]},alert:{component:this.childComponents[d.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[d.LayoutRegions.TOP_NAV]=this.options.getTopNavView(f.Core.AppLinkHelper.getCurrentAppLink()))}},{key:"hideLeftNav",value:function(){this.unsetRegion(d.LayoutRegions.LEFT_NAV)}},{key:"closePopup",value:function(){this.unsetRegion(d.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(j(t.prototype),"showChildView",this).call(this,"layout",p.createElement(P,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(S.a.curatorLayout)}}])&&E(n.prototype,r),i&&E(n,i),t}(f.Core.LayoutView),I=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},C=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):"")},L=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(C,{className:A("top-nav-region",t.className)},t.component),!!n.component&&p.createElement(C,{className:A("left-nav-region",n.className)},n.component),!!r.component&&p.createElement("div",{className:"content-container"},p.createElement(C,{className:A("content-region",r.className)},r.component))),!!i.component&&p.createElement(C,{className:A("popup-region",i.className)},i.component),!!a.component&&p.createElement(C,{className:A("alert-region",a.className)},a.component))},P=function(e){var t=e.provider,n=I(e,["provider"]);return t?p.createElement(t,null,p.createElement(L,Object.assign({},n))):p.createElement(L,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 x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var R=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&&x(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 B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V(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 H(e){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t){return(M=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Y=function(e){function t(){return B(this,t),J(this,H(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&&M(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 u.IMAGE_UPLOAD}},{key:"channelName",get:function(){return l.IMAGE_UPLOAD}}])&&V(n.prototype,r),i&&V(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 z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K(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,X=function(e){function t(){return z(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:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"name",get:function(){return u.USER}},{key:"channelName",get:function(){return l.USER}}])&&K(n.prototype,r),i&&K(n,i),t}(f.BaseDataService),$={dataServiceName:u.USER,dataChannelName:l.USER},ee={getCurrentUserFetchOptions:function(e,t){return Object.assign(Object.assign({},$),{eventPrefix:a.CURRENT_USER,fetchData:function(e){return e.getCurrentUser()},setData:e,onError:t})}},te={onFileSelect:function(e,t,n){if(t&&t.length){var r=new FileReader;r.addEventListener("load",(function(){return te.onReaderLoad(r,e,n)})),r.readAsDataURL(t[0])}},onReaderLoad:function(e,t,n){var r=new Image;r.src=e.result;var i=d.ImageMinDimensions[t].width,a=d.ImageMinDimensions[t].height;r.addEventListener("load",(function(){te.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=d.ImageMinDimensions[e].width,r=d.ImageMinDimensions[e].height;return!(n&&t.width<n)&&!(r&&t.height<r)}},ne={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"}(Q||(Q={}));var re=function(){return[{value:"protected",access:"r"}]},ie=function(e){return ue.getGroupNames(e).includes(Q.Developer)},ae=function(e){return Object.values(e).every((function(e){return!!e}))},oe=function(e,t){return!!e&&!!t&&e.toString()===t.toString()},ce=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function se(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 le={find:function(e,t){if(e&&e.children&&e.children.length)for(var n=function e(n){if(oe(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=le.find(e,i);a&&(n=[a].concat(se(n))),i=a?r(a):null}return n}},ue={getGroupNames:function(e){return e&&e.groups?e.groups.map((function(e){return e.name})):[]}};function pe(e){return(pe="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 fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function de(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 me(e,t){return!t||"object"!==pe(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 be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ye(e,t){return(ye=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Se=function(e){return"/api/master/v2/objects/".concat(e,"?query=thumbnail,poster,banner")},ve=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},Ee=function(){return"/api/master/v2/series"},he=function(e){return"/api/master/v2/objects/".concat(e)},ge=function(e){function t(){return fe(this,t),me(this,be(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&&ye(e,t)}(t,e),n=t,(r=[{key:"getSeries",value:function(e,t,n){return this.get({resource:Se(e),eventPrefix:"".concat(a.SERIES,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSeriesById",value:function(e,t,n){return this.get({resource:ve(e),eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createSeries",value:function(e,t,n){var r,i=this;this.chain().create({resource:Ee(),data:e,callback:function(e){return r=e},errorCallback:n,eventPrefix:a.SERIES,expiryTime:d.CacheDurations.STANDARD,errorHandler:this.alertService.error("Failed to create series.")}).func((function(){r&&r.id&&i.update({resource:he(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:he(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:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated series"),errorHandler:this.alertService.error("Failed to update series")})}},{key:"name",get:function(){return u.SERIES}},{key:"channelName",get:function(){return l.SERIES}}])&&de(n.prototype,r),i&&de(n,i),t}(f.BaseDataService),je={dataServiceName:u.SERIES,dataChannelName:l.SERIES},Te={getSeriesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},je),{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({},je),{eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),fetchData:function(t){return t.getSeriesById(e)},setData:t,onError:n})}},Oe=n(7);function Ie(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 Ce=p.createContext(void 0),Ae=function(e){var t=e.children,n=Ie(p.useState(),2),r=n[0],i=n[1],a=Ie(p.useState(!1),2),o=a[0],c=a[1],s=Ie(p.useState(),2),l=s[0],u=s[1],f={getDataUrl:function(){var e=r;return i(null),e},setDataUrl:i,imageUploaded:o,getImage:function(){var e=l;return u(null),c(!1),e},setImage:function(e){u(e),c(!0)}};return p.createElement(Ce.Provider,{value:f},t)};function Le(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 Pe=p.createContext(void 0);function Ne(e){var t=e.children,n=Le(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(d.UserDataServiceHelper.getCurrentUserFetchOptions(i),[]),p.createElement(Pe.Provider,{value:r},t)}var ke=n(4),we=n(11),De=n.n(we);function Fe(e){var t=e.className,n=void 0===t?"":t,r=e.actions,i=e.alignLeft;if(!r||!r.length)return p.createElement(p.Fragment,null);var a="".concat(De.a.dropdown," cursor-pointer rounded-circle");n&&(a+=" ".concat(n));var o="actions-dropdown-".concat(f.RandomHelper.getRandomInt());return p.createElement(ke.Dropdown,{className:a,alignRight:!i},p.createElement(ke.Dropdown.Toggle,{as:"a",id:o,className:De.a.dropdownToggle},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.More,size:d.SvgContainerSize.Standard})),p.createElement(ke.Dropdown.Menu,null,r.map((function(e,t){return p.createElement(ke.Dropdown.Item,{key:t,as:d.AppLink,appLink:e.appLink,className:e.className||""},e.name)}))))}function _e(e){var t=e.backToName,n=e.appLink;return p.createElement(d.AppLink,{appLink:n,className:"d-inline-flex align-items-center"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.ArrowLeft,size:d.SvgContainerSize.Small}),p.createElement("span",{className:"ml-1"},"Back to ".concat(t)))}function xe(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 Re=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 Ue(e){var t=e.selected,n=e.onToggle,r=Re(e,["selected","onToggle"]),i=xe(p.useState(t),2),a=i[0],o=i[1];p.useEffect((function(){return o(t)}),[t]);return p.createElement(ke.Form.Check,Object.assign({type:"checkbox",id:"checkbox-".concat(f.RandomHelper.getRandomInt()),checked:a,onChange:function(){o(!a),n(!a)}},r))}function Be(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 Ve(e){var t=e.title,n=e.onClickConfirm,r=e.confirmButtonText,i=e.cancelButtonText,a=e.closePopup,o=Be(p.useState(!1),2),c=o[0],s=o[1],l=[{variant:"link",onClick:a,buttonText:i},{variant:"primary",onClick:function(){s(!0),n()},buttonText:r,isSpinnerButton:!0,showSpinner:c}];return p.createElement(it,{title:t,closePopup:a},p.createElement(p.Fragment,null,e.children,p.createElement(ct,{buttons:l})))}Ve.defaultProps={confirmButtonText:"Confirm",cancelButtonText:"Cancel"};var Je,He=n(5),Me=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 Ye(e){var t=e.onFileSelect,n=e.acceptMultiple,r=e.mimeType,i=e.label,a=e.error,o=e.touched,c=Me(e,["onFileSelect","acceptMultiple","mimeType","label","error","touched"]),s="custom-file-input cursor-pointer";a&&o&&(s+=" is-invalid");var l=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(He.Field,Object.assign({},l,c),e.children),p.createElement(ke.Form.Label,{className:"custom-file-label",htmlFor:c.id},i)))}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 ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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},We=(ze(Je={},d.ImageType.Thumbnails,"Thumbnail"),ze(Je,d.ImageType.Banners,"Banner"),ze(Je,d.ImageType.Avatars,"Avatar"),ze(Je,d.ImageType.Logos,"Logo"),ze(Je,d.ImageType.Covers,"Cover"),ze(Je,d.ImageType.Posters,"Poster"),Je);function Ge(e){var t=e.imageType,n=e.currentImage,r=e.setNewImage,i=e.application,a=e.uploadAction,c=Ke(e,["imageType","currentImage","setNewImage","application","uploadAction"]),s=p.useContext(Ce),l=s.setDataUrl,u=s.getImage,m=s.imageUploaded,b=qe(p.useState(!1),2),y=b[0],S=b[1],v=qe(p.useState(n),2),E=v[0],h=v[1],g=qe(p.useState(!1),2),j=g[0],T=g[1],O=function(e){S(!0),l(e.src),f.Core.AppLinkHelper.trigger({application:i,action:a,args:[t]})};return p.useEffect((function(){if(y){var e=u();e&&(S(!1),h(e),r({fileId:e.id,fileIdType:d.FileIdType.ImageAPIv2}))}}),[m]),p.createElement("div",{className:"form-group"},p.createElement("div",{className:"form-control h-auto py-2"},p.createElement("label",null,We[t]),p.createElement(Ye,Object.assign({label:"Choose a ".concat(We[t].toLowerCase()),name:"image",mimeType:o.IMAGES,onFileSelect:function(e){return te.onFileSelect(t,e,O)}},c)),!!E&&!!E.url&&p.createElement(p.Fragment,null,!j&&p.createElement("div",{className:"pb-2 ".concat(t===d.ImageType.Banners?"w-100":"w-50")},p.createElement("img",{src:d.ImageHelper.createUrl(E.url),className:"img img-fluid"})),p.createElement("div",{className:"d-flex justify-content-center"},p.createElement(d.SvgContainer,{svgName:j?d.cvSvgLibrary.ChevronDown:d.cvSvgLibrary.ChevronUp,size:d.SvgContainerSize.Large,className:"svg-container cursor-pointer",onClick:function(){return T(!j)},title:j?"Show image":"Hide image",tooltipPlacement:"top"})))))}var Ze,Qe=n(13),Xe=n.n(Qe);function $e(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"}(Ze||(Ze={}));var et=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function tt(e){var t=e.dataUrl,n=e.minHeight,r=e.minWidth,i=e.onCrop,a=e.onCancel,o=p.useRef(),c=p.useRef(),s=$e(p.useState(!1),2),l=s[0],u=s[1],m=$e(p.useState(!1),2),b=m[0],y=m[1];return p.useEffect((function(){var e=new Image;e.src=t;var i=o.current.offsetWidth/e.width;return c.current=new Xe.a(o.current,{viewMode:Ze.RestrictToCanvas,autoCropArea:1,aspectRatio:r/n,minCropBoxWidth:r*i,minCropBoxHeight:n*i,ready:function(){return u(!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(ke.Button,{variant:"link",onClick:a},"Cancel"),p.createElement(d.SpinnerButton,{onClick:function(){if(l){y(!0);var e=c.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(et);if(t)return t[1]}(t));f.FunctionHelper.isFunction(i)&&i(e)}},disabled:!l,showSpinner:b},"Crop")))}function nt(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(Fe,{actions:n})))}function rt(){return p.createElement("div",{className:"text-center p-5"},p.createElement(ke.Spinner,{as:"div",animation:"border",role:"status"}))}function it(e){var t=e.title,n=e.closeButton,r=void 0===n||n,i=e.closePopup,a=e.onEntered,o=e.showLoadingSpinner,c=Object.assign({show:!0,onHide:i},f.FunctionHelper.isFunction(a)?{onEntered:a}:{});return p.createElement(ke.Modal,Object.assign({},c),!!t&&p.createElement(ke.Modal.Header,{closeButton:r},p.createElement(ke.Modal.Title,null,t)),o?p.createElement(rt,null):p.createElement(ke.Modal.Body,null,e.children))}var at,ot=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(e){e.Button="button",e.Reset="reset",e.Submit="submit"}(at||(at={}));function ct(e){var t=e.buttons;return p.createElement("div",{className:"d-flex justify-content-end border-top pt-3 px-3 mx-n3"},t.map((function(e,t){return function(e,t){var n=e.buttonText,r=e.type,i=void 0===r?at.Button:r,a=e.isSpinnerButton,o=e.showSpinner,c=void 0!==o&&o,s=e.className,l=ot(e,["buttonText","type","isSpinnerButton","showSpinner","className"]),u=Object.assign({key:t,type:i,className:"ml-2".concat(s?" ".concat(s):"")},l);return a?p.createElement(d.SpinnerButton,Object.assign({showSpinner:c},u),n):p.createElement(ke.Button,Object.assign({},u),n)}(e,t)})))}function st(e){var t=e.tabs,n=e.isItemActive;return p.createElement(ke.Nav,{fill:!0,variant:"tabs"},t.map((function(e,t){return p.createElement(ke.Nav.Item,{key:t},p.createElement(ke.Nav.Link,{as:d.AppLink,appLink:e.appLink,active:n(e)},e.label))})))}st.defaultProps={isItemActive:ne.isItemActive};var lt=n(6),ut=n.n(lt);function pt(e){var t=e.name,n=e.appLink,r=e.onSelect,i=e.isDisabled,a=e.className,o=e.actions,c=ut.a.text;return a&&(c+=" ".concat(a)),i?p.createElement("a",{className:"".concat(c," text-muted ").concat(ut.a.disabled)},t):p.createElement(p.Fragment,null,n?p.createElement(d.AppLink,{appLink:n,className:c},t):p.createElement("a",{onClick:r,className:c},t),!!o&&p.createElement(Fe,{className:ut.a.actions,actions:o}))}function ft(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 dt(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 oe(t.id,e)})),s=p.useMemo((function(){return Array.isArray(n)&&n.some((function(e){return le.find(t,e)}))}),[t,n]),l=ft(p.useState(s),2),u=l[0],m=l[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&&ut.a.selected||s&&ut.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(u?"":" ".concat(ut.a.collapsed))},p.createElement("div",{className:"position-relative"},p.createElement("span",{className:ut.a.node},b&&p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.ChevronDown,size:d.SvgContainerSize.Small,className:"svg-container ".concat(ut.a.chevron),onClick:function(){return m(!u)}}),p.createElement(pt,Object.assign({},y))),u&&p.createElement(bt,Object.assign({},e))))}var mt=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 bt(e){var t=e.tree,n=mt(e,["tree"]);return t&&t.children?p.createElement("ul",{className:"m-0 p-0 ".concat(ut.a.tree)},t.children.map((function(e){return p.createElement(dt,Object.assign({key:e.id,tree:e},n))}))):p.createElement(p.Fragment,null)}var yt={getChord:function(e,t){return le.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=le.find(t,e);o&&(n=Object.assign((r={},i=e,a=yt.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 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")}()}var vt=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 Et(e){var t=e.onSelect,n=e.label,r=e.hideCollapseBtn,i=e.collapse,a=e.noSelectionMessage,o=e.isNodeDisabled,c=e.getSelectedItemAppLink,s=vt(e,["onSelect","label","hideCollapseBtn","collapse","noSelectionMessage","isNodeDisabled","getSelectedItemAppLink"]),l=s.tree,u=s.selectedIds,m=St(p.useState(yt.getState(u,l)),2),b=m[0],y=m[1];p.useEffect((function(){return y(yt.getState(u,l))}),[u,l]);var S=St(p.useState(!!i),2),v=S[0],E=S[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(!v)}},v?"Expand":"Collapse")),!v&&p.createElement("div",{className:"py-2 border-top"},p.createElement(bt,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(d.AppLink,{appLink:c(e)},b[e]):b[e])})))))}var ht=n(9),gt=function(e){var t="bg-white";return e&&(t+=" ".concat(e)),t};function jt(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:gt(a)},!!o&&p.createElement("td",null,p.createElement("span",null,o)),p.createElement("td",null,c?p.createElement(d.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(Fe,{actions:r(t)}))))}var Tt=Object(ht.SortableElement)((function(e){return p.createElement(jt,Object.assign({sortable:!0},e))})),Ot=n(8),It=n.n(Ot),Ct=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},At=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)))},Lt=p.forwardRef((function(e,t){var n=e.videos,r=e.sortable,i=Ct(e,["videos","sortable"]);return p.createElement("tbody",{ref:t},!d.CollectionHelper.isEmpty(n)&&n.data.map((function(e,t){return r?p.createElement(Tt,Object.assign({key:e.id,index:t,itemNumber:t+1,video:e,className:It.a.draggableVideoItem},i)):p.createElement(jt,Object.assign({video:e},i))})))}));var Pt=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},Nt=Object(ht.SortableContainer)((function(e){var t=e.forwardedRef,n=Pt(e,["forwardedRef"]);return p.createElement(Lt,Object.assign({sortable:!0,ref:t},n))})),kt=function(e){return function(t){var n=t.node,r=e.current;if(r){r.classList.add(It.a.sortingContainer);var i=r.querySelector(".".concat(It.a.draggedVideoItem));n.childNodes.forEach((function(e,t){return i.childNodes[t].style.width="".concat(e.offsetWidth,"px")}))}}},wt=function(e,t){return function(n){var r=e.current;r&&r.classList.remove(It.a.sortingContainer),t(n.oldIndex,n.newIndex)}};function Dt(e){var t=e.onSortEnd,n=e.emptyMessage,r=Pt(e,["onSortEnd","emptyMessage"]),i=p.useRef();return d.CollectionHelper.isEmpty(e.videos)?p.createElement("div",null,n):p.createElement(ke.Table,{responsive:!0},p.createElement(At,Object.assign({sortable:!0},e)),p.createElement(Nt,Object.assign({forwardedRef:i,onSortStart:kt(i),onSortEnd:wt(i,t),lockAxis:"y",lockToContainerEdges:!0,distance:1,helperClass:It.a.draggedVideoItem,helperContainer:function(){return i.current}},r)))}function Ft(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 _t(e){var t=e.imageType,n=e.closePopup,r=p.useContext(Ce),i=r.getDataUrl,a=r.setImage,o=Ft(p.useState(i()),1)[0],c=Ft(p.useState(!1),2),s=c[0],l=c[1],m=Object(f.useService)(u.IMAGE_UPLOAD),b=function(e){a(e),n()},y={dataUrl:o,imageType:t,minWidth:d.ImageMinDimensions[t].width,minHeight:d.ImageMinDimensions[t].height,onCrop:function(e){return m.uploadBase64Image(e,t,b,n)},onCancel:n};return p.createElement(it,{title:"Crop Image",closePopup:n,onEntered:function(){return l(!0)}},s&&p.createElement(tt,Object.assign({},y)))}Dt.defaultProps={emptyMessage:"There are no videos in this list."};var xt=function(e){var t=e.children;return p.createElement(Ne,null,p.createElement(Ae,null,t))},Rt=n(3),Ut=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Rt.string().trim().max(65535,"Description is too long").default(""),poster:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown(),banner:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown()}).noUnknown(),Bt=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 ie(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 Vt(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 Jt(e){var t=Vt(p.useState(!1),2),n=t[0],r=t[1];return p.useEffect((function(){e.isValid&&e.dirty?r(!0):r(!1)}),[e.isValid,e.dirty,e.values]),p.useEffect((function(){e.isSubmitting&&r(!1)}),[e.isSubmitting]),n}function Ht(e){var t=Object(He.useFormikContext)(),n=Jt(t);return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this series",autoFocus:!0}),p.createElement(d.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this series here"}),p.createElement(Ge,{imageType:d.ImageType.Posters,currentImage:t.values.poster,setNewImage:function(e){return t.setFieldValue("poster",e)},application:s.SERIES,uploadAction:i.Series.UPLOAD_IMAGE}),p.createElement(Ge,{imageType:d.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(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(Fe,{actions:e.actions})))}function Mt(e){return p.createElement(d.FormWrapper,{initialValues:e.series,validationSchema:Ut,onSubmit:e.saveSeries},p.createElement(Ht,{id:e.series&&e.series.id}))}var Yt,qt,zt,Kt,Wt=function(e){return function(t){return t.appLink.action===e}};function Gt(e){var t=e.seriesId,n=e.activeAction,r=p.useContext(Pe);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(st,{tabs:Bt(r,t),isItemActive:Wt(n)}))}function Zt(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 Qt(e){var t=e.seriesId,n=Zt(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(u.SERIES);Object(f.useFetch)(Te.getSeriesFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(Gt,{seriesId:t,activeAction:i.Series.EDIT_SERIES}),!!r&&p.createElement(Mt,{series:r,saveSeries:function(e,n){return o.updateSeries(t,e,n,n)}}))}!function(e){e[e.Subject=0]="Subject",e[e.Classification=1]="Classification"}(Yt||(Yt={})),function(e){e.Playlists="playlists",e.Series="series",e.Videos="videos"}(qt||(qt={})),function(e){e.Root="0"}(zt||(zt={})),function(e){e.Root="root"}(Kt||(Kt={}));var Xt=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default(""),levelIds:Rt.array().of(Rt.string()).required("A level is required").default([])}).noUnknown(),$t=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentIds:Rt.array().of(Rt.string()).default([Kt.Root]),subjectIds:Rt.array().of(Rt.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:Rt.mixed().required("Type is required").default(d.ClassificationType.Subject),emphasize:Rt.boolean().default(!1),cover:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown(),banner:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown()}).noUnknown(),en=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),tn=Rt.object().shape({name:Rt.string().max(255,"Name is too long").required("Name is required"),description:Rt.string().max(65535,"Description is too long").required("Description is required")}),nn=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentId:Rt.string().default(zt.Root)}).noUnknown(),rn={singularizeMemberType:function(e){switch(e){case qt.Playlists:return"playlist";case qt.Series:return"series";case qt.Videos:return"video"}},getMemberAppLink:function(e,t){var n=[t];switch(e){case qt.Playlists:return{application:s.PLAYLISTS,action:i.Playlists.EDIT_PLAYLIST,args:n};case qt.Series:return{application:s.SERIES,action:i.Series.EDIT_SERIES,args:n};case qt.Videos:return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:n}}},getMemberActions:function(e,t,n,r){return[{name:"Remove ".concat(rn.singularizeMemberType(n)),appLink:{application:s.SUBJECTS,action:t===Yt.Subject?i.Subjects.REMOVE_SUBJECT_MEMBER:i.Subjects.REMOVE_CLASSIFICATION_MEMBER,args:[e,r,n]},className:"text-danger"}]}},an=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]}]},on=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]}}]},cn=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 sn(e){return(sn="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 ln(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 un(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pn(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){return!t||"object"!==sn(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 dn(e){return(dn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function mn(e,t){return(mn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var bn=function(){return"/api/subjects/v1/subjects/tree"},yn=function(e){return"/api/subjects/v1/subjects/".concat(e)},Sn=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/").concat(t,"?query={limit:100}")},vn=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},En=function(){return"/api/subjects/v1/subjects"},hn=function(e){return"/api/subjects/v1/subjects/".concat(e)},gn=function(e){return"/api/subjects/v1/subjects/".concat(e)},jn=function(e){return"/api/subjects/v1/objects/".concat(e,"/subjects")},Tn=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/subjects?addToClassifications=").concat(!!t)},On=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?addToClassifications=").concat(!!t)},In=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Cn=function(){return"/api/subjects/v1/presentations"},An=function(e){return"/api/subjects/v1/presentations/".concat(e)},Ln=function(){return"/api/subjects/v1/presentations"},Pn=function(e){return"/api/subjects/v1/presentations/".concat(e)},Nn=function(e){return"/api/subjects/v1/presentations/".concat(e,"/classifications/tree")},kn=function(e){return"/api/subjects/v1/classifications/".concat(e,"?query=cover,banner")},wn=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/").concat(t,"?query={limit:100}")},Dn=function(){return"/api/subjects/v1/classifications"},Fn=function(e){return"/api/subjects/v1/classifications/".concat(e)},_n=function(e){return"/api/subjects/v1/classifications/".concat(e)},xn=function(e){return"/api/subjects/v1/objects/".concat(e,"/classifications")},Rn=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/classifications?presentationId=").concat(t)},Un=function(e){return"/api/subjects/v1/classifications/".concat(e,"/objects")},Bn=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Vn=function(){return"/api/subjects/v1/levels"},Jn=function(e){return"/api/subjects/v1/levels/".concat(e)},Hn=function(){return"/api/subjects/v1/levels"},Mn=function(e){return"/api/subjects/v1/levels/".concat(e)},Yn=function(e){return"/api/subjects/v1/objects/".concat(e,"/levels")},qn=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/levels?addToAudiences=").concat(!!t)},zn=function(e){return"/api/subjects/v1/presentations/".concat(e,"/audiences")},Kn=function(e){return"/api/subjects/v1/audiences/".concat(e)},Wn=function(){return"/api/subjects/v1/audiences"},Gn=function(e){return"/api/subjects/v1/audiences/".concat(e)},Zn=function(e){return"/api/subjects/v1/audiences/".concat(e)},Qn=function(e){return"/api/subjects/v1/objects/".concat(e,"/audiences")},Xn=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/audiences?presentationId=").concat(t)},$n=function(e){return e.data},er=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},tr=function(e){function t(){return un(this,t),fn(this,dn(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&&mn(e,t)}(t,e),n=t,(r=[{key:"getPresentations",value:function(e,t){return this.get({resource:Cn(),formatData:$n,eventPrefix:a.PRESENTATIONS,expiryTime:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getPresentation",value:function(e,t,n){return this.get({resource:An(e),formatData:$n,eventPrefix:"".concat(a.PRESENTATION,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPresentation",value:function(e,t,n){return this.create({resource:Ln(),data:e,formatData:$n,callback:t,errorCallback:n,eventPrefix:a.PRESENTATION,invalidationKeys:[a.PRESENTATIONS],expiryTime:d.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:Pn(e),data:t,formatData:$n,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PRESENTATION,":").concat(e),invalidationKeys:["".concat(a.PRESENTATION,":").concat(e),a.PRESENTATIONS],expiryTime:d.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:bn(),formatData:function(e){return{children:e.data,name:zt.Root,id:null}},eventPrefix:a.SUBJECTS,expiryTime:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getSubject",value:function(e,t,n){return this.get({resource:yn(e),formatData:$n,eventPrefix:"".concat(a.SUBJECT,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSubjectMemberIds",value:function(e,t,n,r){return this.get({resource:Sn(e,t),formatData:$n,eventPrefix:"".concat(a.SUBJECT,":").concat(e,":").concat(t),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"getSubjectClassifications",value:function(e,t,n,r,i){return this.get({resource:vn(e,t,n),formatData:$n,eventPrefix:er(e,t,n),expiryTime:d.CacheDurations.STANDARD,callback:r,errorCallback:i})}},{key:"createSubject",value:function(e,t,n){return this.create({resource:En(),data:e,formatData:$n,callback:t,errorCallback:n,eventPrefix:a.SUBJECT,invalidationKeys:[a.SUBJECTS],expiryTime:d.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:hn(e),data:t,formatData:$n,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_SUBJECT,":").concat(e),invalidationKeys:["".concat(a.SUBJECT,":").concat(e),a.SUBJECTS],expiryTime:d.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:gn(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:jn(e),formatData:$n,eventPrefix:"".concat(t,":").concat(e,":").concat(a.SUBJECTS),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectSubjects",value:function(e,t,n,r,i,o){var c=rn.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,ln(t.map((function(e){return"".concat(a.SUBJECTS,":").concat(e,":").concat(n)})))),this.update({resource:Tn(e,r),data:t,formatData:$n,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?rn.singularizeMemberType(n):n,s=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(ln(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))),ln(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)}))));return this.create({resource:On(e,r),data:t,formatData:$n,callback:i,errorCallback:o,eventPrefix:"".concat(a.ADD_TO_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:s,expiryTime:d.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?rn.singularizeMemberType(n):n,c=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(ln(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))));return this.delete({resource:In(e,t),callback:r,errorCallback:i,eventPrefix:"".concat(a.REMOVE_FROM_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:c,expiryTime:d.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:Nn(e),formatData:function(e){return{children:e.data,name:Kt.Root,id:null}},eventPrefix:"".concat(a.CLASSIFICATIONS,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassification",value:function(e,t,n){return this.get({resource:kn(e),formatData:$n,eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassificationMembers",value:function(e,t,n,r){return this.get({resource:wn(e,t),formatData:$n,eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e,":").concat(t),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"createClassification",value:function(e,t,n){return this.create({resource:Dn(),data:e,formatData:$n,callback:t,errorCallback:n,eventPrefix:a.CLASSIFICATION,invalidationKeys:[a.CLASSIFICATIONS],expiryTime:d.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:Fn(e),data:t,formatData:$n,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_CLASSIFICATION,":").concat(e),invalidationKeys:["".concat(a.CLASSIFICATION,":").concat(e),a.CLASSIFICATIONS],expiryTime:d.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:_n(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:xn(e),formatData:$n,eventPrefix:"".concat(t,":").concat(e,":").concat(a.CLASSIFICATIONS),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectClassifications",value:function(e,t,n,r,i,o){var c=rn.singularizeMemberType(r),s=["".concat(r,":").concat(e,":").concat(a.CLASSIFICATIONS)];return s.push.apply(s,ln(n.map((function(e){return"".concat(a.CLASSIFICATION,":").concat(e,":").concat(r)})))),this.update({resource:Rn(e,t),data:n,formatData:$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?rn.singularizeMemberType(n):n,l=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&l.push(er(r,i,n)),l.push.apply(l,ln(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.create({resource:Un(e),data:t,formatData:$n,callback:o,errorCallback:c,eventPrefix:"".concat(a.ADD_TO_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:l,expiryTime:d.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?rn.singularizeMemberType(n):n,l=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&l.push(er(r,i,n)),l.push.apply(l,ln(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.delete({resource:Bn(e,t),callback:o,errorCallback:c,eventPrefix:"".concat(a.REMOVE_FROM_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:l,expiryTime:d.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:Vn(),formatData:$n,eventPrefix:a.LEVELS,expiryTime:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getLevel",value:function(e,t,n){return this.get({resource:Jn(e),formatData:$n,eventPrefix:"".concat(a.LEVEL,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createLevel",value:function(e,t,n){return this.create({resource:Hn(),data:e,formatData:$n,callback:t,errorCallback:n,eventPrefix:a.LEVEL,invalidationKeys:[a.LEVELS],expiryTime:d.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:Mn(e),data:t,formatData:$n,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_LEVEL,":").concat(e),invalidationKeys:["".concat(a.LEVEL,":").concat(e),a.LEVELS],expiryTime:d.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:Yn(e),formatData:$n,eventPrefix:"".concat(t,":").concat(e,":").concat(a.LEVELS),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectLevels",value:function(e,t,n,r,i,o){var c=rn.singularizeMemberType(n),s=["".concat(n,":").concat(e,":").concat(a.LEVELS)];return r&&s.push("".concat(n,":").concat(e,":").concat(a.AUDIENCES)),this.update({resource:qn(e,r),data:t,formatData:$n,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:zn(e),formatData:$n,callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCES,":").concat(e),expiryTime:d.CacheDurations.STANDARD})}},{key:"getAudience",value:function(e,t,n){return this.get({resource:Kn(e),formatData:$n,callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCE,":").concat(e),expiryTime:d.CacheDurations.STANDARD})}},{key:"createAudience",value:function(e,t,n){return this.create({resource:Wn(),data:e,formatData:$n,callback:t,errorCallback:n,eventPrefix:a.AUDIENCE,invalidationKeys:[a.AUDIENCES],expiryTime:d.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:Gn(e),data:t,formatData:$n,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_AUDIENCE,":").concat(e),invalidationKeys:["".concat(a.AUDIENCE,":").concat(e),a.AUDIENCES],expiryTime:d.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:Zn(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:Qn(e),formatData:$n,eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectAudiences",value:function(e,t,n,r,i,o){var c=rn.singularizeMemberType(r);return this.update({resource:Xn(e,t),data:n,formatData:$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 u.SUBJECT}},{key:"channelName",get:function(){return l.SUBJECT}}])&&pn(n.prototype,r),i&&pn(n,i),t}(f.BaseDataService),nr={dataServiceName:u.SUBJECT,dataChannelName:l.SUBJECT},rr={getSubjectTreeFetchOptions:function(e,t){return Object.assign(Object.assign({},nr),{eventPrefix:a.SUBJECTS,fetchData:function(e){return e.getSubjectTree()},setData:e,onError:t})},getSubjectFetchOptions:function(e,t,n){return Object.assign(Object.assign({},nr),{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({},nr),{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({},nr),{eventPrefix:er(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({},nr),{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({},nr),{eventPrefix:a.PRESENTATIONS,fetchData:function(e){return e.getPresentations()},setData:e,onError:t})},getPresentationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},nr),{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({},nr),{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({},nr),{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({},nr),{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({},nr),{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({},nr),{eventPrefix:a.LEVELS,fetchData:function(e){return e.getLevels()},setData:e,onError:t})},getLevelFetchOptions:function(e,t,n){return Object.assign(Object.assign({},nr),{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({},nr),{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({},nr),{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({},nr),{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({},nr),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),fetchData:function(n){return n.getObjectAudiences(e,t)},setData:n,onError:r})}};function ir(e,t){p.useEffect((function(){e.presentations&&!e.currentPresentation&&d.StateHelper.getSetStateByKey(t,"currentPresentation")(f.ArrayHelper.first(e.presentations))}),[e.presentations])}var ar=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},or=function(e,t){var n=e.levelIds;return t.filter((function(e){return n.includes(e.id)}))};function cr(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 sr(e){var t,n=e.audience,r=e.levels;return p.createElement("tr",null,p.createElement("td",null,p.createElement(d.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(d.AppLink,{key:e.id,appLink:ar(e),className:"mr-2"},e.name)}))))}function lr(e){var t=e.audiences,n=e.levels;return p.createElement(ke.Table,{responsive:!0,bordered:!0},p.createElement(cr,{showLevels:!!t.length}),p.createElement("tbody",null,t.length?t.map((function(e){return p.createElement(sr,{key:e.masterId,audience:e,levels:or(e,n)})})):p.createElement("tr",null,p.createElement("td",null,"This presentation has no audiences."))))}function ur(e){var t=null===e.masterId||void 0===e.masterId,n=Object(He.useFormikContext)(),r=Jt(n);return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this audience",autoFocus:!0}),p.createElement(d.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(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(ke.Button,{as:d.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_AUDIENCE,args:[e.presentationId,e.masterId]}},"Delete")))}function pr(e){return p.createElement(d.FormWrapper,{initialValues:e.audience,validationSchema:Xt,onSubmit:e.saveAudience},p.createElement(ur,{masterId:e.audience&&e.audience.masterId,presentationId:e.presentationId,levels:e.levels}))}function fr(e){var t=e.objectAudiences,n=e.presentationAudiences;return t.filter((function(e){return n.some((function(t){return t.masterId===e.masterId}))}))}function dr(e){var t,n,r,i,a,o=rn.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(Pr,{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(Dr,{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(lr,{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(br,{initialValues:{audienceIds:fr(e).map((function(e){return e.masterId}))},saveAudiences:e.saveAudiences,audiences:c}))}function mr(e){var t=Object(He.useFormikContext)(),n=Jt(t);return p.createElement(He.Form,null,p.createElement(d.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(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Audiences")))}function br(e){return p.createElement(d.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.audienceIds;return e.saveAudiences(r,n)},enableReinitialize:!0},p.createElement(mr,{audiences:e.audiences}))}function yr(e){var t=e.item,n=e.getItemAppLink,r=e.actions;return p.createElement("tr",null,p.createElement("td",null,p.createElement(d.AppLink,{appLink:n(t)},t.name)),r&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(Fe,{actions:r}))))}function Sr(e){var t=e.items,n=e.memberType,r=e.getItemAppLink,i=e.getActions;if(!t.length)return p.createElement("div",{className:"py-5"},"No ".concat(n," in this classification."));var a="".concat(ce(rn.singularizeMemberType(n))," Name");return p.createElement(ke.Table,{responsive:!0},p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,a),f.FunctionHelper.isFunction(i)&&p.createElement("th",null))),p.createElement("tbody",null,t.map((function(e){return p.createElement(yr,{item:e,key:e.id,getItemAppLink:r,actions:f.FunctionHelper.isFunction(i)&&i(e)})}))))}function vr(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 Er=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}};function hr(e){var t=Object(He.useFormikContext)(),n=Jt(t),r=null===e.id||void 0===e.id,a=!r||!(!t.values.parentIds||!t.values.parentIds.length),o=vr(p.useState(a),2),c=o[0],l=o[1];p.useEffect((function(){return l(a)}),[e.id,t.values.parentIds]),p.useEffect((function(){t.values.subjectIds.length&&!t.touched.subjectIds&&t.setFieldTouched("subjectIds",!0)}),[t.values.subjectIds]);var u=function(e){return t.setFieldValue("parentIds",f.ArrayHelper.addOrRemove(t.values.parentIds.map((function(e){return e.toString()})),e.id.toString()))},m=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(d.FormHelper.getCustomFormControlClassName(t.errors,t.touched,e)," h-auto py-2")};return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this classification",autoFocus:!0}),p.createElement(d.FormField,{as:"select",label:"Type",name:"type",id:"type",value:t.values.type},f.ObjectHelper.getEnumKeys(d.ClassificationType).map((function(e){return p.createElement("option",{key:e,value:d.ClassificationType[e]},e)}))),p.createElement(d.FormField,{label:"Emphasize",name:"emphasize",id:"emphasize",type:"checkbox",checked:t.values.emphasize}),p.createElement(d.FormField,{name:"parentIds"},(function(){return p.createElement("div",{className:b("parentIds")},p.createElement(Et,{label:"Parent Classification(s)",tree:e.classificationTree,selectedIds:t.values.parentIds,onSelect:u,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=le.find(n,r);return!!le.find(t,e.id)})}));var n,r})),p.createElement(d.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:b("subjectIds")},p.createElement(Et,{label:"Mapped Subject(s)",tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:m,collapse:!r,getSelectedItemAppLink:Er}))})),p.createElement(Ge,{imageType:d.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.SUBJECTS,uploadAction:i.Subjects.UPLOAD_IMAGE}),p.createElement(Ge,{imageType:d.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(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},r?"Create":"Save"),!r&&p.createElement(ke.Button,{as:d.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e.presentationId,e.id]}},"Delete")))}function gr(e){return p.createElement(d.FormWrapper,{initialValues:e.classification,validationSchema:$t,onSubmit:e.saveClassification},p.createElement(hr,{id:e.classification&&e.classification.id,presentationId:e.presentationId,classificationTree:e.classificationTree,subjectTree:e.subjectTree}))}var jr=function(e){return function(t){if(!e)return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION;switch(e){case qt.Playlists:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;case qt.Series:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_SERIES;case qt.Videos:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_VIDEOS}}};function Tr(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(st,{tabs:cn(t.id,n),isItemActive:jr(r)}))):p.createElement(p.Fragment,null)}function Or(e){var t=Object(He.useFormikContext)(),n=Jt(t),r=p.useContext(d.AppLinkContext),i=r&&r.getClassificationAppLink,a=function(e){return t.setFieldValue("classificationIds",f.ArrayHelper.addOrRemove(t.values.classificationIds.map((function(e){return e.toString()})),e.id.toString()))},o="".concat(d.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"classificationIds")," h-auto py-2");return p.createElement(He.Form,null,p.createElement(d.FormField,{name:"classificationIds"},(function(){return p.createElement("div",{className:o},p.createElement(Et,{label:"Mapped Classification(s)",tree:e.classificationTree,selectedIds:t.values.classificationIds,onSelect:a,getSelectedItemAppLink:i,isNodeDisabled:e.isClassificationDisabled}))})),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Classifications")))}function Ir(e){return p.createElement(d.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.classificationIds;return e.saveClassifications(r,n)},enableReinitialize:!0},p.createElement(Or,{classificationTree:e.classificationTree,isClassificationDisabled:e.isClassificationDisabled}))}function Cr(e){var t=null===e.id||void 0===e.id,n=Object(He.useFormikContext)(),r=Jt(n);return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this level",autoFocus:!0}),p.createElement(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"))}function Ar(e){return p.createElement(d.FormWrapper,{initialValues:e.level,validationSchema:en,onSubmit:e.saveLevel},p.createElement(Cr,{id:e.level&&e.level.id}))}function Lr(e){var t=rn.singularizeMemberType(e.memberType),n=Object(He.useFormikContext)(),r=Jt(n);return p.createElement(He.Form,null,p.createElement(d.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(d.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(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},"Save Levels")))}function Pr(e){return p.createElement(d.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.levelIds,i=t.addToAudiences;return e.saveLevels(r,i,n)}},p.createElement(Lr,{levels:e.levels,memberType:e.memberType}))}function Nr(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(d.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)}function kr(e){var t=e.values,n=t.name,r=t.description,i=e.id,a=e.isSubmitting,o=!i;return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n,placeholder:"Enter a name for this presentation",autoFocus:!0}),p.createElement(d.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:r,placeholder:"Describe this presentation here"}),p.createElement(d.SpinnerButton,{showSpinner:a,type:"submit"},o?"Create":"Save"))}function wr(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(He.Formik,{initialValues:{name:a,description:c},validationSchema:tn,onSubmit:s},(function(e){return p.createElement(kr,Object.assign({id:r},e))}))}Nr.defaultProps={emptyMessage:"There is nothing here."};function Dr(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(ke.Form.Label,null,i),p.createElement(ke.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 Fr(e){return p.createElement(p.Fragment,null,p.createElement("h4",null,"".concat(ce(e.memberType))),p.createElement(ke.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(d.AppLink,{appLink:rn.getMemberAppLink(e.memberType,t.id)},t.name)))})))),p.createElement(Mr,{initialValues:{subjectIds:[],addToClassifications:!0},subjectTree:e.subjectTree,saveSubjects:e.onClickAddToSubject,memberType:e.memberType,saveBtnText:"Add to subject",subjectRequired:!0}))}function _r(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 xr(e){var t=rn.singularizeMemberType(e.memberType),n=[].concat(_r(e.objectClassifications),_r(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(Mr,{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(Dr,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),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(Ir,{initialValues:{classificationIds:e.objectClassifications.map((function(e){return e.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 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")}()}Dr.defaultProps={label:"Presentation"};function Ur(e){var t=!e.id,n=Object(He.useFormikContext)(),r=Jt(n),a=!t||!!n.values.parentId,o=Rr(p.useState(a),2),c=o[0],l=o[1];p.useEffect((function(){return l(a)}),[e.id,n.values.parentId]);var u=function(e){var t=e.id===n.values.parentId?null:e.id;n.setFieldValue("parentId",t)},f="".concat(d.FormHelper.getCustomFormControlClassName(n.errors,n.touched,"parentId")," h-auto py-2");return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this subject",autoFocus:!0}),p.createElement(d.FormField,{name:"parentId"},(function(){return p.createElement("div",{className:f},p.createElement(Et,{label:"Parent Subject",tree:e.subjectTree,selectedIds:[n.values.parentId],onSelect:u,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=le.find(t,r);return!!le.find(n,e.id)})}));var t,r})),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(ke.Button,{as:d.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_SUBJECT,args:[e.id]}},"Delete")))}function Br(e){return p.createElement(d.FormWrapper,{initialValues:e.subject,validationSchema:nn,onSubmit:e.saveSubject},p.createElement(Ur,{id:e.subject&&e.subject.id,subjectTree:e.subjectTree}))}var Vr=function(e){return function(t){return t.appLink.action===e}};function Jr(e){var t=e.subjectId,n=e.activeAction;return p.createElement(p.Fragment,null,p.createElement(ke.Alert,{variant:"danger"},"Warning: You are editing the backbone subjects."),p.createElement("div",{className:"py-2"},p.createElement(st,{tabs:on(t),isItemActive:Vr(n)})))}function Hr(e){var t=Object(He.useFormikContext)(),n=Jt(t),r=p.useContext(d.AppLinkContext),i=r&&r.getSubjectAppLink,a=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)},o=rn.singularizeMemberType(e.memberType),c="".concat(d.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"subjectIds")," h-auto py-2");return p.createElement(He.Form,null,p.createElement(d.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:c},p.createElement(Et,{label:"Mapped Subject".concat(e.allowMultiple?"(s)":""),tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:a,collapse:!!t.initialValues.subjectIds.length,getSelectedItemAppLink:i}))})),p.createElement(d.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(o," 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(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.saveBtnText)))}function Mr(e){var t;return p.createElement(d.FormWrapper,{initialValues:e.initialValues,validationSchema:(t=e.subjectRequired,Rt.object().shape({subjectIds:t?Rt.array().of(Rt.string()).min(1,"A subject is required").required("A subject is required"):Rt.array().of(Rt.string()),addToClassifications:Rt.boolean().default(!0)}).noUnknown()),onSubmit:function(t,n){var r=t.subjectIds,i=t.addToClassifications;return e.saveSubjects(r,i,n)}},p.createElement(Hr,{subjectTree:e.subjectTree,memberType:e.memberType,allowMultiple:e.allowMultiple,saveBtnText:e.saveBtnText}))}Hr.defaultProps={saveBtnText:"Save"};var Yr=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(d.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.")))},qr=function(e){return p.createElement(p.Fragment,null,!!e.presentations&&!!e.classificationDictionary&&e.presentations.map((function(t){return p.createElement(Yr,{key:t.id,presentation:t,classifications:e.classificationDictionary[t.id]})})))},zr=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 Kr(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(Ue,{selected:e.getIsClassificationSelected(t),onToggle:function(n){return e.onToggleClassification(t.id,n)}})),p.createElement(d.AppLink,{appLink:e.getClassificationAppLink(t.id)},function(e,t){return t?e.name:"Classification: ".concat(e.name)}(t,e.showClassificationSubHeader)))})))}function Wr(e){var t=e.memberType,n=e.hasActions,r=e.classifications,i=zr(e,["memberType","hasActions","classifications"]),a="".concat(ce(rn.singularizeMemberType(t))," Name"),o=!!r&&!!r.length,c=o&&r.length>1,s=o?2:1,l=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(Kr,Object.assign({},l))),n&&p.createElement("th",{rowSpan:s})),o&&c&&p.createElement("tr",null,p.createElement(Kr,Object.assign({},l))))}function Gr(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,l=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,l?p.createElement(d.AppLink,{appLink:o(n)},r):r),!!a.length&&a.map((function(e){return p.createElement("td",{key:e.id},p.createElement(Ue,{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(Fe,{actions:s}))))}var Zr=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 Qr(e,t){return function(n){var r=n[e],i=d.CollectionHelper.length(r);return!!i&&i===t.length}}function Xr(e){var t=e.members,n=e.memberType,r=e.getActions,i=e.classifications,a=e.getClassificationAppLink,o=e.onToggleClassification,c=Zr(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),l={memberType:n,classifications:i,getClassificationAppLink:a,getIsClassificationSelected:Qr(n,t),onToggleClassification:o,hasActions:s};return p.createElement(ke.Table,{responsive:!0,bordered:!0},p.createElement(Wr,Object.assign({},l)),p.createElement("tbody",null,t.map((function(e,t){return p.createElement(Gr,Object.assign({key:t,member:e,actions:s&&r(e.id),onToggleClassification:o},c))}))))}function $r(e){var t=e.navItems,n=e.currentAppLink;return p.createElement(ke.Container,null,p.createElement(ke.Navbar,{className:"justify-content-between align-items-center"},p.createElement(ke.Nav,null,!!t&&t.map((function(e,t){return p.createElement(ke.Nav.Item,{key:t},p.createElement(ke.Nav.Link,{as:d.AppLink,appLink:e.appLink,active:ne.isItemActive(e,n),className:ne.isItemActive(e,n)?"text-primary":""},e.label))})))))}function ei(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 ti(e){var t=e.seriesId,n=ei(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Te.getSeriesFetchOptions(e,r("series")),rr.getObjectLevelsFetchOptions(e,qt.Series,r("seriesLevels"))],[e]),Object(f.useFetch)(rr.getObjectAudiencesFetchOptions(e,qt.Series,r("seriesAudiences")),[e,t.seriesLevels]),Object(f.useBulkFetch)([rr.getPresentationsFetchOptions(r("presentations")),rr.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&rr.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),ir(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.seriesLevels&&r.seriesAudiences);return p.createElement(p.Fragment,null,p.createElement(Gt,{seriesId:t,activeAction:i.Series.EDIT_SERIES_AUDIENCES}),p.createElement(nt,{object:r.series}),!!c&&p.createElement(dr,{objectLevels:r.seriesLevels,objectAudiences:r.seriesAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:qt.Series,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,qt.Series,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,qt.Series,n,n)}}))}function ni(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 ri(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 ii=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT_SERIES,args:[e]}},ai=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION_SERIES,args:[e.currentPresentation.id,t]}}};function oi(e){var t=e.seriesId,n=ni(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([rr.getSubjectTreeFetchOptions(r("subjectTree")),rr.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([Te.getSeriesFetchOptions(e,r("series")),rr.getObjectSubjectsFetchOptions(e,qt.Series,r("seriesSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&rr.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(ri(t.subjectClassifications||[]),ri(e))},a=t.seriesSubjects&&t.seriesSubjects.map((function(e){return rr.getSubjectClassificationFetchOptions(e.id,d.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.seriesSubjects],!!a),Object(f.useFetch)(rr.getObjectClassificationsFetchOptions(e,qt.Series,r("seriesClassifications")),[e,t.seriesSubjects])}(t,r,a),ir(r,a);var c=!!(r.seriesSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.seriesClassifications&&r.subjectClassifications);return p.createElement(d.AppLinkContext.Provider,{value:{getSubjectAppLink:ii,getClassificationAppLink:ai(r)}},p.createElement(Gt,{seriesId:t,activeAction:i.Series.EDIT_SERIES_SUBJECTS}),p.createElement(nt,{object:r.series}),c&&p.createElement(xr,{objectSubjects:r.seriesSubjects,subjectTree:r.subjectTree,memberType:qt.Series,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.seriesClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,qt.Series,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,qt.Series,n,n)}}))}function ci(){var e=Object(f.useService)(u.SERIES);return p.createElement(Mt,{saveSeries:function(t,n){return e.createSeries(t,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)}})}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 li(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 pi(e,t,n){return t&&ui(e.prototype,t),n&&ui(e,n),e}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 di(e){return(di=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function mi(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&&bi(e,t)}function bi(e,t){return(bi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var yi=function(e){function t(){return li(this,t),fi(this,di(t).apply(this,arguments))}return mi(t,e),pi(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),Si=function(e){function t(){return li(this,t),fi(this,di(t).apply(this,arguments))}return mi(t,e),pi(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(u).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"newSeries",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ci,null))}},{key:"editSeries",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Qt,{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(d.LayoutRegions.CONTENT,p.createElement(oi,{seriesId:e}))}},{key:"editSeriesAudiences",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ti,{seriesId:e}))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(_t,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 Oe.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.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:xt}}}}],[{key:"router",get:function(){return yi}}]),t}(f.Core.Application);function vi(e){return(vi="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 Ei(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hi(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 gi(e,t){return!t||"object"!==vi(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 ji(e){return(ji=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ti(e,t){return(Ti=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Oi,Ii=function(e){return"/api/master/v2/objects/".concat(e,"?query=cover,banner")},Ci=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},Ai=function(e){return"/api/master/v2/objects/".concat(e,"/playlists")},Li=function(e){return"/api/master/v2/objects/".concat(e)},Pi=function(e){return"/api/master/v1/playlists/".concat(e)},Ni=function(e,t,n){var r="/api/master/v2/objects/".concat(e,"/").concat(t);return n&&(r+="?query=".concat(n)),r},ki=function(e){return"/api/master/v1/objects/".concat(e,"/videos/reorder")},wi=function(e,t){return"/api/master/v1/playlists/".concat(e,"/dissociate/").concat(t)};!function(e){e.Videos="videos"}(Oi||(Oi={}));var Di=function(e){function t(){return Ei(this,t),gi(this,ji(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&&Ti(e,t)}(t,e),n=t,(r=[{key:"getPlaylist",value:function(e,t,n){return this.get({resource:Ii(e),eventPrefix:"".concat(a.PLAYLIST,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getPlaylistsById",value:function(e,t,n){return this.get({resource:Ci(e),eventPrefix:"".concat(a.PLAYLISTS,":").concat(e.join(",")),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPlaylist",value:function(e,t,n,r){return this.create({resource:Ai(t),data:Object.assign(Object.assign({},e),{permissions:re()}),callback:n,errorCallback:r,eventPrefix:a.PLAYLIST,expiryTime:d.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:Li(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PLAYLIST,":").concat(e),invalidationKeys:["".concat(a.PLAYLIST,":").concat(e),a.PLAYLISTS],expiryTime:d.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:Pi(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:Ni(e,Oi.Videos,"{orderBy:orderindex,limit:100}"),callback:t,errorCallback:n,eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(Oi.Videos),expiryTime:d.CacheDurations.STANDARD})}},{key:"reorderVideos",value:function(e,t,n){return this.update({resource:ki(e),data:Object.assign({ownerId:e},t),eventPrefix:a.REORDER_PLAYLIST_VIDEOS,expiryTime:d.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:wi(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 u.PLAYLIST}},{key:"channelName",get:function(){return l.PLAYLIST}}])&&hi(n.prototype,r),i&&hi(n,i),t}(f.BaseDataService),Fi={dataServiceName:u.PLAYLIST,dataChannelName:l.PLAYLIST},_i={getPlaylistFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Fi),{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({},Fi),{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({},Fi),{eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(Oi.Videos),fetchData:function(t){return t.getPlaylistVideos(e)},setData:t,onError:n})}},xi=function(e){var t=e.children;return p.createElement(Ne,null,p.createElement(Ae,null,t))};function Ri(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 Ui(e){var t=e.playlistId,n=e.closePopup,r=Ri(p.useState(),2),a=r[0],o=r[1],c=Ri(p.useState(!1),2),l=c[0],d=c[1],m=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(_i.getPlaylistFetchOptions(t,o),[t]);var b=p.useCallback((function(){n(),f.Core.AppLinkHelper.trigger({application:s.PLAYLISTS,action:i.Playlists.PLAYLISTS})}),[]),y=p.useCallback((function(){d(!0),m.deletePlaylist(t,b,n)}),[t]),S=[{variant:"link",onClick:n,buttonText:"Cancel"},{variant:"danger",onClick:y,buttonText:"Yes, delete playlist",isSpinnerButton:!0,showSpinner:l}],v=!!a;return p.createElement(it,{title:"Delete Playlist",closePopup:n,showLoadingSpinner:!v},v&&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(ct,{buttons:S})))}var Bi=Rt.object().shape({name:Rt.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Rt.string().trim().max(65535,"Description is too long").default(""),cover:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown(),banner:Rt.object().shape({fileId:Rt.string(),fileIdType:Rt.mixed(),url:Rt.string()}).default({}).noUnknown()}).noUnknown(),Vi=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"))},Ji=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 ie(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 Hi(e){var t=Object(He.useFormikContext)(),n=Jt(t);return p.createElement(He.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this playlist",autoFocus:!0}),p.createElement(d.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this playlist here"}),p.createElement(Ge,{imageType:d.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.PLAYLISTS,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement(Ge,{imageType:d.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(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(Fe,{actions:e.actions})))}function Mi(e){var t,n=e.playlist&&e.playlist.id;return p.createElement(d.FormWrapper,{initialValues:e.playlist,validationSchema:Bi,onSubmit:e.savePlaylist},p.createElement(Hi,{id:n,actions:!!n&&(t=n,[{name:"Delete playlist",appLink:{application:s.PLAYLISTS,action:i.Playlists.DELETE_PLAYLIST,args:[t]},className:"text-danger"}])}))}var Yi=function(e){return function(t){return t.appLink.action===e}};function qi(e){var t=e.playlistId,n=e.activeAction,r=p.useContext(Pe);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(st,{tabs:Ji(r,t),isItemActive:Yi(n)}))}function zi(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 Ki(e){var t=e.playlistId,n=zi(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(_i.getPlaylistFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(qi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST}),!!r&&p.createElement(Mi,{playlist:r,savePlaylist:function(e,n){return o.updatePlaylist(t,e,n,n)}}))}function Wi(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 Gi(e){var t=e.playlistId,n=Wi(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([_i.getPlaylistFetchOptions(e,r("playlist")),rr.getObjectLevelsFetchOptions(e,qt.Playlists,r("playlistLevels"))],[e]),Object(f.useFetch)(rr.getObjectAudiencesFetchOptions(e,qt.Playlists,r("playlistAudiences")),[e,t.playlistLevels]),Object(f.useBulkFetch)([rr.getPresentationsFetchOptions(r("presentations")),rr.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&rr.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),ir(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.playlistLevels&&r.playlistAudiences);return p.createElement(p.Fragment,null,p.createElement(qi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_AUDIENCES}),p.createElement(nt,{object:r.playlist}),!!c&&p.createElement(dr,{objectLevels:r.playlistLevels,objectAudiences:r.playlistAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:qt.Playlists,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,qt.Playlists,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,qt.Playlists,n,n)}}))}function Zi(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 Qi(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 Xi=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT_PLAYLISTS,args:[e]}},$i=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS,args:[e.currentPresentation.id,t]}}};function ea(e){var t=e.playlistId,n=Zi(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([rr.getSubjectTreeFetchOptions(r("subjectTree")),rr.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([_i.getPlaylistFetchOptions(e,r("playlist")),rr.getObjectSubjectsFetchOptions(e,qt.Playlists,r("playlistSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&rr.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(Qi(t.subjectClassifications||[]),Qi(e))},a=t.playlistSubjects&&t.playlistSubjects.map((function(e){return rr.getSubjectClassificationFetchOptions(e.id,d.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.playlistSubjects],!!a),Object(f.useFetch)(rr.getObjectClassificationsFetchOptions(e,qt.Playlists,r("playlistClassifications")),[e,t.playlistSubjects])}(t,r,a),ir(r,a);var c=!!(r.playlistSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.playlistClassifications&&r.subjectClassifications);return p.createElement(d.AppLinkContext.Provider,{value:{getSubjectAppLink:Xi,getClassificationAppLink:$i(r)}},p.createElement(qi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_SUBJECTS}),p.createElement(nt,{object:r.playlist}),c&&p.createElement(xr,{objectSubjects:r.playlistSubjects,subjectTree:r.subjectTree,memberType:qt.Playlists,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.playlistClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,qt.Playlists,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,qt.Playlists,n,n)}}))}function ta(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 na=function(e){return function(t){return[{name:"Remove video",appLink:{application:s.PLAYLISTS,action:i.Playlists.REMOVE_VIDEO,args:[e.toString(),t.id.toString()]},className:"text-danger"}]}},ra=function(e){return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:[e.id]}};function ia(e){var t=e.playlistId,n=ta(p.useState(),2),r=n[0],a=n[1],o=ta(p.useState(),2),c=o[0],s=o[1],l=Object(f.useService)(u.PLAYLIST);!function(e,t,n){Object(f.useBulkFetch)([_i.getPlaylistFetchOptions(e,t),_i.getPlaylistVideosFetchOptions(e,n)],[e])}(t,a,s);return p.createElement(p.Fragment,null,p.createElement(qi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_VIDEOS}),p.createElement(nt,{object:r}),!!c&&p.createElement(Dt,{onSortEnd:function(e,n){if(c.data&&c.data[e]){Vi(c.data,e,n,(function(e,n){l.reorderVideos(t,n),s((function(t){return{data:e,pagination:t.pagination}}))}))}},videos:c,getVideoAppLink:ra,getVideoActions:na(t),emptyMessage:"There are no videos in this playlist."}))}function aa(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 oa(){var e=aa(p.useState(),2),t=e[0],n=e[1],r=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(ee.getCurrentUserFetchOptions(n),[]);return p.createElement(p.Fragment,null,!!t&&p.createElement(Mi,{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 ca(e){return(ca="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 sa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function la(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 ua(e,t){return!t||"object"!==ca(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 pa(e){return(pa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fa(e,t){return(fa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var da,ma=function(e){return"/api/master/v2/objects/".concat(e)},ba=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},ya=function(e,t,n){var r="/api/master/v2/objects/".concat(e,"/").concat(t);return n&&(r+="?".concat(n)),r};!function(e){e.Audiences="subjectpresentationaudiences"}(da||(da={}));var Sa=function(e){function t(){return sa(this,t),ua(this,pa(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&&fa(e,t)}(t,e),n=t,(r=[{key:"getVideo",value:function(e,t,n){return this.get({resource:ma(e),eventPrefix:"".concat(a.VIDEO,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getVideosById",value:function(e,t,n){return this.get({resource:ba(e),eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getVideoAudiences",value:function(e,t,n){return this.get({resource:ya(e,da.Audiences),callback:t,errorCallback:n,eventPrefix:"".concat(a.VIDEO,":").concat(e,":").concat(da.Audiences),expiryTime:d.CacheDurations.STANDARD})}},{key:"name",get:function(){return u.VIDEO}},{key:"channelName",get:function(){return l.VIDEO}}])&&la(n.prototype,r),i&&la(n,i),t}(f.BaseDataService),va={dataServiceName:u.VIDEO,dataChannelName:l.VIDEO},Ea={getVideoFetchOptions:function(e,t,n){return Object.assign(Object.assign({},va),{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({},va),{eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),fetchData:function(t){return t.getVideosById(e)},setData:t,onError:n})},getVideoAudiencesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},va),{eventPrefix:"".concat(a.VIDEO,":").concat(e,":").concat(da.Audiences),fetchData:function(t){return t.getVideoAudiences(e)},setData:t,onError:n})}};function ha(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 ga(e){var t=e.videoId,n=e.playlistId,r=e.closePopup,i=ha(p.useState(),2),a=i[0],o=i[1],c=ha(p.useState(),2),s=c[0],l=c[1],d=ha(p.useState(!1),2),m=d[0],b=d[1],y=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(Ea.getVideoFetchOptions(t,o),[t]),Object(f.useFetch)(_i.getPlaylistFetchOptions(n,l),[n]);var S=p.useCallback((function(){b(!0),y.removeVideoFromPlaylist(n,t,r,r)}),[t,n]),v=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:S,buttonText:"Yes, remove video",isSpinnerButton:!0,showSpinner:m}],E=s&&a;return p.createElement(it,{title:"Remove Video",closePopup:r,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,a.name)," from ",p.createElement("strong",null,s.name),"?")),p.createElement(ct,{buttons:v})))}function ja(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 Ta=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 Oa(e){var t=e.id,n=e.routeToOnDelete,r=e.closePopup,i=ja(p.useState(),2),a=i[0],o=i[1],c=ja(p.useState(!1),2),s=c[0],l=c[1],d=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(rr.getAudienceFetchOptions(t,o),[t]);return p.createElement(it,{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(ct,{buttons:Ta((function(){l(!0);d.deleteAudience(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)}),r,s)})))}function Ia(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 Ca=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function Aa(e){var t=e.presentationId,n=e.audienceId,r=Ia(p.useState(),2),i=r[0],a=r[1],o=Ia(p.useState(),2),c=o[0],s=o[1],l=Ia(p.useState(),2),d=l[0],m=l[1],b=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(rr.getAudienceFetchOptions(n,a),[n]),Object(f.useFetch)(rr.getLevelsFetchOptions(s),[]),Object(f.useFetch)(rr.getPresentationFetchOptions(t,m),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(_e,{appLink:Ca(t),backToName:"audiences"})),!!d&&p.createElement("h6",null,"Presentation: ".concat(d.name)),!!i&&!!c&&p.createElement(pr,{audience:i,levels:c,saveAudience:function(e,r){return b.updateAudience(n,Object.assign(Object.assign({},e),{presentationId:t}),r,r)},presentationId:t}))}function La(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 Pa=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e,t.masterId]}}},Na=function(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_AUDIENCE,args:[e]}},ka={application:s.SUBJECTS,action:i.Subjects.AUDIENCES};function wa(e){var t=e.presentationId,n=La(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(rr.getAudiencesFetchOptions(t,i),[]),p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(_e,{appLink:ka,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(d.AppLink,{appLink:Na(t),className:"d-block"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Audience"))),p.createElement(Nr,{objects:r,getAppLink:Pa(e.presentationId),emptyMessage:"There are no audiences in this presentation yet. Click '+ New Audience' to create one."}))}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")}()}var Fa=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function _a(e){var t=e.presentationId,n=Da(p.useState(),2),r=n[0],a=n[1],o=Da(p.useState(),2),c=o[0],l=o[1],d=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(rr.getLevelsFetchOptions(a),[]),Object(f.useFetch)(rr.getPresentationFetchOptions(t,l),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2"},p.createElement(_e,{appLink:Fa(t),backToName:"audiences"})),!!c&&p.createElement("h6",null,"Presentation: ".concat(c.name)),!!r&&p.createElement(pr,{levels:r,presentationId:t,saveAudience:function(e,n){return d.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 xa(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]}}function Ra(e){return[{name:"Add child",getAppLink:function(t){return Object.assign(Object.assign({},xa(e)),{args:[e],params:{parentId:t.id}})}},{name:"Delete classification",getAppLink:function(t){return{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e,t.id]}},className:"text-danger"}]}var Ua=n(14),Ba=n.n(Ua);function Va(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 Ja(e){var t=e.presentationId,n=e.selectedClassificationId,r=Va(p.useState(),2),a=r[0],o=r[1],c=Va(p.useState(),2),l=c[0],u=c[1];return function(e,t,n){var r=rr.getClassificationTreeFetchOptions(e,t),i=rr.getPresentationFetchOptions(e,n);Object(f.useBulkFetch)([r,i],[e])}(t,o,u),p.createElement("div",{className:"".concat(Ba.a.navContainer," h-auto pr-2 border-right")},!!l&&p.createElement("h6",{className:"border-bottom pb-2"},"Classifications (".concat(l.name,")")),p.createElement(d.AppLink,{appLink:xa(t),className:"d-inline-block pb-2"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Classification")),!!a&&p.createElement("div",{className:"border-top pt-1"},p.createElement(bt,{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:Ra(t)})))}function Ha(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 Ma(e){var t=e.classificationId,n=e.routeToOnDelete,r=e.closePopup,i=Ha(p.useState(),2),a=i[0],o=i[1],c=Ha(p.useState(!1),2),s=c[0],l=c[1];Object(f.useFetch)(rr.getClassificationFetchOptions(t,o),[]);var d=Object(f.useService)(u.SUBJECT),m=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){l(!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(it,{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(ct,{buttons:m})))}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 qa(e){var t=e.presentationId,n=e.classificationId,r=Ya(p.useState(),2),i=r[0],a=r[1],o=Ya(p.useState(),2),c=o[0],s=o[1],l=Ya(p.useState(),2),d=l[0],m=l[1],b=Ya(p.useState(),2),y=b[0],S=b[1],v=Object(f.useService)(u.SUBJECT),E=rr.getClassificationFetchOptions(n,a),h=rr.getPresentationFetchOptions(t,s),g=rr.getClassificationTreeFetchOptions(t,m),j=rr.getSubjectTreeFetchOptions(S);Object(f.useFetch)(j,[]),Object(f.useFetch)(E,[n]),Object(f.useBulkFetch)([h,g],[t]);return p.createElement("div",null,p.createElement(Tr,{presentation:c,classificationId:n}),!!i&&!!d&&!!y&&p.createElement(gr,{classification:i,presentationId:t,subjectTree:y,classificationTree:d,saveClassification:function(e,t){return v.updateClassification(n,e,t,t)}}))}function za(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 Ka(e){var t=e.presentationId,n=e.classificationId,r=e.memberType,i=za(p.useState(),2),a=i[0],o=i[1],c=za(p.useState(),2),s=c[0],l=c[1];Object(f.useFetch)(rr.getPresentationFetchOptions(t,o),[]),Object(f.useFetch)(rr.getClassificationMembersFetchOptions(n,r,l),[n,r]);var u={items:s&&s.data,memberType:r,getItemAppLink:function(e){return rn.getMemberAppLink(r,e.id)},getActions:function(e){return rn.getMemberActions(n,Yt.Classification,r,e.id)}},d={presentation:a,classificationId:n},m=ae(u);return p.createElement(p.Fragment,null,p.createElement(Tr,Object.assign({},d,{memberType:r})),m&&p.createElement(Sr,Object.assign({},u)))}function Wa(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 Ga(e){var t=e.presentationId,n=e.parentId,r=Wa(p.useState(),2),a=r[0],o=r[1],c=Wa(p.useState(),2),l=c[0],d=c[1],m=Object(f.useService)(u.SUBJECT),b=rr.getClassificationTreeFetchOptions(t,o),y=rr.getSubjectTreeFetchOptions(d);Object(f.useFetch)(y,[]),Object(f.useFetch)(b,[t]);return p.createElement("div",null,p.createElement("h4",{className:"py-2"},"Create New Classification"),!!l&&!!a&&p.createElement(gr,{classification:n?{parentIds:[n]}:{},presentationId:t,subjectTree:l,classificationTree:a,saveClassification:function(e,n){return m.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 Za(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 Qa=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(rn.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function Xa(e){var t=e.classificationId,n=e.memberId,r=e.memberType,i=e.closePopup,a=Za(p.useState(),2),o=a[0],c=a[1],s=Za(p.useState(),2),l=s[0],d=s[1],m=Za(p.useState(!1),2),b=m[0],y=m[1],S=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(function(e,t,n){switch(e){case qt.Playlists:return _i.getPlaylistFetchOptions(t,n);case qt.Series:return Te.getSeriesFetchOptions(t,n);case qt.Videos:return Ea.getVideoFetchOptions(t,n)}}(r,n,d),[n]),Object(f.useFetch)(rr.getClassificationFetchOptions(t,c),[t]);var v=!!o&&!!l,E="Remove ".concat(ce(rn.singularizeMemberType(r)));return p.createElement(it,{title:E,closePopup:i,showLoadingSpinner:!v},v&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,l.name)," from ",p.createElement("strong",null,o.name),"?"),p.createElement("p",null,"This will not remove it from the backbone subject.")),p.createElement(ct,{buttons:Qa(i,(function(){y(!0),S.removeObjectsFromClassification(t,[n],r,null,null,i,i)}),r,b)})))}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.id,n=$a(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(rr.getLevelFetchOptions(t,i),[t]);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Level"),!!r&&p.createElement(Ar,{level:r,saveLevel:function(e,n){return a.updateLevel(t,e,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")}()}var no=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},ro={application:s.SUBJECTS,action:i.Subjects.NEW_LEVEL};function io(){var e=to(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(rr.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(d.AppLink,{appLink:ro,className:"d-block"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Level"))),p.createElement(Nr,{objects:t,getAppLink:no}))}function ao(){var e=Object(f.useService)(u.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Level"),p.createElement(Ar,{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 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 co(e){var t=e.id,n=oo(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(rr.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=ae(o);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Presentation"),!!c&&p.createElement(wr,Object.assign({},o)))}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")}()}var lo=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_PRESENTATION,args:[e.id]}},uo={application:s.SUBJECTS,action:i.Subjects.NEW_PRESENTATION};function po(){var e=so(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(rr.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(d.AppLink,{appLink:uo,className:"d-block"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Presentation"))),p.createElement(Nr,{objects:t,getAppLink:lo}))}function fo(){var e=Object(f.useService)(u.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Presentation"),p.createElement(wr,{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 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 bo(e){var t=e.objectType,n=e.getAppLink,r=mo(p.useState(),2),i=r[0],a=r[1];return Object(f.useFetch)(rr.getPresentationsFetchOptions(a),[]),p.createElement("div",null,p.createElement("h5",null,"Select a presentation to view its ".concat(t,":")),p.createElement(Nr,{objects:i,getAppLink:n}))}function yo(e,t){return d.StateHelper.getSetStateByKey(e,t)}function So(e,t){var n=e.memberType,r=e.objectIds,i=rr.getSubjectTreeFetchOptions(yo(t,"subjectTree"));Object(f.useFetch)(i,[]);var a=function(e,t,n){switch(e){case qt.Playlists:return _i.getPlaylistsByIdFetchOptions(t,n);case qt.Series:return Te.getSeriesByIdFetchOptions(t,n);case qt.Videos:return Ea.getVideosByIdFetchOptions(t,n)}}(n,r,yo(t,"objects"));Object(f.useFetch)(a,[n,r])}function vo(e,t,n,r){var a=n.selectedSubject,o=n.objects,c=function(){return yo(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 qt.Playlists:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_PLAYLISTS});case qt.Series:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_SERIES});case qt.Videos:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_VIDEOS})}}(a.id,t.memberType))}),c)}function Eo(e,t,n){if(t&&n){var r=1===t.length?"this ".concat(rn.singularizeMemberType(e)):"these ".concat(e);return"Add ".concat(r," to ").concat(n.name)}}function ho(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 go=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}},jo=function(e,t){return function(n,r,i){i(),yo(t,"selectedSubject")(le.find(e.subjectTree,f.ArrayHelper.first(n))),yo(t,"addToClassifications")(r),yo(t,"showConfirmationPopup")(!0)}};function To(e){var t=ho(p.useState({}),2),n=t[0],r=t[1],i=Object(f.useService)(u.SUBJECT);So(e,r);var a;return p.createElement(d.AppLinkContext.Provider,{value:{getSubjectAppLink:go}},!!n.objects&&!!n.subjectTree&&p.createElement(Fr,{memberType:e.memberType,objects:n.objects,subjectTree:n.subjectTree,onClickAddToSubject:jo(n,r)}),n.showConfirmationPopup&&p.createElement(Ve,{title:Eo(e.memberType,n.objects,n.selectedSubject),onClickConfirm:function(){return vo(i,e,n,r)},closePopup:function(){return e=!1,yo(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,ce(rn.singularizeMemberType(a)))," to classification mappings can be managed from the "),p.createElement("strong",null,"Edit Subject ".concat(ce(e.memberType)," ")),"page.")))}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 Io(e){var t=e.subjectId,n=e.routeToOnDelete,r=e.closePopup,i=Oo(p.useState(),2),a=i[0],o=i[1],c=Oo(p.useState(!1),2),s=c[0],l=c[1];Object(f.useFetch)(rr.getSubjectFetchOptions(t,o),[]);var d=Object(f.useService)(u.SUBJECT),m=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){l(!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(it,{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(ct,{buttons:m})))}function Co(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 Ao(e){var t=e.subjectId,n=Co(p.useState(),2),r=n[0],a=n[1],o=Co(p.useState(),2),c=o[0],s=o[1],l=Object(f.useService)(u.SUBJECT),d=rr.getSubjectFetchOptions(t,a),m=rr.getSubjectTreeFetchOptions(s);Object(f.useFetch)(m,[]),Object(f.useFetch)(d,[t]);return p.createElement(p.Fragment,null,p.createElement(Jr,{subjectId:t,activeAction:i.Subjects.EDIT_SUBJECT}),!!r&&!!c&&p.createElement(Br,{subject:r,subjectTree:c,saveSubject:function(e,n){return l.updateSubject(t,e,n,n)}}))}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 Po=p.createContext(void 0);function No(e){var t=e.children,n=Lo(p.useState(),2),r=n[0],i=n[1];return p.createElement(Po.Provider,{value:[r,i]},t)}var ko=function(e){var t=e.children;return p.createElement(Ne,null,p.createElement(No,null,p.createElement(Ae,null,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 Do(e,t){return d.StateHelper.getSetStateByKey(e,t)}function Fo(e,t,n){var r=e.subjectId,i=e.memberType,a=t.memberIds,o=wo(p.useContext(Po),1)[0];Object(f.useFetch)(rr.getPresentationsFetchOptions(Do(n,"presentations")),[]),Object(f.useFetch)(rr.getSubjectMemberIdsFetchOptions(r,i,Do(n,"memberIds")),[r,i]),Object(f.useFetch)(function(e,t,n){if(!t||!t.length)return;switch(e){case qt.Playlists:return _i.getPlaylistsByIdFetchOptions(t,n);case qt.Series:return Te.getSeriesByIdFetchOptions(t,n);case qt.Videos:return Ea.getVideosByIdFetchOptions(t,n)}}(i,a,Do(n,"members")),[i,a],!!a&&!!a.length),Object(f.useFetch)(!!o&&rr.getSubjectClassificationFetchOptions(r,Do(n,"classifications"),o.id,i),[r,i,o],!!o)}var _o=function(e,t){return function(n){var r,a=s.SUBJECTS,o=[t,n];switch(e){case qt.Playlists:r=i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;break;case qt.Series:r=i.Subjects.EDIT_CLASSIFICATION_SERIES;break;case qt.Videos:r=i.Subjects.EDIT_CLASSIFICATION_VIDEOS}return{application:a,action:r,args:o}}};function xo(e){switch(e){case qt.Playlists:return i.Subjects.EDIT_SUBJECT_PLAYLISTS;case qt.Series:return i.Subjects.EDIT_SUBJECT_SERIES;case qt.Videos:return i.Subjects.EDIT_SUBJECT_VIDEOS}}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 Uo(e){var t=e.subjectId,n=e.memberType,r=Ro(p.useState({}),2),i=r[0],a=r[1],o=i.presentations,c=i.classifications,s=i.memberIds,l=i.membersWithClassifications,d=Ro(p.useContext(Po),2),m=d[0],b=d[1],y=Object(f.useService)(u.SUBJECT);Fo(e,i,a),function(e,t,n){var r=t.memberIds,i=t.members,a=t.classifications;p.useEffect((function(){Do(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&&Do(n,"members")([])}),[r])}(e,i,a);var S={presentations:o,currentPresentation:m,setCurrentPresentation:b},v={members:l||[],memberType:n,getMemberAppLink:function(e){return rn.getMemberAppLink(n,e)},getActions:function(e){return rn.getMemberActions(t,Yt.Subject,n,e)},classifications:c,getClassificationAppLink:m&&_o(n,m.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,m&&m.id,e,r)}},E=!!m&&!!c;return p.createElement(p.Fragment,null,p.createElement(Jr,{subjectId:t,activeAction:xo(n)}),p.createElement(ke.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(Dr,Object.assign({},S))),E&&p.createElement(Xr,Object.assign({},v)))}function Bo(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 Vo(e){var t=e.parentId,n=Bo(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT),c=rr.getSubjectTreeFetchOptions(a);Object(f.useFetch)(c,[]);var l={application:s.SUBJECTS,action:i.Subjects.PRESENTATIONS};return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2 border-bottom"},p.createElement(_e,{backToName:"Presentations",appLink:l})),p.createElement("h4",{className:"py-2"},"Create New Subject"),!!r&&p.createElement(Br,{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 Jo(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 Ho=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(rn.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function Mo(e){var t=e.subjectId,n=e.memberId,r=e.memberType,i=e.closePopup,a=Jo(p.useState(),2),o=a[0],c=a[1],s=Jo(p.useState(),2),l=s[0],d=s[1],m=Jo(p.useState(!1),2),b=m[0],y=m[1],S=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(function(e,t,n){switch(e){case qt.Playlists:return _i.getPlaylistFetchOptions(t,n);case qt.Series:return Te.getSeriesFetchOptions(t,n);case qt.Videos:return Ea.getVideoFetchOptions(t,n)}}(r,n,d),[n]),Object(f.useFetch)(rr.getSubjectFetchOptions(t,c),[t]);var v=!!o&&!!l,E="Remove ".concat(ce(rn.singularizeMemberType(r)));return p.createElement(it,{title:E,closePopup:i,showLoadingSpinner:!v},v&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,l.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(ct,{buttons:Ho(i,(function(){y(!0),S.removeObjectsFromSubject(t,[n],r,i,i)}),r,b)})))}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.subjectId,n=Yo(p.useState({}),2),r=n[0];return function(e,t){var n=function(e){return d.StateHelper.getSetStateByKey(t,e)};Object(f.useFetch)(rr.getSubjectClassificationFetchOptions(e,n("classifications")),[e]),Object(f.useFetch)(rr.getPresentationsFetchOptions(n("presentations")),[])}(t,n[1]),p.createElement(p.Fragment,null,p.createElement(Jr,{subjectId:t,activeAction:i.Subjects.SUBJECT_CLASSIFICATIONS}),p.createElement(qr,{presentations:r.presentations,classificationDictionary:f.ArrayHelper.groupBy(r.classifications,"presentationId")}))}var zo=n(15),Ko=n.n(zo);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.selectedSubjectId,n=Wo(p.useState(),2),r=n[0],a=n[1];Object(f.useFetch)(rr.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},l=[{name:"Add child",getAppLink:function(e){return Object.assign(Object.assign({},c),{params:{parentId:e.id}})}},{name:"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(Ko.a.navContainer," h-auto pr-2 border-right")},p.createElement("h5",{className:"border-bottom pb-2"},"Subjects"),p.createElement(d.AppLink,{appLink:c,className:"d-inline-block pb-2"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Subject")),!!r&&p.createElement("div",{className:"border-top pt-1"},p.createElement(bt,{tree:r,getAppLink:o,selectedIds:[t],actions:l})))}function Zo(e){var t=e.currentAppLink;return p.createElement($r,{navItems:an(),currentAppLink:t})}function Qo(e){return(Qo="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 Xo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $o(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 ec(e,t,n){return t&&$o(e.prototype,t),n&&$o(e,n),e}function tc(e,t){return!t||"object"!==Qo(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){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&&ic(e,t)}function ic(e,t){return(ic=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ac=function(e){function t(){return Xo(this,t),tc(this,nc(t).apply(this,arguments))}return rc(t,e),ec(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),oc=function(e){function t(){return Xo(this,t),tc(this,nc(t).apply(this,arguments))}return rc(t,e),ec(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(u).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"index",value:function(){this.navigate("/dashboards/playlists")}},{key:"newPlaylist",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(oa,null))}},{key:"editPlaylist",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ki,{key:e,playlistId:e}))}},{key:"editPlaylistVideos",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ia,{key:e,playlistId:e}))}},{key:"editPlaylistSubjects",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ea,{key:e,playlistId:e}))}},{key:"editPlaylistAudiences",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Gi,{key:e,playlistId:e}))}},{key:"deletePlaylist",value:function(e){var t=Object.assign({playlistId:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(Ui,Object.assign({},t)))}},{key:"removeVideo",value:function(e,t){var n=Object.assign({playlistId:e,videoId:t},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(ga,Object.assign({},n)))}},{key:"removeFromSubject",value:function(e,t){var n=Object.assign({subjectId:t,memberId:e,memberType:qt.Playlists},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(Mo,Object.assign({},n)))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(_t,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 Oe.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.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:xi}}}}],[{key:"router",get:function(){return ac}}]),t}(f.Core.Application);function cc(e){return(cc="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 sc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lc(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 uc(e,t,n){return t&&lc(e.prototype,t),n&&lc(e,n),e}function pc(e,t){return!t||"object"!==cc(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 fc(e){return(fc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function dc(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&&mc(e,t)}function mc(e,t){return(mc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var bc=function(e){function t(){return sc(this,t),pc(this,fc(t).apply(this,arguments))}return dc(t,e),uc(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),yc=function(e){function t(){return sc(this,t),pc(this,fc(t).apply(this,arguments))}return dc(t,e),uc(t,[{key:"initialize",value:function(){var e=this;this.subjectDataService=f.InstanceManager.getInstance(u.SUBJECT,this),f.ObjectHelper.values(u).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(d.LayoutRegions.CONTENT,p.createElement(Vo,Object.assign({key:e.parentId},t))),this.renderSubjectsLeftNav()}},{key:"editSubject",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ao,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"editSubjectPlaylists",value:function(e){var t={subjectId:e,memberType:qt.Playlists};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Uo,Object.assign({key:"".concat(e,":playlists")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectSeries",value:function(e){var t={subjectId:e,memberType:qt.Series};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Uo,Object.assign({key:"".concat(e,":series")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectVideos",value:function(e){var t={subjectId:e,memberType:qt.Videos};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Uo,Object.assign({key:"".concat(e,":videos")},t))),this.renderSubjectsLeftNav(e)}},{key:"subjectClassifications",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(qo,{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(d.LayoutRegions.CONTENT,p.createElement(To,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(d.LayoutRegions.POPUP,p.createElement(Mo,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(d.LayoutRegions.POPUP,p.createElement(Io,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(d.LayoutRegions.CONTENT,p.createElement(bo,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(d.LayoutRegions.CONTENT,p.createElement(Ga,Object.assign({key:t.parentId},n))),this.renderClassificationLeftNav(e)}},{key:"editClassification",value:function(e,t){var n={presentationId:e,classificationId:t};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(qa,Object.assign({key:t},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationPlaylists",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:qt.Playlists};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ka,Object.assign({key:"".concat(t,":playlists")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationSeries",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:qt.Series};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ka,Object.assign({key:"".concat(t,":series")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationVideos",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:qt.Videos};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ka,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(d.LayoutRegions.POPUP,p.createElement(Xa,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(d.LayoutRegions.POPUP,p.createElement(Ma,Object.assign({},r)))}},{key:"levels",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(io,null)),this.hideLeftNav()}},{key:"newLevel",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ao,null)),this.hideLeftNav()}},{key:"editLevel",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(eo,{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(d.LayoutRegions.CONTENT,p.createElement(bo,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationAudiences",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(wa,{presentationId:e})),this.hideLeftNav()}},{key:"newAudience",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(_a,{presentationId:e})),this.hideLeftNav()}},{key:"editAudience",value:function(e,t){var n={presentationId:e,audienceId:t};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Aa,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(d.LayoutRegions.POPUP,p.createElement(Oa,Object.assign({},r)))}},{key:"presentations",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(po,null)),this.hideLeftNav()}},{key:"newPresentation",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(fo,null))}},{key:"editPresentation",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(co,{key:e,id:e})),this.hideLeftNav()}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(_t,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 Oe.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.AlertList,{alerts:n,removeAlert:r}))}},{key:"renderClassificationLeftNav",value:function(e,t){this.setCurrentLeftNavItem(t);var n={presentationId:e,selectedClassificationId:t};this.layout.showChildView(d.LayoutRegions.LEFT_NAV,p.createElement(Ja,Object.assign({},n)))}},{key:"renderSubjectsLeftNav",value:function(e){this.setCurrentLeftNavItem(e),this.layout.showChildView(d.LayoutRegions.LEFT_NAV,p.createElement(Go,{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(Zo,{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:ko,getTopNavView:this.getTopNav}}}}],[{key:"router",get:function(){return bc}}]),t}(f.Core.Application),Sc=function(e){var t=e.children;return p.createElement(Ne,null,p.createElement(Ae,null,t))},vc=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]}}]},Ec=function(e){return function(t){return t.appLink.action===e}};function hc(e){var t=e.videoId,n=e.activeAction;return p.createElement("div",{className:"py-2"},p.createElement(st,{tabs:vc(t),isItemActive:Ec(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 jc(e){var t=e.videoId,n=gc(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Ea.getVideoFetchOptions(e,r("video")),rr.getObjectLevelsFetchOptions(e,qt.Videos,r("videoLevels"))],[e]),Object(f.useFetch)(Ea.getVideoAudiencesFetchOptions(e,r("videoAudiences")),[e,t.videoLevels]),Object(f.useBulkFetch)([rr.getPresentationsFetchOptions(r("presentations")),rr.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&rr.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),ir(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.videoLevels&&r.videoAudiences);return p.createElement(p.Fragment,null,p.createElement(hc,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_AUDIENCES}),p.createElement(nt,{object:r.video}),!!c&&p.createElement(dr,{objectLevels:r.videoLevels,objectAudiences:r.videoAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:qt.Videos,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,qt.Videos,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,qt.Videos,n,n)}}))}function Tc(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){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 Ic=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT_VIDEOS,args:[e]}},Cc=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION_VIDEOS,args:[e.currentPresentation.id,t]}}};function Ac(e){var t=e.videoId,n=Tc(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([rr.getSubjectTreeFetchOptions(r("subjectTree")),rr.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([Ea.getVideoFetchOptions(e,r("video")),rr.getObjectSubjectsFetchOptions(e,qt.Videos,r("videoSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&rr.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(Oc(t.subjectClassifications||[]),Oc(e))},a=t.videoSubjects&&t.videoSubjects.map((function(e){return rr.getSubjectClassificationFetchOptions(e.id,d.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.videoSubjects],!!a),Object(f.useFetch)(rr.getObjectClassificationsFetchOptions(e,qt.Videos,r("videoClassifications")),[e,t.videoSubjects])}(t,r,a),ir(r,a);var c=!!(r.videoSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.videoClassifications&&r.subjectClassifications);return p.createElement(d.AppLinkContext.Provider,{value:{getSubjectAppLink:Ic,getClassificationAppLink:Cc(r)}},p.createElement(hc,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_SUBJECTS}),p.createElement(nt,{object:r.video}),c&&p.createElement(xr,{objectSubjects:r.videoSubjects,subjectTree:r.subjectTree,memberType:qt.Videos,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.videoClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,qt.Videos,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,qt.Videos,n,n)}}))}function Lc(e){return(Lc="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 Pc(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 kc(e,t,n){return t&&Nc(e.prototype,t),n&&Nc(e,n),e}function wc(e,t){return!t||"object"!==Lc(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 Dc(e){return(Dc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fc(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&&_c(e,t)}function _c(e,t){return(_c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var xc=function(e){function t(){return Pc(this,t),wc(this,Dc(t).apply(this,arguments))}return Fc(t,e),kc(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),Rc=function(e){function t(){return Pc(this,t),wc(this,Dc(t).apply(this,arguments))}return Fc(t,e),kc(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(u).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(d.LayoutRegions.CONTENT,p.createElement(jc,{videoId:e}))}},{key:"editVideoSubjects",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ac,{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 Oe.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.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:Sc}}}}],[{key:"router",get:function(){return xc}}]),t}(f.Core.Application);function Uc(){return p.createElement(p.Fragment,null,"Domain Options")}function Bc(){return p.createElement(p.Fragment,null,"New Domain Options")}function Vc(e){var t=e.optionId;return p.createElement(p.Fragment,null,t)}function Jc(e){return(Jc="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 Hc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mc(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 Yc(e,t,n){return t&&Mc(e.prototype,t),n&&Mc(e,n),e}function qc(e,t){return!t||"object"!==Jc(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 zc(e){return(zc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Kc(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&&Wc(e,t)}function Wc(e,t){return(Wc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Gc=function(e){function t(){return Hc(this,t),qc(this,zc(t).apply(this,arguments))}return Kc(t,e),Yc(t,[{key:"channelName",get:function(){return s.DOMAIN_OPTIONS}},{key:"appRoutes",get:function(){return{"developer/options(/)":"domainOptions","developer/options/new(/)":"newDomainOptions","developer/options/:id(/)":"editDomainOptions"}}}]),t}(f.Core.AppRouter),Zc=function(e){function t(){return Hc(this,t),qc(this,zc(t).apply(this,arguments))}return Kc(t,e),Yc(t,[{key:"domainOptions",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Uc,null))}},{key:"newDomainOptions",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Bc,null))}},{key:"editDomainOptions",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Vc,{optionId: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 Oe.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.AlertList,{alerts:n,removeAlert:r}))}},{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 Gc}}]),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 l})),n.d(t,"DataServices",(function(){return u})),n.d(t,"CuratorLayoutView",(function(){return O})),n.d(t,"LayoutComponent",(function(){return P})),n.d(t,"CuratorAppNavService",(function(){return R})),n.d(t,"ImageUploadDataService",(function(){return Y})),n.d(t,"UserDataService",(function(){return X})),n.d(t,"UserDataServiceHelper",(function(){return ee})),n.d(t,"SeriesDataService",(function(){return ge})),n.d(t,"SeriesDataServiceHelper",(function(){return Te})),n.d(t,"SeriesApplication",(function(){return Si})),n.d(t,"PlaylistDataService",(function(){return Di})),n.d(t,"PlaylistDataServiceHelper",(function(){return _i})),n.d(t,"PlaylistsApplication",(function(){return oc})),n.d(t,"SubjectDataService",(function(){return tr})),n.d(t,"SubjectDataServiceHelper",(function(){return rr})),n.d(t,"SubjectsApplication",(function(){return yc})),n.d(t,"VideoDataService",(function(){return Sa})),n.d(t,"VideoDataServiceHelper",(function(){return Ea})),n.d(t,"VideosApplication",(function(){return Rc})),n.d(t,"DomainOptionsApplication",(function(){return Zc}))}])}));
|
package/package.json
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@clickview/curator",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
4
|
-
"description": "curator",
|
|
5
|
-
"main": "dist/curator-app.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"start": "set NODE_ENV=development&& webpack -w --config ./tooling/webpack.config.js",
|
|
9
|
-
"build": "set NODE_ENV=production&& webpack --config ./tooling/webpack.config.js",
|
|
10
|
-
"dev-build": "set NODE_ENV=development&& webpack --config ./tooling/webpack.config.js"
|
|
11
|
-
},
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "http://gitlab.cvinternal.net/front-end/curator.git"
|
|
15
|
-
},
|
|
16
|
-
"cv": {
|
|
17
|
-
"publishable": true,
|
|
18
|
-
"rebuildable": true
|
|
19
|
-
},
|
|
20
|
-
"author": "Matt Trengrove",
|
|
21
|
-
"license": "ISC",
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@clickview/tooling": "0.0.10-rc.0",
|
|
24
|
-
"@types/cropperjs": "1.3.0",
|
|
25
|
-
"@types/react-transition-group": "4.2.3",
|
|
26
|
-
"@types/yup": "0.26.24"
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"@clickview/common": "1.0.0-rc.0",
|
|
30
|
-
"@clickview/shared": "1.0.0-rc.
|
|
31
|
-
"@clickview/styles": "1.0.0-rc.0",
|
|
32
|
-
"cropperjs": "1.5.6",
|
|
33
|
-
"yup": "0.27.0"
|
|
34
|
-
},
|
|
35
|
-
"babel": {
|
|
36
|
-
"presets": [
|
|
37
|
-
[
|
|
38
|
-
"@babel/preset-env",
|
|
39
|
-
{
|
|
40
|
-
"corejs": 2,
|
|
41
|
-
"useBuiltIns": "entry"
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@clickview/curator",
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
|
+
"description": "curator",
|
|
5
|
+
"main": "dist/curator-app.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "set NODE_ENV=development&& webpack -w --config ./tooling/webpack.config.js",
|
|
9
|
+
"build": "set NODE_ENV=production&& webpack --config ./tooling/webpack.config.js",
|
|
10
|
+
"dev-build": "set NODE_ENV=development&& webpack --config ./tooling/webpack.config.js"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "http://gitlab.cvinternal.net/front-end/curator.git"
|
|
15
|
+
},
|
|
16
|
+
"cv": {
|
|
17
|
+
"publishable": true,
|
|
18
|
+
"rebuildable": true
|
|
19
|
+
},
|
|
20
|
+
"author": "Matt Trengrove",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@clickview/tooling": "0.0.10-rc.0",
|
|
24
|
+
"@types/cropperjs": "1.3.0",
|
|
25
|
+
"@types/react-transition-group": "4.2.3",
|
|
26
|
+
"@types/yup": "0.26.24"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@clickview/common": "1.0.0-rc.0",
|
|
30
|
+
"@clickview/shared": "1.0.0-rc.1",
|
|
31
|
+
"@clickview/styles": "1.0.0-rc.0",
|
|
32
|
+
"cropperjs": "1.5.6",
|
|
33
|
+
"yup": "0.27.0"
|
|
34
|
+
},
|
|
35
|
+
"babel": {
|
|
36
|
+
"presets": [
|
|
37
|
+
[
|
|
38
|
+
"@babel/preset-env",
|
|
39
|
+
{
|
|
40
|
+
"corejs": 2,
|
|
41
|
+
"useBuiltIns": "entry"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|