@clickview/curator 1.0.15-rc.0 → 1.0.15-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.
Files changed (24) hide show
  1. package/dist/curator-app.js +1 -1
  2. package/dist/libs/shared/src/flight-requests/UserRequests.d.ts +5 -0
  3. package/dist/libs/shared/src/interfaces/models/Group.d.ts +3 -0
  4. package/dist/libs/shared/src/interfaces/models/User.d.ts +2 -1
  5. package/dist/libs/shared/src/interfaces/models/index.d.ts +1 -0
  6. package/dist/projects/curator/src/apps/playlists/components/edit-playlist-nav/EditPlaylistNav.d.ts +3 -1
  7. package/dist/projects/curator/src/apps/playlists/utils/PlaylistNavHelper.d.ts +2 -1
  8. package/dist/projects/curator/src/apps/series/components/edit-series-nav/EditSeriesNav.d.ts +3 -1
  9. package/dist/projects/curator/src/apps/series/utils/SeriesNavHelper.d.ts +2 -1
  10. package/dist/projects/curator/src/apps/videos/components/edit-video-details/EditVideoDetails.d.ts +2 -1
  11. package/dist/projects/curator/src/apps/videos/components/edit-video-details/VideoDetailsForm.d.ts +2 -1
  12. package/dist/projects/curator/src/apps/videos/components/edit-video-nav/EditVideoNav.d.ts +3 -1
  13. package/dist/projects/curator/src/apps/videos/utils/VideoNavHelper.d.ts +2 -1
  14. package/dist/projects/curator/src/apps/videos/views/edit-video-aliases/EditVideoAliasesView.d.ts +1 -1
  15. package/dist/projects/curator/src/index.d.ts +1 -2
  16. package/dist/projects/curator/src/shared/constants/RadioChannels.d.ts +0 -1
  17. package/dist/projects/curator/src/shared/constants/Services.d.ts +0 -1
  18. package/dist/projects/curator/src/shared/context/index.d.ts +0 -1
  19. package/dist/projects/curator/src/shared/interfaces/models/index.d.ts +0 -2
  20. package/dist/projects/curator/src/shared/services/index.d.ts +0 -1
  21. package/dist/projects/curator/src/shared/utils/PermissionsHelper.d.ts +2 -1
  22. package/dist/projects/curator/src/shared/utils/UserHelper.d.ts +1 -1
  23. package/dist/projects/curator/src/shared/utils/index.d.ts +0 -1
  24. package/package.json +3 -3
@@ -14,4 +14,4 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var r="function"==typeof Symbol&&Symbol.for,i=r?Symbol.for("react.element"):60103,a=r?Symbol.for("react.portal"):60106,o=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,c=r?Symbol.for("react.profiler"):60114,l=r?Symbol.for("react.provider"):60109,u=r?Symbol.for("react.context"):60110,p=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,m=r?Symbol.for("react.suspense"):60113,h=r?Symbol.for("react.suspense_list"):60120,g=r?Symbol.for("react.memo"):60115,y=r?Symbol.for("react.lazy"):60116,v=r?Symbol.for("react.block"):60121,b=r?Symbol.for("react.fundamental"):60117,S=r?Symbol.for("react.responder"):60118,E=r?Symbol.for("react.scope"):60119;function C(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case i:switch(e=e.type){case p:case f:case o:case c:case s:case m:return e;default:switch(e=e&&e.$$typeof){case u:case d:case y:case g:case l:return e;default:return t}}case a:return t}}}function O(e){return C(e)===f}t.AsyncMode=p,t.ConcurrentMode=f,t.ContextConsumer=u,t.ContextProvider=l,t.Element=i,t.ForwardRef=d,t.Fragment=o,t.Lazy=y,t.Memo=g,t.Portal=a,t.Profiler=c,t.StrictMode=s,t.Suspense=m,t.isAsyncMode=function(e){return O(e)||C(e)===p},t.isConcurrentMode=O,t.isContextConsumer=function(e){return C(e)===u},t.isContextProvider=function(e){return C(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i},t.isForwardRef=function(e){return C(e)===d},t.isFragment=function(e){return C(e)===o},t.isLazy=function(e){return C(e)===y},t.isMemo=function(e){return C(e)===g},t.isPortal=function(e){return C(e)===a},t.isProfiler=function(e){return C(e)===c},t.isStrictMode=function(e){return C(e)===s},t.isSuspense=function(e){return C(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===f||e===c||e===s||e===m||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===g||e.$$typeof===l||e.$$typeof===u||e.$$typeof===d||e.$$typeof===b||e.$$typeof===S||e.$$typeof===E||e.$$typeof===v)},t.typeOf=C},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),o=p(a),s=p(n(16)),c=p(n(170)),l=p(n(171)),u=n(179);function p(e){return e&&e.__esModule?e:{default:e}}var f=function(){return!0},d=function(e){function t(e){var n=e.alwaysRenderSuggestions;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return m.call(r),r.state={isFocused:!1,isCollapsed:!n,highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null},r.justPressedUpDown=!1,r.justMouseEntered=!1,r.pressedSuggestion=null,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.onDocumentMouseDown),document.addEventListener("mouseup",this.onDocumentMouseUp),this.input=this.autowhatever.input,this.suggestionsContainer=this.autowhatever.itemsContainer}},{key:"componentWillReceiveProps",value:function(e){(0,c.default)(e.suggestions,this.props.suggestions)?e.highlightFirstSuggestion&&e.suggestions.length>0&&!1===this.justPressedUpDown&&!1===this.justMouseEntered&&this.highlightFirstSuggestion():this.willRenderSuggestions(e)?this.state.isCollapsed&&!this.justSelectedSuggestion&&this.revealSuggestions():this.resetHighlightedSuggestion()}},{key:"componentDidUpdate",value:function(e,t){var n=this.props,r=n.suggestions,i=n.onSuggestionHighlighted,a=n.highlightFirstSuggestion;if(!(0,c.default)(r,e.suggestions)&&r.length>0&&a)this.highlightFirstSuggestion();else if(i){var o=this.getHighlightedSuggestion();o!=t.highlightedSuggestion&&i({suggestion:o})}}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.onDocumentMouseDown),document.removeEventListener("mouseup",this.onDocumentMouseUp)}},{key:"updateHighlightedSuggestion",value:function(e,t,n){var r=this;this.setState((function(i){var a=i.valueBeforeUpDown;return null===t?a=null:null===a&&void 0!==n&&(a=n),{highlightedSectionIndex:e,highlightedSuggestionIndex:t,highlightedSuggestion:null===t?null:r.getSuggestion(e,t),valueBeforeUpDown:a}}))}},{key:"resetHighlightedSuggestion",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setState((function(t){var n=t.valueBeforeUpDown;return{highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:e?null:n}}))}},{key:"revealSuggestions",value:function(){this.setState({isCollapsed:!1})}},{key:"closeSuggestions",value:function(){this.setState({highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null,isCollapsed:!0})}},{key:"getSuggestion",value:function(e,t){var n=this.props,r=n.suggestions,i=n.multiSection,a=n.getSectionSuggestions;return i?a(r[e])[t]:r[t]}},{key:"getHighlightedSuggestion",value:function(){var e=this.state,t=e.highlightedSectionIndex,n=e.highlightedSuggestionIndex;return null===n?null:this.getSuggestion(t,n)}},{key:"getSuggestionValueByIndex",value:function(e,t){return(0,this.props.getSuggestionValue)(this.getSuggestion(e,t))}},{key:"getSuggestionIndices",value:function(e){var t=e.getAttribute("data-section-index"),n=e.getAttribute("data-suggestion-index");return{sectionIndex:"string"==typeof t?parseInt(t,10):null,suggestionIndex:parseInt(n,10)}}},{key:"findSuggestionElement",value:function(e){var t=e;do{if(null!==t.getAttribute("data-suggestion-index"))return t;t=t.parentNode}while(null!==t);throw console.error("Clicked element:",e),new Error("Couldn't find suggestion element")}},{key:"maybeCallOnChange",value:function(e,t,n){var r=this.props.inputProps,i=r.value,a=r.onChange;t!==i&&a(e,{newValue:t,method:n})}},{key:"willRenderSuggestions",value:function(e){var t=e.suggestions,n=e.inputProps,r=e.shouldRenderSuggestions,i=n.value;return t.length>0&&r(i)}},{key:"getQuery",value:function(){var e=this.props.inputProps.value,t=this.state.valueBeforeUpDown;return(null===t?e:t).trim()}},{key:"render",value:function(){var e=this,t=this.props,n=t.suggestions,i=t.renderInputComponent,a=t.onSuggestionsFetchRequested,s=t.renderSuggestion,c=t.inputProps,p=t.multiSection,d=t.renderSectionTitle,m=t.id,h=t.getSectionSuggestions,g=t.theme,y=t.getSuggestionValue,v=t.alwaysRenderSuggestions,b=t.highlightFirstSuggestion,S=this.state,E=S.isFocused,C=S.isCollapsed,O=S.highlightedSectionIndex,I=S.highlightedSuggestionIndex,j=S.valueBeforeUpDown,A=v?f:this.props.shouldRenderSuggestions,T=c.value,w=c.onFocus,L=c.onKeyDown,k=this.willRenderSuggestions(this.props),_=v||E&&!C&&k,x=_?n:[],P=r({},c,{onFocus:function(t){if(!e.justSelectedSuggestion&&!e.justClickedOnSuggestionsContainer){var n=A(T);e.setState({isFocused:!0,isCollapsed:!n}),w&&w(t),n&&a({value:T,reason:"input-focused"})}},onBlur:function(t){e.justClickedOnSuggestionsContainer?e.input.focus():(e.blurEvent=t,e.justSelectedSuggestion||(e.onBlur(),e.onSuggestionsClearRequested()))},onChange:function(t){var n=t.target.value,i=A(n);e.maybeCallOnChange(t,n,"type"),e.suggestionsContainer&&(e.suggestionsContainer.scrollTop=0),e.setState(r({},b?{}:{highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null},{valueBeforeUpDown:null,isCollapsed:!i})),i?a({value:n,reason:"input-changed"}):e.onSuggestionsClearRequested()},onKeyDown:function(t,r){var i=t.keyCode;switch(i){case 40:case 38:if(C)A(T)&&(a({value:T,reason:"suggestions-revealed"}),e.revealSuggestions());else if(n.length>0){var o=r.newHighlightedSectionIndex,s=r.newHighlightedItemIndex,c=void 0;c=null===s?null===j?T:j:e.getSuggestionValueByIndex(o,s),e.updateHighlightedSuggestion(o,s,T),e.maybeCallOnChange(t,c,40===i?"down":"up")}t.preventDefault(),e.justPressedUpDown=!0,setTimeout((function(){e.justPressedUpDown=!1}));break;case 13:if(229===t.keyCode)break;var l=e.getHighlightedSuggestion();if(_&&!v&&e.closeSuggestions(),null!=l){var u=y(l);e.maybeCallOnChange(t,u,"enter"),e.onSuggestionSelected(t,{suggestion:l,suggestionValue:u,suggestionIndex:I,sectionIndex:O,method:"enter"}),e.justSelectedSuggestion=!0,setTimeout((function(){e.justSelectedSuggestion=!1}))}break;case 27:_&&t.preventDefault();var p=_&&!v;if(null===j){if(!p){e.maybeCallOnChange(t,"","escape"),A("")?a({value:"",reason:"escape-pressed"}):e.onSuggestionsClearRequested()}}else e.maybeCallOnChange(t,j,"escape");p?(e.onSuggestionsClearRequested(),e.closeSuggestions()):e.resetHighlightedSuggestion()}L&&L(t)}}),N={query:this.getQuery()};return o.default.createElement(l.default,{multiSection:p,items:x,renderInputComponent:i,renderItemsContainer:this.renderSuggestionsContainer,renderItem:s,renderItemData:N,renderSectionTitle:d,getSectionItems:h,highlightedSectionIndex:O,highlightedItemIndex:I,inputProps:P,itemProps:this.itemProps,theme:(0,u.mapToAutowhateverTheme)(g),id:m,ref:this.storeAutowhateverRef})}}]),t}(a.Component);d.propTypes={suggestions:s.default.array.isRequired,onSuggestionsFetchRequested:function(e,t){var n=e[t];if("function"!=typeof n)throw new Error("'onSuggestionsFetchRequested' must be implemented. See: https://github.com/moroshko/react-autosuggest#onSuggestionsFetchRequestedProp")},onSuggestionsClearRequested:function(e,t){var n=e[t];if(!1===e.alwaysRenderSuggestions&&"function"!=typeof n)throw new Error("'onSuggestionsClearRequested' must be implemented. See: https://github.com/moroshko/react-autosuggest#onSuggestionsClearRequestedProp")},onSuggestionSelected:s.default.func,onSuggestionHighlighted:s.default.func,renderInputComponent:s.default.func,renderSuggestionsContainer:s.default.func,getSuggestionValue:s.default.func.isRequired,renderSuggestion:s.default.func.isRequired,inputProps:function(e,t){var n=e[t];if(!n.hasOwnProperty("value"))throw new Error("'inputProps' must have 'value'.");if(!n.hasOwnProperty("onChange"))throw new Error("'inputProps' must have 'onChange'.")},shouldRenderSuggestions:s.default.func,alwaysRenderSuggestions:s.default.bool,multiSection:s.default.bool,renderSectionTitle:function(e,t){var n=e[t];if(!0===e.multiSection&&"function"!=typeof n)throw new Error("'renderSectionTitle' must be implemented. See: https://github.com/moroshko/react-autosuggest#renderSectionTitleProp")},getSectionSuggestions:function(e,t){var n=e[t];if(!0===e.multiSection&&"function"!=typeof n)throw new Error("'getSectionSuggestions' must be implemented. See: https://github.com/moroshko/react-autosuggest#getSectionSuggestionsProp")},focusInputOnSuggestionClick:s.default.bool,highlightFirstSuggestion:s.default.bool,theme:s.default.object,id:s.default.string},d.defaultProps={renderSuggestionsContainer:function(e){var t=e.containerProps,n=e.children;return o.default.createElement("div",t,n)},shouldRenderSuggestions:function(e){return e.trim().length>0},alwaysRenderSuggestions:!1,multiSection:!1,focusInputOnSuggestionClick:!0,highlightFirstSuggestion:!1,theme:u.defaultTheme,id:"1"};var m=function(){var e=this;this.onDocumentMouseDown=function(t){e.justClickedOnSuggestionsContainer=!1;for(var n=t.detail&&t.detail.target||t.target;null!==n&&n!==document;){if(null!==n.getAttribute("data-suggestion-index"))return;if(n===e.suggestionsContainer)return void(e.justClickedOnSuggestionsContainer=!0);n=n.parentNode}},this.storeAutowhateverRef=function(t){null!==t&&(e.autowhatever=t)},this.onSuggestionMouseEnter=function(t,n){var r=n.sectionIndex,i=n.itemIndex;e.updateHighlightedSuggestion(r,i),t.target===e.pressedSuggestion&&(e.justSelectedSuggestion=!0),e.justMouseEntered=!0,setTimeout((function(){e.justMouseEntered=!1}))},this.highlightFirstSuggestion=function(){e.updateHighlightedSuggestion(e.props.multiSection?0:null,0)},this.onDocumentMouseUp=function(){e.pressedSuggestion&&!e.justSelectedSuggestion&&e.input.focus(),e.pressedSuggestion=null},this.onSuggestionMouseDown=function(t){e.justSelectedSuggestion||(e.justSelectedSuggestion=!0,e.pressedSuggestion=t.target)},this.onSuggestionsClearRequested=function(){var t=e.props.onSuggestionsClearRequested;t&&t()},this.onSuggestionSelected=function(t,n){var r=e.props,i=r.alwaysRenderSuggestions,a=r.onSuggestionSelected,o=r.onSuggestionsFetchRequested;a&&a(t,n),i?o({value:n.suggestionValue,reason:"suggestion-selected"}):e.onSuggestionsClearRequested(),e.resetHighlightedSuggestion()},this.onSuggestionClick=function(t){var n=e.props,r=n.alwaysRenderSuggestions,i=n.focusInputOnSuggestionClick,a=e.getSuggestionIndices(e.findSuggestionElement(t.target)),o=a.sectionIndex,s=a.suggestionIndex,c=e.getSuggestion(o,s),l=e.props.getSuggestionValue(c);e.maybeCallOnChange(t,l,"click"),e.onSuggestionSelected(t,{suggestion:c,suggestionValue:l,suggestionIndex:s,sectionIndex:o,method:"click"}),r||e.closeSuggestions(),!0===i?e.input.focus():e.onBlur(),setTimeout((function(){e.justSelectedSuggestion=!1}))},this.onBlur=function(){var t=e.props,n=t.inputProps,r=t.shouldRenderSuggestions,i=n.value,a=n.onBlur,o=e.getHighlightedSuggestion(),s=r(i);e.setState({isFocused:!1,highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null,isCollapsed:!s}),a&&a(e.blurEvent,{highlightedSuggestion:o})},this.onSuggestionMouseLeave=function(t){e.resetHighlightedSuggestion(!1),e.justSelectedSuggestion&&t.target===e.pressedSuggestion&&(e.justSelectedSuggestion=!1)},this.onSuggestionTouchStart=function(){e.justSelectedSuggestion=!0},this.onSuggestionTouchMove=function(){e.justSelectedSuggestion=!1,e.pressedSuggestion=null,e.input.focus()},this.itemProps=function(t){return{"data-section-index":t.sectionIndex,"data-suggestion-index":t.itemIndex,onMouseEnter:e.onSuggestionMouseEnter,onMouseLeave:e.onSuggestionMouseLeave,onMouseDown:e.onSuggestionMouseDown,onTouchStart:e.onSuggestionTouchStart,onTouchMove:e.onSuggestionTouchMove,onClick:e.onSuggestionClick}},this.renderSuggestionsContainer=function(t){var n=t.containerProps,r=t.children;return(0,e.props.renderSuggestionsContainer)({containerProps:n,children:r,query:e.getQuery()})}};t.default=d},function(e,t,n){"use strict";var r=n(169);function i(){}function a(){}a.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,a,o){if(o!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";e.exports=function(e,t){if(e===t)return!0;if(!e||!t)return!1;var n=e.length;if(t.length!==n)return!1;for(var r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}},function(e,t,n){"use strict";e.exports=n(172).default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(0),s=d(o),c=d(n(16)),l=d(n(173)),u=d(n(174)),p=d(n(176)),f=d(n(177));function d(e){return e&&e.__esModule?e:{default:e}}var m={},h=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.storeInputReference=function(e){null!==e&&(n.input=e)},n.storeItemsContainerReference=function(e){null!==e&&(n.itemsContainer=e)},n.onHighlightedItemChange=function(e){n.highlightedItem=e},n.getItemId=function(e,t){return null===t?null:"react-autowhatever-"+n.props.id+"-"+(null===e?"":"section-"+e)+"-item-"+t},n.onFocus=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!0}),t.onFocus&&t.onFocus(e)},n.onBlur=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!1}),t.onBlur&&t.onBlur(e)},n.onKeyDown=function(e){var t=n.props,r=t.inputProps,a=t.highlightedSectionIndex,o=t.highlightedItemIndex;switch(e.key){case"ArrowDown":case"ArrowUp":var s="ArrowDown"===e.key?"next":"prev",c=n.sectionIterator[s]([a,o]),l=i(c,2),u=l[0],p=l[1];r.onKeyDown(e,{newHighlightedSectionIndex:u,newHighlightedItemIndex:p});break;default:r.onKeyDown(e,{highlightedSectionIndex:a,highlightedItemIndex:o})}},n.highlightedItem=null,n.state={isInputFocused:!1},n.setSectionsItems(e),n.setSectionIterator(e),n.setTheme(e),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"componentDidMount",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){e.items!==this.props.items&&this.setSectionsItems(e),e.items===this.props.items&&e.multiSection===this.props.multiSection||this.setSectionIterator(e),e.theme!==this.props.theme&&this.setTheme(e)}},{key:"componentDidUpdate",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"setSectionsItems",value:function(e){e.multiSection&&(this.sectionsItems=e.items.map((function(t){return e.getSectionItems(t)})),this.sectionsLengths=this.sectionsItems.map((function(e){return e.length})),this.allSectionsAreEmpty=this.sectionsLengths.every((function(e){return 0===e})))}},{key:"setSectionIterator",value:function(e){this.sectionIterator=(0,l.default)({multiSection:e.multiSection,data:e.multiSection?this.sectionsLengths:e.items.length})}},{key:"setTheme",value:function(e){this.theme=(0,u.default)(e.theme)}},{key:"renderSections",value:function(){var e=this;if(this.allSectionsAreEmpty)return null;var t=this.theme,n=this.props,r=n.id,i=n.items,a=n.renderItem,o=n.renderItemData,c=n.renderSectionTitle,l=n.highlightedSectionIndex,u=n.highlightedItemIndex,d=n.itemProps;return i.map((function(n,i){var m="react-autowhatever-"+r+"-",h=m+"section-"+i+"-",g=0===i;return s.default.createElement("div",t(h+"container","sectionContainer",g&&"sectionContainerFirst"),s.default.createElement(p.default,{section:n,renderSectionTitle:c,theme:t,sectionKeyPrefix:h}),s.default.createElement(f.default,{items:e.sectionsItems[i],itemProps:d,renderItem:a,renderItemData:o,sectionIndex:i,highlightedItemIndex:l===i?u:null,onHighlightedItemChange:e.onHighlightedItemChange,getItemId:e.getItemId,theme:t,keyPrefix:m,ref:e.storeItemsListReference}))}))}},{key:"renderItems",value:function(){var e=this.props.items;if(0===e.length)return null;var t=this.theme,n=this.props,r=n.id,i=n.renderItem,a=n.renderItemData,o=n.highlightedSectionIndex,c=n.highlightedItemIndex,l=n.itemProps;return s.default.createElement(f.default,{items:e,itemProps:l,renderItem:i,renderItemData:a,highlightedItemIndex:null===o?c:null,onHighlightedItemChange:this.onHighlightedItemChange,getItemId:this.getItemId,theme:t,keyPrefix:"react-autowhatever-"+r+"-"})}},{key:"ensureHighlightedItemIsVisible",value:function(){var e=this.highlightedItem;if(e){var t=this.itemsContainer,n=e.offsetParent===t?e.offsetTop:e.offsetTop-t.offsetTop,r=t.scrollTop;n<r?r=n:n+e.offsetHeight>r+t.offsetHeight&&(r=n+e.offsetHeight-t.offsetHeight),r!==t.scrollTop&&(t.scrollTop=r)}}},{key:"render",value:function(){var e=this.theme,t=this.props,n=t.id,i=t.multiSection,a=t.renderInputComponent,o=t.renderItemsContainer,c=t.highlightedSectionIndex,l=t.highlightedItemIndex,u=this.state.isInputFocused,p=i?this.renderSections():this.renderItems(),f=null!==p,d=this.getItemId(c,l),m="react-autowhatever-"+n,h=r({role:"combobox","aria-haspopup":"listbox","aria-owns":m,"aria-expanded":f},e("react-autowhatever-"+n+"-container","container",f&&"containerOpen"),this.props.containerProps),g=a(r({type:"text",value:"",autoComplete:"off","aria-autocomplete":"list","aria-controls":m,"aria-activedescendant":d},e("react-autowhatever-"+n+"-input","input",f&&"inputOpen",u&&"inputFocused"),this.props.inputProps,{onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.props.inputProps.onKeyDown&&this.onKeyDown,ref:this.storeInputReference})),y=o({containerProps:r({id:m,role:"listbox"},e("react-autowhatever-"+n+"-items-container","itemsContainer",f&&"itemsContainerOpen"),{ref:this.storeItemsContainerReference}),children:p});return s.default.createElement("div",h,g,y)}}]),t}(o.Component);h.propTypes={id:c.default.string,multiSection:c.default.bool,renderInputComponent:c.default.func,renderItemsContainer:c.default.func,items:c.default.array.isRequired,renderItem:c.default.func,renderItemData:c.default.object,renderSectionTitle:c.default.func,getSectionItems:c.default.func,containerProps:c.default.object,inputProps:c.default.object,itemProps:c.default.oneOfType([c.default.object,c.default.func]),highlightedSectionIndex:c.default.number,highlightedItemIndex:c.default.number,theme:c.default.oneOfType([c.default.object,c.default.array])},h.defaultProps={id:"1",multiSection:!1,renderInputComponent:function(e){return s.default.createElement("input",e)},renderItemsContainer:function(e){var t=e.containerProps,n=e.children;return s.default.createElement("div",t,n)},renderItem:function(){throw new Error("`renderItem` must be provided")},renderItemData:m,renderSectionTitle:function(){throw new Error("`renderSectionTitle` must be provided")},getSectionItems:function(){throw new Error("`getSectionItems` must be provided")},containerProps:m,inputProps:m,itemProps:m,highlightedSectionIndex:null,highlightedItemIndex:null,theme:{container:"react-autowhatever__container",containerOpen:"react-autowhatever__container--open",input:"react-autowhatever__input",inputOpen:"react-autowhatever__input--open",inputFocused:"react-autowhatever__input--focused",itemsContainer:"react-autowhatever__items-container",itemsContainerOpen:"react-autowhatever__items-container--open",itemsList:"react-autowhatever__items-list",item:"react-autowhatever__item",itemFirst:"react-autowhatever__item--first",itemHighlighted:"react-autowhatever__item--highlighted",sectionContainer:"react-autowhatever__section-container",sectionContainerFirst:"react-autowhatever__section-container--first",sectionTitle:"react-autowhatever__section-title"}},t.default=h},function(e,t,n){"use strict";var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};e.exports=function(e){var t=e.data,n=e.multiSection;function i(e){var i=r(e,2),a=i[0],o=i[1];return n?null===o||o===t[a]-1?null===(a=function(e){for(null===e?e=0:e++;e<t.length&&0===t[e];)e++;return e===t.length?null:e}(a))?[null,null]:[a,0]:[a,o+1]:0===t||o===t-1?[null,null]:null===o?[null,0]:[null,o+1]}return{next:i,prev:function(e){var i=r(e,2),a=i[0],o=i[1];return n?null===o||0===o?null===(a=function(e){for(null===e?e=t.length-1:e--;e>=0&&0===t[e];)e--;return-1===e?null:e}(a))?[null,null]:[a,t[a]-1]:[a,o-1]:0===t||0===o?[null,null]:null===o?[null,t-1]:[null,o-1]},isLast:function(e){return null===i(e)[1]}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var a,o=n(175),s=(a=o)&&a.__esModule?a:{default:a},c=function(e){return e};t.default=function(e){var t=Array.isArray(e)&&2===e.length?e:[e,null],n=r(t,2),a=n[0],o=n[1];return function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var l=n.map((function(e){return a[e]})).filter(c);return"string"==typeof l[0]||"function"==typeof o?{key:e,className:o?o.apply(void 0,i(l)):l.join(" ")}:{key:e,style:s.default.apply(void 0,[{}].concat(i(l)))}}},e.exports=t.default},function(e,t,n){"use strict";var r=Object.prototype.propertyIsEnumerable;function i(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function a(e){var t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e))),t.filter((function(t){return r.call(e,t)}))}e.exports=Object.assign||function(e,t){for(var n,r,o=i(e),s=1;s<arguments.length;s++){n=arguments[s],r=a(Object(n));for(var c=0;c<r.length;c++)o[r[c]]=n[r[c]]}return o}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=c(i),o=c(n(16)),s=c(n(27));function c(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var p=function(e){function t(){return l(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"shouldComponentUpdate",value:function(e){return(0,s.default)(e,this.props)}},{key:"render",value:function(){var e=this.props,t=e.section,n=e.renderSectionTitle,r=e.theme,i=e.sectionKeyPrefix,o=n(t);return o?a.default.createElement("div",r(i+"title","sectionTitle"),o):null}}]),t}(i.Component);p.propTypes={section:o.default.any.isRequired,renderSectionTitle:o.default.func.isRequired,theme:o.default.func.isRequired,sectionKeyPrefix:o.default.string.isRequired},t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),o=u(a),s=u(n(16)),c=u(n(178)),l=u(n(27));function u(e){return e&&e.__esModule?e:{default:e}}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var d=function(e){function t(){var e,n,r;p(this,t);for(var i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=r=f(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.storeHighlightedItemReference=function(e){r.props.onHighlightedItemChange(null===e?null:e.item)},f(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"shouldComponentUpdate",value:function(e){return(0,l.default)(e,this.props,["itemProps"])}},{key:"render",value:function(){var e=this,t=this.props,n=t.items,i=t.itemProps,a=t.renderItem,s=t.renderItemData,l=t.sectionIndex,u=t.highlightedItemIndex,p=t.getItemId,f=t.theme,d=t.keyPrefix,m=null===l?d:d+"section-"+l+"-",h="function"==typeof i;return o.default.createElement("ul",r({role:"listbox"},f(m+"items-list","itemsList")),n.map((function(t,n){var d=0===n,g=n===u,y=m+"item-"+n,v=h?i({sectionIndex:l,itemIndex:n}):i,b=r({id:p(l,n),"aria-selected":g},f(y,"item",d&&"itemFirst",g&&"itemHighlighted"),v);return g&&(b.ref=e.storeHighlightedItemReference),o.default.createElement(c.default,r({},b,{sectionIndex:l,isHighlighted:g,itemIndex:n,item:t,renderItem:a,renderItemData:s}))})))}}]),t}(a.Component);d.propTypes={items:s.default.array.isRequired,itemProps:s.default.oneOfType([s.default.object,s.default.func]),renderItem:s.default.func.isRequired,renderItemData:s.default.object.isRequired,sectionIndex:s.default.number,highlightedItemIndex:s.default.number,onHighlightedItemChange:s.default.func.isRequired,getItemId:s.default.func.isRequired,theme:s.default.func.isRequired,keyPrefix:s.default.string.isRequired},d.defaultProps={sectionIndex:null},t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),o=l(a),s=l(n(16)),c=l(n(27));function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var f=function(e){function t(){var e,n,r;u(this,t);for(var i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=r=p(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.storeItemReference=function(e){null!==e&&(r.item=e)},r.onMouseEnter=function(e){var t=r.props,n=t.sectionIndex,i=t.itemIndex;r.props.onMouseEnter(e,{sectionIndex:n,itemIndex:i})},r.onMouseLeave=function(e){var t=r.props,n=t.sectionIndex,i=t.itemIndex;r.props.onMouseLeave(e,{sectionIndex:n,itemIndex:i})},r.onMouseDown=function(e){var t=r.props,n=t.sectionIndex,i=t.itemIndex;r.props.onMouseDown(e,{sectionIndex:n,itemIndex:i})},r.onClick=function(e){var t=r.props,n=t.sectionIndex,i=t.itemIndex;r.props.onClick(e,{sectionIndex:n,itemIndex:i})},p(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"shouldComponentUpdate",value:function(e){return(0,c.default)(e,this.props,["renderItemData"])}},{key:"render",value:function(){var e=this.props,t=e.isHighlighted,n=e.item,i=e.renderItem,a=e.renderItemData,s=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["isHighlighted","item","renderItem","renderItemData"]);return delete s.sectionIndex,delete s.itemIndex,"function"==typeof s.onMouseEnter&&(s.onMouseEnter=this.onMouseEnter),"function"==typeof s.onMouseLeave&&(s.onMouseLeave=this.onMouseLeave),"function"==typeof s.onMouseDown&&(s.onMouseDown=this.onMouseDown),"function"==typeof s.onClick&&(s.onClick=this.onClick),o.default.createElement("li",r({role:"option"},s,{ref:this.storeItemReference}),i(n,r({isHighlighted:t},a)))}}]),t}(a.Component);f.propTypes={sectionIndex:s.default.number,isHighlighted:s.default.bool.isRequired,itemIndex:s.default.number.isRequired,item:s.default.any.isRequired,renderItem:s.default.func.isRequired,renderItemData:s.default.object.isRequired,onMouseEnter:s.default.func,onMouseLeave:s.default.func,onMouseDown:s.default.func,onClick:s.default.func},t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.defaultTheme={container:"react-autosuggest__container",containerOpen:"react-autosuggest__container--open",input:"react-autosuggest__input",inputOpen:"react-autosuggest__input--open",inputFocused:"react-autosuggest__input--focused",suggestionsContainer:"react-autosuggest__suggestions-container",suggestionsContainerOpen:"react-autosuggest__suggestions-container--open",suggestionsList:"react-autosuggest__suggestions-list",suggestion:"react-autosuggest__suggestion",suggestionFirst:"react-autosuggest__suggestion--first",suggestionHighlighted:"react-autosuggest__suggestion--highlighted",sectionContainer:"react-autosuggest__section-container",sectionContainerFirst:"react-autosuggest__section-container--first",sectionTitle:"react-autosuggest__section-title"},t.mapToAutowhateverTheme=function(e){var t={};for(var n in e)switch(n){case"suggestionsContainer":t.itemsContainer=e[n];break;case"suggestionsContainerOpen":t.itemsContainerOpen=e[n];break;case"suggestion":t.item=e[n];break;case"suggestionFirst":t.itemFirst=e[n];break;case"suggestionHighlighted":t.itemHighlighted=e[n];break;case"suggestionsList":t.itemsList=e[n];break;default:t[n]=e[n]}return t}},function(e,t,n){const{defaults:r}=n(17),{block:i}=n(117),{rtrim:a,splitCells:o,escape:s}=n(13);e.exports=class e{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||r,this.rules=i.normal,this.options.pedantic?this.rules=i.pedantic:this.options.gfm&&(this.rules=i.gfm)}static get rules(){return i}static lex(t,n){return new e(n).lex(t)}lex(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.token(e,!0)}token(e,t){let n,r,c,l,u,p,f,d,m,h,g,y,v,b,S,E;for(e=e.replace(/^ +$/gm,"");e;)if((c=this.rules.newline.exec(e))&&(e=e.substring(c[0].length),c[0].length>1&&this.tokens.push({type:"space"})),c=this.rules.code.exec(e)){const t=this.tokens[this.tokens.length-1];e=e.substring(c[0].length),t&&"paragraph"===t.type?t.text+="\n"+c[0].trimRight():(c=c[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",codeBlockStyle:"indented",text:this.options.pedantic?c:a(c,"\n")}))}else if(c=this.rules.fences.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"code",lang:c[2]?c[2].trim():c[2],text:c[3]||""});else if(c=this.rules.heading.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"heading",depth:c[1].length,text:c[2]});else if((c=this.rules.nptable.exec(e))&&(p={type:"table",header:o(c[1].replace(/^ *| *\| *$/g,"")),align:c[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:c[3]?c[3].replace(/\n$/,"").split("\n"):[]},p.header.length===p.align.length)){for(e=e.substring(c[0].length),g=0;g<p.align.length;g++)/^ *-+: *$/.test(p.align[g])?p.align[g]="right":/^ *:-+: *$/.test(p.align[g])?p.align[g]="center":/^ *:-+ *$/.test(p.align[g])?p.align[g]="left":p.align[g]=null;for(g=0;g<p.cells.length;g++)p.cells[g]=o(p.cells[g],p.header.length);this.tokens.push(p)}else if(c=this.rules.hr.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"hr"});else if(c=this.rules.blockquote.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"blockquote_start"}),c=c[0].replace(/^ *> ?/gm,""),this.token(c,t),this.tokens.push({type:"blockquote_end"});else if(c=this.rules.list.exec(e)){for(e=e.substring(c[0].length),l=c[2],b=l.length>1,f={type:"list_start",ordered:b,start:b?+l:"",loose:!1},this.tokens.push(f),c=c[0].match(this.rules.item),d=[],n=!1,v=c.length,g=0;g<v;g++)p=c[g],h=p.length,p=p.replace(/^ *([*+-]|\d+\.) */,""),~p.indexOf("\n ")&&(h-=p.length,p=this.options.pedantic?p.replace(/^ {1,4}/gm,""):p.replace(new RegExp("^ {1,"+h+"}","gm"),"")),g!==v-1&&(u=i.bullet.exec(c[g+1])[0],(l.length>1?1===u.length:u.length>1||this.options.smartLists&&u!==l)&&(e=c.slice(g+1).join("\n")+e,g=v-1)),r=n||/\n\n(?!\s*$)/.test(p),g!==v-1&&(n="\n"===p.charAt(p.length-1),r||(r=n)),r&&(f.loose=!0),S=/^\[[ xX]\] /.test(p),E=void 0,S&&(E=" "!==p[1],p=p.replace(/^\[[ xX]\] +/,"")),m={type:"list_item_start",task:S,checked:E,loose:r},d.push(m),this.tokens.push(m),this.token(p,!1),this.tokens.push({type:"list_item_end"});if(f.loose)for(v=d.length,g=0;g<v;g++)d[g].loose=!0;this.tokens.push({type:"list_end"})}else if(c=this.rules.html.exec(e))e=e.substring(c[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===c[1]||"script"===c[1]||"style"===c[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(c[0]):s(c[0]):c[0]});else if(t&&(c=this.rules.def.exec(e)))e=e.substring(c[0].length),c[3]&&(c[3]=c[3].substring(1,c[3].length-1)),y=c[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[y]||(this.tokens.links[y]={href:c[2],title:c[3]});else if((c=this.rules.table.exec(e))&&(p={type:"table",header:o(c[1].replace(/^ *| *\| *$/g,"")),align:c[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:c[3]?c[3].replace(/\n$/,"").split("\n"):[]},p.header.length===p.align.length)){for(e=e.substring(c[0].length),g=0;g<p.align.length;g++)/^ *-+: *$/.test(p.align[g])?p.align[g]="right":/^ *:-+: *$/.test(p.align[g])?p.align[g]="center":/^ *:-+ *$/.test(p.align[g])?p.align[g]="left":p.align[g]=null;for(g=0;g<p.cells.length;g++)p.cells[g]=o(p.cells[g].replace(/^ *\| *| *\| *$/g,""),p.header.length);this.tokens.push(p)}else if(c=this.rules.lheading.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"heading",depth:"="===c[2].charAt(0)?1:2,text:c[1]});else if(t&&(c=this.rules.paragraph.exec(e)))e=e.substring(c[0].length),this.tokens.push({type:"paragraph",text:"\n"===c[1].charAt(c[1].length-1)?c[1].slice(0,-1):c[1]});else if(c=this.rules.text.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"text",text:c[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens}}},function(e,t,n){const r=n(28),i=n(118),a=n(119),o=n(120),{defaults:s}=n(17),{merge:c,unescape:l}=n(13);e.exports=class e{constructor(e){this.tokens=[],this.token=null,this.options=e||s,this.options.renderer=this.options.renderer||new r,this.renderer=this.options.renderer,this.renderer.options=this.options,this.slugger=new i}static parse(t,n){return new e(n).parse(t)}parse(e){this.inline=new a(e.links,this.options),this.inlineText=new a(e.links,c({},this.options,{renderer:new o})),this.tokens=e.reverse();let t="";for(;this.next();)t+=this.tok();return t}next(){return this.token=this.tokens.pop(),this.token}peek(){return this.tokens[this.tokens.length-1]||0}parseText(){let e=this.token.text;for(;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)}tok(){let e="";switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,l(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":{let t,n,r,i,a="";for(r="",t=0;t<this.token.header.length;t++)r+=this.renderer.tablecell(this.inline.output(this.token.header[t]),{header:!0,align:this.token.align[t]});for(a+=this.renderer.tablerow(r),t=0;t<this.token.cells.length;t++){for(n=this.token.cells[t],r="",i=0;i<n.length;i++)r+=this.renderer.tablecell(this.inline.output(n[i]),{header:!1,align:this.token.align[i]});e+=this.renderer.tablerow(r)}return this.renderer.table(a,e)}case"blockquote_start":for(e="";"blockquote_end"!==this.next().type;)e+=this.tok();return this.renderer.blockquote(e);case"list_start":{e="";const t=this.token.ordered,n=this.token.start;for(;"list_end"!==this.next().type;)e+=this.tok();return this.renderer.list(e,t,n)}case"list_item_start":{e="";const t=this.token.loose,n=this.token.checked,r=this.token.task;if(this.token.task)if(t)if("text"===this.peek().type){const e=this.peek();e.text=this.renderer.checkbox(n)+" "+e.text}else this.tokens.push({type:"text",text:this.renderer.checkbox(n)});else e+=this.renderer.checkbox(n);for(;"list_item_end"!==this.next().type;)e+=t||"text"!==this.token.type?this.tok():this.parseText();return this.renderer.listitem(e,r,n)}case"html":return this.renderer.html(this.token.text);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText());default:{const e='Token with "'+this.token.type+'" type was not found.';if(!this.options.silent)throw new Error(e);console.log(e)}}}}},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"AppLinkHelper",(function(){return j})),n.d(r,"AppLinkUtility",(function(){return O})),n.d(r,"Application",(function(){return P})),n.d(r,"AppRouter",(function(){return F})),n.d(r,"Behavior",(function(){return M})),n.d(r,"Collection",(function(){return U})),n.d(r,"CollectionView",(function(){return V})),n.d(r,"ComponentCollection",(function(){return V})),n.d(r,"Error",(function(){return L})),n.d(r,"ErrorHelper",(function(){return x})),n.d(r,"SilentError",(function(){return k})),n.d(r,"LayoutView",(function(){return J})),n.d(r,"NestedModel",(function(){return Y})),n.d(r,"Service",(function(){return G})),n.d(r,"Model",(function(){return K})),n.d(r,"View",(function(){return H})),n.d(r,"Component",(function(){return q})),n.d(r,"EventNames",(function(){return g})),n.d(r,"LayoutService",(function(){return W})),n.d(r,"Middleware",(function(){return N})),n.d(r,"LocationUtils",(function(){return v})),n.d(r,"Shell",(function(){return Q}));var i={};n.r(i),n.d(i,"emptyResponse",(function(){return jt})),n.d(i,"getResponse",(function(){return At})),n.d(i,"getFetch",(function(){return Tt})),n.d(i,"fetch",(function(){return wt})),n.d(i,"useGetFetch",(function(){return Lt})),n.d(i,"useGetResponse",(function(){return kt})),n.d(i,"useBasicFetch",(function(){return _t})),n.d(i,"createMiddleware",(function(){return Rt})),n.d(i,"FlightReducer",(function(){return Ut})),n.d(i,"Simulator",(function(){return qt})),n.d(i,"Actions",(function(){return nt})),n.d(i,"RequestStatus",(function(){return rt})),n.d(i,"ajaxRequest",(function(){return st})),n.d(i,"normalize",(function(){return ft})),n.d(i,"denormalize",(function(){return ht}));n(130),n(131),n(132),n(133),n(134),n(135),n(136),n(137),n(138),n(139),n(140),n(141),n(142),n(143),n(144),n(145),n(146),n(147),n(148),n(149),n(150),n(151),n(152),n(153),n(154),n(155),n(156),n(157),n(158),n(159),n(160),n(161);var a={UPLOAD_IMAGE:"upload:image"},o={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"},a),Playlists:Object.assign({PLAYLISTS:"index",SEARCH_PLAYLISTS:"search:playlists",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"},a),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",LEGACY_EDIT_SERIES:"legacy:edit:series"},a),Videos:Object.assign({EDIT_VIDEO:"edit:video",EDIT_VIDEO_AUDIENCES:"edit:video:audiences",EDIT_VIDEO_SUBJECTS:"edit:video:subjects",EDIT_VIDEO_ALIASES:"edit:video:aliases",LEGACY_EDIT_VIDEO:"legacy:edit:video"},a),DomainOptions:{DOMAIN_OPTIONS:"domain:options",NEW_DOMAIN_OPTION:"new:domain:option",EDIT_DOMAIN_OPTION:"edit:domain:option",DELETE_DOMAIN_OPTION:"delete:domain:option"},People:{PEOPLE:"people",NEW_PERSON:"new:person",EDIT_PERSON:"edit:person"},Companies:{COMPANIES:"companies",NEW_COMPANY:"new:company",EDIT_COMPANY:"edit:company"},Themes:Object.assign({THEMES:"themes",NEW_THEME:"new:theme",EDIT_THEME:"edit:theme",DELETE_THEME:"delete:theme"},a)},s={SUBJECT:"subject",SUBJECTS:"subjects",UPDATE_SUBJECT:"update:subject",DELETE_SUBJECT:"delete:subject",UPDATE_OBJECT_SUBJECTS:"update:object:subjects",ADD_TO_SUBJECT:"add:to:subject",REMOVE_FROM_SUBJECT:"remove:from:subject",CLASSIFICATION:"classification",CLASSIFICATIONS:"classifications",UPDATE_CLASSIFICATION:"update:classification",DELETE_CLASSIFICATION:"delete:classification",UPDATE_OBJECT_CLASSIFICATIONS:"update:object:classifications",ADD_TO_CLASSIFICATION:"add:to:classification",REMOVE_FROM_CLASSIFICATION:"remove:from:classification",PRESENTATION:"presentation",PRESENTATIONS:"presentations",UPDATE_PRESENTATION:"update:presentation",LEVEL:"level",LEVELS:"levels",UPDATE_LEVEL:"update:level",ADD_TO_LEVEL:"add:to:level",REMOVE_FROM_LEVEL:"remove:from:level",UPDATE_OBJECT_LEVELS:"update:object:levels",AUDIENCE:"audience",AUDIENCES:"audiences",UPDATE_AUDIENCE:"update:audience",DELETE_AUDIENCE:"delete:audience",UPDATE_OBJECT_AUDIENCES:"update:object:audiences",PLAYLIST:"playlist",PLAYLISTS:"playlists",UPDATE_PLAYLIST:"update:playlist",DELETE_PLAYLIST:"delete:playlist",PLAYLIST_VIDEOS:"playlist:videos",REORDER_PLAYLIST_VIDEOS:"reorder:playlist:videos",REMOVE_PLAYLIST_VIDEO:"remove:playlist:video",VIDEO:"video",SERIES:"series",SERIES_BY_ID:"series:by:id",UPDATE_SERIES:"update:series",CURRENT_USER:"current:user",UPLOAD_IMAGE:"upload:image",LOCALE:"locale",PHRASES:"PHRASES"},c={IMAGES:".".concat(["jpg","tif","png","bmp","gif","jpeg"].join(",."))},l={CURATOR_LAYOUT:"CuratorLayout"},u={COMPANIES:"companies:application",DOMAIN_OPTIONS:"domain:options:application",PEOPLE:"people:application",PLAYLISTS:"playlists:application",SERIES:"series:application",SUBJECTS:"subjects:application",THEMES:"themes:application",VIDEOS:"videos:application"},p={IMAGE_UPLOAD:"image:upload:data:service",SUBJECT:"subject:data:service",USER:"user:data:service",LANGUAGE:"language:data:service"},f={IMAGE_UPLOAD:"ImageUploadDataService",SUBJECT:"SubjectDataService",USER:"UserDataService",LANGUAGE:"LanguageDataService"},d=n(0),m=n(1),h=n(4);const g={SHOW_POPUP:"show:popup",ROUTE:"route",LOCK_NAV:"lock:nav",UNLOCK_NAV:"unlock:nav",NAV_IS_LOCKED:"navigation:islocked",NAV_UNLOCKED_BY_USER:"navigation:unlocked:by:user",ROUTING_START:"routing:start",ROUTING_END:"routing:end",HAS_ACTIVE_ROUTE:"has:active:route",ROUTE_LOOKUP:"route:look:up",URL_CHANGE:"url:change",ERROR:"error",CURRENT_ROUTE:"route:current"},y={SHELL:"global:shell",ALERT:"global:alert",POPUP:"global:popup"},v={GetQuery:()=>v.DeserializeQueryParams(window.location.search.substring(1)),UpdateQuery(e){if(!e)return;const t=v.GetQuery();let n=v.SerializeQueryParams(m.extend(t,e));n&&(n="?"+n),v.UpdateUrl(`${v.GetCurrentPath()}${n}`,null,{replace:!0,trigger:!1})},UpdateUrl(e,t,n){const r=j.buildRoute(e,t);h.history.navigate(r,n),h.Radio.channel(y.SHELL).trigger(g.URL_CHANGE,t,n)},SerializeQueryParams:e=>e?"string"==typeof e?e:$.param(e,!0):"",DeserializeQueryParams:e=>e?m.reduce(e.split("&"),(e,t)=>{const n=t.split("="),r=n[0],i=n.length>0?decodeURIComponent(n[1]):"";return e[r]?e[r]instanceof Array?(e[r].push(i),e):(e[r]=[e[r],i],e):(e[r]=i,e)},{}):{},StartHistory(){h.History.started&&h.history.stop(),h.history.start({pushState:!0})},PageLoad(e,t=!1){t?window.open(e,"_blank"):window.location.href=e},Redirect(e,t=!0){const n=()=>t?window.location.replace(e):window.location.href=e;O.hasActiveRoute()?h.Radio.channel(y.SHELL).once("routing:end",n):n()},Reload(e=!0){window.location.reload(e)},GetCurrentPath:()=>window.location.pathname,GetCurrentQueryString:()=>window.location.search,GetCurrentUrl:()=>window.location.href,GetCurrentReferrer:()=>document.referrer,SetPageTitle(e){document.title=e}},b=/((\(\?)?:\w+)|(\*\w+)/,S=/[\(\)]/g,E=/\(\/\)/g,C=/\/$/,O={routingStarted(){h.Radio.channel(y.SHELL).trigger(g.ROUTING_START)},routingEnded(){if(!O.hasActiveRoute())return;h.Radio.channel(y.SHELL).trigger(g.ROUTING_END)},hasActiveRoute:()=>h.Radio.channel(y.SHELL).request(g.HAS_ACTIVE_ROUTE)},I=(e,t={})=>{t.usedHelper=!0;const{application:n,action:r}=e;h.Radio.channel(n).trigger(r,e,t)},j={getHref(e){if(!e)return"";const{application:t,action:n,args:r,params:i}=e;return"/"+h.Radio.channel(y.SHELL).request(g.ROUTE_LOOKUP,`${t}:${n}`,r,i)},buildRoute(e,t){if(!t)return e;let n=t.args,r=t.params;if(m.each(n,t=>{e=e.replace(b,t||"")}),e=(e=(e=e.replace(E,"")).replace(S,"")).replace(C,""),!r)return e;const i=v.SerializeQueryParams(r);return i.length?`${e}?${i}`:e},trigger(e,t){if(!e)return;if(!O.hasActiveRoute())return void I(e,t);h.Radio.channel(y.SHELL).once("routing:end",()=>{I(e,t)})},getCurrentAppLink:()=>h.Radio.channel(y.SHELL).request(g.CURRENT_ROUTE)};var A=n(7);function T(e,t,n,r){let i=e;return"string"==typeof e&&(i=h.Radio.channel(e)),r.call(this,i,t,n)}const w=class{constructor(){this.variables={}}static get Instance(){return this.instance||(this.instance=new this)}get name(){return"EnvironmentVariables"}get isDevelopment(){return this.variables.isDevelopment}get(e){return this.variables[e]}setUpVariables(e){this.variables=e}}.Instance;class L extends Error{constructor(e){super(e)}}class k extends L{get name(){return"SilentError"}}class _ extends Error{get name(){return"CoreError"}}const x={throw(e){if(h.Radio.channel(y.SHELL).trigger(g.ERROR,e),!(e instanceof k||w.isDevelopment))throw e}};class P extends A.Application{constructor(e){super(e),this.mergeOptions(e,[...this.defaultProps,...this.props||[]]),m.result(this,"name")||x.throw(new _("BaseApplication must define a name")),m.result(this,"channelName")||x.throw(new _("BaseApplication must define a channelName")),this.listenTo(this.getGlobalRadioChannel("popup"),g.SHOW_POPUP,this.onShowPopup),this.listenTo(this.getGlobalRadioChannel("alert"),"show:alert",this.onShowAlert)}get defaultProps(){return["shell","layoutService"]}getGlobalRadioChannel(e){const t=this.shell.getGlobalRadioChannels()[e.toUpperCase()];return t||x.throw(new _(`Global channel ${t} does not exist`)),h.Radio.channel(t)}onLoadLayout(){if(this.layoutOptions&&this.layoutOptions.name){var e=m.extend({},this.layoutOptions.options||{},{store:this.shell.store});this.layout=this.layoutService.getLayout(m.extend(this.layoutOptions,{options:e})),this.layout||x.throw(new _(`Layout: ${this.layoutOptions.name} does not exist or was not registered`)),this.shell.showView(this.layout),this.triggerMethod("layout:loaded")}}onShowPopup(e){this.layout.getRegion("popup")||x.throw(new _("Your application layout must define a popup region")),this.layout.showChildView("popup",e)}onShowAlert(e){const{ctor:t,collection:n}=e,r=this.layout.getRegion("alert");r||x.throw(new _("Your application layout must define an alert region")),r.hasView()||this.layout.showChildView("alert",new t({collection:n}))}setDefaultQueryParams(e){this.defaultQueryParams&&(e=m.extend(this.defaultQueryParams,e)),this.defaultQueryParams=e}getAndClearDefaultQueryParams(){const e=this.defaultQueryParams;return delete this.defaultQueryParams,e||{}}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class N{use(e){var t;this.go=(t=this.go,(n,r)=>t(n,()=>e(n,r)))}go(e,t){t(e)}}const D=/([A-Z])/g,R=/(^|:)(\w)/gi;class F extends A.AppRouter{constructor(e){super(e),this.bindDisposal(),this.processInternalRoutes(),this.processExternalRoutes(),this.processAppLinks()}bindDisposal(){this.listenTo(y.SHELL,g.ROUTE,e=>{e.application!==this.channelName&&this.destroyApp()})}addRouteLookup(e,t){this.options.shell.addRouteLookup(`${this.channelName}:${e}`,(n,r)=>j.buildRoute(t,{application:this.channelName,action:e,args:n,params:r}))}processInternalRoutes(){m.each(m.keys(this.appRoutes),e=>{const t=this.appRoutes[e],n=this.toEventName(t);this.addRouteLookup(n,e),this.listenTo(this.channelName,n,(t,n)=>{n&&n.usedHelper||x.throw(new _("Please use Core.AppLinkHelper.trigger({}) to trigger appLinks.")),this.executeRoute(t,{isAppRoute:!0},()=>{const r=m.extend({},this.controller.getAndClearDefaultQueryParams(),t.params);t.params=r,v.UpdateUrl(e,t,n)})})})}processExternalRoutes(){this.externalRoutes&&m.each(m.keys(this.externalRoutes),e=>{const t=this.externalRoutes[e],n=this.toEventName(t);this.addRouteLookup(n,e),this.listenTo(this.channelName,n,(e,t)=>{t&&t.usedHelper||x.throw(new _("Please use Core.AppLinkHelper.trigger({}) to trigger appLinks.")),v.PageLoad(j.getHref(e))})})}processAppLinks(){this.appLinks&&m.each(this.appLinks,e=>{const t=this.toEventName(e);this.listenTo(this.channelName,t,(e,t)=>{t&&t.usedHelper||x.throw(new _("Please use Core.AppLinkHelper.trigger({}) to trigger appLinks.")),this.executeRoute(e,{isAppRoute:!1})})})}executeRoute(e,t,n){this.validateAppLink(e);const r=this.toMethodName(e.action);O.routingStarted();const i=h.Radio.channel(y.SHELL);if(this.options.shell.isNavLocked())return i.trigger(g.NAV_IS_LOCKED,e),void O.routingEnded();const a=new N;m.each(this.filters,e=>a.use(e)),a.go(e,()=>{i.trigger(g.ROUTE,e,t),this.createApp();const a=this.controller;if(m.isFunction(a[r])||(O.routingEnded(),x.throw(new _(`${r} does not exist on the ${m.result(a,"name")}.`))),!1===a.triggerMethod("before:action"))return a.triggerMethod("action:cancelled"),void O.routingEnded();a.triggerMethod("load:layout"),a[r].apply(a,[...e.args||[],e.params||{}]),m.isFunction(n)&&n(),O.routingEnded()})}createApp(){this.controller||(this.controller=new this.options.appConstructor(this.options.appOptions),this.controller.start())}destroyApp(){if(!this.controller)return;this.controller.destroy(),delete this.controller}_addAppRoute(e,t,n){this.route(t,n,(...e)=>{const t={application:this.channelName,action:this.toEventName(n),args:e.slice(0,e.length-1),params:v.DeserializeQueryParams(e[e.length-1])};this.executeRoute(t,{isAppRoute:!0},()=>{v.UpdateQuery(m.extend(this.controller.getAndClearDefaultQueryParams(),t.params))})})}toEventName(e){return e.replace(D,":$1").toLowerCase()}toMethodName(e){const t=e.replace(R,(e,t,n)=>n.toUpperCase());return t[0].toLowerCase()+t.slice(1,t.length)}validateAppLink(e){e.application&&e.action||(O.routingEnded(),x.throw(new _("Invalid AppLink")))}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class M extends A.Behavior{listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class U extends h.Collection{listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class V extends A.CollectionView{constructor(e){super(e),m.result(this,"name")||x.throw(new _(`Error: View with cid:${this.cid} requires a name.`))}serializeModel(){return this.model?this.model.toJSON():{}}serializeCollection(){return this.collection?this.collection.toJSON():[]}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class B extends L{get name(){return"DevError"}}class z extends A.View{constructor(e){super(e);const t=[...this.defaultProps,...this.props||[]];this.mergeOptions(e,t),m.result(this,"name")||x.throw(new _(`Error: View with cid:${this.cid} requires a name.`))}get defaultProps(){return["shell","layoutService"]}_setOptions(e){this.options=m.extend({},m.result(this,"defaults"),e)}_setAttributes(e){w.isDevelopment&&m.extend(e,{"cv-classname":this.name}),this.$el.attr(e)}get ui(){return this.uiStorage||(this.uiStorage=this.elements),this.uiStorage}set ui(e){this.uiStorage=e}get elements(){return null}static AddViewDataExtension(e){z.ViewDataExtensions.push(e)}serializeModel(){return this.model?this.model.toJSON():{}}serializeCollection(){return this.collection?this.collection.toJSON():[]}resetClassName(){this.$el.attr("class",m.result(this,"className"))}serializeData(){const e=super.serializeData(),t=m.result(this,"viewOptions"),n=m.extend({},e,{options:t});return z.ViewDataExtensions.length?m.extend(n,...m.map(z.ViewDataExtensions,e=>e instanceof Function?e(this):e)):n}viewOptions(){return this.options}undelegateAppLinks(){this.$el&&this.$el.off(".appLinks"+this.cid)}renderAppLinks(){let e=this.appLinks;e&&(e=this.normalizeUIKeys(e),this.undelegateAppLinks(),m.each(m.keys(e),t=>{let n=t;const r=e[t],i=j.getHref(r);"[this]"===n&&(n=null);const a=n?this.$el.find(t):this.$el;(a.is("a")||a.is("button"))&&(i&&"/"!==i&&a.attr("href",i),this.delegate("click.appLinks"+this.cid,n,(function(e){e.preventDefault(),j.trigger(r)})))}))}hasPartialLoadingRegions(){const e=this;return void 0!==e._hasPartialLoadingRegions||(e._hasPartialLoadingRegions=m.some(e.regions,e=>m.has(e,"partialLoading"))),e._hasPartialLoadingRegions}renderPartialLoading(e){h.Radio.channel(y.SHELL).trigger("render:partial:loading",this,e)}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}render(){const e=this;if(e._isDestroyed)return this;let t=this.processRequriedResources(!0);return t&&(t=e.triggerMethod("before:render",this)),!1!==t&&(t=!0),t=t&&this.processRequriedResources(!1),!1===t?(e._partialLoadingRendered||!e.hasPartialLoadingRegions()||(e._partialLoadingRendered=!0,e._reInitRegions(),e._renderTemplate(),e.renderPartialLoading()),this):((e._isRendered||e._partialLoadingRendered)&&e._reInitRegions(),this.setTitle(),e._renderTemplate(),e.bindUIElements(),this.renderAppLinks(),e._partialLoadingRendered=!1,e._isRendered=!0,e.triggerMethod("render",this),this)}processRequriedResources(e){return!0}setTitle(){}}z.ViewDataExtensions=[];class H extends z{constructor(e){super(e),this.boundListeners={},this.resourceInstances={}}processRequriedResources(e){const t=m.keys(this.requiredResources);if(!t.length)return!0;const n=this;let r=!0;return m.each(t,t=>{const i=this.requiredResources[t];if(i.beforeOnBeforeRender!==e)return;const a=i.dataServiceName;this.resourceInstances[a]||(this.resourceInstances[a]=i.getInstance(this)),this.boundListeners[`${a}:${i.eventName}`]||(this.listenTo(this.resourceInstances[a].channelName,i.eventName,this.render),this.boundListeners[`${a}:${i.eventName}`]=!0),n[t]=i.getData(this.resourceInstances[a]),r=r&&!!n[t]}),r}setTitle(){m.isString(this.title)||!1===this.title||x.throw(new B(`Must define a title for ${this.name}.`));h.Radio.channel(y.SHELL).trigger("set:page:title",this.title)}}class q extends z{}class J extends H{constructor(e){super(e)}static getCacheKey(e){x.throw(new B(`Must define getCacheKey for ${this.name}.`))}unmountRegion(e){this.trigger("unmount:"+e)}}class K extends h.Model{mixin(e){const t=this;for(let n in e){if(t.hasOwnProperty(n)){const r=t[n];return void(t[n]=m.extend({},r,e[n]))}t[n]=e[n]}}addValidation(e){this.mixin({validation:e})}validate(e,t){super.validate.call(this,e,t)}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class Y extends K{set(e,t,n){let r,i;if(null===e)return this;for(r in"object"==typeof e?(i=e,n=t):(i={},i[e]=t),n||(n={}),i)m.has(this.associations,r)&&(i[r]=this.setAssociation(r,i[r],n));return super.set.call(this,i,n)}get(e){var t=e.indexOf(".");if(-1===t)return super.get.call(this,e);const n=e.substr(0,t),r=this.attributes[n];if(!r||!m.isFunction(r.get))return super.get.call(this,e);const i=e.substr(t+1);return r.get(i)}setAssociation(e,t,n){const r=this.associations[e],i=this.attributes[e];if(!m.isFunction(r))return t;if(n.unset)return i&&delete i.parent,delete this[e],i;if(i)return i instanceof K&&i.set(t,n),i instanceof U&&i.set(t,n),n.silent||this.trigger("change:"+e,this,t,n),i;const a=t instanceof K?t:new r(t,{parse:!0});return a.parent=this,this[e]=a,a}toJSON(...e){const t=super.toJSON.apply(this,e);return m.each(this.associations,(e,n)=>{m.has(t,n)&&m.isFunction(t[n].toJSON)?t[n]=t[n].toJSON():t[n]=(new e).toJSON()}),t}toFlatJSON(...e){return m.omit(super.toJSON.apply(this,e),m.keys(this.associations))}}class G extends A.Object{constructor(e){super(e),this.name||x.throw(new _("Your service must be named."))}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class W extends A.Object{constructor(e){super(e),this.layouts={},this.requiredRegions=e.requiredRegions}clearLayout(){this.currentLayout&&(this.currentLayout.destroy(),delete this.currentLayout,delete this.currentLayoutCacheKey)}registerLayout(e,t){return this.checkRequiredRegions(t),this.layouts[e]=t,this}getLayout(e){const{name:t,options:n={}}=e;this.layouts[t]||x.throw(new _(t+" was not registered as a template."));const r=this.layouts[t].getCacheKey(n);return this.currentLayoutCacheKey===r&&this.currentLayout?(this.currentLayout.triggerMethod("layout:requested",n),this.currentLayout):(this.clearLayout(),this.currentLayoutCacheKey=r,this.currentLayout=new this.layouts[t](n),this.listenToOnce(this.currentLayout,"destroy",this.clearLayout),this.currentLayout)}checkRequiredRegions(e){m.each(this.requiredRegions,t=>{m.has(m.result(e.prototype,"regions"),t)||x.throw(new _(`Layout: ${e.prototype.name} must define an ${t} region.`))})}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class Z{constructor(e,t){this.application=e,this.options=t||{}}get Application(){return this.application}get Options(){return this.options}}class Q extends A.Application{initialize(e){this.mergeOptions(e,["layoutService"]),this.applications=[],this.routeLookup={},this.shellState={navLock:!1,activeRoute:!1,currentAppLink:null},this.errorHandlers=[]}bindListeners(){this.bindRouteLookup(),this.bindNavLockListeners(),this.bindAppLinkListeners(),this.bindErrorHandlers(),this.bindErrorListener()}bindNavLockListeners(){this.listenTo(y.SHELL,g.LOCK_NAV,()=>this.shellState.navLock=!0),this.listenTo(y.SHELL,g.UNLOCK_NAV,()=>this.shellState.navLock=!1)}bindAppLinkListeners(){this.listenTo(y.SHELL,g.ROUTING_START,()=>this.shellState.activeRoute=!0),this.listenTo(y.SHELL,g.ROUTING_END,()=>this.shellState.activeRoute=!1),this.listenTo(y.SHELL,g.ROUTE,e=>this.shellState.currentAppLink=e);const e=h.Radio.channel(y.SHELL);e.reply(g.HAS_ACTIVE_ROUTE,m.bind(this.hasActiveRoute,this)),e.reply(g.CURRENT_ROUTE,()=>this.shellState.currentAppLink)}bindErrorHandlers(){window.addEventListener("error",()=>{O.routingEnded()})}bindErrorListener(){const e=h.Radio.channel(y.SHELL);this.listenTo(e,g.ERROR,this.handleError)}bindRouteLookup(){h.Radio.channel(y.SHELL).reply(g.ROUTE_LOOKUP,(e,t,n)=>this.routeLookup[e]?this.routeLookup[e](t,n):"",this)}addRouteLookup(e,t){this.routeLookup[e]=t}registerApplication(e,t){return this.applications.push(new Z(e,t)),this}getGlobalRadioChannels(){return y}isNavLocked(){return this.shellState.navLock}start(e){e||(e={}),this.runInitializationSteps(this,(t,n)=>{this.runStartUpSteps(this,e,(t,n,r)=>{super.start(e)})})}hasActiveRoute(){return this.shellState.activeRoute}onStart(){m.each(this.applications,e=>{const t={appConstructor:e.Application,shell:this,appOptions:Object.assign({region:"",shell:this,layoutService:this.layoutService},e.Options)};new e.Application.router(t)}),this.bindListeners(),v.StartHistory()}addInitializationStep(e){var t;return this.runInitializationSteps=(t=this.runInitializationSteps,(n,r)=>t(n,()=>e(n,r))),this}runInitializationSteps(e,t){t(e)}addStartUpStep(e){var t;return this.runStartUpSteps=(t=this.runStartUpSteps,(n,r,i)=>t(n,r,()=>e(n,r,i))),this}runStartUpSteps(e,t,n){n(e,t)}registerLayout(e,t){return this.layoutService.registerLayout(e,t),this}registerErrorHandler(e,t){return e||x.throw(new _("An error must have a name in order to register a handler for it.")),m.any(this.errorHandlers,t=>t.errorType===e)&&x.throw(new _(`An error handler for ${e.prototype.name} has already been defined.`)),this.errorHandlers.push({errorType:e,handler:t}),this}handleError(e){const t=m.find(this.errorHandlers,t=>e instanceof t.errorType);t&&t.handler&&t.handler(e)}registerStore(e){this.store=e}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}const X={debounce:(e,t,n)=>m.debounce(e,t,n),throttle:(e,t,n)=>m.throttle(e,t,n),isFunction:e=>m.isFunction(e),useIdentity:()=>m.identity,memoize:(e,t)=>m.memoize(e,t)};var ee=n(24),te=n(5);class ne extends J{isReactComponent(e){return d&&d.isValidElement(e)}showChildView(e,t){this.isReactComponent(t)&&this.showChildReactComponent(e,t)}showChildReactComponent(e,t){this.isAttached()?this.renderChildReactComponent(e,t):this.listenToOnce(this,"attach",()=>this.renderChildReactComponent(e,t))}renderChildReactComponent(e,t){const n=this.getRegion(e),r=this.$el.find(n.el);r&&r.length&&(n.trigger("before:show"),ee.render(t,r[0],()=>n.trigger("show")),this.listenToOnce(this,"unmount:"+e,()=>ee.unmountComponentAtNode(r[0])),this.listenToOnce(this,"before:destroy",()=>ee.unmountComponentAtNode(r[0])))}wrapWithStore(e){return d.createElement(te.Provider,{store:this.options.store},e)}}const re="top:nav",ie="left:nav",ae="content",oe="popup",se="alert";var ce=n(121),le=n.n(ce),ue=n(25),pe=n.n(ue);function fe(e){return(fe="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 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,n){return(me="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=ve(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 he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ge(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var i=ve(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ye(this,n)}}function ye(e,t){return!t||"object"!==fe(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 ve(e){return(ve=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var be=function(e){!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&&he(e,t)}(o,e);var t,n,i,a=ge(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=a.call(this,e)).childComponents={},t}return t=o,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}}],(n=[{key:"regions",value:function(){return{layout:".layout-region"}}},{key:"getChildComponents",value:function(){return{topNav:{component:this.childComponents[re],className:pe.a.topNavRegion},leftNav:{component:this.childComponents[ie],className:"py-3 ".concat(pe.a.leftNavRegion)},content:{component:this.childComponents[ae],className:"position-relative container py-3"},popup:{component:this.childComponents[oe]},alert:{component:this.childComponents[se]}}}},{key:"unsetRegion",value:function(e){delete this.childComponents[e],this.renderLayout()}},{key:"renderTopNav",value:function(){X.isFunction(this.options.getTopNavView)&&(this.childComponents[re]=this.options.getTopNavView(r.AppLinkHelper.getCurrentAppLink()))}},{key:"hideLeftNav",value:function(){this.unsetRegion(ie)}},{key:"closePopup",value:function(){this.unsetRegion(oe)}},{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());me(ve(o.prototype),"showChildView",this).call(this,"layout",this.wrapWithStore(d.createElement(Ie,Object.assign({},e))))}},{key:"title",get:function(){return!1}},{key:"name",get:function(){return"CuratorLayoutView"}},{key:"template",get:function(){return le.a}},{key:"className",get:function(){return"container-fluid ".concat(pe.a.curatorLayout)}}])&&de(t.prototype,n),i&&de(t,i),o}(ne),Se=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},Ee=function(e){var t=e.className,n=e.children;return d.createElement("div",{className:t},n)},Ce=function(e,t){return"".concat(e).concat(t?" ".concat(t):"")},Oe=function(e){var t=e.topNav,n=e.leftNav,r=e.content,i=e.popup,a=e.alert;return d.createElement(d.Fragment,null,d.createElement("div",{className:"position-relative"},!!t.component&&d.createElement(Ee,{className:Ce("top-nav-region",t.className)},t.component),!!n.component&&d.createElement(Ee,{className:Ce("left-nav-region",n.className)},n.component),!!r.component&&d.createElement("div",{className:"content-container"},d.createElement(Ee,{className:Ce("content-region",r.className)},r.component))),!!i.component&&d.createElement(Ee,{className:Ce("popup-region",i.className)},i.component),!!a.component&&d.createElement(Ee,{className:Ce("alert-region",a.className)},a.component))},Ie=function(e){var t=e.provider,n=Se(e,["provider"]);return t?d.createElement(t,null,d.createElement(Oe,Object.assign({},n))):d.createElement(Oe,Object.assign({},n))};function je(e){return(je="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 Ae(e){return function(e){if(Array.isArray(e))return Te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Te(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function we(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Le(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 ke(e,t){return(ke=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _e(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Pe(e);if(t){var i=Pe(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xe(this,n)}}function xe(e,t){return!t||"object"!==je(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 Pe(e){return(Pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ne=function(e){!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&&ke(e,t)}(o,e);var t,n,i,a=_e(o);function o(){return we(this,o),a.apply(this,arguments)}return t=o,(n=[{key:"initialize",value:function(){this.listenTo(y.SHELL,r.EventNames.ROUTING_END,this.updateNav)}},{key:"updateNav",value:function(){var e=this,t=r.AppLinkHelper.getCurrentAppLink().application;if(t!==this.currentApplication){this.currentApplication=t;var n=this.options.navItemMappings[t];if(n){var i=document.querySelector(this.options.navSelector);i&&i.children&&Ae(i.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"}}])&&Le(t.prototype,n),i&&Le(t,i),o}(r.Service);class De extends G{constructor(e){super(e),m.result(this,"name")||x.throw(new B("Must provide a name when extending BaseDataService")),m.result(this,"channelName")||x.throw(new B("Must provide a channelName for "+m.result(this,"name")));const t=[...this.defaultProps,...this.props||[]];this.dataRequestSignatures={},this.mergeOptions(e,t)}get defaultProps(){return["dataProvider","cache","bootstrapData","defaultErrorHandler","alertService"]}getCursors(e){const t=this.cache.get(e);return t?t.cursors:{}}clearCacheAndGet(e){const{callback:t,errorCallback:n,eventPrefix:r}=e,{syncEvent:i,errorEvent:a}=this.getEventNames(r),o=this.cache.get(r);if(o&&o.openRequest){const e=e=>{m.isFunction(n)&&this.stopListening(this.getChannel(),a,n),m.isFunction(t)&&t(e)},r=()=>{m.isFunction(t)&&this.stopListening(this.getChannel(),i,t),m.isFunction(n)&&n()};return this.listenToOnce(this.getChannel(),i,e),void this.listenToOnce(this.getChannel(),a,r)}this.cache.remove(e.eventPrefix),this.get(e)}get(e){const{callback:t,errorCallback:n,eventPrefix:r,resource:i,formatData:a,expiryTime:o,successHandler:s,errorHandler:c,bootstrapName:l}=e,{syncEvent:u,requestEvent:p,successEvent:f,errorEvent:d}=this.getEventNames(r),h=this.getChannel(),g=this.currentTimestamp();this.bootstrapData&&this.bootstrapData[l]&&(this.cacheData(r,this.bootstrapData[l],a,{openRequest:!1,timestamp:g}),delete this.bootstrapData[l]);const y=this.cache.get(r);let v;y&&(v=y.data);const b=y&&y.openRequest,S=this.isExpired(r,o);if(b){const e=e=>{m.isFunction(n)&&this.stopListening(this.getChannel(),d,n),m.isFunction(t)&&t(e)},r=()=>{m.isFunction(t)&&this.stopListening(this.getChannel(),u,t),m.isFunction(n)&&n()};this.listenToOnce(h,u,e),this.listenToOnce(h,d,r)}if(this.cache.has(r)&&!S||(h.trigger(p),this.listenToResponse({eventPrefix:r,formatData:a,cacheOptions:{timestamp:g},callback:t,errorCallback:n,successHandler:s,errorHandler:c}),this.cacheData(r,null,null,{openRequest:!0,timestamp:g}),this.dataProvider.read(i,{channel:this.getTransportChannel(),successEvent:f,errorEvent:d})),v&&m.isFunction(t)&&!S&&t(v),v)return v}create(e){const{eventPrefix:t,resource:n,data:r,formatData:i,callback:a,errorCallback:o,invalidationKeys:s,successHandler:c,errorHandler:l}=e,{requestEvent:u,successEvent:p,errorEvent:f}=this.getEventNames(e.eventPrefix),d=this.getChannel(),m=this.getTransportChannel();d.trigger(u),this.listenToResponse({eventPrefix:t,formatData:i,invalidationKeys:s,callback:a,errorCallback:o,successHandler:c,errorHandler:l}),this.dataProvider.create(n,r,{channel:m,successEvent:p,errorEvent:f})}update(e){const{data:t,callback:n,errorCallback:r,resource:i,formatData:a,eventPrefix:o,invalidationKeys:s,errorHandler:c,successHandler:l}=e,{requestEvent:u,successEvent:p,errorEvent:f}=this.getEventNames(e.eventPrefix),d=this.getChannel(),m=this.getTransportChannel();d.trigger(u),this.listenToResponse({eventPrefix:o,formatData:a,invalidationKeys:s,callback:n,errorCallback:r,successHandler:l,errorHandler:c}),this.dataProvider.update(i,t,{channel:m,successEvent:p,errorEvent:f})}delete(e){const{eventPrefix:t,resource:n,callback:r,errorCallback:i,invalidationKeys:a,successHandler:o,errorHandler:s}=e,{successEvent:c,errorEvent:l}=this.getEventNames(t),u=this.getTransportChannel();this.listenToResponse({eventPrefix:t,invalidationKeys:a,callback:r,errorCallback:i,cacheOptions:{noCache:!0,clearCacheKey:!0},successHandler:o,errorHandler:s}),this.dataProvider.delete(n,{channel:u,successEvent:c,errorEvent:l})}listenToResponse(e){const{eventPrefix:t,formatData:n,callback:r,errorCallback:i,successHandler:a,errorHandler:o,invalidationKeys:s,cacheOptions:c={}}=e,{syncEvent:l,requestEvent:u,successEvent:p,errorEvent:f,successAlertEvent:d,errorAlertEvent:h}=this.getEventNames(t),g=this.getChannel(),y=this.getTransportChannel(),v=this.getAlertChannel();if(m.isFunction(r)&&this.listenToOnce(g,l,r),m.isFunction(i)&&this.listenToOnce(g,f,i),this.stopListening(v,d),this.stopListening(v,h),m.isFunction(a)&&this.listenToOnce(v,d,a),m.isFunction(o)&&this.listenToOnce(v,h,o),!m.isFunction(o)&&!1!==o&&m.isFunction(this.defaultErrorHandler)&&this.listenToOnce(v,h,this.defaultErrorHandler),this.hasRequestSignature(t))return;this.setRequestSignature(t);this.listenTo(y,p,(e,...r)=>{this.stopListening(g,f,i),v.trigger(d,e,...r);const a=c.noCache?this.formatData(e,n):this.cacheData(t,e,n);c.clearCacheKey&&this.cache.remove(t),g.trigger(l,a),s&&s.length&&this.cache.invalidate(s,e=>g.trigger(e+":invalidate"))}),this.listenTo(y,f,(...e)=>{this.stopListening(g,l,r);const n=this.dataProvider.parseError(...e);v.trigger(h,n),g.trigger(f,n),c.noCache||this.cacheData(t,null,null)})}cacheData(e,t,n,r={}){let{openRequest:i=!1,timestamp:a}=r;a||(a=this.currentTimestamp());const o=this.processPagination(t),s=this.formatData(t,n);return this.cache.set(e,{data:s,timestamp:a,cursors:o,openRequest:i}),s}processPagination(e){if(!e)return;const{pagination:t}=e;return t?t.cursors?t.cursors:m.isUndefined(t.offset)||m.isUndefined(t.pageSize)?t.page?this.convertLegacyPaginationToCursors(t):void 0:this.convertOffsetPaginationToCursors(t):void 0}formatData(e,t){return m.isFunction(t)?t(e):e}chain(){const e=[],t=(e,t)=>{m.isFunction(e)&&e(t)},n=(n,i)=>(e.push(()=>{const r=n.callback;n.callback=n=>{t(r,n),t(e.shift())},this[i](n)}),r),r={func:t=>(e.push(()=>{t(e.shift()||(()=>{}))}),r),get:e=>n(e,"get"),create:e=>n(e,"create"),update:e=>n(e,"update"),delete:e=>n(e,"delete"),run(){t(e.shift())}};return r}invalidateCache(e){e&&e.length&&this.cache.invalidate(e)}currentTimestamp(){return(new Date).valueOf()}isExpired(e,t){if(!t)return!1;const n=this.cache.get(e);if(!n||!n.timestamp)return!0;const r=1e3*t;return n.timestamp<this.currentTimestamp()-r}getEventNames(e){return{syncEvent:e+":sync",requestEvent:e+":request",successEvent:e+":success",errorEvent:e+":error",successAlertEvent:e+":success:alert",errorAlertEvent:e+":error:alert"}}getTransportChannel(){return h.Radio.channel(this.channelName+":transport")}getAlertChannel(){return h.Radio.channel(this.channelName+":alert")}setRequestSignature(e){this.dataRequestSignatures[e]=e}hasRequestSignature(e){return!!this.dataRequestSignatures[e]}convertOffsetPaginationToCursors(e){const{offset:t,pageSize:n,totalItems:r}=e,i=r>0&&t<r&&t+n,a=r>0&&t>0&&Math.max(t-n,0);let o={};if(i&&i<r&&(o.next=i.toString()),m.isNumber(a)&&(o.previous=a.toString()),!m.isEmpty(o))return o}convertLegacyPaginationToCursors(e){const{page:t,totalPages:n}=e,r=m.isNumber(t)&&t>0&&t<n&&t+1,i=m.isNumber(t)&&t>1&&t-1;let a={};if(r&&r<=n&&(a.next=r.toString()),i&&(a.previous=i.toString()),!m.isEmpty(a))return a}}function Re(e){return(Re="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 Me(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 Ue(e,t){return(Ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ve(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ze(e);if(t){var i=ze(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Be(this,n)}}function Be(e,t){return!t||"object"!==Re(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 ze(e){return(ze=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var He=function(e){!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&&Ue(e,t)}(a,e);var t,n,r,i=Ve(a);function a(){return Fe(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"uploadBase64Image",value:function(e,t,n,r){return this.create({resource:"/api/image/upload?type=".concat(t),eventPrefix:s.UPLOAD_IMAGE,data:e,callback:n,errorCallback:r})}},{key:"name",get:function(){return f.IMAGE_UPLOAD}},{key:"channelName",get:function(){return p.IMAGE_UPLOAD}}])&&Me(t.prototype,n),r&&Me(t,r),a}(De);const qe={SHORT:120,STANDARD:600};var Je={dataServiceName:f.USER,dataChannelName:p.USER},$e={getCurrentUserFetchOptions:function(e,t){return Object.assign(Object.assign({},Je),{eventPrefix:s.CURRENT_USER,fetchData:function(e){return e.getCurrentUser()},setData:e,onError:t})}};class Ke{constructor(e){this.value=e}increment(){this.value+=1}decrement(){this.value-=1}getValue(){return this.value}}function Ye(e){return(Ye="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 Ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function We(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 Ze(e,t){return(Ze=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=et(e);if(t){var i=et(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Xe(this,n)}}function Xe(e,t){return!t||"object"!==Ye(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 et(e){return(et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var tt=function(e){!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&&Ze(e,t)}(a,e);var t,n,r,i=Qe(a);function a(){return Ge(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"getLanguageConfig",value:function(e){var t={locale:"en",phrases:{}},n=new Ke(3),r=function(){n.decrement(),n.getValue()>0||e(t)};this.get({resource:"/api/locale",eventPrefix:s.LOCALE,expiryTime:qe.STANDARD,callback:function(e){t.locale=e,r()}}),this.get({resource:"/api/phrases/shared",eventPrefix:"".concat(s.PHRASES,":shared"),expiryTime:qe.STANDARD,callback:function(e){null===e.shared&&(e.shared={}),t.phrases=Object.assign(Object.assign({},t.phrases),e),r()}}),this.get({resource:"/api/phrases/subjects",eventPrefix:"".concat(s.PHRASES,":subjects"),expiryTime:qe.STANDARD,callback:function(e){null===e.subjects&&(e.subjects={}),t.phrases=Object.assign(Object.assign({},t.phrases),e),r()}})}},{key:"name",get:function(){return f.LANGUAGE}},{key:"channelName",get:function(){return p.LANGUAGE}}])&&We(t.prototype,n),r&&We(t,r),a}(De);const nt={API_REQUEST:"API_REQUEST",API_REPONSE:"API_RESPONSE",API_ERROR:"API_ERROR",INVALIDATE:"INVALIDATE",UPDATE:"UPDATE"};var rt,it;function at(e){const{getResponseHeader:t,responseJSON:n,status:r}=e;return{getResponseHeader:t,responseJSON:n,status:r}}!function(e){e.None="None",e.Fetching="Fetching",e.Success="Success",e.Error="Error"}(rt||(rt={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(it||(it={}));const ot=[it.POST,it.PUT];function st(e){const{resource:t,type:n,success:r,error:i,always:a}=e,o={url:t,method:n};ot.includes(n)&&e.data&&(o.data=JSON.stringify(e.data)),$.ajax(o).done((e,t,n)=>{r&&r(e,at(n))}).fail((e,t,n)=>{i&&i(at(e))}).always(()=>{a&&a()})}const ct="id";function lt(e,t={}){const{idAttribute:n=ct,namespace:r=""}=t;return e[n]||x.throw(new B("There was an issue during normalization. Object did not have an id attribute.")),`${r}__${e[n]}`}function ut(e,t,n={}){const{idAttribute:r=ct}=n,i=[];return e.forEach(e=>{e[r]&&i.push(lt(e,n)),pt(e,t,n)}),i}function pt(e,t,n={}){if(e)return Array.isArray(e)?ut(e,t,n):"object"==typeof e?function e(t,n,r={}){const{idAttribute:i=ct}=r,a=Object.assign({},t);if(Object.keys(t).forEach(o=>{const s=t[o];if(s)if(Array.isArray(s)){var c=ut(s,n,r);c.length&&(a[o]=c)}else if("object"==typeof s){var l=e(s,n,r);s[i]?a[o]=lt(s,r):a[o]=l}}),t[i]){const e=lt(t,r);return n[e]=a,e}return a}(e,t,n):e}function ft(e,t){const n={};return{result:pt(e,n,t),entities:n}}const dt={isEmpty:e=>m.isEmpty(e),values:e=>m.values(e),keys:e=>m.keys(e),deepClone:e=>(m.isArray(e)?m.map:m.mapObject)(e,e=>m.isObject(e)||m.isArray(e)?dt.deepClone(e):e),getEnumKeys:e=>Object.keys(e).filter(e=>!(parseInt(e)>=0)),isObject:e=>m.isObject(e),isEqual:(e,t)=>m.isEqual(e,t),omit:(e,t)=>m.omit(e,t)};function mt(e,t,n){if(e){if("string"==typeof e)return function(e,t,n){if(n[e])return n[e];n[e]={};const r=mt(t[e],t,n);return Object.assign(n[e],r),dt.isEmpty(n[e])&&delete n[e],n[e]}(e,t,n);if(Array.isArray(e))return e.map(e=>mt(e,t,n));if("object"==typeof e){const r={};return Object.keys(e).forEach(i=>{r[i]=mt(e[i],t,n)||e[i]}),r}}}function ht(e,t){return mt(e,t,{})}function gt(e,t){return e===t}function yt(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}function vt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt,n=null,r=null;return function(){return yt(t,n,arguments)||(r=e.apply(null,arguments)),n=arguments,r}}function bt(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}function St(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];var a=0,o=r.pop(),s=bt(r),c=e.apply(void 0,[function(){return a++,o.apply(null,arguments)}].concat(n)),l=e((function(){for(var e=[],t=s.length,n=0;n<t;n++)e.push(s[n].apply(null,arguments));return c.apply(null,e)}));return l.resultFunc=o,l.dependencies=s,l.recomputations=function(){return a},l.resetRecomputations=function(){return a=0},l}}var Et=St(vt);const Ct={currentTimestamp:()=>(new Date).valueOf(),isExpired(e,t){if(!t)return!1;const n=1e3*t;return e<Ct.currentTimestamp()-n},currentTimeOfDay(e){e||(e=new Date);const t=e.getHours();return t>=12&&t<18?"afternoon":t>=18?"evening":"morning"}};class Ot{constructor(e){this.status=e.status,this.requestTime=e.requestTime,this.cacheDuration=e.cacheDuration,this.data=e.data,this.statusCode=e.statusCode}get shouldFetch(){return this.status===rt.None||this.isExpired}get isExpired(){return Ct.isExpired(this.requestTime,this.cacheDuration)}get isFetching(){return this.status===rt.Fetching}get hasError(){return this.status===rt.Error}get isComplete(){return this.status===rt.Success||this.status===rt.Error}}function It(e,t,n){if(!e||!t)return jt();let r=t.response;return!1!==t.request.normalize&&(r=ht(t.response,n)),new Ot({status:t.status,statusCode:t.statusCode,requestTime:t.timestamp,cacheDuration:t.request.expiryTime,data:r})}function jt(){return new Ot({status:rt.None})}function At(e,t){return It(t,e.flightData.resources[t],e.flightData.entities)}function Tt(e,t){return()=>{wt(e,t)}}function wt(e,t){e({type:nt.API_REQUEST,request:t})}function Lt(e){return Tt(Object(te.useDispatch)(),e)}function kt(e,t){const n=Object(d.useMemo)(()=>{var n;return(null===(n=t)||void 0===n?void 0:n.optimize)?function(e){return St(vt,(e,t)=>{const n=["response","request"];return dt.isEqual(dt.omit(e,n),dt.omit(t,n))})(t=>t.flightData.resources[e],t=>{var n;const r=t.flightData.resources[e];return(null===(n=r)||void 0===n?void 0:n.entityIds)?r.entityIds.reduce((e,n)=>(e[n]=t.flightData.entities[n],e),{}):{}},(t,n)=>It(e,t,n))}(e):function(e){return Et(t=>t.flightData.resources[e],e=>e.flightData.entities,(t,n)=>It(e,t,n))}(e)},[e]);return Object(te.useSelector)(e=>n(e))}function _t(e,t){const n=Object(te.useDispatch)(),r=kt(e&&e.key,t),i=Tt(n,e);return e&&r.shouldFetch&&i(),r}const xt={getMatchingKeyMap(e,t,n){const r=Array.isArray(t)?t:[t];let i=[];return r.forEach(t=>{const n=new RegExp(t,"i"),r=Object.keys(e.resources).filter(e=>n.test(e));i.push(...r)}),n&&(i=i.filter(e=>e!==n)),i.reduce((e,t)=>(e[t]=!0,e),{})}};var Pt;!function(e){e[e.Ok=200]="Ok",e[e.NoContent=204]="NoContent",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.Conflict=409]="Conflict",e[e.InternalServer=500]="InternalServer"}(Pt||(Pt={}));const Nt={isSimulated(e){const t=e;return!!(t.successResponse||t.errorResponse||t.noResponse)},simulateFetchData(e,t){const{success:n,error:r,always:i}=e,a=t;window.setTimeout(()=>{a.noResponse||(a.successResponse?n(a.successResponse(),{status:Pt.Ok,getResponseHeader:e=>""}):a.errorResponse&&r(a.errorResponse()),i())},function(e){const t=e.timeout||300;return t/2+(Math.floor(Math.random()*t/2)+1)}(t))}};var Dt=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 Rt(e){const{fetchData:t,bootstrappedData:n,defaultExpiryTime:r}=e,i=Object.freeze({key:null,url:null,type:it.GET,normalize:!0,formatData:e=>e,expiryTime:r});return function(e){return r=>a=>{if(a.type!==nt.API_REQUEST)return void r(a);const o=e.getState(),s=Object.assign({},i,a.request),{success:c,error:l,always:u,formatData:p}=s,f=Dt(s,["success","error","always","formatData"]),d=o.flightData.resources[f.key];if(r(a),d&&d.status===rt.Fetching)return;if(f.bootstrapName&&n[a.request.bootstrapName])return h(n[a.request.bootstrapName]),g(),void delete n[a.request.bootstrapName];const m={resource:f.url,type:f.type,data:f.data,success:h,error:function(t){e.dispatch({type:nt.API_ERROR,errorResponse:t.responseJSON,request:a.request,timestamp:Ct.currentTimestamp(),xhr:t}),l&&l(t)},always:g};return void(Nt.isSimulated(f)?Nt.simulateFetchData(m,f):t(m));function h(t,n){const r=p(t);let i={result:r,entities:{}};if(f.normalize&&(i=ft(r,f.normalizeOptions)),e.dispatch({type:nt.API_REPONSE,result:i.result,entities:i.entities,request:f,timestamp:Ct.currentTimestamp(),xhr:n}),f.updateState){(Array.isArray(f.updateState)?f.updateState:[f.updateState]).forEach(t=>{!function(t){const n=xt.getMatchingKeyMap(o.flightData,t.keys),r=Object.assign({},Object.keys(o.flightData.resources).filter(e=>n[e]).reduce((e,t)=>{const n=o.flightData.resources[t];let r=n.response;return n.request.normalize&&(r=ht(n.response,o.flightData.entities)),e[t]=r,e},{})),i=t.updateData(r);Object.keys(i).forEach(t=>{const n=o.flightData.resources[t],r=i[t];let a={result:r,entities:{}};n.request.normalize&&(a=ft(r,n.request.normalizeOptions)),e.dispatch({type:nt.UPDATE,result:a.result,entities:a.entities,request:n.request})})}(t)})}if(!c)return;let a=i.result;f.normalize&&(a=ht(i.result,Object.assign(Object.assign({},o.flightData.entities),i.entities))),c(a)}function g(){f.invalidationKeys&&e.dispatch({type:nt.INVALIDATE,keys:f.invalidationKeys,request:f}),u&&u()}}}}function Ft(e,t){const n=Object.assign({},e);return Object.keys(t).forEach(r=>{e[r]?n[r]=Object.assign(Object.assign({},e[r]),t[r]):n[r]=t[r]}),n}const Mt={resources:{},entities:{}};function Ut(e=Mt,t){switch(t.type){case nt.API_REQUEST:return function(e,t){const n=e.resources[t.request.key];return{entities:Object.assign({},e.entities),resources:Object.assign(Object.assign({},e.resources),{[t.request.key]:{request:t.request,status:rt.Fetching,response:n?n.response:null,entityIds:n?n.entityIds:null}})}}(e,t);case nt.API_REPONSE:return function(e,t){var n;const r=t.entities?Object.keys(t.entities):[];return{entities:Ft(e.entities,t.entities),resources:Object.assign(Object.assign({},e.resources),{[t.request.key]:{request:t.request,status:rt.Success,response:t.result,timestamp:t.timestamp,statusCode:null===(n=t.xhr)||void 0===n?void 0:n.status,entityIds:r}})}}(e,t);case nt.API_ERROR:return function(e,t){var n;return{entities:Object.assign({},e.entities),resources:Object.assign(Object.assign({},e.resources),{[t.request.key]:{request:t.request,status:rt.Error,errorResponse:t.errorResponse,timestamp:t.timestamp,statusCode:null===(n=t.xhr)||void 0===n?void 0:n.status}})}}(e,t);case nt.INVALIDATE:return function(e,t){var n;const r=xt.getMatchingKeyMap(e,t.keys,null===(n=t.request)||void 0===n?void 0:n.key);return{entities:Object.assign({},e.entities),resources:Object.assign(Object.assign({},e.resources),Object.keys(e.resources).filter(e=>r[e]).reduce((t,n)=>{const r=e.resources[n];return t[n]=Object.assign({},r,{status:rt.None}),t},{}))}}(e,t);case nt.UPDATE:return function(e=Mt,t){const n=t.entities?Object.keys(t.entities):[];return{entities:Ft(e.entities,t.entities),resources:Object.assign(Object.assign({},e.resources),{[t.request.key]:Object.assign(Object.assign({},e.resources[t.request.key]),{request:t.request,response:t.result,entityIds:n})})}}(e,t)}return e}const Vt={first:e=>m.first(e),firstFew:(e,t)=>m.first(e,t),last:e=>m.last(e),lastFew:(e,t)=>m.last(e,t),max:(e,t)=>m.max(e,t),cloneAndReplaceAtIdx(e,t,n,r=null){let i=e&&e.length?e.slice():[];return t+1>i.length&&(i=[...i,...Array(t+1-i.length).fill(r)]),i.splice(t,1,n),i},moveItem(e,t,n){const r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r},isEmpty:e=>e&&!e.length,findIndex:(e,t)=>m.findIndex(e,t),where:(e,t)=>m.where(e,t),groupBy:(e,t)=>m.groupBy(e,t),flatten:(e,t)=>m.flatten(e,t),intersection:(...e)=>m.intersection(...e),addOrRemove(e,t){const n=e.indexOf(t);return-1===n?e.push(t):e.splice(n,1),e},addOrRemoveImmutable(e,t){const n=e.indexOf(t),r=dt.deepClone(e);return-1===n?[...r,t]:[...r.slice(0,n),...r.slice(n+1)]},sortBy:(e,t)=>m.sortBy(e,t),chunk:(e,t)=>m.chunk(e,t),uniq:e=>m.uniq(e)},Bt="id";function zt(e,t){return localStorage.setItem(e,JSON.stringify(t)),t}function Ht(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}const qt={getAll(e,t){let n=Ht(e);return n&&n.length?n:!n&&t?(t.forEach(t=>qt.create(e,t)),Ht(e)):[]},get(e,t){const n=qt.getAll(e);return n.length?n.find(e=>e[Bt]===t):null},create(e,t){const n=qt.getAll(e),r=Object.assign(Object.assign({},t),{[Bt]:t[Bt]||(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)+1).toString()});return n.push(r),zt(e,n),r},update(e,t){const n=qt.getAll(e);if(!n.length)return t;const r=n.findIndex(e=>e[Bt]===t[Bt]);return n[r]=t,zt(e,n),t},delete(e,t){const n=qt.getAll(e);n.length&&(Array.isArray(t)||(t=[t]),t.forEach(e=>{const t=n.findIndex(t=>t[Bt]===e);n.splice(t,1)}),zt(e,n))},assoc(e,t,n,r,i){const a=Array.isArray(i);let o=a?i:[i];"string"==typeof Vt.first(o)&&(o=qt.getAll(r).filter(e=>o.includes(e.id)));const s=o.map(e=>e.id?e:qt.create(r,e));let c=qt.getAll(e);if(!c.length)return;let l=c.find(e=>e.id===t);return l?(s.forEach(e=>{if(l[n])if(Array.isArray(l[n])){if(l[n].find(t=>t.id===e.id))return;l[n].push(e)}else l[n]=e;else l[n]=a?[e]:e}),c=c.map(e=>e.id!==l.id?e:l),zt(e,c),a?s:Vt.first(s)):void 0},dissoc(e,t,n,r){let i=qt.getAll(e);if(!i.length)return;let a=i.find(e=>e.id===t);if(!a)return;let o=a[n];return o?(Array.isArray(r)||(r=[r]),Array.isArray(o)||(o=[o]),r.forEach(e=>{const t=o.findIndex(t=>t.id===e);o.splice(t,1)}),a[n]=o,i=i.map(e=>e.id!==a.id?e:a),zt(e,i),i):void 0}};var Jt=function(e){var t="/api/master/v2/companies";return e?"".concat(t,"?cursor=").concat(e):t},$t=function(e){return"/api/master/v2/objects/".concat(e)},Kt=function(){return"/api/master/v2/companies"},Yt=function(e){return"/api/master/v2/objects/".concat(e)},Gt="companies",Wt="company",Zt="update:company",Qt=function(e){return{key:"".concat(Gt).concat(e?":".concat(e):""),url:Jt(e)}},Xt=function(e){return{key:"".concat(Wt,":").concat(e),url:$t(e)}},en=function(e,t,n){return{key:Wt,url:Kt(),data:e,type:it.POST,success:t,error:n,invalidationKeys:[Gt]}},tn=function(e,t,n){return{key:"".concat(Zt,":").concat(e),url:Yt(e),data:t,type:it.PUT,always:n}},nn=n(12),rn=n.n(nn),an=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===on}(e)}(e)};var on="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function sn(e,t){return!1!==t.clone&&t.isMergeableObject(e)?ln((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function cn(e,t,n){return e.concat(t).map((function(e){return sn(e,n)}))}function ln(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||cn,n.isMergeableObject=n.isMergeableObject||an;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):function(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach((function(t){r[t]=sn(e[t],n)})),Object.keys(t).forEach((function(i){n.isMergeableObject(t[i])&&e[i]?r[i]=ln(e[i],t[i],n):r[i]=sn(t[i],n)})),r}(e,t,n):sn(t,n)}ln.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return ln(e,n,t)}),{})};var un=ln,pn=n(6),fn=pn.a.Symbol,dn=Object.prototype,mn=dn.hasOwnProperty,hn=dn.toString,gn=fn?fn.toStringTag:void 0;var yn=function(e){var t=mn.call(e,gn),n=e[gn];try{e[gn]=void 0;var r=!0}catch(e){}var i=hn.call(e);return r&&(t?e[gn]=n:delete e[gn]),i},vn=Object.prototype.toString;var bn=function(e){return vn.call(e)},Sn=fn?fn.toStringTag:void 0;var En=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Sn&&Sn in Object(e)?yn(e):bn(e)};var Cn=function(e,t){return function(n){return e(t(n))}},On=Cn(Object.getPrototypeOf,Object);var In=function(e){return null!=e&&"object"==typeof e},jn=Function.prototype,An=Object.prototype,Tn=jn.toString,wn=An.hasOwnProperty,Ln=Tn.call(Object);var kn=function(e){if(!In(e)||"[object Object]"!=En(e))return!1;var t=On(e);if(null===t)return!0;var n=wn.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Tn.call(n)==Ln};var _n=function(){this.__data__=[],this.size=0};var xn=function(e,t){return e===t||e!=e&&t!=t};var Pn=function(e,t){for(var n=e.length;n--;)if(xn(e[n][0],t))return n;return-1},Nn=Array.prototype.splice;var Dn=function(e){var t=this.__data__,n=Pn(t,e);return!(n<0)&&(n==t.length-1?t.pop():Nn.call(t,n,1),--this.size,!0)};var Rn=function(e){var t=this.__data__,n=Pn(t,e);return n<0?void 0:t[n][1]};var Fn=function(e){return Pn(this.__data__,e)>-1};var Mn=function(e,t){var n=this.__data__,r=Pn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Un.prototype.clear=_n,Un.prototype.delete=Dn,Un.prototype.get=Rn,Un.prototype.has=Fn,Un.prototype.set=Mn;var Vn=Un;var Bn=function(){this.__data__=new Vn,this.size=0};var zn=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var Hn=function(e){return this.__data__.get(e)};var qn=function(e){return this.__data__.has(e)};var Jn=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var $n,Kn=function(e){if(!Jn(e))return!1;var t=En(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Yn=pn.a["__core-js_shared__"],Gn=($n=/[^.]+$/.exec(Yn&&Yn.keys&&Yn.keys.IE_PROTO||""))?"Symbol(src)_1."+$n:"";var Wn=function(e){return!!Gn&&Gn in e},Zn=Function.prototype.toString;var Qn=function(e){if(null!=e){try{return Zn.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Xn=/^\[object .+?Constructor\]$/,er=Function.prototype,tr=Object.prototype,nr=er.toString,rr=tr.hasOwnProperty,ir=RegExp("^"+nr.call(rr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ar=function(e){return!(!Jn(e)||Wn(e))&&(Kn(e)?ir:Xn).test(Qn(e))};var or=function(e,t){return null==e?void 0:e[t]};var sr=function(e,t){var n=or(e,t);return ar(n)?n:void 0},cr=sr(pn.a,"Map"),lr=sr(Object,"create");var ur=function(){this.__data__=lr?lr(null):{},this.size=0};var pr=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},fr=Object.prototype.hasOwnProperty;var dr=function(e){var t=this.__data__;if(lr){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return fr.call(t,e)?t[e]:void 0},mr=Object.prototype.hasOwnProperty;var hr=function(e){var t=this.__data__;return lr?void 0!==t[e]:mr.call(t,e)};var gr=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=lr&&void 0===t?"__lodash_hash_undefined__":t,this};function yr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}yr.prototype.clear=ur,yr.prototype.delete=pr,yr.prototype.get=dr,yr.prototype.has=hr,yr.prototype.set=gr;var vr=yr;var br=function(){this.size=0,this.__data__={hash:new vr,map:new(cr||Vn),string:new vr}};var Sr=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Er=function(e,t){var n=e.__data__;return Sr(t)?n["string"==typeof t?"string":"hash"]:n.map};var Cr=function(e){var t=Er(this,e).delete(e);return this.size-=t?1:0,t};var Or=function(e){return Er(this,e).get(e)};var Ir=function(e){return Er(this,e).has(e)};var jr=function(e,t){var n=Er(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function Ar(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ar.prototype.clear=br,Ar.prototype.delete=Cr,Ar.prototype.get=Or,Ar.prototype.has=Ir,Ar.prototype.set=jr;var Tr=Ar;var wr=function(e,t){var n=this.__data__;if(n instanceof Vn){var r=n.__data__;if(!cr||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Tr(r)}return n.set(e,t),this.size=n.size,this};function Lr(e){var t=this.__data__=new Vn(e);this.size=t.size}Lr.prototype.clear=Bn,Lr.prototype.delete=zn,Lr.prototype.get=Hn,Lr.prototype.has=qn,Lr.prototype.set=wr;var kr=Lr;var _r=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e},xr=function(){try{var e=sr(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Pr=function(e,t,n){"__proto__"==t&&xr?xr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Nr=Object.prototype.hasOwnProperty;var Dr=function(e,t,n){var r=e[t];Nr.call(e,t)&&xn(r,n)&&(void 0!==n||t in e)||Pr(e,t,n)};var Rr=function(e,t,n,r){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;void 0===c&&(c=e[s]),i?Pr(n,s,c):Dr(n,s,c)}return n};var Fr=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};var Mr=function(e){return In(e)&&"[object Arguments]"==En(e)},Ur=Object.prototype,Vr=Ur.hasOwnProperty,Br=Ur.propertyIsEnumerable,zr=Mr(function(){return arguments}())?Mr:function(e){return In(e)&&Vr.call(e,"callee")&&!Br.call(e,"callee")},Hr=Array.isArray,qr=n(20),Jr=/^(?:0|[1-9]\d*)$/;var $r=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Jr.test(e))&&e>-1&&e%1==0&&e<t};var Kr=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Yr={};Yr["[object Float32Array]"]=Yr["[object Float64Array]"]=Yr["[object Int8Array]"]=Yr["[object Int16Array]"]=Yr["[object Int32Array]"]=Yr["[object Uint8Array]"]=Yr["[object Uint8ClampedArray]"]=Yr["[object Uint16Array]"]=Yr["[object Uint32Array]"]=!0,Yr["[object Arguments]"]=Yr["[object Array]"]=Yr["[object ArrayBuffer]"]=Yr["[object Boolean]"]=Yr["[object DataView]"]=Yr["[object Date]"]=Yr["[object Error]"]=Yr["[object Function]"]=Yr["[object Map]"]=Yr["[object Number]"]=Yr["[object Object]"]=Yr["[object RegExp]"]=Yr["[object Set]"]=Yr["[object String]"]=Yr["[object WeakMap]"]=!1;var Gr=function(e){return In(e)&&Kr(e.length)&&!!Yr[En(e)]};var Wr=function(e){return function(t){return e(t)}},Zr=n(10),Qr=Zr.a&&Zr.a.isTypedArray,Xr=Qr?Wr(Qr):Gr,ei=Object.prototype.hasOwnProperty;var ti=function(e,t){var n=Hr(e),r=!n&&zr(e),i=!n&&!r&&Object(qr.a)(e),a=!n&&!r&&!i&&Xr(e),o=n||r||i||a,s=o?Fr(e.length,String):[],c=s.length;for(var l in e)!t&&!ei.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||$r(l,c))||s.push(l);return s},ni=Object.prototype;var ri=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ni)},ii=Cn(Object.keys,Object),ai=Object.prototype.hasOwnProperty;var oi=function(e){if(!ri(e))return ii(e);var t=[];for(var n in Object(e))ai.call(e,n)&&"constructor"!=n&&t.push(n);return t};var si=function(e){return null!=e&&Kr(e.length)&&!Kn(e)};var ci=function(e){return si(e)?ti(e):oi(e)};var li=function(e,t){return e&&Rr(t,ci(t),e)};var ui=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},pi=Object.prototype.hasOwnProperty;var fi=function(e){if(!Jn(e))return ui(e);var t=ri(e),n=[];for(var r in e)("constructor"!=r||!t&&pi.call(e,r))&&n.push(r);return n};var di=function(e){return si(e)?ti(e,!0):fi(e)};var mi=function(e,t){return e&&Rr(t,di(t),e)},hi=n(123);var gi=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var yi=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a};var vi=function(){return[]},bi=Object.prototype.propertyIsEnumerable,Si=Object.getOwnPropertySymbols,Ei=Si?function(e){return null==e?[]:(e=Object(e),yi(Si(e),(function(t){return bi.call(e,t)})))}:vi;var Ci=function(e,t){return Rr(e,Ei(e),t)};var Oi=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},Ii=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Oi(t,Ei(e)),e=On(e);return t}:vi;var ji=function(e,t){return Rr(e,Ii(e),t)};var Ai=function(e,t,n){var r=t(e);return Hr(e)?r:Oi(r,n(e))};var Ti=function(e){return Ai(e,ci,Ei)};var wi=function(e){return Ai(e,di,Ii)},Li=sr(pn.a,"DataView"),ki=sr(pn.a,"Promise"),_i=sr(pn.a,"Set"),xi=sr(pn.a,"WeakMap"),Pi=Qn(Li),Ni=Qn(cr),Di=Qn(ki),Ri=Qn(_i),Fi=Qn(xi),Mi=En;(Li&&"[object DataView]"!=Mi(new Li(new ArrayBuffer(1)))||cr&&"[object Map]"!=Mi(new cr)||ki&&"[object Promise]"!=Mi(ki.resolve())||_i&&"[object Set]"!=Mi(new _i)||xi&&"[object WeakMap]"!=Mi(new xi))&&(Mi=function(e){var t=En(e),n="[object Object]"==t?e.constructor:void 0,r=n?Qn(n):"";if(r)switch(r){case Pi:return"[object DataView]";case Ni:return"[object Map]";case Di:return"[object Promise]";case Ri:return"[object Set]";case Fi:return"[object WeakMap]"}return t});var Ui=Mi,Vi=Object.prototype.hasOwnProperty;var Bi=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Vi.call(e,"index")&&(n.index=e.index,n.input=e.input),n},zi=pn.a.Uint8Array;var Hi=function(e){var t=new e.constructor(e.byteLength);return new zi(t).set(new zi(e)),t};var qi=function(e,t){var n=t?Hi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},Ji=/\w*$/;var $i=function(e){var t=new e.constructor(e.source,Ji.exec(e));return t.lastIndex=e.lastIndex,t},Ki=fn?fn.prototype:void 0,Yi=Ki?Ki.valueOf:void 0;var Gi=function(e){return Yi?Object(Yi.call(e)):{}};var Wi=function(e,t){var n=t?Hi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};var Zi=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return Hi(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return qi(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Wi(e,n);case"[object Map]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return $i(e);case"[object Set]":return new r;case"[object Symbol]":return Gi(e)}},Qi=Object.create,Xi=function(){function e(){}return function(t){if(!Jn(t))return{};if(Qi)return Qi(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var ea=function(e){return"function"!=typeof e.constructor||ri(e)?{}:Xi(On(e))};var ta=function(e){return In(e)&&"[object Map]"==Ui(e)},na=Zr.a&&Zr.a.isMap,ra=na?Wr(na):ta;var ia=function(e){return In(e)&&"[object Set]"==Ui(e)},aa=Zr.a&&Zr.a.isSet,oa=aa?Wr(aa):ia,sa={};sa["[object Arguments]"]=sa["[object Array]"]=sa["[object ArrayBuffer]"]=sa["[object DataView]"]=sa["[object Boolean]"]=sa["[object Date]"]=sa["[object Float32Array]"]=sa["[object Float64Array]"]=sa["[object Int8Array]"]=sa["[object Int16Array]"]=sa["[object Int32Array]"]=sa["[object Map]"]=sa["[object Number]"]=sa["[object Object]"]=sa["[object RegExp]"]=sa["[object Set]"]=sa["[object String]"]=sa["[object Symbol]"]=sa["[object Uint8Array]"]=sa["[object Uint8ClampedArray]"]=sa["[object Uint16Array]"]=sa["[object Uint32Array]"]=!0,sa["[object Error]"]=sa["[object Function]"]=sa["[object WeakMap]"]=!1;var ca=function e(t,n,r,i,a,o){var s,c=1&n,l=2&n,u=4&n;if(r&&(s=a?r(t,i,a,o):r(t)),void 0!==s)return s;if(!Jn(t))return t;var p=Hr(t);if(p){if(s=Bi(t),!c)return gi(t,s)}else{var f=Ui(t),d="[object Function]"==f||"[object GeneratorFunction]"==f;if(Object(qr.a)(t))return Object(hi.a)(t,c);if("[object Object]"==f||"[object Arguments]"==f||d&&!a){if(s=l||d?{}:ea(t),!c)return l?ji(t,mi(s,t)):Ci(t,li(s,t))}else{if(!sa[f])return a?t:{};s=Zi(t,f,c)}}o||(o=new kr);var m=o.get(t);if(m)return m;o.set(t,s),oa(t)?t.forEach((function(i){s.add(e(i,n,r,i,t,o))})):ra(t)&&t.forEach((function(i,a){s.set(a,e(i,n,r,a,t,o))}));var h=u?l?wi:Ti:l?keysIn:ci,g=p?void 0:h(t);return _r(g||t,(function(i,a){g&&(i=t[a=i]),Dr(s,a,e(i,n,r,a,t,o))})),s};var la=function(e){return ca(e,4)};var ua=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i};var pa=function(e){return"symbol"==typeof e||In(e)&&"[object Symbol]"==En(e)};function fa(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(fa.Cache||Tr),n}fa.Cache=Tr;var da=fa;var ma=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ha=/\\(\\)?/g,ga=function(e){var t=da(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ma,(function(e,n,r,i){t.push(r?i.replace(ha,"$1"):n||e)})),t}));var ya=function(e){if("string"==typeof e||pa(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},va=fn?fn.prototype:void 0,ba=va?va.toString:void 0;var Sa=function e(t){if("string"==typeof t)return t;if(Hr(t))return ua(t,e)+"";if(pa(t))return ba?ba.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};var Ea=function(e){return null==e?"":Sa(e)};var Ca=function(e){return Hr(e)?ua(e,ya):pa(e)?[e]:gi(ga(Ea(e)))};var Oa=function(e,t){},Ia=n(29),ja=n(30),Aa=n.n(ja);var Ta=function(e){return ca(e,5)};function wa(){return(wa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function La(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function ka(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function _a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var xa=function(e){return"function"==typeof e},Pa=function(e){return null!==e&&"object"==typeof e},Na=function(e){return String(Math.floor(Number(e)))===e},Da=function(e){return"[object String]"===Object.prototype.toString.call(e)},Ra=function(e){return 0===d.Children.count(e)},Fa=function(e){return Pa(e)&&xa(e.then)};function Ma(e,t,n,r){void 0===r&&(r=0);for(var i=Ca(t);e&&r<i.length;)e=e[i[r++]];return void 0===e?n:e}function Ua(e,t,n){for(var r=la(e),i=r,a=0,o=Ca(t);a<o.length-1;a++){var s=o[a],c=Ma(e,o.slice(0,a+1));if(c&&(Pa(c)||Array.isArray(c)))i=i[s]=la(c);else{var l=o[a+1];i=i[s]=Na(l)&&Number(l)>=0?[]:{}}}return(0===a?e:i)[o[a]]===n?e:(void 0===n?delete i[o[a]]:i[o[a]]=n,0===a&&void 0===n&&delete r[o[a]],r)}function Va(e,t,n,r){void 0===n&&(n=new WeakMap),void 0===r&&(r={});for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],s=e[o];Pa(s)?n.get(s)||(n.set(s,!0),r[o]=Array.isArray(s)?[]:{},Va(s,t,n,r[o])):r[o]=t}return r}var Ba=Object(d.createContext)(void 0),za=Ba.Provider,Ha=Ba.Consumer;function qa(){var e=Object(d.useContext)(Ba);return e||Oa(!1),e}function Ja(e,t){switch(t.type){case"SET_VALUES":return wa({},e,{values:t.payload});case"SET_TOUCHED":return wa({},e,{touched:t.payload});case"SET_ERRORS":return wa({},e,{errors:t.payload});case"SET_STATUS":return wa({},e,{status:t.payload});case"SET_ISSUBMITTING":return wa({},e,{isSubmitting:t.payload});case"SET_ISVALIDATING":return wa({},e,{isValidating:t.payload});case"SET_FIELD_VALUE":return wa({},e,{values:Ua(e.values,t.payload.field,t.payload.value)});case"SET_FIELD_TOUCHED":return wa({},e,{touched:Ua(e.touched,t.payload.field,t.payload.value)});case"SET_FIELD_ERROR":return wa({},e,{errors:Ua(e.errors,t.payload.field,t.payload.value)});case"RESET_FORM":return wa({},e,t.payload);case"SET_FORMIK_STATE":return t.payload(e);case"SUBMIT_ATTEMPT":return wa({},e,{touched:Va(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return wa({},e,{isSubmitting:!1});default:return e}}var $a={},Ka={};function Ya(e){var t=e.validateOnChange,n=void 0===t||t,r=e.validateOnBlur,i=void 0===r||r,a=e.validateOnMount,o=void 0!==a&&a,s=e.isInitialValid,c=e.enableReinitialize,l=void 0!==c&&c,u=e.onSubmit,p=ka(e,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),f=wa({validateOnChange:n,validateOnBlur:i,validateOnMount:o,onSubmit:u},p),m=Object(d.useRef)(f.initialValues),h=Object(d.useRef)(f.initialErrors||$a),g=Object(d.useRef)(f.initialTouched||Ka),y=Object(d.useRef)(f.initialStatus),v=Object(d.useRef)(!1),b=Object(d.useRef)({});Object(d.useEffect)((function(){0}),[]),Object(d.useEffect)((function(){return v.current=!0,function(){v.current=!1}}),[]);var S=Object(d.useReducer)(Ja,{values:f.initialValues,errors:f.initialErrors||$a,touched:f.initialTouched||Ka,status:f.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),E=S[0],C=S[1],O=Object(d.useCallback)((function(e,t){return new Promise((function(n,r){var i=f.validate(e,t);null==i?n($a):Fa(i)?i.then((function(e){n(e||$a)}),(function(e){r(e)})):n(i)}))}),[f.validate]),I=Object(d.useCallback)((function(e,t){var n=f.validationSchema,r=xa(n)?n(t):n,i=t&&r.validateAt?r.validateAt(t,e):function(e,t,n,r){void 0===n&&(n=!1);void 0===r&&(r={});var i=function e(t){var n={};for(var r in t)if(t.hasOwnProperty(r)){var i=String(r);!0===Array.isArray(t[i])?n[i]=t[i].map((function(t){return!0===Array.isArray(t)||kn(t)?e(t):""!==t?t:void 0})):kn(t[i])?n[i]=e(t[i]):n[i]=""!==t[i]?t[i]:void 0}return n}(e);return t[n?"validateSync":"validate"](i,{abortEarly:!1,context:r})}(e,r);return new Promise((function(e,t){i.then((function(){e($a)}),(function(n){"ValidationError"===n.name?e(function(e){var t={};if(e.inner){if(0===e.inner.length)return Ua(t,e.path,e.message);var n=e.inner,r=Array.isArray(n),i=0;for(n=r?n:n[Symbol.iterator]();;){var a;if(r){if(i>=n.length)break;a=n[i++]}else{if((i=n.next()).done)break;a=i.value}var o=a;Ma(t,o.path)||(t=Ua(t,o.path,o.message))}}return t}(n)):t(n)}))}))}),[f.validationSchema]),j=Object(d.useCallback)((function(e,t){return new Promise((function(n){return n(b.current[e].validate(t))}))}),[]),A=Object(d.useCallback)((function(e){var t=Object.keys(b.current).filter((function(e){return xa(b.current[e].validate)})),n=t.length>0?t.map((function(t){return j(t,Ma(e,t))})):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(n).then((function(e){return e.reduce((function(e,n,r){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===n||n&&(e=Ua(e,t[r],n)),e}),{})}))}),[j]),T=Object(d.useCallback)((function(e){return Promise.all([A(e),f.validationSchema?I(e):{},f.validate?O(e):{}]).then((function(e){var t=e[0],n=e[1],r=e[2];return un.all([t,n,r],{arrayMerge:Wa})}))}),[f.validate,f.validationSchema,A,O,I]),w=Qa((function(e){return void 0===e&&(e=E.values),Object(Ia.unstable_runWithPriority)(Ia.LowPriority,(function(){return T(e).then((function(e){return v.current&&C({type:"SET_ERRORS",payload:e}),e}))}))})),L=Qa((function(e){return void 0===e&&(e=E.values),C({type:"SET_ISVALIDATING",payload:!0}),T(e).then((function(e){return v.current&&(C({type:"SET_ISVALIDATING",payload:!1}),rn()(E.errors,e)||C({type:"SET_ERRORS",payload:e})),e}))}));Object(d.useEffect)((function(){o&&!0===v.current&&w(f.initialValues)}),[f.initialValues,o,w]);var k=Object(d.useCallback)((function(e){var t=e&&e.values?e.values:m.current,n=e&&e.errors?e.errors:h.current?h.current:f.initialErrors||{},r=e&&e.touched?e.touched:g.current?g.current:f.initialTouched||{},i=e&&e.status?e.status:y.current?y.current:f.initialStatus;m.current=t,h.current=n,g.current=r,y.current=i,C({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:n,touched:r,status:i,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})}),[f.initialErrors,f.initialStatus,f.initialTouched]);Object(d.useEffect)((function(){l&&!0===v.current&&!rn()(m.current,f.initialValues)&&(m.current=f.initialValues,k())}),[l,f.initialValues,k]),Object(d.useEffect)((function(){l&&!0===v.current&&!rn()(h.current,f.initialErrors)&&(h.current=f.initialErrors||$a,C({type:"SET_ERRORS",payload:f.initialErrors||$a}))}),[l,f.initialErrors]),Object(d.useEffect)((function(){l&&!0===v.current&&!rn()(g.current,f.initialTouched)&&(g.current=f.initialTouched||Ka,C({type:"SET_TOUCHED",payload:f.initialTouched||Ka}))}),[l,f.initialTouched]),Object(d.useEffect)((function(){l&&!0===v.current&&!rn()(y.current,f.initialStatus)&&(y.current=f.initialStatus,C({type:"SET_STATUS",payload:f.initialStatus}))}),[l,f.initialStatus,f.initialTouched]);var _=Qa((function(e){if(xa(b.current[e].validate)){var t=Ma(E.values,e),n=b.current[e].validate(t);return Fa(n)?(C({type:"SET_ISVALIDATING",payload:!0}),n.then((function(e){return e})).then((function(t){C({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),C({type:"SET_ISVALIDATING",payload:!1})}))):(C({type:"SET_FIELD_ERROR",payload:{field:e,value:n}}),Promise.resolve(n))}return Promise.resolve()})),x=Object(d.useCallback)((function(e,t){var n=t.validate;b.current[e]={validate:n}}),[]),P=Object(d.useCallback)((function(e){delete b.current[e]}),[]),N=Qa((function(e){return C({type:"SET_TOUCHED",payload:e}),i?w(E.values):Promise.resolve()})),D=Object(d.useCallback)((function(e){C({type:"SET_ERRORS",payload:e})}),[]),R=Qa((function(e){return C({type:"SET_VALUES",payload:e}),n?w(e):Promise.resolve()})),F=Object(d.useCallback)((function(e,t){C({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})}),[]),M=Qa((function(e,t,r){return void 0===r&&(r=!0),C({type:"SET_FIELD_VALUE",payload:{field:e,value:t}}),n&&r?w(Ua(E.values,e,t)):Promise.resolve()})),U=Object(d.useCallback)((function(e,t){var n,r=t,i=e;if(!Da(e)){e.persist&&e.persist();var a=e.target,o=a.type,s=a.name,c=a.id,l=a.value,u=a.checked,p=(a.outerHTML,a.options),f=a.multiple;r=t||(s||c),i=/number|range/.test(o)?(n=parseFloat(l),isNaN(n)?"":n):/checkbox/.test(o)?function(e,t,n){if("true"==n||"false"==n)return!!t;if(t&&n)return Array.isArray(e)?e.concat(n):[n];if(!Array.isArray(e))return!e;var r=e.indexOf(n);if(r<0)return e;return e.slice(0,r).concat(e.slice(r+1))}(Ma(E.values,r),u,l):f?function(e){return Array.from(e).filter((function(e){return e.selected})).map((function(e){return e.value}))}(p):l}r&&M(r,i)}),[M,E.values]),V=Object(d.useCallback)((function(e){if(Da(e))return function(t){return U(t,e)};U(e)}),[U]),B=Qa((function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n=!0),C({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}}),i&&n?w(E.values):Promise.resolve()})),z=Object(d.useCallback)((function(e,t){e.persist&&e.persist();var n=e.target,r=n.name,i=n.id,a=(n.outerHTML,t||(r||i));B(a,!0)}),[B]),H=Object(d.useCallback)((function(e){if(Da(e))return function(t){return z(t,e)};z(e)}),[z]),q=Object(d.useCallback)((function(e){xa(e)?C({type:"SET_FORMIK_STATE",payload:e}):C({type:"SET_FORMIK_STATE",payload:function(){return e}})}),[]),J=Object(d.useCallback)((function(e){C({type:"SET_STATUS",payload:e})}),[]),$=Object(d.useCallback)((function(e){C({type:"SET_ISSUBMITTING",payload:e})}),[]),K={resetForm:k,validateForm:L,validateField:_,setErrors:D,setFieldError:F,setFieldTouched:B,setFieldValue:M,setStatus:J,setSubmitting:$,setTouched:N,setValues:R,setFormikState:q},Y=Qa((function(){return u(E.values,K)})),G=Qa((function(){return C({type:"SUBMIT_ATTEMPT"}),L().then((function(e){if(0===Object.keys(e).length){var t=Y();if(void 0===t)return;return Promise.resolve(t).then((function(){v.current&&C({type:"SUBMIT_SUCCESS"})})).catch((function(e){if(v.current)throw C({type:"SUBMIT_FAILURE"}),e}))}v.current&&C({type:"SUBMIT_FAILURE"})}))})),W=Qa((function(e){e&&e.preventDefault&&xa(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&xa(e.stopPropagation)&&e.stopPropagation(),G()})),Z=Qa((function(e){if(e&&e.preventDefault&&xa(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&xa(e.stopPropagation)&&e.stopPropagation(),f.onReset){var t=f.onReset(E.values,K);Fa(t)?t.then(k):k()}else k()})),Q=Object(d.useCallback)((function(e){return{value:Ma(E.values,e),error:Ma(E.errors,e),touched:!!Ma(E.touched,e),initialValue:Ma(m.current,e),initialTouched:!!Ma(g.current,e),initialError:Ma(h.current,e)}}),[E.errors,E.touched,E.values]),X=Object(d.useCallback)((function(e){var t=Pa(e),n=t?e.name:e,r=Ma(E.values,n),i={name:n,value:r,onChange:V,onBlur:H};if(t){var a=e.type,o=e.value,s=e.as,c=e.multiple;"checkbox"===a?void 0===o?i.checked=!!r:(i.checked=!(!Array.isArray(r)||!~r.indexOf(o)),i.value=o):"radio"===a?(i.checked=r===o,i.value=o):"select"===s&&c&&(i.value=i.value||[],i.multiple=!0)}return i}),[H,V,E.values]),ee=Object(d.useMemo)((function(){return!rn()(m.current,E.values)}),[E.values]),te=Object(d.useMemo)((function(){return void 0!==s?ee?E.errors&&0===Object.keys(E.errors).length:!1!==s&&xa(s)?s(f):s:E.errors&&0===Object.keys(E.errors).length}),[s,ee,E.errors,f]);return wa({},E,{initialValues:m.current,initialErrors:h.current,initialTouched:g.current,initialStatus:y.current,handleBlur:H,handleChange:V,handleReset:Z,handleSubmit:W,resetForm:k,setErrors:D,setFormikState:q,setFieldTouched:B,setFieldValue:M,setFieldError:F,setStatus:J,setSubmitting:$,setTouched:N,setValues:R,submitForm:G,validateForm:L,validateField:_,isValid:te,dirty:ee,unregisterField:P,registerField:x,getFieldProps:X,getFieldMeta:Q,validateOnBlur:i,validateOnChange:n,validateOnMount:o})}function Ga(e){var t=Ya(e),n=e.component,r=e.children,i=e.render;return Object(d.useEffect)((function(){0}),[]),Object(d.createElement)(za,{value:t},n?Object(d.createElement)(n,t):i?i(t):r?xa(r)?r(t):Ra(r)?null:d.Children.only(r):null)}function Wa(e,t,n){var r=e.slice();return t.forEach((function(t,i){if(void 0===r[i]){var a=!1!==n.clone&&n.isMergeableObject(t);r[i]=a?un(Array.isArray(t)?[]:{},t,n):t}else n.isMergeableObject(t)?r[i]=un(e[i],t,n):-1===e.indexOf(t)&&r.push(t)})),r}var Za="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?d.useLayoutEffect:d.useEffect;function Qa(e){var t=Object(d.useRef)(e);return Za((function(){t.current=e})),Object(d.useCallback)((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.current.apply(void 0,n)}),[])}function Xa(e){var t=e.validate,n=e.name,r=e.render,i=e.children,a=e.as,o=e.component,s=ka(e,["validate","name","render","children","as","component"]),c=qa(),l=(c.validate,c.validationSchema,ka(c,["validate","validationSchema"]));Object(d.useEffect)((function(){0}),[]);var u=l.registerField,p=l.unregisterField;Object(d.useEffect)((function(){return u(n,{validate:t}),function(){p(n)}}),[u,p,n,t]);var f=l.getFieldProps(wa({name:n},s)),m=l.getFieldMeta(n),h={field:f,form:l};if(r)return r(wa({},h,{meta:m}));if(xa(i))return i(wa({},h,{meta:m}));if(o){if("string"==typeof o){var g=s.innerRef,y=ka(s,["innerRef"]);return Object(d.createElement)(o,wa({ref:g},f,y),i)}return Object(d.createElement)(o,wa({field:f,form:l},s),i)}var v=a||"input";if("string"==typeof v){var b=s.innerRef,S=ka(s,["innerRef"]);return Object(d.createElement)(v,wa({ref:b},f,S),i)}return Object(d.createElement)(v,wa({},f,s),i)}var eo=Object(d.forwardRef)((function(e,t){var n=e.action,r=ka(e,["action"]),i=n||"#",a=qa(),o=a.handleReset,s=a.handleSubmit;return Object(d.createElement)("form",Object.assign({onSubmit:s,ref:t,onReset:o,action:i},r))}));function to(e){var t=function(t){return Object(d.createElement)(Ha,null,(function(n){return n||Oa(!1),Object(d.createElement)(e,Object.assign({},t,{formik:n}))}))},n=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return t.WrappedComponent=e,t.displayName="FormikConnect("+n+")",Aa()(t,e)}eo.displayName="Form";var no=function(e,t,n){var r=ro(e);return r.splice(t,0,n),r},ro=function(e){if(e){if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map((function(e){return parseInt(e)})).reduce((function(e,t){return t>e?t:e}),0);return Array.from(wa({},e,{length:t+1}))}return[]},io=function(e){function t(t){var n;return(n=e.call(this,t)||this).updateArrayField=function(e,t,r){var i=n.props,a=i.name,o=i.validateOnChange,s=i.formik,c=s.setFormikState,l=s.validateForm;c((function(n){var i="function"==typeof r?r:e,o="function"==typeof t?t:e;return wa({},n,{values:Ua(n.values,a,e(Ma(n.values,a))),errors:r?Ua(n.errors,a,i(Ma(n.errors,a))):n.errors,touched:t?Ua(n.touched,a,o(Ma(n.touched,a))):n.touched})}),(function(){o&&l()}))},n.push=function(e){return n.updateArrayField((function(t){return[].concat(ro(t),[Ta(e)])}),!1,!1)},n.handlePush=function(e){return function(){return n.push(e)}},n.swap=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=ro(e),i=r[t];return r[t]=r[n],r[n]=i,r}(n,e,t)}),!0,!0)},n.handleSwap=function(e,t){return function(){return n.swap(e,t)}},n.move=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=ro(e),i=r[t];return r.splice(t,1),r.splice(n,0,i),r}(n,e,t)}),!0,!0)},n.handleMove=function(e,t){return function(){return n.move(e,t)}},n.insert=function(e,t){return n.updateArrayField((function(n){return no(n,e,t)}),(function(t){return no(t,e,null)}),(function(t){return no(t,e,null)}))},n.handleInsert=function(e,t){return function(){return n.insert(e,t)}},n.replace=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=ro(e);return r[t]=n,r}(n,e,t)}),!1,!1)},n.handleReplace=function(e,t){return function(){return n.replace(e,t)}},n.unshift=function(e){var t=-1;return n.updateArrayField((function(n){var r=n?[e].concat(n):[e];return t<0&&(t=r.length),r}),(function(e){var n=e?[null].concat(e):[null];return t<0&&(t=n.length),n}),(function(e){var n=e?[null].concat(e):[null];return t<0&&(t=n.length),n})),t},n.handleUnshift=function(e){return function(){return n.unshift(e)}},n.handleRemove=function(e){return function(){return n.remove(e)}},n.handlePop=function(){return function(){return n.pop()}},n.remove=n.remove.bind(_a(n)),n.pop=n.pop.bind(_a(n)),n}La(t,e);var n=t.prototype;return n.remove=function(e){var t;return this.updateArrayField((function(n){var r=n?ro(n):[];return t||(t=r[e]),xa(r.splice)&&r.splice(e,1),r}),!0,!0),t},n.pop=function(){var e;return this.updateArrayField((function(t){var n=t;return e||(e=n&&n.pop&&n.pop()),n}),!0,!0),e},n.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},t=this.props,n=t.component,r=t.render,i=t.children,a=t.name,o=t.formik,s=(o.validate,o.validationSchema,wa({},e,{form:ka(o,["validate","validationSchema"]),name:a}));return n?Object(d.createElement)(n,s):r?r(s):i?"function"==typeof i?i(s):Ra(i)?null:d.Children.only(i):null},t}(d.Component);io.defaultProps={validateOnChange:!0};var ao=to(function(e){function t(){return e.apply(this,arguments)||this}La(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return Ma(this.props.formik.errors,this.props.name)!==Ma(e.formik.errors,this.props.name)||Ma(this.props.formik.touched,this.props.name)!==Ma(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},n.render=function(){var e=this.props,t=e.component,n=e.formik,r=e.render,i=e.children,a=e.name,o=ka(e,["component","formik","render","children","name"]),s=Ma(n.touched,a),c=Ma(n.errors,a);return s&&c?r?xa(r)?r(c):null:i?xa(i)?i(c):null:t?Object(d.createElement)(t,o,c):c:null},t}(d.Component));(function(e){function t(t){var n;n=e.call(this,t)||this;var r=t.render,i=t.children,a=t.component,o=t.as;t.name;return r&&Oa(!1),a&&r&&Oa(!1),o&&i&&xa(i)&&Oa(!1),a&&i&&xa(i)&&Oa(!1),r&&i&&!Ra(i)&&Oa(!1),n}La(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e,t,n){return this.props.shouldUpdate?this.props.shouldUpdate(e,this.props):Ma(this.context.values,this.props.name)!==Ma(n.values,this.props.name)||Ma(this.context.errors,this.props.name)!==Ma(n.errors,this.props.name)||Ma(this.context.touched,this.props.name)!==Ma(n.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length||this.context.isSubmitting!==n.isSubmitting},n.componentDidMount=function(){this.context.registerField(this.props.name,{validate:this.props.validate})},n.componentDidUpdate=function(e){this.props.name!==e.name&&(this.context.unregisterField(e.name),this.context.registerField(this.props.name,{validate:this.props.validate})),this.props.validate!==e.validate&&this.context.registerField(this.props.name,{validate:this.props.validate})},n.componentWillUnmount=function(){this.context.unregisterField(this.props.name)},n.render=function(){var e=this.props,t=(e.validate,e.name),n=e.render,r=e.as,i=e.children,a=e.component,o=(e.shouldUpdate,ka(e,["validate","name","render","as","children","component","shouldUpdate"])),s=this.context,c=(s.validate,s.validationSchema,ka(s,["validate","validationSchema"])),l={value:"radio"===o.type||"checkbox"===o.type?o.value:Ma(s.values,t),name:t,onChange:s.handleChange,onBlur:s.handleBlur},u={field:l,meta:{value:Ma(s.values,t),error:Ma(s.errors,t),touched:!!Ma(s.touched,t),initialValue:Ma(s.initialValues,t),initialTouched:!!Ma(s.initialTouched,t),initialError:Ma(s.initialErrors,t)},form:c};if(n)return n(u);if(xa(i))return i(u);if(a){if("string"==typeof a){var p=o.innerRef,f=ka(o,["innerRef"]);return Object(d.createElement)(a,wa({ref:p},l,f),i)}return Object(d.createElement)(a,wa({field:l,form:s},o),i)}var m=r||"input";if("string"==typeof m){var h=o.innerRef,g=ka(o,["innerRef"]);return Object(d.createElement)(m,wa({ref:h},l,g),i)}return Object(d.createElement)(m,wa({},l,o),i)},t}(d.Component)).contextType=Ba;var oo=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 so(e){const{castInitialValues:t,castValuesOnSubmit:n,initialValues:r,onSubmit:i,resetOnSubmit:a}=e,o=oo(e,["castInitialValues","castValuesOnSubmit","initialValues","onSubmit","resetOnSubmit"]),s=t&&e.validationSchema?e.validationSchema.cast(function e(t){const n=dt.deepClone(t);return Object.keys(n).forEach(t=>{n.hasOwnProperty(t)&&(dt.isObject(n[t])?n[t]=e(n[t]):null===n[t]&&delete n[t])}),n}(r)):r,c={allowInitialSubmit:e.allowInitialSubmit};return d.createElement(Ga,Object.assign({enableReinitialize:!0},o,{initialValues:s,onSubmit:(t,{setSubmitting:r,resetForm:o})=>{const s=n&&e.validationSchema?e.validationSchema.cast(t):t;i(s,()=>{a&&o(),r(!1)})},initialStatus:c}),X.isFunction(e.children)?t=>e.children(t):d.Children.count(e.children)?e.children:null)}so.defaultProps={castInitialValues:!0,castValuesOnSubmit:!0};var co=n(2),lo=co.object().shape({name:co.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),uo=n(3);const po={getCustomFormControlClassName(e,t,n,r){let i="form-control";return Ma(t,n)&&Ma(e,n)&&(i+=" is-invalid"),r&&(i+=" "+r),i}};function fo(e){const{values:t}=qa(),n=t[e.fieldName];return"string"!=typeof n?d.createElement(d.Fragment,null):d.createElement("div",{className:"float-right text-muted"},n.length,"/",e.limit)}var mo=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 ho(e){const{label:t}=e,n=mo(e,["label"]);return d.createElement(uo.Form.Group,null,d.createElement("div",{className:"custom-control custom-checkbox"},d.createElement(yo,Object.assign({className:"custom-control-input"},n)),d.createElement(uo.Form.Label,{className:"custom-control-label",htmlFor:n.id},t)))}var go=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 yo(e){const{children:t}=e,n=go(e,["children"]);return d.createElement(Xa,Object.assign({},n),X.isFunction(t)?e=>t(e):d.Children.count(t)?t:null)}function vo(e){const{label:t,className:n,showCharacterCounter:r}=e,i=go(e,["label","className","showCharacterCounter"]),{errors:a,touched:o}=qa();return"checkbox"===i.type?d.createElement(ho,Object.assign({},e)):d.createElement(uo.Form.Group,null,!!t&&d.createElement(uo.Form.Label,{htmlFor:i.id},t),d.createElement(yo,Object.assign({className:po.getCustomFormControlClassName(a,o,i.name,n)},i)),!!r&&!!i.maxLength&&d.createElement(fo,{fieldName:i.name,limit:i.maxLength}),d.createElement(ao,{name:i.name},e=>d.createElement(uo.Form.Control.Feedback,{type:"invalid"},e)))}function bo(e){var t;const[n,r]=d.useState(!1);return d.useEffect(()=>{var t;e.isValid&&(e.dirty||(null===(t=e.initialStatus)||void 0===t?void 0:t.allowInitialSubmit))?r(!0):r(!1)},[e.isValid,null===(t=e.initialStatus)||void 0===t?void 0:t.allowInitialSubmit,e.dirty,e.values]),d.useEffect(()=>{e.isSubmitting&&r(!1)},[e.isSubmitting]),n}var So=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 Eo(e){const{showSpinner:t,children:n}=e,r=So(e,["showSpinner","children"]),i=d.useRef(),[a,o]=d.useState({});return d.useEffect(()=>{const{width:e,height:t}=a;if(e&&t)return;const n=i.current,r=n.offsetHeight,s=n.offsetWidth;r&&s&&o({width:s,height:r})}),d.useEffect(()=>{const{width:e,height:t}=a;if(!e||!t)return;const n=i.current;n.style.width=e+1+"px",n.style.height=t+1+"px"},[a]),d.createElement(uo.Button,Object.assign({ref:i,disabled:t},r),t?d.createElement(uo.Spinner,{as:"span",animation:"border",role:"status",size:"sm"}):n)}var Co=n(124),Oo=n(21);const Io="AlertService",jo="LanguageService";const Ao=class extends G{static get Instance(){return this.instance||(this.instance=new this)}get name(){return jo}setConfig(e){this.polyglot=new Co({locale:e.locale,phrases:e.phrases.rootElement||e.phrases}),this.cache={}}getPhrase(e,t,n){const r=`${e}.${t}`;if(this.polyglot||x.throw(new B("LanguageService config must be set.")),!this.polyglot.has(r)){if(!w.isDevelopment){const e=window.trackJs;return e&&e.console.error(`No phrase set for ${r} in language config`),""}x.throw(new B(`No phrase set for ${r} in language config.`))}if(!n||m.isEmpty(n)){const e=this.cache[r];if(e)return e;const t=this.polyglot.t(r);return this.cache[r]=t,t}const i=m.omit(n,"smartCount");let a={};for(let e in i)a[e]=Oo.sanitize(i[e]);m.isNumber(n.smartCount)&&(a.smart_count=n.smartCount);const o=`${r}:${m.values(Object.assign({},a)).join(":")}`,s=this.cache[o];if(s)return s;const c=this.polyglot.t(r,a);return this.cache[o]=c,c}encloseNamespace(e){return(t,n)=>this.getPhrase(e,t,n)}}.Instance,To=d.createContext(""),wo=d.memo((function(e){const{phrase:t,namespace:n,options:r}=e,i=d.useContext(To),a=n||i,o=Ao.getPhrase(a,t,r);return d.createElement("span",{dangerouslySetInnerHTML:{__html:o}})}),(e,t)=>e.namespace===t.namespace&&e.phrase===t.phrase&&dt.isEqual(e.options,t.options));function Lo(e){const t=qa(),n=bo(t);d.useEffect(()=>{function e(e){13===e.keyCode&&n&&t.validateForm().then(e=>{Object.keys(e).length||t.submitForm()})}return window.addEventListener("keypress",e),()=>window.removeEventListener("keypress",e)},[n]);let r="save";return e.isNew&&(r="create"),e.hasNext&&(r="next"),d.createElement(Eo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},d.createElement(wo,{namespace:"shared.formButtons",phrase:r}))}function ko(e){var t=qa();return d.createElement(eo,null,d.createElement(vo,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this company",autoFocus:!0}),d.createElement(Lo,{isNew:e.isNew}))}function _o(e){return d.createElement(so,{initialValues:e.company,validationSchema:lo,onSubmit:e.saveCompany},d.createElement(ko,{isNew:!(e.company&&e.company.id)}))}function xo(e){var t=Object(te.useDispatch)(),n=i.useBasicFetch(Xt(e.id));return d.createElement(d.Fragment,null,!!n.data&&d.createElement(_o,{company:n.data,saveCompany:function(n,r){return i.fetch(t,tn(e.id,n,r))}}))}function Po(){var e=Object(te.useDispatch)();return d.createElement(_o,{saveCompany:function(t,n){i.fetch(e,en(t,(function(e){n(),r.AppLinkHelper.trigger({application:u.PEOPLE,action:o.Companies.EDIT_COMPANY,args:[e.id]})}),n))}})}var No,Do=n(125);!function(e){e.XS="(max-width: 575px)",e.SM="(min-width: 576px) and (max-width: 767px)",e.MD="(min-width: 768px) and (max-width: 991px)",e.LG="(min-width: 992px)",e.XL="(min-width: 1200px)",e.XXL="(min-width: 1440px)",e.SMDown="(max-width: 576px)",e.MDDown="(max-width: 768px)"}(No||(No={}));const Ro={isNumber:e=>Ro.isType(e,"number"),isString:e=>Ro.isType(e,"string"),isType:(e,t)=>typeof e===t};var Fo,Mo=n(14),Uo=n.n(Mo);function Vo(e,t){return dt.isObject(e)&&e.hasOwnProperty(t)&&Ro.isString(e[t])}function Bo(e,t,n){return({value:r})=>{if(r.length||n(),!(r.length<e.activationLength)){if(e.local){const n=X.isFunction(e.getLocalSuggestions)?e.getLocalSuggestions(r,e.local):function(e,t,n){const r=e.trim().toLowerCase();return r.length?t.filter(e=>!(!Vo(e,n)||!Ro.isString(e[n]))&&e[n].trim().toLowerCase().includes(r)):[]}(r,e.local,e.valueKey);t(e=>Object.assign(Object.assign({},e),{[Fo.Local]:n}))}e.getRemoteUrl&&function(e,t,n){const r=X.isFunction(e)&&e(t);r&&i.ajaxRequest({resource:r,type:it.GET,success:n,error:()=>{}})}(e.getRemoteUrl,r,n=>t(t=>Object.assign(Object.assign({},t),{[Fo.Remote]:X.isFunction(e.formatRemoteSuggestions)?e.formatRemoteSuggestions(n):n})))}}}function zo(e,t,n,r,i,a){const o=t=>e[t]||[],s=t?o(Fo.Recent):[],c=o(Fo.Local),l=o(Fo.Remote);let u=[];s.length&&u.push({title:n,data:s});const p=[...c,...l];return Number.isInteger(a)&&u.length>a&&p.slice(0,a),X.isFunction(i)?u.push(...i(p)):u.push({title:r,data:p}),u}function Ho(e){return e.data}function qo(e){if(e.title)return d.createElement("strong",null,e.title)}!function(e){e.Local="local",e.Recent="recent",e.Remote="remote"}(Fo||(Fo={}));const Jo={container:"position-relative",suggestionsContainerOpen:"bg-white py-1 border rounded "+Uo.a.suggestionsContainerOpen,suggestionsList:"list-unstyled m-0",suggestion:"cursor-pointer py-1 px-2",suggestionHighlighted:Uo.a.suggestionHighlighted,sectionContainer:"border-bottom py-1 "+Uo.a.sectionContainer};function $o(e={}){return Object.assign(Jo,e)}var Ko=n(15),Yo=n(32),Go=n.n(Yo),Wo=n(33),Zo=n.n(Wo),Qo=n(34),Xo=n.n(Qo),es=n(35),ts=n.n(es),ns=(n(36),n(37),n(38)),rs=n.n(ns),is=n(39),as=n.n(is),os=n(40),ss=n.n(os),cs=n(41),ls=n.n(cs),us=n(42),ps=n.n(us),fs=n(43),ds=n.n(fs),ms=n(44),hs=n.n(ms),gs=n(45),ys=n.n(gs),vs=n(46),bs=n.n(vs),Ss=n(47),Es=n.n(Ss),Cs=n(48),Os=n.n(Cs),Is=n(49),js=n.n(Is),As=n(50),Ts=n.n(As),ws=n(51),Ls=n.n(ws),ks=n(52),_s=n.n(ks),xs=n(53),Ps=n.n(xs),Ns=n(54),Ds=n.n(Ns),Rs=n(55),Fs=n.n(Rs),Ms=n(56),Us=n.n(Ms),Vs=n(57),Bs=n.n(Vs),zs=(n(58),n(59)),Hs=n.n(zs),qs=n(60),Js=n.n(qs),$s=n(61),Ks=n.n($s),Ys=(n(62),n(63),n(64)),Gs=n.n(Ys),Ws=n(65),Zs=n.n(Ws),Qs=n(66),Xs=n.n(Qs),ec=n(67),tc=n.n(ec),nc=n(68),rc=n.n(nc),ic=n(69),ac=n.n(ic),oc=(n(70),n(71)),sc=n.n(oc),cc=n(72),lc=n.n(cc),uc=n(73),pc=n.n(uc),fc=n(74),dc=n.n(fc),mc=n(75),hc=n.n(mc),gc=n(76),yc=n.n(gc),vc=n(77),bc=n.n(vc),Sc=(n(78),n(79)),Ec=n.n(Sc),Cc=n(80),Oc=n.n(Cc),Ic=n(81),jc=n.n(Ic),Ac=n(82),Tc=n.n(Ac),wc=n(83),Lc=n.n(wc),kc=n(84),_c=n.n(kc),xc=n(85),Pc=n.n(xc),Nc=n(86),Dc=n.n(Nc),Rc=n(87),Fc=n.n(Rc),Mc=n(88),Uc=n.n(Mc),Vc=n(89),Bc=n.n(Vc),zc=n(90),Hc=n.n(zc),qc=n(91),Jc=n.n(qc),$c=(n(92),n(93),n(94),n(95)),Kc=n.n($c),Yc=(n(96),n(97),n(98),n(99),n(100)),Gc=n.n(Yc),Wc=n(101),Zc=n.n(Wc),Qc=(n(102),n(103),n(104),n(105)),Xc=n.n(Qc),el=n(106),tl=n.n(el),nl=n(107),rl=n.n(nl),il=n(108),al=n.n(il),ol=n(109),sl=n.n(ol),cl=n(110),ll=n.n(cl),ul=n(111),pl=n.n(ul),fl=(n(112),n(113),n(114),n(115)),dl=n.n(fl),ml=n(116),hl=n.n(ml);const gl=[Go.a,Xo.a,ts.a,rs.a,ls.a,ps.a,ds.a,hs.a,ss.a,Zo.a,ys.a,bs.a,Es.a,Os.a,js.a,as.a,Ts.a,Ls.a,_s.a,Bs.a,Ps.a,Ds.a,Fs.a,Us.a,Hs.a,Xs.a,Pc.a,Fc.a,Dc.a,Jc.a,Uc.a,Bc.a,Hc.a,dc.a,yc.a,hc.a,Js.a,Ks.a,lc.a,pc.a,sc.a,Gs.a,tc.a,Oc.a,jc.a,rc.a,ac.a,Tc.a,Zs.a,Ec.a,Lc.a,_c.a,bc.a,Gc.a,Zc.a,Kc.a,rl.a,tl.a,Xc.a,al.a,ll.a,sl.a,pl.a,hl.a,dl.a];var yl;!function(e){e.AddToPlaylists="add-to-playlist",e.Caret="caret",e.Delete="delete",e.Edit="edit",e.NoEdit="no-edit",e.Close="close",e.Folder="folder",e.Resources="resources",e.More="more",e.Bell="bell",e.Plus="plus",e.Search="search",e.Share="share",e.Upload="upload",e.Preview="preview",e.CircleCheck="circle-check",e.Down="down",e.Right="right",e.UpDown="up-down",e.ChevronUp="chevron-up",e.ChevronDown="chevron-down",e.ChevronLeft="chevron-left",e.ChevronRight="chevron-right",e.VisibleOff="visible-off",e.VisibleOn="visible-on",e.PublisherArchive="publisher-archive",e.Play="play",e.PlayCircle="play-circle",e.ArrowLeft="arrow-left",e.CheckCircleOutline="check-circle-o",e.CheckCircle="check-circle",e.Check="check",e.Lock="lock",e.Link="link",e.Info="info",e.Question="question",e.Star="star",e.StarOutline="star-o",e.Archive="archive",e.Warning="warning",e.WarningOutline="warning-o",e.NewWindow="new-window",e.File="file",e.FilePDF="file-pdf",e.FileExcel="file-excel",e.FilePowerpoint="file-ppt",e.FileWord="file-word",e.FileImg="file-img",e.FileZip="file-zip",e.Enter="enter",e.Calendar="calendar",e.CloseCaption="close-caption",e.CloseCaptionBadge="close-caption-badge",e.Playlist="playlist",e.Handle="handle",e.Subject="subject",e.Series="series",e.EditClickView="edit-clickview",e.Heart="heart",e.HeartOutline="heart-outline",e.WhiteWave="white-wave",e.Cog="cog",e.Video="video",e.Compass="compass",e.History="history",e.Tag="tag"}(yl||(yl={}));m.extend(Ko.config,{autoReplaceSvg:!1,autoAddCss:!1,familyPrefix:"cv",autoA11y:!0,observeMutations:!1,replacementClass:"cv-svg",keepOriginalSource:!1}),Ko.library.add(...gl);const vl="cv";const bl=class{constructor(){}static get Instance(){return this.instance||(this.instance=new this)}getSvg(e,t={}){const n=this.faIconLookup(e,t),r=this.getIcon(n,t);if(r&&(!r||r.html.length))return r.html.pop()}getIcon(e,t){return Ko.icon(e,t.iconOptions||{})}faIconLookup(e,t){let{prefix:n=vl}=t;return Ko.findIconDefinition({prefix:n,iconName:e})}}.Instance,Sl=yl,El={getRandomInt:(e=1e4)=>Math.floor(Math.random()*Math.floor(e))};function Cl(e){const{title:t,placement:n,trigger:r,children:i}=e;return d.createElement(uo.OverlayTrigger,{placement:n,overlay:d.createElement(uo.Tooltip,{id:`${t}-${El.getRandomInt()}`},t),trigger:r},d.createElement("span",null,i))}Cl.defaultProps={trigger:["hover","click","focus"],placement:"top"};const Ol="d-inline-block svg-container",Il="span";var jl;function Al(e){const{svgName:t,className:n=Ol,tagName:r=Il,size:i=jl.Standard,onClick:a,title:o,tooltipPlacement:s="right"}=e,c=r,l={dangerouslySetInnerHTML:{__html:bl.getSvg(t)},className:`${n} ${i}`,onClick:X.isFunction(a)?a:null};return o?d.createElement(Cl,{title:o,placement:s},d.createElement(c,Object.assign({},l))):d.createElement(c,Object.assign({},l))}!function(e){e.Standard="std",e.Small="sm",e.Medium="md",e.Large="lg",e.ExtraLarge="xlg"}(jl||(jl={}));var Tl=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};const wl=e=>{const t="d-inline-block svg-container";return X.isFunction(e)?t+" cursor-pointer":t};function Ll(e){const{onClickSearchIcon:t,searchIconPlacement:n,className:r}=e,i=Tl(e,["onClickSearchIcon","searchIconPlacement","className"]);let a="form-control "+Uo.a.input,o="input-group-text bg-white";"right"===n&&(a+=" border-right-0",o+=" pl-0"),"left"===n&&(a+=" border-left-0",o+=" pr-0"),r&&(a+=" "+r);const s=()=>d.createElement("div",{className:o},d.createElement(Al,{svgName:Sl.Search,size:jl.Small,onClick:t,className:wl(t)}));return d.createElement("div",{className:"input-group"},"left"===n&&d.createElement("div",{className:"input-group-prepend"},d.createElement(s,null)),d.createElement("input",Object.assign({className:a},i)),"right"===n&&d.createElement("div",{className:"input-group-append"},d.createElement(s,null)))}const kl=X.isFunction;function _l(e){const t=(n=e.initialSuggestions,r=e.recentSearches,{[Fo.Recent]:r,[Fo.Local]:n,[Fo.Remote]:[]});var n,r;const[i,a]=d.useState(e.initialQuery||""),[o,s]=d.useState(t),c=function(e){const[t,n]=Object(d.useState)(window.matchMedia(e).matches);return Object(d.useEffect)(()=>{const r=window.matchMedia(e);r.matches!==t&&n(r.matches);const i=()=>n(r.matches);return r.addListener(i),()=>r.removeListener(i)},[e]),t}(No.XS),l=()=>{s(t)},u=t=>{t.preventDefault(),kl(e.onSubmit)&&e.onSubmit(i)};return d.createElement("form",{onSubmit:u},d.createElement(Do,{suggestions:zo(o,!i,e.recentSearchHeading||Ao.getPhrase("shared.searchBar","recentSearchHeading"),e.suggestionsHeading,e.getSections,e.suggestionLimit),onSuggestionsFetchRequested:Bo(e,s,l),onSuggestionsClearRequested:()=>{e.alwaysRenderSuggestions||l()},onSuggestionSelected:(t,{suggestion:n})=>{e.clearQueryOnSelect&&a(""),e.onSuggestionSelected(n)},getSuggestionValue:t=>e.updateQueryOnSelection?function(e,t){return Vo(t,e)?t[e]:""}(e.valueKey,t):i,renderSuggestion:t=>kl(e.getSuggestionComponent)?e.getSuggestionComponent(t):function(e,t){return Vo(t,e)?d.createElement(d.Fragment,null,t[e]):d.createElement(d.Fragment,null)}(e.valueKey,t),alwaysRenderSuggestions:e.alwaysRenderSuggestions,focusInputOnSuggestionClick:!c,inputProps:{placeholder:e.placeholder||Ao.getPhrase("shared.searchBar","placeholder"),value:i,onChange:(t,{newValue:n})=>{a(n),kl(e.onQueryChange)&&e.onQueryChange(n)},onKeyDown:t=>{8===t.keyCode&&e.onBackspace&&!i&&e.onBackspace()},autoFocus:!!e.autoFocusInput,onClickSearchIcon:!!e.submitOnClickSearchIcon&&u,searchIconPlacement:e.searchIconPlacement},renderInputComponent:Ll,theme:$o(e.theme),multiSection:!0,renderSectionTitle:qo,getSectionSuggestions:Ho}))}function xl(e){const{appLink:t,className:n,children:i,tag:a="a"}=e;if(!t)return d.createElement("span",{className:n||""},i);let o=e.onClick;o||(o=e=>{e.preventDefault(),r.AppLinkHelper.trigger(t)});const s={onClick:o,href:r.AppLinkHelper.getHref(t),className:n};return d.createElement(a,Object.assign({},s),i)}function Pl(e){var t=e.backToName,n=e.appLink;return d.createElement(xl,{appLink:n,className:"d-inline-flex align-items-center"},d.createElement(Al,{svgName:Sl.ArrowLeft,size:jl.Small}),d.createElement("span",{className:"ml-1"},"Back to ".concat(t)))}function Nl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Dl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dl(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}_l.defaultProps={updateQueryOnSelection:!0,valueKey:"name",activationLength:3,suggestionLimit:5,recentSearches:[],initialSuggestions:[],searchIconPlacement:"right"};var Rl=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 Fl(e){var t=e.selected,n=e.onToggle,r=Rl(e,["selected","onToggle"]),i=Nl(d.useState(t),2),a=i[0],o=i[1];d.useEffect((function(){return o(t)}),[t]);return d.createElement(uo.Form.Check,Object.assign({type:"checkbox",id:"checkbox-".concat(El.getRandomInt()),checked:a,onChange:function(){o(!a),n(!a)}},r))}var Ml,Ul,Vl,Bl,zl=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 Hl(e){var t=e.onFileSelect,n=e.acceptMultiple,r=e.mimeType,i=e.label,a=e.error,o=e.touched,s=zl(e,["onFileSelect","acceptMultiple","mimeType","label","error","touched"]),c="custom-file-input cursor-pointer";a&&o&&(c+=" is-invalid");var l=Object.assign({type:"file",className:c,onChange:function(e){var n=e.currentTarget.files;n&&n.length&&X.isFunction(t)&&t(n)},autoComplete:"off",value:"",multiple:!!n},r?{accept:r}:{});return d.createElement("div",{className:"form-group"},d.createElement("div",{className:"custom-file"},d.createElement(Xa,Object.assign({},l,s),e.children),d.createElement(uo.Form.Label,{className:"custom-file-label",htmlFor:s.id},i)))}!function(e){e.Small="small",e.Medium="medium",e.Large="large"}(Ml||(Ml={})),function(e){e[e.Thumbnails=0]="Thumbnails",e[e.Banners=1]="Banners",e[e.Avatars=2]="Avatars",e[e.Logos=3]="Logos",e[e.Covers=4]="Covers",e[e.Posters=5]="Posters",e[e.TallPosters=6]="TallPosters",e[e.HeroBanners=7]="HeroBanners"}(Ul||(Ul={})),function(e){e[e.Crop=0]="Crop",e[e.Stretched=1]="Stretched",e[e.Cover=2]="Cover"}(Vl||(Vl={})),function(e){e[e.None=0]="None",e[e.ImageAPIv1=1]="ImageAPIv1",e[e.FileAPIv1=2]="FileAPIv1",e[e.ImageAPIv2=3]="ImageAPIv2"}(Bl||(Bl={}));const ql={urlBuilder(e,t){const n=m.map(t,(e,t)=>{if(t&&Array.isArray(e)){return e.map(e=>`${t}=${encodeURIComponent(e)}`).join("&")}return t&&void 0!==e?`${t}=${encodeURIComponent(e)}`:""}),r=m.reduce(n,(e,t)=>t?e?`${e}&${t}`:t:e);return r?`${e}?${r}`:e},buildFilter(e){let t=[];if(e.limit&&t.push("limit:"+e.limit),e.cursor&&t.push("page:"+e.cursor),e.before&&t.push("dateCreated:..."+e.before),t.length)return t.join(",")},makeHttps:e=>m.isString(e)?-1===e.indexOf("http://")?e:e=e.replace("http://","https://"):e,safeUrlConcat(e,t){if(!e)return;let n=e;return e.endsWith("/")||(n+="/"),t?(n+=t.startsWith("/")?t.slice(1):t,n):n}};var Jl;!function(e){e.Banner="banner",e.Thumbnail="thumbnail"}(Jl||(Jl={}));const $l={[Ul.Banners]:Jl.Banner,[Ul.Thumbnails]:Jl.Thumbnail},Kl=e=>"/v1/category-map/"+e,Yl={createUrl:(e,t)=>Yl._createUrl(e,t),createBannerUrl:(e,t,n)=>e&&e.url?Yl._createUrl(e.url,n):Yl._createCategoryMappedUrl(t,n),Rfc3986EncodeURIComponent:e=>encodeURIComponent(e).replace(/[!'()*]/g,escape),_createCategoryMappedUrl(e,t){const{fallbackBaseUrl:n,fallbackCategoryName:r,type:i}=e,a=ql.safeUrlConcat(n,""+Kl($l[i])),o=Object.assign({name:Yl.Rfc3986EncodeURIComponent(r)},t);return Yl._createUrl(a,o)},_createUrl(e,t){if(!e)return;if(dt.isEmpty(t))return e;const n=$.param(t),r=-1===e.indexOf("?")?"?":"&";return ql.safeUrlConcat(e,`${r}${n}`)},legacyCreateThumbnailUrl(e,t){if(!e)return"";let n;if(!e)return;if(n=e instanceof r.Model?e.get("url"):"string"==typeof e?e:e.url,!n)return;const i=Object.assign({size:Ml.Small,bgColor:"000"},t);return Yl._createUrl(n,i)}},Gl={[Ul.Thumbnails]:{width:1280,height:720},[Ul.Banners]:{width:3600,height:666},[Ul.Covers]:{width:1080,height:1080},[Ul.Posters]:{width:1e3,height:1500},[Ul.TallPosters]:{width:1080,height:1920},[Ul.HeroBanners]:{width:1920,height:640}};var Wl,Zl={onFileSelect:function(e,t,n){if(t&&t.length){var r=new FileReader;r.addEventListener("load",(function(){return Zl.onReaderLoad(r,e,n)})),r.readAsDataURL(t[0])}},onReaderLoad:function(e,t,n){var r=new Image;r.src=e.result;var i=Gl[t].width,a=Gl[t].height;r.addEventListener("load",(function(){Zl.isImageValid(t,r)&&X.isFunction(n)?n(r):alert("Image too small: minimum dimensions are ".concat(i," x ").concat(a))}))},isImageValid:function(e,t){var n=Gl[e].width,r=Gl[e].height;return!(n&&t.width<n)&&!(r&&t.height<r)}},Ql={isItemActive:function(e,t){return t||(t=r.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.Content="Content",e.Curator="Curators",e.Support="Support",e.SalesSupport="Sales Support"}(Wl||(Wl={}));var Xl=function(){return[{value:"protected",access:"r"}]},eu=function(e){return[Wl.Developer,Wl.Content].some((function(t){return su.getGroupNames(e).includes(t)}))},tu=function(e){return Object.values(e).every((function(e){return!!e}))},nu=function(e,t){return!!e&&!!t&&e.toString()===t.toString()},ru=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function iu(e){return function(e){if(Array.isArray(e))return au(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return au(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return au(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function au(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ou={find:function(e,t){if(e&&e.children&&e.children.length)for(var n=function e(n){if(nu(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=ou.find(e,i);a&&(n=[a].concat(iu(n))),i=a?r(a):null}return n}},su={getGroupNames:function(e){return e&&e.groups?e.groups.map((function(e){return e.name})):[]}};function cu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return lu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lu(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var uu=d.createContext(void 0),pu=function(e){var t=e.children,n=cu(d.useState(),2),r=n[0],i=n[1],a=cu(d.useState(!1),2),o=a[0],s=a[1],c=cu(d.useState(),2),l=c[0],u=c[1],p={getDataUrl:function(){var e=r;return i(null),e},setDataUrl:i,imageUploaded:o,getImage:function(){var e=l;return u(null),s(!1),e},setImage:function(e){u(e),s(!0)}};return d.createElement(uu.Provider,{value:p},t)};const fu=class extends G{constructor(){super(),this.constructors={},this.destructors={},this.instances={},this.singletonInstances={},this.referenceCounts={}}get name(){return"InstanceManager"}static get Instance(){return this.instance||(this.instance=new this)}registerDataService(e,t){this.validateConstructor(e);const n=e.prototype.name;return this.referenceCounts[n]=0,this.constructors[n]=()=>new e({dataProvider:this.getInstance(t.dataProvider),cache:this.getInstance(t.cache),bootstrapData:t.bootstrapData,defaultErrorHandler:t.defaultErrorHandler,alertService:t.alertService}),this.destructors[n]=()=>{this.instances[n]?this.instances[n].destroy():x.throw(new B(`Trying to destroy a ${n} instance that has already been destroyed`)),this.releaseInstance(t.dataProvider),this.releaseInstance(t.cache)},this}registerInstance(e,t){this.validateConstructor(e);const n=e.prototype.name;return this.referenceCounts[n]=0,this.constructors[n]=()=>new e(t),this.destructors[n]=()=>m.isFunction(this.instances[n].destroy)&&this.instances[n].destroy(),this}registerSingleton(e){const t=e.name;return this.singletonInstances[t]=e,this}getInstance(e,t){return this.singletonInstances[e]?this.singletonInstances[e]:(this.constructors[e]||x.throw(new B(`${e} was not registered with ${this.name}`)),this.referenceCounts[e]++,t&&this.listenTo(t,"destroy",()=>this.releaseInstance(e)),this.instances[e]||(this.instances[e]=this.constructors[e]()),this.instances[e])}releaseInstance(e){if(this.instances[e])return window.setTimeout(()=>{this.referenceCounts[e]--,this.referenceCounts[e]<1&&(this.destructors[e](),delete this.instances[e])},0),this}validateConstructor(e){const t=e.prototype.name;t||x.throw(new B(`Classes registered with ${this.name} must have a unique name property.`)),this.constructors[t]&&x.throw(new B(`A class with the name: ${t} has already been registered with ${this.name}`))}}.Instance,du={fetch(e,t){const{dataServiceName:n,eventPrefix:r,fetchData:i,setData:a,onError:o,deleteEventPrefix:s}=e;if(!X.isFunction(i))return void x.throw(new B("A fetchData function must be passed to fetch"));if(!X.isFunction(a))return void x.throw(new B("A setData function must be passed to fetch"));const c=o&&X.isFunction(o),l=fu.getInstance(n),u=h.Radio.channel(l.channelName),p=r+":request",f=r+":sync",d=r+":error",m=r+":invalidate",g=s&&s+":sync",y=()=>t(!1),v=()=>t(!0),b=()=>t(!1),S=()=>u.off(m,b);u.once(p,y),u.once(f,v),u.once(m,b),c&&u.once(d,o),g&&u.once(g,S);const E=i(l);return E&&(t(!0),e.setData(E)),()=>{fu.releaseInstance(n),u.off(p,y),u.off(f,v),u.off(m,b),c&&u.off(d,o),g&&u.off(g,S)}}};function mu(e,t,n=!0){const[r,i]=d.useState(!1);d.useEffect(()=>{i(!1)},[...t]),d.useEffect(()=>{if(n)return du.fetch(e,i)},[r,n])}const hu="UserDataService",gu="user:data:service",yu="current:user",vu="workspace";class bu extends De{get name(){return hu}get channelName(){return gu}getCurrentUser(e,t){return this.get({resource:"/api/currentuser",eventPrefix:yu,expiryTime:qe.STANDARD,callback:e,errorCallback:t})}getWorkspace(e,t){return this.get({resource:"/api/domain/v2/me/workspace?query=categorytree",eventPrefix:vu,expiryTime:qe.STANDARD,callback:e,errorCallback:t})}}const Su={dataServiceName:hu,dataChannelName:gu},Eu={getCurrentUserFetchOptions:(e,t)=>Object.assign(Object.assign({},Su),{eventPrefix:yu,fetchData:e=>e.getCurrentUser(),setData:e,onError:t}),currentUser:{dataServiceName:hu,eventName:yu+":sync",getData:e=>e.getCurrentUser(),getInstance:e=>fu.getInstance(hu,e),beforeOnBeforeRender:!0}};function Cu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ou(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ou(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ou(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Iu,ju=d.createContext(void 0);function Au(e){var t=e.children,n=Cu(d.useState(),2),r=n[0],i=n[1];return mu(Eu.getCurrentUserFetchOptions(i),[]),d.createElement(ju.Provider,{value:r},t)}function Tu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return wu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return wu(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Lu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ku=(Lu(Iu={},Ul.Thumbnails,"Thumbnail"),Lu(Iu,Ul.Banners,"Banner"),Lu(Iu,Ul.Avatars,"Avatar"),Lu(Iu,Ul.Logos,"Logo"),Lu(Iu,Ul.Covers,"Cover"),Lu(Iu,Ul.Posters,"Poster"),Lu(Iu,Ul.TallPosters,"Tall Poster"),Lu(Iu,Ul.HeroBanners,"Hero Banner"),Iu);function _u(e){var t,n=qa(),i=Ma(null===(t=n)||void 0===t?void 0:t.values,e.fieldName),a=d.useContext(uu),o=a.setDataUrl,s=a.getImage,l=a.imageUploaded,u=Tu(d.useState(!1),2),p=u[0],f=u[1],m=Tu(d.useState(i),2),h=m[0],g=m[1],y=Tu(d.useState(!1),2),v=y[0],b=y[1];function S(t){f(!0),o(t.src),r.AppLinkHelper.trigger({application:e.application,action:e.uploadAction,args:[e.imageType]})}d.useEffect((function(){if(p){var t,r=s();if(r)f(!1),g(r),t=r,X.isFunction(e.setSelectedImage)?e.setSelectedImage(t):n&&n.setFieldValue(e.fieldName,{fileId:t.id,fileIdType:Bl.ImageAPIv2})}}),[l]);var E=e.label||ku[e.imageType]||"Image";return d.createElement("div",{className:"form-group"},d.createElement("div",{className:"form-control h-auto py-2"},d.createElement("label",null,E),d.createElement("em",{className:"ml-1 text-muted"},"(Minimum dimensions are ".concat(Gl[e.imageType].width,"px")+" x ".concat(Gl[e.imageType].height,"px)")),d.createElement(Hl,{label:"Choose a ".concat(E.toLowerCase()),name:"image",mimeType:c.IMAGES,onFileSelect:function(t){return Zl.onFileSelect(e.imageType,t,S)}}),!!h&&!!h.url&&d.createElement(d.Fragment,null,!v&&d.createElement("div",{className:"pb-2 ".concat(e.imageType===Ul.Banners?"w-100":"w-50")},d.createElement("img",{src:Yl.createUrl(h.url),className:"img img-fluid"})),d.createElement("div",{className:"d-flex justify-content-center"},d.createElement(Al,{svgName:v?Sl.ChevronDown:Sl.ChevronUp,size:jl.Large,className:"svg-container cursor-pointer",onClick:function(){return b(!v)},title:v?"Show image":"Hide image",tooltipPlacement:"top"})))))}var xu,Pu=n(126),Nu=n.n(Pu);function Du(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ru(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ru(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ru(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}!function(e){e[e.NoRestrictions=0]="NoRestrictions",e[e.RestrictToCanvas=1]="RestrictToCanvas"}(xu||(xu={}));var Fu,Mu,Uu,Vu,Bu,zu,Hu,qu,Ju,$u,Ku,Yu,Gu,Wu,Zu,Qu,Xu,ep,tp,np,rp,ip=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function ap(e){var t=e.dataUrl,n=e.minHeight,r=e.minWidth,i=e.onCrop,a=e.onCancel,o=d.useRef(),s=d.useRef(),c=Du(d.useState(!1),2),l=c[0],u=c[1],p=Du(d.useState(!1),2),f=p[0],m=p[1];return d.useEffect((function(){var e=new Image;e.src=t;var i=o.current.offsetWidth/e.width;return s.current=new Nu.a(o.current,{viewMode:xu.RestrictToCanvas,autoCropArea:1,aspectRatio:r/n,minCropBoxWidth:r*i,minCropBoxHeight:n*i,ready:function(){return u(!0)}}),function(){return s.current.destroy()}}),[]),d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-3"},d.createElement("img",{ref:o,src:t,className:"img img-fluid mw-100"})),d.createElement("div",{className:"d-flex justify-content-end border-top pt-3"},d.createElement(uo.Button,{variant:"link",onClick:a},"Cancel"),d.createElement(Eo,{onClick:function(){if(l){m(!0);var e=s.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(ip);if(t)return t[1]}(t));X.isFunction(i)&&i(e)}},disabled:!l,showSpinner:f},"Crop")))}!function(e){e.Stream="cv_product_stream",e.WebPlayerStream="cv_product_webplayer_stream",e.Login="cv_product_login",e.LoginSsoRedirect="cv_product_login_sso_redirect",e.LoginFailed="cv_product_login_failed",e.Search="cv_product_search",e.InstantSearch="cv_product_search",e.SearchEmptyResult="cv_product_search_empty_result",e.Filter="cv_product_search_filter",e.SearchLanding="cv_product_search_landing",e.Share="cv_product_share",e.WorkspaceAdd="cv_product_tv_add",e.Rename="cv_product_rename",e.Move="cv_product_move",e.Sort="cv_product_sort",e.Create="cv_product_create",e.Delete="cv_product_delete",e.Associate="cv_product_associate",e.Dissociate="cv_product_dissociate",e.Edit="cv_product_edit",e.Approve="cv_product_approve",e.Reject="cv_product_reject",e.Disable="cv_product_disable",e.Upload="cv_product_upload",e.Download="cv_product_download",e.Navigate="cv_product_navigate",e.Click="cv_product_click",e.Suggest="cv_product_suggest",e.EditAssoc="cv_product_edit_assoc",e.Play="cv_product_play",e.Favourite="cv_product_favourite",e.Follow="cv_product_follow",e.Prefer="cv_product_prefer",e.SetAccess="cv_product_set_access",e.AddToLocalCache="cv_product_add_to_lc",e.ResolveWarning="cv_product_resolve_warning",e.DismissWarning="cv_product_dismiss_warning"}(Fu||(Fu={})),function(e){e.Folder="folder",e.Video="video",e.Rating="rating",e.Series="series",e.Library="library",e.Resource="resource",e.Tag="tag",e.Subtitle="subtitle",e.Chapter="chapter",e.Restriction="restriction",e.Interactive="interactive",e.PDF="pdf",e.CustomerSetting="customer_setting",e.StaffRequest="staff_request",e.Logo="logo",e.Pagination="pagination",e.Thumbnail="thumbnail",e.Banner="banner",e.Link="link",e.Playlist="playlist",e.Person="person",e.Company="company",e.Classroom="classroom",e.ClassroomGroup="classroom_group",e.Classification="classification",e.ShareLink="share_link",e.Upload="upload",e.SearchResults="search_results",e.Audience="audience",e.User="target_user"}(Mu||(Mu={})),function(e){e.TopNav="top_nav",e.LeftNav="left_nav",e.Popup="popup",e.Banner="banner",e.VideoList="video_list",e.VideoListItem="video_list_item",e.VideoListHeader="video_header",e.VideoThumbnail="video_thumbnail",e.VideoItemPreview="video_item_preview",e.VideoDetails="video_details",e.VideoDetailsHeader="video_details_header",e.EditVideoDetails="edit_video_details",e.EditVideoChapters="edit_video_chapters",e.EditVideoResources="edit_video_resources",e.VideoUpload="video_upload",e.VideoRequest="video_request",e.Pagination="pagination",e.SearchBar="search_bar",e.InstantSearch="instant_search",e.SearchFilters="search_filters",e.LibraryHeader="library_header",e.LibraryTiles="library_tiles",e.StaffRequestDetails="staff_request_details",e.SubFolderList="sub_folder_list",e.AwaitingReviewVideoListHeader="awaiting_review_video_list_header",e.AwaitingReviewVideoItem="awaiting_review_video_item",e.PastReleasesHeader="past_releases_header",e.MigrationWarnings="migration_warnings",e.PlaylistListHeader="playlist_list_header",e.PlaylistListItem="playlist_list_item",e.TeacherManager="teacher_manager",e.TeacherManagerListItem="teacher_manager_list_item",e.StudentManager="student_manager",e.StudentManagerListItem="student_manager_list_item",e.ClassroomsList="classrooms_list",e.ClassroomsListItem="classrooms_list_item",e.ClassroomOverview="classroom_overview",e.ClassroomOverviewStudentListItem="classroom_overview_student_list_item",e.ManageClassroomStudents="manage_classroom_students",e.ManageClassroomStudentListItem="manage_classroom_student_list_item",e.ManageClassroomGroups="manage_classroom_groups",e.ManageClassroomGroupListItem="manage_classroom_group_list_item",e.PlayPage="play_page",e.FloatingPlayer="floating_player",e.ContentUpdatesClassificationBanner="content_updates_classification_banner",e.PreferencesSettings="preferences_settings",e.MyUploads="my_uploads"}(Uu||(Uu={})),function(e){e.Start="start",e.Complete="complete",e.Save="save",e.Discard="discard"}(Vu||(Vu={})),function(e){e.PageLoad="page_load"}(Bu||(Bu={})),function(e){e.Single="single",e.Bulk="bulk",e.All="all"}(zu||(zu={})),function(e){e.ProductionYear="production_year",e.Alphabetical="alphabetical"}(Hu||(Hu={})),function(e){e.Content="content",e.Quality="quality",e.Duration="duration",e.Reset="reset"}(qu||(qu={})),function(e){e.Submit="submit",e.ShowAll="show_all",e.Recent="recent",e.SearchIcon="search_icon"}(Ju||(Ju={})),function(e){e.Start="start",e.Finish="finish",e.Terminate="terminate",e.Play="play",e.Pause="pause",e.Playback="playback",e.NextChapter="next_chapter",e.PreviousChapter="previous_chapter",e.FullScreenEnter="full_screen_enter",e.FullScreenExit="full_screen_exit"}($u||($u={})),function(e){e.TogglePreview="toggle_preview",e.NavigateHome="navigate_home",e.OpenInStaffView="open_in_staff_view",e.Thumbnail="thumbnail",e.Title="title",e.ToggleHideValidListings="toggle_hide_valid_listings",e.LaunchImmersiveReader="launch_immersive_reader",e.CopyEmbedHtml="copy_embed_html",e.Close="close",e.Open="open"}(Ku||(Ku={})),function(e){e.LibraryReview="library_review"}(Yu||(Yu={})),function(e){e.FileSelect="file_select",e.DragDrop="drag_drop"}(Gu||(Gu={})),function(e){e.Edit="edit"}(Wu||(Wu={})),function(e){e.Image="image",e.User="user"}(Zu||(Zu={})),function(e){e.On="on",e.Off="off"}(Qu||(Qu={})),function(e){e.EntityRemoved="cv_entity_removed",e.ValueUpdated="cv_value_updated"}(Xu||(Xu={})),function(e){e.FileSelect="file_select",e.DragDrop="drag_drop"}(ep||(ep={})),function(e){e.Video="videos",e.Folder="categories",e.Series="series",e.Tags="tags"}(tp||(tp={})),function(e){e[e.V1=1]="V1"}(np||(np={})),function(e){e.Analytics="AnalyticsService",e.Context="ContextService"}(rp||(rp={}));class op extends r.Service{constructor(){super(...arguments),this.contextHistory=[]}get name(){return rp.Context}static get Instance(){return this.instance||(this.instance=new this)}initialize(){this.listenTo(y.SHELL,r.EventNames.ROUTE,this.setContext)}setContext(e){this.contextHistory.length>=5&&this.contextHistory.unshift(),this.contextHistory.push({pageLoad:!this.contextHistory.length,appLink:e})}getCurrentContext(){if(this.contextHistory.length)return this.contextHistory[this.contextHistory.length-1]}fromPageLoad(){return 1===this.contextHistory.length}}const sp=new op;var cp;!function(e){e.Inlet="event:inlet",e.Outlet="event:outlet"}(cp||(cp={}));const lp="global:analytics",up=np.V1;class pp{constructor(e,t,n,r){this.type=e,this.data=t,this.actionContext=n,this.eventVersion=r||up}isType(e){return e===this.type}enrich(e,t){this.validateKey(e),this[e]=t}get(e){if(e&&this[e])return this[e]}validateKey(e){"type"!==e&&"data"!==e||r.ErrorHelper.throw(new B(e+" is not a valid key")),this[e]&&r.ErrorHelper.throw(new B("Event already contains an enrichment named "+e))}}const fp={log(e,t,n,r){h.Radio.channel(lp).trigger(cp.Inlet,new pp(e,t,n,r))}};function dp(){const{appLink:e}=sp.getCurrentContext();return m.isObject(e)||r.ErrorHelper.throw(new B("Applink does not exist. Check current context.")),e.application.replace(":","-")}function mp(e={}){const{location:t,entity:n,workflowPhase:i=null,descriptor:a=null}=e;return t||r.ErrorHelper.throw(new B("location must be set.")),n||r.ErrorHelper.throw(new B("entity must be set.")),{productArea:dp(),location:t,entity:n,descriptor:a,workflowPhase:i}}function hp(){return r.LocationUtils.GetCurrentPath()+r.LocationUtils.GetCurrentQueryString()}const gp={logUserAction(e,t){if(!function(e){return!(!m.isArray(e)||!m.every(e,e=>m.isObject(e)))||!!m.isObject(e)}(e)||!m.isObject(t))return;const{userAction:n,action:r,eventVersion:i}=gp.buildUserActionEvent(t);fp.log(n,e,r,i)},logNavigate(e,t){const n=Object.assign({currentLocation:hp(),appLink:e},t);fp.log(Fu.Navigate,n)},mergeOptions:(e,t)=>m.extend({},e,t),buildActionContext:(e={})=>mp(e),buildUserActionEvent(e={}){const{actionType:t,eventVersion:n}=e;return{userAction:t,action:mp(e),eventVersion:n}},buildCurrentLocation:()=>hp(),buildSearchEvent:(e,t)=>({data:{query:e},action:mp({entity:Mu.Video,location:Uu.SearchBar,descriptor:t})}),buildInstantSearchEvent(e,t,n){let r;n===tp.Series&&(r=Mu.Series),n===tp.Folder&&(r=Mu.Folder),n===tp.Tags&&(r=Mu.Tag),n===tp.Video&&(r=Mu.Video);const i={instant:{},query:e};return t.id&&(i.instant.selectedId=t.id),t.name&&(i.instant.selectedName=t.name),{data:i,action:mp({entity:r,location:Uu.SearchBar})}},mapInteractionType(e){switch(e){case ep.DragDrop:return Gu.DragDrop;case ep.FileSelect:return Gu.FileSelect;default:return}}};function yp(e,t){return t?{application:e.application,action:e.action,args:e.args,params:Object.assign({},e.params,{cursor:t})}:null}function vp({appLink:e,cursors:t,className:n}){function r(e){gp.logUserAction({page:e},{location:Uu.Pagination,entity:Mu.Pagination,actionType:Fu.Navigate,workflowPhase:Vu.Complete})}return d.createElement(To.Provider,{value:"shared.pagination"},d.createElement("div",{className:n},d.createElement(xl,{appLink:yp(e,t.previous),className:"btn btn-secondary mr-1 "+(t.previous?"":"disabled"),onClick:()=>r("previous")},d.createElement(wo,{phrase:"previous"})),d.createElement(xl,{appLink:yp(e,t.next),className:"btn btn-secondary "+(t.next?"":"disabled"),onClick:()=>r("next")},d.createElement(wo,{phrase:"next"}))))}function bp(e){if(!e.collection)return d.createElement(d.Fragment,null);var t=e.collection,n=t.data,r=t.pagination;return d.createElement(d.Fragment,null,!!n&&d.createElement(_p,{objects:n,getObjectAppLink:e.getObjectAppLink,newObjectAppLink:e.newObjectAppLink,objectName:e.objectName}),!!r&&!!r.cursors&&d.createElement(vp,{cursors:r.cursors,appLink:e.collectionAppLink}))}vp.defaultProps={className:"py-2"};var Sp=n(22),Ep=n.n(Sp);function Cp(e){let t="dropdown-item";return e&&(t+=" "+e),t}function Op(e){if(!e.actions||!e.actions.length)return d.createElement(d.Fragment,null);const t="actions-dropdown-"+El.getRandomInt();let n="px-0 "+Ep.a.dropdownToggle;return e.dropdownToggleClassName&&(n+=" "+e.dropdownToggleClassName),d.createElement(uo.Dropdown,{className:e.className?e.className:"",alignRight:!0},d.createElement(uo.Dropdown.Toggle,{as:"button",type:"button",id:t,className:n},d.createElement(Al,{svgName:Sl.More,size:jl.Small})),d.createElement(uo.Dropdown.Menu,null,e.actions.map((e,t)=>d.createElement(xl,{key:t,appLink:e.appLink,className:Cp(e.className)},e.label))))}Op.defaultProps={dropdownToggleClassName:"btn btn-light"};var Ip=n(18),jp=n.n(Ip);function Ap(e){const{svgName:t,children:n,appLink:r,className:i,onClick:a}=e;let o=`${i} ${jp.a.iconButton}`;o+=n?" "+jp.a.iconWithText:" "+jp.a.iconOnly;const s=d.createElement(Al,{svgName:t,className:jp.a.svg});return r?d.createElement(xl,{appLink:r,className:o,onClick:a},s,n):d.createElement("button",{className:o,onClick:a},s,n)}function Tp(e){const{onClick:t,appLink:n,svgName:r,tooltip:i}=e.actionOptions;let a="ml-2";return e.actionOptions.className&&(a+=" "+e.actionOptions.className),i?d.createElement(Cl,{title:i},d.createElement(Ap,{appLink:n,svgName:r,onClick:t,className:a},e.children)):r?d.createElement(Ap,{onClick:t,appLink:n,svgName:r,className:a},e.children):n?d.createElement(xl,{onClick:t,appLink:n,className:a},e.children):d.createElement("button",{onClick:t,className:a},e.children)}function wp(e){const t=[],n=[];e.actions.forEach(e=>{e.button?t.push(e):n.push(e)});let r="d-flex";return e.className&&(r+=" "+e.className),d.createElement("div",{className:r},d.createElement(d.Fragment,null,!!t.length&&d.createElement("span",{className:Ep.a.buttonList},t.map((e,t)=>d.createElement(Tp,{key:t,actionOptions:e},e.label))),e.sortComponent?e.sortComponent:"",!!n.length&&d.createElement(Op,{actions:n,className:!!t.length&&"ml-2",dropdownToggleClassName:e.actionsDropdownClassName})))}function Lp(e){var t=e.object,n=e.actions;return d.createElement("div",{className:"d-flex justify-content-between py-2"},!!t&&d.createElement("h5",null,t.name),!!n&&d.createElement("span",null,d.createElement(wp,{actions:n})))}function kp(e){return d.createElement("tr",null,d.createElement("td",null,d.createElement(xl,{appLink:e.appLink},e.object.name)),d.createElement("td",null))}function _p(e){return d.createElement(uo.Table,{responsive:!0},d.createElement("thead",null,d.createElement("tr",null,d.createElement("th",null,"Name"),d.createElement("th",null,d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(xl,{appLink:e.newObjectAppLink},d.createElement(Al,{svgName:Sl.Plus,size:jl.Small}),d.createElement("span",null,"New ".concat(e.objectName))))))),d.createElement("tbody",null,e.objects.map((function(t){return d.createElement(kp,{key:t.id,object:t,appLink:e.getObjectAppLink(t)})}))))}function xp(e){var t=e.objects,n=e.getAppLink,r=e.emptyMessage;return t?t.length?d.createElement("ul",{className:"list-unstyled"},t.map((function(e,t){return d.createElement("li",{key:t,className:"border rounded mb-3"},d.createElement(xl,{appLink:n(e),className:"d-block p-3"},e.name))}))):d.createElement("div",{className:"py-3"},d.createElement("p",null,r)):d.createElement(d.Fragment,null)}xp.defaultProps={emptyMessage:"There is nothing here."};function Pp(e){var t=qa();return d.createElement(vo,{as:"select",label:"Rating",name:"rating",id:"rating",value:t.values.rating&&t.values.rating.id,onChange:function(e){return t.setFieldValue("rating",e.target.value?{id:e.target.value}:{})},disabled:e.disabled},d.createElement(d.Fragment,null,d.createElement("option",{value:""},"Please select a rating"),e.ratings.map((function(e,t){return d.createElement("option",{key:t,value:e.id},function(e){return"".concat(e.name).concat(e.code?" (".concat(e.code,")"):"")}(e))}))))}function Np(e){var t=e.tabs,n=e.isItemActive;return d.createElement(uo.Nav,{fill:!0,variant:"tabs"},t.map((function(e,t){return d.createElement(uo.Nav.Item,{key:t},d.createElement(xl,{appLink:e.appLink,className:(r=n(e),r?"nav-link active":"nav-link")},e.label));var r})))}Np.defaultProps={isItemActive:Ql.isItemActive};var Dp=n(8),Rp=n.n(Dp);function Fp(e){var t=e.name,n=e.appLink,r=e.onSelect,i=e.isDisabled,a=e.className,o=e.actions,s=Rp.a.text;return a&&(s+=" ".concat(a)),i?d.createElement("a",{className:"".concat(s," text-muted ").concat(Rp.a.disabled)},t):d.createElement(d.Fragment,null,n?d.createElement(xl,{appLink:n,className:s},t):d.createElement("a",{onClick:r,className:s},t),!!o&&d.createElement(wp,{className:Rp.a.actions,actions:o}))}function Mp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Up(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Up(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Up(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Vp(e){var t=e.tree,n=e.selectedIds,r=e.getAppLink,i=e.onSelect,a=e.isDisabled,o=e.actions,s=Array.isArray(n)&&n.some((function(e){return nu(t.id,e)})),c=d.useMemo((function(){return Array.isArray(n)&&n.some((function(e){return ou.find(t,e)}))}),[t,n]),l=Mp(d.useState(c),2),u=l[0],p=l[1],f=!!t.children&&!!t.children.length,m={name:t.name,appLink:X.isFunction(r)?r(t):null,onSelect:X.isFunction(i)?function(){return i(t)}:null,isDisabled:!!X.isFunction(a)&&a(t),className:s&&Rp.a.selected||c&&Rp.a.parentOfSelected,actions:!!o&&o.map((function(e){return Object.assign(Object.assign({},e),{appLink:e.getAppLink(t)})}))};return d.createElement("li",{className:"position-relative".concat(u?"":" ".concat(Rp.a.collapsed))},d.createElement("div",{className:"position-relative"},d.createElement("span",{className:Rp.a.node},f&&d.createElement(Al,{svgName:Sl.ChevronDown,size:jl.Small,className:"svg-container ".concat(Rp.a.chevron),onClick:function(){return p(!u)}}),d.createElement(Fp,Object.assign({},m))),u&&d.createElement(zp,Object.assign({},e))))}var Bp=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 zp(e){var t=e.tree,n=Bp(e,["tree"]);return t&&t.children?d.createElement("ul",{className:"m-0 p-0 ".concat(Rp.a.tree)},t.children.map((function(e){return d.createElement(Vp,Object.assign({key:e.id,tree:e},n))}))):d.createElement(d.Fragment,null)}var Hp={getChord:function(e,t){return ou.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=ou.find(t,e);o&&(n=Object.assign((r={},i=e,a=Hp.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 qp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Jp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jp(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var $p=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 Kp(e){var t=e.onSelect,n=e.label,r=e.hideCollapseBtn,i=e.collapse,a=e.noSelectionMessage,o=e.isNodeDisabled,s=e.getSelectedItemAppLink,c=$p(e,["onSelect","label","hideCollapseBtn","collapse","noSelectionMessage","isNodeDisabled","getSelectedItemAppLink"]),l=c.tree,u=c.selectedIds,p=qp(d.useState(Hp.getState(u,l)),2),f=p[0],m=p[1];d.useEffect((function(){return m(Hp.getState(u,l))}),[u,l]);var h=qp(d.useState(!!i),2),g=h[0],y=h[1];d.useEffect((function(){return y(!!i)}),[i]);var v=!r||!!n;return d.createElement(d.Fragment,null,v&&d.createElement("div",{className:"pb-2"},!!n&&d.createElement("label",{className:"m-0"},n),!r&&d.createElement("a",{className:"float-right cursor-pointer",onClick:function(){return y(!g)}},g?"Expand":"Collapse")),!g&&d.createElement("div",{className:"py-2 border-top"},d.createElement(zp,Object.assign({onSelect:function(e){return X.isFunction(t)&&t(e)},isDisabled:o},c))),(!dt.isEmpty(f)||!!a)&&d.createElement("div",{className:"py-2 border-top"},d.createElement("label",null,"Selected:"),d.createElement("ul",{className:"m-0"},dt.isEmpty(f)?d.createElement("li",null,a):Object.keys(f).map((function(e,t){return d.createElement("li",{key:t},X.isFunction(s)?d.createElement(xl,{appLink:s(e)},f[e]):f[e])})))))}var Yp=n(23);const Gp={isEmpty:e=>e&&!(e.data&&e.data.length),length:e=>e&&e.data&&e.data.length,at(e,t){if(e&&e.data&&e.data.length&&!(t>e.data.length))return e.data[t]},get(e,t){if(e&&e.data&&e.data.length)return e.data.find(e=>e.id&&e.id.toString()===t)},flattenCollections(e){if(!e||!e.length)return;let t=[];return e.forEach(e=>{t=[...t,...e.data]}),t},getNextCursor:e=>e.pagination&&e.pagination.cursors&&e.pagination.cursors.next};var Wp=function(e){var t="bg-white";return e&&(t+=" ".concat(e)),t};function Zp(e){var t=e.video,n=e.getVideoAppLink,r=e.getVideoActions,i=e.className,a=void 0===i?"":i,o=e.itemNumber,s=X.isFunction(n)&&n(t);return d.createElement("tr",{className:Wp(a)},!!o&&d.createElement("td",null,d.createElement("span",null,o)),d.createElement("td",null,s?d.createElement(xl,{appLink:s},t.name):t.name),X.isFunction(r)&&d.createElement("td",null,d.createElement("span",{className:"d-flex justify-content-end"},d.createElement(wp,{actions:r(t)}))))}var Qp=Object(Yp.SortableElement)((function(e){return d.createElement(Zp,Object.assign({sortable:!0},e))})),Xp=n(11),ef=n.n(Xp),tf=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},nf=function(e){var t=e.sortable,n=e.getVideoActions;return d.createElement("thead",null,d.createElement("tr",null,!!t&&d.createElement("th",null,"#"),d.createElement("th",null,"Name"),!!n&&d.createElement("th",null)))},rf=d.forwardRef((function(e,t){var n=e.videos,r=e.sortable,i=tf(e,["videos","sortable"]);return d.createElement("tbody",{ref:t},!Gp.isEmpty(n)&&n.data.map((function(e,t){return r?d.createElement(Qp,Object.assign({key:e.id,index:t,itemNumber:t+1,video:e,className:ef.a.draggableVideoItem},i)):d.createElement(Zp,Object.assign({video:e},i))})))}));var af=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},of=Object(Yp.SortableContainer)((function(e){var t=e.forwardedRef,n=af(e,["forwardedRef"]);return d.createElement(rf,Object.assign({sortable:!0,ref:t},n))})),sf=function(e){return function(t){var n=t.node,r=e.current;if(r){r.classList.add(ef.a.sortingContainer);var i=r.querySelector(".".concat(ef.a.draggedVideoItem));n.childNodes.forEach((function(e,t){return i.childNodes[t].style.width="".concat(e.offsetWidth,"px")}))}}},cf=function(e,t){return function(n){var r=e.current;r&&r.classList.remove(ef.a.sortingContainer),t(n.oldIndex,n.newIndex)}};function lf(e){var t=e.onSortEnd,n=e.emptyMessage,r=af(e,["onSortEnd","emptyMessage"]),i=d.useRef();return Gp.isEmpty(e.videos)?d.createElement("div",null,n):d.createElement(uo.Table,{responsive:!0},d.createElement(nf,Object.assign({sortable:!0},e)),d.createElement(of,Object.assign({forwardedRef:i,onSortStart:sf(i),onSortEnd:cf(i,t),lockAxis:"y",lockToContainerEdges:!0,distance:1,helperClass:ef.a.draggedVideoItem,helperContainer:function(){return i.current}},r)))}function uf(e){var t=e.alias,n=e.onDelete;return d.createElement("li",{className:"list-group-item d-flex justify-content-between"},t.name,d.createElement(Al,{svgName:Sl.Delete,onClick:function(){return n(t.id)}}))}function pf(e){var t=e.aliases,n=e.onDelete;return d.createElement("ul",{className:"list-group mb-3"},t?t.map((function(e){return d.createElement(uf,{key:e.id,alias:e,onDelete:n})})):d.createElement("span",null,"Currently there are no aliases for this object."))}lf.defaultProps={emptyMessage:"There are no videos in this list."};var ff=Object(co.object)().shape({name:Object(co.string)().trim().max(255,"Name is too long").required("Name is required").default("")});function df(){var e=qa(),t=bo(e);return d.createElement(eo,null,d.createElement(vo,{label:"Create an alias",name:"name",id:"name",value:e.values.name,placeholder:"Add an alias"}),d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(Eo,{showSpinner:e.isSubmitting,type:"submit",disabled:!t},"Add")))}function mf(e){var t=e.onSave;return d.createElement(so,{initialValues:{name:""},validationSchema:ff,onSubmit:function(e,n){t(e,n)},resetOnSubmit:!0},d.createElement(df,null))}function hf(e){var t=e.onSave,n=e.aliases,r=e.onDelete;return d.createElement("div",{className:"w-50"},d.createElement("h1",null,"Aliases"),d.createElement(pf,{aliases:n,onDelete:r}),d.createElement(mf,{onSave:t}))}var gf=u.COMPANIES,yf=function(e){return{application:gf,action:o.Companies.EDIT_COMPANY,args:[e.id]}},vf=function(e){return r.AppLinkHelper.trigger(yf(e))};function bf(e){var t=i.useBasicFetch(Qt(e.cursor));return d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-3 w-50"},d.createElement(_l,{placeholder:"Search for a company",onSuggestionSelected:vf,getRemoteUrl:function(e){return"".concat("/api/domain/v1/search/companies/instant/raw","?q=").concat(e)},activationLength:2})),d.createElement(bp,{collection:t&&t.data,collectionAppLink:{application:gf,action:o.Companies.COMPANIES},newObjectAppLink:{application:gf,action:o.Companies.NEW_COMPANY},getObjectAppLink:yf,objectName:"Company"}))}function Sf(e){return(Sf="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 Ef(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cf(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 Of(e,t,n){return t&&Cf(e.prototype,t),n&&Cf(e,n),e}function If(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&&jf(e,t)}function jf(e,t){return(jf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Af(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=wf(e);if(t){var i=wf(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Tf(this,n)}}function Tf(e,t){return!t||"object"!==Sf(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 wf(e){return(wf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Lf,kf,_f=function(e){If(n,e);var t=Af(n);function n(){return Ef(this,n),t.apply(this,arguments)}return Of(n,[{key:"channelName",get:function(){return u.COMPANIES}},{key:"appRoutes",get:function(){return{"manage/companies(/)":"companies","manage/companies/new(/)":"newCompany","manage/companies/:id(/)":"editCompany"}}}]),n}(r.AppRouter),xf=function(e){If(n,e);var t=Af(n);function n(){return Ef(this,n),t.apply(this,arguments)}return Of(n,[{key:"companies",value:function(e){var t=e.cursor;this.layout.showChildView(ae,d.createElement(bf,{cursor:t}))}},{key:"newCompany",value:function(){this.layout.showChildView(ae,d.createElement(Po,null))}},{key:"editCompany",value:function(e){this.layout.showChildView(ae,d.createElement(xo,{id:e}))}},{key:"name",get:function(){return"Companies Application"}},{key:"channelName",get:function(){return u.COMPANIES}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return _f}}]),n}(r.Application),Pf=n(31);!function(e){e.Success="success",e.Warning="warning",e.Fail="danger",e.Info="info"}(Lf||(Lf={})),function(e){e.Success="Success! 🙌",e.Warning="Whoops...",e.Fail="Oops...",e.Info="FYI"}(kf||(kf={}));class Nf extends G{constructor(e){super(e)}initialize(){this.alertCollection=new U,this.listenTo(y.ALERT,"remove:alert",this.removeAlert),this.showAlerts()}get name(){return Io}get defaults(){return{maxAlerts:3}}showAlerts(){const e=h.Radio.channel(y.ALERT);let t={collection:this.alertCollection};this.options.alertViewCtor&&(t=m.extend({},t,{ctor:this.options.alertViewCtor})),e.trigger("show:alert",t)}removeAlert(e){this.alertCollection.remove(e),this.showAlerts()}createAlert(e){this.alertCollection.length===this.options.maxAlerts&&this.alertCollection.shift(),e.id||(e=m.extend({},e,{id:this.generateUniqueAlertId()})),this.alertCollection.push(new K(e)),this.showAlerts()}clearAllAlerts(){this.alertCollection.reset(null)}success(e){return"string"==typeof e?m.bind(()=>this.createAlert(m.extend({},this.options.defaultSuccessAlert,{message:e})),this):e.useXHR?m.bind((e,t)=>this.createAlert(m.extend({},this.options.defaultSuccessAlert,{message:t})),this):m.bind(()=>this.createAlert(m.extend({},this.options.defaultSuccessAlert,e)),this)}error(e){return"string"==typeof e?m.bind(()=>this.createAlert(m.extend({},this.options.defaultErrorAlert,{message:e})),this):e.useXHR?m.bind(e=>this.createAlert(m.extend({},this.options.defaultErrorAlert,{message:e.message})),this):m.bind(()=>this.createAlert(m.extend({},this.options.defaultErrorAlertIL_DEFAULT,e)),this)}generateUniqueAlertId(){return m.uniqueId("alert_")}}var Df=n(9),Rf=n.n(Df);function Ff(e){const{alert:t,svgName:n,svgClassName:r,closeAlert:i}=e,{message:a,heading:o,appLink:s,appLinkText:c,appLinkClassName:l=""}=t,u=Object(Oo.sanitize)(a);return d.createElement(d.Fragment,null,d.createElement("div",{className:"d-inline-block "+Rf.a.icon},d.createElement(Al,{svgName:n,className:"svg-container "+r})),d.createElement("div",{className:"pl-2 d-inline-block "+Rf.a.alertContent},d.createElement("p",{className:"p-0 m-0 pb-1 "+Rf.a.heading},o),d.createElement("p",{className:"p-0 m-0 "+Rf.a.message,dangerouslySetInnerHTML:{__html:u}}),!!s&&d.createElement(xl,{className:l,appLink:s},c)),d.createElement("div",{className:"close d-inline-block cursor-pointer",role:"button","aria-hidden":"true",onClick:i},"×"))}const Mf=e=>{switch(e.type){case Lf.Success:return Sl.CheckCircleOutline;case Lf.Fail:case Lf.Warning:return Sl.Warning;case Lf.Info:default:return Sl.Info}};function Uf({alert:e,closeAlert:t}){const[n,r]=d.useState(!0),i=d.useRef();d.useEffect(()=>{n?i.current=window.setTimeout(t,3e3):clearTimeout(i.current)},[n]);const a="text-"+e.type.toLowerCase();return d.createElement("li",{className:"bg-white mt-2 p-2 show clearfix "+Rf.a.alertItem,onMouseEnter:()=>r(!1),onMouseLeave:()=>r(!0)},d.createElement(Ff,{alert:e,svgName:Mf(e),svgClassName:a,closeAlert:t}))}function Vf({alerts:e,removeAlert:t}){return d.createElement("div",{className:Rf.a.alertBox},d.createElement(Pf.TransitionGroup,{component:"ul",className:Rf.a.alertList+" list-unstyled"},e&&e.map((e,n)=>d.createElement(Pf.CSSTransition,{key:n,timeout:200,classNames:"alert"},d.createElement(Uf,{alert:e,closeAlert:()=>t(e.id)})))))}function Bf(){return d.createElement("div",{className:"text-center p-5"},d.createElement(uo.Spinner,{as:"div",animation:"border",role:"status"}))}function zf(e){const{title:t,closeButton:n=!0,closePopup:r,onEntered:i,showLoadingSpinner:a}=e,o=Object.assign({show:!0,onHide:r},X.isFunction(i)?{onEntered:i}:{});return d.createElement(uo.Modal,Object.assign({},o),!!t&&d.createElement(uo.Modal.Header,{closeButton:n},d.createElement(uo.Modal.Title,null,t)),a?d.createElement(Bf,null):d.createElement(uo.Modal.Body,null,e.children))}var Hf=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 qf({buttons:e}){return d.createElement("div",{className:"d-flex justify-content-end border-top pt-3 px-3 mx-n3"},e.map((e,t)=>((e,t)=>{const{buttonText:n,type:r="button",isSpinnerButton:i,showSpinner:a=!1,className:o}=e,s=Hf(e,["buttonText","type","isSpinnerButton","showSpinner","className"]),c=Object.assign({key:t,type:r,className:"ml-2"+(o?" "+o:"")},s);return i?d.createElement(Eo,Object.assign({showSpinner:a},c),n):d.createElement(uo.Button,Object.assign({},c),n)})(e,t)))}var Jf,$f;!function(e){e.Boolean="System.Boolean",e.String="System.String",e.StaffRequest="ClickView.DomainApi.Models.Options.Enums.StaffRequestOption, ClickView.DomainApi.Models, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null",e.Long="System.Int64"}(Jf||(Jf={})),function(e){e[e.Permanent=0]="Permanent",e[e.Temporary=1]="Temporary"}($f||($f={}));var Kf={namespace:"domain_options"},Yf=function(){return"/api/domain/v3/settings/types"},Gf=function(e){return"/api/domain/v3/settings/types/".concat(e)},Wf=function(){return"/api/domain/v3/settings/types"},Zf=function(e){return"/api/domain/v3/settings/types/".concat(e)},Qf=function(e){return"/api/domain/v3/settings/types/".concat(e)},Xf="domain:options",ed="domain:option",td="update:domain:option",nd="delete:domain:option",rd=function(){return{key:Xf,url:Yf(),normalizeOptions:Kf}},id=function(e){return{key:"".concat(ed,":").concat(e),url:Gf(e),normalizeOptions:Kf}},ad=function(e,t,n){return e.type===Jf.String&&(e=cd(e)),{key:ed,url:Wf(),data:e,type:it.POST,success:t,error:n,invalidationKeys:[Xf],normalizeOptions:Kf}},od=function(e,t){return e.type===Jf.String&&(e=cd(e)),{key:"".concat(td,":").concat(e.id),url:Zf(e.id),data:e,type:it.PUT,always:t,formatData:function(){return e},normalizeOptions:Kf}},sd=function(e,t){return{key:"".concat(nd,":").concat(e),url:Qf(e),type:it.DELETE,invalidationKeys:[Xf],normalizeOptions:Kf,success:t}};function cd(e){var t=e.defaultValue;if('"'===t)return Object.assign(Object.assign({},e),{defaultValue:'"'.concat(t,'"')});var n=t.charAt(0),r=t.charAt(t.length-1);return'"'!==n&&(t='"'.concat(t)),'"'!==r&&(t="".concat(t,'"')),Object.assign(Object.assign({},e),{defaultValue:t})}function ld(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ud(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ud(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ud(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function pd(e){var t=ld(d.useState(!1),2),n=t[0],a=t[1],s=i.useBasicFetch(id(e.optionId)),c=Object(te.useDispatch)(),l=function(){e.closePopup(),r.AppLinkHelper.trigger({application:u.DOMAIN_OPTIONS,action:o.DomainOptions.DOMAIN_OPTIONS})};return d.createElement(zf,{title:"Delete Domain Option",closePopup:e.closePopup,showLoadingSpinner:!s.data},s.data&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,s.data.name),"?")),d.createElement(qf,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){a(!0),i.fetch(c,sd(e.optionId,l))},buttonText:"Yes, delete this domain option",isSpinnerButton:!0,showSpinner:n}]})))}var fd,dd=function(e){return{application:u.DOMAIN_OPTIONS,action:o.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]}},md={application:u.DOMAIN_OPTIONS,action:o.DomainOptions.NEW_DOMAIN_OPTION};function hd(){var e=i.useBasicFetch(rd());if(!e.data)return d.createElement(d.Fragment,null);var t=e.data.map((function(e){return e.displayName&&(e.name=e.displayName),e}));return d.createElement(d.Fragment,null,d.createElement("div",{className:"d-flex justify-content-between mb-2"},d.createElement("h5",{className:"d-inline-block m-0"},"Select a domain option type to edit:"),d.createElement(xl,{appLink:md,className:"d-block"},d.createElement(Al,{svgName:Sl.Plus,size:jl.Small}),d.createElement("span",null,"New Domain Option"))),d.createElement(xp,{objects:t,getAppLink:dd}))}!function(e){e[e.Audience=1]="Audience",e[e.Category=2]="Category",e[e.Channel=3]="Channel",e[e.Chapter=4]="Chapter",e[e.Comment=5]="Comment",e[e.OwnerComment=6]="OwnerComment",e[e.Image=7]="Image",e[e.Thumbnail=8]="Thumbnail",e[e.Avatar=9]="Avatar",e[e.Banner=10]="Banner",e[e.Video=11]="Video",e[e.Trailer=12]="Trailer",e[e.Rating=13]="Rating",e[e.Topic=14]="Topic",e[e.Series=15]="Series",e[e.Season=16]="Season",e[e.HostedMediaObjectCollection=17]="HostedMediaObjectCollection",e[e.ExchangeCollection=18]="ExchangeCollection",e[e.CustomMediaObjectCollection=19]="CustomMediaObjectCollection",e[e.Playlist=20]="Playlist",e[e.ClickViewTvCollection=21]="ClickViewTvCollection",e[e.ClickViewProductionsCollection=22]="ClickViewProductionsCollection",e[e.User=23]="User",e[e.SystemUser=24]="SystemUser",e[e.Customer=25]="Customer",e[e.Country=26]="Country",e[e.Organisation=28]="Organisation",e[e.SystemOrganisation=29]="SystemOrganisation",e[e.Group=30]="Group",e[e.SystemGroup=31]="SystemGroup",e[e.FlagReason=32]="FlagReason",e[e.Library=33]="Library",e[e.Interactive=34]="Interactive",e[e.WorkspaceCollection=35]="WorkspaceCollection",e[e.Conversation=36]="Conversation",e[e.Message=37]="Message",e[e.Notification=38]="Notification",e[e.Clip=39]="Clip",e[e.Link=40]="Link",e[e.UserChannel=41]="UserChannel",e[e.Resource=42]="Resource",e[e.VideoStream=43]="VideoStream",e[e.AudioStream=44]="AudioStream",e[e.Tag=45]="Tag",e[e.Subtitle=46]="Subtitle",e[e.LicencedContentCollection=47]="LicencedContentCollection",e[e.PublicCollection=48]="PublicCollection",e[e.CategoryTree=49]="CategoryTree",e[e.Logo=50]="Logo",e[e.Permission=51]="Permission",e[e.Subject=52]="Subject",e[e.Field=53]="Field",e[e.Company=54]="Company",e[e.Person=55]="Person",e[e.Cover=56]="Cover",e[e.Poster=57]="Poster",e[e.SubjectAudience=58]="SubjectAudience"}(fd||(fd={}));var gd=co.object().shape({id:co.string(),name:co.string().trim().max(64,"Name is too long").required("Name is required").default(""),displayName:co.string().trim().max(255,"Display name is too long").required("Display name is required").default(""),type:co.mixed().required("Type is required").default(Jf.Boolean),entityType:co.mixed().required("Entity type is required").default(fd.Customer),kind:co.mixed().required("Kind is required").default($f.Temporary),defaultValue:co.mixed().required("Default value is required").default("false")}).noUnknown();function yd(e){var t=e.type,n=e.defaultValue;if(!t)return d.createElement(d.Fragment,null);var r={label:"Default Value",name:"defaultValue",id:"defaultValue",value:n};return t===Jf.Boolean?d.createElement(vo,Object.assign({as:"select"},r),d.createElement("option",{value:"true"},"True"),d.createElement("option",{value:"false"},"False")):t===Jf.Long||t===Jf.StaffRequest?d.createElement(vo,Object.assign({as:"input",type:"number"},r)):t===Jf.String?d.createElement(vo,Object.assign({as:"input"},r)):void 0}var vd=[fd.Customer,fd.User];function bd(e){var t=null===e.id||void 0===e.id,n=qa(),r=bo(n);return d.createElement(eo,null,d.createElement(vo,{label:"Name (snake_case)",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this domain option",autoFocus:!0}),d.createElement(vo,{label:"Display Name",type:"text",name:"displayName",id:"displayName",value:n.values.displayName,placeholder:"Enter a display name for this domain option"}),d.createElement(vo,{as:"select",label:"Kind",name:"kind",id:"kind",value:n.values.kind},dt.getEnumKeys($f).map((function(e){return d.createElement("option",{key:e,value:$f[e]},e)}))),d.createElement(vo,{as:"select",label:"Entity",name:"entityType",id:"entityType",value:n.values.entityType},dt.getEnumKeys(fd).filter((function(e){return vd.includes(fd[e])})).map((function(e){return d.createElement("option",{key:e,value:fd[e]},e)}))),d.createElement(vo,{as:"select",label:"Type",name:"type",id:"type",value:n.values.type},dt.getEnumKeys(Jf).map((function(e){return d.createElement("option",{key:e,value:Jf[e]},e)}))),d.createElement(yd,{type:n.values.type,defaultValue:n.values.defaultValue}),d.createElement("div",{className:"d-flex justify-content-between"},d.createElement(Eo,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&d.createElement(uo.Button,{as:xl,variant:"danger",appLink:{application:u.DOMAIN_OPTIONS,action:o.DomainOptions.DELETE_DOMAIN_OPTION,args:[e.id]}},"Delete")))}function Sd(e){return d.createElement(so,{initialValues:e.domainOption,validationSchema:gd,onSubmit:e.saveDomainOption},d.createElement(bd,{id:e.domainOption&&e.domainOption.id}))}function Ed(){var e=Object(te.useDispatch)();return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Create New Domain Option"),d.createElement(Sd,{saveDomainOption:function(t,n){i.fetch(e,ad(t,(function(e){n(),r.AppLinkHelper.trigger({application:u.DOMAIN_OPTIONS,action:o.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]})}),n))}}))}function Cd(e){var t=e.optionId,n=i.useBasicFetch(id(t)),r=Object(te.useDispatch)();return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Edit Domain Option"),n.data&&d.createElement(Sd,{domainOption:n.data,saveDomainOption:function(e,t){return i.fetch(r,od(e,t))}}))}function Od(e){return(Od="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 Id(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jd(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 Ad(e,t,n){return t&&jd(e.prototype,t),n&&jd(e,n),e}function Td(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&&wd(e,t)}function wd(e,t){return(wd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ld(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=_d(e);if(t){var i=_d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return kd(this,n)}}function kd(e,t){return!t||"object"!==Od(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 _d(e){return(_d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var xd=function(e){Td(n,e);var t=Ld(n);function n(){return Id(this,n),t.apply(this,arguments)}return Ad(n,[{key:"channelName",get:function(){return u.DOMAIN_OPTIONS}},{key:"appRoutes",get:function(){return{"developer/options(/)":"domainOptions","developer/options/new(/)":"newDomainOption","developer/options/:id(/)":"editDomainOption"}}},{key:"appLinks",get:function(){return["deleteDomainOption"]}}]),n}(r.AppRouter),Pd=function(e){Td(n,e);var t=Ld(n);function n(){return Id(this,n),t.apply(this,arguments)}return Ad(n,[{key:"domainOptions",value:function(){this.layout.showChildView(ae,d.createElement(hd,null))}},{key:"newDomainOption",value:function(){this.layout.showChildView(ae,d.createElement(Ed,null))}},{key:"editDomainOption",value:function(e){this.layout.showChildView(ae,d.createElement(Cd,{optionId:e}))}},{key:"deleteDomainOption",value:function(e){this.layout.showChildView(oe,d.createElement(pd,Object.assign({optionId:e},this.getPopupProps())))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return h.Radio.channel(y.ALERT).trigger("remove:alert",e)};this.layout.showChildView(se,d.createElement(Vf,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Domain Options Application"}},{key:"channelName",get:function(){return u.DOMAIN_OPTIONS}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return xd}}]),n}(r.Application),Nd=function(e){return e?"".concat("/api/master/v2/people","?cursor=").concat(e):"/api/master/v2/people"},Dd=function(e){return"/api/master/v2/objects/".concat(e)},Rd=function(){return"/api/master/v2/people"},Fd=function(e){return"/api/master/v2/objects/".concat(e)},Md="people",Ud="person",Vd="update:person",Bd=function(e){return{key:"".concat(Md).concat(e?":".concat(e):""),url:Nd(e)}},zd=function(e){return{key:"".concat(Ud,":").concat(e),url:Dd(e)}},Hd=function(e,t,n){return{key:Ud,url:Rd(),data:e,type:it.POST,success:t,error:n,invalidationKeys:[Md]}},qd=function(e,t,n){return{key:"".concat(Vd,":").concat(e),url:Fd(e),data:t,type:it.PUT,always:n}},Jd=co.object().shape({name:co.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown();function $d(e){var t=qa();return d.createElement(eo,null,d.createElement(vo,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this person",autoFocus:!0}),d.createElement(Lo,{isNew:e.isNew}))}function Kd(e){return d.createElement(so,{initialValues:e.person,validationSchema:Jd,onSubmit:e.savePerson},d.createElement($d,{isNew:!(e.person&&e.person.id)}))}function Yd(e){var t=Object(te.useDispatch)(),n=i.useBasicFetch(zd(e.id));return d.createElement(d.Fragment,null,!!n.data&&d.createElement(Kd,{person:n.data,savePerson:function(n,r){return i.fetch(t,qd(e.id,n,r))}}))}function Gd(){var e=Object(te.useDispatch)();return d.createElement(Kd,{savePerson:function(t,n){i.fetch(e,Hd(t,(function(e){n(),r.AppLinkHelper.trigger({application:u.PEOPLE,action:o.People.EDIT_PERSON,args:[e.id]})}),n))}})}var Wd=u.PEOPLE,Zd=function(e){return{application:Wd,action:o.People.EDIT_PERSON,args:[e.id]}},Qd=function(e){return r.AppLinkHelper.trigger(Zd(e))};function Xd(e){var t=i.useBasicFetch(Bd(e.cursor));return d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-3 w-50"},d.createElement(_l,{placeholder:"Search for a person",onSuggestionSelected:Qd,getRemoteUrl:function(e){return"".concat("/api/domain/v1/search/people/instant/raw","?q=").concat(e)},activationLength:2})),d.createElement(bp,{collection:t&&t.data,collectionAppLink:{application:Wd,action:o.People.PEOPLE},newObjectAppLink:{application:Wd,action:o.People.NEW_PERSON},getObjectAppLink:Zd,objectName:"Person"}))}function em(e){return(em="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 tm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nm(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 rm(e,t,n){return t&&nm(e.prototype,t),n&&nm(e,n),e}function im(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&&am(e,t)}function am(e,t){return(am=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function om(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=cm(e);if(t){var i=cm(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return sm(this,n)}}function sm(e,t){return!t||"object"!==em(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 cm(e){return(cm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var lm=function(e){im(n,e);var t=om(n);function n(){return tm(this,n),t.apply(this,arguments)}return rm(n,[{key:"channelName",get:function(){return u.PEOPLE}},{key:"appRoutes",get:function(){return{"manage/people(/)":"people","manage/people/new(/)":"newPerson","manage/people/:id(/)":"editPerson"}}}]),n}(r.AppRouter),um=function(e){im(n,e);var t=om(n);function n(){return tm(this,n),t.apply(this,arguments)}return rm(n,[{key:"people",value:function(e){var t=e.cursor;this.layout.showChildView(ae,d.createElement(Xd,{cursor:t}))}},{key:"newPerson",value:function(){this.layout.showChildView(ae,d.createElement(Gd,null))}},{key:"editPerson",value:function(e){this.layout.showChildView(ae,d.createElement(Yd,{id:e}))}},{key:"name",get:function(){return"People Application"}},{key:"channelName",get:function(){return u.PEOPLE}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return lm}}]),n}(r.Application);function pm(e){return function(e){const t=fu.getInstance(e);return d.useEffect(()=>()=>fu.releaseInstance(e)),t}(e)}function fm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return dm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dm(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mm(e){var t=e.imageType,n=e.closePopup,r=d.useContext(uu),i=r.getDataUrl,a=r.setImage,o=fm(d.useState(i()),1)[0],s=fm(d.useState(!1),2),c=s[0],l=s[1],u=pm(f.IMAGE_UPLOAD),p=function(e){a(e),n()},m={dataUrl:o,imageType:t,minWidth:Gl[t].width,minHeight:Gl[t].height,onCrop:function(e){return u.uploadBase64Image(e,t,p,n)},onCancel:n};return d.createElement(zf,{title:"Crop Image",closePopup:n,onEntered:function(){return l(!0)}},c&&d.createElement(ap,Object.assign({},m)))}var hm=function(e){var t=e.children;return d.createElement(Au,null,d.createElement(pu,null,t))};const gm=()=>{const e=pm(Io);return{success(t){e.success(t)()},error(t){e.error(t)()},warning(t){e.createAlert({type:Lf.Warning,heading:kf.Warning,message:t})}}};function ym(e){var t=e.page,n=e.totalPages,r=Ro.isNumber(t)&&t>0&&t<n&&t+1,i=Ro.isNumber(t)&&t>1&&t-1,a={};if(r&&r<=n&&(a.next=r.toString()),i&&(a.previous=i.toString()),!dt.isEmpty(a))return a}var vm={convertLegacyPaginatedCollection:function(e){if(e)return{data:e.data,pagination:{cursors:ym(e.pagination),limit:e.pagination.pageSize}}}},bm=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"1";return{key:"playlists:".concat(e),url:"/ajax/playlists/curators?page=".concat(e),formatData:vm.convertLegacyPaginatedCollection}},Sm=function(e,t){var n="/api/domain/v1/search/playlists?query=".concat(e);return t&&(n+="&filter={page:".concat(t,"}")),{key:"playlists:search:".concat(e).concat(t?":".concat(t):""),url:n,formatData:vm.convertLegacyPaginatedCollection}},Em=function(e){return{key:"playlist:".concat(e),url:"/api/master/v2/objects/".concat(e,"?query=cover,banner")}},Cm=function(e){var t=e.slice().sort();return{key:"playlists:".concat(t.join(",")),url:"/api/master/v2/objects?".concat(t.map((function(e){return"id=".concat(e)})).join("&"))}},Om=function(e,t,n,r,i){return{url:"/api/master/v2/objects/".concat(t,"/playlists"),key:"playlist",data:e,type:it.POST,invalidationKeys:"playlists",success:n,error:r,always:i}},Im=function(e,t,n,r,i){return{url:"/api/master/v2/objects/".concat(e),key:"update:playlist:".concat(e),data:t,type:it.PUT,success:n,error:r,always:i}},jm=function(e,t,n,r){return{url:"/api/master/v1/playlists/".concat(e),key:"delete:playlist:".concat(e),type:it.DELETE,invalidationKeys:"playlists",success:t,error:n,always:r}},Am=function(e){return{key:"playlist:".concat(e,":videos"),url:"/api/master/v2/objects/".concat(e,"/videos?query={orderBy:orderindex,limit:100}")}},Tm=function(e,t,n,r){return{key:"reorder:playlist",url:"/api/master/v1/objects/".concat(e,"/videos/reorder"),data:t,type:it.PUT,invalidationKeys:"playlist:".concat(e,":videos"),success:n,error:r}},wm=function(e,t,n,r,i){return{key:"remove:playlist:video",url:"/api/master/v1/playlists/".concat(e,"/dissociate/").concat(t),type:it.DELETE,invalidationKeys:"playlist:".concat(e,":videos"),success:n,error:r,always:i}};function Lm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return km(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return km(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function km(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _m(e){var t=Object(te.useDispatch)(),n=gm(),a=Lm(d.useState(!1),2),s=a[0],c=a[1],l=i.useBasicFetch(Em(e.playlistId));var p=[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){c(!0),i.fetch(t,jm(e.playlistId,(function(){n.success("Successfully deleted playlist."),r.AppLinkHelper.trigger({application:u.PLAYLISTS,action:o.Playlists.PLAYLISTS})}),(function(){c(!1),n.error("Failed to delete playlist.")}),e.closePopup))},buttonText:"Yes, delete playlist",isSpinnerButton:!0,showSpinner:s}],f=!!l.data;return d.createElement(zf,{title:"Delete Playlist",closePopup:e.closePopup,showLoadingSpinner:!f},f&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,l.data.name),"?"),d.createElement("p",null,"Please ensure it is not being used in any widgets.")),d.createElement(qf,{buttons:p})))}var xm=co.object().shape({name:co.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:co.string().trim().max(65535,"Description is too long").default(""),cover:co.object().shape({fileId:co.string(),fileIdType:co.mixed(),url:co.string()}).default({}).noUnknown(),banner:co.object().shape({fileId:co.string(),fileIdType:co.mixed(),url:co.string()}).default({}).noUnknown()}).noUnknown(),Pm=function(e,t){var n=u.PLAYLISTS,r=o.Playlists,i=[{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 eu(e)&&i.push.apply(i,[{label:"Subjects",appLink:{application:n,action:r.EDIT_PLAYLIST_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_PLAYLIST_AUDIENCES,args:[t]}}]),i};function Nm(e){var t=qa(),n=bo(t);return d.createElement(eo,null,d.createElement(vo,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this playlist",autoFocus:!0}),d.createElement(vo,{label:"Description",as:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this playlist here"}),d.createElement(_u,{imageType:Ul.Covers,fieldName:"cover",application:u.PLAYLISTS,uploadAction:o.Playlists.UPLOAD_IMAGE}),d.createElement(_u,{imageType:Ul.Banners,fieldName:"banner",application:u.PLAYLISTS,uploadAction:o.Playlists.UPLOAD_IMAGE}),d.createElement("div",{className:"d-flex justify-content-between align-items-center"},d.createElement(Eo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&d.createElement(wp,{actions:e.actions})))}function Dm(e){var t,n=e.playlist&&e.playlist.id;return d.createElement(so,{initialValues:e.playlist,validationSchema:xm,onSubmit:e.savePlaylist},d.createElement(Nm,{id:n,actions:!!n&&(t=n,[{label:"Delete playlist",appLink:{application:u.PLAYLISTS,action:o.Playlists.DELETE_PLAYLIST,args:[t]},className:"text-danger"}])}))}var Rm=function(e){return function(t){return t.appLink.action===e}};function Fm(e){var t=e.playlistId,n=e.activeAction,r=d.useContext(ju);return d.createElement("div",{className:"py-2"},!!r&&d.createElement(Np,{tabs:Pm(r,t),isItemActive:Rm(n)}))}function Mm(e){var t=Object(te.useDispatch)(),n=gm(),r=i.useBasicFetch(Em(e.playlistId));return d.createElement(d.Fragment,null,d.createElement(Fm,{playlistId:e.playlistId,activeAction:o.Playlists.EDIT_PLAYLIST}),!!r.data&&d.createElement(Dm,{playlist:r.data,savePlaylist:function(r,a){i.fetch(t,Im(e.playlistId,r,(function(){n.success("Successfully updated playlist.")}),(function(){n.error("Failed to update playlist.")}),a))}}))}const Um=e=>Array(Array.isArray(e)?e.length:0).fill(!1);function Vm(e,t,n=!0){const[r,i]=d.useState(Um(e));d.useEffect(()=>{i(Um(e))},[...t]),d.useEffect(()=>{if(!n)return;const t=[];return e&&e.forEach((e,n)=>{t.push(du.fetch(e,e=>{e!==r[n]&&i(Vt.cloneAndReplaceAtIdx(r,n,e))}))}),()=>t.forEach(e=>e())},[r,n])}const Bm={getSetStateByKey:(e,t,n)=>r=>e(e=>{const i=X.isFunction(n)?n:X.useIdentity();return Object.assign(Object.assign({},e),{[t]:i(r,e)})})};var zm,Hm,qm,Jm;!function(e){e[e.Subject=0]="Subject",e[e.Classification=1]="Classification"}(zm||(zm={})),function(e){e.Playlists="playlists",e.Series="series",e.Videos="videos"}(Hm||(Hm={})),function(e){e.Root="0"}(qm||(qm={})),function(e){e.Root="root"}(Jm||(Jm={}));var $m,Km=co.object().shape({name:co.string().trim().max(255,"Name is too long").required("Name is required").default(""),levelIds:co.array().of(co.string()).required("A level is required").default([])}).noUnknown();!function(e){e.Subject="Subject",e.Topic="Topic"}($m||($m={}));var Ym=co.object().shape({name:co.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentIds:co.array().of(co.string()).default([Jm.Root]),subjectIds:co.array().of(co.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:co.mixed().required("Type is required").default($m.Subject),emphasize:co.boolean().default(!1),comingSoon:co.boolean().default(!0),canBePreferred:co.boolean().default(!1),cover:co.object().shape({fileId:co.string(),fileIdType:co.mixed(),url:co.string()}).default({}).noUnknown(),banner:co.object().shape({fileId:co.string(),fileIdType:co.mixed(),url:co.string()}).default({}).noUnknown()}).noUnknown(),Gm=co.object().shape({name:co.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),Wm=co.object().shape({name:co.string().max(255,"Name is too long").required("Name is required"),description:co.string().max(65535,"Description is too long").required("Description is required")}),Zm=co.object().shape({name:co.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentId:co.string().default(qm.Root)}).noUnknown(),Qm={singularizeMemberType:function(e){switch(e){case Hm.Playlists:return"playlist";case Hm.Series:return"series";case Hm.Videos:return"video"}},getMemberAppLink:function(e,t){var n=[t];switch(e){case Hm.Playlists:return{application:u.PLAYLISTS,action:o.Playlists.EDIT_PLAYLIST,args:n};case Hm.Series:return{application:u.SERIES,action:o.Series.EDIT_SERIES,args:n};case Hm.Videos:return{application:u.VIDEOS,action:o.Videos.EDIT_VIDEO,args:n}}},getMemberActions:function(e,t,n,r){return[{label:"Remove ".concat(Qm.singularizeMemberType(n)),appLink:{application:u.SUBJECTS,action:t===zm.Subject?o.Subjects.REMOVE_SUBJECT_MEMBER:o.Subjects.REMOVE_CLASSIFICATION_MEMBER,args:[e,r,n]},className:"text-danger"}]}},Xm=function(){var e=u.SUBJECTS,t=o.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]}]},eh=function(e){var t=u.SUBJECTS,n=o.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]}}]},th=function(e,t){var n=u.SUBJECTS,r=o.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 nh(e){return(nh="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 rh(e){return function(e){if(Array.isArray(e))return ih(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return ih(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ih(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ih(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ah(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oh(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 sh(e,t){return(sh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ch(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=uh(e);if(t){var i=uh(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return lh(this,n)}}function lh(e,t){return!t||"object"!==nh(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 uh(e){return(uh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ph=function(){return"/api/subjects/v1/subjects/tree"},fh=function(e){return"/api/subjects/v1/subjects/".concat(e)},dh=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/").concat(t,"?query={limit:100}")},mh=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},hh=function(){return"/api/subjects/v1/subjects"},gh=function(e){return"/api/subjects/v1/subjects/".concat(e)},yh=function(e){return"/api/subjects/v1/subjects/".concat(e)},vh=function(e){return"/api/subjects/v1/objects/".concat(e,"/subjects")},bh=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/subjects?addToClassifications=").concat(!!t)},Sh=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?addToClassifications=").concat(!!t)},Eh=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Ch=function(){return"/api/subjects/v1/presentations"},Oh=function(e){return"/api/subjects/v1/presentations/".concat(e)},Ih=function(){return"/api/subjects/v1/presentations"},jh=function(e){return"/api/subjects/v1/presentations/".concat(e)},Ah=function(e){return"/api/subjects/v1/presentations/".concat(e,"/classifications/tree")},Th=function(e){return"/api/subjects/v1/classifications/".concat(e,"?query=cover,banner")},wh=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/").concat(t,"?query={limit:100}")},Lh=function(){return"/api/subjects/v1/classifications"},kh=function(e){return"/api/subjects/v1/classifications/".concat(e)},_h=function(e){return"/api/subjects/v1/classifications/".concat(e)},xh=function(e){return"/api/subjects/v1/objects/".concat(e,"/classifications")},Ph=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/classifications?presentationId=").concat(t)},Nh=function(e){return"/api/subjects/v1/classifications/".concat(e,"/objects")},Dh=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Rh=function(){return"/api/subjects/v1/levels"},Fh=function(e){return"/api/subjects/v1/levels/".concat(e)},Mh=function(){return"/api/subjects/v1/levels"},Uh=function(e){return"/api/subjects/v1/levels/".concat(e)},Vh=function(e){return"/api/subjects/v1/objects/".concat(e,"/levels")},Bh=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/levels?addToAudiences=").concat(!!t)},zh=function(e){return"/api/subjects/v1/presentations/".concat(e,"/audiences")},Hh=function(e){return"/api/subjects/v1/audiences/".concat(e)},qh=function(){return"/api/subjects/v1/audiences"},Jh=function(e){return"/api/subjects/v1/audiences/".concat(e)},$h=function(e){return"/api/subjects/v1/audiences/".concat(e)},Kh=function(e){return"/api/subjects/v1/objects/".concat(e,"/audiences")},Yh=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/audiences?presentationId=").concat(t)},Gh=function(e,t,n){var r="".concat(s.SUBJECT,":").concat(e);return t&&(r+=":".concat(t)),r+=":".concat(s.CLASSIFICATIONS),n&&(r+=":".concat(n)),r},Wh=function(e){!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&&sh(e,t)}(a,e);var t,n,r,i=ch(a);function a(){return ah(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"getPresentations",value:function(e,t){return this.get({resource:Ch(),eventPrefix:s.PRESENTATIONS,expiryTime:qe.STANDARD,callback:e,errorCallback:t})}},{key:"getPresentation",value:function(e,t,n){return this.get({resource:Oh(e),eventPrefix:"".concat(s.PRESENTATION,":").concat(e),expiryTime:qe.STANDARD,callback:t,errorCallback:n})}},{key:"createPresentation",value:function(e,t,n){return this.create({resource:Ih(),data:e,callback:t,errorCallback:n,eventPrefix:s.PRESENTATION,invalidationKeys:[s.PRESENTATIONS],expiryTime:qe.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:jh(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(s.UPDATE_PRESENTATION,":").concat(e),invalidationKeys:["".concat(s.PRESENTATION,":").concat(e),s.PRESENTATIONS],expiryTime:qe.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:ph(),formatData:function(e){return{children:e,name:qm.Root,id:null}},eventPrefix:s.SUBJECTS,expiryTime:qe.STANDARD,callback:e,errorCallback:t})}},{key:"getSubject",value:function(e,t,n){return this.get({resource:fh(e),eventPrefix:"".concat(s.SUBJECT,":").concat(e),expiryTime:qe.STANDARD,callback:t,errorCallback:n})}},{key:"getSubjectMemberIds",value:function(e,t,n,r){return this.get({resource:dh(e,t),eventPrefix:"".concat(s.SUBJECT,":").concat(e,":").concat(t),expiryTime:qe.STANDARD,callback:n,errorCallback:r})}},{key:"getSubjectClassifications",value:function(e,t,n,r,i){return this.get({resource:mh(e,t,n),eventPrefix:Gh(e,t,n),expiryTime:qe.STANDARD,callback:r,errorCallback:i})}},{key:"createSubject",value:function(e,t,n){return this.create({resource:hh(),data:e,callback:t,errorCallback:n,eventPrefix:s.SUBJECT,invalidationKeys:[s.SUBJECTS],expiryTime:qe.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:gh(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(s.UPDATE_SUBJECT,":").concat(e),invalidationKeys:["".concat(s.SUBJECT,":").concat(e),s.SUBJECTS],expiryTime:qe.STANDARD,successHandler:this.alertService.success("Successfully updated subject."),errorHandler:this.alertService.error("Failed to save subject.")})}},{key:"deleteSubject",value:function(e,t,n){var r=this;return this.delete({resource:yh(e),callback:t,errorCallback:n,eventPrefix:s.DELETE_SUBJECT,invalidationKeys:["".concat(s.SUBJECT,":").concat(e),s.SUBJECTS],successHandler:this.alertService.success("Successfully deleted subject."),errorHandler:function(e){var t,n=(null===(t=e)||void 0===t?void 0:t.code)===Pt.Conflict?"Cannot delete a subject with child subjects and/or classifications.":"Failed to delete subject.";r.alertService.error(n)()}})}},{key:"getObjectSubjects",value:function(e,t,n,r){return this.get({resource:vh(e),eventPrefix:"".concat(t,":").concat(e,":").concat(s.SUBJECTS),expiryTime:qe.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectSubjects",value:function(e,t,n,r,i,a){var o=Qm.singularizeMemberType(n),c=["".concat(n,":").concat(e,":").concat(s.SUBJECTS)];return r&&c.push("".concat(n,":").concat(e,":").concat(s.CLASSIFICATIONS)),c.push.apply(c,rh(t.map((function(e){return"".concat(s.SUBJECTS,":").concat(e,":").concat(n)})))),this.update({resource:bh(e,r),data:t,callback:i,errorCallback:a,eventPrefix:"".concat(s.UPDATE_OBJECT_SUBJECTS,":").concat(e),invalidationKeys:c,successHandler:this.alertService.success("Successfully updated ".concat(o," subjects.")),errorHandler:this.alertService.error("Failed to update ".concat(o," subjects."))})}},{key:"addObjectsToSubject",value:function(e,t,n,r,i,a){var o=1===t.length?Qm.singularizeMemberType(n):n,c=["".concat(s.SUBJECT,":").concat(e,":").concat(n)].concat(rh(t.map((function(e){return"".concat(n,":").concat(e,":").concat(s.SUBJECTS)}))),rh(t.map((function(e){return"".concat(n,":").concat(e,":").concat(s.CLASSIFICATIONS)}))));return this.create({resource:Sh(e,r),data:t,callback:i,errorCallback:a,eventPrefix:"".concat(s.ADD_TO_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:c,expiryTime:qe.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(o," to subject.")),errorHandler:this.alertService.error("Failed to add ".concat(o," to subject."))})}},{key:"removeObjectsFromSubject",value:function(e,t,n,r,i){var a=1===t.length?Qm.singularizeMemberType(n):n,o=["".concat(s.SUBJECT,":").concat(e,":").concat(n)].concat(rh(t.map((function(e){return"".concat(n,":").concat(e,":").concat(s.SUBJECTS)}))));return this.delete({resource:Eh(e,t),callback:r,errorCallback:i,eventPrefix:"".concat(s.REMOVE_FROM_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:o,expiryTime:qe.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(a," from subject.")),errorHandler:this.alertService.error("Failed to remove ".concat(a," from subject."))})}},{key:"getClassificationTree",value:function(e,t,n){return this.get({resource:Ah(e),formatData:function(e){return{children:e,name:Jm.Root,id:null}},eventPrefix:"".concat(s.CLASSIFICATIONS,":").concat(e),expiryTime:qe.STANDARD,callback:t,errorCallback:n})}},{key:"getClassification",value:function(e,t,n){return this.get({resource:Th(e),eventPrefix:"".concat(s.CLASSIFICATION,":").concat(e),expiryTime:qe.STANDARD,callback:t,errorCallback:n})}},{key:"getClassificationMembers",value:function(e,t,n,r){return this.get({resource:wh(e,t),eventPrefix:"".concat(s.CLASSIFICATION,":").concat(e,":").concat(t),expiryTime:qe.STANDARD,callback:n,errorCallback:r})}},{key:"createClassification",value:function(e,t,n){return this.create({resource:Lh(),data:e,callback:t,errorCallback:n,eventPrefix:s.CLASSIFICATION,invalidationKeys:[s.CLASSIFICATIONS],expiryTime:qe.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:kh(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(s.UPDATE_CLASSIFICATION,":").concat(e),invalidationKeys:["".concat(s.CLASSIFICATION,":").concat(e),s.CLASSIFICATIONS],expiryTime:qe.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:_h(e),callback:t,errorCallback:n,eventPrefix:s.DELETE_CLASSIFICATION,invalidationKeys:["".concat(s.CLASSIFICATION,":").concat(e),s.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:xh(e),eventPrefix:"".concat(t,":").concat(e,":").concat(s.CLASSIFICATIONS),expiryTime:qe.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectClassifications",value:function(e,t,n,r,i,a){var o=Qm.singularizeMemberType(r),c=["".concat(r,":").concat(e,":").concat(s.CLASSIFICATIONS)];return c.push.apply(c,rh(n.map((function(e){return"".concat(s.CLASSIFICATION,":").concat(e,":").concat(r)})))),this.update({resource:Ph(e,t),data:n,callback:i,errorCallback:a,eventPrefix:"".concat(s.UPDATE_OBJECT_CLASSIFICATIONS,":").concat(e),invalidationKeys:c,successHandler:this.alertService.success("Successfully updated ".concat(o," classifications.")),errorHandler:this.alertService.error("Failed to update ".concat(o," classifications."))})}},{key:"addObjectsToClassification",value:function(e,t,n,r,i,a,o){var c=1===t.length?Qm.singularizeMemberType(n):n,l=["".concat(s.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&l.push(Gh(r,i,n)),l.push.apply(l,rh(t.map((function(e){return"".concat(n,":").concat(e,":").concat(s.CLASSIFICATIONS)})))),this.create({resource:Nh(e),data:t,callback:a,errorCallback:o,eventPrefix:"".concat(s.ADD_TO_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:l,expiryTime:qe.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(c," to classification.")),errorHandler:this.alertService.error("Failed to add ".concat(c," to classification."))})}},{key:"removeObjectsFromClassification",value:function(e,t,n,r,i,a,o){var c=1===t.length?Qm.singularizeMemberType(n):n,l=["".concat(s.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&l.push(Gh(r,i,n)),l.push.apply(l,rh(t.map((function(e){return"".concat(n,":").concat(e,":").concat(s.CLASSIFICATIONS)})))),this.delete({resource:Dh(e,t),callback:a,errorCallback:o,eventPrefix:"".concat(s.REMOVE_FROM_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:l,expiryTime:qe.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(c," from classification.")),errorHandler:this.alertService.error("Failed to remove ".concat(c," from classification."))})}},{key:"getLevels",value:function(e,t){return this.get({resource:Rh(),eventPrefix:s.LEVELS,expiryTime:qe.STANDARD,callback:e,errorCallback:t})}},{key:"getLevel",value:function(e,t,n){return this.get({resource:Fh(e),eventPrefix:"".concat(s.LEVEL,":").concat(e),expiryTime:qe.STANDARD,callback:t,errorCallback:n})}},{key:"createLevel",value:function(e,t,n){return this.create({resource:Mh(),data:e,callback:t,errorCallback:n,eventPrefix:s.LEVEL,invalidationKeys:[s.LEVELS],expiryTime:qe.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:Uh(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(s.UPDATE_LEVEL,":").concat(e),invalidationKeys:["".concat(s.LEVEL,":").concat(e),s.LEVELS],expiryTime:qe.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:Vh(e),eventPrefix:"".concat(t,":").concat(e,":").concat(s.LEVELS),expiryTime:qe.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectLevels",value:function(e,t,n,r,i,a){var o=Qm.singularizeMemberType(n),c=["".concat(n,":").concat(e,":").concat(s.LEVELS)];return r&&c.push("".concat(n,":").concat(e,":").concat(s.AUDIENCES)),this.update({resource:Bh(e,r),data:t,callback:i,errorCallback:a,eventPrefix:"".concat(s.UPDATE_OBJECT_LEVELS,":").concat(e),invalidationKeys:c,successHandler:this.alertService.success("Successfully updated ".concat(o," levels.")),errorHandler:this.alertService.error("Failed to update ".concat(o," levels."))})}},{key:"getAudiences",value:function(e,t,n){return this.get({resource:zh(e),callback:t,errorCallback:n,eventPrefix:"".concat(s.AUDIENCES,":").concat(e),expiryTime:qe.STANDARD})}},{key:"getAudience",value:function(e,t,n){return this.get({resource:Hh(e),callback:t,errorCallback:n,eventPrefix:"".concat(s.AUDIENCE,":").concat(e),expiryTime:qe.STANDARD})}},{key:"createAudience",value:function(e,t,n){return this.create({resource:qh(),data:e,callback:t,errorCallback:n,eventPrefix:s.AUDIENCE,invalidationKeys:[s.AUDIENCES],expiryTime:qe.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:Jh(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(s.UPDATE_AUDIENCE,":").concat(e),invalidationKeys:["".concat(s.AUDIENCE,":").concat(e),s.AUDIENCES],expiryTime:qe.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:$h(e),callback:t,errorCallback:n,eventPrefix:s.DELETE_AUDIENCE,invalidationKeys:["".concat(s.AUDIENCE,":").concat(e),s.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:Kh(e),eventPrefix:"".concat(t,":").concat(e,":").concat(s.AUDIENCES),expiryTime:qe.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectAudiences",value:function(e,t,n,r,i,a){var o=Qm.singularizeMemberType(r);return this.update({resource:Yh(e,t),data:n,callback:i,errorCallback:a,eventPrefix:"".concat(s.UPDATE_OBJECT_AUDIENCES,":").concat(e),invalidationKeys:["".concat(r,":").concat(e,":").concat(s.AUDIENCES)],successHandler:this.alertService.success("Successfully updated ".concat(o," audiences.")),errorHandler:this.alertService.error("Failed to update ".concat(o," audiences."))})}},{key:"name",get:function(){return f.SUBJECT}},{key:"channelName",get:function(){return p.SUBJECT}}])&&oh(t.prototype,n),r&&oh(t,r),a}(De),Zh={dataServiceName:f.SUBJECT,dataChannelName:p.SUBJECT},Qh={getSubjectTreeFetchOptions:function(e,t){return Object.assign(Object.assign({},Zh),{eventPrefix:s.SUBJECTS,fetchData:function(e){return e.getSubjectTree()},setData:e,onError:t})},getSubjectFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Zh),{eventPrefix:"".concat(s.SUBJECT,":").concat(e),fetchData:function(t){return t.getSubject(e)},setData:t,onError:n,deleteEventPrefix:s.DELETE_SUBJECT})},getSubjectMemberIdsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Zh),{eventPrefix:"".concat(s.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({},Zh),{eventPrefix:Gh(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({},Zh),{eventPrefix:"".concat(t,":").concat(e,":").concat(s.SUBJECTS),fetchData:function(n){return n.getObjectSubjects(e,t)},setData:n,onError:r})},getPresentationsFetchOptions:function(e,t){return Object.assign(Object.assign({},Zh),{eventPrefix:s.PRESENTATIONS,fetchData:function(e){return e.getPresentations()},setData:e,onError:t})},getPresentationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Zh),{eventPrefix:"".concat(s.PRESENTATION,":").concat(e),fetchData:function(t){return t.getPresentation(e)},setData:t,onError:n})},getClassificationTreeFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Zh),{eventPrefix:"".concat(s.CLASSIFICATIONS,":").concat(e),fetchData:function(t){return t.getClassificationTree(e)},setData:t,onError:n})},getClassificationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Zh),{eventPrefix:"".concat(s.CLASSIFICATION,":").concat(e),fetchData:function(t){return t.getClassification(e)},setData:t,onError:n,deleteEventPrefix:s.DELETE_CLASSIFICATION})},getClassificationMembersFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Zh),{eventPrefix:"".concat(s.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({},Zh),{eventPrefix:"".concat(t,":").concat(e,":").concat(s.CLASSIFICATIONS),fetchData:function(n){return n.getObjectClassifications(e,t)},setData:n,onError:r})},getLevelsFetchOptions:function(e,t){return Object.assign(Object.assign({},Zh),{eventPrefix:s.LEVELS,fetchData:function(e){return e.getLevels()},setData:e,onError:t})},getLevelFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Zh),{eventPrefix:"".concat(s.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({},Zh),{eventPrefix:"".concat(t,":").concat(e,":").concat(s.LEVELS),fetchData:function(n){return n.getObjectLevels(e,t)},setData:n,onError:r})},getAudiencesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Zh),{eventPrefix:"".concat(s.AUDIENCES,":").concat(e),fetchData:function(t){return t.getAudiences(e)},setData:t,onError:n})},getAudienceFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Zh),{eventPrefix:"".concat(s.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({},Zh),{eventPrefix:"".concat(t,":").concat(e,":").concat(s.AUDIENCES),fetchData:function(n){return n.getObjectAudiences(e,t)},setData:n,onError:r})}},Xh=function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_LEVEL,args:[e.id]}},eg=function(e,t){var n=e.levelIds;return t.filter((function(e){return n.includes(e.id)}))};function tg(e){var t=e.showLevels;return d.createElement("thead",null,d.createElement("tr",null,d.createElement("th",null,"Audiences"),!!t&&d.createElement("th",null,"Mapped Level(s)")))}function ng(e){var t,n=e.audience,r=e.levels;return d.createElement("tr",null,d.createElement("td",null,d.createElement(xl,{appLink:(t=n,{application:u.SUBJECTS,action:o.Subjects.EDIT_AUDIENCE,args:[t.presentationId,t.masterId]})},n.name)),d.createElement("td",null,r.map((function(e){return d.createElement(xl,{key:e.id,appLink:Xh(e),className:"mr-2"},e.name)}))))}function rg(e){var t=e.audiences,n=e.levels;return d.createElement(uo.Table,{responsive:!0,bordered:!0},d.createElement(tg,{showLevels:!!t.length}),d.createElement("tbody",null,t.length?t.map((function(e){return d.createElement(ng,{key:e.masterId,audience:e,levels:eg(e,n)})})):d.createElement("tr",null,d.createElement("td",null,"This presentation has no audiences."))))}function ig(e){var t=null===e.masterId||void 0===e.masterId,n=qa(),r=bo(n);return d.createElement(eo,null,d.createElement(vo,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this audience",autoFocus:!0}),d.createElement(vo,{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 d.createElement("option",{key:e.id,value:e.id},e.name)}))),d.createElement("div",{className:"d-flex justify-content-between"},d.createElement(Eo,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&d.createElement(uo.Button,{as:xl,variant:"danger",appLink:{application:u.SUBJECTS,action:o.Subjects.DELETE_AUDIENCE,args:[e.presentationId,e.masterId]}},"Delete")))}function ag(e){return d.createElement(so,{initialValues:e.audience,validationSchema:Km,onSubmit:e.saveAudience},d.createElement(ig,{masterId:e.audience&&e.audience.masterId,presentationId:e.presentationId,levels:e.levels}))}function og(e){var t=e.objectAudiences,n=e.presentationAudiences;return t.filter((function(e){return n.some((function(t){return t.masterId===e.masterId}))}))}function sg(e){var t,n,r,i,a,o=Qm.singularizeMemberType(e.memberType),s=(n=(t=e).presentationAudiences,r=t.objectLevels,i=t.objectAudiences,a=r.map((function(e){return e.id})),n.filter((function(e){return Vt.intersection(e.levelIds,a).length||i.some((function(t){return t.masterId===e.masterId}))})));return d.createElement(d.Fragment,null,d.createElement("div",{className:"border-bottom pb-3 mb-3"},d.createElement("h6",null,"Levels"),d.createElement("p",null,"Select which levels this ".concat(o," is mapped to.")),d.createElement("p",null,"To see how levels correspond to audiences, scroll down to the audience-level mappings table."),d.createElement(wg,{initialValues:{levelIds:e.objectLevels.map((function(e){return e.id})),addToAudiences:!0},saveLevels:e.saveLevels,levels:e.levels,memberType:e.memberType})),d.createElement("h6",null,"Audiences"),d.createElement("p",null,"Select a presentation to view its audiences and map them to this ".concat(o,".")),d.createElement("div",{className:"w-50 pb-3"},d.createElement(_g,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),d.createElement("p",null,"Audience to level mappings for this presentation are displayed below."),d.createElement(rg,{levels:e.levels,audiences:e.presentationAudiences}),d.createElement("p",null,"Only the audiences which are mapped to a level that this"+" ".concat(o," is mapped to are displayed below.")),!!s.length&&d.createElement(lg,{initialValues:{audienceIds:og(e).map((function(e){return e.masterId}))},saveAudiences:e.saveAudiences,audiences:s}))}function cg(e){var t=qa(),n=bo(t);return d.createElement(eo,null,d.createElement(vo,{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 d.createElement("option",{key:e.masterId,value:e.masterId},e.name)}))),d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(Eo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Audiences")))}function lg(e){return d.createElement(so,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.audienceIds;return e.saveAudiences(r,n)},enableReinitialize:!0},d.createElement(cg,{audiences:e.audiences}))}function ug(e){var t=e.item,n=e.getItemAppLink,r=e.actions,i=e.pinState;return d.createElement("tr",null,d.createElement("td",null,d.createElement(xl,{appLink:n(t)},t.name)),i.isPinnable&&d.createElement("td",null,d.createElement(Fl,{selected:parseInt(t.id)===parseInt(i.currentPinnedVideo),onToggle:function(e){return i.onChange(e,t.id)},id:t.id})),r&&d.createElement("td",null,d.createElement("span",{className:"d-flex justify-content-end"},d.createElement(wp,{actions:r}))))}function pg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return fg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fg(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return mg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mg(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function hg(e){var t=e.items,n=e.memberType,r=e.classification,i=e.getItemAppLink,a=e.getActions,o=e.updatePinnedVideo,s=dg(d.useState(!1),2),c=s[0],l=s[1],u=function(e,t){var n=e.pinnedVideoMasterId||null,r=pg(d.useState(n),2),i=r[0],a=r[1];return{currentPinnedVideo:i,onChange:function(e,t){a(e?t:null)},canSubmit:n!==i,isPinnable:t===Hm.Videos}}(r,n);if(!t.length)return d.createElement("div",{className:"py-5"},"No ".concat(n," in this classification."));var p="".concat(ru(Qm.singularizeMemberType(n))," Name");return d.createElement(d.Fragment,null,d.createElement(uo.Table,{responsive:!0},d.createElement("thead",null,d.createElement("tr",null,d.createElement("th",null,p),u.isPinnable&&d.createElement("th",null,"Pinned"),X.isFunction(a)&&d.createElement("th",null))),d.createElement("tbody",null,t.map((function(e){return d.createElement(ug,{item:e,key:e.id,getItemAppLink:i,actions:X.isFunction(a)&&a(e),pinState:u})})))),u.isPinnable&&d.createElement(Eo,{showSpinner:c,onClick:function(){l(!0),o(u.currentPinnedVideo,(function(){return l(!1)}))},disabled:!u.canSubmit||c},"Save"))}function gg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return yg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yg(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var vg=function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_SUBJECT,args:[e]}};function bg(e){var t=qa(),n=bo(t),r=null===e.id||void 0===e.id,i=!r||!(!t.values.parentIds||!t.values.parentIds.length),a=gg(d.useState(i),2),s=a[0],c=a[1];d.useEffect((function(){return c(i)}),[e.id,t.values.parentIds]),d.useEffect((function(){t.values.subjectIds.length&&!t.touched.subjectIds&&t.setFieldTouched("subjectIds",!0)}),[t.values.subjectIds]);var l=function(e){return t.setFieldValue("parentIds",Vt.addOrRemove(t.values.parentIds.map((function(e){return e.toString()})),e.id.toString()))},p=function(e){return t.setFieldValue("subjectIds",Vt.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),e.id.toString()))},f=function(e){return"".concat(po.getCustomFormControlClassName(t.errors,t.touched,e)," h-auto py-2")};return d.createElement(eo,null,d.createElement(vo,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this classification",autoFocus:!0}),d.createElement(vo,{as:"select",label:"Type",name:"type",id:"type",value:t.values.type},dt.getEnumKeys($m).map((function(e){return d.createElement("option",{key:e,value:$m[e]},e)}))),d.createElement(vo,{label:"Coming Soon",name:"comingSoon",id:"comingSoon",type:"checkbox",checked:t.values.comingSoon}),d.createElement(vo,{label:"Emphasize",name:"emphasize",id:"emphasize",type:"checkbox",checked:t.values.emphasize}),d.createElement(vo,{label:"Can Be Preferred",name:"canBePreferred",id:"canBePreferred",type:"checkbox",checked:t.values.canBePreferred}),d.createElement(vo,{name:"parentIds"},(function(){return d.createElement("div",{className:f("parentIds")},d.createElement(Kp,{label:"Parent Classification(s)",tree:e.classificationTree,selectedIds:t.values.parentIds,onSelect:l,collapse:s,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=ou.find(n,r);return!!ou.find(t,e.id)})}));var n,r})),d.createElement(vo,{name:"subjectIds"},(function(){return d.createElement("div",{className:f("subjectIds")},d.createElement(Kp,{label:"Mapped Subject(s)",tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:p,collapse:!r,getSelectedItemAppLink:vg}))})),d.createElement(_u,{imageType:Ul.Covers,fieldName:"cover",application:u.SUBJECTS,uploadAction:o.Subjects.UPLOAD_IMAGE}),d.createElement(_u,{imageType:Ul.Banners,fieldName:"banner",application:u.SUBJECTS,uploadAction:o.Subjects.UPLOAD_IMAGE}),d.createElement("div",{className:"d-flex justify-content-between"},d.createElement(Eo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},r?"Create":"Save"),!r&&d.createElement(uo.Button,{as:xl,variant:"danger",appLink:{application:u.SUBJECTS,action:o.Subjects.DELETE_CLASSIFICATION,args:[e.presentationId,e.id]}},"Delete")))}function Sg(e){return d.createElement(so,{initialValues:e.classification,validationSchema:Ym,onSubmit:e.saveClassification},d.createElement(bg,{id:e.classification&&e.classification.id,presentationId:e.presentationId,classificationTree:e.classificationTree,subjectTree:e.subjectTree}))}var Eg=function(e){return function(t){if(!e)return t.appLink.action===o.Subjects.EDIT_CLASSIFICATION;switch(e){case Hm.Playlists:return t.appLink.action===o.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;case Hm.Series:return t.appLink.action===o.Subjects.EDIT_CLASSIFICATION_SERIES;case Hm.Videos:return t.appLink.action===o.Subjects.EDIT_CLASSIFICATION_VIDEOS}}};function Cg(e){var t=e.presentation,n=e.classificationId,r=e.memberType;return t?d.createElement(d.Fragment,null,d.createElement("h6",null,"Presentation: ".concat(!!t&&t.name)),d.createElement("div",{className:"py-2"},d.createElement(Np,{tabs:th(t.id,n),isItemActive:Eg(r)}))):d.createElement(d.Fragment,null)}function Og(e){var t=qa(),n=bo(t),r=function(e){return t.setFieldValue("classificationIds",Vt.addOrRemove(t.values.classificationIds.map((function(e){return e.toString()})),e.id.toString()))},i="".concat(po.getCustomFormControlClassName(t.errors,t.touched,"classificationIds")," h-auto py-2");return d.createElement(eo,null,d.createElement(vo,{name:"classificationIds"},(function(){return d.createElement("div",{className:i},d.createElement(Kp,{label:"Mapped Classification(s)",tree:e.classificationTree,selectedIds:t.values.classificationIds,onSelect:r,getSelectedItemAppLink:(n=e.presentationId,function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_CLASSIFICATION,args:[n,e]}}),isNodeDisabled:e.isClassificationDisabled}));var n})),d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(Eo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Classifications")))}function Ig(e){return d.createElement(so,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.classificationIds;return e.saveClassifications(r,n)},enableReinitialize:!0},d.createElement(Og,{presentationId:e.presentationId,classificationTree:e.classificationTree,isClassificationDisabled:e.isClassificationDisabled}))}function jg(e){var t=null===e.id||void 0===e.id,n=qa(),r=bo(n);return d.createElement(eo,null,d.createElement(vo,{label:"Name",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this level",autoFocus:!0}),d.createElement(Eo,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"))}function Ag(e){return d.createElement(so,{initialValues:e.level,validationSchema:Gm,onSubmit:e.saveLevel},d.createElement(jg,{id:e.level&&e.level.id}))}function Tg(e){var t=Qm.singularizeMemberType(e.memberType),n=qa(),r=bo(n);return d.createElement(eo,null,d.createElement(vo,{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 d.createElement("option",{key:e.id,value:e.id},e.name)}))),d.createElement(vo,{label:"Automatically add to audiences*",name:"addToAudiences",id:"add-to-audiences",type:"checkbox",checked:n.values.addToAudiences}),d.createElement("p",null,d.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.")),d.createElement("p",null,d.createElement("strong",null,"Note:")," When removing a ".concat(t," from a level, that level's audiences "),d.createElement("strong",null,"will not")," be automatically removed from."),d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(Eo,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},"Save Levels")))}function wg(e){return d.createElement(so,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.levelIds,i=t.addToAudiences;return e.saveLevels(r,i,n)}},d.createElement(Tg,{levels:e.levels,memberType:e.memberType}))}function Lg(e){var t=e.values,n=t.name,r=t.description,i=e.id,a=e.isSubmitting,o=!i;return d.createElement(eo,null,d.createElement(vo,{label:"Name",type:"text",name:"name",id:"name",value:n,placeholder:"Enter a name for this presentation",autoFocus:!0}),d.createElement(vo,{label:"Description",as:"textarea",name:"description",id:"description",value:r,placeholder:"Describe this presentation here"}),d.createElement(Eo,{showSpinner:a,type:"submit"},o?"Create":"Save"))}function kg(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,s=void 0===o?"":o,c=e.savePresentation;return d.createElement(Ga,{initialValues:{name:a,description:s},validationSchema:Wm,onSubmit:c},(function(e){return d.createElement(Lg,Object.assign({id:r},e))}))}function _g(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,Vt.first(i.filter((function(e){return e.id.toString()===n.toString()}))));r(a)};return d.useEffect((function(){t&&!n&&r(t[0])}),[t]),d.createElement(d.Fragment,null,!!n&&d.createElement(d.Fragment,null,d.createElement(uo.Form.Label,null,i),d.createElement(uo.Form.Control,{as:"select",value:n.id,onChange:function(e){return a(e.target.value)},className:"cursor-pointer"},t.map((function(e){return d.createElement("option",{value:e.id,key:e.id},e.name)})))))}function xg(e){return d.createElement(d.Fragment,null,d.createElement("h4",null,"".concat(ru(e.memberType))),d.createElement(uo.Table,{responsive:!0},d.createElement("tbody",null,e.objects&&e.objects.map((function(t){return d.createElement("tr",{key:t.id},d.createElement("td",null,d.createElement(xl,{appLink:Qm.getMemberAppLink(e.memberType,t.id)},t.name)))})))),d.createElement(qg,{initialValues:{subjectIds:[],addToClassifications:!0},subjectTree:e.subjectTree,saveSubjects:e.onClickAddToSubject,memberType:e.memberType,saveBtnText:"Add to subject",subjectRequired:!0}))}function Pg(e){return function(e){if(Array.isArray(e))return Ng(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Ng(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ng(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ng(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Dg(e){var t=Qm.singularizeMemberType(e.memberType),n=[].concat(Pg(e.objectClassifications),Pg(e.objectSubjectClassifications)).map((function(e){return e.id}));return d.createElement(d.Fragment,null,d.createElement("div",{className:"border-bottom pb-3 mb-3"},d.createElement("h6",null,"Subjects"),d.createElement("p",null,"Select which subjects this ".concat(t," is mapped to.")),d.createElement(qg,{initialValues:{subjectIds:e.objectSubjects.map((function(e){return e.id}))},subjectTree:e.subjectTree,saveSubjects:e.saveSubjects,memberType:e.memberType,saveBtnText:"Save Subjects",allowMultiple:!0})),d.createElement("h6",null,"Classifications"),d.createElement("p",null,"Select a presentation to view its classifications and map them to this ".concat(t,".")),d.createElement("div",{className:"w-50 pb-3"},d.createElement(_g,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),e.currentPresentation&&e.classificationTree&&e.classificationTree.children.length?d.createElement(d.Fragment,null,d.createElement("p",null,"Only classifications which are mapped to one of the subjects selected above can be selected."),d.createElement(Ig,{initialValues:{classificationIds:e.objectClassifications.map((function(e){return e.id}))},presentationId:e.currentPresentation.id,classificationTree:e.classificationTree,saveClassifications:e.saveClassifications,isClassificationDisabled:function(e){return!n.includes(e.id)}})):d.createElement("p",null,"This presentation has no classifications."))}function Rg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Fg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fg(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}_g.defaultProps={label:"Presentation"};function Mg(e){var t=!e.id,n=qa(),r=bo(n),i=!t||!!n.values.parentId,a=Rg(d.useState(i),2),s=a[0],c=a[1];d.useEffect((function(){return c(i)}),[e.id,n.values.parentId]);var l=function(e){var t=e.id===n.values.parentId?null:e.id;n.setFieldValue("parentId",t)},p="".concat(po.getCustomFormControlClassName(n.errors,n.touched,"parentId")," h-auto py-2");return d.createElement(eo,null,d.createElement(vo,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this subject",autoFocus:!0}),d.createElement(vo,{name:"parentId"},(function(){return d.createElement("div",{className:p},d.createElement(Kp,{label:"Parent Subject",tree:e.subjectTree,selectedIds:[n.values.parentId],onSelect:l,collapse:s,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=ou.find(t,r);return!!ou.find(n,e.id)})}));var t,r})),d.createElement("div",{className:"d-flex justify-content-between"},d.createElement(Eo,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&d.createElement(uo.Button,{as:xl,variant:"danger",appLink:{application:u.SUBJECTS,action:o.Subjects.DELETE_SUBJECT,args:[e.id]}},"Delete")))}function Ug(e){return d.createElement(so,{initialValues:e.subject,validationSchema:Zm,onSubmit:e.saveSubject},d.createElement(Mg,{id:e.subject&&e.subject.id,subjectTree:e.subjectTree}))}var Vg=function(e){return function(t){return t.appLink.action===e}};function Bg(e){var t=e.subjectId,n=e.activeAction;return d.createElement(d.Fragment,null,d.createElement(uo.Alert,{variant:"danger"},"Warning: You are editing the backbone subjects."),d.createElement("div",{className:"py-2"},d.createElement(Np,{tabs:eh(t),isItemActive:Vg(n)})))}var zg=function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_SUBJECT,args:[e]}};function Hg(e){var t=qa(),n=bo(t),r=function(n){var r=e.allowMultiple?Vt.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),n.id.toString()):[n.id];t.setFieldValue("subjectIds",r)},i=Qm.singularizeMemberType(e.memberType),a="".concat(po.getCustomFormControlClassName(t.errors,t.touched,"subjectIds")," h-auto py-2");return d.createElement(eo,null,d.createElement(vo,{name:"subjectIds"},(function(){return d.createElement("div",{className:a},d.createElement(Kp,{label:"Mapped Subject".concat(e.allowMultiple?"(s)":""),tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:r,collapse:!!t.initialValues.subjectIds.length,getSelectedItemAppLink:zg}))})),d.createElement(vo,{label:"Automatically add to classifications*",name:"addToClassifications",id:"add-to-classifications",type:"checkbox",checked:t.values.addToClassifications}),d.createElement("p",null,d.createElement("em",null,"*If selected, when adding a ".concat(i," to a subject, all of that subject's")+" mapped classifications across all presentations will also be added to.")),d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(Eo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.saveBtnText)))}function qg(e){var t;return d.createElement(so,{initialValues:e.initialValues,validationSchema:(t=e.subjectRequired,co.object().shape({subjectIds:t?co.array().of(co.string()).min(1,"A subject is required").required("A subject is required"):co.array().of(co.string()),addToClassifications:co.boolean().default(!0)}).noUnknown()),onSubmit:function(t,n){var r=t.subjectIds,i=t.addToClassifications;return e.saveSubjects(r,i,n)}},d.createElement(Hg,{subjectTree:e.subjectTree,memberType:e.memberType,allowMultiple:e.allowMultiple,saveBtnText:e.saveBtnText}))}Hg.defaultProps={saveBtnText:"Save"};var Jg=function(e){return d.createElement("div",{className:"border rounded p-2 mb-3"},d.createElement("h6",{className:"border-bottom pb-1"},e.presentation.name),e.classifications&&e.classifications.length?d.createElement("ul",{className:"list-unstyled mb-0"},e.classifications.map((function(t){return d.createElement("li",{key:t.id,className:"py-1"},d.createElement(xl,{appLink:(n=e.presentation.id,r=t.id,{application:u.SUBJECTS,action:o.Subjects.EDIT_CLASSIFICATION,args:[n,r]})},t.name));var n,r}))):d.createElement("p",null,d.createElement("em",null,"There are no classifications mapped to this subject in this presentation.")))},$g=function(e){return d.createElement(d.Fragment,null,!!e.presentations&&!!e.classificationDictionary&&e.presentations.map((function(t){return d.createElement(Jg,{key:t.id,presentation:t,classifications:e.classificationDictionary[t.id]})})))},Kg=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 Yg(e){return d.createElement(d.Fragment,null,e.classifications.map((function(t){return d.createElement("th",{key:t.id},d.createElement("span",{className:"d-inline-block"},d.createElement(Fl,{selected:e.getIsClassificationSelected(t),onToggle:function(n){return e.onToggleClassification(t.id,n)}})),d.createElement(xl,{appLink:e.getClassificationAppLink(t.id)},function(e,t){return t?e.name:"Classification: ".concat(e.name)}(t,e.showClassificationSubHeader)))})))}function Gg(e){var t=e.memberType,n=e.hasActions,r=e.classifications,i=Kg(e,["memberType","hasActions","classifications"]),a="".concat(ru(Qm.singularizeMemberType(t))," Name"),o=!!r&&!!r.length,s=o&&r.length>1,c=o?2:1,l=Object.assign({classifications:r,showClassificationSubHeader:s},i);return d.createElement("thead",null,d.createElement("tr",null,d.createElement("th",{rowSpan:c},a),o&&(s?d.createElement("th",{colSpan:r.length,className:"text-center"},"Classifications"):d.createElement(Yg,Object.assign({},l))),n&&d.createElement("th",{rowSpan:c})),o&&s&&d.createElement("tr",null,d.createElement(Yg,Object.assign({},l))))}function Wg(e){var t=e.member,n=t.id,i=t.name,a=t.classifications,o=void 0===a?[]:a,s=e.getMemberAppLink,c=e.onToggleClassification,l=e.actions,u=X.isFunction(s)&&s(n);return o.length&&!X.isFunction(c)&&r.ErrorHelper.throw(new B("onToggleClassification must be passed to SubjectMemberItem")),d.createElement("tr",null,d.createElement("td",null,u?d.createElement(xl,{appLink:s(n)},i):i),!!o.length&&o.map((function(e){return d.createElement("td",{key:e.id},d.createElement(Fl,{selected:e.selected,onToggle:function(t){return c(e.id,t,n)}}))})),l&&d.createElement("td",null,d.createElement("span",{className:"d-flex justify-content-end"},d.createElement(wp,{actions:l}))))}var Zg=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 Qg(e,t){return function(n){var r=n[e],i=Gp.length(r);return!!i&&i===t.length}}function Xg(e){var t=e.members,n=e.memberType,r=e.getActions,i=e.classifications,a=e.getClassificationAppLink,o=e.onToggleClassification,s=Zg(e,["members","memberType","getActions","classifications","getClassificationAppLink","onToggleClassification"]);if(!t.length)return d.createElement("div",{className:"py-5"},"No ".concat(n," in this subject."));var c=X.isFunction(r),l={memberType:n,classifications:i,getClassificationAppLink:a,getIsClassificationSelected:Qg(n,t),onToggleClassification:o,hasActions:c};return d.createElement(uo.Table,{responsive:!0,bordered:!0},d.createElement(Gg,Object.assign({},l)),d.createElement("tbody",null,t.map((function(e,t){return d.createElement(Wg,Object.assign({key:t,member:e,actions:c&&r(e.id),onToggleClassification:o},s))}))))}function ey(e){var t=e.navItems,n=e.currentAppLink;return d.createElement(uo.Container,null,d.createElement(uo.Navbar,{className:"justify-content-between align-items-center"},d.createElement(uo.Nav,null,!!t&&t.map((function(e,t){return d.createElement(uo.Nav.Item,{key:t},d.createElement(xl,{appLink:e.appLink,className:"nav-link".concat(Ql.isItemActive(e,n)?" text-primary":"")},e.label))})))))}function ty(e,t){d.useEffect((function(){e.presentations&&!e.currentPresentation&&Bm.getSetStateByKey(t,"currentPresentation")(Vt.first(e.presentations))}),[e.presentations])}function ny(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ry(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ry(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ry(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function iy(e){var t=i.useBasicFetch(Em(e.playlistId)),n=ny(d.useState({}),2),r=n[0],a=n[1],s=pm(f.SUBJECT);!function(e,t,n){var r=function(e){return Bm.getSetStateByKey(n,e)};Vm([Qh.getObjectLevelsFetchOptions(e,Hm.Playlists,r("playlistLevels"))],[e]),mu(Qh.getObjectAudiencesFetchOptions(e,Hm.Playlists,r("playlistAudiences")),[e,t.playlistLevels]),Vm([Qh.getPresentationsFetchOptions(r("presentations")),Qh.getLevelsFetchOptions(r("levels"))],[]),mu(!!t.currentPresentation&&Qh.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(e.playlistId,r,a),ty(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.playlistLevels&&r.playlistAudiences);return d.createElement(d.Fragment,null,d.createElement(Fm,{playlistId:e.playlistId,activeAction:o.Playlists.EDIT_PLAYLIST_AUDIENCES}),d.createElement(Lp,{object:t.data}),!!c&&d.createElement(sg,{objectLevels:r.playlistLevels,objectAudiences:r.playlistAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:Bm.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Hm.Playlists,saveLevels:function(t,n,r){return s.updateObjectLevels(e.playlistId,t,Hm.Playlists,n,r,r)},saveAudiences:function(t,n){return s.updateObjectAudiences(e.playlistId,r.currentPresentation.id,t,Hm.Playlists,n,n)}}))}function ay(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||sy(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oy(e){return function(e){if(Array.isArray(e))return cy(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||sy(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sy(e,t){if(e){if("string"==typeof e)return cy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cy(e,t):void 0}}function cy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ly(e){var t=i.useBasicFetch(Em(e.playlistId)),n=ay(d.useState({}),2),r=n[0],a=n[1],s=pm(f.SUBJECT);!function(e,t,n){var r=function(e){return Bm.getSetStateByKey(n,e)};Vm([Qh.getSubjectTreeFetchOptions(r("subjectTree")),Qh.getPresentationsFetchOptions(r("presentations"))],[]),Vm([Qh.getObjectSubjectsFetchOptions(e,Hm.Playlists,r("playlistSubjects"))],[e]),mu(!!t.currentPresentation&&Qh.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),d.useEffect((function(){return r("subjectClassifications")([])}),[t.playlistSubjects]);var i=function(e,t){return[].concat(oy(t.subjectClassifications||[]),oy(e))},a=t.playlistSubjects&&t.playlistSubjects.map((function(e){return Qh.getSubjectClassificationFetchOptions(e.id,Bm.getSetStateByKey(n,"subjectClassifications",i))}));Vm(a,[t.playlistSubjects],!!a),mu(Qh.getObjectClassificationsFetchOptions(e,Hm.Playlists,r("playlistClassifications")),[e,t.playlistSubjects])}(e.playlistId,r,a),ty(r,a);var c=!!(r.playlistSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.playlistClassifications&&r.subjectClassifications);return d.createElement(d.Fragment,null,d.createElement(Fm,{playlistId:e.playlistId,activeAction:o.Playlists.EDIT_PLAYLIST_SUBJECTS}),d.createElement(Lp,{object:t.data}),c&&d.createElement(Dg,{objectSubjects:r.playlistSubjects,subjectTree:r.subjectTree,memberType:Hm.Playlists,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:Bm.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.playlistClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(t,n,r){return s.updateObjectSubjects(e.playlistId,t,Hm.Playlists,n,r,r)},saveClassifications:function(t,n){return s.updateObjectClassifications(e.playlistId,r.currentPresentation.id,t,Hm.Playlists,n,n)}}))}const uy={reorder(e,t,n){if(t===n)return{reorderedItems:e,reorderRequest:null};const r=Vt.moveItem(e,t,n),i=n<e.length-1?r[n+1].id:null;return{reorderedItems:r,reorderRequest:{sourceMemberId:r[n].id,destinationMemberId:i}}},updateState(e,t,n){const r=[],i=dt.deepClone(n),a=[e];let o=n[e];const s=!!o&&!!o.data&&o.data.length;for(;o&&Array.isArray(o.data);){r.push(...o.data);const t=o.pagination&&o.pagination.cursors&&o.pagination.cursors.next,i=!!t&&`${e}:${t}`;o=t&&n[i],o&&a.push(i)}if(!r.length)return n;const c=Vt.findIndex(r,e=>e.id===t.sourceMemberId),l=[...r],u=l.splice(c,1),p=t.destinationMemberId?Vt.findIndex(l,e=>e.id===t.destinationMemberId):l.length;return l.splice(p,0,u[0]),a.forEach(e=>{const t=l.splice(0,s);i[e].data=t}),i}};function py(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return fy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var dy=function(e){return{application:u.VIDEOS,action:o.Videos.EDIT_VIDEO,args:[e.id]}};function my(e){var t,n,r=Object(te.useDispatch)(),a=gm(),s=i.useBasicFetch(Em(e.playlistId)),c=i.useBasicFetch(Am(e.playlistId)),l=py(function(e){const[t,n]=Object(d.useState)();return Object(d.useEffect)(()=>{t&&(e.length!==t.length||function(e,t){let n=!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].id!==t[r].id){n=!1;break}return n}(e,t))&&n(null)},[e]),[t,n]}(null===(t=c.data)||void 0===t?void 0:t.data),2),p=l[0],f=l[1],m=p?{data:p,pagination:null}:c.data;return d.createElement(d.Fragment,null,d.createElement(Fm,{playlistId:e.playlistId,activeAction:o.Playlists.EDIT_PLAYLIST_VIDEOS}),d.createElement(Lp,{object:s.data}),!!m&&d.createElement(lf,{onSortEnd:function(t,n){if(t!==n){var o=uy.reorder(c.data.data,t,n),s=o.reorderRequest,l=o.reorderedItems;f(l);i.fetch(r,Tm(e.playlistId,s,null,(function(){a.error("Failed to update playlist order."),f(null)})))}},videos:m,getVideoAppLink:dy,getVideoActions:(n=e.playlistId,function(e){return[{label:"Remove video",appLink:{application:u.PLAYLISTS,action:o.Playlists.REMOVE_VIDEO,args:[n.toString(),e.id.toString()]},className:"text-danger"}]}),emptyMessage:"There are no videos in this playlist."}))}function hy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return gy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yy(){var e=Object(te.useDispatch)(),t=gm(),n=hy(d.useState(),2),a=n[0],s=n[1];return mu($e.getCurrentUserFetchOptions(s),[]),d.createElement(d.Fragment,null,!!a&&d.createElement(Dm,{savePlaylist:function(n,s){i.fetch(e,Om(n,a.id,(function(e){t.success("Successfully created playlist."),function(e){e&&e.id&&r.AppLinkHelper.trigger({application:u.PLAYLISTS,action:o.Playlists.EDIT_PLAYLIST,args:[e.id]})}(e)}),(function(){t.error("Failed to create playlist.")}),s))}}))}var vy="rating,thumbnail,glance",by=function(e){return{url:"/api/master/v2/objects/".concat(e,"?query=").concat(vy),key:"videos:".concat(e)}},Sy=function(e){var t=e.slice().sort();return{key:"videos:".concat(t.join(",")),url:"/api/master/v2/objects?".concat(t.map((function(e){return"id=".concat(e)})).join("&"))}},Ey=function(e){return{url:"/ajax/hostedlibraries/rightsline/programs/".concat(e),key:"rightsline:videos:".concat(e),normalizeOptions:{namespace:"rightsline"}}},Cy=function(e,t,n,r,i){return{key:"videos:".concat(e),url:"/api/master/v2/objects/".concat(e),data:t,type:it.PUT,success:n,error:r,always:i}};function Oy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Iy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Iy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Iy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function jy(e){var t=Object(te.useDispatch)(),n=gm(),r=i.useBasicFetch(Em(e.playlistId)),a=i.useBasicFetch(by(e.videoId)),o=Oy(d.useState(!1),2),s=o[0],c=o[1];var l=!!r.data&&!!a.data;return d.createElement(zf,{title:"Remove Video",closePopup:e.closePopup,showLoadingSpinner:!l},!!l&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to remove ",d.createElement("strong",null,a.data.name)," from ",d.createElement("strong",null,r.data.name),"?")),d.createElement(qf,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){c(!0),i.fetch(t,wm(e.playlistId,e.videoId,(function(){n.success("Successfully removed video from playlist")}),(function(){n.error("Failed to remove video from playlist")}),e.closePopup))},buttonText:"Yes, remove video",isSpinnerButton:!0,showSpinner:s}]})))}function Ay(e){return r.AppLinkHelper.trigger(function(e){return{application:u.PLAYLISTS,action:o.Playlists.EDIT_PLAYLIST,args:[e.id]}}(e))}function Ty(e){var t=e?{application:u.PLAYLISTS,action:o.Playlists.SEARCH_PLAYLISTS,params:{query:e}}:{application:u.PLAYLISTS,action:o.Playlists.PLAYLISTS};r.AppLinkHelper.trigger(t)}function wy(e){return d.createElement("div",{className:"pb-3 w-50"},d.createElement(_l,{initialQuery:e.query,placeholder:"Search for a playlist",onSuggestionSelected:Ay,getRemoteUrl:function(e){return"".concat("/api/domain/v1/search/playlists/instant/raw","?query=").concat(e)},activationLength:2,onSubmit:Ty}))}var Ly=u.PLAYLISTS,ky=function(e){return{application:Ly,action:o.Playlists.EDIT_PLAYLIST,args:[e.id]}};function _y(e){var t=i.useBasicFetch(bm(e.cursor));return d.createElement(d.Fragment,null,d.createElement(wy,null),d.createElement(bp,{collection:t&&t.data,collectionAppLink:{application:Ly,action:o.Playlists.PLAYLISTS},newObjectAppLink:{application:Ly,action:o.Playlists.NEW_PLAYLIST},getObjectAppLink:ky,objectName:"Playlist"}))}var xy=u.PLAYLISTS,Py=function(e){return{application:xy,action:o.Playlists.EDIT_PLAYLIST,args:[e.id]}};function Ny(e){var t=i.useBasicFetch(Sm(e.query,e.cursor));return d.createElement(d.Fragment,null,d.createElement(wy,{query:e.query}),!!t.data&&(t.data.data.length?d.createElement(bp,{collection:t.data,collectionAppLink:{application:xy,action:o.Playlists.SEARCH_PLAYLISTS,params:{query:e.query}},newObjectAppLink:{application:xy,action:o.Playlists.NEW_PLAYLIST},getObjectAppLink:Py,objectName:"Playlist"}):d.createElement("p",null,"No playlists found, please try a different search query.")))}function Dy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ry(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ry(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ry(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Fy=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 My(e){var t=e.id,n=e.routeToOnDelete,i=e.closePopup,a=Dy(d.useState(),2),o=a[0],s=a[1],c=Dy(d.useState(!1),2),l=c[0],u=c[1],p=pm(f.SUBJECT);mu(Qh.getAudienceFetchOptions(t,s),[t]);return d.createElement(zf,{title:"Delete Audience",closePopup:i,showLoadingSpinner:!o},!!o&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,o.name),"?")),d.createElement(qf,{buttons:Fy((function(){u(!0);p.deleteAudience(t,(function(){i(),n&&r.AppLinkHelper.trigger(n)}),i)}),i,l)})))}function Uy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Vy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var By=function(e){return{application:u.SUBJECTS,action:o.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function zy(e){var t=e.presentationId,n=e.audienceId,r=Uy(d.useState(),2),i=r[0],a=r[1],o=Uy(d.useState(),2),s=o[0],c=o[1],l=Uy(d.useState(),2),u=l[0],p=l[1],m=pm(f.SUBJECT);mu(Qh.getAudienceFetchOptions(n,a),[n]),mu(Qh.getLevelsFetchOptions(c),[]),mu(Qh.getPresentationFetchOptions(t,p),[t]);return d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-3"},d.createElement(Pl,{appLink:By(t),backToName:"audiences"})),!!u&&d.createElement("h6",null,"Presentation: ".concat(u.name)),!!i&&!!s&&d.createElement(ag,{audience:i,levels:s,saveAudience:function(e,r){return m.updateAudience(n,Object.assign(Object.assign({},e),{presentationId:t}),r,r)},presentationId:t}))}function Hy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Jy=function(e){return function(t){return{application:u.SUBJECTS,action:o.Subjects.EDIT_AUDIENCE,args:[e,t.masterId]}}},$y=function(e){return{application:u.SUBJECTS,action:o.Subjects.NEW_AUDIENCE,args:[e]}},Ky={application:u.SUBJECTS,action:o.Subjects.AUDIENCES};function Yy(e){var t=e.presentationId,n=Hy(d.useState(),2),r=n[0],i=n[1];return mu(Qh.getAudiencesFetchOptions(t,i),[]),d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-3"},d.createElement(Pl,{appLink:Ky,backToName:"presentations"})),d.createElement("div",{className:"d-flex justify-content-between mb-2"},d.createElement("h5",{className:"d-inline-block m-0"},"Select an audience to edit:"),d.createElement(xl,{appLink:$y(t),className:"d-block"},d.createElement(Al,{svgName:Sl.Plus,size:jl.Small}),d.createElement("span",null,"New Audience"))),d.createElement(xp,{objects:r,getAppLink:Jy(e.presentationId),emptyMessage:"There are no audiences in this presentation yet. Click '+ New Audience' to create one."}))}function Gy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Wy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Wy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Zy=function(e){return{application:u.SUBJECTS,action:o.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function Qy(e){var t=e.presentationId,n=Gy(d.useState(),2),i=n[0],a=n[1],s=Gy(d.useState(),2),c=s[0],l=s[1],p=pm(f.SUBJECT);mu(Qh.getLevelsFetchOptions(a),[]),mu(Qh.getPresentationFetchOptions(t,l),[t]);return d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-2"},d.createElement(Pl,{appLink:Zy(t),backToName:"audiences"})),!!c&&d.createElement("h6",null,"Presentation: ".concat(c.name)),!!i&&d.createElement(ag,{levels:i,presentationId:t,saveAudience:function(e,n){return p.createAudience(Object.assign(Object.assign({},e),{presentationId:t}),function(e,t){return function(n){t(),r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_AUDIENCE,args:[e,n.masterId]})}}(t,n),n)}}))}function Xy(e){return{application:u.SUBJECTS,action:o.Subjects.NEW_CLASSIFICATION,args:[e]}}function ev(e){return[{label:"Add child",getAppLink:function(t){return Object.assign(Object.assign({},Xy(e)),{args:[e],params:{parentId:t.id}})}},{label:"Delete classification",getAppLink:function(t){return{application:u.SUBJECTS,action:o.Subjects.DELETE_CLASSIFICATION,args:[e,t.id]}},className:"text-danger"}]}var tv=n(127),nv=n.n(tv);function rv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return iv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return iv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function av(e){var t=e.presentationId,n=e.selectedClassificationId,r=rv(d.useState(),2),i=r[0],a=r[1],s=rv(d.useState(),2),c=s[0],l=s[1];return function(e,t,n){Vm([Qh.getClassificationTreeFetchOptions(e,t),Qh.getPresentationFetchOptions(e,n)],[e])}(t,a,l),d.createElement("div",{className:"".concat(nv.a.navContainer," h-auto pr-2 border-right")},!!c&&d.createElement("h6",{className:"border-bottom pb-2"},"Classifications (".concat(c.name,")")),d.createElement(xl,{appLink:Xy(t),className:"d-inline-block pb-2"},d.createElement(Al,{svgName:Sl.Plus,size:jl.Small}),d.createElement("span",null,"New Classification")),!!i&&d.createElement("div",{className:"border-top pt-1"},d.createElement(zp,{tree:i,getAppLink:function(e){return function(e,t){return{application:u.SUBJECTS,action:o.Subjects.EDIT_CLASSIFICATION,args:[e,t.id]}}(t,e)},selectedIds:[n],actions:ev(t)})))}function ov(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return sv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cv(e){var t=e.classificationId,n=e.routeToOnDelete,i=e.closePopup,a=ov(d.useState(),2),o=a[0],s=a[1],c=ov(d.useState(!1),2),l=c[0],u=c[1];mu(Qh.getClassificationFetchOptions(t,s),[]);var p=pm(f.SUBJECT),m=[{variant:"link",onClick:i,buttonText:"Cancel"},{variant:"danger",onClick:function(){u(!0);p.deleteClassification(t,(function(){i(),n&&r.AppLinkHelper.trigger(n)}),i)},buttonText:"Yes, delete this classification",isSpinnerButton:!0,showSpinner:l}];return d.createElement(zf,{title:"Delete Classification",closePopup:i,showLoadingSpinner:!o},!!o&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,o.name),"?")),d.createElement(qf,{buttons:m})))}function lv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return uv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function uv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function pv(e){var t=e.presentationId,n=e.classificationId,r=lv(d.useState(),2),i=r[0],a=r[1],o=lv(d.useState(),2),s=o[0],c=o[1],l=lv(d.useState(),2),u=l[0],p=l[1],m=lv(d.useState(),2),h=m[0],g=m[1],y=pm(f.SUBJECT),v=Qh.getClassificationFetchOptions(n,a),b=Qh.getPresentationFetchOptions(t,c),S=Qh.getClassificationTreeFetchOptions(t,p);mu(Qh.getSubjectTreeFetchOptions(g),[]),mu(v,[n]),Vm([b,S],[t]);return d.createElement("div",null,d.createElement(Cg,{presentation:s,classificationId:n}),!!i&&!!u&&!!h&&d.createElement(Sg,{classification:i,presentationId:t,subjectTree:h,classificationTree:u,saveClassification:function(e,t){return y.updateClassification(n,e,t,t)}}))}function fv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return dv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mv(e){var t=e.presentationId,n=e.classificationId,r=e.memberType,i=fv(d.useState(),2),a=i[0],o=i[1],s=fv(d.useState(),2),c=s[0],l=s[1],u=fv(d.useState(),2),p=u[0],m=u[1];mu(Qh.getPresentationFetchOptions(t,o),[]),mu(Qh.getClassificationFetchOptions(n,l),[n]),mu(Qh.getClassificationMembersFetchOptions(n,r,m),[n,r]);var h=pm(f.SUBJECT),g={items:p&&p.data,memberType:r,classification:c,updatePinnedVideo:function(e,t){var r=Object.assign(Object.assign({},c),{pinnedVideoMasterId:e});h.updateClassification(n,r,t)},getItemAppLink:function(e){return Qm.getMemberAppLink(r,e.id)},getActions:function(e){return Qm.getMemberActions(n,zm.Classification,r,e.id)}},y={presentation:a,classificationId:n},v=tu(g);return d.createElement(d.Fragment,null,d.createElement(Cg,Object.assign({},y,{memberType:r})),v&&d.createElement(hg,Object.assign({},g)))}function hv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return gv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yv(e){var t=e.presentationId,n=e.parentId,i=hv(d.useState(),2),a=i[0],s=i[1],c=hv(d.useState(),2),l=c[0],p=c[1],m=pm(f.SUBJECT),h=Qh.getClassificationTreeFetchOptions(t,s);mu(Qh.getSubjectTreeFetchOptions(p),[]),mu(h,[t]);return d.createElement("div",null,d.createElement("h4",{className:"py-2"},"Create New Classification"),!!l&&!!a&&d.createElement(Sg,{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&&r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]})}}(t,n),n)}}))}var vv=function(e){return{key:"series:".concat(e),url:"/api/master/v2/objects/".concat(e,"?query=thumbnail,tallPoster,banner,rating")}},bv=function(e){var t=e.slice().sort();return{key:"series:".concat(t.join(",")),url:"/api/master/v2/objects?".concat(t.map((function(e){return"id=".concat(e)})).join("&"))}},Sv=function(e,t,n,r){return{url:"/api/master/v2/series",key:"series",data:e,type:it.POST,success:t,error:n,always:r}},Ev=function(e,t,n,r,i){return{url:"/api/master/v2/objects/".concat(e),key:"update:series:".concat(e),data:t,type:it.PUT,success:n,error:r,always:i}};function Cv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ov(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ov(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ov(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Iv(e){var t=Cv(d.useState(),2),n=t[0],r=t[1],a=Cv(d.useState(!1),2),o=a[0],s=a[1],c=i.useBasicFetch(function(e,t){switch(e){case Hm.Playlists:return Em(t);case Hm.Series:return vv(t);case Hm.Videos:return by(t)}}(e.memberType,e.memberId)),l=pm(f.SUBJECT);mu(Qh.getClassificationFetchOptions(e.classificationId,r),[e.classificationId]);var u=!!n&&!!c.data,p="Remove ".concat(ru(Qm.singularizeMemberType(e.memberType)));return d.createElement(zf,{title:p,closePopup:e.closePopup,showLoadingSpinner:!u},u&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to remove ",d.createElement("strong",null,c.data.name)," from ",d.createElement("strong",null,n.name),"?"),d.createElement("p",null,"This will not remove it from the backbone subject.")),d.createElement(qf,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){s(!0),l.removeObjectsFromClassification(e.classificationId,[e.memberId],e.memberType,null,null,e.closePopup,e.closePopup),n.pinnedVideoMasterId===e.memberId&&l.updateClassification(e.classificationId,Object.assign(Object.assign({},n),{pinnedVideoMasterId:null}))},buttonText:"Yes, remove this ".concat(Qm.singularizeMemberType(e.memberType)),isSpinnerButton:!0,showSpinner:o}]})))}function jv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Av(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Av(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Av(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Tv(e){var t=e.id,n=jv(d.useState(),2),r=n[0],i=n[1],a=pm(f.SUBJECT);mu(Qh.getLevelFetchOptions(t,i),[t]);return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Edit Level"),!!r&&d.createElement(Ag,{level:r,saveLevel:function(e,n){return a.updateLevel(t,e,n,n)}}))}function wv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Lv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var kv=function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_LEVEL,args:[e.id]}},_v={application:u.SUBJECTS,action:o.Subjects.NEW_LEVEL};function xv(){var e=wv(d.useState(),2),t=e[0],n=e[1];return mu(Qh.getLevelsFetchOptions(n),[]),d.createElement("div",null,d.createElement("div",{className:"d-flex justify-content-between mb-2"},d.createElement("h5",{className:"d-inline-block m-0"},"Select a level to edit:"),d.createElement(xl,{appLink:_v,className:"d-block"},d.createElement(Al,{svgName:Sl.Plus,size:jl.Small}),d.createElement("span",null,"New Level"))),d.createElement(xp,{objects:t,getAppLink:kv}))}function Pv(){var e=pm(f.SUBJECT);return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Create New Level"),d.createElement(Ag,{saveLevel:function(t,n){return e.createLevel(t,function(e){return function(t){e(),t&&t.id&&r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_LEVEL,args:[t.id]})}}(n),n)}}))}function Nv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Dv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Rv(e){var t=e.id,n=Nv(d.useState(),2),r=n[0],i=n[1],a=pm(f.SUBJECT);mu(Qh.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)}))}},s=tu(o);return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Edit Presentation"),!!s&&d.createElement(kg,Object.assign({},o)))}function Fv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Mv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Mv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Uv=function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_PRESENTATION,args:[e.id]}},Vv={application:u.SUBJECTS,action:o.Subjects.NEW_PRESENTATION};function Bv(){var e=Fv(d.useState(),2),t=e[0],n=e[1];return mu(Qh.getPresentationsFetchOptions(n),[]),d.createElement("div",null,d.createElement("div",{className:"d-flex justify-content-between mb-2"},d.createElement("h5",{className:"d-inline-block m-0"},"Select a presentation to edit:"),d.createElement(xl,{appLink:Vv,className:"d-block"},d.createElement(Al,{svgName:Sl.Plus,size:jl.Small}),d.createElement("span",null,"New Presentation"))),d.createElement(xp,{objects:t,getAppLink:Uv}))}function zv(){var e=pm(f.SUBJECT);return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Create New Presentation"),d.createElement(kg,{savePresentation:function(t,n){var i=n.setSubmitting;e.createPresentation(t,(function(e){return function(e,t){t(!1),e&&e.id&&r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_PRESENTATION,args:[e.id]})}(e,i)}),(function(){return i(!1)}))}}))}function Hv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Jv(e){var t=e.objectType,n=e.getAppLink,r=Hv(d.useState(),2),i=r[0],a=r[1];return mu(Qh.getPresentationsFetchOptions(a),[]),d.createElement("div",null,d.createElement("h5",null,d.createElement(wo,{namespace:"subjects.selectPresentation",phrase:"heading",options:{objectType:t}})),d.createElement(xp,{objects:i,getAppLink:n}))}function $v(e){const{title:t,onClickConfirm:n,confirmButtonText:r,cancelButtonText:i,closePopup:a}=e,[o,s]=d.useState(!1),c=[{variant:"link",onClick:a,buttonText:i},{variant:"primary",onClick:()=>{s(!0),n()},buttonText:r,isSpinnerButton:!0,showSpinner:o}];return d.createElement(zf,{title:t,closePopup:a},d.createElement(d.Fragment,null,e.children,d.createElement(qf,{buttons:c})))}function Kv(e,t){return Bm.getSetStateByKey(e,t)}function Yv(e,t,n,i,a){var s=i.selectedSubject,c=function(){return Kv(a,"showConfirmationPopup")(!1)};t.addObjectsToSubject(s.id,e.map((function(e){return e.id})),n.memberType,i.addToClassifications,(function(){c(),r.AppLinkHelper.trigger(function(e,t){var n={application:u.SUBJECTS,args:[e]};switch(t){case Hm.Playlists:return Object.assign(Object.assign({},n),{action:o.Subjects.EDIT_SUBJECT_PLAYLISTS});case Hm.Series:return Object.assign(Object.assign({},n),{action:o.Subjects.EDIT_SUBJECT_SERIES});case Hm.Videos:return Object.assign(Object.assign({},n),{action:o.Subjects.EDIT_SUBJECT_VIDEOS})}}(s.id,n.memberType))}),c)}function Gv(e,t,n){if(t&&n){var r=1===t.length?"this ".concat(Qm.singularizeMemberType(e)):"these ".concat(e);return"Add ".concat(r," to ").concat(n.name)}}function Wv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Zv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Zv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Qv(e,t){return function(n,r,i){i(),Kv(t,"selectedSubject")(ou.find(e.subjectTree,Vt.first(n))),Kv(t,"addToClassifications")(r),Kv(t,"showConfirmationPopup")(!0)}}function Xv(e){var t=Wv(d.useState({}),2),n=t[0],r=t[1],a=i.useBasicFetch(function(e,t){switch(e){case Hm.Playlists:return Cm(t);case Hm.Series:return bv(t);case Hm.Videos:return Sy(t)}}(e.memberType,e.objectIds)),o=pm(f.SUBJECT);!function(e,t){e.memberType,e.objectIds,mu(Qh.getSubjectTreeFetchOptions(Kv(t,"subjectTree")),[])}(e,r);var s;return d.createElement(d.Fragment,null,!!a.data&&!!n.subjectTree&&d.createElement(xg,{memberType:e.memberType,objects:a.data,subjectTree:n.subjectTree,onClickAddToSubject:Qv(n,r)}),n.showConfirmationPopup&&d.createElement($v,{title:Gv(e.memberType,a.data,n.selectedSubject),onClickConfirm:function(){return Yv(a.data,o,e,n,r)},closePopup:function(){return e=!1,Kv(r,"showConfirmationPopup")(e);var e}},d.createElement("p",null,"The following ".concat(e.memberType," will be added to "),d.createElement("strong",null,n.selectedSubject.name),n.addToClassifications?" and its mapped classifications:":":"),d.createElement("ul",null,a.data.map((function(e){return d.createElement("li",{key:e.id},e.name)}))),!n.addToClassifications&&d.createElement("p",null,"".concat(1===a.data.length?"It":"They"," will not be added to its mapped classifications.")),d.createElement("p",null,"".concat((s=e.memberType,ru(Qm.singularizeMemberType(s)))," to classification mappings can be managed from the "),d.createElement("strong",null,"Edit Subject ".concat(ru(e.memberType)," ")),"page.")))}function eb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return tb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function nb(e){var t=e.subjectId,n=e.routeToOnDelete,i=e.closePopup,a=eb(d.useState(),2),o=a[0],s=a[1],c=eb(d.useState(!1),2),l=c[0],u=c[1];mu(Qh.getSubjectFetchOptions(t,s),[]);var p=pm(f.SUBJECT),m=[{variant:"link",onClick:i,buttonText:"Cancel"},{variant:"danger",onClick:function(){u(!0);p.deleteSubject(t,(function(){i(),n&&r.AppLinkHelper.trigger(n)}),i)},buttonText:"Yes, delete this subject",isSpinnerButton:!0,showSpinner:l}];return d.createElement(zf,{title:"Delete Subject",closePopup:i,showLoadingSpinner:!o},!!o&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,o.name),"?"),d.createElement("p",null,"Subjects that have mapped classifications cannot be deleted.")),d.createElement(qf,{buttons:m})))}function rb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ib(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ib(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ib(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ab(e){var t=e.subjectId,n=rb(d.useState(),2),r=n[0],i=n[1],a=rb(d.useState(),2),s=a[0],c=a[1],l=pm(f.SUBJECT),u=Qh.getSubjectFetchOptions(t,i);mu(Qh.getSubjectTreeFetchOptions(c),[]),mu(u,[t]);return d.createElement(d.Fragment,null,d.createElement(Bg,{subjectId:t,activeAction:o.Subjects.EDIT_SUBJECT}),!!r&&!!s&&d.createElement(Ug,{subject:r,subjectTree:s,saveSubject:function(e,n){return l.updateSubject(t,e,n,n)}}))}function ob(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return sb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}$v.defaultProps={confirmButtonText:"Confirm",cancelButtonText:"Cancel"};var cb=d.createContext(void 0);function lb(e){var t=e.children,n=ob(d.useState(),2),r=n[0],i=n[1];return d.createElement(cb.Provider,{value:[r,i]},t)}var ub=function(e){var t=e.children;return d.createElement(Au,null,d.createElement(lb,null,d.createElement(pu,null,t)))};function pb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return fb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function db(e,t){return Bm.getSetStateByKey(e,t)}function mb(e){switch(e){case Hm.Playlists:return o.Subjects.EDIT_SUBJECT_PLAYLISTS;case Hm.Series:return o.Subjects.EDIT_SUBJECT_SERIES;case Hm.Videos:return o.Subjects.EDIT_SUBJECT_VIDEOS}}function hb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return gb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yb(e){var t=hb(d.useState({}),2),n=t[0],r=t[1],a=n.presentations,s=n.classifications,c=n.memberIds,l=n.membersWithClassifications,p=i.useBasicFetch(Array.isArray(c)&&function(e,t){switch(e){case Hm.Playlists:return Cm(t);case Hm.Series:return bv(t);case Hm.Videos:return Sy(t)}}(e.memberType,c)),m=hb(d.useContext(cb),2),h=m[0],g=m[1],y=pm(f.SUBJECT);!function(e,t,n){var r=e.subjectId,i=e.memberType,a=pb(d.useContext(cb),1)[0];mu(Qh.getPresentationsFetchOptions(db(n,"presentations")),[]),mu(Qh.getSubjectMemberIdsFetchOptions(r,i,db(n,"memberIds")),[r,i]),mu(!!a&&Qh.getSubjectClassificationFetchOptions(r,db(n,"classifications"),a.id,i),[r,i,a],!!a)}(e,0,r),function(e,t,n,r){var i=n.classifications;d.useEffect((function(){db(r,"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}))}}))}(t.memberType,e,i))}),[e,i])}(p.data,e,n,r);var v,b,S=!!h&&!!s;return d.createElement(d.Fragment,null,d.createElement(Bg,{subjectId:e.subjectId,activeAction:mb(e.memberType)}),d.createElement(uo.Alert,{variant:"info",className:"m-0"},"Select which ".concat(e.memberType," are shown for each classification in this subject.")+" Change the selected presentation to view different classifications."),d.createElement("div",{className:"w-50 py-2"},!!a&&d.createElement(_g,{presentations:a,currentPresentation:h,setCurrentPresentation:g})),S&&d.createElement(Xg,{members:l||[],memberType:e.memberType,getMemberAppLink:function(t){return Qm.getMemberAppLink(e.memberType,t)},getActions:function(t){return Qm.getMemberActions(e.subjectId,zm.Subject,e.memberType,t)},classifications:s,getClassificationAppLink:h&&(v=e.memberType,b=h.id,function(e){var t,n=u.SUBJECTS,r=[b,e];switch(v){case Hm.Playlists:t=o.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;break;case Hm.Series:t=o.Subjects.EDIT_CLASSIFICATION_SERIES;break;case Hm.Videos:t=o.Subjects.EDIT_CLASSIFICATION_VIDEOS}return{application:n,action:t,args:r}}),onToggleClassification:function(t,n,r){return function(e,t,n,r,i,a,o){(o?e.addObjectsToClassification.bind(e):e.removeObjectsFromClassification.bind(e))(a,n,t,r,i)}(y,e.memberType,r?[r]:c,e.subjectId,h&&h.id,t,n)}}))}function vb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return bb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Sb(e){var t=e.parentId,n=vb(d.useState(),2),i=n[0],a=n[1],s=pm(f.SUBJECT);mu(Qh.getSubjectTreeFetchOptions(a),[]);var c={application:u.SUBJECTS,action:o.Subjects.PRESENTATIONS};return d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-2 border-bottom"},d.createElement(Pl,{backToName:"Presentations",appLink:c})),d.createElement("h4",{className:"py-2"},"Create New Subject"),!!i&&d.createElement(Ug,{subject:{parentId:t},subjectTree:i,saveSubject:function(e,t){return s.createSubject(e,function(e){return function(t){e(),t&&t.id&&r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_SUBJECT,args:[t.id]})}}(t),t)}}))}function Eb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Cb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ob(e){var t=Eb(d.useState(),2),n=t[0],r=t[1],a=Eb(d.useState(!1),2),o=a[0],s=a[1],c=i.useBasicFetch(function(e,t){switch(e){case Hm.Playlists:return Em(t);case Hm.Series:return vv(t);case Hm.Videos:return by(t)}}(e.memberType,e.memberId)),l=pm(f.SUBJECT);mu(Qh.getSubjectFetchOptions(e.subjectId,r),[e.subjectId]);var u=!!n&&!!c.data,p="Remove ".concat(ru(Qm.singularizeMemberType(e.memberType)));return d.createElement(zf,{title:p,closePopup:e.closePopup,showLoadingSpinner:!u},u&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to remove ",d.createElement("strong",null,c.data.name)," from ",d.createElement("strong",null,n.name),"?"),d.createElement("p",null,"Please ensure that it is not in any classifications before removing.")),d.createElement(qf,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){s(!0),l.removeObjectsFromSubject(e.subjectId,[e.memberId],e.memberType,e.closePopup,e.closePopup)},buttonText:"Yes, remove this ".concat(Qm.singularizeMemberType(e.memberType)),isSpinnerButton:!0,showSpinner:o}]})))}function Ib(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return jb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ab(e){var t=e.subjectId,n=Ib(d.useState({}),2),r=n[0];return function(e,t){var n=function(e){return Bm.getSetStateByKey(t,e)};mu(Qh.getSubjectClassificationFetchOptions(e,n("classifications")),[e]),mu(Qh.getPresentationsFetchOptions(n("presentations")),[])}(t,n[1]),d.createElement(d.Fragment,null,d.createElement(Bg,{subjectId:t,activeAction:o.Subjects.SUBJECT_CLASSIFICATIONS}),d.createElement($g,{presentations:r.presentations,classificationDictionary:Vt.groupBy(r.classifications,"presentationId")}))}var Tb=n(128),wb=n.n(Tb);function Lb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return kb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _b(e){var t=e.selectedSubjectId,n=Lb(d.useState(),2),r=n[0],i=n[1];mu(Qh.getSubjectTreeFetchOptions(i),[]);var a=d.useCallback((function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_SUBJECT,args:[e.id]}}),[]),s={application:u.SUBJECTS,action:o.Subjects.NEW_SUBJECT},c=[{label:"Add child",getAppLink:function(e){return Object.assign(Object.assign({},s),{params:{parentId:e.id}})}},{label:"Delete subject",getAppLink:function(e){return{application:u.SUBJECTS,action:o.Subjects.DELETE_SUBJECT,args:[e.id]}},className:"text-danger"}];return d.createElement("div",{className:"".concat(wb.a.navContainer," h-auto pr-2 border-right")},d.createElement("h5",{className:"border-bottom pb-2"},"Subjects"),d.createElement(xl,{appLink:s,className:"d-inline-block pb-2"},d.createElement(Al,{svgName:Sl.Plus,size:jl.Small}),d.createElement("span",null,"New Subject")),!!r&&d.createElement("div",{className:"border-top pt-1"},d.createElement(zp,{tree:r,getAppLink:a,selectedIds:[t],actions:c})))}function xb(e){var t=e.currentAppLink;return d.createElement(ey,{navItems:Xm(),currentAppLink:t})}function Pb(e){return(Pb="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 Nb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Db(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 Rb(e,t,n){return t&&Db(e.prototype,t),n&&Db(e,n),e}function Fb(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&&Mb(e,t)}function Mb(e,t){return(Mb=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ub(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Bb(e);if(t){var i=Bb(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Vb(this,n)}}function Vb(e,t){return!t||"object"!==Pb(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 Bb(e){return(Bb=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var zb=function(e){Fb(n,e);var t=Ub(n);function n(){return Nb(this,n),t.apply(this,arguments)}return Rb(n,[{key:"channelName",get:function(){return u.PLAYLISTS}},{key:"appRoutes",get:function(){return{"manage/playlists(/)":"index","manage/playlists/new(/)":"newPlaylist","manage/playlists/search(/)":"searchPlaylists","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"]}}]),n}(r.AppRouter),Hb=function(e){Fb(n,e);var t=Ub(n);function n(){return Nb(this,n),t.apply(this,arguments)}return Rb(n,[{key:"initialize",value:function(){var e=this;dt.values(f).forEach((function(t){return fu.getInstance(t,e)}))}},{key:"index",value:function(e){var t;this.layout.showChildView(ae,d.createElement(_y,{cursor:null===(t=e)||void 0===t?void 0:t.cursor}))}},{key:"searchPlaylists",value:function(e){var t,n;this.layout.showChildView(ae,d.createElement(Ny,{query:null===(t=e)||void 0===t?void 0:t.query,cursor:null===(n=e)||void 0===n?void 0:n.cursor}))}},{key:"newPlaylist",value:function(){this.layout.showChildView(ae,d.createElement(yy,null))}},{key:"editPlaylist",value:function(e){this.layout.showChildView(ae,d.createElement(Mm,{key:e,playlistId:e}))}},{key:"editPlaylistVideos",value:function(e){this.layout.showChildView(ae,d.createElement(my,{key:e,playlistId:e}))}},{key:"editPlaylistSubjects",value:function(e){this.layout.showChildView(ae,d.createElement(ly,{key:e,playlistId:e}))}},{key:"editPlaylistAudiences",value:function(e){this.layout.showChildView(ae,d.createElement(iy,{key:e,playlistId:e}))}},{key:"deletePlaylist",value:function(e){var t=Object.assign({playlistId:e},this.getPopupProps());this.layout.showChildView(oe,d.createElement(_m,Object.assign({},t)))}},{key:"removeVideo",value:function(e,t){var n=Object.assign({playlistId:e,videoId:t},this.getPopupProps());this.layout.showChildView(oe,d.createElement(jy,Object.assign({},n)))}},{key:"removeFromSubject",value:function(e,t){var n=Object.assign({subjectId:t,memberId:e,memberType:Hm.Playlists},this.getPopupProps());this.layout.showChildView(oe,d.createElement(Ob,Object.assign({},n)))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(oe,d.createElement(mm,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 h.Radio.channel(y.ALERT).trigger("remove:alert",e)};this.layout.showChildView(se,d.createElement(Vf,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Playlists Application"}},{key:"channelName",get:function(){return u.PLAYLISTS}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT,options:{provider:hm}}}}],[{key:"router",get:function(){return zb}}]),n}(r.Application),qb=function(e){var t=e.children;return d.createElement(Au,null,d.createElement(pu,null,t))},Jb=function(){return"/api/domain/v2/me/ratings"},$b="ratings",Kb=function(){return{url:Jb(),key:$b}},Yb=co.object().shape({name:co.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:co.string().trim().max(350,"Description is too long").default(""),rating:co.object().shape({id:co.string()}).default({}).noUnknown(),tallPoster:co.object().shape({fileId:co.string(),fileIdType:co.mixed(),url:co.string()}).default({}).noUnknown(),banner:co.object().shape({fileId:co.string(),fileIdType:co.mixed(),url:co.string()}).default({}).noUnknown()}).noUnknown(),Gb=function(e,t){var n=u.SERIES,r=o.Series,i=[{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 eu(e)&&i.push.apply(i,[{label:"Subjects",appLink:{application:n,action:r.EDIT_SERIES_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_SERIES_AUDIENCES,args:[t]}}]),i};function Wb(e){var t=qa(),n=bo(t);return d.createElement(eo,null,d.createElement(vo,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this series",autoFocus:!0}),d.createElement(vo,{label:"Description",as:"textarea",name:"description",id:"description",maxLength:350,value:t.values.description,placeholder:"Describe this series here",showCharacterCounter:!0}),d.createElement(Pp,{ratings:e.ratings}),d.createElement(_u,{imageType:Ul.TallPosters,fieldName:"tallPoster",application:u.SERIES,uploadAction:o.Series.UPLOAD_IMAGE}),d.createElement(_u,{imageType:Ul.Banners,fieldName:"banner",application:u.SERIES,uploadAction:o.Playlists.UPLOAD_IMAGE}),d.createElement("div",{className:"d-flex justify-content-between align-items-center"},d.createElement(Eo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&d.createElement(wp,{actions:e.actions})))}function Zb(e){return d.createElement(so,{initialValues:e.series,validationSchema:Yb,onSubmit:e.saveSeries},d.createElement(Wb,{id:e.series&&e.series.id,ratings:e.ratings}))}var Qb=function(e){return function(t){return t.appLink.action===e}};function Xb(e){var t=e.seriesId,n=e.activeAction,r=d.useContext(ju);return d.createElement("div",{className:"py-2"},!!r&&d.createElement(Np,{tabs:Gb(r,t),isItemActive:Qb(n)}))}function eS(e){var t,n=Object(te.useDispatch)(),r=gm(),a=i.useBasicFetch(vv(e.seriesId)),s=i.useBasicFetch(Kb());return d.createElement(d.Fragment,null,d.createElement(Xb,{seriesId:e.seriesId,activeAction:o.Series.EDIT_SERIES}),!!a.data&&!!s.data&&d.createElement(Zb,{series:a.data,saveSeries:function(t,a){i.fetch(n,Ev(e.seriesId,t,(function(){r.success("Successfully updated series.")}),(function(){r.error("Failed to update series.")}),a))},ratings:s.data}),d.createElement("div",{className:"py-3 text-right"},"Can't find what you're looking for? Try the old edit series page ",d.createElement(xl,{className:"info-link",appLink:(t=e.seriesId,{application:u.SERIES,action:o.Series.LEGACY_EDIT_SERIES,args:[t]})},"here"),"."))}function tS(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return nS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nS(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function rS(e){var t=tS(d.useState({}),2),n=t[0],r=t[1],a=i.useBasicFetch(vv(e.seriesId)),s=pm(f.SUBJECT);!function(e,t,n){var r=function(e){return Bm.getSetStateByKey(n,e)};mu(Qh.getObjectLevelsFetchOptions(e,Hm.Series,r("seriesLevels")),[e]),mu(Qh.getObjectAudiencesFetchOptions(e,Hm.Series,r("seriesAudiences")),[e,t.seriesLevels]),Vm([Qh.getPresentationsFetchOptions(r("presentations")),Qh.getLevelsFetchOptions(r("levels"))],[]),mu(!!t.currentPresentation&&Qh.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(e.seriesId,n,r),ty(n,r);var c=!!(n.presentations&&n.levels&&n.presentationAudiences&&n.seriesLevels&&n.seriesAudiences);return d.createElement(d.Fragment,null,d.createElement(Xb,{seriesId:e.seriesId,activeAction:o.Series.EDIT_SERIES_AUDIENCES}),d.createElement(Lp,{object:a.data}),!!c&&d.createElement(sg,{objectLevels:n.seriesLevels,objectAudiences:n.seriesAudiences,presentations:n.presentations,currentPresentation:n.currentPresentation,setCurrentPresentation:Bm.getSetStateByKey(r,"currentPresentation"),levels:n.levels,presentationAudiences:n.presentationAudiences,memberType:Hm.Series,saveLevels:function(t,n,r){return s.updateObjectLevels(e.seriesId,t,Hm.Series,n,r,r)},saveAudiences:function(t,r){return s.updateObjectAudiences(e.seriesId,n.currentPresentation.id,t,Hm.Series,r,r)}}))}function iS(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||oS(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function aS(e){return function(e){if(Array.isArray(e))return sS(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||oS(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oS(e,t){if(e){if("string"==typeof e)return sS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?sS(e,t):void 0}}function sS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cS(e){var t=iS(d.useState({}),2),n=t[0],r=t[1],a=i.useBasicFetch(vv(e.seriesId)),s=pm(f.SUBJECT);!function(e,t,n){var r=function(e){return Bm.getSetStateByKey(n,e)};Vm([Qh.getSubjectTreeFetchOptions(r("subjectTree")),Qh.getPresentationsFetchOptions(r("presentations"))],[]),mu(Qh.getObjectSubjectsFetchOptions(e,Hm.Series,r("seriesSubjects")),[e]),mu(!!t.currentPresentation&&Qh.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),d.useEffect((function(){return r("subjectClassifications")([])}),[t.seriesSubjects]);var i=function(e,t){return[].concat(aS(t.subjectClassifications||[]),aS(e))},a=t.seriesSubjects&&t.seriesSubjects.map((function(e){return Qh.getSubjectClassificationFetchOptions(e.id,Bm.getSetStateByKey(n,"subjectClassifications",i))}));Vm(a,[t.seriesSubjects],!!a),mu(Qh.getObjectClassificationsFetchOptions(e,Hm.Series,r("seriesClassifications")),[e,t.seriesSubjects])}(e.seriesId,n,r),ty(n,r);var c=!!(n.seriesSubjects&&n.subjectTree&&n.presentations&&n.classificationTree&&n.seriesClassifications&&n.subjectClassifications);return d.createElement(d.Fragment,null,d.createElement(Xb,{seriesId:e.seriesId,activeAction:o.Series.EDIT_SERIES_SUBJECTS}),d.createElement(Lp,{object:a.data}),c&&d.createElement(Dg,{objectSubjects:n.seriesSubjects,subjectTree:n.subjectTree,memberType:Hm.Series,presentations:n.presentations,currentPresentation:n.currentPresentation,setCurrentPresentation:Bm.getSetStateByKey(r,"currentPresentation"),objectClassifications:n.seriesClassifications,objectSubjectClassifications:n.subjectClassifications,classificationTree:n.classificationTree,saveSubjects:function(t,n,r){return s.updateObjectSubjects(e.seriesId,t,Hm.Series,n,r,r)},saveClassifications:function(t,r){return s.updateObjectClassifications(e.seriesId,n.currentPresentation.id,t,Hm.Series,r,r)}}))}function lS(){var e=Object(te.useDispatch)(),t=gm(),n=i.useBasicFetch(Kb());return d.createElement(d.Fragment,null,!!n.data&&d.createElement(Zb,{saveSeries:function(n,a){var s=function(){t.error("Failed to create series.")},c=function(e){t.success("Successfully created series."),function(e){r.AppLinkHelper.trigger({application:u.SERIES,action:o.Series.EDIT_SERIES,args:[e.id]})}(e)};i.fetch(e,Sv(n,(function(t){var n={permissions:Xl()};i.fetch(e,Ev(t.id,n,c,s,a))}),s))},ratings:n.data}))}function uS(e){return(uS="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fS(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function dS(e,t,n){return t&&fS(e.prototype,t),n&&fS(e,n),e}function mS(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&&hS(e,t)}function hS(e,t){return(hS=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function gS(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=vS(e);if(t){var i=vS(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return yS(this,n)}}function yS(e,t){return!t||"object"!==uS(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function vS(e){return(vS=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var bS=function(e){mS(n,e);var t=gS(n);function n(){return pS(this,n),t.apply(this,arguments)}return dS(n,[{key:"channelName",get:function(){return u.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","manage/legacy/series/:id(/)":"legacyEditSeries"}}},{key:"appLinks",get:function(){return["uploadImage"]}}]),n}(r.AppRouter),SS=function(e){mS(n,e);var t=gS(n);function n(){return pS(this,n),t.apply(this,arguments)}return dS(n,[{key:"initialize",value:function(){var e=this;dt.values(f).forEach((function(t){return fu.getInstance(t,e)}))}},{key:"newSeries",value:function(){this.layout.showChildView(ae,d.createElement(lS,null))}},{key:"editSeries",value:function(e){this.layout.showChildView(ae,d.createElement(eS,{seriesId:e}))}},{key:"editSeriesVideos",value:function(e){this.legacyEditSeries(e)}},{key:"editSeriesSubjects",value:function(e){this.layout.showChildView(ae,d.createElement(cS,{seriesId:e}))}},{key:"editSeriesAudiences",value:function(e){this.layout.showChildView(ae,d.createElement(rS,{seriesId:e}))}},{key:"legacyEditSeries",value:function(e){r.LocationUtils.Redirect("/manage/legacy/series/".concat(e),!0)}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(oe,d.createElement(mm,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 h.Radio.channel(y.ALERT).trigger("remove:alert",e)};this.layout.showChildView(se,d.createElement(Vf,{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 u.SERIES}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT,options:{provider:qb}}}}],[{key:"router",get:function(){return bS}}]),n}(r.Application);function ES(e){return(ES="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 CS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function OS(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 IS(e,t,n){return t&&OS(e.prototype,t),n&&OS(e,n),e}function jS(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&&AS(e,t)}function AS(e,t){return(AS=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function TS(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=LS(e);if(t){var i=LS(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return wS(this,n)}}function wS(e,t){return!t||"object"!==ES(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 LS(e){return(LS=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var kS=function(e){jS(n,e);var t=TS(n);function n(){return CS(this,n),t.apply(this,arguments)}return IS(n,[{key:"channelName",get:function(){return u.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"]}}]),n}(r.AppRouter),_S=function(e){jS(n,e);var t=TS(n);function n(){return CS(this,n),t.apply(this,arguments)}return IS(n,[{key:"initialize",value:function(){var e=this;this.subjectDataService=fu.getInstance(f.SUBJECT,this),dt.values(f).forEach((function(t){return fu.getInstance(t,e)}))}},{key:"subjects",value:function(){this.subjectDataService.getSubjectTree((function(e){var t=!!e.children&&e.children[0];t?r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_SUBJECT,args:[t.id]},{replace:!0}):r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.NEW_SUBJECT},{replace:!0})}))}},{key:"newSubject",value:function(e){var t={parentId:e.parentId};this.layout.showChildView(ae,d.createElement(Sb,Object.assign({key:e.parentId},t))),this.renderSubjectsLeftNav()}},{key:"editSubject",value:function(e){this.layout.showChildView(ae,d.createElement(ab,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"editSubjectPlaylists",value:function(e){var t={subjectId:e,memberType:Hm.Playlists};this.layout.showChildView(ae,d.createElement(yb,Object.assign({key:"".concat(e,":playlists")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectSeries",value:function(e){var t={subjectId:e,memberType:Hm.Series};this.layout.showChildView(ae,d.createElement(yb,Object.assign({key:"".concat(e,":series")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectVideos",value:function(e){var t={subjectId:e,memberType:Hm.Videos};this.layout.showChildView(ae,d.createElement(yb,Object.assign({key:"".concat(e,":videos")},t))),this.renderSubjectsLeftNav(e)}},{key:"subjectClassifications",value:function(e){this.layout.showChildView(ae,d.createElement(Ab,{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(ae,d.createElement(Xv,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(oe,d.createElement(Ob,Object.assign({},r)))}},{key:"deleteSubject",value:function(e){var t=e.toString()===this.currentLeftNavId.toString()?{application:u.SUBJECTS,action:o.Subjects.NEW_SUBJECT}:null,n=Object.assign({subjectId:e,routeToOnDelete:t||null},this.getPopupProps());this.layout.showChildView(oe,d.createElement(nb,Object.assign({},n)))}},{key:"classifications",value:function(){var e={objectType:"classifications",getAppLink:function(e){return{application:u.SUBJECTS,action:o.Subjects.PRESENTATION_CLASSIFICATIONS,args:[e.id]}}};this.layout.showChildView(ae,d.createElement(Jv,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationClassifications",value:function(e){this.subjectDataService.getClassificationTree(e,(function(t){var n=!!t.children&&t.children[0];n?r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]},{replace:!0}):r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.NEW_CLASSIFICATION,args:[e]},{replace:!0})}))}},{key:"newClassification",value:function(e,t){var n={presentationId:e,parentId:t.parentId};this.layout.showChildView(ae,d.createElement(yv,Object.assign({key:t.parentId},n))),this.renderClassificationLeftNav(e)}},{key:"editClassification",value:function(e,t){var n={presentationId:e,classificationId:t};this.layout.showChildView(ae,d.createElement(pv,Object.assign({key:t},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationPlaylists",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Hm.Playlists};this.layout.showChildView(ae,d.createElement(mv,Object.assign({key:"".concat(t,":playlists")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationSeries",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Hm.Series};this.layout.showChildView(ae,d.createElement(mv,Object.assign({key:"".concat(t,":series")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationVideos",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Hm.Videos};this.layout.showChildView(ae,d.createElement(mv,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(oe,d.createElement(Iv,Object.assign({},r)))}},{key:"deleteClassification",value:function(e,t){var n=t===this.currentLeftNavId?{application:u.SUBJECTS,action:o.Subjects.NEW_CLASSIFICATION,args:[e]}:null,r=Object.assign({classificationId:t,routeToOnDelete:n||null},this.getPopupProps());this.layout.showChildView(oe,d.createElement(cv,Object.assign({},r)))}},{key:"levels",value:function(){this.layout.showChildView(ae,d.createElement(xv,null)),this.hideLeftNav()}},{key:"newLevel",value:function(){this.layout.showChildView(ae,d.createElement(Pv,null)),this.hideLeftNav()}},{key:"editLevel",value:function(e){this.layout.showChildView(ae,d.createElement(Tv,{key:e,id:e})),this.hideLeftNav()}},{key:"audiences",value:function(){var e={objectType:"audiences",getAppLink:function(e){return{application:u.SUBJECTS,action:o.Subjects.PRESENTATION_AUDIENCES,args:[e.id]}}};this.layout.showChildView(ae,d.createElement(Jv,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationAudiences",value:function(e){this.layout.showChildView(ae,d.createElement(Yy,{presentationId:e})),this.hideLeftNav()}},{key:"newAudience",value:function(e){this.layout.showChildView(ae,d.createElement(Qy,{presentationId:e})),this.hideLeftNav()}},{key:"editAudience",value:function(e,t){var n={presentationId:e,audienceId:t};this.layout.showChildView(ae,d.createElement(zy,Object.assign({key:t},n))),this.hideLeftNav()}},{key:"deleteAudience",value:function(e,t){var n={application:u.SUBJECTS,action:o.Subjects.PRESENTATION_AUDIENCES,args:[e]},r=Object.assign({id:t,routeToOnDelete:n},this.getPopupProps());this.layout.showChildView(oe,d.createElement(My,Object.assign({},r)))}},{key:"presentations",value:function(){this.layout.showChildView(ae,d.createElement(Bv,null)),this.hideLeftNav()}},{key:"newPresentation",value:function(){this.layout.showChildView(ae,d.createElement(zv,null))}},{key:"editPresentation",value:function(e){this.layout.showChildView(ae,d.createElement(Rv,{key:e,id:e})),this.hideLeftNav()}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(oe,d.createElement(mm,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 h.Radio.channel(y.ALERT).trigger("remove:alert",e)};this.layout.showChildView(se,d.createElement(Vf,{alerts:n,removeAlert:r}))}},{key:"renderClassificationLeftNav",value:function(e,t){this.setCurrentLeftNavItem(t);var n={presentationId:e,selectedClassificationId:t};this.layout.showChildView(ie,d.createElement(av,Object.assign({},n)))}},{key:"renderSubjectsLeftNav",value:function(e){this.setCurrentLeftNavItem(e),this.layout.showChildView(ie,d.createElement(_b,{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 d.createElement(xb,{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 u.SUBJECTS}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT,options:{provider:ub,getTopNavView:this.getTopNav}}}}],[{key:"router",get:function(){return kS}}]),n}(r.Application);class xS extends P{onShowAlert(e){if(!this.layoutOptions.options.alertRegion)return;const{ctor:t,collection:n}=e,r=n?n.toJSON():[];this.layout.showChildView(this.layoutOptions.options.alertRegion,d.createElement(t,{alerts:r,removeAlert:e=>h.Radio.channel(y.ALERT).trigger("remove:alert",e)}))}}var PS,NS=function(e){return{url:"/api/domain/v1/themes/".concat(e),key:"themes:".concat(e)}},DS=function(e){var t="/api/domain/v1/themes",n="themes";return e&&(t+="?type=".concat(e),n+=":type:".concat(e)),{url:t,key:n}},RS=function(e,t,n,r){return{url:"/api/domain/v1/themes",key:"theme",data:e,type:it.POST,invalidationKeys:"themes",success:t,error:n,always:r}},FS=function(e,t,n,r,i){return{url:"/api/domain/v1/themes/".concat(e),key:"update:theme:".concat(e),data:t,type:it.PUT,success:n,error:r,always:i}},MS=function(e,t,n,r){return{url:"/api/domain/v1/themes/".concat(e),key:"delete:theme:".concat(e),type:it.DELETE,invalidationKeys:"themes",success:t,error:n,always:r}},US=function(e){return{application:u.THEMES,action:o.Themes.EDIT_THEME,args:[e.id]}};function VS(){var e=i.useBasicFetch(DS());return e.data?d.createElement(_p,{objects:e.data,getObjectAppLink:US,newObjectAppLink:{application:u.THEMES,action:o.Themes.NEW_THEME},objectName:"Theme"}):d.createElement(d.Fragment,null)}!function(e){e.Glance="glance"}(PS||(PS={}));var BS=[{key:"topLeft",label:"Top Left"},{key:"topRight",label:"Top Right"},{key:"bottomLeft",label:"Bottom Left"},{key:"bottomRight",label:"Bottom Right"}];function zS(){var e=qa();return d.createElement("div",{className:"form-group"},BS.map((function(t){var n="data.".concat(t.key);return d.createElement(_u,{label:t.label,imageType:Ul.HeroBanners,fieldName:n,application:u.THEMES,uploadAction:o.Videos.UPLOAD_IMAGE,setSelectedImage:function(t){e.setFieldValue(n,{fileId:t.id,url:t.url,fileIdType:Bl.ImageAPIv2})}})})))}var HS=co.object().shape({fileId:co.string(),fileIdType:co.mixed(),url:co.string()}).default({}).noUnknown(),qS=co.object().shape({name:co.string().trim().max(255,"Name is too long").required("Name is required").default(""),type:co.mixed().required("Type is required"),data:co.mixed().when("type",{is:PS.Glance,then:co.object().shape({topLeft:HS,topRight:HS,bottomLeft:HS,bottomRight:HS}).noUnknown(),otherwise:co.mixed().strip(!0)}).default({})}).noUnknown();function JS(e){var t=qa(),n=function(e){switch(e){case PS.Glance:return zS;default:return}}(t.values.type);return d.createElement(eo,null,d.createElement(vo,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this theme",autoFocus:!0}),d.createElement(vo,{as:"select",label:"Type",name:"type",id:"type",value:t.values.type},d.createElement("option",{value:null},"Select a type..."),dt.getEnumKeys(PS).map((function(e){return d.createElement("option",{key:e,value:PS[e]},e)}))),!!n&&d.createElement(n,null),d.createElement("div",{className:"d-flex justify-content-between align-items-center"},d.createElement(Lo,{isNew:e.isNew}),!!e.actions&&d.createElement(wp,{actions:e.actions})))}function $S(e){var t;return d.createElement(so,{initialValues:e.theme,validationSchema:qS,onSubmit:e.saveTheme},d.createElement(JS,{isNew:!(null===(t=e.theme)||void 0===t?void 0:t.id),actions:e.actions}))}function KS(){var e=Object(te.useDispatch)();return d.createElement($S,{saveTheme:function(t,n){i.fetch(e,RS(t,(function(e){n(),r.AppLinkHelper.trigger({application:u.THEMES,action:o.Themes.EDIT_THEME,args:[e.id]})}),null,n))}})}function YS(e){var t=Object(te.useDispatch)(),n=gm(),r=i.useBasicFetch(NS(e.id));return r.data?d.createElement($S,{theme:r.data,saveTheme:function(r,a){i.fetch(t,FS(e.id,r,(function(){n.success("Successfully updated theme")}),(function(){n.error("Failed to update theme")}),a))},actions:[{label:"Delete theme",className:"btn btn-danger",button:!0,appLink:{application:u.THEMES,action:o.Themes.DELETE_THEME,args:[e.id]}}]}):d.createElement(d.Fragment,null)}function GS(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return WS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return WS(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function WS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ZS(e){var t=Object(te.useDispatch)(),n=gm(),a=GS(d.useState(!1),2),s=a[0],c=a[1],l=i.useBasicFetch(NS(e.id));return d.createElement(zf,{title:"Delete Theme",closePopup:e.closePopup,showLoadingSpinner:!l.data},d.createElement(d.Fragment,null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,l.data.name),"?"),d.createElement(qf,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){c(!0),i.fetch(t,MS(e.id,(function(){n.success("Successfully deleted theme"),r.AppLinkHelper.trigger({application:u.THEMES,action:o.Themes.THEMES})}),(function(){n.error("Failed to delete theme")})))},buttonText:"Yes, delete this theme",isSpinnerButton:!0,showSpinner:s}]})))}var QS=function(e){var t=e.children;return d.createElement(Au,null,d.createElement(pu,null,t))};function XS(e){return(XS="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 eE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tE(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 nE(e,t,n){return t&&tE(e.prototype,t),n&&tE(e,n),e}function rE(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&&iE(e,t)}function iE(e,t){return(iE=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function aE(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=sE(e);if(t){var i=sE(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return oE(this,n)}}function oE(e,t){return!t||"object"!==XS(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 sE(e){return(sE=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var cE=function(e){rE(n,e);var t=aE(n);function n(){return eE(this,n),t.apply(this,arguments)}return nE(n,[{key:"channelName",get:function(){return u.THEMES}},{key:"appRoutes",get:function(){return{"manage/themes(/)":"themes","manage/themes/new(/)":"newTheme","manage/themes/:id(/)":"editTheme"}}},{key:"appLinks",get:function(){return["deleteTheme","uploadImage"]}}]),n}(r.AppRouter),lE=function(e){rE(n,e);var t=aE(n);function n(){return eE(this,n),t.apply(this,arguments)}return nE(n,[{key:"themes",value:function(){this.layout.showChildView(ae,d.createElement(VS,null))}},{key:"newTheme",value:function(){this.layout.showChildView(ae,d.createElement(KS,null))}},{key:"editTheme",value:function(e){this.layout.showChildView(ae,d.createElement(YS,{id:e}))}},{key:"deleteTheme",value:function(e){var t=this;this.layout.showChildView(oe,d.createElement(ZS,{id:e,closePopup:function(){return t.layout.closePopup()}}))}},{key:"uploadImage",value:function(e){var t=this;this.layout.showChildView(oe,d.createElement(mm,{imageType:e,closePopup:function(){return t.layout.closePopup()}}))}},{key:"name",get:function(){return"Themes Application"}},{key:"channelName",get:function(){return u.THEMES}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT,options:{provider:QS}}}}],[{key:"router",get:function(){return cE}}]),n}(xS),uE=function(e){var t=e.children;return d.createElement(Au,null,d.createElement(pu,null,t))},pE=function(e){var t=u.VIDEOS,n=o.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]}},{label:"Aliases",appLink:{application:t,action:n.EDIT_VIDEO_ALIASES,args:[e]}}]},fE=function(e){return function(t){return t.appLink.action===e}};function dE(e){var t=e.videoId,n=e.activeAction;return d.createElement("div",{className:"py-2"},d.createElement(Np,{tabs:pE(t),isItemActive:fE(n)}))}var mE,hE=co.object().shape({name:co.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:co.string().trim().default(""),status:co.mixed().required("Status is required"),productionYear:co.number().min(1900),rating:co.object().shape({id:co.string()}).default({}).noUnknown(),thumbnail:co.object().shape({fileId:co.string(),fileIdType:co.mixed(),url:co.string()}).default({}).noUnknown(),heroBanner:co.object().shape({fileId:co.string(),fileIdType:co.mixed(),url:co.string()}).default({}).noUnknown(),glance:co.object().shape({theme:co.string(),format:co.mixed(),content:co.string()}).default({}).noUnknown()}).noUnknown();!function(e){e[e.Draft=0]="Draft",e[e.Published=1]="Published",e[e.Archived=2]="Archived",e[e.Pending=3]="Pending",e[e.Rejected=4]="Rejected",e[e.Processing=5]="Processing"}(mE||(mE={}));var gE,yE=n(129);function vE(e){var t,n,r,i,a,o=qa();return d.createElement("div",{className:"form-group p-2 border"},d.createElement("div",{className:"border-bottom mb-2"},d.createElement("label",null,"Summary")),d.createElement(vo,{as:"select",label:"Theme",name:"glance.theme",id:"type",value:null===(t=o.values.glance)||void 0===t?void 0:t.theme},d.createElement("option",{value:null},"Select a theme..."),e.themes.map((function(e){return d.createElement("option",{key:e.id,value:e.name},e.name)}))),d.createElement(vo,{as:"select",label:"Format",name:"glance.format",id:"type",value:null===(n=o.values.glance)||void 0===n?void 0:n.format},d.createElement("option",{value:null},"Select a format..."),dt.getEnumKeys(gE).map((function(e){return d.createElement("option",{key:e,value:gE[e]},e)}))),d.createElement(vo,{label:"Content",as:"textarea",name:"glance.content",id:"content",value:null===(r=o.values.glance)||void 0===r?void 0:r.content}),(null===(i=o.values.glance)||void 0===i?void 0:i.format)===gE.Markdown&&d.createElement("div",{className:"form-group"},d.createElement("label",null,"Content Preview"),d.createElement("div",{className:"border rounded py-2",dangerouslySetInnerHTML:{__html:yE(null===(a=o.values.glance)||void 0===a?void 0:a.content)}})))}function bE(e){switch(e){case mE.Published:return"badge-success";case mE.Archived:return"badge-danger";case mE.Draft:return"badge-warning";case mE.Pending:return"badge-info";case mE.Rejected:return"badge-dark";default:return"badge-secondary"}}function SE(e){var t=qa(),n=!!e.rightslineId;return d.createElement(eo,null,n&&d.createElement(vo,{label:"Rightsline ID",name:"rightslineId",id:"rightslineId",value:e.rightslineId,disabled:!0}),d.createElement(vo,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this video",disabled:n,autoFocus:!0}),d.createElement("div",{className:"form-group"},d.createElement("label",null,"Status"),d.createElement("div",null,d.createElement("span",{className:"badge ".concat(bE(t.values.status))},mE[t.values.status]))),d.createElement(vo,{label:"Description",as:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this video here",disabled:n,showCharacterCounter:!0}),d.createElement(vo,{label:"Production Year",type:"number",name:"productionYear",id:"productionYear",value:t.values.productionYear,disabled:n}),d.createElement(Pp,{ratings:e.ratings,disabled:n}),d.createElement(_u,{imageType:Ul.Thumbnails,fieldName:"thumbnail",application:u.VIDEOS,uploadAction:o.Videos.UPLOAD_IMAGE}),d.createElement(_u,{imageType:Ul.HeroBanners,fieldName:"heroBanner",application:u.VIDEOS,uploadAction:o.Videos.UPLOAD_IMAGE}),d.createElement(vE,{themes:e.themes}),d.createElement(Lo,{isNew:!e.id}))}function EE(e,t){if(e)return t?Object.assign(Object.assign({},e),t):e}function CE(e){return d.createElement(so,{initialValues:EE(e.video,e.rightslineVideo),validationSchema:hE,onSubmit:e.saveVideo,allowInitialSubmit:!!e.rightslineVideo},d.createElement(SE,{id:e.video&&e.video.id,ratings:e.ratings,themes:e.themes,rightslineId:e.rightslineId}))}function OE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return IE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return IE(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function IE(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function jE(e){var t,n=Object(te.useDispatch)(),r=OE(d.useState(!1),2),a=r[0],s=r[1],c=i.useBasicFetch(by(e.videoId)),l=i.useBasicFetch(Ey(e.videoId)),p=i.useBasicFetch(Kb()),f=i.useBasicFetch(DS(PS.Glance));var m,h=!!c.data&&!!p.data&&!!f.data&&l.isComplete;return d.createElement(d.Fragment,null,d.createElement(dE,{videoId:e.videoId,activeAction:o.Videos.EDIT_VIDEO}),!!l.data&&d.createElement("div",{className:"pt-3 text-right"},d.createElement(uo.Button,{variant:"outline-dark",size:"sm",onClick:function(){l.isFetching||(s(!0),i.fetch(n,Ey(e.videoId)))}},"Sync from Rightsline")),h&&d.createElement(CE,{video:c.data,saveVideo:function(t,r){i.fetch(n,Cy(e.videoId,t,null,null,r))},ratings:p.data,themes:f.data,rightslineId:null===(t=l.data)||void 0===t?void 0:t.rightslineId,rightslineVideo:a&&l.data}),d.createElement("div",{className:"py-3 text-right"},"Can't find what you're looking for? Try the old edit video page ",d.createElement(xl,{className:"info-link",appLink:(m=e.videoId,{application:u.VIDEOS,action:o.Videos.LEGACY_EDIT_VIDEO,args:[m]})},"here"),"."))}function AE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return TE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return TE(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function TE(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wE(e){var t=AE(d.useState({}),2),n=t[0],r=t[1],a=i.useBasicFetch(by(e.videoId)),s=pm(f.SUBJECT);!function(e,t,n){var r=function(e){return Bm.getSetStateByKey(n,e)};mu(Qh.getObjectLevelsFetchOptions(e,Hm.Videos,r("videoLevels")),[e]),mu(Qh.getObjectAudiencesFetchOptions(e,Hm.Videos,r("videoAudiences")),[e,t.videoLevels]),Vm([Qh.getPresentationsFetchOptions(r("presentations")),Qh.getLevelsFetchOptions(r("levels"))],[]),mu(!!t.currentPresentation&&Qh.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(e.videoId,n,r),ty(n,r);var c=!!(n.presentations&&n.levels&&n.presentationAudiences&&n.videoLevels&&n.videoAudiences);return d.createElement(d.Fragment,null,d.createElement(dE,{videoId:e.videoId,activeAction:o.Videos.EDIT_VIDEO_AUDIENCES}),d.createElement(Lp,{object:a.data}),!!c&&d.createElement(sg,{objectLevels:n.videoLevels,objectAudiences:n.videoAudiences,presentations:n.presentations,currentPresentation:n.currentPresentation,setCurrentPresentation:Bm.getSetStateByKey(r,"currentPresentation"),levels:n.levels,presentationAudiences:n.presentationAudiences,memberType:Hm.Videos,saveLevels:function(t,n,r){return s.updateObjectLevels(e.videoId,t,Hm.Videos,n,r,r)},saveAudiences:function(t,r){return s.updateObjectAudiences(e.videoId,n.currentPresentation.id,t,Hm.Videos,r,r)}}))}function LE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||_E(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kE(e){return function(e){if(Array.isArray(e))return xE(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||_E(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _E(e,t){if(e){if("string"==typeof e)return xE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xE(e,t):void 0}}function xE(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function PE(e){var t=LE(d.useState({}),2),n=t[0],r=t[1],a=i.useBasicFetch(by(e.videoId)),s=pm(f.SUBJECT);!function(e,t,n){var r=function(e){return Bm.getSetStateByKey(n,e)};Vm([Qh.getSubjectTreeFetchOptions(r("subjectTree")),Qh.getPresentationsFetchOptions(r("presentations"))],[]),mu(Qh.getObjectSubjectsFetchOptions(e,Hm.Videos,r("videoSubjects")),[e]),mu(!!t.currentPresentation&&Qh.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),d.useEffect((function(){return r("subjectClassifications")([])}),[t.videoSubjects]);var i=function(e,t){return[].concat(kE(t.subjectClassifications||[]),kE(e))},a=t.videoSubjects&&t.videoSubjects.map((function(e){return Qh.getSubjectClassificationFetchOptions(e.id,Bm.getSetStateByKey(n,"subjectClassifications",i))}));Vm(a,[t.videoSubjects],!!a),mu(Qh.getObjectClassificationsFetchOptions(e,Hm.Videos,r("videoClassifications")),[e,t.videoSubjects])}(e.videoId,n,r),ty(n,r);var c=!!(n.videoSubjects&&n.subjectTree&&n.presentations&&n.classificationTree&&n.videoClassifications&&n.subjectClassifications);return d.createElement(d.Fragment,null,d.createElement(dE,{videoId:e.videoId,activeAction:o.Videos.EDIT_VIDEO_SUBJECTS}),d.createElement(Lp,{object:a.data}),c&&d.createElement(Dg,{objectSubjects:n.videoSubjects,subjectTree:n.subjectTree,memberType:Hm.Videos,presentations:n.presentations,currentPresentation:n.currentPresentation,setCurrentPresentation:Bm.getSetStateByKey(r,"currentPresentation"),objectClassifications:n.videoClassifications,objectSubjectClassifications:n.subjectClassifications,classificationTree:n.classificationTree,saveSubjects:function(t,n,r){return s.updateObjectSubjects(e.videoId,t,Hm.Videos,n,r,r)},saveClassifications:function(t,r){return s.updateObjectClassifications(e.videoId,n.currentPresentation.id,t,Hm.Videos,r,r)}}))}!function(e){e.Markdown="text/markdown"}(gE||(gE={}));var NE=function(e){return{key:"aliases:".concat(e),url:"/api/master/v2/objects/".concat(e,"/aliases")}},DE=function(e,t,n,r){return{key:"create:alias",url:"/api/master/v2/objects/".concat(e,"/aliases"),type:it.POST,invalidationKeys:"aliases:".concat(e),data:t,success:n,error:r}},RE=function(e,t,n,r){return{key:"delete:alias",url:"/api/domain/v2/objects/".concat(e,"/aliases/").concat(t),type:it.DELETE,invalidationKeys:"aliases:".concat(e),success:n,error:r}};function FE(e){var t=e.videoId,n=Object(te.useDispatch)(),r=gm(),a=i.useBasicFetch(NE(t));return a.data?d.createElement(d.Fragment,null,d.createElement(dE,{videoId:t,activeAction:o.Videos.EDIT_VIDEO_ALIASES}),d.createElement(hf,{aliases:a.data.data,onSave:function(e,a){i.fetch(n,DE(t,e,(function(){r.success("Successfully created alias"),a()}),(function(){r.error("Something went wrong creating your alias")})))},onDelete:function(e){i.fetch(n,RE(t,e,(function(){r.success("Successfully deleted alias")}),(function(){r.error("Something went wrong deleting your alias")})))}})):d.createElement(d.Fragment,null,"Loading...")}function ME(e){return(ME="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 UE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VE(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 BE(e,t,n){return t&&VE(e.prototype,t),n&&VE(e,n),e}function zE(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&&HE(e,t)}function HE(e,t){return(HE=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qE(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=$E(e);if(t){var i=$E(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return JE(this,n)}}function JE(e,t){return!t||"object"!==ME(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(e){return($E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var KE,YE,GE=function(e){zE(n,e);var t=qE(n);function n(){return UE(this,n),t.apply(this,arguments)}return BE(n,[{key:"channelName",get:function(){return u.VIDEOS}},{key:"appRoutes",get:function(){return{"manage/videos/:id(/)":"editVideo","manage/videos/:id/audiences(/)":"editVideoAudiences","manage/videos/:id/subjects(/)":"editVideoSubjects","manage/videos/:id/aliases(/)":"editVideoAliases","tools/programlookup/:id":"legacyEditVideo"}}},{key:"appLinks",get:function(){return["uploadImage"]}}]),n}(r.AppRouter),WE=function(e){zE(n,e);var t=qE(n);function n(){return UE(this,n),t.apply(this,arguments)}return BE(n,[{key:"initialize",value:function(){var e=this;dt.values(f).forEach((function(t){return fu.getInstance(t,e)}))}},{key:"editVideo",value:function(e){this.layout.showChildView(ae,d.createElement(jE,{videoId:e}))}},{key:"editVideoAudiences",value:function(e){this.layout.showChildView(ae,d.createElement(wE,{videoId:e}))}},{key:"editVideoSubjects",value:function(e){this.layout.showChildView(ae,d.createElement(PE,{videoId:e}))}},{key:"editVideoAliases",value:function(e){this.layout.showChildView(ae,d.createElement(FE,{videoId:e}))}},{key:"legacyEditVideo",value:function(e){r.LocationUtils.Redirect("/tools/programlookup/".concat(e))}},{key:"uploadImage",value:function(e){var t=this;this.layout.showChildView(oe,d.createElement(mm,{imageType:e,closePopup:function(){return t.layout.closePopup()}}))}},{key:"name",get:function(){return"Videos Application"}},{key:"channelName",get:function(){return u.VIDEOS}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT,options:{provider:uE,alertRegion:se}}}}],[{key:"router",get:function(){return GE}}]),n}(xS);!function(e){e.Fifo="FifoMemoryCache"}(KE||(KE={}));class ZE extends G{constructor(e){super(),this.size=e.size,this.cache={},this.cachedkeys=[]}get name(){return KE.Fifo}removeCacheKey(e){this.cachedkeys=m.without(this.cachedkeys,e)}has(e){return!!this.cache[e]}get(e){return this.cache[e]}set(e,t){e&&t||x.throw(new B("Must provide a cache key and a value to cache in FifoMemoryCache.")),this.has(e)&&this.removeCacheKey(e),this.cachedkeys.push(e),this.cache[e]=t,this.cachedkeys.length>this.size&&delete this.cache[this.cachedkeys.shift()]}getOrSet(e,t){if(this.has(e))return this.get(e);const n=t();return this.set(e,n),n}remove(e){return!!this.has(e)&&(delete this.cache[e],this.removeCacheKey(e),!0)}invalidate(e,t){const n=m.object(this.cachedkeys,this.cachedkeys);let r=[];m.each(e,e=>{n[e]&&r.push(e);const t=new RegExp(e,"i"),i=m.filter(n,e=>t.test(e));r.push(...i)}),r.length&&(r=m.uniq(r),m.each(r,e=>{delete this.cache[e],m.isFunction(t)&&t(e)}),this.cachedkeys=m.without(this.cachedkeys,...r))}}!function(e){e[e.Unknown=0]="Unknown",e[e.BadRequest=1]="BadRequest",e[e.Unauthorized=2]="Unauthorized",e[e.Forbidden=3]="Forbidden",e[e.NotFound=4]="NotFound",e[e.InternalServer=5]="InternalServer"}(YE||(YE={}));const QE={type:YE.Unknown,message:"",code:0};var XE;!function(e){e.Ajax="AjaxDataProvider",e.Notifications="NotificationsSignalRDataProvider"}(XE||(XE={}));const eC={parseErrorMessage(e,t,n){if(!n||!n.errorCode)return e[t];let r=""+n.errorCode;return n.errorSubCode&&(r+="."+n.errorSubCode),e[r]||e[t]}};class tC extends A.Object{constructor(e){super(e),$.ajaxSetup({cache:!1,contentType:"application/json; charset=utf-8"}),this.successMiddleware={},this.errorMiddleware={},this.dataServiceErrorMessageMappings=e.dataServiceErrorMessageMappings,this.defaultErrorMessageKey=e.defaultErrorMessageKey}get name(){return XE.Ajax}parseUrl(e){const t=document.createElement("a");return t.href=e,""===t.host&&(t.href=t.href),t}makeHttps(e){const t=this.parseUrl(e);return"http:"===t.protocol&&(t.protocol="https:"),t.href}base(e,t,n,r={}){n||(n=it.GET);const i=m.defaults(r,{forceHttps:!1}),a={url:e,method:n,type:n};t&&(a.data=n===it.POST||n===it.PUT?JSON.stringify(t):t),i.forceHttps&&(a.url=this.makeHttps(a.url)),i.traditional&&(a.traditional=i.traditional);const o=$.ajax(a);return m.keys(this.successMiddleware).length&&o.done(m.values(this.successMiddleware)),m.keys(this.errorMiddleware).length&&o.fail(m.values(this.errorMiddleware)),o}create(e,t,n){const{channel:r,successEvent:i,errorEvent:a}=n;this.base(e,t,it.POST).done((e,t,n)=>r.trigger(i,e,t,n)).fail((e,t,n)=>r.trigger(a,e,t,n))}read(e,t){const{channel:n,successEvent:r,errorEvent:i}=t;this.base(e,null,it.GET).done((e,t,i)=>{n.trigger(r,e,t,i)}).fail((e,t,r)=>{n.trigger(i,e,t,r)})}update(e,t,n){const{channel:r,successEvent:i,errorEvent:a}=n;this.base(e,t,it.PUT).done((e,t,n)=>r.trigger(i,e,t,n)).fail((e,t,n)=>r.trigger(a,e,t,n))}delete(e,t){const{channel:n,successEvent:r,errorEvent:i}=t;this.base(e,null,it.DELETE).done((e,t,i)=>n.trigger(r,e,t,i)).fail((e,t,r)=>n.trigger(i,e,t,r))}useMiddleware(e,t){this.successMiddleware[e]||(this.successMiddleware[e]=t)}useErrorMiddleware(e,t){this.errorMiddleware[e]||(this.errorMiddleware[e]=t)}parseError(e,t,n){const r=e.responseJSON,i=QE;switch(i.code=e.status,i.message=eC.parseErrorMessage(this.dataServiceErrorMessageMappings,this.defaultErrorMessageKey,r),e.status){case 400:i.type=YE.BadRequest;break;case 401:i.type=YE.Unauthorized;break;case 403:i.type=YE.Forbidden;break;case 404:i.type=YE.NotFound;break;case 500:i.type=YE.InternalServer}return i}}n.d(t,"Actions",(function(){return o})),n.d(t,"DataPrefixes",(function(){return s})),n.d(t,"FileExtensions",(function(){return c})),n.d(t,"Layouts",(function(){return l})),n.d(t,"AppChannels",(function(){return u})),n.d(t,"DataChannels",(function(){return p})),n.d(t,"DataServices",(function(){return f})),n.d(t,"CuratorLayoutView",(function(){return be})),n.d(t,"LayoutComponent",(function(){return Ie})),n.d(t,"CuratorAppNavService",(function(){return Ne})),n.d(t,"ImageUploadDataService",(function(){return He})),n.d(t,"UserDataServiceHelper",(function(){return $e})),n.d(t,"LanguageDataService",(function(){return tt})),n.d(t,"CompaniesApplication",(function(){return xf})),n.d(t,"DomainOptionsApplication",(function(){return Pd})),n.d(t,"PeopleApplication",(function(){return um})),n.d(t,"PlaylistsApplication",(function(){return Hb})),n.d(t,"SeriesApplication",(function(){return SS})),n.d(t,"SubjectDataService",(function(){return Wh})),n.d(t,"SubjectDataServiceHelper",(function(){return Qh})),n.d(t,"SubjectsApplication",(function(){return _S})),n.d(t,"ThemesApplication",(function(){return lE})),n.d(t,"VideosApplication",(function(){return WE})),n.d(t,"DomainOptionsApplication",(function(){return Pd})),n.d(t,"Core",(function(){return r})),n.d(t,"InstanceManager",(function(){return fu})),n.d(t,"FifoMemoryCache",(function(){return ZE})),n.d(t,"AjaxDataProvider",(function(){return tC})),n.d(t,"AlertType",(function(){return Lf})),n.d(t,"BaseAlertService",(function(){return Nf})),n.d(t,"LanguageService",(function(){return Ao})),n.d(t,"Flight",(function(){return i})),n.d(t,"CacheDurations",(function(){return qe})),n.d(t,"UserDataService",(function(){return bu}))}])}));
17
+ */var r="function"==typeof Symbol&&Symbol.for,i=r?Symbol.for("react.element"):60103,a=r?Symbol.for("react.portal"):60106,o=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,c=r?Symbol.for("react.profiler"):60114,l=r?Symbol.for("react.provider"):60109,u=r?Symbol.for("react.context"):60110,p=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,m=r?Symbol.for("react.suspense"):60113,h=r?Symbol.for("react.suspense_list"):60120,g=r?Symbol.for("react.memo"):60115,y=r?Symbol.for("react.lazy"):60116,v=r?Symbol.for("react.block"):60121,b=r?Symbol.for("react.fundamental"):60117,S=r?Symbol.for("react.responder"):60118,E=r?Symbol.for("react.scope"):60119;function C(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case i:switch(e=e.type){case p:case f:case o:case c:case s:case m:return e;default:switch(e=e&&e.$$typeof){case u:case d:case y:case g:case l:return e;default:return t}}case a:return t}}}function O(e){return C(e)===f}t.AsyncMode=p,t.ConcurrentMode=f,t.ContextConsumer=u,t.ContextProvider=l,t.Element=i,t.ForwardRef=d,t.Fragment=o,t.Lazy=y,t.Memo=g,t.Portal=a,t.Profiler=c,t.StrictMode=s,t.Suspense=m,t.isAsyncMode=function(e){return O(e)||C(e)===p},t.isConcurrentMode=O,t.isContextConsumer=function(e){return C(e)===u},t.isContextProvider=function(e){return C(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i},t.isForwardRef=function(e){return C(e)===d},t.isFragment=function(e){return C(e)===o},t.isLazy=function(e){return C(e)===y},t.isMemo=function(e){return C(e)===g},t.isPortal=function(e){return C(e)===a},t.isProfiler=function(e){return C(e)===c},t.isStrictMode=function(e){return C(e)===s},t.isSuspense=function(e){return C(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===f||e===c||e===s||e===m||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===g||e.$$typeof===l||e.$$typeof===u||e.$$typeof===d||e.$$typeof===b||e.$$typeof===S||e.$$typeof===E||e.$$typeof===v)},t.typeOf=C},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),o=p(a),s=p(n(16)),c=p(n(170)),l=p(n(171)),u=n(179);function p(e){return e&&e.__esModule?e:{default:e}}var f=function(){return!0},d=function(e){function t(e){var n=e.alwaysRenderSuggestions;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return m.call(r),r.state={isFocused:!1,isCollapsed:!n,highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null},r.justPressedUpDown=!1,r.justMouseEntered=!1,r.pressedSuggestion=null,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.onDocumentMouseDown),document.addEventListener("mouseup",this.onDocumentMouseUp),this.input=this.autowhatever.input,this.suggestionsContainer=this.autowhatever.itemsContainer}},{key:"componentWillReceiveProps",value:function(e){(0,c.default)(e.suggestions,this.props.suggestions)?e.highlightFirstSuggestion&&e.suggestions.length>0&&!1===this.justPressedUpDown&&!1===this.justMouseEntered&&this.highlightFirstSuggestion():this.willRenderSuggestions(e)?this.state.isCollapsed&&!this.justSelectedSuggestion&&this.revealSuggestions():this.resetHighlightedSuggestion()}},{key:"componentDidUpdate",value:function(e,t){var n=this.props,r=n.suggestions,i=n.onSuggestionHighlighted,a=n.highlightFirstSuggestion;if(!(0,c.default)(r,e.suggestions)&&r.length>0&&a)this.highlightFirstSuggestion();else if(i){var o=this.getHighlightedSuggestion();o!=t.highlightedSuggestion&&i({suggestion:o})}}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.onDocumentMouseDown),document.removeEventListener("mouseup",this.onDocumentMouseUp)}},{key:"updateHighlightedSuggestion",value:function(e,t,n){var r=this;this.setState((function(i){var a=i.valueBeforeUpDown;return null===t?a=null:null===a&&void 0!==n&&(a=n),{highlightedSectionIndex:e,highlightedSuggestionIndex:t,highlightedSuggestion:null===t?null:r.getSuggestion(e,t),valueBeforeUpDown:a}}))}},{key:"resetHighlightedSuggestion",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setState((function(t){var n=t.valueBeforeUpDown;return{highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:e?null:n}}))}},{key:"revealSuggestions",value:function(){this.setState({isCollapsed:!1})}},{key:"closeSuggestions",value:function(){this.setState({highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null,isCollapsed:!0})}},{key:"getSuggestion",value:function(e,t){var n=this.props,r=n.suggestions,i=n.multiSection,a=n.getSectionSuggestions;return i?a(r[e])[t]:r[t]}},{key:"getHighlightedSuggestion",value:function(){var e=this.state,t=e.highlightedSectionIndex,n=e.highlightedSuggestionIndex;return null===n?null:this.getSuggestion(t,n)}},{key:"getSuggestionValueByIndex",value:function(e,t){return(0,this.props.getSuggestionValue)(this.getSuggestion(e,t))}},{key:"getSuggestionIndices",value:function(e){var t=e.getAttribute("data-section-index"),n=e.getAttribute("data-suggestion-index");return{sectionIndex:"string"==typeof t?parseInt(t,10):null,suggestionIndex:parseInt(n,10)}}},{key:"findSuggestionElement",value:function(e){var t=e;do{if(null!==t.getAttribute("data-suggestion-index"))return t;t=t.parentNode}while(null!==t);throw console.error("Clicked element:",e),new Error("Couldn't find suggestion element")}},{key:"maybeCallOnChange",value:function(e,t,n){var r=this.props.inputProps,i=r.value,a=r.onChange;t!==i&&a(e,{newValue:t,method:n})}},{key:"willRenderSuggestions",value:function(e){var t=e.suggestions,n=e.inputProps,r=e.shouldRenderSuggestions,i=n.value;return t.length>0&&r(i)}},{key:"getQuery",value:function(){var e=this.props.inputProps.value,t=this.state.valueBeforeUpDown;return(null===t?e:t).trim()}},{key:"render",value:function(){var e=this,t=this.props,n=t.suggestions,i=t.renderInputComponent,a=t.onSuggestionsFetchRequested,s=t.renderSuggestion,c=t.inputProps,p=t.multiSection,d=t.renderSectionTitle,m=t.id,h=t.getSectionSuggestions,g=t.theme,y=t.getSuggestionValue,v=t.alwaysRenderSuggestions,b=t.highlightFirstSuggestion,S=this.state,E=S.isFocused,C=S.isCollapsed,O=S.highlightedSectionIndex,I=S.highlightedSuggestionIndex,j=S.valueBeforeUpDown,A=v?f:this.props.shouldRenderSuggestions,T=c.value,w=c.onFocus,L=c.onKeyDown,k=this.willRenderSuggestions(this.props),_=v||E&&!C&&k,x=_?n:[],P=r({},c,{onFocus:function(t){if(!e.justSelectedSuggestion&&!e.justClickedOnSuggestionsContainer){var n=A(T);e.setState({isFocused:!0,isCollapsed:!n}),w&&w(t),n&&a({value:T,reason:"input-focused"})}},onBlur:function(t){e.justClickedOnSuggestionsContainer?e.input.focus():(e.blurEvent=t,e.justSelectedSuggestion||(e.onBlur(),e.onSuggestionsClearRequested()))},onChange:function(t){var n=t.target.value,i=A(n);e.maybeCallOnChange(t,n,"type"),e.suggestionsContainer&&(e.suggestionsContainer.scrollTop=0),e.setState(r({},b?{}:{highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null},{valueBeforeUpDown:null,isCollapsed:!i})),i?a({value:n,reason:"input-changed"}):e.onSuggestionsClearRequested()},onKeyDown:function(t,r){var i=t.keyCode;switch(i){case 40:case 38:if(C)A(T)&&(a({value:T,reason:"suggestions-revealed"}),e.revealSuggestions());else if(n.length>0){var o=r.newHighlightedSectionIndex,s=r.newHighlightedItemIndex,c=void 0;c=null===s?null===j?T:j:e.getSuggestionValueByIndex(o,s),e.updateHighlightedSuggestion(o,s,T),e.maybeCallOnChange(t,c,40===i?"down":"up")}t.preventDefault(),e.justPressedUpDown=!0,setTimeout((function(){e.justPressedUpDown=!1}));break;case 13:if(229===t.keyCode)break;var l=e.getHighlightedSuggestion();if(_&&!v&&e.closeSuggestions(),null!=l){var u=y(l);e.maybeCallOnChange(t,u,"enter"),e.onSuggestionSelected(t,{suggestion:l,suggestionValue:u,suggestionIndex:I,sectionIndex:O,method:"enter"}),e.justSelectedSuggestion=!0,setTimeout((function(){e.justSelectedSuggestion=!1}))}break;case 27:_&&t.preventDefault();var p=_&&!v;if(null===j){if(!p){e.maybeCallOnChange(t,"","escape"),A("")?a({value:"",reason:"escape-pressed"}):e.onSuggestionsClearRequested()}}else e.maybeCallOnChange(t,j,"escape");p?(e.onSuggestionsClearRequested(),e.closeSuggestions()):e.resetHighlightedSuggestion()}L&&L(t)}}),N={query:this.getQuery()};return o.default.createElement(l.default,{multiSection:p,items:x,renderInputComponent:i,renderItemsContainer:this.renderSuggestionsContainer,renderItem:s,renderItemData:N,renderSectionTitle:d,getSectionItems:h,highlightedSectionIndex:O,highlightedItemIndex:I,inputProps:P,itemProps:this.itemProps,theme:(0,u.mapToAutowhateverTheme)(g),id:m,ref:this.storeAutowhateverRef})}}]),t}(a.Component);d.propTypes={suggestions:s.default.array.isRequired,onSuggestionsFetchRequested:function(e,t){var n=e[t];if("function"!=typeof n)throw new Error("'onSuggestionsFetchRequested' must be implemented. See: https://github.com/moroshko/react-autosuggest#onSuggestionsFetchRequestedProp")},onSuggestionsClearRequested:function(e,t){var n=e[t];if(!1===e.alwaysRenderSuggestions&&"function"!=typeof n)throw new Error("'onSuggestionsClearRequested' must be implemented. See: https://github.com/moroshko/react-autosuggest#onSuggestionsClearRequestedProp")},onSuggestionSelected:s.default.func,onSuggestionHighlighted:s.default.func,renderInputComponent:s.default.func,renderSuggestionsContainer:s.default.func,getSuggestionValue:s.default.func.isRequired,renderSuggestion:s.default.func.isRequired,inputProps:function(e,t){var n=e[t];if(!n.hasOwnProperty("value"))throw new Error("'inputProps' must have 'value'.");if(!n.hasOwnProperty("onChange"))throw new Error("'inputProps' must have 'onChange'.")},shouldRenderSuggestions:s.default.func,alwaysRenderSuggestions:s.default.bool,multiSection:s.default.bool,renderSectionTitle:function(e,t){var n=e[t];if(!0===e.multiSection&&"function"!=typeof n)throw new Error("'renderSectionTitle' must be implemented. See: https://github.com/moroshko/react-autosuggest#renderSectionTitleProp")},getSectionSuggestions:function(e,t){var n=e[t];if(!0===e.multiSection&&"function"!=typeof n)throw new Error("'getSectionSuggestions' must be implemented. See: https://github.com/moroshko/react-autosuggest#getSectionSuggestionsProp")},focusInputOnSuggestionClick:s.default.bool,highlightFirstSuggestion:s.default.bool,theme:s.default.object,id:s.default.string},d.defaultProps={renderSuggestionsContainer:function(e){var t=e.containerProps,n=e.children;return o.default.createElement("div",t,n)},shouldRenderSuggestions:function(e){return e.trim().length>0},alwaysRenderSuggestions:!1,multiSection:!1,focusInputOnSuggestionClick:!0,highlightFirstSuggestion:!1,theme:u.defaultTheme,id:"1"};var m=function(){var e=this;this.onDocumentMouseDown=function(t){e.justClickedOnSuggestionsContainer=!1;for(var n=t.detail&&t.detail.target||t.target;null!==n&&n!==document;){if(null!==n.getAttribute("data-suggestion-index"))return;if(n===e.suggestionsContainer)return void(e.justClickedOnSuggestionsContainer=!0);n=n.parentNode}},this.storeAutowhateverRef=function(t){null!==t&&(e.autowhatever=t)},this.onSuggestionMouseEnter=function(t,n){var r=n.sectionIndex,i=n.itemIndex;e.updateHighlightedSuggestion(r,i),t.target===e.pressedSuggestion&&(e.justSelectedSuggestion=!0),e.justMouseEntered=!0,setTimeout((function(){e.justMouseEntered=!1}))},this.highlightFirstSuggestion=function(){e.updateHighlightedSuggestion(e.props.multiSection?0:null,0)},this.onDocumentMouseUp=function(){e.pressedSuggestion&&!e.justSelectedSuggestion&&e.input.focus(),e.pressedSuggestion=null},this.onSuggestionMouseDown=function(t){e.justSelectedSuggestion||(e.justSelectedSuggestion=!0,e.pressedSuggestion=t.target)},this.onSuggestionsClearRequested=function(){var t=e.props.onSuggestionsClearRequested;t&&t()},this.onSuggestionSelected=function(t,n){var r=e.props,i=r.alwaysRenderSuggestions,a=r.onSuggestionSelected,o=r.onSuggestionsFetchRequested;a&&a(t,n),i?o({value:n.suggestionValue,reason:"suggestion-selected"}):e.onSuggestionsClearRequested(),e.resetHighlightedSuggestion()},this.onSuggestionClick=function(t){var n=e.props,r=n.alwaysRenderSuggestions,i=n.focusInputOnSuggestionClick,a=e.getSuggestionIndices(e.findSuggestionElement(t.target)),o=a.sectionIndex,s=a.suggestionIndex,c=e.getSuggestion(o,s),l=e.props.getSuggestionValue(c);e.maybeCallOnChange(t,l,"click"),e.onSuggestionSelected(t,{suggestion:c,suggestionValue:l,suggestionIndex:s,sectionIndex:o,method:"click"}),r||e.closeSuggestions(),!0===i?e.input.focus():e.onBlur(),setTimeout((function(){e.justSelectedSuggestion=!1}))},this.onBlur=function(){var t=e.props,n=t.inputProps,r=t.shouldRenderSuggestions,i=n.value,a=n.onBlur,o=e.getHighlightedSuggestion(),s=r(i);e.setState({isFocused:!1,highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null,isCollapsed:!s}),a&&a(e.blurEvent,{highlightedSuggestion:o})},this.onSuggestionMouseLeave=function(t){e.resetHighlightedSuggestion(!1),e.justSelectedSuggestion&&t.target===e.pressedSuggestion&&(e.justSelectedSuggestion=!1)},this.onSuggestionTouchStart=function(){e.justSelectedSuggestion=!0},this.onSuggestionTouchMove=function(){e.justSelectedSuggestion=!1,e.pressedSuggestion=null,e.input.focus()},this.itemProps=function(t){return{"data-section-index":t.sectionIndex,"data-suggestion-index":t.itemIndex,onMouseEnter:e.onSuggestionMouseEnter,onMouseLeave:e.onSuggestionMouseLeave,onMouseDown:e.onSuggestionMouseDown,onTouchStart:e.onSuggestionTouchStart,onTouchMove:e.onSuggestionTouchMove,onClick:e.onSuggestionClick}},this.renderSuggestionsContainer=function(t){var n=t.containerProps,r=t.children;return(0,e.props.renderSuggestionsContainer)({containerProps:n,children:r,query:e.getQuery()})}};t.default=d},function(e,t,n){"use strict";var r=n(169);function i(){}function a(){}a.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,a,o){if(o!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";e.exports=function(e,t){if(e===t)return!0;if(!e||!t)return!1;var n=e.length;if(t.length!==n)return!1;for(var r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}},function(e,t,n){"use strict";e.exports=n(172).default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(0),s=d(o),c=d(n(16)),l=d(n(173)),u=d(n(174)),p=d(n(176)),f=d(n(177));function d(e){return e&&e.__esModule?e:{default:e}}var m={},h=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.storeInputReference=function(e){null!==e&&(n.input=e)},n.storeItemsContainerReference=function(e){null!==e&&(n.itemsContainer=e)},n.onHighlightedItemChange=function(e){n.highlightedItem=e},n.getItemId=function(e,t){return null===t?null:"react-autowhatever-"+n.props.id+"-"+(null===e?"":"section-"+e)+"-item-"+t},n.onFocus=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!0}),t.onFocus&&t.onFocus(e)},n.onBlur=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!1}),t.onBlur&&t.onBlur(e)},n.onKeyDown=function(e){var t=n.props,r=t.inputProps,a=t.highlightedSectionIndex,o=t.highlightedItemIndex;switch(e.key){case"ArrowDown":case"ArrowUp":var s="ArrowDown"===e.key?"next":"prev",c=n.sectionIterator[s]([a,o]),l=i(c,2),u=l[0],p=l[1];r.onKeyDown(e,{newHighlightedSectionIndex:u,newHighlightedItemIndex:p});break;default:r.onKeyDown(e,{highlightedSectionIndex:a,highlightedItemIndex:o})}},n.highlightedItem=null,n.state={isInputFocused:!1},n.setSectionsItems(e),n.setSectionIterator(e),n.setTheme(e),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"componentDidMount",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){e.items!==this.props.items&&this.setSectionsItems(e),e.items===this.props.items&&e.multiSection===this.props.multiSection||this.setSectionIterator(e),e.theme!==this.props.theme&&this.setTheme(e)}},{key:"componentDidUpdate",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"setSectionsItems",value:function(e){e.multiSection&&(this.sectionsItems=e.items.map((function(t){return e.getSectionItems(t)})),this.sectionsLengths=this.sectionsItems.map((function(e){return e.length})),this.allSectionsAreEmpty=this.sectionsLengths.every((function(e){return 0===e})))}},{key:"setSectionIterator",value:function(e){this.sectionIterator=(0,l.default)({multiSection:e.multiSection,data:e.multiSection?this.sectionsLengths:e.items.length})}},{key:"setTheme",value:function(e){this.theme=(0,u.default)(e.theme)}},{key:"renderSections",value:function(){var e=this;if(this.allSectionsAreEmpty)return null;var t=this.theme,n=this.props,r=n.id,i=n.items,a=n.renderItem,o=n.renderItemData,c=n.renderSectionTitle,l=n.highlightedSectionIndex,u=n.highlightedItemIndex,d=n.itemProps;return i.map((function(n,i){var m="react-autowhatever-"+r+"-",h=m+"section-"+i+"-",g=0===i;return s.default.createElement("div",t(h+"container","sectionContainer",g&&"sectionContainerFirst"),s.default.createElement(p.default,{section:n,renderSectionTitle:c,theme:t,sectionKeyPrefix:h}),s.default.createElement(f.default,{items:e.sectionsItems[i],itemProps:d,renderItem:a,renderItemData:o,sectionIndex:i,highlightedItemIndex:l===i?u:null,onHighlightedItemChange:e.onHighlightedItemChange,getItemId:e.getItemId,theme:t,keyPrefix:m,ref:e.storeItemsListReference}))}))}},{key:"renderItems",value:function(){var e=this.props.items;if(0===e.length)return null;var t=this.theme,n=this.props,r=n.id,i=n.renderItem,a=n.renderItemData,o=n.highlightedSectionIndex,c=n.highlightedItemIndex,l=n.itemProps;return s.default.createElement(f.default,{items:e,itemProps:l,renderItem:i,renderItemData:a,highlightedItemIndex:null===o?c:null,onHighlightedItemChange:this.onHighlightedItemChange,getItemId:this.getItemId,theme:t,keyPrefix:"react-autowhatever-"+r+"-"})}},{key:"ensureHighlightedItemIsVisible",value:function(){var e=this.highlightedItem;if(e){var t=this.itemsContainer,n=e.offsetParent===t?e.offsetTop:e.offsetTop-t.offsetTop,r=t.scrollTop;n<r?r=n:n+e.offsetHeight>r+t.offsetHeight&&(r=n+e.offsetHeight-t.offsetHeight),r!==t.scrollTop&&(t.scrollTop=r)}}},{key:"render",value:function(){var e=this.theme,t=this.props,n=t.id,i=t.multiSection,a=t.renderInputComponent,o=t.renderItemsContainer,c=t.highlightedSectionIndex,l=t.highlightedItemIndex,u=this.state.isInputFocused,p=i?this.renderSections():this.renderItems(),f=null!==p,d=this.getItemId(c,l),m="react-autowhatever-"+n,h=r({role:"combobox","aria-haspopup":"listbox","aria-owns":m,"aria-expanded":f},e("react-autowhatever-"+n+"-container","container",f&&"containerOpen"),this.props.containerProps),g=a(r({type:"text",value:"",autoComplete:"off","aria-autocomplete":"list","aria-controls":m,"aria-activedescendant":d},e("react-autowhatever-"+n+"-input","input",f&&"inputOpen",u&&"inputFocused"),this.props.inputProps,{onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.props.inputProps.onKeyDown&&this.onKeyDown,ref:this.storeInputReference})),y=o({containerProps:r({id:m,role:"listbox"},e("react-autowhatever-"+n+"-items-container","itemsContainer",f&&"itemsContainerOpen"),{ref:this.storeItemsContainerReference}),children:p});return s.default.createElement("div",h,g,y)}}]),t}(o.Component);h.propTypes={id:c.default.string,multiSection:c.default.bool,renderInputComponent:c.default.func,renderItemsContainer:c.default.func,items:c.default.array.isRequired,renderItem:c.default.func,renderItemData:c.default.object,renderSectionTitle:c.default.func,getSectionItems:c.default.func,containerProps:c.default.object,inputProps:c.default.object,itemProps:c.default.oneOfType([c.default.object,c.default.func]),highlightedSectionIndex:c.default.number,highlightedItemIndex:c.default.number,theme:c.default.oneOfType([c.default.object,c.default.array])},h.defaultProps={id:"1",multiSection:!1,renderInputComponent:function(e){return s.default.createElement("input",e)},renderItemsContainer:function(e){var t=e.containerProps,n=e.children;return s.default.createElement("div",t,n)},renderItem:function(){throw new Error("`renderItem` must be provided")},renderItemData:m,renderSectionTitle:function(){throw new Error("`renderSectionTitle` must be provided")},getSectionItems:function(){throw new Error("`getSectionItems` must be provided")},containerProps:m,inputProps:m,itemProps:m,highlightedSectionIndex:null,highlightedItemIndex:null,theme:{container:"react-autowhatever__container",containerOpen:"react-autowhatever__container--open",input:"react-autowhatever__input",inputOpen:"react-autowhatever__input--open",inputFocused:"react-autowhatever__input--focused",itemsContainer:"react-autowhatever__items-container",itemsContainerOpen:"react-autowhatever__items-container--open",itemsList:"react-autowhatever__items-list",item:"react-autowhatever__item",itemFirst:"react-autowhatever__item--first",itemHighlighted:"react-autowhatever__item--highlighted",sectionContainer:"react-autowhatever__section-container",sectionContainerFirst:"react-autowhatever__section-container--first",sectionTitle:"react-autowhatever__section-title"}},t.default=h},function(e,t,n){"use strict";var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};e.exports=function(e){var t=e.data,n=e.multiSection;function i(e){var i=r(e,2),a=i[0],o=i[1];return n?null===o||o===t[a]-1?null===(a=function(e){for(null===e?e=0:e++;e<t.length&&0===t[e];)e++;return e===t.length?null:e}(a))?[null,null]:[a,0]:[a,o+1]:0===t||o===t-1?[null,null]:null===o?[null,0]:[null,o+1]}return{next:i,prev:function(e){var i=r(e,2),a=i[0],o=i[1];return n?null===o||0===o?null===(a=function(e){for(null===e?e=t.length-1:e--;e>=0&&0===t[e];)e--;return-1===e?null:e}(a))?[null,null]:[a,t[a]-1]:[a,o-1]:0===t||0===o?[null,null]:null===o?[null,t-1]:[null,o-1]},isLast:function(e){return null===i(e)[1]}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var a,o=n(175),s=(a=o)&&a.__esModule?a:{default:a},c=function(e){return e};t.default=function(e){var t=Array.isArray(e)&&2===e.length?e:[e,null],n=r(t,2),a=n[0],o=n[1];return function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var l=n.map((function(e){return a[e]})).filter(c);return"string"==typeof l[0]||"function"==typeof o?{key:e,className:o?o.apply(void 0,i(l)):l.join(" ")}:{key:e,style:s.default.apply(void 0,[{}].concat(i(l)))}}},e.exports=t.default},function(e,t,n){"use strict";var r=Object.prototype.propertyIsEnumerable;function i(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function a(e){var t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e))),t.filter((function(t){return r.call(e,t)}))}e.exports=Object.assign||function(e,t){for(var n,r,o=i(e),s=1;s<arguments.length;s++){n=arguments[s],r=a(Object(n));for(var c=0;c<r.length;c++)o[r[c]]=n[r[c]]}return o}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=c(i),o=c(n(16)),s=c(n(27));function c(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var p=function(e){function t(){return l(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"shouldComponentUpdate",value:function(e){return(0,s.default)(e,this.props)}},{key:"render",value:function(){var e=this.props,t=e.section,n=e.renderSectionTitle,r=e.theme,i=e.sectionKeyPrefix,o=n(t);return o?a.default.createElement("div",r(i+"title","sectionTitle"),o):null}}]),t}(i.Component);p.propTypes={section:o.default.any.isRequired,renderSectionTitle:o.default.func.isRequired,theme:o.default.func.isRequired,sectionKeyPrefix:o.default.string.isRequired},t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),o=u(a),s=u(n(16)),c=u(n(178)),l=u(n(27));function u(e){return e&&e.__esModule?e:{default:e}}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var d=function(e){function t(){var e,n,r;p(this,t);for(var i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=r=f(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.storeHighlightedItemReference=function(e){r.props.onHighlightedItemChange(null===e?null:e.item)},f(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"shouldComponentUpdate",value:function(e){return(0,l.default)(e,this.props,["itemProps"])}},{key:"render",value:function(){var e=this,t=this.props,n=t.items,i=t.itemProps,a=t.renderItem,s=t.renderItemData,l=t.sectionIndex,u=t.highlightedItemIndex,p=t.getItemId,f=t.theme,d=t.keyPrefix,m=null===l?d:d+"section-"+l+"-",h="function"==typeof i;return o.default.createElement("ul",r({role:"listbox"},f(m+"items-list","itemsList")),n.map((function(t,n){var d=0===n,g=n===u,y=m+"item-"+n,v=h?i({sectionIndex:l,itemIndex:n}):i,b=r({id:p(l,n),"aria-selected":g},f(y,"item",d&&"itemFirst",g&&"itemHighlighted"),v);return g&&(b.ref=e.storeHighlightedItemReference),o.default.createElement(c.default,r({},b,{sectionIndex:l,isHighlighted:g,itemIndex:n,item:t,renderItem:a,renderItemData:s}))})))}}]),t}(a.Component);d.propTypes={items:s.default.array.isRequired,itemProps:s.default.oneOfType([s.default.object,s.default.func]),renderItem:s.default.func.isRequired,renderItemData:s.default.object.isRequired,sectionIndex:s.default.number,highlightedItemIndex:s.default.number,onHighlightedItemChange:s.default.func.isRequired,getItemId:s.default.func.isRequired,theme:s.default.func.isRequired,keyPrefix:s.default.string.isRequired},d.defaultProps={sectionIndex:null},t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),o=l(a),s=l(n(16)),c=l(n(27));function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var f=function(e){function t(){var e,n,r;u(this,t);for(var i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=r=p(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.storeItemReference=function(e){null!==e&&(r.item=e)},r.onMouseEnter=function(e){var t=r.props,n=t.sectionIndex,i=t.itemIndex;r.props.onMouseEnter(e,{sectionIndex:n,itemIndex:i})},r.onMouseLeave=function(e){var t=r.props,n=t.sectionIndex,i=t.itemIndex;r.props.onMouseLeave(e,{sectionIndex:n,itemIndex:i})},r.onMouseDown=function(e){var t=r.props,n=t.sectionIndex,i=t.itemIndex;r.props.onMouseDown(e,{sectionIndex:n,itemIndex:i})},r.onClick=function(e){var t=r.props,n=t.sectionIndex,i=t.itemIndex;r.props.onClick(e,{sectionIndex:n,itemIndex:i})},p(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"shouldComponentUpdate",value:function(e){return(0,c.default)(e,this.props,["renderItemData"])}},{key:"render",value:function(){var e=this.props,t=e.isHighlighted,n=e.item,i=e.renderItem,a=e.renderItemData,s=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["isHighlighted","item","renderItem","renderItemData"]);return delete s.sectionIndex,delete s.itemIndex,"function"==typeof s.onMouseEnter&&(s.onMouseEnter=this.onMouseEnter),"function"==typeof s.onMouseLeave&&(s.onMouseLeave=this.onMouseLeave),"function"==typeof s.onMouseDown&&(s.onMouseDown=this.onMouseDown),"function"==typeof s.onClick&&(s.onClick=this.onClick),o.default.createElement("li",r({role:"option"},s,{ref:this.storeItemReference}),i(n,r({isHighlighted:t},a)))}}]),t}(a.Component);f.propTypes={sectionIndex:s.default.number,isHighlighted:s.default.bool.isRequired,itemIndex:s.default.number.isRequired,item:s.default.any.isRequired,renderItem:s.default.func.isRequired,renderItemData:s.default.object.isRequired,onMouseEnter:s.default.func,onMouseLeave:s.default.func,onMouseDown:s.default.func,onClick:s.default.func},t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.defaultTheme={container:"react-autosuggest__container",containerOpen:"react-autosuggest__container--open",input:"react-autosuggest__input",inputOpen:"react-autosuggest__input--open",inputFocused:"react-autosuggest__input--focused",suggestionsContainer:"react-autosuggest__suggestions-container",suggestionsContainerOpen:"react-autosuggest__suggestions-container--open",suggestionsList:"react-autosuggest__suggestions-list",suggestion:"react-autosuggest__suggestion",suggestionFirst:"react-autosuggest__suggestion--first",suggestionHighlighted:"react-autosuggest__suggestion--highlighted",sectionContainer:"react-autosuggest__section-container",sectionContainerFirst:"react-autosuggest__section-container--first",sectionTitle:"react-autosuggest__section-title"},t.mapToAutowhateverTheme=function(e){var t={};for(var n in e)switch(n){case"suggestionsContainer":t.itemsContainer=e[n];break;case"suggestionsContainerOpen":t.itemsContainerOpen=e[n];break;case"suggestion":t.item=e[n];break;case"suggestionFirst":t.itemFirst=e[n];break;case"suggestionHighlighted":t.itemHighlighted=e[n];break;case"suggestionsList":t.itemsList=e[n];break;default:t[n]=e[n]}return t}},function(e,t,n){const{defaults:r}=n(17),{block:i}=n(117),{rtrim:a,splitCells:o,escape:s}=n(13);e.exports=class e{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||r,this.rules=i.normal,this.options.pedantic?this.rules=i.pedantic:this.options.gfm&&(this.rules=i.gfm)}static get rules(){return i}static lex(t,n){return new e(n).lex(t)}lex(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.token(e,!0)}token(e,t){let n,r,c,l,u,p,f,d,m,h,g,y,v,b,S,E;for(e=e.replace(/^ +$/gm,"");e;)if((c=this.rules.newline.exec(e))&&(e=e.substring(c[0].length),c[0].length>1&&this.tokens.push({type:"space"})),c=this.rules.code.exec(e)){const t=this.tokens[this.tokens.length-1];e=e.substring(c[0].length),t&&"paragraph"===t.type?t.text+="\n"+c[0].trimRight():(c=c[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",codeBlockStyle:"indented",text:this.options.pedantic?c:a(c,"\n")}))}else if(c=this.rules.fences.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"code",lang:c[2]?c[2].trim():c[2],text:c[3]||""});else if(c=this.rules.heading.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"heading",depth:c[1].length,text:c[2]});else if((c=this.rules.nptable.exec(e))&&(p={type:"table",header:o(c[1].replace(/^ *| *\| *$/g,"")),align:c[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:c[3]?c[3].replace(/\n$/,"").split("\n"):[]},p.header.length===p.align.length)){for(e=e.substring(c[0].length),g=0;g<p.align.length;g++)/^ *-+: *$/.test(p.align[g])?p.align[g]="right":/^ *:-+: *$/.test(p.align[g])?p.align[g]="center":/^ *:-+ *$/.test(p.align[g])?p.align[g]="left":p.align[g]=null;for(g=0;g<p.cells.length;g++)p.cells[g]=o(p.cells[g],p.header.length);this.tokens.push(p)}else if(c=this.rules.hr.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"hr"});else if(c=this.rules.blockquote.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"blockquote_start"}),c=c[0].replace(/^ *> ?/gm,""),this.token(c,t),this.tokens.push({type:"blockquote_end"});else if(c=this.rules.list.exec(e)){for(e=e.substring(c[0].length),l=c[2],b=l.length>1,f={type:"list_start",ordered:b,start:b?+l:"",loose:!1},this.tokens.push(f),c=c[0].match(this.rules.item),d=[],n=!1,v=c.length,g=0;g<v;g++)p=c[g],h=p.length,p=p.replace(/^ *([*+-]|\d+\.) */,""),~p.indexOf("\n ")&&(h-=p.length,p=this.options.pedantic?p.replace(/^ {1,4}/gm,""):p.replace(new RegExp("^ {1,"+h+"}","gm"),"")),g!==v-1&&(u=i.bullet.exec(c[g+1])[0],(l.length>1?1===u.length:u.length>1||this.options.smartLists&&u!==l)&&(e=c.slice(g+1).join("\n")+e,g=v-1)),r=n||/\n\n(?!\s*$)/.test(p),g!==v-1&&(n="\n"===p.charAt(p.length-1),r||(r=n)),r&&(f.loose=!0),S=/^\[[ xX]\] /.test(p),E=void 0,S&&(E=" "!==p[1],p=p.replace(/^\[[ xX]\] +/,"")),m={type:"list_item_start",task:S,checked:E,loose:r},d.push(m),this.tokens.push(m),this.token(p,!1),this.tokens.push({type:"list_item_end"});if(f.loose)for(v=d.length,g=0;g<v;g++)d[g].loose=!0;this.tokens.push({type:"list_end"})}else if(c=this.rules.html.exec(e))e=e.substring(c[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===c[1]||"script"===c[1]||"style"===c[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(c[0]):s(c[0]):c[0]});else if(t&&(c=this.rules.def.exec(e)))e=e.substring(c[0].length),c[3]&&(c[3]=c[3].substring(1,c[3].length-1)),y=c[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[y]||(this.tokens.links[y]={href:c[2],title:c[3]});else if((c=this.rules.table.exec(e))&&(p={type:"table",header:o(c[1].replace(/^ *| *\| *$/g,"")),align:c[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:c[3]?c[3].replace(/\n$/,"").split("\n"):[]},p.header.length===p.align.length)){for(e=e.substring(c[0].length),g=0;g<p.align.length;g++)/^ *-+: *$/.test(p.align[g])?p.align[g]="right":/^ *:-+: *$/.test(p.align[g])?p.align[g]="center":/^ *:-+ *$/.test(p.align[g])?p.align[g]="left":p.align[g]=null;for(g=0;g<p.cells.length;g++)p.cells[g]=o(p.cells[g].replace(/^ *\| *| *\| *$/g,""),p.header.length);this.tokens.push(p)}else if(c=this.rules.lheading.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"heading",depth:"="===c[2].charAt(0)?1:2,text:c[1]});else if(t&&(c=this.rules.paragraph.exec(e)))e=e.substring(c[0].length),this.tokens.push({type:"paragraph",text:"\n"===c[1].charAt(c[1].length-1)?c[1].slice(0,-1):c[1]});else if(c=this.rules.text.exec(e))e=e.substring(c[0].length),this.tokens.push({type:"text",text:c[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens}}},function(e,t,n){const r=n(28),i=n(118),a=n(119),o=n(120),{defaults:s}=n(17),{merge:c,unescape:l}=n(13);e.exports=class e{constructor(e){this.tokens=[],this.token=null,this.options=e||s,this.options.renderer=this.options.renderer||new r,this.renderer=this.options.renderer,this.renderer.options=this.options,this.slugger=new i}static parse(t,n){return new e(n).parse(t)}parse(e){this.inline=new a(e.links,this.options),this.inlineText=new a(e.links,c({},this.options,{renderer:new o})),this.tokens=e.reverse();let t="";for(;this.next();)t+=this.tok();return t}next(){return this.token=this.tokens.pop(),this.token}peek(){return this.tokens[this.tokens.length-1]||0}parseText(){let e=this.token.text;for(;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)}tok(){let e="";switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,l(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":{let t,n,r,i,a="";for(r="",t=0;t<this.token.header.length;t++)r+=this.renderer.tablecell(this.inline.output(this.token.header[t]),{header:!0,align:this.token.align[t]});for(a+=this.renderer.tablerow(r),t=0;t<this.token.cells.length;t++){for(n=this.token.cells[t],r="",i=0;i<n.length;i++)r+=this.renderer.tablecell(this.inline.output(n[i]),{header:!1,align:this.token.align[i]});e+=this.renderer.tablerow(r)}return this.renderer.table(a,e)}case"blockquote_start":for(e="";"blockquote_end"!==this.next().type;)e+=this.tok();return this.renderer.blockquote(e);case"list_start":{e="";const t=this.token.ordered,n=this.token.start;for(;"list_end"!==this.next().type;)e+=this.tok();return this.renderer.list(e,t,n)}case"list_item_start":{e="";const t=this.token.loose,n=this.token.checked,r=this.token.task;if(this.token.task)if(t)if("text"===this.peek().type){const e=this.peek();e.text=this.renderer.checkbox(n)+" "+e.text}else this.tokens.push({type:"text",text:this.renderer.checkbox(n)});else e+=this.renderer.checkbox(n);for(;"list_item_end"!==this.next().type;)e+=t||"text"!==this.token.type?this.tok():this.parseText();return this.renderer.listitem(e,r,n)}case"html":return this.renderer.html(this.token.text);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText());default:{const e='Token with "'+this.token.type+'" type was not found.';if(!this.options.silent)throw new Error(e);console.log(e)}}}}},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"AppLinkHelper",(function(){return j})),n.d(r,"AppLinkUtility",(function(){return O})),n.d(r,"Application",(function(){return P})),n.d(r,"AppRouter",(function(){return F})),n.d(r,"Behavior",(function(){return M})),n.d(r,"Collection",(function(){return U})),n.d(r,"CollectionView",(function(){return V})),n.d(r,"ComponentCollection",(function(){return V})),n.d(r,"Error",(function(){return L})),n.d(r,"ErrorHelper",(function(){return x})),n.d(r,"SilentError",(function(){return k})),n.d(r,"LayoutView",(function(){return J})),n.d(r,"NestedModel",(function(){return Y})),n.d(r,"Service",(function(){return G})),n.d(r,"Model",(function(){return K})),n.d(r,"View",(function(){return H})),n.d(r,"Component",(function(){return q})),n.d(r,"EventNames",(function(){return g})),n.d(r,"LayoutService",(function(){return W})),n.d(r,"Middleware",(function(){return N})),n.d(r,"LocationUtils",(function(){return v})),n.d(r,"Shell",(function(){return Q}));var i={};n.r(i),n.d(i,"emptyResponse",(function(){return Ot})),n.d(i,"getResponse",(function(){return It})),n.d(i,"getFetch",(function(){return jt})),n.d(i,"fetch",(function(){return At})),n.d(i,"useGetFetch",(function(){return Tt})),n.d(i,"useGetResponse",(function(){return wt})),n.d(i,"useBasicFetch",(function(){return Lt})),n.d(i,"createMiddleware",(function(){return Nt})),n.d(i,"FlightReducer",(function(){return Ft})),n.d(i,"Simulator",(function(){return zt})),n.d(i,"Actions",(function(){return et})),n.d(i,"RequestStatus",(function(){return tt})),n.d(i,"ajaxRequest",(function(){return at})),n.d(i,"normalize",(function(){return ut})),n.d(i,"denormalize",(function(){return dt}));n(130),n(131),n(132),n(133),n(134),n(135),n(136),n(137),n(138),n(139),n(140),n(141),n(142),n(143),n(144),n(145),n(146),n(147),n(148),n(149),n(150),n(151),n(152),n(153),n(154),n(155),n(156),n(157),n(158),n(159),n(160),n(161);var a={UPLOAD_IMAGE:"upload:image"},o={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"},a),Playlists:Object.assign({PLAYLISTS:"index",SEARCH_PLAYLISTS:"search:playlists",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"},a),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",LEGACY_EDIT_SERIES:"legacy:edit:series"},a),Videos:Object.assign({EDIT_VIDEO:"edit:video",EDIT_VIDEO_AUDIENCES:"edit:video:audiences",EDIT_VIDEO_SUBJECTS:"edit:video:subjects",EDIT_VIDEO_ALIASES:"edit:video:aliases",LEGACY_EDIT_VIDEO:"legacy:edit:video"},a),DomainOptions:{DOMAIN_OPTIONS:"domain:options",NEW_DOMAIN_OPTION:"new:domain:option",EDIT_DOMAIN_OPTION:"edit:domain:option",DELETE_DOMAIN_OPTION:"delete:domain:option"},People:{PEOPLE:"people",NEW_PERSON:"new:person",EDIT_PERSON:"edit:person"},Companies:{COMPANIES:"companies",NEW_COMPANY:"new:company",EDIT_COMPANY:"edit:company"},Themes:Object.assign({THEMES:"themes",NEW_THEME:"new:theme",EDIT_THEME:"edit:theme",DELETE_THEME:"delete:theme"},a)},s={SUBJECT:"subject",SUBJECTS:"subjects",UPDATE_SUBJECT:"update:subject",DELETE_SUBJECT:"delete:subject",UPDATE_OBJECT_SUBJECTS:"update:object:subjects",ADD_TO_SUBJECT:"add:to:subject",REMOVE_FROM_SUBJECT:"remove:from:subject",CLASSIFICATION:"classification",CLASSIFICATIONS:"classifications",UPDATE_CLASSIFICATION:"update:classification",DELETE_CLASSIFICATION:"delete:classification",UPDATE_OBJECT_CLASSIFICATIONS:"update:object:classifications",ADD_TO_CLASSIFICATION:"add:to:classification",REMOVE_FROM_CLASSIFICATION:"remove:from:classification",PRESENTATION:"presentation",PRESENTATIONS:"presentations",UPDATE_PRESENTATION:"update:presentation",LEVEL:"level",LEVELS:"levels",UPDATE_LEVEL:"update:level",ADD_TO_LEVEL:"add:to:level",REMOVE_FROM_LEVEL:"remove:from:level",UPDATE_OBJECT_LEVELS:"update:object:levels",AUDIENCE:"audience",AUDIENCES:"audiences",UPDATE_AUDIENCE:"update:audience",DELETE_AUDIENCE:"delete:audience",UPDATE_OBJECT_AUDIENCES:"update:object:audiences",PLAYLIST:"playlist",PLAYLISTS:"playlists",UPDATE_PLAYLIST:"update:playlist",DELETE_PLAYLIST:"delete:playlist",PLAYLIST_VIDEOS:"playlist:videos",REORDER_PLAYLIST_VIDEOS:"reorder:playlist:videos",REMOVE_PLAYLIST_VIDEO:"remove:playlist:video",VIDEO:"video",SERIES:"series",SERIES_BY_ID:"series:by:id",UPDATE_SERIES:"update:series",CURRENT_USER:"current:user",UPLOAD_IMAGE:"upload:image",LOCALE:"locale",PHRASES:"PHRASES"},c={IMAGES:".".concat(["jpg","tif","png","bmp","gif","jpeg"].join(",."))},l={CURATOR_LAYOUT:"CuratorLayout"},u={COMPANIES:"companies:application",DOMAIN_OPTIONS:"domain:options:application",PEOPLE:"people:application",PLAYLISTS:"playlists:application",SERIES:"series:application",SUBJECTS:"subjects:application",THEMES:"themes:application",VIDEOS:"videos:application"},p={IMAGE_UPLOAD:"image:upload:data:service",SUBJECT:"subject:data:service",LANGUAGE:"language:data:service"},f={IMAGE_UPLOAD:"ImageUploadDataService",SUBJECT:"SubjectDataService",LANGUAGE:"LanguageDataService"},d=n(0),m=n(1),h=n(4);const g={SHOW_POPUP:"show:popup",ROUTE:"route",LOCK_NAV:"lock:nav",UNLOCK_NAV:"unlock:nav",NAV_IS_LOCKED:"navigation:islocked",NAV_UNLOCKED_BY_USER:"navigation:unlocked:by:user",ROUTING_START:"routing:start",ROUTING_END:"routing:end",HAS_ACTIVE_ROUTE:"has:active:route",ROUTE_LOOKUP:"route:look:up",URL_CHANGE:"url:change",ERROR:"error",CURRENT_ROUTE:"route:current"},y={SHELL:"global:shell",ALERT:"global:alert",POPUP:"global:popup"},v={GetQuery:()=>v.DeserializeQueryParams(window.location.search.substring(1)),UpdateQuery(e){if(!e)return;const t=v.GetQuery();let n=v.SerializeQueryParams(m.extend(t,e));n&&(n="?"+n),v.UpdateUrl(`${v.GetCurrentPath()}${n}`,null,{replace:!0,trigger:!1})},UpdateUrl(e,t,n){const r=j.buildRoute(e,t);h.history.navigate(r,n),h.Radio.channel(y.SHELL).trigger(g.URL_CHANGE,t,n)},SerializeQueryParams:e=>e?"string"==typeof e?e:$.param(e,!0):"",DeserializeQueryParams:e=>e?m.reduce(e.split("&"),(e,t)=>{const n=t.split("="),r=n[0],i=n.length>0?decodeURIComponent(n[1]):"";return e[r]?e[r]instanceof Array?(e[r].push(i),e):(e[r]=[e[r],i],e):(e[r]=i,e)},{}):{},StartHistory(){h.History.started&&h.history.stop(),h.history.start({pushState:!0})},PageLoad(e,t=!1){t?window.open(e,"_blank"):window.location.href=e},Redirect(e,t=!0){const n=()=>t?window.location.replace(e):window.location.href=e;O.hasActiveRoute()?h.Radio.channel(y.SHELL).once("routing:end",n):n()},Reload(e=!0){window.location.reload(e)},GetCurrentPath:()=>window.location.pathname,GetCurrentQueryString:()=>window.location.search,GetCurrentUrl:()=>window.location.href,GetCurrentReferrer:()=>document.referrer,SetPageTitle(e){document.title=e}},b=/((\(\?)?:\w+)|(\*\w+)/,S=/[\(\)]/g,E=/\(\/\)/g,C=/\/$/,O={routingStarted(){h.Radio.channel(y.SHELL).trigger(g.ROUTING_START)},routingEnded(){if(!O.hasActiveRoute())return;h.Radio.channel(y.SHELL).trigger(g.ROUTING_END)},hasActiveRoute:()=>h.Radio.channel(y.SHELL).request(g.HAS_ACTIVE_ROUTE)},I=(e,t={})=>{t.usedHelper=!0;const{application:n,action:r}=e;h.Radio.channel(n).trigger(r,e,t)},j={getHref(e){if(!e)return"";const{application:t,action:n,args:r,params:i}=e;return"/"+h.Radio.channel(y.SHELL).request(g.ROUTE_LOOKUP,`${t}:${n}`,r,i)},buildRoute(e,t){if(!t)return e;let n=t.args,r=t.params;if(m.each(n,t=>{e=e.replace(b,t||"")}),e=(e=(e=e.replace(E,"")).replace(S,"")).replace(C,""),!r)return e;const i=v.SerializeQueryParams(r);return i.length?`${e}?${i}`:e},trigger(e,t){if(!e)return;if(!O.hasActiveRoute())return void I(e,t);h.Radio.channel(y.SHELL).once("routing:end",()=>{I(e,t)})},getCurrentAppLink:()=>h.Radio.channel(y.SHELL).request(g.CURRENT_ROUTE)};var A=n(7);function T(e,t,n,r){let i=e;return"string"==typeof e&&(i=h.Radio.channel(e)),r.call(this,i,t,n)}const w=class{constructor(){this.variables={}}static get Instance(){return this.instance||(this.instance=new this)}get name(){return"EnvironmentVariables"}get isDevelopment(){return this.variables.isDevelopment}get(e){return this.variables[e]}setUpVariables(e){this.variables=e}}.Instance;class L extends Error{constructor(e){super(e)}}class k extends L{get name(){return"SilentError"}}class _ extends Error{get name(){return"CoreError"}}const x={throw(e){if(h.Radio.channel(y.SHELL).trigger(g.ERROR,e),!(e instanceof k||w.isDevelopment))throw e}};class P extends A.Application{constructor(e){super(e),this.mergeOptions(e,[...this.defaultProps,...this.props||[]]),m.result(this,"name")||x.throw(new _("BaseApplication must define a name")),m.result(this,"channelName")||x.throw(new _("BaseApplication must define a channelName")),this.listenTo(this.getGlobalRadioChannel("popup"),g.SHOW_POPUP,this.onShowPopup),this.listenTo(this.getGlobalRadioChannel("alert"),"show:alert",this.onShowAlert)}get defaultProps(){return["shell","layoutService"]}getGlobalRadioChannel(e){const t=this.shell.getGlobalRadioChannels()[e.toUpperCase()];return t||x.throw(new _(`Global channel ${t} does not exist`)),h.Radio.channel(t)}onLoadLayout(){if(this.layoutOptions&&this.layoutOptions.name){var e=m.extend({},this.layoutOptions.options||{},{store:this.shell.store});this.layout=this.layoutService.getLayout(m.extend(this.layoutOptions,{options:e})),this.layout||x.throw(new _(`Layout: ${this.layoutOptions.name} does not exist or was not registered`)),this.shell.showView(this.layout),this.triggerMethod("layout:loaded")}}onShowPopup(e){this.layout.getRegion("popup")||x.throw(new _("Your application layout must define a popup region")),this.layout.showChildView("popup",e)}onShowAlert(e){const{ctor:t,collection:n}=e,r=this.layout.getRegion("alert");r||x.throw(new _("Your application layout must define an alert region")),r.hasView()||this.layout.showChildView("alert",new t({collection:n}))}setDefaultQueryParams(e){this.defaultQueryParams&&(e=m.extend(this.defaultQueryParams,e)),this.defaultQueryParams=e}getAndClearDefaultQueryParams(){const e=this.defaultQueryParams;return delete this.defaultQueryParams,e||{}}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class N{use(e){var t;this.go=(t=this.go,(n,r)=>t(n,()=>e(n,r)))}go(e,t){t(e)}}const D=/([A-Z])/g,R=/(^|:)(\w)/gi;class F extends A.AppRouter{constructor(e){super(e),this.bindDisposal(),this.processInternalRoutes(),this.processExternalRoutes(),this.processAppLinks()}bindDisposal(){this.listenTo(y.SHELL,g.ROUTE,e=>{e.application!==this.channelName&&this.destroyApp()})}addRouteLookup(e,t){this.options.shell.addRouteLookup(`${this.channelName}:${e}`,(n,r)=>j.buildRoute(t,{application:this.channelName,action:e,args:n,params:r}))}processInternalRoutes(){m.each(m.keys(this.appRoutes),e=>{const t=this.appRoutes[e],n=this.toEventName(t);this.addRouteLookup(n,e),this.listenTo(this.channelName,n,(t,n)=>{n&&n.usedHelper||x.throw(new _("Please use Core.AppLinkHelper.trigger({}) to trigger appLinks.")),this.executeRoute(t,{isAppRoute:!0},()=>{const r=m.extend({},this.controller.getAndClearDefaultQueryParams(),t.params);t.params=r,v.UpdateUrl(e,t,n)})})})}processExternalRoutes(){this.externalRoutes&&m.each(m.keys(this.externalRoutes),e=>{const t=this.externalRoutes[e],n=this.toEventName(t);this.addRouteLookup(n,e),this.listenTo(this.channelName,n,(e,t)=>{t&&t.usedHelper||x.throw(new _("Please use Core.AppLinkHelper.trigger({}) to trigger appLinks.")),v.PageLoad(j.getHref(e))})})}processAppLinks(){this.appLinks&&m.each(this.appLinks,e=>{const t=this.toEventName(e);this.listenTo(this.channelName,t,(e,t)=>{t&&t.usedHelper||x.throw(new _("Please use Core.AppLinkHelper.trigger({}) to trigger appLinks.")),this.executeRoute(e,{isAppRoute:!1})})})}executeRoute(e,t,n){this.validateAppLink(e);const r=this.toMethodName(e.action);O.routingStarted();const i=h.Radio.channel(y.SHELL);if(this.options.shell.isNavLocked())return i.trigger(g.NAV_IS_LOCKED,e),void O.routingEnded();const a=new N;m.each(this.filters,e=>a.use(e)),a.go(e,()=>{i.trigger(g.ROUTE,e,t),this.createApp();const a=this.controller;if(m.isFunction(a[r])||(O.routingEnded(),x.throw(new _(`${r} does not exist on the ${m.result(a,"name")}.`))),!1===a.triggerMethod("before:action"))return a.triggerMethod("action:cancelled"),void O.routingEnded();a.triggerMethod("load:layout"),a[r].apply(a,[...e.args||[],e.params||{}]),m.isFunction(n)&&n(),O.routingEnded()})}createApp(){this.controller||(this.controller=new this.options.appConstructor(this.options.appOptions),this.controller.start())}destroyApp(){if(!this.controller)return;this.controller.destroy(),delete this.controller}_addAppRoute(e,t,n){this.route(t,n,(...e)=>{const t={application:this.channelName,action:this.toEventName(n),args:e.slice(0,e.length-1),params:v.DeserializeQueryParams(e[e.length-1])};this.executeRoute(t,{isAppRoute:!0},()=>{v.UpdateQuery(m.extend(this.controller.getAndClearDefaultQueryParams(),t.params))})})}toEventName(e){return e.replace(D,":$1").toLowerCase()}toMethodName(e){const t=e.replace(R,(e,t,n)=>n.toUpperCase());return t[0].toLowerCase()+t.slice(1,t.length)}validateAppLink(e){e.application&&e.action||(O.routingEnded(),x.throw(new _("Invalid AppLink")))}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class M extends A.Behavior{listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class U extends h.Collection{listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class V extends A.CollectionView{constructor(e){super(e),m.result(this,"name")||x.throw(new _(`Error: View with cid:${this.cid} requires a name.`))}serializeModel(){return this.model?this.model.toJSON():{}}serializeCollection(){return this.collection?this.collection.toJSON():[]}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class B extends L{get name(){return"DevError"}}class z extends A.View{constructor(e){super(e);const t=[...this.defaultProps,...this.props||[]];this.mergeOptions(e,t),m.result(this,"name")||x.throw(new _(`Error: View with cid:${this.cid} requires a name.`))}get defaultProps(){return["shell","layoutService"]}_setOptions(e){this.options=m.extend({},m.result(this,"defaults"),e)}_setAttributes(e){w.isDevelopment&&m.extend(e,{"cv-classname":this.name}),this.$el.attr(e)}get ui(){return this.uiStorage||(this.uiStorage=this.elements),this.uiStorage}set ui(e){this.uiStorage=e}get elements(){return null}static AddViewDataExtension(e){z.ViewDataExtensions.push(e)}serializeModel(){return this.model?this.model.toJSON():{}}serializeCollection(){return this.collection?this.collection.toJSON():[]}resetClassName(){this.$el.attr("class",m.result(this,"className"))}serializeData(){const e=super.serializeData(),t=m.result(this,"viewOptions"),n=m.extend({},e,{options:t});return z.ViewDataExtensions.length?m.extend(n,...m.map(z.ViewDataExtensions,e=>e instanceof Function?e(this):e)):n}viewOptions(){return this.options}undelegateAppLinks(){this.$el&&this.$el.off(".appLinks"+this.cid)}renderAppLinks(){let e=this.appLinks;e&&(e=this.normalizeUIKeys(e),this.undelegateAppLinks(),m.each(m.keys(e),t=>{let n=t;const r=e[t],i=j.getHref(r);"[this]"===n&&(n=null);const a=n?this.$el.find(t):this.$el;(a.is("a")||a.is("button"))&&(i&&"/"!==i&&a.attr("href",i),this.delegate("click.appLinks"+this.cid,n,(function(e){e.preventDefault(),j.trigger(r)})))}))}hasPartialLoadingRegions(){const e=this;return void 0!==e._hasPartialLoadingRegions||(e._hasPartialLoadingRegions=m.some(e.regions,e=>m.has(e,"partialLoading"))),e._hasPartialLoadingRegions}renderPartialLoading(e){h.Radio.channel(y.SHELL).trigger("render:partial:loading",this,e)}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}render(){const e=this;if(e._isDestroyed)return this;let t=this.processRequriedResources(!0);return t&&(t=e.triggerMethod("before:render",this)),!1!==t&&(t=!0),t=t&&this.processRequriedResources(!1),!1===t?(e._partialLoadingRendered||!e.hasPartialLoadingRegions()||(e._partialLoadingRendered=!0,e._reInitRegions(),e._renderTemplate(),e.renderPartialLoading()),this):((e._isRendered||e._partialLoadingRendered)&&e._reInitRegions(),this.setTitle(),e._renderTemplate(),e.bindUIElements(),this.renderAppLinks(),e._partialLoadingRendered=!1,e._isRendered=!0,e.triggerMethod("render",this),this)}processRequriedResources(e){return!0}setTitle(){}}z.ViewDataExtensions=[];class H extends z{constructor(e){super(e),this.boundListeners={},this.resourceInstances={}}processRequriedResources(e){const t=m.keys(this.requiredResources);if(!t.length)return!0;const n=this;let r=!0;return m.each(t,t=>{const i=this.requiredResources[t];if(i.beforeOnBeforeRender!==e)return;const a=i.dataServiceName;this.resourceInstances[a]||(this.resourceInstances[a]=i.getInstance(this)),this.boundListeners[`${a}:${i.eventName}`]||(this.listenTo(this.resourceInstances[a].channelName,i.eventName,this.render),this.boundListeners[`${a}:${i.eventName}`]=!0),n[t]=i.getData(this.resourceInstances[a]),r=r&&!!n[t]}),r}setTitle(){m.isString(this.title)||!1===this.title||x.throw(new B(`Must define a title for ${this.name}.`));h.Radio.channel(y.SHELL).trigger("set:page:title",this.title)}}class q extends z{}class J extends H{constructor(e){super(e)}static getCacheKey(e){x.throw(new B(`Must define getCacheKey for ${this.name}.`))}unmountRegion(e){this.trigger("unmount:"+e)}}class K extends h.Model{mixin(e){const t=this;for(let n in e){if(t.hasOwnProperty(n)){const r=t[n];return void(t[n]=m.extend({},r,e[n]))}t[n]=e[n]}}addValidation(e){this.mixin({validation:e})}validate(e,t){super.validate.call(this,e,t)}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class Y extends K{set(e,t,n){let r,i;if(null===e)return this;for(r in"object"==typeof e?(i=e,n=t):(i={},i[e]=t),n||(n={}),i)m.has(this.associations,r)&&(i[r]=this.setAssociation(r,i[r],n));return super.set.call(this,i,n)}get(e){var t=e.indexOf(".");if(-1===t)return super.get.call(this,e);const n=e.substr(0,t),r=this.attributes[n];if(!r||!m.isFunction(r.get))return super.get.call(this,e);const i=e.substr(t+1);return r.get(i)}setAssociation(e,t,n){const r=this.associations[e],i=this.attributes[e];if(!m.isFunction(r))return t;if(n.unset)return i&&delete i.parent,delete this[e],i;if(i)return i instanceof K&&i.set(t,n),i instanceof U&&i.set(t,n),n.silent||this.trigger("change:"+e,this,t,n),i;const a=t instanceof K?t:new r(t,{parse:!0});return a.parent=this,this[e]=a,a}toJSON(...e){const t=super.toJSON.apply(this,e);return m.each(this.associations,(e,n)=>{m.has(t,n)&&m.isFunction(t[n].toJSON)?t[n]=t[n].toJSON():t[n]=(new e).toJSON()}),t}toFlatJSON(...e){return m.omit(super.toJSON.apply(this,e),m.keys(this.associations))}}class G extends A.Object{constructor(e){super(e),this.name||x.throw(new _("Your service must be named."))}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class W extends A.Object{constructor(e){super(e),this.layouts={},this.requiredRegions=e.requiredRegions}clearLayout(){this.currentLayout&&(this.currentLayout.destroy(),delete this.currentLayout,delete this.currentLayoutCacheKey)}registerLayout(e,t){return this.checkRequiredRegions(t),this.layouts[e]=t,this}getLayout(e){const{name:t,options:n={}}=e;this.layouts[t]||x.throw(new _(t+" was not registered as a template."));const r=this.layouts[t].getCacheKey(n);return this.currentLayoutCacheKey===r&&this.currentLayout?(this.currentLayout.triggerMethod("layout:requested",n),this.currentLayout):(this.clearLayout(),this.currentLayoutCacheKey=r,this.currentLayout=new this.layouts[t](n),this.listenToOnce(this.currentLayout,"destroy",this.clearLayout),this.currentLayout)}checkRequiredRegions(e){m.each(this.requiredRegions,t=>{m.has(m.result(e.prototype,"regions"),t)||x.throw(new _(`Layout: ${e.prototype.name} must define an ${t} region.`))})}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}class Z{constructor(e,t){this.application=e,this.options=t||{}}get Application(){return this.application}get Options(){return this.options}}class Q extends A.Application{initialize(e){this.mergeOptions(e,["layoutService"]),this.applications=[],this.routeLookup={},this.shellState={navLock:!1,activeRoute:!1,currentAppLink:null},this.errorHandlers=[]}bindListeners(){this.bindRouteLookup(),this.bindNavLockListeners(),this.bindAppLinkListeners(),this.bindErrorHandlers(),this.bindErrorListener()}bindNavLockListeners(){this.listenTo(y.SHELL,g.LOCK_NAV,()=>this.shellState.navLock=!0),this.listenTo(y.SHELL,g.UNLOCK_NAV,()=>this.shellState.navLock=!1)}bindAppLinkListeners(){this.listenTo(y.SHELL,g.ROUTING_START,()=>this.shellState.activeRoute=!0),this.listenTo(y.SHELL,g.ROUTING_END,()=>this.shellState.activeRoute=!1),this.listenTo(y.SHELL,g.ROUTE,e=>this.shellState.currentAppLink=e);const e=h.Radio.channel(y.SHELL);e.reply(g.HAS_ACTIVE_ROUTE,m.bind(this.hasActiveRoute,this)),e.reply(g.CURRENT_ROUTE,()=>this.shellState.currentAppLink)}bindErrorHandlers(){window.addEventListener("error",()=>{O.routingEnded()})}bindErrorListener(){const e=h.Radio.channel(y.SHELL);this.listenTo(e,g.ERROR,this.handleError)}bindRouteLookup(){h.Radio.channel(y.SHELL).reply(g.ROUTE_LOOKUP,(e,t,n)=>this.routeLookup[e]?this.routeLookup[e](t,n):"",this)}addRouteLookup(e,t){this.routeLookup[e]=t}registerApplication(e,t){return this.applications.push(new Z(e,t)),this}getGlobalRadioChannels(){return y}isNavLocked(){return this.shellState.navLock}start(e){e||(e={}),this.runInitializationSteps(this,(t,n)=>{this.runStartUpSteps(this,e,(t,n,r)=>{super.start(e)})})}hasActiveRoute(){return this.shellState.activeRoute}onStart(){m.each(this.applications,e=>{const t={appConstructor:e.Application,shell:this,appOptions:Object.assign({region:"",shell:this,layoutService:this.layoutService},e.Options)};new e.Application.router(t)}),this.bindListeners(),v.StartHistory()}addInitializationStep(e){var t;return this.runInitializationSteps=(t=this.runInitializationSteps,(n,r)=>t(n,()=>e(n,r))),this}runInitializationSteps(e,t){t(e)}addStartUpStep(e){var t;return this.runStartUpSteps=(t=this.runStartUpSteps,(n,r,i)=>t(n,r,()=>e(n,r,i))),this}runStartUpSteps(e,t,n){n(e,t)}registerLayout(e,t){return this.layoutService.registerLayout(e,t),this}registerErrorHandler(e,t){return e||x.throw(new _("An error must have a name in order to register a handler for it.")),m.any(this.errorHandlers,t=>t.errorType===e)&&x.throw(new _(`An error handler for ${e.prototype.name} has already been defined.`)),this.errorHandlers.push({errorType:e,handler:t}),this}handleError(e){const t=m.find(this.errorHandlers,t=>e instanceof t.errorType);t&&t.handler&&t.handler(e)}registerStore(e){this.store=e}listenTo(...e){return T.call(this,e[0],e[1],e[2],super.listenTo)}}const X={debounce:(e,t,n)=>m.debounce(e,t,n),throttle:(e,t,n)=>m.throttle(e,t,n),isFunction:e=>m.isFunction(e),useIdentity:()=>m.identity,memoize:(e,t)=>m.memoize(e,t)};var ee=n(24),te=n(5);class ne extends J{isReactComponent(e){return d&&d.isValidElement(e)}showChildView(e,t){this.isReactComponent(t)&&this.showChildReactComponent(e,t)}showChildReactComponent(e,t){this.isAttached()?this.renderChildReactComponent(e,t):this.listenToOnce(this,"attach",()=>this.renderChildReactComponent(e,t))}renderChildReactComponent(e,t){const n=this.getRegion(e),r=this.$el.find(n.el);r&&r.length&&(n.trigger("before:show"),ee.render(t,r[0],()=>n.trigger("show")),this.listenToOnce(this,"unmount:"+e,()=>ee.unmountComponentAtNode(r[0])),this.listenToOnce(this,"before:destroy",()=>ee.unmountComponentAtNode(r[0])))}wrapWithStore(e){return d.createElement(te.Provider,{store:this.options.store},e)}}const re="top:nav",ie="left:nav",ae="content",oe="popup",se="alert";var ce=n(121),le=n.n(ce),ue=n(25),pe=n.n(ue);function fe(e){return(fe="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 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,n){return(me="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=ve(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 he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ge(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var i=ve(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ye(this,n)}}function ye(e,t){return!t||"object"!==fe(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 ve(e){return(ve=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var be=function(e){!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&&he(e,t)}(o,e);var t,n,i,a=ge(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=a.call(this,e)).childComponents={},t}return t=o,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}}],(n=[{key:"regions",value:function(){return{layout:".layout-region"}}},{key:"getChildComponents",value:function(){return{topNav:{component:this.childComponents[re],className:pe.a.topNavRegion},leftNav:{component:this.childComponents[ie],className:"py-3 ".concat(pe.a.leftNavRegion)},content:{component:this.childComponents[ae],className:"position-relative container py-3"},popup:{component:this.childComponents[oe]},alert:{component:this.childComponents[se]}}}},{key:"unsetRegion",value:function(e){delete this.childComponents[e],this.renderLayout()}},{key:"renderTopNav",value:function(){X.isFunction(this.options.getTopNavView)&&(this.childComponents[re]=this.options.getTopNavView(r.AppLinkHelper.getCurrentAppLink()))}},{key:"hideLeftNav",value:function(){this.unsetRegion(ie)}},{key:"closePopup",value:function(){this.unsetRegion(oe)}},{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());me(ve(o.prototype),"showChildView",this).call(this,"layout",this.wrapWithStore(d.createElement(Ie,Object.assign({},e))))}},{key:"title",get:function(){return!1}},{key:"name",get:function(){return"CuratorLayoutView"}},{key:"template",get:function(){return le.a}},{key:"className",get:function(){return"container-fluid ".concat(pe.a.curatorLayout)}}])&&de(t.prototype,n),i&&de(t,i),o}(ne),Se=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},Ee=function(e){var t=e.className,n=e.children;return d.createElement("div",{className:t},n)},Ce=function(e,t){return"".concat(e).concat(t?" ".concat(t):"")},Oe=function(e){var t=e.topNav,n=e.leftNav,r=e.content,i=e.popup,a=e.alert;return d.createElement(d.Fragment,null,d.createElement("div",{className:"position-relative"},!!t.component&&d.createElement(Ee,{className:Ce("top-nav-region",t.className)},t.component),!!n.component&&d.createElement(Ee,{className:Ce("left-nav-region",n.className)},n.component),!!r.component&&d.createElement("div",{className:"content-container"},d.createElement(Ee,{className:Ce("content-region",r.className)},r.component))),!!i.component&&d.createElement(Ee,{className:Ce("popup-region",i.className)},i.component),!!a.component&&d.createElement(Ee,{className:Ce("alert-region",a.className)},a.component))},Ie=function(e){var t=e.provider,n=Se(e,["provider"]);return t?d.createElement(t,null,d.createElement(Oe,Object.assign({},n))):d.createElement(Oe,Object.assign({},n))};function je(e){return(je="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 Ae(e){return function(e){if(Array.isArray(e))return Te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Te(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function we(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Le(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 ke(e,t){return(ke=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _e(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Pe(e);if(t){var i=Pe(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xe(this,n)}}function xe(e,t){return!t||"object"!==je(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 Pe(e){return(Pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ne=function(e){!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&&ke(e,t)}(o,e);var t,n,i,a=_e(o);function o(){return we(this,o),a.apply(this,arguments)}return t=o,(n=[{key:"initialize",value:function(){this.listenTo(y.SHELL,r.EventNames.ROUTING_END,this.updateNav)}},{key:"updateNav",value:function(){var e=this,t=r.AppLinkHelper.getCurrentAppLink().application;if(t!==this.currentApplication){this.currentApplication=t;var n=this.options.navItemMappings[t];if(n){var i=document.querySelector(this.options.navSelector);i&&i.children&&Ae(i.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"}}])&&Le(t.prototype,n),i&&Le(t,i),o}(r.Service);class De extends G{constructor(e){super(e),m.result(this,"name")||x.throw(new B("Must provide a name when extending BaseDataService")),m.result(this,"channelName")||x.throw(new B("Must provide a channelName for "+m.result(this,"name")));const t=[...this.defaultProps,...this.props||[]];this.dataRequestSignatures={},this.mergeOptions(e,t)}get defaultProps(){return["dataProvider","cache","bootstrapData","defaultErrorHandler","alertService"]}getCursors(e){const t=this.cache.get(e);return t?t.cursors:{}}clearCacheAndGet(e){const{callback:t,errorCallback:n,eventPrefix:r}=e,{syncEvent:i,errorEvent:a}=this.getEventNames(r),o=this.cache.get(r);if(o&&o.openRequest){const e=e=>{m.isFunction(n)&&this.stopListening(this.getChannel(),a,n),m.isFunction(t)&&t(e)},r=()=>{m.isFunction(t)&&this.stopListening(this.getChannel(),i,t),m.isFunction(n)&&n()};return this.listenToOnce(this.getChannel(),i,e),void this.listenToOnce(this.getChannel(),a,r)}this.cache.remove(e.eventPrefix),this.get(e)}get(e){const{callback:t,errorCallback:n,eventPrefix:r,resource:i,formatData:a,expiryTime:o,successHandler:s,errorHandler:c,bootstrapName:l}=e,{syncEvent:u,requestEvent:p,successEvent:f,errorEvent:d}=this.getEventNames(r),h=this.getChannel(),g=this.currentTimestamp();this.bootstrapData&&this.bootstrapData[l]&&(this.cacheData(r,this.bootstrapData[l],a,{openRequest:!1,timestamp:g}),delete this.bootstrapData[l]);const y=this.cache.get(r);let v;y&&(v=y.data);const b=y&&y.openRequest,S=this.isExpired(r,o);if(b){const e=e=>{m.isFunction(n)&&this.stopListening(this.getChannel(),d,n),m.isFunction(t)&&t(e)},r=()=>{m.isFunction(t)&&this.stopListening(this.getChannel(),u,t),m.isFunction(n)&&n()};this.listenToOnce(h,u,e),this.listenToOnce(h,d,r)}if(this.cache.has(r)&&!S||(h.trigger(p),this.listenToResponse({eventPrefix:r,formatData:a,cacheOptions:{timestamp:g},callback:t,errorCallback:n,successHandler:s,errorHandler:c}),this.cacheData(r,null,null,{openRequest:!0,timestamp:g}),this.dataProvider.read(i,{channel:this.getTransportChannel(),successEvent:f,errorEvent:d})),v&&m.isFunction(t)&&!S&&t(v),v)return v}create(e){const{eventPrefix:t,resource:n,data:r,formatData:i,callback:a,errorCallback:o,invalidationKeys:s,successHandler:c,errorHandler:l}=e,{requestEvent:u,successEvent:p,errorEvent:f}=this.getEventNames(e.eventPrefix),d=this.getChannel(),m=this.getTransportChannel();d.trigger(u),this.listenToResponse({eventPrefix:t,formatData:i,invalidationKeys:s,callback:a,errorCallback:o,successHandler:c,errorHandler:l}),this.dataProvider.create(n,r,{channel:m,successEvent:p,errorEvent:f})}update(e){const{data:t,callback:n,errorCallback:r,resource:i,formatData:a,eventPrefix:o,invalidationKeys:s,errorHandler:c,successHandler:l}=e,{requestEvent:u,successEvent:p,errorEvent:f}=this.getEventNames(e.eventPrefix),d=this.getChannel(),m=this.getTransportChannel();d.trigger(u),this.listenToResponse({eventPrefix:o,formatData:a,invalidationKeys:s,callback:n,errorCallback:r,successHandler:l,errorHandler:c}),this.dataProvider.update(i,t,{channel:m,successEvent:p,errorEvent:f})}delete(e){const{eventPrefix:t,resource:n,callback:r,errorCallback:i,invalidationKeys:a,successHandler:o,errorHandler:s}=e,{successEvent:c,errorEvent:l}=this.getEventNames(t),u=this.getTransportChannel();this.listenToResponse({eventPrefix:t,invalidationKeys:a,callback:r,errorCallback:i,cacheOptions:{noCache:!0,clearCacheKey:!0},successHandler:o,errorHandler:s}),this.dataProvider.delete(n,{channel:u,successEvent:c,errorEvent:l})}listenToResponse(e){const{eventPrefix:t,formatData:n,callback:r,errorCallback:i,successHandler:a,errorHandler:o,invalidationKeys:s,cacheOptions:c={}}=e,{syncEvent:l,requestEvent:u,successEvent:p,errorEvent:f,successAlertEvent:d,errorAlertEvent:h}=this.getEventNames(t),g=this.getChannel(),y=this.getTransportChannel(),v=this.getAlertChannel();if(m.isFunction(r)&&this.listenToOnce(g,l,r),m.isFunction(i)&&this.listenToOnce(g,f,i),this.stopListening(v,d),this.stopListening(v,h),m.isFunction(a)&&this.listenToOnce(v,d,a),m.isFunction(o)&&this.listenToOnce(v,h,o),!m.isFunction(o)&&!1!==o&&m.isFunction(this.defaultErrorHandler)&&this.listenToOnce(v,h,this.defaultErrorHandler),this.hasRequestSignature(t))return;this.setRequestSignature(t);this.listenTo(y,p,(e,...r)=>{this.stopListening(g,f,i),v.trigger(d,e,...r);const a=c.noCache?this.formatData(e,n):this.cacheData(t,e,n);c.clearCacheKey&&this.cache.remove(t),g.trigger(l,a),s&&s.length&&this.cache.invalidate(s,e=>g.trigger(e+":invalidate"))}),this.listenTo(y,f,(...e)=>{this.stopListening(g,l,r);const n=this.dataProvider.parseError(...e);v.trigger(h,n),g.trigger(f,n),c.noCache||this.cacheData(t,null,null)})}cacheData(e,t,n,r={}){let{openRequest:i=!1,timestamp:a}=r;a||(a=this.currentTimestamp());const o=this.processPagination(t),s=this.formatData(t,n);return this.cache.set(e,{data:s,timestamp:a,cursors:o,openRequest:i}),s}processPagination(e){if(!e)return;const{pagination:t}=e;return t?t.cursors?t.cursors:m.isUndefined(t.offset)||m.isUndefined(t.pageSize)?t.page?this.convertLegacyPaginationToCursors(t):void 0:this.convertOffsetPaginationToCursors(t):void 0}formatData(e,t){return m.isFunction(t)?t(e):e}chain(){const e=[],t=(e,t)=>{m.isFunction(e)&&e(t)},n=(n,i)=>(e.push(()=>{const r=n.callback;n.callback=n=>{t(r,n),t(e.shift())},this[i](n)}),r),r={func:t=>(e.push(()=>{t(e.shift()||(()=>{}))}),r),get:e=>n(e,"get"),create:e=>n(e,"create"),update:e=>n(e,"update"),delete:e=>n(e,"delete"),run(){t(e.shift())}};return r}invalidateCache(e){e&&e.length&&this.cache.invalidate(e)}currentTimestamp(){return(new Date).valueOf()}isExpired(e,t){if(!t)return!1;const n=this.cache.get(e);if(!n||!n.timestamp)return!0;const r=1e3*t;return n.timestamp<this.currentTimestamp()-r}getEventNames(e){return{syncEvent:e+":sync",requestEvent:e+":request",successEvent:e+":success",errorEvent:e+":error",successAlertEvent:e+":success:alert",errorAlertEvent:e+":error:alert"}}getTransportChannel(){return h.Radio.channel(this.channelName+":transport")}getAlertChannel(){return h.Radio.channel(this.channelName+":alert")}setRequestSignature(e){this.dataRequestSignatures[e]=e}hasRequestSignature(e){return!!this.dataRequestSignatures[e]}convertOffsetPaginationToCursors(e){const{offset:t,pageSize:n,totalItems:r}=e,i=r>0&&t<r&&t+n,a=r>0&&t>0&&Math.max(t-n,0);let o={};if(i&&i<r&&(o.next=i.toString()),m.isNumber(a)&&(o.previous=a.toString()),!m.isEmpty(o))return o}convertLegacyPaginationToCursors(e){const{page:t,totalPages:n}=e,r=m.isNumber(t)&&t>0&&t<n&&t+1,i=m.isNumber(t)&&t>1&&t-1;let a={};if(r&&r<=n&&(a.next=r.toString()),i&&(a.previous=i.toString()),!m.isEmpty(a))return a}}function Re(e){return(Re="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 Me(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 Ue(e,t){return(Ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ve(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ze(e);if(t){var i=ze(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Be(this,n)}}function Be(e,t){return!t||"object"!==Re(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 ze(e){return(ze=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var He=function(e){!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&&Ue(e,t)}(a,e);var t,n,r,i=Ve(a);function a(){return Fe(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"uploadBase64Image",value:function(e,t,n,r){return this.create({resource:"/api/image/upload?type=".concat(t),eventPrefix:s.UPLOAD_IMAGE,data:e,callback:n,errorCallback:r})}},{key:"name",get:function(){return f.IMAGE_UPLOAD}},{key:"channelName",get:function(){return p.IMAGE_UPLOAD}}])&&Me(t.prototype,n),r&&Me(t,r),a}(De);class qe{constructor(e){this.value=e}increment(){this.value+=1}decrement(){this.value-=1}getValue(){return this.value}}const Je={SHORT:120,STANDARD:600};function $e(e){return($e="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 Ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ye(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 Ge(e,t){return(Ge=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function We(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Qe(e);if(t){var i=Qe(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Ze(this,n)}}function Ze(e,t){return!t||"object"!==$e(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 Qe(e){return(Qe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Xe=function(e){!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&&Ge(e,t)}(a,e);var t,n,r,i=We(a);function a(){return Ke(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"getLanguageConfig",value:function(e){var t={locale:"en",phrases:{}},n=new qe(3),r=function(){n.decrement(),n.getValue()>0||e(t)};this.get({resource:"/api/locale",eventPrefix:s.LOCALE,expiryTime:Je.STANDARD,callback:function(e){t.locale=e,r()}}),this.get({resource:"/api/phrases/shared",eventPrefix:"".concat(s.PHRASES,":shared"),expiryTime:Je.STANDARD,callback:function(e){null===e.shared&&(e.shared={}),t.phrases=Object.assign(Object.assign({},t.phrases),e),r()}}),this.get({resource:"/api/phrases/subjects",eventPrefix:"".concat(s.PHRASES,":subjects"),expiryTime:Je.STANDARD,callback:function(e){null===e.subjects&&(e.subjects={}),t.phrases=Object.assign(Object.assign({},t.phrases),e),r()}})}},{key:"name",get:function(){return f.LANGUAGE}},{key:"channelName",get:function(){return p.LANGUAGE}}])&&Ye(t.prototype,n),r&&Ye(t,r),a}(De);const et={API_REQUEST:"API_REQUEST",API_REPONSE:"API_RESPONSE",API_ERROR:"API_ERROR",INVALIDATE:"INVALIDATE",UPDATE:"UPDATE"};var tt,nt;function rt(e){const{getResponseHeader:t,responseJSON:n,status:r}=e;return{getResponseHeader:t,responseJSON:n,status:r}}!function(e){e.None="None",e.Fetching="Fetching",e.Success="Success",e.Error="Error"}(tt||(tt={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(nt||(nt={}));const it=[nt.POST,nt.PUT];function at(e){const{resource:t,type:n,success:r,error:i,always:a}=e,o={url:t,method:n};it.includes(n)&&e.data&&(o.data=JSON.stringify(e.data)),$.ajax(o).done((e,t,n)=>{r&&r(e,rt(n))}).fail((e,t,n)=>{i&&i(rt(e))}).always(()=>{a&&a()})}const ot="id";function st(e,t={}){const{idAttribute:n=ot,namespace:r=""}=t;return e[n]||x.throw(new B("There was an issue during normalization. Object did not have an id attribute.")),`${r}__${e[n]}`}function ct(e,t,n={}){const{idAttribute:r=ot}=n,i=[];return e.forEach(e=>{e[r]&&i.push(st(e,n)),lt(e,t,n)}),i}function lt(e,t,n={}){if(e)return Array.isArray(e)?ct(e,t,n):"object"==typeof e?function e(t,n,r={}){const{idAttribute:i=ot}=r,a=Object.assign({},t);if(Object.keys(t).forEach(o=>{const s=t[o];if(s)if(Array.isArray(s)){var c=ct(s,n,r);c.length&&(a[o]=c)}else if("object"==typeof s){var l=e(s,n,r);s[i]?a[o]=st(s,r):a[o]=l}}),t[i]){const e=st(t,r);return n[e]=a,e}return a}(e,t,n):e}function ut(e,t){const n={};return{result:lt(e,n,t),entities:n}}const pt={isEmpty:e=>m.isEmpty(e),values:e=>m.values(e),keys:e=>m.keys(e),deepClone:e=>(m.isArray(e)?m.map:m.mapObject)(e,e=>m.isObject(e)||m.isArray(e)?pt.deepClone(e):e),getEnumKeys:e=>Object.keys(e).filter(e=>!(parseInt(e)>=0)),isObject:e=>m.isObject(e),isEqual:(e,t)=>m.isEqual(e,t),omit:(e,t)=>m.omit(e,t)};function ft(e,t,n){if(e){if("string"==typeof e)return function(e,t,n){if(n[e])return n[e];n[e]={};const r=ft(t[e],t,n);return Object.assign(n[e],r),pt.isEmpty(n[e])&&delete n[e],n[e]}(e,t,n);if(Array.isArray(e))return e.map(e=>ft(e,t,n));if("object"==typeof e){const r={};return Object.keys(e).forEach(i=>{r[i]=ft(e[i],t,n)||e[i]}),r}}}function dt(e,t){return ft(e,t,{})}function mt(e,t){return e===t}function ht(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}function gt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mt,n=null,r=null;return function(){return ht(t,n,arguments)||(r=e.apply(null,arguments)),n=arguments,r}}function yt(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}function vt(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];var a=0,o=r.pop(),s=yt(r),c=e.apply(void 0,[function(){return a++,o.apply(null,arguments)}].concat(n)),l=e((function(){for(var e=[],t=s.length,n=0;n<t;n++)e.push(s[n].apply(null,arguments));return c.apply(null,e)}));return l.resultFunc=o,l.dependencies=s,l.recomputations=function(){return a},l.resetRecomputations=function(){return a=0},l}}var bt=vt(gt);const St={currentTimestamp:()=>(new Date).valueOf(),isExpired(e,t){if(!t)return!1;const n=1e3*t;return e<St.currentTimestamp()-n},currentTimeOfDay(e){e||(e=new Date);const t=e.getHours();return t>=12&&t<18?"afternoon":t>=18?"evening":"morning"}};class Et{constructor(e){this.status=e.status,this.requestTime=e.requestTime,this.cacheDuration=e.cacheDuration,this.data=e.data,this.statusCode=e.statusCode}get shouldFetch(){return this.status===tt.None||this.isExpired}get isExpired(){return St.isExpired(this.requestTime,this.cacheDuration)}get isFetching(){return this.status===tt.Fetching}get hasError(){return this.status===tt.Error}get isComplete(){return this.status===tt.Success||this.status===tt.Error}}function Ct(e,t,n){if(!e||!t)return Ot();let r=t.response;return!1!==t.request.normalize&&(r=dt(t.response,n)),new Et({status:t.status,statusCode:t.statusCode,requestTime:t.timestamp,cacheDuration:t.request.expiryTime,data:r})}function Ot(){return new Et({status:tt.None})}function It(e,t){return Ct(t,e.flightData.resources[t],e.flightData.entities)}function jt(e,t){return()=>{At(e,t)}}function At(e,t){e({type:et.API_REQUEST,request:t})}function Tt(e){return jt(Object(te.useDispatch)(),e)}function wt(e,t){const n=Object(d.useMemo)(()=>{var n;return(null===(n=t)||void 0===n?void 0:n.optimize)?function(e){return vt(gt,(e,t)=>{const n=["response","request"];return pt.isEqual(pt.omit(e,n),pt.omit(t,n))})(t=>t.flightData.resources[e],t=>{var n;const r=t.flightData.resources[e];return(null===(n=r)||void 0===n?void 0:n.entityIds)?r.entityIds.reduce((e,n)=>(e[n]=t.flightData.entities[n],e),{}):{}},(t,n)=>Ct(e,t,n))}(e):function(e){return bt(t=>t.flightData.resources[e],e=>e.flightData.entities,(t,n)=>Ct(e,t,n))}(e)},[e]);return Object(te.useSelector)(e=>n(e))}function Lt(e,t){const n=Object(te.useDispatch)(),r=wt(e&&e.key,t),i=jt(n,e);return e&&r.shouldFetch&&i(),r}const kt={getMatchingKeyMap(e,t,n){const r=Array.isArray(t)?t:[t];let i=[];return r.forEach(t=>{const n=new RegExp(t,"i"),r=Object.keys(e.resources).filter(e=>n.test(e));i.push(...r)}),n&&(i=i.filter(e=>e!==n)),i.reduce((e,t)=>(e[t]=!0,e),{})}};var _t;!function(e){e[e.Ok=200]="Ok",e[e.NoContent=204]="NoContent",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.Conflict=409]="Conflict",e[e.InternalServer=500]="InternalServer"}(_t||(_t={}));const xt={isSimulated(e){const t=e;return!!(t.successResponse||t.errorResponse||t.noResponse)},simulateFetchData(e,t){const{success:n,error:r,always:i}=e,a=t;window.setTimeout(()=>{a.noResponse||(a.successResponse?n(a.successResponse(),{status:_t.Ok,getResponseHeader:e=>""}):a.errorResponse&&r(a.errorResponse()),i())},function(e){const t=e.timeout||300;return t/2+(Math.floor(Math.random()*t/2)+1)}(t))}};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};function Nt(e){const{fetchData:t,bootstrappedData:n,defaultExpiryTime:r}=e,i=Object.freeze({key:null,url:null,type:nt.GET,normalize:!0,formatData:e=>e,expiryTime:r});return function(e){return r=>a=>{if(a.type!==et.API_REQUEST)return void r(a);const o=e.getState(),s=Object.assign({},i,a.request),{success:c,error:l,always:u,formatData:p}=s,f=Pt(s,["success","error","always","formatData"]),d=o.flightData.resources[f.key];if(r(a),d&&d.status===tt.Fetching)return;if(f.bootstrapName&&n[a.request.bootstrapName])return h(n[a.request.bootstrapName]),g(),void delete n[a.request.bootstrapName];const m={resource:f.url,type:f.type,data:f.data,success:h,error:function(t){e.dispatch({type:et.API_ERROR,errorResponse:t.responseJSON,request:a.request,timestamp:St.currentTimestamp(),xhr:t}),l&&l(t)},always:g};return void(xt.isSimulated(f)?xt.simulateFetchData(m,f):t(m));function h(t,n){const r=p(t);let i={result:r,entities:{}};if(f.normalize&&(i=ut(r,f.normalizeOptions)),e.dispatch({type:et.API_REPONSE,result:i.result,entities:i.entities,request:f,timestamp:St.currentTimestamp(),xhr:n}),f.updateState){(Array.isArray(f.updateState)?f.updateState:[f.updateState]).forEach(t=>{!function(t){const n=kt.getMatchingKeyMap(o.flightData,t.keys),r=Object.assign({},Object.keys(o.flightData.resources).filter(e=>n[e]).reduce((e,t)=>{const n=o.flightData.resources[t];let r=n.response;return n.request.normalize&&(r=dt(n.response,o.flightData.entities)),e[t]=r,e},{})),i=t.updateData(r);Object.keys(i).forEach(t=>{const n=o.flightData.resources[t],r=i[t];let a={result:r,entities:{}};n.request.normalize&&(a=ut(r,n.request.normalizeOptions)),e.dispatch({type:et.UPDATE,result:a.result,entities:a.entities,request:n.request})})}(t)})}if(!c)return;let a=i.result;f.normalize&&(a=dt(i.result,Object.assign(Object.assign({},o.flightData.entities),i.entities))),c(a)}function g(){f.invalidationKeys&&e.dispatch({type:et.INVALIDATE,keys:f.invalidationKeys,request:f}),u&&u()}}}}function Dt(e,t){const n=Object.assign({},e);return Object.keys(t).forEach(r=>{e[r]?n[r]=Object.assign(Object.assign({},e[r]),t[r]):n[r]=t[r]}),n}const Rt={resources:{},entities:{}};function Ft(e=Rt,t){switch(t.type){case et.API_REQUEST:return function(e,t){const n=e.resources[t.request.key];return{entities:Object.assign({},e.entities),resources:Object.assign(Object.assign({},e.resources),{[t.request.key]:{request:t.request,status:tt.Fetching,response:n?n.response:null,entityIds:n?n.entityIds:null}})}}(e,t);case et.API_REPONSE:return function(e,t){var n;const r=t.entities?Object.keys(t.entities):[];return{entities:Dt(e.entities,t.entities),resources:Object.assign(Object.assign({},e.resources),{[t.request.key]:{request:t.request,status:tt.Success,response:t.result,timestamp:t.timestamp,statusCode:null===(n=t.xhr)||void 0===n?void 0:n.status,entityIds:r}})}}(e,t);case et.API_ERROR:return function(e,t){var n;return{entities:Object.assign({},e.entities),resources:Object.assign(Object.assign({},e.resources),{[t.request.key]:{request:t.request,status:tt.Error,errorResponse:t.errorResponse,timestamp:t.timestamp,statusCode:null===(n=t.xhr)||void 0===n?void 0:n.status}})}}(e,t);case et.INVALIDATE:return function(e,t){var n;const r=kt.getMatchingKeyMap(e,t.keys,null===(n=t.request)||void 0===n?void 0:n.key);return{entities:Object.assign({},e.entities),resources:Object.assign(Object.assign({},e.resources),Object.keys(e.resources).filter(e=>r[e]).reduce((t,n)=>{const r=e.resources[n];return t[n]=Object.assign({},r,{status:tt.None}),t},{}))}}(e,t);case et.UPDATE:return function(e=Rt,t){const n=t.entities?Object.keys(t.entities):[];return{entities:Dt(e.entities,t.entities),resources:Object.assign(Object.assign({},e.resources),{[t.request.key]:Object.assign(Object.assign({},e.resources[t.request.key]),{request:t.request,response:t.result,entityIds:n})})}}(e,t)}return e}const Mt={first:e=>m.first(e),firstFew:(e,t)=>m.first(e,t),last:e=>m.last(e),lastFew:(e,t)=>m.last(e,t),max:(e,t)=>m.max(e,t),cloneAndReplaceAtIdx(e,t,n,r=null){let i=e&&e.length?e.slice():[];return t+1>i.length&&(i=[...i,...Array(t+1-i.length).fill(r)]),i.splice(t,1,n),i},moveItem(e,t,n){const r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r},isEmpty:e=>e&&!e.length,findIndex:(e,t)=>m.findIndex(e,t),where:(e,t)=>m.where(e,t),groupBy:(e,t)=>m.groupBy(e,t),flatten:(e,t)=>m.flatten(e,t),intersection:(...e)=>m.intersection(...e),addOrRemove(e,t){const n=e.indexOf(t);return-1===n?e.push(t):e.splice(n,1),e},addOrRemoveImmutable(e,t){const n=e.indexOf(t),r=pt.deepClone(e);return-1===n?[...r,t]:[...r.slice(0,n),...r.slice(n+1)]},sortBy:(e,t)=>m.sortBy(e,t),chunk:(e,t)=>m.chunk(e,t),uniq:e=>m.uniq(e)},Ut="id";function Vt(e,t){return localStorage.setItem(e,JSON.stringify(t)),t}function Bt(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}const zt={getAll(e,t){let n=Bt(e);return n&&n.length?n:!n&&t?(t.forEach(t=>zt.create(e,t)),Bt(e)):[]},get(e,t){const n=zt.getAll(e);return n.length?n.find(e=>e[Ut]===t):null},create(e,t){const n=zt.getAll(e),r=Object.assign(Object.assign({},t),{[Ut]:t[Ut]||(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)+1).toString()});return n.push(r),Vt(e,n),r},update(e,t){const n=zt.getAll(e);if(!n.length)return t;const r=n.findIndex(e=>e[Ut]===t[Ut]);return n[r]=t,Vt(e,n),t},delete(e,t){const n=zt.getAll(e);n.length&&(Array.isArray(t)||(t=[t]),t.forEach(e=>{const t=n.findIndex(t=>t[Ut]===e);n.splice(t,1)}),Vt(e,n))},assoc(e,t,n,r,i){const a=Array.isArray(i);let o=a?i:[i];"string"==typeof Mt.first(o)&&(o=zt.getAll(r).filter(e=>o.includes(e.id)));const s=o.map(e=>e.id?e:zt.create(r,e));let c=zt.getAll(e);if(!c.length)return;let l=c.find(e=>e.id===t);return l?(s.forEach(e=>{if(l[n])if(Array.isArray(l[n])){if(l[n].find(t=>t.id===e.id))return;l[n].push(e)}else l[n]=e;else l[n]=a?[e]:e}),c=c.map(e=>e.id!==l.id?e:l),Vt(e,c),a?s:Mt.first(s)):void 0},dissoc(e,t,n,r){let i=zt.getAll(e);if(!i.length)return;let a=i.find(e=>e.id===t);if(!a)return;let o=a[n];return o?(Array.isArray(r)||(r=[r]),Array.isArray(o)||(o=[o]),r.forEach(e=>{const t=o.findIndex(t=>t.id===e);o.splice(t,1)}),a[n]=o,i=i.map(e=>e.id!==a.id?e:a),Vt(e,i),i):void 0}};var Ht=function(e){var t="/api/master/v2/companies";return e?"".concat(t,"?cursor=").concat(e):t},qt=function(e){return"/api/master/v2/objects/".concat(e)},Jt=function(){return"/api/master/v2/companies"},$t=function(e){return"/api/master/v2/objects/".concat(e)},Kt="companies",Yt="company",Gt="update:company",Wt=function(e){return{key:"".concat(Kt).concat(e?":".concat(e):""),url:Ht(e)}},Zt=function(e){return{key:"".concat(Yt,":").concat(e),url:qt(e)}},Qt=function(e,t,n){return{key:Yt,url:Jt(),data:e,type:nt.POST,success:t,error:n,invalidationKeys:[Kt]}},Xt=function(e,t,n){return{key:"".concat(Gt,":").concat(e),url:$t(e),data:t,type:nt.PUT,always:n}},en=n(12),tn=n.n(en),nn=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===rn}(e)}(e)};var rn="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function an(e,t){return!1!==t.clone&&t.isMergeableObject(e)?sn((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function on(e,t,n){return e.concat(t).map((function(e){return an(e,n)}))}function sn(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||on,n.isMergeableObject=n.isMergeableObject||nn;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):function(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach((function(t){r[t]=an(e[t],n)})),Object.keys(t).forEach((function(i){n.isMergeableObject(t[i])&&e[i]?r[i]=sn(e[i],t[i],n):r[i]=an(t[i],n)})),r}(e,t,n):an(t,n)}sn.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return sn(e,n,t)}),{})};var cn=sn,ln=n(6),un=ln.a.Symbol,pn=Object.prototype,fn=pn.hasOwnProperty,dn=pn.toString,mn=un?un.toStringTag:void 0;var hn=function(e){var t=fn.call(e,mn),n=e[mn];try{e[mn]=void 0;var r=!0}catch(e){}var i=dn.call(e);return r&&(t?e[mn]=n:delete e[mn]),i},gn=Object.prototype.toString;var yn=function(e){return gn.call(e)},vn=un?un.toStringTag:void 0;var bn=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":vn&&vn in Object(e)?hn(e):yn(e)};var Sn=function(e,t){return function(n){return e(t(n))}},En=Sn(Object.getPrototypeOf,Object);var Cn=function(e){return null!=e&&"object"==typeof e},On=Function.prototype,In=Object.prototype,jn=On.toString,An=In.hasOwnProperty,Tn=jn.call(Object);var wn=function(e){if(!Cn(e)||"[object Object]"!=bn(e))return!1;var t=En(e);if(null===t)return!0;var n=An.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&jn.call(n)==Tn};var Ln=function(){this.__data__=[],this.size=0};var kn=function(e,t){return e===t||e!=e&&t!=t};var _n=function(e,t){for(var n=e.length;n--;)if(kn(e[n][0],t))return n;return-1},xn=Array.prototype.splice;var Pn=function(e){var t=this.__data__,n=_n(t,e);return!(n<0)&&(n==t.length-1?t.pop():xn.call(t,n,1),--this.size,!0)};var Nn=function(e){var t=this.__data__,n=_n(t,e);return n<0?void 0:t[n][1]};var Dn=function(e){return _n(this.__data__,e)>-1};var Rn=function(e,t){var n=this.__data__,r=_n(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Fn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Fn.prototype.clear=Ln,Fn.prototype.delete=Pn,Fn.prototype.get=Nn,Fn.prototype.has=Dn,Fn.prototype.set=Rn;var Mn=Fn;var Un=function(){this.__data__=new Mn,this.size=0};var Vn=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var Bn=function(e){return this.__data__.get(e)};var zn=function(e){return this.__data__.has(e)};var Hn=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var qn,Jn=function(e){if(!Hn(e))return!1;var t=bn(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},$n=ln.a["__core-js_shared__"],Kn=(qn=/[^.]+$/.exec($n&&$n.keys&&$n.keys.IE_PROTO||""))?"Symbol(src)_1."+qn:"";var Yn=function(e){return!!Kn&&Kn in e},Gn=Function.prototype.toString;var Wn=function(e){if(null!=e){try{return Gn.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Zn=/^\[object .+?Constructor\]$/,Qn=Function.prototype,Xn=Object.prototype,er=Qn.toString,tr=Xn.hasOwnProperty,nr=RegExp("^"+er.call(tr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var rr=function(e){return!(!Hn(e)||Yn(e))&&(Jn(e)?nr:Zn).test(Wn(e))};var ir=function(e,t){return null==e?void 0:e[t]};var ar=function(e,t){var n=ir(e,t);return rr(n)?n:void 0},or=ar(ln.a,"Map"),sr=ar(Object,"create");var cr=function(){this.__data__=sr?sr(null):{},this.size=0};var lr=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ur=Object.prototype.hasOwnProperty;var pr=function(e){var t=this.__data__;if(sr){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return ur.call(t,e)?t[e]:void 0},fr=Object.prototype.hasOwnProperty;var dr=function(e){var t=this.__data__;return sr?void 0!==t[e]:fr.call(t,e)};var mr=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=sr&&void 0===t?"__lodash_hash_undefined__":t,this};function hr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}hr.prototype.clear=cr,hr.prototype.delete=lr,hr.prototype.get=pr,hr.prototype.has=dr,hr.prototype.set=mr;var gr=hr;var yr=function(){this.size=0,this.__data__={hash:new gr,map:new(or||Mn),string:new gr}};var vr=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var br=function(e,t){var n=e.__data__;return vr(t)?n["string"==typeof t?"string":"hash"]:n.map};var Sr=function(e){var t=br(this,e).delete(e);return this.size-=t?1:0,t};var Er=function(e){return br(this,e).get(e)};var Cr=function(e){return br(this,e).has(e)};var Or=function(e,t){var n=br(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function Ir(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ir.prototype.clear=yr,Ir.prototype.delete=Sr,Ir.prototype.get=Er,Ir.prototype.has=Cr,Ir.prototype.set=Or;var jr=Ir;var Ar=function(e,t){var n=this.__data__;if(n instanceof Mn){var r=n.__data__;if(!or||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new jr(r)}return n.set(e,t),this.size=n.size,this};function Tr(e){var t=this.__data__=new Mn(e);this.size=t.size}Tr.prototype.clear=Un,Tr.prototype.delete=Vn,Tr.prototype.get=Bn,Tr.prototype.has=zn,Tr.prototype.set=Ar;var wr=Tr;var Lr=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e},kr=function(){try{var e=ar(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var _r=function(e,t,n){"__proto__"==t&&kr?kr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},xr=Object.prototype.hasOwnProperty;var Pr=function(e,t,n){var r=e[t];xr.call(e,t)&&kn(r,n)&&(void 0!==n||t in e)||_r(e,t,n)};var Nr=function(e,t,n,r){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;void 0===c&&(c=e[s]),i?_r(n,s,c):Pr(n,s,c)}return n};var Dr=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};var Rr=function(e){return Cn(e)&&"[object Arguments]"==bn(e)},Fr=Object.prototype,Mr=Fr.hasOwnProperty,Ur=Fr.propertyIsEnumerable,Vr=Rr(function(){return arguments}())?Rr:function(e){return Cn(e)&&Mr.call(e,"callee")&&!Ur.call(e,"callee")},Br=Array.isArray,zr=n(20),Hr=/^(?:0|[1-9]\d*)$/;var qr=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Hr.test(e))&&e>-1&&e%1==0&&e<t};var Jr=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},$r={};$r["[object Float32Array]"]=$r["[object Float64Array]"]=$r["[object Int8Array]"]=$r["[object Int16Array]"]=$r["[object Int32Array]"]=$r["[object Uint8Array]"]=$r["[object Uint8ClampedArray]"]=$r["[object Uint16Array]"]=$r["[object Uint32Array]"]=!0,$r["[object Arguments]"]=$r["[object Array]"]=$r["[object ArrayBuffer]"]=$r["[object Boolean]"]=$r["[object DataView]"]=$r["[object Date]"]=$r["[object Error]"]=$r["[object Function]"]=$r["[object Map]"]=$r["[object Number]"]=$r["[object Object]"]=$r["[object RegExp]"]=$r["[object Set]"]=$r["[object String]"]=$r["[object WeakMap]"]=!1;var Kr=function(e){return Cn(e)&&Jr(e.length)&&!!$r[bn(e)]};var Yr=function(e){return function(t){return e(t)}},Gr=n(10),Wr=Gr.a&&Gr.a.isTypedArray,Zr=Wr?Yr(Wr):Kr,Qr=Object.prototype.hasOwnProperty;var Xr=function(e,t){var n=Br(e),r=!n&&Vr(e),i=!n&&!r&&Object(zr.a)(e),a=!n&&!r&&!i&&Zr(e),o=n||r||i||a,s=o?Dr(e.length,String):[],c=s.length;for(var l in e)!t&&!Qr.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||qr(l,c))||s.push(l);return s},ei=Object.prototype;var ti=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ei)},ni=Sn(Object.keys,Object),ri=Object.prototype.hasOwnProperty;var ii=function(e){if(!ti(e))return ni(e);var t=[];for(var n in Object(e))ri.call(e,n)&&"constructor"!=n&&t.push(n);return t};var ai=function(e){return null!=e&&Jr(e.length)&&!Jn(e)};var oi=function(e){return ai(e)?Xr(e):ii(e)};var si=function(e,t){return e&&Nr(t,oi(t),e)};var ci=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},li=Object.prototype.hasOwnProperty;var ui=function(e){if(!Hn(e))return ci(e);var t=ti(e),n=[];for(var r in e)("constructor"!=r||!t&&li.call(e,r))&&n.push(r);return n};var pi=function(e){return ai(e)?Xr(e,!0):ui(e)};var fi=function(e,t){return e&&Nr(t,pi(t),e)},di=n(123);var mi=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var hi=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a};var gi=function(){return[]},yi=Object.prototype.propertyIsEnumerable,vi=Object.getOwnPropertySymbols,bi=vi?function(e){return null==e?[]:(e=Object(e),hi(vi(e),(function(t){return yi.call(e,t)})))}:gi;var Si=function(e,t){return Nr(e,bi(e),t)};var Ei=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},Ci=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ei(t,bi(e)),e=En(e);return t}:gi;var Oi=function(e,t){return Nr(e,Ci(e),t)};var Ii=function(e,t,n){var r=t(e);return Br(e)?r:Ei(r,n(e))};var ji=function(e){return Ii(e,oi,bi)};var Ai=function(e){return Ii(e,pi,Ci)},Ti=ar(ln.a,"DataView"),wi=ar(ln.a,"Promise"),Li=ar(ln.a,"Set"),ki=ar(ln.a,"WeakMap"),_i=Wn(Ti),xi=Wn(or),Pi=Wn(wi),Ni=Wn(Li),Di=Wn(ki),Ri=bn;(Ti&&"[object DataView]"!=Ri(new Ti(new ArrayBuffer(1)))||or&&"[object Map]"!=Ri(new or)||wi&&"[object Promise]"!=Ri(wi.resolve())||Li&&"[object Set]"!=Ri(new Li)||ki&&"[object WeakMap]"!=Ri(new ki))&&(Ri=function(e){var t=bn(e),n="[object Object]"==t?e.constructor:void 0,r=n?Wn(n):"";if(r)switch(r){case _i:return"[object DataView]";case xi:return"[object Map]";case Pi:return"[object Promise]";case Ni:return"[object Set]";case Di:return"[object WeakMap]"}return t});var Fi=Ri,Mi=Object.prototype.hasOwnProperty;var Ui=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Mi.call(e,"index")&&(n.index=e.index,n.input=e.input),n},Vi=ln.a.Uint8Array;var Bi=function(e){var t=new e.constructor(e.byteLength);return new Vi(t).set(new Vi(e)),t};var zi=function(e,t){var n=t?Bi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},Hi=/\w*$/;var qi=function(e){var t=new e.constructor(e.source,Hi.exec(e));return t.lastIndex=e.lastIndex,t},Ji=un?un.prototype:void 0,$i=Ji?Ji.valueOf:void 0;var Ki=function(e){return $i?Object($i.call(e)):{}};var Yi=function(e,t){var n=t?Bi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};var Gi=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return Bi(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return zi(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Yi(e,n);case"[object Map]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return qi(e);case"[object Set]":return new r;case"[object Symbol]":return Ki(e)}},Wi=Object.create,Zi=function(){function e(){}return function(t){if(!Hn(t))return{};if(Wi)return Wi(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Qi=function(e){return"function"!=typeof e.constructor||ti(e)?{}:Zi(En(e))};var Xi=function(e){return Cn(e)&&"[object Map]"==Fi(e)},ea=Gr.a&&Gr.a.isMap,ta=ea?Yr(ea):Xi;var na=function(e){return Cn(e)&&"[object Set]"==Fi(e)},ra=Gr.a&&Gr.a.isSet,ia=ra?Yr(ra):na,aa={};aa["[object Arguments]"]=aa["[object Array]"]=aa["[object ArrayBuffer]"]=aa["[object DataView]"]=aa["[object Boolean]"]=aa["[object Date]"]=aa["[object Float32Array]"]=aa["[object Float64Array]"]=aa["[object Int8Array]"]=aa["[object Int16Array]"]=aa["[object Int32Array]"]=aa["[object Map]"]=aa["[object Number]"]=aa["[object Object]"]=aa["[object RegExp]"]=aa["[object Set]"]=aa["[object String]"]=aa["[object Symbol]"]=aa["[object Uint8Array]"]=aa["[object Uint8ClampedArray]"]=aa["[object Uint16Array]"]=aa["[object Uint32Array]"]=!0,aa["[object Error]"]=aa["[object Function]"]=aa["[object WeakMap]"]=!1;var oa=function e(t,n,r,i,a,o){var s,c=1&n,l=2&n,u=4&n;if(r&&(s=a?r(t,i,a,o):r(t)),void 0!==s)return s;if(!Hn(t))return t;var p=Br(t);if(p){if(s=Ui(t),!c)return mi(t,s)}else{var f=Fi(t),d="[object Function]"==f||"[object GeneratorFunction]"==f;if(Object(zr.a)(t))return Object(di.a)(t,c);if("[object Object]"==f||"[object Arguments]"==f||d&&!a){if(s=l||d?{}:Qi(t),!c)return l?Oi(t,fi(s,t)):Si(t,si(s,t))}else{if(!aa[f])return a?t:{};s=Gi(t,f,c)}}o||(o=new wr);var m=o.get(t);if(m)return m;o.set(t,s),ia(t)?t.forEach((function(i){s.add(e(i,n,r,i,t,o))})):ta(t)&&t.forEach((function(i,a){s.set(a,e(i,n,r,a,t,o))}));var h=u?l?Ai:ji:l?keysIn:oi,g=p?void 0:h(t);return Lr(g||t,(function(i,a){g&&(i=t[a=i]),Pr(s,a,e(i,n,r,a,t,o))})),s};var sa=function(e){return oa(e,4)};var ca=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i};var la=function(e){return"symbol"==typeof e||Cn(e)&&"[object Symbol]"==bn(e)};function ua(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(ua.Cache||jr),n}ua.Cache=jr;var pa=ua;var fa=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,da=/\\(\\)?/g,ma=function(e){var t=pa(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(fa,(function(e,n,r,i){t.push(r?i.replace(da,"$1"):n||e)})),t}));var ha=function(e){if("string"==typeof e||la(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},ga=un?un.prototype:void 0,ya=ga?ga.toString:void 0;var va=function e(t){if("string"==typeof t)return t;if(Br(t))return ca(t,e)+"";if(la(t))return ya?ya.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};var ba=function(e){return null==e?"":va(e)};var Sa=function(e){return Br(e)?ca(e,ha):la(e)?[e]:mi(ma(ba(e)))};var Ea=function(e,t){},Ca=n(29),Oa=n(30),Ia=n.n(Oa);var ja=function(e){return oa(e,5)};function Aa(){return(Aa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Ta(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function wa(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function La(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var ka=function(e){return"function"==typeof e},_a=function(e){return null!==e&&"object"==typeof e},xa=function(e){return String(Math.floor(Number(e)))===e},Pa=function(e){return"[object String]"===Object.prototype.toString.call(e)},Na=function(e){return 0===d.Children.count(e)},Da=function(e){return _a(e)&&ka(e.then)};function Ra(e,t,n,r){void 0===r&&(r=0);for(var i=Sa(t);e&&r<i.length;)e=e[i[r++]];return void 0===e?n:e}function Fa(e,t,n){for(var r=sa(e),i=r,a=0,o=Sa(t);a<o.length-1;a++){var s=o[a],c=Ra(e,o.slice(0,a+1));if(c&&(_a(c)||Array.isArray(c)))i=i[s]=sa(c);else{var l=o[a+1];i=i[s]=xa(l)&&Number(l)>=0?[]:{}}}return(0===a?e:i)[o[a]]===n?e:(void 0===n?delete i[o[a]]:i[o[a]]=n,0===a&&void 0===n&&delete r[o[a]],r)}function Ma(e,t,n,r){void 0===n&&(n=new WeakMap),void 0===r&&(r={});for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],s=e[o];_a(s)?n.get(s)||(n.set(s,!0),r[o]=Array.isArray(s)?[]:{},Ma(s,t,n,r[o])):r[o]=t}return r}var Ua=Object(d.createContext)(void 0),Va=Ua.Provider,Ba=Ua.Consumer;function za(){var e=Object(d.useContext)(Ua);return e||Ea(!1),e}function Ha(e,t){switch(t.type){case"SET_VALUES":return Aa({},e,{values:t.payload});case"SET_TOUCHED":return Aa({},e,{touched:t.payload});case"SET_ERRORS":return Aa({},e,{errors:t.payload});case"SET_STATUS":return Aa({},e,{status:t.payload});case"SET_ISSUBMITTING":return Aa({},e,{isSubmitting:t.payload});case"SET_ISVALIDATING":return Aa({},e,{isValidating:t.payload});case"SET_FIELD_VALUE":return Aa({},e,{values:Fa(e.values,t.payload.field,t.payload.value)});case"SET_FIELD_TOUCHED":return Aa({},e,{touched:Fa(e.touched,t.payload.field,t.payload.value)});case"SET_FIELD_ERROR":return Aa({},e,{errors:Fa(e.errors,t.payload.field,t.payload.value)});case"RESET_FORM":return Aa({},e,t.payload);case"SET_FORMIK_STATE":return t.payload(e);case"SUBMIT_ATTEMPT":return Aa({},e,{touched:Ma(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return Aa({},e,{isSubmitting:!1});default:return e}}var qa={},Ja={};function $a(e){var t=e.validateOnChange,n=void 0===t||t,r=e.validateOnBlur,i=void 0===r||r,a=e.validateOnMount,o=void 0!==a&&a,s=e.isInitialValid,c=e.enableReinitialize,l=void 0!==c&&c,u=e.onSubmit,p=wa(e,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),f=Aa({validateOnChange:n,validateOnBlur:i,validateOnMount:o,onSubmit:u},p),m=Object(d.useRef)(f.initialValues),h=Object(d.useRef)(f.initialErrors||qa),g=Object(d.useRef)(f.initialTouched||Ja),y=Object(d.useRef)(f.initialStatus),v=Object(d.useRef)(!1),b=Object(d.useRef)({});Object(d.useEffect)((function(){0}),[]),Object(d.useEffect)((function(){return v.current=!0,function(){v.current=!1}}),[]);var S=Object(d.useReducer)(Ha,{values:f.initialValues,errors:f.initialErrors||qa,touched:f.initialTouched||Ja,status:f.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),E=S[0],C=S[1],O=Object(d.useCallback)((function(e,t){return new Promise((function(n,r){var i=f.validate(e,t);null==i?n(qa):Da(i)?i.then((function(e){n(e||qa)}),(function(e){r(e)})):n(i)}))}),[f.validate]),I=Object(d.useCallback)((function(e,t){var n=f.validationSchema,r=ka(n)?n(t):n,i=t&&r.validateAt?r.validateAt(t,e):function(e,t,n,r){void 0===n&&(n=!1);void 0===r&&(r={});var i=function e(t){var n={};for(var r in t)if(t.hasOwnProperty(r)){var i=String(r);!0===Array.isArray(t[i])?n[i]=t[i].map((function(t){return!0===Array.isArray(t)||wn(t)?e(t):""!==t?t:void 0})):wn(t[i])?n[i]=e(t[i]):n[i]=""!==t[i]?t[i]:void 0}return n}(e);return t[n?"validateSync":"validate"](i,{abortEarly:!1,context:r})}(e,r);return new Promise((function(e,t){i.then((function(){e(qa)}),(function(n){"ValidationError"===n.name?e(function(e){var t={};if(e.inner){if(0===e.inner.length)return Fa(t,e.path,e.message);var n=e.inner,r=Array.isArray(n),i=0;for(n=r?n:n[Symbol.iterator]();;){var a;if(r){if(i>=n.length)break;a=n[i++]}else{if((i=n.next()).done)break;a=i.value}var o=a;Ra(t,o.path)||(t=Fa(t,o.path,o.message))}}return t}(n)):t(n)}))}))}),[f.validationSchema]),j=Object(d.useCallback)((function(e,t){return new Promise((function(n){return n(b.current[e].validate(t))}))}),[]),A=Object(d.useCallback)((function(e){var t=Object.keys(b.current).filter((function(e){return ka(b.current[e].validate)})),n=t.length>0?t.map((function(t){return j(t,Ra(e,t))})):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(n).then((function(e){return e.reduce((function(e,n,r){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===n||n&&(e=Fa(e,t[r],n)),e}),{})}))}),[j]),T=Object(d.useCallback)((function(e){return Promise.all([A(e),f.validationSchema?I(e):{},f.validate?O(e):{}]).then((function(e){var t=e[0],n=e[1],r=e[2];return cn.all([t,n,r],{arrayMerge:Ya})}))}),[f.validate,f.validationSchema,A,O,I]),w=Wa((function(e){return void 0===e&&(e=E.values),Object(Ca.unstable_runWithPriority)(Ca.LowPriority,(function(){return T(e).then((function(e){return v.current&&C({type:"SET_ERRORS",payload:e}),e}))}))})),L=Wa((function(e){return void 0===e&&(e=E.values),C({type:"SET_ISVALIDATING",payload:!0}),T(e).then((function(e){return v.current&&(C({type:"SET_ISVALIDATING",payload:!1}),tn()(E.errors,e)||C({type:"SET_ERRORS",payload:e})),e}))}));Object(d.useEffect)((function(){o&&!0===v.current&&w(f.initialValues)}),[f.initialValues,o,w]);var k=Object(d.useCallback)((function(e){var t=e&&e.values?e.values:m.current,n=e&&e.errors?e.errors:h.current?h.current:f.initialErrors||{},r=e&&e.touched?e.touched:g.current?g.current:f.initialTouched||{},i=e&&e.status?e.status:y.current?y.current:f.initialStatus;m.current=t,h.current=n,g.current=r,y.current=i,C({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:n,touched:r,status:i,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})}),[f.initialErrors,f.initialStatus,f.initialTouched]);Object(d.useEffect)((function(){l&&!0===v.current&&!tn()(m.current,f.initialValues)&&(m.current=f.initialValues,k())}),[l,f.initialValues,k]),Object(d.useEffect)((function(){l&&!0===v.current&&!tn()(h.current,f.initialErrors)&&(h.current=f.initialErrors||qa,C({type:"SET_ERRORS",payload:f.initialErrors||qa}))}),[l,f.initialErrors]),Object(d.useEffect)((function(){l&&!0===v.current&&!tn()(g.current,f.initialTouched)&&(g.current=f.initialTouched||Ja,C({type:"SET_TOUCHED",payload:f.initialTouched||Ja}))}),[l,f.initialTouched]),Object(d.useEffect)((function(){l&&!0===v.current&&!tn()(y.current,f.initialStatus)&&(y.current=f.initialStatus,C({type:"SET_STATUS",payload:f.initialStatus}))}),[l,f.initialStatus,f.initialTouched]);var _=Wa((function(e){if(ka(b.current[e].validate)){var t=Ra(E.values,e),n=b.current[e].validate(t);return Da(n)?(C({type:"SET_ISVALIDATING",payload:!0}),n.then((function(e){return e})).then((function(t){C({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),C({type:"SET_ISVALIDATING",payload:!1})}))):(C({type:"SET_FIELD_ERROR",payload:{field:e,value:n}}),Promise.resolve(n))}return Promise.resolve()})),x=Object(d.useCallback)((function(e,t){var n=t.validate;b.current[e]={validate:n}}),[]),P=Object(d.useCallback)((function(e){delete b.current[e]}),[]),N=Wa((function(e){return C({type:"SET_TOUCHED",payload:e}),i?w(E.values):Promise.resolve()})),D=Object(d.useCallback)((function(e){C({type:"SET_ERRORS",payload:e})}),[]),R=Wa((function(e){return C({type:"SET_VALUES",payload:e}),n?w(e):Promise.resolve()})),F=Object(d.useCallback)((function(e,t){C({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})}),[]),M=Wa((function(e,t,r){return void 0===r&&(r=!0),C({type:"SET_FIELD_VALUE",payload:{field:e,value:t}}),n&&r?w(Fa(E.values,e,t)):Promise.resolve()})),U=Object(d.useCallback)((function(e,t){var n,r=t,i=e;if(!Pa(e)){e.persist&&e.persist();var a=e.target,o=a.type,s=a.name,c=a.id,l=a.value,u=a.checked,p=(a.outerHTML,a.options),f=a.multiple;r=t||(s||c),i=/number|range/.test(o)?(n=parseFloat(l),isNaN(n)?"":n):/checkbox/.test(o)?function(e,t,n){if("true"==n||"false"==n)return!!t;if(t&&n)return Array.isArray(e)?e.concat(n):[n];if(!Array.isArray(e))return!e;var r=e.indexOf(n);if(r<0)return e;return e.slice(0,r).concat(e.slice(r+1))}(Ra(E.values,r),u,l):f?function(e){return Array.from(e).filter((function(e){return e.selected})).map((function(e){return e.value}))}(p):l}r&&M(r,i)}),[M,E.values]),V=Object(d.useCallback)((function(e){if(Pa(e))return function(t){return U(t,e)};U(e)}),[U]),B=Wa((function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n=!0),C({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}}),i&&n?w(E.values):Promise.resolve()})),z=Object(d.useCallback)((function(e,t){e.persist&&e.persist();var n=e.target,r=n.name,i=n.id,a=(n.outerHTML,t||(r||i));B(a,!0)}),[B]),H=Object(d.useCallback)((function(e){if(Pa(e))return function(t){return z(t,e)};z(e)}),[z]),q=Object(d.useCallback)((function(e){ka(e)?C({type:"SET_FORMIK_STATE",payload:e}):C({type:"SET_FORMIK_STATE",payload:function(){return e}})}),[]),J=Object(d.useCallback)((function(e){C({type:"SET_STATUS",payload:e})}),[]),$=Object(d.useCallback)((function(e){C({type:"SET_ISSUBMITTING",payload:e})}),[]),K={resetForm:k,validateForm:L,validateField:_,setErrors:D,setFieldError:F,setFieldTouched:B,setFieldValue:M,setStatus:J,setSubmitting:$,setTouched:N,setValues:R,setFormikState:q},Y=Wa((function(){return u(E.values,K)})),G=Wa((function(){return C({type:"SUBMIT_ATTEMPT"}),L().then((function(e){if(0===Object.keys(e).length){var t=Y();if(void 0===t)return;return Promise.resolve(t).then((function(){v.current&&C({type:"SUBMIT_SUCCESS"})})).catch((function(e){if(v.current)throw C({type:"SUBMIT_FAILURE"}),e}))}v.current&&C({type:"SUBMIT_FAILURE"})}))})),W=Wa((function(e){e&&e.preventDefault&&ka(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&ka(e.stopPropagation)&&e.stopPropagation(),G()})),Z=Wa((function(e){if(e&&e.preventDefault&&ka(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&ka(e.stopPropagation)&&e.stopPropagation(),f.onReset){var t=f.onReset(E.values,K);Da(t)?t.then(k):k()}else k()})),Q=Object(d.useCallback)((function(e){return{value:Ra(E.values,e),error:Ra(E.errors,e),touched:!!Ra(E.touched,e),initialValue:Ra(m.current,e),initialTouched:!!Ra(g.current,e),initialError:Ra(h.current,e)}}),[E.errors,E.touched,E.values]),X=Object(d.useCallback)((function(e){var t=_a(e),n=t?e.name:e,r=Ra(E.values,n),i={name:n,value:r,onChange:V,onBlur:H};if(t){var a=e.type,o=e.value,s=e.as,c=e.multiple;"checkbox"===a?void 0===o?i.checked=!!r:(i.checked=!(!Array.isArray(r)||!~r.indexOf(o)),i.value=o):"radio"===a?(i.checked=r===o,i.value=o):"select"===s&&c&&(i.value=i.value||[],i.multiple=!0)}return i}),[H,V,E.values]),ee=Object(d.useMemo)((function(){return!tn()(m.current,E.values)}),[E.values]),te=Object(d.useMemo)((function(){return void 0!==s?ee?E.errors&&0===Object.keys(E.errors).length:!1!==s&&ka(s)?s(f):s:E.errors&&0===Object.keys(E.errors).length}),[s,ee,E.errors,f]);return Aa({},E,{initialValues:m.current,initialErrors:h.current,initialTouched:g.current,initialStatus:y.current,handleBlur:H,handleChange:V,handleReset:Z,handleSubmit:W,resetForm:k,setErrors:D,setFormikState:q,setFieldTouched:B,setFieldValue:M,setFieldError:F,setStatus:J,setSubmitting:$,setTouched:N,setValues:R,submitForm:G,validateForm:L,validateField:_,isValid:te,dirty:ee,unregisterField:P,registerField:x,getFieldProps:X,getFieldMeta:Q,validateOnBlur:i,validateOnChange:n,validateOnMount:o})}function Ka(e){var t=$a(e),n=e.component,r=e.children,i=e.render;return Object(d.useEffect)((function(){0}),[]),Object(d.createElement)(Va,{value:t},n?Object(d.createElement)(n,t):i?i(t):r?ka(r)?r(t):Na(r)?null:d.Children.only(r):null)}function Ya(e,t,n){var r=e.slice();return t.forEach((function(t,i){if(void 0===r[i]){var a=!1!==n.clone&&n.isMergeableObject(t);r[i]=a?cn(Array.isArray(t)?[]:{},t,n):t}else n.isMergeableObject(t)?r[i]=cn(e[i],t,n):-1===e.indexOf(t)&&r.push(t)})),r}var Ga="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?d.useLayoutEffect:d.useEffect;function Wa(e){var t=Object(d.useRef)(e);return Ga((function(){t.current=e})),Object(d.useCallback)((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.current.apply(void 0,n)}),[])}function Za(e){var t=e.validate,n=e.name,r=e.render,i=e.children,a=e.as,o=e.component,s=wa(e,["validate","name","render","children","as","component"]),c=za(),l=(c.validate,c.validationSchema,wa(c,["validate","validationSchema"]));Object(d.useEffect)((function(){0}),[]);var u=l.registerField,p=l.unregisterField;Object(d.useEffect)((function(){return u(n,{validate:t}),function(){p(n)}}),[u,p,n,t]);var f=l.getFieldProps(Aa({name:n},s)),m=l.getFieldMeta(n),h={field:f,form:l};if(r)return r(Aa({},h,{meta:m}));if(ka(i))return i(Aa({},h,{meta:m}));if(o){if("string"==typeof o){var g=s.innerRef,y=wa(s,["innerRef"]);return Object(d.createElement)(o,Aa({ref:g},f,y),i)}return Object(d.createElement)(o,Aa({field:f,form:l},s),i)}var v=a||"input";if("string"==typeof v){var b=s.innerRef,S=wa(s,["innerRef"]);return Object(d.createElement)(v,Aa({ref:b},f,S),i)}return Object(d.createElement)(v,Aa({},f,s),i)}var Qa=Object(d.forwardRef)((function(e,t){var n=e.action,r=wa(e,["action"]),i=n||"#",a=za(),o=a.handleReset,s=a.handleSubmit;return Object(d.createElement)("form",Object.assign({onSubmit:s,ref:t,onReset:o,action:i},r))}));function Xa(e){var t=function(t){return Object(d.createElement)(Ba,null,(function(n){return n||Ea(!1),Object(d.createElement)(e,Object.assign({},t,{formik:n}))}))},n=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return t.WrappedComponent=e,t.displayName="FormikConnect("+n+")",Ia()(t,e)}Qa.displayName="Form";var eo=function(e,t,n){var r=to(e);return r.splice(t,0,n),r},to=function(e){if(e){if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map((function(e){return parseInt(e)})).reduce((function(e,t){return t>e?t:e}),0);return Array.from(Aa({},e,{length:t+1}))}return[]},no=function(e){function t(t){var n;return(n=e.call(this,t)||this).updateArrayField=function(e,t,r){var i=n.props,a=i.name,o=i.validateOnChange,s=i.formik,c=s.setFormikState,l=s.validateForm;c((function(n){var i="function"==typeof r?r:e,o="function"==typeof t?t:e;return Aa({},n,{values:Fa(n.values,a,e(Ra(n.values,a))),errors:r?Fa(n.errors,a,i(Ra(n.errors,a))):n.errors,touched:t?Fa(n.touched,a,o(Ra(n.touched,a))):n.touched})}),(function(){o&&l()}))},n.push=function(e){return n.updateArrayField((function(t){return[].concat(to(t),[ja(e)])}),!1,!1)},n.handlePush=function(e){return function(){return n.push(e)}},n.swap=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=to(e),i=r[t];return r[t]=r[n],r[n]=i,r}(n,e,t)}),!0,!0)},n.handleSwap=function(e,t){return function(){return n.swap(e,t)}},n.move=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=to(e),i=r[t];return r.splice(t,1),r.splice(n,0,i),r}(n,e,t)}),!0,!0)},n.handleMove=function(e,t){return function(){return n.move(e,t)}},n.insert=function(e,t){return n.updateArrayField((function(n){return eo(n,e,t)}),(function(t){return eo(t,e,null)}),(function(t){return eo(t,e,null)}))},n.handleInsert=function(e,t){return function(){return n.insert(e,t)}},n.replace=function(e,t){return n.updateArrayField((function(n){return function(e,t,n){var r=to(e);return r[t]=n,r}(n,e,t)}),!1,!1)},n.handleReplace=function(e,t){return function(){return n.replace(e,t)}},n.unshift=function(e){var t=-1;return n.updateArrayField((function(n){var r=n?[e].concat(n):[e];return t<0&&(t=r.length),r}),(function(e){var n=e?[null].concat(e):[null];return t<0&&(t=n.length),n}),(function(e){var n=e?[null].concat(e):[null];return t<0&&(t=n.length),n})),t},n.handleUnshift=function(e){return function(){return n.unshift(e)}},n.handleRemove=function(e){return function(){return n.remove(e)}},n.handlePop=function(){return function(){return n.pop()}},n.remove=n.remove.bind(La(n)),n.pop=n.pop.bind(La(n)),n}Ta(t,e);var n=t.prototype;return n.remove=function(e){var t;return this.updateArrayField((function(n){var r=n?to(n):[];return t||(t=r[e]),ka(r.splice)&&r.splice(e,1),r}),!0,!0),t},n.pop=function(){var e;return this.updateArrayField((function(t){var n=t;return e||(e=n&&n.pop&&n.pop()),n}),!0,!0),e},n.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},t=this.props,n=t.component,r=t.render,i=t.children,a=t.name,o=t.formik,s=(o.validate,o.validationSchema,Aa({},e,{form:wa(o,["validate","validationSchema"]),name:a}));return n?Object(d.createElement)(n,s):r?r(s):i?"function"==typeof i?i(s):Na(i)?null:d.Children.only(i):null},t}(d.Component);no.defaultProps={validateOnChange:!0};var ro=Xa(function(e){function t(){return e.apply(this,arguments)||this}Ta(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return Ra(this.props.formik.errors,this.props.name)!==Ra(e.formik.errors,this.props.name)||Ra(this.props.formik.touched,this.props.name)!==Ra(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},n.render=function(){var e=this.props,t=e.component,n=e.formik,r=e.render,i=e.children,a=e.name,o=wa(e,["component","formik","render","children","name"]),s=Ra(n.touched,a),c=Ra(n.errors,a);return s&&c?r?ka(r)?r(c):null:i?ka(i)?i(c):null:t?Object(d.createElement)(t,o,c):c:null},t}(d.Component));(function(e){function t(t){var n;n=e.call(this,t)||this;var r=t.render,i=t.children,a=t.component,o=t.as;t.name;return r&&Ea(!1),a&&r&&Ea(!1),o&&i&&ka(i)&&Ea(!1),a&&i&&ka(i)&&Ea(!1),r&&i&&!Na(i)&&Ea(!1),n}Ta(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e,t,n){return this.props.shouldUpdate?this.props.shouldUpdate(e,this.props):Ra(this.context.values,this.props.name)!==Ra(n.values,this.props.name)||Ra(this.context.errors,this.props.name)!==Ra(n.errors,this.props.name)||Ra(this.context.touched,this.props.name)!==Ra(n.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length||this.context.isSubmitting!==n.isSubmitting},n.componentDidMount=function(){this.context.registerField(this.props.name,{validate:this.props.validate})},n.componentDidUpdate=function(e){this.props.name!==e.name&&(this.context.unregisterField(e.name),this.context.registerField(this.props.name,{validate:this.props.validate})),this.props.validate!==e.validate&&this.context.registerField(this.props.name,{validate:this.props.validate})},n.componentWillUnmount=function(){this.context.unregisterField(this.props.name)},n.render=function(){var e=this.props,t=(e.validate,e.name),n=e.render,r=e.as,i=e.children,a=e.component,o=(e.shouldUpdate,wa(e,["validate","name","render","as","children","component","shouldUpdate"])),s=this.context,c=(s.validate,s.validationSchema,wa(s,["validate","validationSchema"])),l={value:"radio"===o.type||"checkbox"===o.type?o.value:Ra(s.values,t),name:t,onChange:s.handleChange,onBlur:s.handleBlur},u={field:l,meta:{value:Ra(s.values,t),error:Ra(s.errors,t),touched:!!Ra(s.touched,t),initialValue:Ra(s.initialValues,t),initialTouched:!!Ra(s.initialTouched,t),initialError:Ra(s.initialErrors,t)},form:c};if(n)return n(u);if(ka(i))return i(u);if(a){if("string"==typeof a){var p=o.innerRef,f=wa(o,["innerRef"]);return Object(d.createElement)(a,Aa({ref:p},l,f),i)}return Object(d.createElement)(a,Aa({field:l,form:s},o),i)}var m=r||"input";if("string"==typeof m){var h=o.innerRef,g=wa(o,["innerRef"]);return Object(d.createElement)(m,Aa({ref:h},l,g),i)}return Object(d.createElement)(m,Aa({},l,o),i)},t}(d.Component)).contextType=Ua;var io=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 ao(e){const{castInitialValues:t,castValuesOnSubmit:n,initialValues:r,onSubmit:i,resetOnSubmit:a}=e,o=io(e,["castInitialValues","castValuesOnSubmit","initialValues","onSubmit","resetOnSubmit"]),s=t&&e.validationSchema?e.validationSchema.cast(function e(t){const n=pt.deepClone(t);return Object.keys(n).forEach(t=>{n.hasOwnProperty(t)&&(pt.isObject(n[t])?n[t]=e(n[t]):null===n[t]&&delete n[t])}),n}(r)):r,c={allowInitialSubmit:e.allowInitialSubmit};return d.createElement(Ka,Object.assign({enableReinitialize:!0},o,{initialValues:s,onSubmit:(t,{setSubmitting:r,resetForm:o})=>{const s=n&&e.validationSchema?e.validationSchema.cast(t):t;i(s,()=>{a&&o(),r(!1)})},initialStatus:c}),X.isFunction(e.children)?t=>e.children(t):d.Children.count(e.children)?e.children:null)}ao.defaultProps={castInitialValues:!0,castValuesOnSubmit:!0};var oo=n(2),so=oo.object().shape({name:oo.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),co=n(3);const lo={getCustomFormControlClassName(e,t,n,r){let i="form-control";return Ra(t,n)&&Ra(e,n)&&(i+=" is-invalid"),r&&(i+=" "+r),i}};function uo(e){const{values:t}=za(),n=t[e.fieldName];return"string"!=typeof n?d.createElement(d.Fragment,null):d.createElement("div",{className:"float-right text-muted"},n.length,"/",e.limit)}var po=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 fo(e){const{label:t}=e,n=po(e,["label"]);return d.createElement(co.Form.Group,null,d.createElement("div",{className:"custom-control custom-checkbox"},d.createElement(ho,Object.assign({className:"custom-control-input"},n)),d.createElement(co.Form.Label,{className:"custom-control-label",htmlFor:n.id},t)))}var mo=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 ho(e){const{children:t}=e,n=mo(e,["children"]);return d.createElement(Za,Object.assign({},n),X.isFunction(t)?e=>t(e):d.Children.count(t)?t:null)}function go(e){const{label:t,className:n,showCharacterCounter:r}=e,i=mo(e,["label","className","showCharacterCounter"]),{errors:a,touched:o}=za();return"checkbox"===i.type?d.createElement(fo,Object.assign({},e)):d.createElement(co.Form.Group,null,!!t&&d.createElement(co.Form.Label,{htmlFor:i.id},t),d.createElement(ho,Object.assign({className:lo.getCustomFormControlClassName(a,o,i.name,n)},i)),!!r&&!!i.maxLength&&d.createElement(uo,{fieldName:i.name,limit:i.maxLength}),d.createElement(ro,{name:i.name},e=>d.createElement(co.Form.Control.Feedback,{type:"invalid"},e)))}function yo(e){var t;const[n,r]=d.useState(!1);return d.useEffect(()=>{var t;e.isValid&&(e.dirty||(null===(t=e.initialStatus)||void 0===t?void 0:t.allowInitialSubmit))?r(!0):r(!1)},[e.isValid,null===(t=e.initialStatus)||void 0===t?void 0:t.allowInitialSubmit,e.dirty,e.values]),d.useEffect(()=>{e.isSubmitting&&r(!1)},[e.isSubmitting]),n}var vo=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 bo(e){const{showSpinner:t,children:n}=e,r=vo(e,["showSpinner","children"]),i=d.useRef(),[a,o]=d.useState({});return d.useEffect(()=>{const{width:e,height:t}=a;if(e&&t)return;const n=i.current,r=n.offsetHeight,s=n.offsetWidth;r&&s&&o({width:s,height:r})}),d.useEffect(()=>{const{width:e,height:t}=a;if(!e||!t)return;const n=i.current;n.style.width=e+1+"px",n.style.height=t+1+"px"},[a]),d.createElement(co.Button,Object.assign({ref:i,disabled:t},r),t?d.createElement(co.Spinner,{as:"span",animation:"border",role:"status",size:"sm"}):n)}var So=n(124),Eo=n(21);const Co="AlertService",Oo="LanguageService";const Io=class extends G{static get Instance(){return this.instance||(this.instance=new this)}get name(){return Oo}setConfig(e){this.polyglot=new So({locale:e.locale,phrases:e.phrases.rootElement||e.phrases}),this.cache={}}getPhrase(e,t,n){const r=`${e}.${t}`;if(this.polyglot||x.throw(new B("LanguageService config must be set.")),!this.polyglot.has(r)){if(!w.isDevelopment){const e=window.trackJs;return e&&e.console.error(`No phrase set for ${r} in language config`),""}x.throw(new B(`No phrase set for ${r} in language config.`))}if(!n||m.isEmpty(n)){const e=this.cache[r];if(e)return e;const t=this.polyglot.t(r);return this.cache[r]=t,t}const i=m.omit(n,"smartCount");let a={};for(let e in i)a[e]=Eo.sanitize(i[e]);m.isNumber(n.smartCount)&&(a.smart_count=n.smartCount);const o=`${r}:${m.values(Object.assign({},a)).join(":")}`,s=this.cache[o];if(s)return s;const c=this.polyglot.t(r,a);return this.cache[o]=c,c}encloseNamespace(e){return(t,n)=>this.getPhrase(e,t,n)}}.Instance,jo=d.createContext(""),Ao=d.memo((function(e){const{phrase:t,namespace:n,options:r}=e,i=d.useContext(jo),a=n||i,o=Io.getPhrase(a,t,r);return d.createElement("span",{dangerouslySetInnerHTML:{__html:o}})}),(e,t)=>e.namespace===t.namespace&&e.phrase===t.phrase&&pt.isEqual(e.options,t.options));function To(e){const t=za(),n=yo(t);d.useEffect(()=>{function e(e){13===e.keyCode&&n&&t.validateForm().then(e=>{Object.keys(e).length||t.submitForm()})}return window.addEventListener("keypress",e),()=>window.removeEventListener("keypress",e)},[n]);let r="save";return e.isNew&&(r="create"),e.hasNext&&(r="next"),d.createElement(bo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},d.createElement(Ao,{namespace:"shared.formButtons",phrase:r}))}function wo(e){var t=za();return d.createElement(Qa,null,d.createElement(go,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this company",autoFocus:!0}),d.createElement(To,{isNew:e.isNew}))}function Lo(e){return d.createElement(ao,{initialValues:e.company,validationSchema:so,onSubmit:e.saveCompany},d.createElement(wo,{isNew:!(e.company&&e.company.id)}))}function ko(e){var t=Object(te.useDispatch)(),n=i.useBasicFetch(Zt(e.id));return d.createElement(d.Fragment,null,!!n.data&&d.createElement(Lo,{company:n.data,saveCompany:function(n,r){return i.fetch(t,Xt(e.id,n,r))}}))}function _o(){var e=Object(te.useDispatch)();return d.createElement(Lo,{saveCompany:function(t,n){i.fetch(e,Qt(t,(function(e){n(),r.AppLinkHelper.trigger({application:u.PEOPLE,action:o.Companies.EDIT_COMPANY,args:[e.id]})}),n))}})}var xo,Po=n(125);!function(e){e.XS="(max-width: 575px)",e.SM="(min-width: 576px) and (max-width: 767px)",e.MD="(min-width: 768px) and (max-width: 991px)",e.LG="(min-width: 992px)",e.XL="(min-width: 1200px)",e.XXL="(min-width: 1440px)",e.SMDown="(max-width: 576px)",e.MDDown="(max-width: 768px)"}(xo||(xo={}));const No={isNumber:e=>No.isType(e,"number"),isString:e=>No.isType(e,"string"),isType:(e,t)=>typeof e===t};var Do,Ro=n(14),Fo=n.n(Ro);function Mo(e,t){return pt.isObject(e)&&e.hasOwnProperty(t)&&No.isString(e[t])}function Uo(e,t,n){return({value:r})=>{if(r.length||n(),!(r.length<e.activationLength)){if(e.local){const n=X.isFunction(e.getLocalSuggestions)?e.getLocalSuggestions(r,e.local):function(e,t,n){const r=e.trim().toLowerCase();return r.length?t.filter(e=>!(!Mo(e,n)||!No.isString(e[n]))&&e[n].trim().toLowerCase().includes(r)):[]}(r,e.local,e.valueKey);t(e=>Object.assign(Object.assign({},e),{[Do.Local]:n}))}e.getRemoteUrl&&function(e,t,n){const r=X.isFunction(e)&&e(t);r&&i.ajaxRequest({resource:r,type:nt.GET,success:n,error:()=>{}})}(e.getRemoteUrl,r,n=>t(t=>Object.assign(Object.assign({},t),{[Do.Remote]:X.isFunction(e.formatRemoteSuggestions)?e.formatRemoteSuggestions(n):n})))}}}function Vo(e,t,n,r,i,a){const o=t=>e[t]||[],s=t?o(Do.Recent):[],c=o(Do.Local),l=o(Do.Remote);let u=[];s.length&&u.push({title:n,data:s});const p=[...c,...l];return Number.isInteger(a)&&u.length>a&&p.slice(0,a),X.isFunction(i)?u.push(...i(p)):u.push({title:r,data:p}),u}function Bo(e){return e.data}function zo(e){if(e.title)return d.createElement("strong",null,e.title)}!function(e){e.Local="local",e.Recent="recent",e.Remote="remote"}(Do||(Do={}));const Ho={container:"position-relative",suggestionsContainerOpen:"bg-white py-1 border rounded "+Fo.a.suggestionsContainerOpen,suggestionsList:"list-unstyled m-0",suggestion:"cursor-pointer py-1 px-2",suggestionHighlighted:Fo.a.suggestionHighlighted,sectionContainer:"border-bottom py-1 "+Fo.a.sectionContainer};function qo(e={}){return Object.assign(Ho,e)}var Jo=n(15),$o=n(32),Ko=n.n($o),Yo=n(33),Go=n.n(Yo),Wo=n(34),Zo=n.n(Wo),Qo=n(35),Xo=n.n(Qo),es=(n(36),n(37),n(38)),ts=n.n(es),ns=n(39),rs=n.n(ns),is=n(40),as=n.n(is),os=n(41),ss=n.n(os),cs=n(42),ls=n.n(cs),us=n(43),ps=n.n(us),fs=n(44),ds=n.n(fs),ms=n(45),hs=n.n(ms),gs=n(46),ys=n.n(gs),vs=n(47),bs=n.n(vs),Ss=n(48),Es=n.n(Ss),Cs=n(49),Os=n.n(Cs),Is=n(50),js=n.n(Is),As=n(51),Ts=n.n(As),ws=n(52),Ls=n.n(ws),ks=n(53),_s=n.n(ks),xs=n(54),Ps=n.n(xs),Ns=n(55),Ds=n.n(Ns),Rs=n(56),Fs=n.n(Rs),Ms=n(57),Us=n.n(Ms),Vs=(n(58),n(59)),Bs=n.n(Vs),zs=n(60),Hs=n.n(zs),qs=n(61),Js=n.n(qs),$s=(n(62),n(63),n(64)),Ks=n.n($s),Ys=n(65),Gs=n.n(Ys),Ws=n(66),Zs=n.n(Ws),Qs=n(67),Xs=n.n(Qs),ec=n(68),tc=n.n(ec),nc=n(69),rc=n.n(nc),ic=(n(70),n(71)),ac=n.n(ic),oc=n(72),sc=n.n(oc),cc=n(73),lc=n.n(cc),uc=n(74),pc=n.n(uc),fc=n(75),dc=n.n(fc),mc=n(76),hc=n.n(mc),gc=n(77),yc=n.n(gc),vc=(n(78),n(79)),bc=n.n(vc),Sc=n(80),Ec=n.n(Sc),Cc=n(81),Oc=n.n(Cc),Ic=n(82),jc=n.n(Ic),Ac=n(83),Tc=n.n(Ac),wc=n(84),Lc=n.n(wc),kc=n(85),_c=n.n(kc),xc=n(86),Pc=n.n(xc),Nc=n(87),Dc=n.n(Nc),Rc=n(88),Fc=n.n(Rc),Mc=n(89),Uc=n.n(Mc),Vc=n(90),Bc=n.n(Vc),zc=n(91),Hc=n.n(zc),qc=(n(92),n(93),n(94),n(95)),Jc=n.n(qc),$c=(n(96),n(97),n(98),n(99),n(100)),Kc=n.n($c),Yc=n(101),Gc=n.n(Yc),Wc=(n(102),n(103),n(104),n(105)),Zc=n.n(Wc),Qc=n(106),Xc=n.n(Qc),el=n(107),tl=n.n(el),nl=n(108),rl=n.n(nl),il=n(109),al=n.n(il),ol=n(110),sl=n.n(ol),cl=n(111),ll=n.n(cl),ul=(n(112),n(113),n(114),n(115)),pl=n.n(ul),fl=n(116),dl=n.n(fl);const ml=[Ko.a,Zo.a,Xo.a,ts.a,ss.a,ls.a,ps.a,ds.a,as.a,Go.a,hs.a,ys.a,bs.a,Es.a,Os.a,rs.a,js.a,Ts.a,Ls.a,Us.a,_s.a,Ps.a,Ds.a,Fs.a,Bs.a,Zs.a,_c.a,Dc.a,Pc.a,Hc.a,Fc.a,Uc.a,Bc.a,pc.a,hc.a,dc.a,Hs.a,Js.a,sc.a,lc.a,ac.a,Ks.a,Xs.a,Ec.a,Oc.a,tc.a,rc.a,jc.a,Gs.a,bc.a,Tc.a,Lc.a,yc.a,Kc.a,Gc.a,Jc.a,tl.a,Xc.a,Zc.a,rl.a,sl.a,al.a,ll.a,dl.a,pl.a];var hl;!function(e){e.AddToPlaylists="add-to-playlist",e.Caret="caret",e.Delete="delete",e.Edit="edit",e.NoEdit="no-edit",e.Close="close",e.Folder="folder",e.Resources="resources",e.More="more",e.Bell="bell",e.Plus="plus",e.Search="search",e.Share="share",e.Upload="upload",e.Preview="preview",e.CircleCheck="circle-check",e.Down="down",e.Right="right",e.UpDown="up-down",e.ChevronUp="chevron-up",e.ChevronDown="chevron-down",e.ChevronLeft="chevron-left",e.ChevronRight="chevron-right",e.VisibleOff="visible-off",e.VisibleOn="visible-on",e.PublisherArchive="publisher-archive",e.Play="play",e.PlayCircle="play-circle",e.ArrowLeft="arrow-left",e.CheckCircleOutline="check-circle-o",e.CheckCircle="check-circle",e.Check="check",e.Lock="lock",e.Link="link",e.Info="info",e.Question="question",e.Star="star",e.StarOutline="star-o",e.Archive="archive",e.Warning="warning",e.WarningOutline="warning-o",e.NewWindow="new-window",e.File="file",e.FilePDF="file-pdf",e.FileExcel="file-excel",e.FilePowerpoint="file-ppt",e.FileWord="file-word",e.FileImg="file-img",e.FileZip="file-zip",e.Enter="enter",e.Calendar="calendar",e.CloseCaption="close-caption",e.CloseCaptionBadge="close-caption-badge",e.Playlist="playlist",e.Handle="handle",e.Subject="subject",e.Series="series",e.EditClickView="edit-clickview",e.Heart="heart",e.HeartOutline="heart-outline",e.WhiteWave="white-wave",e.Cog="cog",e.Video="video",e.Compass="compass",e.History="history",e.Tag="tag"}(hl||(hl={}));m.extend(Jo.config,{autoReplaceSvg:!1,autoAddCss:!1,familyPrefix:"cv",autoA11y:!0,observeMutations:!1,replacementClass:"cv-svg",keepOriginalSource:!1}),Jo.library.add(...ml);const gl="cv";const yl=class{constructor(){}static get Instance(){return this.instance||(this.instance=new this)}getSvg(e,t={}){const n=this.faIconLookup(e,t),r=this.getIcon(n,t);if(r&&(!r||r.html.length))return r.html.pop()}getIcon(e,t){return Jo.icon(e,t.iconOptions||{})}faIconLookup(e,t){let{prefix:n=gl}=t;return Jo.findIconDefinition({prefix:n,iconName:e})}}.Instance,vl=hl,bl={getRandomInt:(e=1e4)=>Math.floor(Math.random()*Math.floor(e))};function Sl(e){const{title:t,placement:n,trigger:r,children:i}=e;return d.createElement(co.OverlayTrigger,{placement:n,overlay:d.createElement(co.Tooltip,{id:`${t}-${bl.getRandomInt()}`},t),trigger:r},d.createElement("span",null,i))}Sl.defaultProps={trigger:["hover","click","focus"],placement:"top"};const El="d-inline-block svg-container",Cl="span";var Ol;function Il(e){const{svgName:t,className:n=El,tagName:r=Cl,size:i=Ol.Standard,onClick:a,title:o,tooltipPlacement:s="right"}=e,c=r,l={dangerouslySetInnerHTML:{__html:yl.getSvg(t)},className:`${n} ${i}`,onClick:X.isFunction(a)?a:null};return o?d.createElement(Sl,{title:o,placement:s},d.createElement(c,Object.assign({},l))):d.createElement(c,Object.assign({},l))}!function(e){e.Standard="std",e.Small="sm",e.Medium="md",e.Large="lg",e.ExtraLarge="xlg"}(Ol||(Ol={}));var jl=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};const Al=e=>{const t="d-inline-block svg-container";return X.isFunction(e)?t+" cursor-pointer":t};function Tl(e){const{onClickSearchIcon:t,searchIconPlacement:n,className:r}=e,i=jl(e,["onClickSearchIcon","searchIconPlacement","className"]);let a="form-control "+Fo.a.input,o="input-group-text bg-white";"right"===n&&(a+=" border-right-0",o+=" pl-0"),"left"===n&&(a+=" border-left-0",o+=" pr-0"),r&&(a+=" "+r);const s=()=>d.createElement("div",{className:o},d.createElement(Il,{svgName:vl.Search,size:Ol.Small,onClick:t,className:Al(t)}));return d.createElement("div",{className:"input-group"},"left"===n&&d.createElement("div",{className:"input-group-prepend"},d.createElement(s,null)),d.createElement("input",Object.assign({className:a},i)),"right"===n&&d.createElement("div",{className:"input-group-append"},d.createElement(s,null)))}const wl=X.isFunction;function Ll(e){const t=(n=e.initialSuggestions,r=e.recentSearches,{[Do.Recent]:r,[Do.Local]:n,[Do.Remote]:[]});var n,r;const[i,a]=d.useState(e.initialQuery||""),[o,s]=d.useState(t),c=function(e){const[t,n]=Object(d.useState)(window.matchMedia(e).matches);return Object(d.useEffect)(()=>{const r=window.matchMedia(e);r.matches!==t&&n(r.matches);const i=()=>n(r.matches);return r.addListener(i),()=>r.removeListener(i)},[e]),t}(xo.XS),l=()=>{s(t)},u=t=>{t.preventDefault(),wl(e.onSubmit)&&e.onSubmit(i)};return d.createElement("form",{onSubmit:u},d.createElement(Po,{suggestions:Vo(o,!i,e.recentSearchHeading||Io.getPhrase("shared.searchBar","recentSearchHeading"),e.suggestionsHeading,e.getSections,e.suggestionLimit),onSuggestionsFetchRequested:Uo(e,s,l),onSuggestionsClearRequested:()=>{e.alwaysRenderSuggestions||l()},onSuggestionSelected:(t,{suggestion:n})=>{e.clearQueryOnSelect&&a(""),e.onSuggestionSelected(n)},getSuggestionValue:t=>e.updateQueryOnSelection?function(e,t){return Mo(t,e)?t[e]:""}(e.valueKey,t):i,renderSuggestion:t=>wl(e.getSuggestionComponent)?e.getSuggestionComponent(t):function(e,t){return Mo(t,e)?d.createElement(d.Fragment,null,t[e]):d.createElement(d.Fragment,null)}(e.valueKey,t),alwaysRenderSuggestions:e.alwaysRenderSuggestions,focusInputOnSuggestionClick:!c,inputProps:{placeholder:e.placeholder||Io.getPhrase("shared.searchBar","placeholder"),value:i,onChange:(t,{newValue:n})=>{a(n),wl(e.onQueryChange)&&e.onQueryChange(n)},onKeyDown:t=>{8===t.keyCode&&e.onBackspace&&!i&&e.onBackspace()},autoFocus:!!e.autoFocusInput,onClickSearchIcon:!!e.submitOnClickSearchIcon&&u,searchIconPlacement:e.searchIconPlacement},renderInputComponent:Tl,theme:qo(e.theme),multiSection:!0,renderSectionTitle:zo,getSectionSuggestions:Bo}))}function kl(e){const{appLink:t,className:n,children:i,tag:a="a"}=e;if(!t)return d.createElement("span",{className:n||""},i);let o=e.onClick;o||(o=e=>{e.preventDefault(),r.AppLinkHelper.trigger(t)});const s={onClick:o,href:r.AppLinkHelper.getHref(t),className:n};return d.createElement(a,Object.assign({},s),i)}function _l(e){var t=e.backToName,n=e.appLink;return d.createElement(kl,{appLink:n,className:"d-inline-flex align-items-center"},d.createElement(Il,{svgName:vl.ArrowLeft,size:Ol.Small}),d.createElement("span",{className:"ml-1"},"Back to ".concat(t)))}function xl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Pl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pl(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Ll.defaultProps={updateQueryOnSelection:!0,valueKey:"name",activationLength:3,suggestionLimit:5,recentSearches:[],initialSuggestions:[],searchIconPlacement:"right"};var Nl=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 Dl(e){var t=e.selected,n=e.onToggle,r=Nl(e,["selected","onToggle"]),i=xl(d.useState(t),2),a=i[0],o=i[1];d.useEffect((function(){return o(t)}),[t]);return d.createElement(co.Form.Check,Object.assign({type:"checkbox",id:"checkbox-".concat(bl.getRandomInt()),checked:a,onChange:function(){o(!a),n(!a)}},r))}var Rl,Fl,Ml,Ul,Vl=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 Bl(e){var t=e.onFileSelect,n=e.acceptMultiple,r=e.mimeType,i=e.label,a=e.error,o=e.touched,s=Vl(e,["onFileSelect","acceptMultiple","mimeType","label","error","touched"]),c="custom-file-input cursor-pointer";a&&o&&(c+=" is-invalid");var l=Object.assign({type:"file",className:c,onChange:function(e){var n=e.currentTarget.files;n&&n.length&&X.isFunction(t)&&t(n)},autoComplete:"off",value:"",multiple:!!n},r?{accept:r}:{});return d.createElement("div",{className:"form-group"},d.createElement("div",{className:"custom-file"},d.createElement(Za,Object.assign({},l,s),e.children),d.createElement(co.Form.Label,{className:"custom-file-label",htmlFor:s.id},i)))}!function(e){e.Small="small",e.Medium="medium",e.Large="large"}(Rl||(Rl={})),function(e){e[e.Thumbnails=0]="Thumbnails",e[e.Banners=1]="Banners",e[e.Avatars=2]="Avatars",e[e.Logos=3]="Logos",e[e.Covers=4]="Covers",e[e.Posters=5]="Posters",e[e.TallPosters=6]="TallPosters",e[e.HeroBanners=7]="HeroBanners"}(Fl||(Fl={})),function(e){e[e.Crop=0]="Crop",e[e.Stretched=1]="Stretched",e[e.Cover=2]="Cover"}(Ml||(Ml={})),function(e){e[e.None=0]="None",e[e.ImageAPIv1=1]="ImageAPIv1",e[e.FileAPIv1=2]="FileAPIv1",e[e.ImageAPIv2=3]="ImageAPIv2"}(Ul||(Ul={}));const zl={urlBuilder(e,t){const n=m.map(t,(e,t)=>{if(t&&Array.isArray(e)){return e.map(e=>`${t}=${encodeURIComponent(e)}`).join("&")}return t&&void 0!==e?`${t}=${encodeURIComponent(e)}`:""}),r=m.reduce(n,(e,t)=>t?e?`${e}&${t}`:t:e);return r?`${e}?${r}`:e},buildFilter(e){let t=[];if(e.limit&&t.push("limit:"+e.limit),e.cursor&&t.push("page:"+e.cursor),e.before&&t.push("dateCreated:..."+e.before),t.length)return t.join(",")},makeHttps:e=>m.isString(e)?-1===e.indexOf("http://")?e:e=e.replace("http://","https://"):e,safeUrlConcat(e,t){if(!e)return;let n=e;return e.endsWith("/")||(n+="/"),t?(n+=t.startsWith("/")?t.slice(1):t,n):n}};var Hl;!function(e){e.Banner="banner",e.Thumbnail="thumbnail"}(Hl||(Hl={}));const ql={[Fl.Banners]:Hl.Banner,[Fl.Thumbnails]:Hl.Thumbnail},Jl=e=>"/v1/category-map/"+e,$l={createUrl:(e,t)=>$l._createUrl(e,t),createBannerUrl:(e,t,n)=>e&&e.url?$l._createUrl(e.url,n):$l._createCategoryMappedUrl(t,n),Rfc3986EncodeURIComponent:e=>encodeURIComponent(e).replace(/[!'()*]/g,escape),_createCategoryMappedUrl(e,t){const{fallbackBaseUrl:n,fallbackCategoryName:r,type:i}=e,a=zl.safeUrlConcat(n,""+Jl(ql[i])),o=Object.assign({name:$l.Rfc3986EncodeURIComponent(r)},t);return $l._createUrl(a,o)},_createUrl(e,t){if(!e)return;if(pt.isEmpty(t))return e;const n=$.param(t),r=-1===e.indexOf("?")?"?":"&";return zl.safeUrlConcat(e,`${r}${n}`)},legacyCreateThumbnailUrl(e,t){if(!e)return"";let n;if(!e)return;if(n=e instanceof r.Model?e.get("url"):"string"==typeof e?e:e.url,!n)return;const i=Object.assign({size:Rl.Small,bgColor:"000"},t);return $l._createUrl(n,i)}},Kl={[Fl.Thumbnails]:{width:1280,height:720},[Fl.Banners]:{width:3600,height:666},[Fl.Covers]:{width:1080,height:1080},[Fl.Posters]:{width:1e3,height:1500},[Fl.TallPosters]:{width:1080,height:1920},[Fl.HeroBanners]:{width:1920,height:640}};var Yl={onFileSelect:function(e,t,n){if(t&&t.length){var r=new FileReader;r.addEventListener("load",(function(){return Yl.onReaderLoad(r,e,n)})),r.readAsDataURL(t[0])}},onReaderLoad:function(e,t,n){var r=new Image;r.src=e.result;var i=Kl[t].width,a=Kl[t].height;r.addEventListener("load",(function(){Yl.isImageValid(t,r)&&X.isFunction(n)?n(r):alert("Image too small: minimum dimensions are ".concat(i," x ").concat(a))}))},isImageValid:function(e,t){var n=Kl[e].width,r=Kl[e].height;return!(n&&t.width<n)&&!(r&&t.height<r)}},Gl={isItemActive:function(e,t){return t||(t=r.AppLinkHelper.getCurrentAppLink()),t.application===e.appLink.application&&(Array.isArray(e.activeActions)?e.activeActions.includes(t.action):t.action===e.appLink.action)}},Wl=function(e){return Object.values(e).every((function(e){return!!e}))},Zl=function(e,t){return!!e&&!!t&&e.toString()===t.toString()},Ql=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function Xl(e){return function(e){if(Array.isArray(e))return eu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return eu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eu(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var tu={find:function(e,t){if(e&&e.children&&e.children.length)for(var n=function e(n){if(Zl(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=tu.find(e,i);a&&(n=[a].concat(Xl(n))),i=a?r(a):null}return n}},nu=function(e){return e&&e.groups?e.groups.map((function(e){return e.name})):[]};function ru(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return iu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return iu(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var au,ou=d.createContext(void 0),su=function(e){var t=e.children,n=ru(d.useState(),2),r=n[0],i=n[1],a=ru(d.useState(!1),2),o=a[0],s=a[1],c=ru(d.useState(),2),l=c[0],u=c[1],p={getDataUrl:function(){var e=r;return i(null),e},setDataUrl:i,imageUploaded:o,getImage:function(){var e=l;return u(null),s(!1),e},setImage:function(e){u(e),s(!0)}};return d.createElement(ou.Provider,{value:p},t)};function cu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return lu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lu(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function uu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pu=(uu(au={},Fl.Thumbnails,"Thumbnail"),uu(au,Fl.Banners,"Banner"),uu(au,Fl.Avatars,"Avatar"),uu(au,Fl.Logos,"Logo"),uu(au,Fl.Covers,"Cover"),uu(au,Fl.Posters,"Poster"),uu(au,Fl.TallPosters,"Tall Poster"),uu(au,Fl.HeroBanners,"Hero Banner"),au);function fu(e){var t,n=za(),i=Ra(null===(t=n)||void 0===t?void 0:t.values,e.fieldName),a=d.useContext(ou),o=a.setDataUrl,s=a.getImage,l=a.imageUploaded,u=cu(d.useState(!1),2),p=u[0],f=u[1],m=cu(d.useState(i),2),h=m[0],g=m[1],y=cu(d.useState(!1),2),v=y[0],b=y[1];function S(t){f(!0),o(t.src),r.AppLinkHelper.trigger({application:e.application,action:e.uploadAction,args:[e.imageType]})}d.useEffect((function(){if(p){var t,r=s();if(r)f(!1),g(r),t=r,X.isFunction(e.setSelectedImage)?e.setSelectedImage(t):n&&n.setFieldValue(e.fieldName,{fileId:t.id,fileIdType:Ul.ImageAPIv2})}}),[l]);var E=e.label||pu[e.imageType]||"Image";return d.createElement("div",{className:"form-group"},d.createElement("div",{className:"form-control h-auto py-2"},d.createElement("label",null,E),d.createElement("em",{className:"ml-1 text-muted"},"(Minimum dimensions are ".concat(Kl[e.imageType].width,"px")+" x ".concat(Kl[e.imageType].height,"px)")),d.createElement(Bl,{label:"Choose a ".concat(E.toLowerCase()),name:"image",mimeType:c.IMAGES,onFileSelect:function(t){return Yl.onFileSelect(e.imageType,t,S)}}),!!h&&!!h.url&&d.createElement(d.Fragment,null,!v&&d.createElement("div",{className:"pb-2 ".concat(e.imageType===Fl.Banners?"w-100":"w-50")},d.createElement("img",{src:$l.createUrl(h.url),className:"img img-fluid"})),d.createElement("div",{className:"d-flex justify-content-center"},d.createElement(Il,{svgName:v?vl.ChevronDown:vl.ChevronUp,size:Ol.Large,className:"svg-container cursor-pointer",onClick:function(){return b(!v)},title:v?"Show image":"Hide image",tooltipPlacement:"top"})))))}var du,mu=n(126),hu=n.n(mu);function gu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return yu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yu(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}!function(e){e[e.NoRestrictions=0]="NoRestrictions",e[e.RestrictToCanvas=1]="RestrictToCanvas"}(du||(du={}));var vu,bu,Su,Eu,Cu,Ou,Iu,ju,Au,Tu,wu,Lu,ku,_u,xu,Pu,Nu,Du,Ru,Fu,Mu,Uu=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function Vu(e){var t=e.dataUrl,n=e.minHeight,r=e.minWidth,i=e.onCrop,a=e.onCancel,o=d.useRef(),s=d.useRef(),c=gu(d.useState(!1),2),l=c[0],u=c[1],p=gu(d.useState(!1),2),f=p[0],m=p[1];return d.useEffect((function(){var e=new Image;e.src=t;var i=o.current.offsetWidth/e.width;return s.current=new hu.a(o.current,{viewMode:du.RestrictToCanvas,autoCropArea:1,aspectRatio:r/n,minCropBoxWidth:r*i,minCropBoxHeight:n*i,ready:function(){return u(!0)}}),function(){return s.current.destroy()}}),[]),d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-3"},d.createElement("img",{ref:o,src:t,className:"img img-fluid mw-100"})),d.createElement("div",{className:"d-flex justify-content-end border-top pt-3"},d.createElement(co.Button,{variant:"link",onClick:a},"Cancel"),d.createElement(bo,{onClick:function(){if(l){m(!0);var e=s.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(Uu);if(t)return t[1]}(t));X.isFunction(i)&&i(e)}},disabled:!l,showSpinner:f},"Crop")))}!function(e){e.Stream="cv_product_stream",e.WebPlayerStream="cv_product_webplayer_stream",e.Login="cv_product_login",e.LoginSsoRedirect="cv_product_login_sso_redirect",e.LoginFailed="cv_product_login_failed",e.Search="cv_product_search",e.InstantSearch="cv_product_search",e.SearchEmptyResult="cv_product_search_empty_result",e.Filter="cv_product_search_filter",e.SearchLanding="cv_product_search_landing",e.Share="cv_product_share",e.WorkspaceAdd="cv_product_tv_add",e.Rename="cv_product_rename",e.Move="cv_product_move",e.Sort="cv_product_sort",e.Create="cv_product_create",e.Delete="cv_product_delete",e.Associate="cv_product_associate",e.Dissociate="cv_product_dissociate",e.Edit="cv_product_edit",e.Approve="cv_product_approve",e.Reject="cv_product_reject",e.Disable="cv_product_disable",e.Upload="cv_product_upload",e.Download="cv_product_download",e.Navigate="cv_product_navigate",e.Click="cv_product_click",e.Suggest="cv_product_suggest",e.EditAssoc="cv_product_edit_assoc",e.Play="cv_product_play",e.Favourite="cv_product_favourite",e.Follow="cv_product_follow",e.Prefer="cv_product_prefer",e.SetAccess="cv_product_set_access",e.AddToLocalCache="cv_product_add_to_lc",e.ResolveWarning="cv_product_resolve_warning",e.DismissWarning="cv_product_dismiss_warning"}(vu||(vu={})),function(e){e.Folder="folder",e.Video="video",e.Rating="rating",e.Series="series",e.Library="library",e.Resource="resource",e.Tag="tag",e.Subtitle="subtitle",e.Chapter="chapter",e.Restriction="restriction",e.Interactive="interactive",e.PDF="pdf",e.CustomerSetting="customer_setting",e.StaffRequest="staff_request",e.Logo="logo",e.Pagination="pagination",e.Thumbnail="thumbnail",e.Banner="banner",e.Link="link",e.Playlist="playlist",e.Person="person",e.Company="company",e.Classroom="classroom",e.ClassroomGroup="classroom_group",e.Classification="classification",e.ShareLink="share_link",e.Upload="upload",e.SearchResults="search_results",e.Audience="audience",e.User="target_user"}(bu||(bu={})),function(e){e.TopNav="top_nav",e.LeftNav="left_nav",e.Popup="popup",e.Banner="banner",e.VideoList="video_list",e.VideoListItem="video_list_item",e.VideoListHeader="video_header",e.VideoThumbnail="video_thumbnail",e.VideoItemPreview="video_item_preview",e.VideoDetails="video_details",e.VideoDetailsHeader="video_details_header",e.EditVideoDetails="edit_video_details",e.EditVideoChapters="edit_video_chapters",e.EditVideoResources="edit_video_resources",e.VideoUpload="video_upload",e.VideoRequest="video_request",e.Pagination="pagination",e.SearchBar="search_bar",e.InstantSearch="instant_search",e.SearchFilters="search_filters",e.LibraryHeader="library_header",e.LibraryTiles="library_tiles",e.StaffRequestDetails="staff_request_details",e.SubFolderList="sub_folder_list",e.AwaitingReviewVideoListHeader="awaiting_review_video_list_header",e.AwaitingReviewVideoItem="awaiting_review_video_item",e.PastReleasesHeader="past_releases_header",e.MigrationWarnings="migration_warnings",e.PlaylistListHeader="playlist_list_header",e.PlaylistListItem="playlist_list_item",e.TeacherManager="teacher_manager",e.TeacherManagerListItem="teacher_manager_list_item",e.StudentManager="student_manager",e.StudentManagerListItem="student_manager_list_item",e.ClassroomsList="classrooms_list",e.ClassroomsListItem="classrooms_list_item",e.ClassroomOverview="classroom_overview",e.ClassroomOverviewStudentListItem="classroom_overview_student_list_item",e.ManageClassroomStudents="manage_classroom_students",e.ManageClassroomStudentListItem="manage_classroom_student_list_item",e.ManageClassroomGroups="manage_classroom_groups",e.ManageClassroomGroupListItem="manage_classroom_group_list_item",e.PlayPage="play_page",e.FloatingPlayer="floating_player",e.ContentUpdatesClassificationBanner="content_updates_classification_banner",e.PreferencesSettings="preferences_settings",e.MyUploads="my_uploads"}(Su||(Su={})),function(e){e.Start="start",e.Complete="complete",e.Save="save",e.Discard="discard"}(Eu||(Eu={})),function(e){e.PageLoad="page_load"}(Cu||(Cu={})),function(e){e.Single="single",e.Bulk="bulk",e.All="all"}(Ou||(Ou={})),function(e){e.ProductionYear="production_year",e.Alphabetical="alphabetical"}(Iu||(Iu={})),function(e){e.Content="content",e.Quality="quality",e.Duration="duration",e.Reset="reset"}(ju||(ju={})),function(e){e.Submit="submit",e.ShowAll="show_all",e.Recent="recent",e.SearchIcon="search_icon"}(Au||(Au={})),function(e){e.Start="start",e.Finish="finish",e.Terminate="terminate",e.Play="play",e.Pause="pause",e.Playback="playback",e.NextChapter="next_chapter",e.PreviousChapter="previous_chapter",e.FullScreenEnter="full_screen_enter",e.FullScreenExit="full_screen_exit"}(Tu||(Tu={})),function(e){e.TogglePreview="toggle_preview",e.NavigateHome="navigate_home",e.OpenInStaffView="open_in_staff_view",e.Thumbnail="thumbnail",e.Title="title",e.ToggleHideValidListings="toggle_hide_valid_listings",e.LaunchImmersiveReader="launch_immersive_reader",e.CopyEmbedHtml="copy_embed_html",e.Close="close",e.Open="open"}(wu||(wu={})),function(e){e.LibraryReview="library_review"}(Lu||(Lu={})),function(e){e.FileSelect="file_select",e.DragDrop="drag_drop"}(ku||(ku={})),function(e){e.Edit="edit"}(_u||(_u={})),function(e){e.Image="image",e.User="user"}(xu||(xu={})),function(e){e.On="on",e.Off="off"}(Pu||(Pu={})),function(e){e.EntityRemoved="cv_entity_removed",e.ValueUpdated="cv_value_updated"}(Nu||(Nu={})),function(e){e.FileSelect="file_select",e.DragDrop="drag_drop"}(Du||(Du={})),function(e){e.Video="videos",e.Folder="categories",e.Series="series",e.Tags="tags"}(Ru||(Ru={})),function(e){e[e.V1=1]="V1"}(Fu||(Fu={})),function(e){e.Analytics="AnalyticsService",e.Context="ContextService"}(Mu||(Mu={}));class Bu extends r.Service{constructor(){super(...arguments),this.contextHistory=[]}get name(){return Mu.Context}static get Instance(){return this.instance||(this.instance=new this)}initialize(){this.listenTo(y.SHELL,r.EventNames.ROUTE,this.setContext)}setContext(e){this.contextHistory.length>=5&&this.contextHistory.unshift(),this.contextHistory.push({pageLoad:!this.contextHistory.length,appLink:e})}getCurrentContext(){if(this.contextHistory.length)return this.contextHistory[this.contextHistory.length-1]}fromPageLoad(){return 1===this.contextHistory.length}}const zu=new Bu;var Hu;!function(e){e.Inlet="event:inlet",e.Outlet="event:outlet"}(Hu||(Hu={}));const qu="global:analytics",Ju=Fu.V1;class $u{constructor(e,t,n,r){this.type=e,this.data=t,this.actionContext=n,this.eventVersion=r||Ju}isType(e){return e===this.type}enrich(e,t){this.validateKey(e),this[e]=t}get(e){if(e&&this[e])return this[e]}validateKey(e){"type"!==e&&"data"!==e||r.ErrorHelper.throw(new B(e+" is not a valid key")),this[e]&&r.ErrorHelper.throw(new B("Event already contains an enrichment named "+e))}}const Ku={log(e,t,n,r){h.Radio.channel(qu).trigger(Hu.Inlet,new $u(e,t,n,r))}};function Yu(){const{appLink:e}=zu.getCurrentContext();return m.isObject(e)||r.ErrorHelper.throw(new B("Applink does not exist. Check current context.")),e.application.replace(":","-")}function Gu(e={}){const{location:t,entity:n,workflowPhase:i=null,descriptor:a=null}=e;return t||r.ErrorHelper.throw(new B("location must be set.")),n||r.ErrorHelper.throw(new B("entity must be set.")),{productArea:Yu(),location:t,entity:n,descriptor:a,workflowPhase:i}}function Wu(){return r.LocationUtils.GetCurrentPath()+r.LocationUtils.GetCurrentQueryString()}const Zu={logUserAction(e,t){if(!function(e){return!(!m.isArray(e)||!m.every(e,e=>m.isObject(e)))||!!m.isObject(e)}(e)||!m.isObject(t))return;const{userAction:n,action:r,eventVersion:i}=Zu.buildUserActionEvent(t);Ku.log(n,e,r,i)},logNavigate(e,t){const n=Object.assign({currentLocation:Wu(),appLink:e},t);Ku.log(vu.Navigate,n)},mergeOptions:(e,t)=>m.extend({},e,t),buildActionContext:(e={})=>Gu(e),buildUserActionEvent(e={}){const{actionType:t,eventVersion:n}=e;return{userAction:t,action:Gu(e),eventVersion:n}},buildCurrentLocation:()=>Wu(),buildSearchEvent:(e,t)=>({data:{query:e},action:Gu({entity:bu.Video,location:Su.SearchBar,descriptor:t})}),buildInstantSearchEvent(e,t,n){let r;n===Ru.Series&&(r=bu.Series),n===Ru.Folder&&(r=bu.Folder),n===Ru.Tags&&(r=bu.Tag),n===Ru.Video&&(r=bu.Video);const i={instant:{},query:e};return t.id&&(i.instant.selectedId=t.id),t.name&&(i.instant.selectedName=t.name),{data:i,action:Gu({entity:r,location:Su.SearchBar})}},mapInteractionType(e){switch(e){case Du.DragDrop:return ku.DragDrop;case Du.FileSelect:return ku.FileSelect;default:return}}};function Qu(e,t){return t?{application:e.application,action:e.action,args:e.args,params:Object.assign({},e.params,{cursor:t})}:null}function Xu({appLink:e,cursors:t,className:n}){function r(e){Zu.logUserAction({page:e},{location:Su.Pagination,entity:bu.Pagination,actionType:vu.Navigate,workflowPhase:Eu.Complete})}return d.createElement(jo.Provider,{value:"shared.pagination"},d.createElement("div",{className:n},d.createElement(kl,{appLink:Qu(e,t.previous),className:"btn btn-secondary mr-1 "+(t.previous?"":"disabled"),onClick:()=>r("previous")},d.createElement(Ao,{phrase:"previous"})),d.createElement(kl,{appLink:Qu(e,t.next),className:"btn btn-secondary "+(t.next?"":"disabled"),onClick:()=>r("next")},d.createElement(Ao,{phrase:"next"}))))}function ep(e){if(!e.collection)return d.createElement(d.Fragment,null);var t=e.collection,n=t.data,r=t.pagination;return d.createElement(d.Fragment,null,!!n&&d.createElement(fp,{objects:n,getObjectAppLink:e.getObjectAppLink,newObjectAppLink:e.newObjectAppLink,objectName:e.objectName}),!!r&&!!r.cursors&&d.createElement(Xu,{cursors:r.cursors,appLink:e.collectionAppLink}))}Xu.defaultProps={className:"py-2"};var tp=n(22),np=n.n(tp);function rp(e){let t="dropdown-item";return e&&(t+=" "+e),t}function ip(e){if(!e.actions||!e.actions.length)return d.createElement(d.Fragment,null);const t="actions-dropdown-"+bl.getRandomInt();let n="px-0 "+np.a.dropdownToggle;return e.dropdownToggleClassName&&(n+=" "+e.dropdownToggleClassName),d.createElement(co.Dropdown,{className:e.className?e.className:"",alignRight:!0},d.createElement(co.Dropdown.Toggle,{as:"button",type:"button",id:t,className:n},d.createElement(Il,{svgName:vl.More,size:Ol.Small})),d.createElement(co.Dropdown.Menu,null,e.actions.map((e,t)=>d.createElement(kl,{key:t,appLink:e.appLink,className:rp(e.className)},e.label))))}ip.defaultProps={dropdownToggleClassName:"btn btn-light"};var ap=n(18),op=n.n(ap);function sp(e){const{svgName:t,children:n,appLink:r,className:i,onClick:a}=e;let o=`${i} ${op.a.iconButton}`;o+=n?" "+op.a.iconWithText:" "+op.a.iconOnly;const s=d.createElement(Il,{svgName:t,className:op.a.svg});return r?d.createElement(kl,{appLink:r,className:o,onClick:a},s,n):d.createElement("button",{className:o,onClick:a},s,n)}function cp(e){const{onClick:t,appLink:n,svgName:r,tooltip:i}=e.actionOptions;let a="ml-2";return e.actionOptions.className&&(a+=" "+e.actionOptions.className),i?d.createElement(Sl,{title:i},d.createElement(sp,{appLink:n,svgName:r,onClick:t,className:a},e.children)):r?d.createElement(sp,{onClick:t,appLink:n,svgName:r,className:a},e.children):n?d.createElement(kl,{onClick:t,appLink:n,className:a},e.children):d.createElement("button",{onClick:t,className:a},e.children)}function lp(e){const t=[],n=[];e.actions.forEach(e=>{e.button?t.push(e):n.push(e)});let r="d-flex";return e.className&&(r+=" "+e.className),d.createElement("div",{className:r},d.createElement(d.Fragment,null,!!t.length&&d.createElement("span",{className:np.a.buttonList},t.map((e,t)=>d.createElement(cp,{key:t,actionOptions:e},e.label))),e.sortComponent?e.sortComponent:"",!!n.length&&d.createElement(ip,{actions:n,className:!!t.length&&"ml-2",dropdownToggleClassName:e.actionsDropdownClassName})))}function up(e){var t=e.object,n=e.actions;return d.createElement("div",{className:"d-flex justify-content-between py-2"},!!t&&d.createElement("h5",null,t.name),!!n&&d.createElement("span",null,d.createElement(lp,{actions:n})))}function pp(e){return d.createElement("tr",null,d.createElement("td",null,d.createElement(kl,{appLink:e.appLink},e.object.name)),d.createElement("td",null))}function fp(e){return d.createElement(co.Table,{responsive:!0},d.createElement("thead",null,d.createElement("tr",null,d.createElement("th",null,"Name"),d.createElement("th",null,d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(kl,{appLink:e.newObjectAppLink},d.createElement(Il,{svgName:vl.Plus,size:Ol.Small}),d.createElement("span",null,"New ".concat(e.objectName))))))),d.createElement("tbody",null,e.objects.map((function(t){return d.createElement(pp,{key:t.id,object:t,appLink:e.getObjectAppLink(t)})}))))}function dp(e){var t=e.objects,n=e.getAppLink,r=e.emptyMessage;return t?t.length?d.createElement("ul",{className:"list-unstyled"},t.map((function(e,t){return d.createElement("li",{key:t,className:"border rounded mb-3"},d.createElement(kl,{appLink:n(e),className:"d-block p-3"},e.name))}))):d.createElement("div",{className:"py-3"},d.createElement("p",null,r)):d.createElement(d.Fragment,null)}dp.defaultProps={emptyMessage:"There is nothing here."};function mp(e){var t=za();return d.createElement(go,{as:"select",label:"Rating",name:"rating",id:"rating",value:t.values.rating&&t.values.rating.id,onChange:function(e){return t.setFieldValue("rating",e.target.value?{id:e.target.value}:{})},disabled:e.disabled},d.createElement(d.Fragment,null,d.createElement("option",{value:""},"Please select a rating"),e.ratings.map((function(e,t){return d.createElement("option",{key:t,value:e.id},function(e){return"".concat(e.name).concat(e.code?" (".concat(e.code,")"):"")}(e))}))))}function hp(e){var t=e.tabs,n=e.isItemActive;return d.createElement(co.Nav,{fill:!0,variant:"tabs"},t.map((function(e,t){return d.createElement(co.Nav.Item,{key:t},d.createElement(kl,{appLink:e.appLink,className:(r=n(e),r?"nav-link active":"nav-link")},e.label));var r})))}hp.defaultProps={isItemActive:Gl.isItemActive};var gp=n(8),yp=n.n(gp);function vp(e){var t=e.name,n=e.appLink,r=e.onSelect,i=e.isDisabled,a=e.className,o=e.actions,s=yp.a.text;return a&&(s+=" ".concat(a)),i?d.createElement("a",{className:"".concat(s," text-muted ").concat(yp.a.disabled)},t):d.createElement(d.Fragment,null,n?d.createElement(kl,{appLink:n,className:s},t):d.createElement("a",{onClick:r,className:s},t),!!o&&d.createElement(lp,{className:yp.a.actions,actions:o}))}function bp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Sp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sp(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ep(e){var t=e.tree,n=e.selectedIds,r=e.getAppLink,i=e.onSelect,a=e.isDisabled,o=e.actions,s=Array.isArray(n)&&n.some((function(e){return Zl(t.id,e)})),c=d.useMemo((function(){return Array.isArray(n)&&n.some((function(e){return tu.find(t,e)}))}),[t,n]),l=bp(d.useState(c),2),u=l[0],p=l[1],f=!!t.children&&!!t.children.length,m={name:t.name,appLink:X.isFunction(r)?r(t):null,onSelect:X.isFunction(i)?function(){return i(t)}:null,isDisabled:!!X.isFunction(a)&&a(t),className:s&&yp.a.selected||c&&yp.a.parentOfSelected,actions:!!o&&o.map((function(e){return Object.assign(Object.assign({},e),{appLink:e.getAppLink(t)})}))};return d.createElement("li",{className:"position-relative".concat(u?"":" ".concat(yp.a.collapsed))},d.createElement("div",{className:"position-relative"},d.createElement("span",{className:yp.a.node},f&&d.createElement(Il,{svgName:vl.ChevronDown,size:Ol.Small,className:"svg-container ".concat(yp.a.chevron),onClick:function(){return p(!u)}}),d.createElement(vp,Object.assign({},m))),u&&d.createElement(Op,Object.assign({},e))))}var Cp=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 Op(e){var t=e.tree,n=Cp(e,["tree"]);return t&&t.children?d.createElement("ul",{className:"m-0 p-0 ".concat(yp.a.tree)},t.children.map((function(e){return d.createElement(Ep,Object.assign({key:e.id,tree:e},n))}))):d.createElement(d.Fragment,null)}var Ip={getChord:function(e,t){return tu.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=tu.find(t,e);o&&(n=Object.assign((r={},i=e,a=Ip.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 jp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ap(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ap(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ap(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Tp=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 wp(e){var t=e.onSelect,n=e.label,r=e.hideCollapseBtn,i=e.collapse,a=e.noSelectionMessage,o=e.isNodeDisabled,s=e.getSelectedItemAppLink,c=Tp(e,["onSelect","label","hideCollapseBtn","collapse","noSelectionMessage","isNodeDisabled","getSelectedItemAppLink"]),l=c.tree,u=c.selectedIds,p=jp(d.useState(Ip.getState(u,l)),2),f=p[0],m=p[1];d.useEffect((function(){return m(Ip.getState(u,l))}),[u,l]);var h=jp(d.useState(!!i),2),g=h[0],y=h[1];d.useEffect((function(){return y(!!i)}),[i]);var v=!r||!!n;return d.createElement(d.Fragment,null,v&&d.createElement("div",{className:"pb-2"},!!n&&d.createElement("label",{className:"m-0"},n),!r&&d.createElement("a",{className:"float-right cursor-pointer",onClick:function(){return y(!g)}},g?"Expand":"Collapse")),!g&&d.createElement("div",{className:"py-2 border-top"},d.createElement(Op,Object.assign({onSelect:function(e){return X.isFunction(t)&&t(e)},isDisabled:o},c))),(!pt.isEmpty(f)||!!a)&&d.createElement("div",{className:"py-2 border-top"},d.createElement("label",null,"Selected:"),d.createElement("ul",{className:"m-0"},pt.isEmpty(f)?d.createElement("li",null,a):Object.keys(f).map((function(e,t){return d.createElement("li",{key:t},X.isFunction(s)?d.createElement(kl,{appLink:s(e)},f[e]):f[e])})))))}var Lp=n(23);const kp={isEmpty:e=>e&&!(e.data&&e.data.length),length:e=>e&&e.data&&e.data.length,at(e,t){if(e&&e.data&&e.data.length&&!(t>e.data.length))return e.data[t]},get(e,t){if(e&&e.data&&e.data.length)return e.data.find(e=>e.id&&e.id.toString()===t)},flattenCollections(e){if(!e||!e.length)return;let t=[];return e.forEach(e=>{t=[...t,...e.data]}),t},getNextCursor:e=>e.pagination&&e.pagination.cursors&&e.pagination.cursors.next};var _p=function(e){var t="bg-white";return e&&(t+=" ".concat(e)),t};function xp(e){var t=e.video,n=e.getVideoAppLink,r=e.getVideoActions,i=e.className,a=void 0===i?"":i,o=e.itemNumber,s=X.isFunction(n)&&n(t);return d.createElement("tr",{className:_p(a)},!!o&&d.createElement("td",null,d.createElement("span",null,o)),d.createElement("td",null,s?d.createElement(kl,{appLink:s},t.name):t.name),X.isFunction(r)&&d.createElement("td",null,d.createElement("span",{className:"d-flex justify-content-end"},d.createElement(lp,{actions:r(t)}))))}var Pp=Object(Lp.SortableElement)((function(e){return d.createElement(xp,Object.assign({sortable:!0},e))})),Np=n(11),Dp=n.n(Np),Rp=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},Fp=function(e){var t=e.sortable,n=e.getVideoActions;return d.createElement("thead",null,d.createElement("tr",null,!!t&&d.createElement("th",null,"#"),d.createElement("th",null,"Name"),!!n&&d.createElement("th",null)))},Mp=d.forwardRef((function(e,t){var n=e.videos,r=e.sortable,i=Rp(e,["videos","sortable"]);return d.createElement("tbody",{ref:t},!kp.isEmpty(n)&&n.data.map((function(e,t){return r?d.createElement(Pp,Object.assign({key:e.id,index:t,itemNumber:t+1,video:e,className:Dp.a.draggableVideoItem},i)):d.createElement(xp,Object.assign({video:e},i))})))}));var Up=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},Vp=Object(Lp.SortableContainer)((function(e){var t=e.forwardedRef,n=Up(e,["forwardedRef"]);return d.createElement(Mp,Object.assign({sortable:!0,ref:t},n))})),Bp=function(e){return function(t){var n=t.node,r=e.current;if(r){r.classList.add(Dp.a.sortingContainer);var i=r.querySelector(".".concat(Dp.a.draggedVideoItem));n.childNodes.forEach((function(e,t){return i.childNodes[t].style.width="".concat(e.offsetWidth,"px")}))}}},zp=function(e,t){return function(n){var r=e.current;r&&r.classList.remove(Dp.a.sortingContainer),t(n.oldIndex,n.newIndex)}};function Hp(e){var t=e.onSortEnd,n=e.emptyMessage,r=Up(e,["onSortEnd","emptyMessage"]),i=d.useRef();return kp.isEmpty(e.videos)?d.createElement("div",null,n):d.createElement(co.Table,{responsive:!0},d.createElement(Fp,Object.assign({sortable:!0},e)),d.createElement(Vp,Object.assign({forwardedRef:i,onSortStart:Bp(i),onSortEnd:zp(i,t),lockAxis:"y",lockToContainerEdges:!0,distance:1,helperClass:Dp.a.draggedVideoItem,helperContainer:function(){return i.current}},r)))}function qp(e){var t=e.alias,n=e.onDelete;return d.createElement("li",{className:"list-group-item d-flex justify-content-between"},t.name,d.createElement(Il,{svgName:vl.Delete,onClick:function(){return n(t.id)}}))}function Jp(e){var t=e.aliases,n=e.onDelete;return d.createElement("ul",{className:"list-group mb-3"},t?t.map((function(e){return d.createElement(qp,{key:e.id,alias:e,onDelete:n})})):d.createElement("span",null,"Currently there are no aliases for this object."))}Hp.defaultProps={emptyMessage:"There are no videos in this list."};var $p=Object(oo.object)().shape({name:Object(oo.string)().trim().max(255,"Name is too long").required("Name is required").default("")});function Kp(){var e=za(),t=yo(e);return d.createElement(Qa,null,d.createElement(go,{label:"Create an alias",name:"name",id:"name",value:e.values.name,placeholder:"Add an alias"}),d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(bo,{showSpinner:e.isSubmitting,type:"submit",disabled:!t},"Add")))}function Yp(e){var t=e.onSave;return d.createElement(ao,{initialValues:{name:""},validationSchema:$p,onSubmit:function(e,n){t(e,n)},resetOnSubmit:!0},d.createElement(Kp,null))}function Gp(e){var t=e.onSave,n=e.aliases,r=e.onDelete;return d.createElement("div",{className:"w-50"},d.createElement("h1",null,"Aliases"),d.createElement(Jp,{aliases:n,onDelete:r}),d.createElement(Yp,{onSave:t}))}var Wp=u.COMPANIES,Zp=function(e){return{application:Wp,action:o.Companies.EDIT_COMPANY,args:[e.id]}},Qp=function(e){return r.AppLinkHelper.trigger(Zp(e))};function Xp(e){var t=i.useBasicFetch(Wt(e.cursor));return d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-3 w-50"},d.createElement(Ll,{placeholder:"Search for a company",onSuggestionSelected:Qp,getRemoteUrl:function(e){return"".concat("/api/domain/v1/search/companies/instant/raw","?q=").concat(e)},activationLength:2})),d.createElement(ep,{collection:t&&t.data,collectionAppLink:{application:Wp,action:o.Companies.COMPANIES},newObjectAppLink:{application:Wp,action:o.Companies.NEW_COMPANY},getObjectAppLink:Zp,objectName:"Company"}))}function ef(e){return(ef="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 tf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nf(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 rf(e,t,n){return t&&nf(e.prototype,t),n&&nf(e,n),e}function af(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&&of(e,t)}function of(e,t){return(of=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function sf(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=lf(e);if(t){var i=lf(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return cf(this,n)}}function cf(e,t){return!t||"object"!==ef(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 lf(e){return(lf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var uf,pf,ff=function(e){af(n,e);var t=sf(n);function n(){return tf(this,n),t.apply(this,arguments)}return rf(n,[{key:"channelName",get:function(){return u.COMPANIES}},{key:"appRoutes",get:function(){return{"manage/companies(/)":"companies","manage/companies/new(/)":"newCompany","manage/companies/:id(/)":"editCompany"}}}]),n}(r.AppRouter),df=function(e){af(n,e);var t=sf(n);function n(){return tf(this,n),t.apply(this,arguments)}return rf(n,[{key:"companies",value:function(e){var t=e.cursor;this.layout.showChildView(ae,d.createElement(Xp,{cursor:t}))}},{key:"newCompany",value:function(){this.layout.showChildView(ae,d.createElement(_o,null))}},{key:"editCompany",value:function(e){this.layout.showChildView(ae,d.createElement(ko,{id:e}))}},{key:"name",get:function(){return"Companies Application"}},{key:"channelName",get:function(){return u.COMPANIES}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return ff}}]),n}(r.Application),mf=n(31);!function(e){e.Success="success",e.Warning="warning",e.Fail="danger",e.Info="info"}(uf||(uf={})),function(e){e.Success="Success! 🙌",e.Warning="Whoops...",e.Fail="Oops...",e.Info="FYI"}(pf||(pf={}));class hf extends G{constructor(e){super(e)}initialize(){this.alertCollection=new U,this.listenTo(y.ALERT,"remove:alert",this.removeAlert),this.showAlerts()}get name(){return Co}get defaults(){return{maxAlerts:3}}showAlerts(){const e=h.Radio.channel(y.ALERT);let t={collection:this.alertCollection};this.options.alertViewCtor&&(t=m.extend({},t,{ctor:this.options.alertViewCtor})),e.trigger("show:alert",t)}removeAlert(e){this.alertCollection.remove(e),this.showAlerts()}createAlert(e){this.alertCollection.length===this.options.maxAlerts&&this.alertCollection.shift(),e.id||(e=m.extend({},e,{id:this.generateUniqueAlertId()})),this.alertCollection.push(new K(e)),this.showAlerts()}clearAllAlerts(){this.alertCollection.reset(null)}success(e){return"string"==typeof e?m.bind(()=>this.createAlert(m.extend({},this.options.defaultSuccessAlert,{message:e})),this):e.useXHR?m.bind((e,t)=>this.createAlert(m.extend({},this.options.defaultSuccessAlert,{message:t})),this):m.bind(()=>this.createAlert(m.extend({},this.options.defaultSuccessAlert,e)),this)}error(e){return"string"==typeof e?m.bind(()=>this.createAlert(m.extend({},this.options.defaultErrorAlert,{message:e})),this):e.useXHR?m.bind(e=>this.createAlert(m.extend({},this.options.defaultErrorAlert,{message:e.message})),this):m.bind(()=>this.createAlert(m.extend({},this.options.defaultErrorAlertIL_DEFAULT,e)),this)}generateUniqueAlertId(){return m.uniqueId("alert_")}}var gf=n(9),yf=n.n(gf);function vf(e){const{alert:t,svgName:n,svgClassName:r,closeAlert:i}=e,{message:a,heading:o,appLink:s,appLinkText:c,appLinkClassName:l=""}=t,u=Object(Eo.sanitize)(a);return d.createElement(d.Fragment,null,d.createElement("div",{className:"d-inline-block "+yf.a.icon},d.createElement(Il,{svgName:n,className:"svg-container "+r})),d.createElement("div",{className:"pl-2 d-inline-block "+yf.a.alertContent},d.createElement("p",{className:"p-0 m-0 pb-1 "+yf.a.heading},o),d.createElement("p",{className:"p-0 m-0 "+yf.a.message,dangerouslySetInnerHTML:{__html:u}}),!!s&&d.createElement(kl,{className:l,appLink:s},c)),d.createElement("div",{className:"close d-inline-block cursor-pointer",role:"button","aria-hidden":"true",onClick:i},"×"))}const bf=e=>{switch(e.type){case uf.Success:return vl.CheckCircleOutline;case uf.Fail:case uf.Warning:return vl.Warning;case uf.Info:default:return vl.Info}};function Sf({alert:e,closeAlert:t}){const[n,r]=d.useState(!0),i=d.useRef();d.useEffect(()=>{n?i.current=window.setTimeout(t,3e3):clearTimeout(i.current)},[n]);const a="text-"+e.type.toLowerCase();return d.createElement("li",{className:"bg-white mt-2 p-2 show clearfix "+yf.a.alertItem,onMouseEnter:()=>r(!1),onMouseLeave:()=>r(!0)},d.createElement(vf,{alert:e,svgName:bf(e),svgClassName:a,closeAlert:t}))}function Ef({alerts:e,removeAlert:t}){return d.createElement("div",{className:yf.a.alertBox},d.createElement(mf.TransitionGroup,{component:"ul",className:yf.a.alertList+" list-unstyled"},e&&e.map((e,n)=>d.createElement(mf.CSSTransition,{key:n,timeout:200,classNames:"alert"},d.createElement(Sf,{alert:e,closeAlert:()=>t(e.id)})))))}function Cf(){return d.createElement("div",{className:"text-center p-5"},d.createElement(co.Spinner,{as:"div",animation:"border",role:"status"}))}function Of(e){const{title:t,closeButton:n=!0,closePopup:r,onEntered:i,showLoadingSpinner:a}=e,o=Object.assign({show:!0,onHide:r},X.isFunction(i)?{onEntered:i}:{});return d.createElement(co.Modal,Object.assign({},o),!!t&&d.createElement(co.Modal.Header,{closeButton:n},d.createElement(co.Modal.Title,null,t)),a?d.createElement(Cf,null):d.createElement(co.Modal.Body,null,e.children))}var If=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 jf({buttons:e}){return d.createElement("div",{className:"d-flex justify-content-end border-top pt-3 px-3 mx-n3"},e.map((e,t)=>((e,t)=>{const{buttonText:n,type:r="button",isSpinnerButton:i,showSpinner:a=!1,className:o}=e,s=If(e,["buttonText","type","isSpinnerButton","showSpinner","className"]),c=Object.assign({key:t,type:r,className:"ml-2"+(o?" "+o:"")},s);return i?d.createElement(bo,Object.assign({showSpinner:a},c),n):d.createElement(co.Button,Object.assign({},c),n)})(e,t)))}var Af,Tf;!function(e){e.Boolean="System.Boolean",e.String="System.String",e.StaffRequest="ClickView.DomainApi.Models.Options.Enums.StaffRequestOption, ClickView.DomainApi.Models, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null",e.Long="System.Int64"}(Af||(Af={})),function(e){e[e.Permanent=0]="Permanent",e[e.Temporary=1]="Temporary"}(Tf||(Tf={}));var wf={namespace:"domain_options"},Lf=function(){return"/api/domain/v3/settings/types"},kf=function(e){return"/api/domain/v3/settings/types/".concat(e)},_f=function(){return"/api/domain/v3/settings/types"},xf=function(e){return"/api/domain/v3/settings/types/".concat(e)},Pf=function(e){return"/api/domain/v3/settings/types/".concat(e)},Nf="domain:options",Df="domain:option",Rf="update:domain:option",Ff="delete:domain:option",Mf=function(){return{key:Nf,url:Lf(),normalizeOptions:wf}},Uf=function(e){return{key:"".concat(Df,":").concat(e),url:kf(e),normalizeOptions:wf}},Vf=function(e,t,n){return e.type===Af.String&&(e=Hf(e)),{key:Df,url:_f(),data:e,type:nt.POST,success:t,error:n,invalidationKeys:[Nf],normalizeOptions:wf}},Bf=function(e,t){return e.type===Af.String&&(e=Hf(e)),{key:"".concat(Rf,":").concat(e.id),url:xf(e.id),data:e,type:nt.PUT,always:t,formatData:function(){return e},normalizeOptions:wf}},zf=function(e,t){return{key:"".concat(Ff,":").concat(e),url:Pf(e),type:nt.DELETE,invalidationKeys:[Nf],normalizeOptions:wf,success:t}};function Hf(e){var t=e.defaultValue;if('"'===t)return Object.assign(Object.assign({},e),{defaultValue:'"'.concat(t,'"')});var n=t.charAt(0),r=t.charAt(t.length-1);return'"'!==n&&(t='"'.concat(t)),'"'!==r&&(t="".concat(t,'"')),Object.assign(Object.assign({},e),{defaultValue:t})}function qf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Jf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $f(e){var t=qf(d.useState(!1),2),n=t[0],a=t[1],s=i.useBasicFetch(Uf(e.optionId)),c=Object(te.useDispatch)(),l=function(){e.closePopup(),r.AppLinkHelper.trigger({application:u.DOMAIN_OPTIONS,action:o.DomainOptions.DOMAIN_OPTIONS})};return d.createElement(Of,{title:"Delete Domain Option",closePopup:e.closePopup,showLoadingSpinner:!s.data},s.data&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,s.data.name),"?")),d.createElement(jf,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){a(!0),i.fetch(c,zf(e.optionId,l))},buttonText:"Yes, delete this domain option",isSpinnerButton:!0,showSpinner:n}]})))}var Kf,Yf=function(e){return{application:u.DOMAIN_OPTIONS,action:o.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]}},Gf={application:u.DOMAIN_OPTIONS,action:o.DomainOptions.NEW_DOMAIN_OPTION};function Wf(){var e=i.useBasicFetch(Mf());if(!e.data)return d.createElement(d.Fragment,null);var t=e.data.map((function(e){return e.displayName&&(e.name=e.displayName),e}));return d.createElement(d.Fragment,null,d.createElement("div",{className:"d-flex justify-content-between mb-2"},d.createElement("h5",{className:"d-inline-block m-0"},"Select a domain option type to edit:"),d.createElement(kl,{appLink:Gf,className:"d-block"},d.createElement(Il,{svgName:vl.Plus,size:Ol.Small}),d.createElement("span",null,"New Domain Option"))),d.createElement(dp,{objects:t,getAppLink:Yf}))}!function(e){e[e.Audience=1]="Audience",e[e.Category=2]="Category",e[e.Channel=3]="Channel",e[e.Chapter=4]="Chapter",e[e.Comment=5]="Comment",e[e.OwnerComment=6]="OwnerComment",e[e.Image=7]="Image",e[e.Thumbnail=8]="Thumbnail",e[e.Avatar=9]="Avatar",e[e.Banner=10]="Banner",e[e.Video=11]="Video",e[e.Trailer=12]="Trailer",e[e.Rating=13]="Rating",e[e.Topic=14]="Topic",e[e.Series=15]="Series",e[e.Season=16]="Season",e[e.HostedMediaObjectCollection=17]="HostedMediaObjectCollection",e[e.ExchangeCollection=18]="ExchangeCollection",e[e.CustomMediaObjectCollection=19]="CustomMediaObjectCollection",e[e.Playlist=20]="Playlist",e[e.ClickViewTvCollection=21]="ClickViewTvCollection",e[e.ClickViewProductionsCollection=22]="ClickViewProductionsCollection",e[e.User=23]="User",e[e.SystemUser=24]="SystemUser",e[e.Customer=25]="Customer",e[e.Country=26]="Country",e[e.Organisation=28]="Organisation",e[e.SystemOrganisation=29]="SystemOrganisation",e[e.Group=30]="Group",e[e.SystemGroup=31]="SystemGroup",e[e.FlagReason=32]="FlagReason",e[e.Library=33]="Library",e[e.Interactive=34]="Interactive",e[e.WorkspaceCollection=35]="WorkspaceCollection",e[e.Conversation=36]="Conversation",e[e.Message=37]="Message",e[e.Notification=38]="Notification",e[e.Clip=39]="Clip",e[e.Link=40]="Link",e[e.UserChannel=41]="UserChannel",e[e.Resource=42]="Resource",e[e.VideoStream=43]="VideoStream",e[e.AudioStream=44]="AudioStream",e[e.Tag=45]="Tag",e[e.Subtitle=46]="Subtitle",e[e.LicencedContentCollection=47]="LicencedContentCollection",e[e.PublicCollection=48]="PublicCollection",e[e.CategoryTree=49]="CategoryTree",e[e.Logo=50]="Logo",e[e.Permission=51]="Permission",e[e.Subject=52]="Subject",e[e.Field=53]="Field",e[e.Company=54]="Company",e[e.Person=55]="Person",e[e.Cover=56]="Cover",e[e.Poster=57]="Poster",e[e.SubjectAudience=58]="SubjectAudience"}(Kf||(Kf={}));var Zf=oo.object().shape({id:oo.string(),name:oo.string().trim().max(64,"Name is too long").required("Name is required").default(""),displayName:oo.string().trim().max(255,"Display name is too long").required("Display name is required").default(""),type:oo.mixed().required("Type is required").default(Af.Boolean),entityType:oo.mixed().required("Entity type is required").default(Kf.Customer),kind:oo.mixed().required("Kind is required").default(Tf.Temporary),defaultValue:oo.mixed().required("Default value is required").default("false")}).noUnknown();function Qf(e){var t=e.type,n=e.defaultValue;if(!t)return d.createElement(d.Fragment,null);var r={label:"Default Value",name:"defaultValue",id:"defaultValue",value:n};return t===Af.Boolean?d.createElement(go,Object.assign({as:"select"},r),d.createElement("option",{value:"true"},"True"),d.createElement("option",{value:"false"},"False")):t===Af.Long||t===Af.StaffRequest?d.createElement(go,Object.assign({as:"input",type:"number"},r)):t===Af.String?d.createElement(go,Object.assign({as:"input"},r)):void 0}var Xf=[Kf.Customer,Kf.User];function ed(e){var t=null===e.id||void 0===e.id,n=za(),r=yo(n);return d.createElement(Qa,null,d.createElement(go,{label:"Name (snake_case)",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this domain option",autoFocus:!0}),d.createElement(go,{label:"Display Name",type:"text",name:"displayName",id:"displayName",value:n.values.displayName,placeholder:"Enter a display name for this domain option"}),d.createElement(go,{as:"select",label:"Kind",name:"kind",id:"kind",value:n.values.kind},pt.getEnumKeys(Tf).map((function(e){return d.createElement("option",{key:e,value:Tf[e]},e)}))),d.createElement(go,{as:"select",label:"Entity",name:"entityType",id:"entityType",value:n.values.entityType},pt.getEnumKeys(Kf).filter((function(e){return Xf.includes(Kf[e])})).map((function(e){return d.createElement("option",{key:e,value:Kf[e]},e)}))),d.createElement(go,{as:"select",label:"Type",name:"type",id:"type",value:n.values.type},pt.getEnumKeys(Af).map((function(e){return d.createElement("option",{key:e,value:Af[e]},e)}))),d.createElement(Qf,{type:n.values.type,defaultValue:n.values.defaultValue}),d.createElement("div",{className:"d-flex justify-content-between"},d.createElement(bo,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&d.createElement(co.Button,{as:kl,variant:"danger",appLink:{application:u.DOMAIN_OPTIONS,action:o.DomainOptions.DELETE_DOMAIN_OPTION,args:[e.id]}},"Delete")))}function td(e){return d.createElement(ao,{initialValues:e.domainOption,validationSchema:Zf,onSubmit:e.saveDomainOption},d.createElement(ed,{id:e.domainOption&&e.domainOption.id}))}function nd(){var e=Object(te.useDispatch)();return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Create New Domain Option"),d.createElement(td,{saveDomainOption:function(t,n){i.fetch(e,Vf(t,(function(e){n(),r.AppLinkHelper.trigger({application:u.DOMAIN_OPTIONS,action:o.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]})}),n))}}))}function rd(e){var t=e.optionId,n=i.useBasicFetch(Uf(t)),r=Object(te.useDispatch)();return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Edit Domain Option"),n.data&&d.createElement(td,{domainOption:n.data,saveDomainOption:function(e,t){return i.fetch(r,Bf(e,t))}}))}function id(e){return(id="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 ad(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function od(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 sd(e,t,n){return t&&od(e.prototype,t),n&&od(e,n),e}function cd(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&&ld(e,t)}function ld(e,t){return(ld=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ud(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=fd(e);if(t){var i=fd(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return pd(this,n)}}function pd(e,t){return!t||"object"!==id(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 fd(e){return(fd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var dd=function(e){cd(n,e);var t=ud(n);function n(){return ad(this,n),t.apply(this,arguments)}return sd(n,[{key:"channelName",get:function(){return u.DOMAIN_OPTIONS}},{key:"appRoutes",get:function(){return{"developer/options(/)":"domainOptions","developer/options/new(/)":"newDomainOption","developer/options/:id(/)":"editDomainOption"}}},{key:"appLinks",get:function(){return["deleteDomainOption"]}}]),n}(r.AppRouter),md=function(e){cd(n,e);var t=ud(n);function n(){return ad(this,n),t.apply(this,arguments)}return sd(n,[{key:"domainOptions",value:function(){this.layout.showChildView(ae,d.createElement(Wf,null))}},{key:"newDomainOption",value:function(){this.layout.showChildView(ae,d.createElement(nd,null))}},{key:"editDomainOption",value:function(e){this.layout.showChildView(ae,d.createElement(rd,{optionId:e}))}},{key:"deleteDomainOption",value:function(e){this.layout.showChildView(oe,d.createElement($f,Object.assign({optionId:e},this.getPopupProps())))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return h.Radio.channel(y.ALERT).trigger("remove:alert",e)};this.layout.showChildView(se,d.createElement(Ef,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Domain Options Application"}},{key:"channelName",get:function(){return u.DOMAIN_OPTIONS}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return dd}}]),n}(r.Application),hd=function(e){return e?"".concat("/api/master/v2/people","?cursor=").concat(e):"/api/master/v2/people"},gd=function(e){return"/api/master/v2/objects/".concat(e)},yd=function(){return"/api/master/v2/people"},vd=function(e){return"/api/master/v2/objects/".concat(e)},bd="people",Sd="person",Ed="update:person",Cd=function(e){return{key:"".concat(bd).concat(e?":".concat(e):""),url:hd(e)}},Od=function(e){return{key:"".concat(Sd,":").concat(e),url:gd(e)}},Id=function(e,t,n){return{key:Sd,url:yd(),data:e,type:nt.POST,success:t,error:n,invalidationKeys:[bd]}},jd=function(e,t,n){return{key:"".concat(Ed,":").concat(e),url:vd(e),data:t,type:nt.PUT,always:n}},Ad=oo.object().shape({name:oo.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown();function Td(e){var t=za();return d.createElement(Qa,null,d.createElement(go,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this person",autoFocus:!0}),d.createElement(To,{isNew:e.isNew}))}function wd(e){return d.createElement(ao,{initialValues:e.person,validationSchema:Ad,onSubmit:e.savePerson},d.createElement(Td,{isNew:!(e.person&&e.person.id)}))}function Ld(e){var t=Object(te.useDispatch)(),n=i.useBasicFetch(Od(e.id));return d.createElement(d.Fragment,null,!!n.data&&d.createElement(wd,{person:n.data,savePerson:function(n,r){return i.fetch(t,jd(e.id,n,r))}}))}function kd(){var e=Object(te.useDispatch)();return d.createElement(wd,{savePerson:function(t,n){i.fetch(e,Id(t,(function(e){n(),r.AppLinkHelper.trigger({application:u.PEOPLE,action:o.People.EDIT_PERSON,args:[e.id]})}),n))}})}var _d=u.PEOPLE,xd=function(e){return{application:_d,action:o.People.EDIT_PERSON,args:[e.id]}},Pd=function(e){return r.AppLinkHelper.trigger(xd(e))};function Nd(e){var t=i.useBasicFetch(Cd(e.cursor));return d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-3 w-50"},d.createElement(Ll,{placeholder:"Search for a person",onSuggestionSelected:Pd,getRemoteUrl:function(e){return"".concat("/api/domain/v1/search/people/instant/raw","?q=").concat(e)},activationLength:2})),d.createElement(ep,{collection:t&&t.data,collectionAppLink:{application:_d,action:o.People.PEOPLE},newObjectAppLink:{application:_d,action:o.People.NEW_PERSON},getObjectAppLink:xd,objectName:"Person"}))}function Dd(e){return(Dd="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 Rd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fd(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 Md(e,t,n){return t&&Fd(e.prototype,t),n&&Fd(e,n),e}function Ud(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&&Vd(e,t)}function Vd(e,t){return(Vd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Bd(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Hd(e);if(t){var i=Hd(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return zd(this,n)}}function zd(e,t){return!t||"object"!==Dd(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 Hd(e){return(Hd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qd=function(e){Ud(n,e);var t=Bd(n);function n(){return Rd(this,n),t.apply(this,arguments)}return Md(n,[{key:"channelName",get:function(){return u.PEOPLE}},{key:"appRoutes",get:function(){return{"manage/people(/)":"people","manage/people/new(/)":"newPerson","manage/people/:id(/)":"editPerson"}}}]),n}(r.AppRouter),Jd=function(e){Ud(n,e);var t=Bd(n);function n(){return Rd(this,n),t.apply(this,arguments)}return Md(n,[{key:"people",value:function(e){var t=e.cursor;this.layout.showChildView(ae,d.createElement(Nd,{cursor:t}))}},{key:"newPerson",value:function(){this.layout.showChildView(ae,d.createElement(kd,null))}},{key:"editPerson",value:function(e){this.layout.showChildView(ae,d.createElement(Ld,{id:e}))}},{key:"name",get:function(){return"People Application"}},{key:"channelName",get:function(){return u.PEOPLE}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return qd}}]),n}(r.Application);const $d=class extends G{constructor(){super(),this.constructors={},this.destructors={},this.instances={},this.singletonInstances={},this.referenceCounts={}}get name(){return"InstanceManager"}static get Instance(){return this.instance||(this.instance=new this)}registerDataService(e,t){this.validateConstructor(e);const n=e.prototype.name;return this.referenceCounts[n]=0,this.constructors[n]=()=>new e({dataProvider:this.getInstance(t.dataProvider),cache:this.getInstance(t.cache),bootstrapData:t.bootstrapData,defaultErrorHandler:t.defaultErrorHandler,alertService:t.alertService}),this.destructors[n]=()=>{this.instances[n]?this.instances[n].destroy():x.throw(new B(`Trying to destroy a ${n} instance that has already been destroyed`)),this.releaseInstance(t.dataProvider),this.releaseInstance(t.cache)},this}registerInstance(e,t){this.validateConstructor(e);const n=e.prototype.name;return this.referenceCounts[n]=0,this.constructors[n]=()=>new e(t),this.destructors[n]=()=>m.isFunction(this.instances[n].destroy)&&this.instances[n].destroy(),this}registerSingleton(e){const t=e.name;return this.singletonInstances[t]=e,this}getInstance(e,t){return this.singletonInstances[e]?this.singletonInstances[e]:(this.constructors[e]||x.throw(new B(`${e} was not registered with ${this.name}`)),this.referenceCounts[e]++,t&&this.listenTo(t,"destroy",()=>this.releaseInstance(e)),this.instances[e]||(this.instances[e]=this.constructors[e]()),this.instances[e])}releaseInstance(e){if(this.instances[e])return window.setTimeout(()=>{this.referenceCounts[e]--,this.referenceCounts[e]<1&&(this.destructors[e](),delete this.instances[e])},0),this}validateConstructor(e){const t=e.prototype.name;t||x.throw(new B(`Classes registered with ${this.name} must have a unique name property.`)),this.constructors[t]&&x.throw(new B(`A class with the name: ${t} has already been registered with ${this.name}`))}}.Instance;function Kd(e){return function(e){const t=$d.getInstance(e);return d.useEffect(()=>()=>$d.releaseInstance(e)),t}(e)}function Yd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Gd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gd(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Wd(e){var t=e.imageType,n=e.closePopup,r=d.useContext(ou),i=r.getDataUrl,a=r.setImage,o=Yd(d.useState(i()),1)[0],s=Yd(d.useState(!1),2),c=s[0],l=s[1],u=Kd(f.IMAGE_UPLOAD),p=function(e){a(e),n()},m={dataUrl:o,imageType:t,minWidth:Kl[t].width,minHeight:Kl[t].height,onCrop:function(e){return u.uploadBase64Image(e,t,p,n)},onCancel:n};return d.createElement(Of,{title:"Crop Image",closePopup:n,onEntered:function(){return l(!0)}},c&&d.createElement(Vu,Object.assign({},m)))}var Zd=function(e){var t=e.children;return d.createElement(su,null,t)};const Qd=()=>{const e=Kd(Co);return{success(t){e.success(t)()},error(t){e.error(t)()},warning(t){e.createAlert({type:uf.Warning,heading:pf.Warning,message:t})}}};function Xd(e){var t=e.page,n=e.totalPages,r=No.isNumber(t)&&t>0&&t<n&&t+1,i=No.isNumber(t)&&t>1&&t-1,a={};if(r&&r<=n&&(a.next=r.toString()),i&&(a.previous=i.toString()),!pt.isEmpty(a))return a}var em={convertLegacyPaginatedCollection:function(e){if(e)return{data:e.data,pagination:{cursors:Xd(e.pagination),limit:e.pagination.pageSize}}}},tm=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"1";return{key:"playlists:".concat(e),url:"/ajax/playlists/curators?page=".concat(e),formatData:em.convertLegacyPaginatedCollection}},nm=function(e,t){var n="/api/domain/v1/search/playlists?query=".concat(e);return t&&(n+="&filter={page:".concat(t,"}")),{key:"playlists:search:".concat(e).concat(t?":".concat(t):""),url:n,formatData:em.convertLegacyPaginatedCollection}},rm=function(e){return{key:"playlist:".concat(e),url:"/api/master/v2/objects/".concat(e,"?query=cover,banner")}},im=function(e){var t=e.slice().sort();return{key:"playlists:".concat(t.join(",")),url:"/api/master/v2/objects?".concat(t.map((function(e){return"id=".concat(e)})).join("&"))}},am=function(e,t,n,r,i){return{url:"/api/master/v2/objects/".concat(t,"/playlists"),key:"playlist",data:e,type:nt.POST,invalidationKeys:"playlists",success:n,error:r,always:i}},om=function(e,t,n,r,i){return{url:"/api/master/v2/objects/".concat(e),key:"update:playlist:".concat(e),data:t,type:nt.PUT,success:n,error:r,always:i}},sm=function(e,t,n,r){return{url:"/api/master/v1/playlists/".concat(e),key:"delete:playlist:".concat(e),type:nt.DELETE,invalidationKeys:"playlists",success:t,error:n,always:r}},cm=function(e){return{key:"playlist:".concat(e,":videos"),url:"/api/master/v2/objects/".concat(e,"/videos?query={orderBy:orderindex,limit:100}")}},lm=function(e,t,n,r){return{key:"reorder:playlist",url:"/api/master/v1/objects/".concat(e,"/videos/reorder"),data:t,type:nt.PUT,invalidationKeys:"playlist:".concat(e,":videos"),success:n,error:r}},um=function(e,t,n,r,i){return{key:"remove:playlist:video",url:"/api/master/v1/playlists/".concat(e,"/dissociate/").concat(t),type:nt.DELETE,invalidationKeys:"playlist:".concat(e,":videos"),success:n,error:r,always:i}};function pm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return fm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fm(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dm(e){var t=Object(te.useDispatch)(),n=Qd(),a=pm(d.useState(!1),2),s=a[0],c=a[1],l=i.useBasicFetch(rm(e.playlistId));var p=[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){c(!0),i.fetch(t,sm(e.playlistId,(function(){n.success("Successfully deleted playlist."),r.AppLinkHelper.trigger({application:u.PLAYLISTS,action:o.Playlists.PLAYLISTS})}),(function(){c(!1),n.error("Failed to delete playlist.")}),e.closePopup))},buttonText:"Yes, delete playlist",isSpinnerButton:!0,showSpinner:s}],f=!!l.data;return d.createElement(Of,{title:"Delete Playlist",closePopup:e.closePopup,showLoadingSpinner:!f},f&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,l.data.name),"?"),d.createElement("p",null,"Please ensure it is not being used in any widgets.")),d.createElement(jf,{buttons:p})))}const mm={url:"/api/currentUser",key:"currentuser"};var hm,gm=oo.object().shape({name:oo.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:oo.string().trim().max(65535,"Description is too long").default(""),cover:oo.object().shape({fileId:oo.string(),fileIdType:oo.mixed(),url:oo.string()}).default({}).noUnknown(),banner:oo.object().shape({fileId:oo.string(),fileIdType:oo.mixed(),url:oo.string()}).default({}).noUnknown()}).noUnknown();!function(e){e.Developer="Curator Devs",e.Content="Content",e.Curator="Curators",e.Support="Support",e.SalesSupport="Sales Support"}(hm||(hm={}));var ym=function(){return[{value:"protected",access:"r"}]},vm=function(e){return[hm.Developer,hm.Content].some((function(t){return nu(e).includes(t)}))},bm=function(e,t){var n=u.PLAYLISTS,r=o.Playlists,i=[{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 vm(e)&&i.push.apply(i,[{label:"Subjects",appLink:{application:n,action:r.EDIT_PLAYLIST_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_PLAYLIST_AUDIENCES,args:[t]}}]),i};function Sm(e){var t=za(),n=yo(t);return d.createElement(Qa,null,d.createElement(go,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this playlist",autoFocus:!0}),d.createElement(go,{label:"Description",as:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this playlist here"}),d.createElement(fu,{imageType:Fl.Covers,fieldName:"cover",application:u.PLAYLISTS,uploadAction:o.Playlists.UPLOAD_IMAGE}),d.createElement(fu,{imageType:Fl.Banners,fieldName:"banner",application:u.PLAYLISTS,uploadAction:o.Playlists.UPLOAD_IMAGE}),d.createElement("div",{className:"d-flex justify-content-between align-items-center"},d.createElement(bo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&d.createElement(lp,{actions:e.actions})))}function Em(e){var t,n=e.playlist&&e.playlist.id;return d.createElement(ao,{initialValues:e.playlist,validationSchema:gm,onSubmit:e.savePlaylist},d.createElement(Sm,{id:n,actions:!!n&&(t=n,[{label:"Delete playlist",appLink:{application:u.PLAYLISTS,action:o.Playlists.DELETE_PLAYLIST,args:[t]},className:"text-danger"}])}))}function Cm(e){return d.createElement("div",{className:"py-2"},d.createElement(hp,{tabs:bm(e.currentUser,e.playlistId),isItemActive:(t=e.activeAction,function(e){return e.appLink.action===t})}));var t}function Om(e){var t=Object(te.useDispatch)(),n=Qd(),r=i.useBasicFetch(rm(e.playlistId)),a=i.useBasicFetch(mm);return d.createElement(d.Fragment,null,!!a.data&&d.createElement(Cm,{playlistId:e.playlistId,activeAction:o.Playlists.EDIT_PLAYLIST,currentUser:a.data}),!!r.data&&d.createElement(Em,{playlist:r.data,savePlaylist:function(r,a){i.fetch(t,om(e.playlistId,r,(function(){n.success("Successfully updated playlist.")}),(function(){n.error("Failed to update playlist.")}),a))}}))}const Im={fetch(e,t){const{dataServiceName:n,eventPrefix:r,fetchData:i,setData:a,onError:o,deleteEventPrefix:s}=e;if(!X.isFunction(i))return void x.throw(new B("A fetchData function must be passed to fetch"));if(!X.isFunction(a))return void x.throw(new B("A setData function must be passed to fetch"));const c=o&&X.isFunction(o),l=$d.getInstance(n),u=h.Radio.channel(l.channelName),p=r+":request",f=r+":sync",d=r+":error",m=r+":invalidate",g=s&&s+":sync",y=()=>t(!1),v=()=>t(!0),b=()=>t(!1),S=()=>u.off(m,b);u.once(p,y),u.once(f,v),u.once(m,b),c&&u.once(d,o),g&&u.once(g,S);const E=i(l);return E&&(t(!0),e.setData(E)),()=>{$d.releaseInstance(n),u.off(p,y),u.off(f,v),u.off(m,b),c&&u.off(d,o),g&&u.off(g,S)}}},jm=e=>Array(Array.isArray(e)?e.length:0).fill(!1);function Am(e,t,n=!0){const[r,i]=d.useState(jm(e));d.useEffect(()=>{i(jm(e))},[...t]),d.useEffect(()=>{if(!n)return;const t=[];return e&&e.forEach((e,n)=>{t.push(Im.fetch(e,e=>{e!==r[n]&&i(Mt.cloneAndReplaceAtIdx(r,n,e))}))}),()=>t.forEach(e=>e())},[r,n])}function Tm(e,t,n=!0){const[r,i]=d.useState(!1);d.useEffect(()=>{i(!1)},[...t]),d.useEffect(()=>{if(n)return Im.fetch(e,i)},[r,n])}const wm={getSetStateByKey:(e,t,n)=>r=>e(e=>{const i=X.isFunction(n)?n:X.useIdentity();return Object.assign(Object.assign({},e),{[t]:i(r,e)})})};var Lm,km,_m,xm;!function(e){e[e.Subject=0]="Subject",e[e.Classification=1]="Classification"}(Lm||(Lm={})),function(e){e.Playlists="playlists",e.Series="series",e.Videos="videos"}(km||(km={})),function(e){e.Root="0"}(_m||(_m={})),function(e){e.Root="root"}(xm||(xm={}));var Pm,Nm=oo.object().shape({name:oo.string().trim().max(255,"Name is too long").required("Name is required").default(""),levelIds:oo.array().of(oo.string()).required("A level is required").default([])}).noUnknown();!function(e){e.Subject="Subject",e.Topic="Topic"}(Pm||(Pm={}));var Dm=oo.object().shape({name:oo.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentIds:oo.array().of(oo.string()).default([xm.Root]),subjectIds:oo.array().of(oo.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:oo.mixed().required("Type is required").default(Pm.Subject),emphasize:oo.boolean().default(!1),comingSoon:oo.boolean().default(!0),canBePreferred:oo.boolean().default(!1),cover:oo.object().shape({fileId:oo.string(),fileIdType:oo.mixed(),url:oo.string()}).default({}).noUnknown(),banner:oo.object().shape({fileId:oo.string(),fileIdType:oo.mixed(),url:oo.string()}).default({}).noUnknown()}).noUnknown(),Rm=oo.object().shape({name:oo.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),Fm=oo.object().shape({name:oo.string().max(255,"Name is too long").required("Name is required"),description:oo.string().max(65535,"Description is too long").required("Description is required")}),Mm=oo.object().shape({name:oo.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentId:oo.string().default(_m.Root)}).noUnknown(),Um={singularizeMemberType:function(e){switch(e){case km.Playlists:return"playlist";case km.Series:return"series";case km.Videos:return"video"}},getMemberAppLink:function(e,t){var n=[t];switch(e){case km.Playlists:return{application:u.PLAYLISTS,action:o.Playlists.EDIT_PLAYLIST,args:n};case km.Series:return{application:u.SERIES,action:o.Series.EDIT_SERIES,args:n};case km.Videos:return{application:u.VIDEOS,action:o.Videos.EDIT_VIDEO,args:n}}},getMemberActions:function(e,t,n,r){return[{label:"Remove ".concat(Um.singularizeMemberType(n)),appLink:{application:u.SUBJECTS,action:t===Lm.Subject?o.Subjects.REMOVE_SUBJECT_MEMBER:o.Subjects.REMOVE_CLASSIFICATION_MEMBER,args:[e,r,n]},className:"text-danger"}]}},Vm=function(){var e=u.SUBJECTS,t=o.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]}]},Bm=function(e){var t=u.SUBJECTS,n=o.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]}}]},zm=function(e,t){var n=u.SUBJECTS,r=o.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 Hm(e){return(Hm="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 qm(e){return function(e){if(Array.isArray(e))return Jm(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Jm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jm(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Km(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 Ym(e,t){return(Ym=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Gm(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Zm(e);if(t){var i=Zm(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Wm(this,n)}}function Wm(e,t){return!t||"object"!==Hm(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 Zm(e){return(Zm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Qm=function(){return"/api/subjects/v1/subjects/tree"},Xm=function(e){return"/api/subjects/v1/subjects/".concat(e)},eh=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/").concat(t,"?query={limit:100}")},th=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},nh=function(){return"/api/subjects/v1/subjects"},rh=function(e){return"/api/subjects/v1/subjects/".concat(e)},ih=function(e){return"/api/subjects/v1/subjects/".concat(e)},ah=function(e){return"/api/subjects/v1/objects/".concat(e,"/subjects")},oh=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/subjects?addToClassifications=").concat(!!t)},sh=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?addToClassifications=").concat(!!t)},ch=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},lh=function(){return"/api/subjects/v1/presentations"},uh=function(e){return"/api/subjects/v1/presentations/".concat(e)},ph=function(){return"/api/subjects/v1/presentations"},fh=function(e){return"/api/subjects/v1/presentations/".concat(e)},dh=function(e){return"/api/subjects/v1/presentations/".concat(e,"/classifications/tree")},mh=function(e){return"/api/subjects/v1/classifications/".concat(e,"?query=cover,banner")},hh=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/").concat(t,"?query={limit:100}")},gh=function(){return"/api/subjects/v1/classifications"},yh=function(e){return"/api/subjects/v1/classifications/".concat(e)},vh=function(e){return"/api/subjects/v1/classifications/".concat(e)},bh=function(e){return"/api/subjects/v1/objects/".concat(e,"/classifications")},Sh=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/classifications?presentationId=").concat(t)},Eh=function(e){return"/api/subjects/v1/classifications/".concat(e,"/objects")},Ch=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Oh=function(){return"/api/subjects/v1/levels"},Ih=function(e){return"/api/subjects/v1/levels/".concat(e)},jh=function(){return"/api/subjects/v1/levels"},Ah=function(e){return"/api/subjects/v1/levels/".concat(e)},Th=function(e){return"/api/subjects/v1/objects/".concat(e,"/levels")},wh=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/levels?addToAudiences=").concat(!!t)},Lh=function(e){return"/api/subjects/v1/presentations/".concat(e,"/audiences")},kh=function(e){return"/api/subjects/v1/audiences/".concat(e)},_h=function(){return"/api/subjects/v1/audiences"},xh=function(e){return"/api/subjects/v1/audiences/".concat(e)},Ph=function(e){return"/api/subjects/v1/audiences/".concat(e)},Nh=function(e){return"/api/subjects/v1/objects/".concat(e,"/audiences")},Dh=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/audiences?presentationId=").concat(t)},Rh=function(e,t,n){var r="".concat(s.SUBJECT,":").concat(e);return t&&(r+=":".concat(t)),r+=":".concat(s.CLASSIFICATIONS),n&&(r+=":".concat(n)),r},Fh=function(e){!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&&Ym(e,t)}(a,e);var t,n,r,i=Gm(a);function a(){return $m(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"getPresentations",value:function(e,t){return this.get({resource:lh(),eventPrefix:s.PRESENTATIONS,expiryTime:Je.STANDARD,callback:e,errorCallback:t})}},{key:"getPresentation",value:function(e,t,n){return this.get({resource:uh(e),eventPrefix:"".concat(s.PRESENTATION,":").concat(e),expiryTime:Je.STANDARD,callback:t,errorCallback:n})}},{key:"createPresentation",value:function(e,t,n){return this.create({resource:ph(),data:e,callback:t,errorCallback:n,eventPrefix:s.PRESENTATION,invalidationKeys:[s.PRESENTATIONS],expiryTime:Je.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:fh(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(s.UPDATE_PRESENTATION,":").concat(e),invalidationKeys:["".concat(s.PRESENTATION,":").concat(e),s.PRESENTATIONS],expiryTime:Je.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:Qm(),formatData:function(e){return{children:e,name:_m.Root,id:null}},eventPrefix:s.SUBJECTS,expiryTime:Je.STANDARD,callback:e,errorCallback:t})}},{key:"getSubject",value:function(e,t,n){return this.get({resource:Xm(e),eventPrefix:"".concat(s.SUBJECT,":").concat(e),expiryTime:Je.STANDARD,callback:t,errorCallback:n})}},{key:"getSubjectMemberIds",value:function(e,t,n,r){return this.get({resource:eh(e,t),eventPrefix:"".concat(s.SUBJECT,":").concat(e,":").concat(t),expiryTime:Je.STANDARD,callback:n,errorCallback:r})}},{key:"getSubjectClassifications",value:function(e,t,n,r,i){return this.get({resource:th(e,t,n),eventPrefix:Rh(e,t,n),expiryTime:Je.STANDARD,callback:r,errorCallback:i})}},{key:"createSubject",value:function(e,t,n){return this.create({resource:nh(),data:e,callback:t,errorCallback:n,eventPrefix:s.SUBJECT,invalidationKeys:[s.SUBJECTS],expiryTime:Je.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:rh(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(s.UPDATE_SUBJECT,":").concat(e),invalidationKeys:["".concat(s.SUBJECT,":").concat(e),s.SUBJECTS],expiryTime:Je.STANDARD,successHandler:this.alertService.success("Successfully updated subject."),errorHandler:this.alertService.error("Failed to save subject.")})}},{key:"deleteSubject",value:function(e,t,n){var r=this;return this.delete({resource:ih(e),callback:t,errorCallback:n,eventPrefix:s.DELETE_SUBJECT,invalidationKeys:["".concat(s.SUBJECT,":").concat(e),s.SUBJECTS],successHandler:this.alertService.success("Successfully deleted subject."),errorHandler:function(e){var t,n=(null===(t=e)||void 0===t?void 0:t.code)===_t.Conflict?"Cannot delete a subject with child subjects and/or classifications.":"Failed to delete subject.";r.alertService.error(n)()}})}},{key:"getObjectSubjects",value:function(e,t,n,r){return this.get({resource:ah(e),eventPrefix:"".concat(t,":").concat(e,":").concat(s.SUBJECTS),expiryTime:Je.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectSubjects",value:function(e,t,n,r,i,a){var o=Um.singularizeMemberType(n),c=["".concat(n,":").concat(e,":").concat(s.SUBJECTS)];return r&&c.push("".concat(n,":").concat(e,":").concat(s.CLASSIFICATIONS)),c.push.apply(c,qm(t.map((function(e){return"".concat(s.SUBJECTS,":").concat(e,":").concat(n)})))),this.update({resource:oh(e,r),data:t,callback:i,errorCallback:a,eventPrefix:"".concat(s.UPDATE_OBJECT_SUBJECTS,":").concat(e),invalidationKeys:c,successHandler:this.alertService.success("Successfully updated ".concat(o," subjects.")),errorHandler:this.alertService.error("Failed to update ".concat(o," subjects."))})}},{key:"addObjectsToSubject",value:function(e,t,n,r,i,a){var o=1===t.length?Um.singularizeMemberType(n):n,c=["".concat(s.SUBJECT,":").concat(e,":").concat(n)].concat(qm(t.map((function(e){return"".concat(n,":").concat(e,":").concat(s.SUBJECTS)}))),qm(t.map((function(e){return"".concat(n,":").concat(e,":").concat(s.CLASSIFICATIONS)}))));return this.create({resource:sh(e,r),data:t,callback:i,errorCallback:a,eventPrefix:"".concat(s.ADD_TO_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:c,expiryTime:Je.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(o," to subject.")),errorHandler:this.alertService.error("Failed to add ".concat(o," to subject."))})}},{key:"removeObjectsFromSubject",value:function(e,t,n,r,i){var a=1===t.length?Um.singularizeMemberType(n):n,o=["".concat(s.SUBJECT,":").concat(e,":").concat(n)].concat(qm(t.map((function(e){return"".concat(n,":").concat(e,":").concat(s.SUBJECTS)}))));return this.delete({resource:ch(e,t),callback:r,errorCallback:i,eventPrefix:"".concat(s.REMOVE_FROM_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:o,expiryTime:Je.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(a," from subject.")),errorHandler:this.alertService.error("Failed to remove ".concat(a," from subject."))})}},{key:"getClassificationTree",value:function(e,t,n){return this.get({resource:dh(e),formatData:function(e){return{children:e,name:xm.Root,id:null}},eventPrefix:"".concat(s.CLASSIFICATIONS,":").concat(e),expiryTime:Je.STANDARD,callback:t,errorCallback:n})}},{key:"getClassification",value:function(e,t,n){return this.get({resource:mh(e),eventPrefix:"".concat(s.CLASSIFICATION,":").concat(e),expiryTime:Je.STANDARD,callback:t,errorCallback:n})}},{key:"getClassificationMembers",value:function(e,t,n,r){return this.get({resource:hh(e,t),eventPrefix:"".concat(s.CLASSIFICATION,":").concat(e,":").concat(t),expiryTime:Je.STANDARD,callback:n,errorCallback:r})}},{key:"createClassification",value:function(e,t,n){return this.create({resource:gh(),data:e,callback:t,errorCallback:n,eventPrefix:s.CLASSIFICATION,invalidationKeys:[s.CLASSIFICATIONS],expiryTime:Je.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:yh(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(s.UPDATE_CLASSIFICATION,":").concat(e),invalidationKeys:["".concat(s.CLASSIFICATION,":").concat(e),s.CLASSIFICATIONS],expiryTime:Je.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:vh(e),callback:t,errorCallback:n,eventPrefix:s.DELETE_CLASSIFICATION,invalidationKeys:["".concat(s.CLASSIFICATION,":").concat(e),s.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:bh(e),eventPrefix:"".concat(t,":").concat(e,":").concat(s.CLASSIFICATIONS),expiryTime:Je.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectClassifications",value:function(e,t,n,r,i,a){var o=Um.singularizeMemberType(r),c=["".concat(r,":").concat(e,":").concat(s.CLASSIFICATIONS)];return c.push.apply(c,qm(n.map((function(e){return"".concat(s.CLASSIFICATION,":").concat(e,":").concat(r)})))),this.update({resource:Sh(e,t),data:n,callback:i,errorCallback:a,eventPrefix:"".concat(s.UPDATE_OBJECT_CLASSIFICATIONS,":").concat(e),invalidationKeys:c,successHandler:this.alertService.success("Successfully updated ".concat(o," classifications.")),errorHandler:this.alertService.error("Failed to update ".concat(o," classifications."))})}},{key:"addObjectsToClassification",value:function(e,t,n,r,i,a,o){var c=1===t.length?Um.singularizeMemberType(n):n,l=["".concat(s.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&l.push(Rh(r,i,n)),l.push.apply(l,qm(t.map((function(e){return"".concat(n,":").concat(e,":").concat(s.CLASSIFICATIONS)})))),this.create({resource:Eh(e),data:t,callback:a,errorCallback:o,eventPrefix:"".concat(s.ADD_TO_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:l,expiryTime:Je.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(c," to classification.")),errorHandler:this.alertService.error("Failed to add ".concat(c," to classification."))})}},{key:"removeObjectsFromClassification",value:function(e,t,n,r,i,a,o){var c=1===t.length?Um.singularizeMemberType(n):n,l=["".concat(s.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&l.push(Rh(r,i,n)),l.push.apply(l,qm(t.map((function(e){return"".concat(n,":").concat(e,":").concat(s.CLASSIFICATIONS)})))),this.delete({resource:Ch(e,t),callback:a,errorCallback:o,eventPrefix:"".concat(s.REMOVE_FROM_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:l,expiryTime:Je.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(c," from classification.")),errorHandler:this.alertService.error("Failed to remove ".concat(c," from classification."))})}},{key:"getLevels",value:function(e,t){return this.get({resource:Oh(),eventPrefix:s.LEVELS,expiryTime:Je.STANDARD,callback:e,errorCallback:t})}},{key:"getLevel",value:function(e,t,n){return this.get({resource:Ih(e),eventPrefix:"".concat(s.LEVEL,":").concat(e),expiryTime:Je.STANDARD,callback:t,errorCallback:n})}},{key:"createLevel",value:function(e,t,n){return this.create({resource:jh(),data:e,callback:t,errorCallback:n,eventPrefix:s.LEVEL,invalidationKeys:[s.LEVELS],expiryTime:Je.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:Ah(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(s.UPDATE_LEVEL,":").concat(e),invalidationKeys:["".concat(s.LEVEL,":").concat(e),s.LEVELS],expiryTime:Je.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:Th(e),eventPrefix:"".concat(t,":").concat(e,":").concat(s.LEVELS),expiryTime:Je.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectLevels",value:function(e,t,n,r,i,a){var o=Um.singularizeMemberType(n),c=["".concat(n,":").concat(e,":").concat(s.LEVELS)];return r&&c.push("".concat(n,":").concat(e,":").concat(s.AUDIENCES)),this.update({resource:wh(e,r),data:t,callback:i,errorCallback:a,eventPrefix:"".concat(s.UPDATE_OBJECT_LEVELS,":").concat(e),invalidationKeys:c,successHandler:this.alertService.success("Successfully updated ".concat(o," levels.")),errorHandler:this.alertService.error("Failed to update ".concat(o," levels."))})}},{key:"getAudiences",value:function(e,t,n){return this.get({resource:Lh(e),callback:t,errorCallback:n,eventPrefix:"".concat(s.AUDIENCES,":").concat(e),expiryTime:Je.STANDARD})}},{key:"getAudience",value:function(e,t,n){return this.get({resource:kh(e),callback:t,errorCallback:n,eventPrefix:"".concat(s.AUDIENCE,":").concat(e),expiryTime:Je.STANDARD})}},{key:"createAudience",value:function(e,t,n){return this.create({resource:_h(),data:e,callback:t,errorCallback:n,eventPrefix:s.AUDIENCE,invalidationKeys:[s.AUDIENCES],expiryTime:Je.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:xh(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(s.UPDATE_AUDIENCE,":").concat(e),invalidationKeys:["".concat(s.AUDIENCE,":").concat(e),s.AUDIENCES],expiryTime:Je.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:Ph(e),callback:t,errorCallback:n,eventPrefix:s.DELETE_AUDIENCE,invalidationKeys:["".concat(s.AUDIENCE,":").concat(e),s.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:Nh(e),eventPrefix:"".concat(t,":").concat(e,":").concat(s.AUDIENCES),expiryTime:Je.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectAudiences",value:function(e,t,n,r,i,a){var o=Um.singularizeMemberType(r);return this.update({resource:Dh(e,t),data:n,callback:i,errorCallback:a,eventPrefix:"".concat(s.UPDATE_OBJECT_AUDIENCES,":").concat(e),invalidationKeys:["".concat(r,":").concat(e,":").concat(s.AUDIENCES)],successHandler:this.alertService.success("Successfully updated ".concat(o," audiences.")),errorHandler:this.alertService.error("Failed to update ".concat(o," audiences."))})}},{key:"name",get:function(){return f.SUBJECT}},{key:"channelName",get:function(){return p.SUBJECT}}])&&Km(t.prototype,n),r&&Km(t,r),a}(De),Mh={dataServiceName:f.SUBJECT,dataChannelName:p.SUBJECT},Uh={getSubjectTreeFetchOptions:function(e,t){return Object.assign(Object.assign({},Mh),{eventPrefix:s.SUBJECTS,fetchData:function(e){return e.getSubjectTree()},setData:e,onError:t})},getSubjectFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Mh),{eventPrefix:"".concat(s.SUBJECT,":").concat(e),fetchData:function(t){return t.getSubject(e)},setData:t,onError:n,deleteEventPrefix:s.DELETE_SUBJECT})},getSubjectMemberIdsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Mh),{eventPrefix:"".concat(s.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({},Mh),{eventPrefix:Rh(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({},Mh),{eventPrefix:"".concat(t,":").concat(e,":").concat(s.SUBJECTS),fetchData:function(n){return n.getObjectSubjects(e,t)},setData:n,onError:r})},getPresentationsFetchOptions:function(e,t){return Object.assign(Object.assign({},Mh),{eventPrefix:s.PRESENTATIONS,fetchData:function(e){return e.getPresentations()},setData:e,onError:t})},getPresentationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Mh),{eventPrefix:"".concat(s.PRESENTATION,":").concat(e),fetchData:function(t){return t.getPresentation(e)},setData:t,onError:n})},getClassificationTreeFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Mh),{eventPrefix:"".concat(s.CLASSIFICATIONS,":").concat(e),fetchData:function(t){return t.getClassificationTree(e)},setData:t,onError:n})},getClassificationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Mh),{eventPrefix:"".concat(s.CLASSIFICATION,":").concat(e),fetchData:function(t){return t.getClassification(e)},setData:t,onError:n,deleteEventPrefix:s.DELETE_CLASSIFICATION})},getClassificationMembersFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Mh),{eventPrefix:"".concat(s.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({},Mh),{eventPrefix:"".concat(t,":").concat(e,":").concat(s.CLASSIFICATIONS),fetchData:function(n){return n.getObjectClassifications(e,t)},setData:n,onError:r})},getLevelsFetchOptions:function(e,t){return Object.assign(Object.assign({},Mh),{eventPrefix:s.LEVELS,fetchData:function(e){return e.getLevels()},setData:e,onError:t})},getLevelFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Mh),{eventPrefix:"".concat(s.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({},Mh),{eventPrefix:"".concat(t,":").concat(e,":").concat(s.LEVELS),fetchData:function(n){return n.getObjectLevels(e,t)},setData:n,onError:r})},getAudiencesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Mh),{eventPrefix:"".concat(s.AUDIENCES,":").concat(e),fetchData:function(t){return t.getAudiences(e)},setData:t,onError:n})},getAudienceFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Mh),{eventPrefix:"".concat(s.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({},Mh),{eventPrefix:"".concat(t,":").concat(e,":").concat(s.AUDIENCES),fetchData:function(n){return n.getObjectAudiences(e,t)},setData:n,onError:r})}},Vh=function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_LEVEL,args:[e.id]}},Bh=function(e,t){var n=e.levelIds;return t.filter((function(e){return n.includes(e.id)}))};function zh(e){var t=e.showLevels;return d.createElement("thead",null,d.createElement("tr",null,d.createElement("th",null,"Audiences"),!!t&&d.createElement("th",null,"Mapped Level(s)")))}function Hh(e){var t,n=e.audience,r=e.levels;return d.createElement("tr",null,d.createElement("td",null,d.createElement(kl,{appLink:(t=n,{application:u.SUBJECTS,action:o.Subjects.EDIT_AUDIENCE,args:[t.presentationId,t.masterId]})},n.name)),d.createElement("td",null,r.map((function(e){return d.createElement(kl,{key:e.id,appLink:Vh(e),className:"mr-2"},e.name)}))))}function qh(e){var t=e.audiences,n=e.levels;return d.createElement(co.Table,{responsive:!0,bordered:!0},d.createElement(zh,{showLevels:!!t.length}),d.createElement("tbody",null,t.length?t.map((function(e){return d.createElement(Hh,{key:e.masterId,audience:e,levels:Bh(e,n)})})):d.createElement("tr",null,d.createElement("td",null,"This presentation has no audiences."))))}function Jh(e){var t=null===e.masterId||void 0===e.masterId,n=za(),r=yo(n);return d.createElement(Qa,null,d.createElement(go,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this audience",autoFocus:!0}),d.createElement(go,{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 d.createElement("option",{key:e.id,value:e.id},e.name)}))),d.createElement("div",{className:"d-flex justify-content-between"},d.createElement(bo,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&d.createElement(co.Button,{as:kl,variant:"danger",appLink:{application:u.SUBJECTS,action:o.Subjects.DELETE_AUDIENCE,args:[e.presentationId,e.masterId]}},"Delete")))}function $h(e){return d.createElement(ao,{initialValues:e.audience,validationSchema:Nm,onSubmit:e.saveAudience},d.createElement(Jh,{masterId:e.audience&&e.audience.masterId,presentationId:e.presentationId,levels:e.levels}))}function Kh(e){var t=e.objectAudiences,n=e.presentationAudiences;return t.filter((function(e){return n.some((function(t){return t.masterId===e.masterId}))}))}function Yh(e){var t,n,r,i,a,o=Um.singularizeMemberType(e.memberType),s=(n=(t=e).presentationAudiences,r=t.objectLevels,i=t.objectAudiences,a=r.map((function(e){return e.id})),n.filter((function(e){return Mt.intersection(e.levelIds,a).length||i.some((function(t){return t.masterId===e.masterId}))})));return d.createElement(d.Fragment,null,d.createElement("div",{className:"border-bottom pb-3 mb-3"},d.createElement("h6",null,"Levels"),d.createElement("p",null,"Select which levels this ".concat(o," is mapped to.")),d.createElement("p",null,"To see how levels correspond to audiences, scroll down to the audience-level mappings table."),d.createElement(hg,{initialValues:{levelIds:e.objectLevels.map((function(e){return e.id})),addToAudiences:!0},saveLevels:e.saveLevels,levels:e.levels,memberType:e.memberType})),d.createElement("h6",null,"Audiences"),d.createElement("p",null,"Select a presentation to view its audiences and map them to this ".concat(o,".")),d.createElement("div",{className:"w-50 pb-3"},d.createElement(vg,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),d.createElement("p",null,"Audience to level mappings for this presentation are displayed below."),d.createElement(qh,{levels:e.levels,audiences:e.presentationAudiences}),d.createElement("p",null,"Only the audiences which are mapped to a level that this"+" ".concat(o," is mapped to are displayed below.")),!!s.length&&d.createElement(Wh,{initialValues:{audienceIds:Kh(e).map((function(e){return e.masterId}))},saveAudiences:e.saveAudiences,audiences:s}))}function Gh(e){var t=za(),n=yo(t);return d.createElement(Qa,null,d.createElement(go,{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 d.createElement("option",{key:e.masterId,value:e.masterId},e.name)}))),d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(bo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Audiences")))}function Wh(e){return d.createElement(ao,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.audienceIds;return e.saveAudiences(r,n)},enableReinitialize:!0},d.createElement(Gh,{audiences:e.audiences}))}function Zh(e){var t=e.item,n=e.getItemAppLink,r=e.actions,i=e.pinState;return d.createElement("tr",null,d.createElement("td",null,d.createElement(kl,{appLink:n(t)},t.name)),i.isPinnable&&d.createElement("td",null,d.createElement(Dl,{selected:parseInt(t.id)===parseInt(i.currentPinnedVideo),onToggle:function(e){return i.onChange(e,t.id)},id:t.id})),r&&d.createElement("td",null,d.createElement("span",{className:"d-flex justify-content-end"},d.createElement(lp,{actions:r}))))}function Qh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Xh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xh(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function eg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return tg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tg(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ng(e){var t=e.items,n=e.memberType,r=e.classification,i=e.getItemAppLink,a=e.getActions,o=e.updatePinnedVideo,s=eg(d.useState(!1),2),c=s[0],l=s[1],u=function(e,t){var n=e.pinnedVideoMasterId||null,r=Qh(d.useState(n),2),i=r[0],a=r[1];return{currentPinnedVideo:i,onChange:function(e,t){a(e?t:null)},canSubmit:n!==i,isPinnable:t===km.Videos}}(r,n);if(!t.length)return d.createElement("div",{className:"py-5"},"No ".concat(n," in this classification."));var p="".concat(Ql(Um.singularizeMemberType(n))," Name");return d.createElement(d.Fragment,null,d.createElement(co.Table,{responsive:!0},d.createElement("thead",null,d.createElement("tr",null,d.createElement("th",null,p),u.isPinnable&&d.createElement("th",null,"Pinned"),X.isFunction(a)&&d.createElement("th",null))),d.createElement("tbody",null,t.map((function(e){return d.createElement(Zh,{item:e,key:e.id,getItemAppLink:i,actions:X.isFunction(a)&&a(e),pinState:u})})))),u.isPinnable&&d.createElement(bo,{showSpinner:c,onClick:function(){l(!0),o(u.currentPinnedVideo,(function(){return l(!1)}))},disabled:!u.canSubmit||c},"Save"))}function rg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ig(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ig(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ig(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ag=function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_SUBJECT,args:[e]}};function og(e){var t=za(),n=yo(t),r=null===e.id||void 0===e.id,i=!r||!(!t.values.parentIds||!t.values.parentIds.length),a=rg(d.useState(i),2),s=a[0],c=a[1];d.useEffect((function(){return c(i)}),[e.id,t.values.parentIds]),d.useEffect((function(){t.values.subjectIds.length&&!t.touched.subjectIds&&t.setFieldTouched("subjectIds",!0)}),[t.values.subjectIds]);var l=function(e){return t.setFieldValue("parentIds",Mt.addOrRemove(t.values.parentIds.map((function(e){return e.toString()})),e.id.toString()))},p=function(e){return t.setFieldValue("subjectIds",Mt.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),e.id.toString()))},f=function(e){return"".concat(lo.getCustomFormControlClassName(t.errors,t.touched,e)," h-auto py-2")};return d.createElement(Qa,null,d.createElement(go,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this classification",autoFocus:!0}),d.createElement(go,{as:"select",label:"Type",name:"type",id:"type",value:t.values.type},pt.getEnumKeys(Pm).map((function(e){return d.createElement("option",{key:e,value:Pm[e]},e)}))),d.createElement(go,{label:"Coming Soon",name:"comingSoon",id:"comingSoon",type:"checkbox",checked:t.values.comingSoon}),d.createElement(go,{label:"Emphasize",name:"emphasize",id:"emphasize",type:"checkbox",checked:t.values.emphasize}),d.createElement(go,{label:"Can Be Preferred",name:"canBePreferred",id:"canBePreferred",type:"checkbox",checked:t.values.canBePreferred}),d.createElement(go,{name:"parentIds"},(function(){return d.createElement("div",{className:f("parentIds")},d.createElement(wp,{label:"Parent Classification(s)",tree:e.classificationTree,selectedIds:t.values.parentIds,onSelect:l,collapse:s,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=tu.find(n,r);return!!tu.find(t,e.id)})}));var n,r})),d.createElement(go,{name:"subjectIds"},(function(){return d.createElement("div",{className:f("subjectIds")},d.createElement(wp,{label:"Mapped Subject(s)",tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:p,collapse:!r,getSelectedItemAppLink:ag}))})),d.createElement(fu,{imageType:Fl.Covers,fieldName:"cover",application:u.SUBJECTS,uploadAction:o.Subjects.UPLOAD_IMAGE}),d.createElement(fu,{imageType:Fl.Banners,fieldName:"banner",application:u.SUBJECTS,uploadAction:o.Subjects.UPLOAD_IMAGE}),d.createElement("div",{className:"d-flex justify-content-between"},d.createElement(bo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},r?"Create":"Save"),!r&&d.createElement(co.Button,{as:kl,variant:"danger",appLink:{application:u.SUBJECTS,action:o.Subjects.DELETE_CLASSIFICATION,args:[e.presentationId,e.id]}},"Delete")))}function sg(e){return d.createElement(ao,{initialValues:e.classification,validationSchema:Dm,onSubmit:e.saveClassification},d.createElement(og,{id:e.classification&&e.classification.id,presentationId:e.presentationId,classificationTree:e.classificationTree,subjectTree:e.subjectTree}))}var cg=function(e){return function(t){if(!e)return t.appLink.action===o.Subjects.EDIT_CLASSIFICATION;switch(e){case km.Playlists:return t.appLink.action===o.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;case km.Series:return t.appLink.action===o.Subjects.EDIT_CLASSIFICATION_SERIES;case km.Videos:return t.appLink.action===o.Subjects.EDIT_CLASSIFICATION_VIDEOS}}};function lg(e){var t=e.presentation,n=e.classificationId,r=e.memberType;return t?d.createElement(d.Fragment,null,d.createElement("h6",null,"Presentation: ".concat(!!t&&t.name)),d.createElement("div",{className:"py-2"},d.createElement(hp,{tabs:zm(t.id,n),isItemActive:cg(r)}))):d.createElement(d.Fragment,null)}function ug(e){var t=za(),n=yo(t),r=function(e){return t.setFieldValue("classificationIds",Mt.addOrRemove(t.values.classificationIds.map((function(e){return e.toString()})),e.id.toString()))},i="".concat(lo.getCustomFormControlClassName(t.errors,t.touched,"classificationIds")," h-auto py-2");return d.createElement(Qa,null,d.createElement(go,{name:"classificationIds"},(function(){return d.createElement("div",{className:i},d.createElement(wp,{label:"Mapped Classification(s)",tree:e.classificationTree,selectedIds:t.values.classificationIds,onSelect:r,getSelectedItemAppLink:(n=e.presentationId,function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_CLASSIFICATION,args:[n,e]}}),isNodeDisabled:e.isClassificationDisabled}));var n})),d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(bo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Classifications")))}function pg(e){return d.createElement(ao,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.classificationIds;return e.saveClassifications(r,n)},enableReinitialize:!0},d.createElement(ug,{presentationId:e.presentationId,classificationTree:e.classificationTree,isClassificationDisabled:e.isClassificationDisabled}))}function fg(e){var t=null===e.id||void 0===e.id,n=za(),r=yo(n);return d.createElement(Qa,null,d.createElement(go,{label:"Name",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this level",autoFocus:!0}),d.createElement(bo,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"))}function dg(e){return d.createElement(ao,{initialValues:e.level,validationSchema:Rm,onSubmit:e.saveLevel},d.createElement(fg,{id:e.level&&e.level.id}))}function mg(e){var t=Um.singularizeMemberType(e.memberType),n=za(),r=yo(n);return d.createElement(Qa,null,d.createElement(go,{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 d.createElement("option",{key:e.id,value:e.id},e.name)}))),d.createElement(go,{label:"Automatically add to audiences*",name:"addToAudiences",id:"add-to-audiences",type:"checkbox",checked:n.values.addToAudiences}),d.createElement("p",null,d.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.")),d.createElement("p",null,d.createElement("strong",null,"Note:")," When removing a ".concat(t," from a level, that level's audiences "),d.createElement("strong",null,"will not")," be automatically removed from."),d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(bo,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},"Save Levels")))}function hg(e){return d.createElement(ao,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.levelIds,i=t.addToAudiences;return e.saveLevels(r,i,n)}},d.createElement(mg,{levels:e.levels,memberType:e.memberType}))}function gg(e){var t=e.values,n=t.name,r=t.description,i=e.id,a=e.isSubmitting,o=!i;return d.createElement(Qa,null,d.createElement(go,{label:"Name",type:"text",name:"name",id:"name",value:n,placeholder:"Enter a name for this presentation",autoFocus:!0}),d.createElement(go,{label:"Description",as:"textarea",name:"description",id:"description",value:r,placeholder:"Describe this presentation here"}),d.createElement(bo,{showSpinner:a,type:"submit"},o?"Create":"Save"))}function yg(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,s=void 0===o?"":o,c=e.savePresentation;return d.createElement(Ka,{initialValues:{name:a,description:s},validationSchema:Fm,onSubmit:c},(function(e){return d.createElement(gg,Object.assign({id:r},e))}))}function vg(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,Mt.first(i.filter((function(e){return e.id.toString()===n.toString()}))));r(a)};return d.useEffect((function(){t&&!n&&r(t[0])}),[t]),d.createElement(d.Fragment,null,!!n&&d.createElement(d.Fragment,null,d.createElement(co.Form.Label,null,i),d.createElement(co.Form.Control,{as:"select",value:n.id,onChange:function(e){return a(e.target.value)},className:"cursor-pointer"},t.map((function(e){return d.createElement("option",{value:e.id,key:e.id},e.name)})))))}function bg(e){return d.createElement(d.Fragment,null,d.createElement("h4",null,"".concat(Ql(e.memberType))),d.createElement(co.Table,{responsive:!0},d.createElement("tbody",null,e.objects&&e.objects.map((function(t){return d.createElement("tr",{key:t.id},d.createElement("td",null,d.createElement(kl,{appLink:Um.getMemberAppLink(e.memberType,t.id)},t.name)))})))),d.createElement(_g,{initialValues:{subjectIds:[],addToClassifications:!0},subjectTree:e.subjectTree,saveSubjects:e.onClickAddToSubject,memberType:e.memberType,saveBtnText:"Add to subject",subjectRequired:!0}))}function Sg(e){return function(e){if(Array.isArray(e))return Eg(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Eg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Eg(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Eg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Cg(e){var t=Um.singularizeMemberType(e.memberType),n=[].concat(Sg(e.objectClassifications),Sg(e.objectSubjectClassifications)).map((function(e){return e.id}));return d.createElement(d.Fragment,null,d.createElement("div",{className:"border-bottom pb-3 mb-3"},d.createElement("h6",null,"Subjects"),d.createElement("p",null,"Select which subjects this ".concat(t," is mapped to.")),d.createElement(_g,{initialValues:{subjectIds:e.objectSubjects.map((function(e){return e.id}))},subjectTree:e.subjectTree,saveSubjects:e.saveSubjects,memberType:e.memberType,saveBtnText:"Save Subjects",allowMultiple:!0})),d.createElement("h6",null,"Classifications"),d.createElement("p",null,"Select a presentation to view its classifications and map them to this ".concat(t,".")),d.createElement("div",{className:"w-50 pb-3"},d.createElement(vg,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),e.currentPresentation&&e.classificationTree&&e.classificationTree.children.length?d.createElement(d.Fragment,null,d.createElement("p",null,"Only classifications which are mapped to one of the subjects selected above can be selected."),d.createElement(pg,{initialValues:{classificationIds:e.objectClassifications.map((function(e){return e.id}))},presentationId:e.currentPresentation.id,classificationTree:e.classificationTree,saveClassifications:e.saveClassifications,isClassificationDisabled:function(e){return!n.includes(e.id)}})):d.createElement("p",null,"This presentation has no classifications."))}function Og(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ig(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ig(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ig(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}vg.defaultProps={label:"Presentation"};function jg(e){var t=!e.id,n=za(),r=yo(n),i=!t||!!n.values.parentId,a=Og(d.useState(i),2),s=a[0],c=a[1];d.useEffect((function(){return c(i)}),[e.id,n.values.parentId]);var l=function(e){var t=e.id===n.values.parentId?null:e.id;n.setFieldValue("parentId",t)},p="".concat(lo.getCustomFormControlClassName(n.errors,n.touched,"parentId")," h-auto py-2");return d.createElement(Qa,null,d.createElement(go,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this subject",autoFocus:!0}),d.createElement(go,{name:"parentId"},(function(){return d.createElement("div",{className:p},d.createElement(wp,{label:"Parent Subject",tree:e.subjectTree,selectedIds:[n.values.parentId],onSelect:l,collapse:s,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=tu.find(t,r);return!!tu.find(n,e.id)})}));var t,r})),d.createElement("div",{className:"d-flex justify-content-between"},d.createElement(bo,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&d.createElement(co.Button,{as:kl,variant:"danger",appLink:{application:u.SUBJECTS,action:o.Subjects.DELETE_SUBJECT,args:[e.id]}},"Delete")))}function Ag(e){return d.createElement(ao,{initialValues:e.subject,validationSchema:Mm,onSubmit:e.saveSubject},d.createElement(jg,{id:e.subject&&e.subject.id,subjectTree:e.subjectTree}))}var Tg=function(e){return function(t){return t.appLink.action===e}};function wg(e){var t=e.subjectId,n=e.activeAction;return d.createElement(d.Fragment,null,d.createElement(co.Alert,{variant:"danger"},"Warning: You are editing the backbone subjects."),d.createElement("div",{className:"py-2"},d.createElement(hp,{tabs:Bm(t),isItemActive:Tg(n)})))}var Lg=function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_SUBJECT,args:[e]}};function kg(e){var t=za(),n=yo(t),r=function(n){var r=e.allowMultiple?Mt.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),n.id.toString()):[n.id];t.setFieldValue("subjectIds",r)},i=Um.singularizeMemberType(e.memberType),a="".concat(lo.getCustomFormControlClassName(t.errors,t.touched,"subjectIds")," h-auto py-2");return d.createElement(Qa,null,d.createElement(go,{name:"subjectIds"},(function(){return d.createElement("div",{className:a},d.createElement(wp,{label:"Mapped Subject".concat(e.allowMultiple?"(s)":""),tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:r,collapse:!!t.initialValues.subjectIds.length,getSelectedItemAppLink:Lg}))})),d.createElement(go,{label:"Automatically add to classifications*",name:"addToClassifications",id:"add-to-classifications",type:"checkbox",checked:t.values.addToClassifications}),d.createElement("p",null,d.createElement("em",null,"*If selected, when adding a ".concat(i," to a subject, all of that subject's")+" mapped classifications across all presentations will also be added to.")),d.createElement("div",{className:"d-flex justify-content-end"},d.createElement(bo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.saveBtnText)))}function _g(e){var t;return d.createElement(ao,{initialValues:e.initialValues,validationSchema:(t=e.subjectRequired,oo.object().shape({subjectIds:t?oo.array().of(oo.string()).min(1,"A subject is required").required("A subject is required"):oo.array().of(oo.string()),addToClassifications:oo.boolean().default(!0)}).noUnknown()),onSubmit:function(t,n){var r=t.subjectIds,i=t.addToClassifications;return e.saveSubjects(r,i,n)}},d.createElement(kg,{subjectTree:e.subjectTree,memberType:e.memberType,allowMultiple:e.allowMultiple,saveBtnText:e.saveBtnText}))}kg.defaultProps={saveBtnText:"Save"};var xg=function(e){return d.createElement("div",{className:"border rounded p-2 mb-3"},d.createElement("h6",{className:"border-bottom pb-1"},e.presentation.name),e.classifications&&e.classifications.length?d.createElement("ul",{className:"list-unstyled mb-0"},e.classifications.map((function(t){return d.createElement("li",{key:t.id,className:"py-1"},d.createElement(kl,{appLink:(n=e.presentation.id,r=t.id,{application:u.SUBJECTS,action:o.Subjects.EDIT_CLASSIFICATION,args:[n,r]})},t.name));var n,r}))):d.createElement("p",null,d.createElement("em",null,"There are no classifications mapped to this subject in this presentation.")))},Pg=function(e){return d.createElement(d.Fragment,null,!!e.presentations&&!!e.classificationDictionary&&e.presentations.map((function(t){return d.createElement(xg,{key:t.id,presentation:t,classifications:e.classificationDictionary[t.id]})})))},Ng=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 Dg(e){return d.createElement(d.Fragment,null,e.classifications.map((function(t){return d.createElement("th",{key:t.id},d.createElement("span",{className:"d-inline-block"},d.createElement(Dl,{selected:e.getIsClassificationSelected(t),onToggle:function(n){return e.onToggleClassification(t.id,n)}})),d.createElement(kl,{appLink:e.getClassificationAppLink(t.id)},function(e,t){return t?e.name:"Classification: ".concat(e.name)}(t,e.showClassificationSubHeader)))})))}function Rg(e){var t=e.memberType,n=e.hasActions,r=e.classifications,i=Ng(e,["memberType","hasActions","classifications"]),a="".concat(Ql(Um.singularizeMemberType(t))," Name"),o=!!r&&!!r.length,s=o&&r.length>1,c=o?2:1,l=Object.assign({classifications:r,showClassificationSubHeader:s},i);return d.createElement("thead",null,d.createElement("tr",null,d.createElement("th",{rowSpan:c},a),o&&(s?d.createElement("th",{colSpan:r.length,className:"text-center"},"Classifications"):d.createElement(Dg,Object.assign({},l))),n&&d.createElement("th",{rowSpan:c})),o&&s&&d.createElement("tr",null,d.createElement(Dg,Object.assign({},l))))}function Fg(e){var t=e.member,n=t.id,i=t.name,a=t.classifications,o=void 0===a?[]:a,s=e.getMemberAppLink,c=e.onToggleClassification,l=e.actions,u=X.isFunction(s)&&s(n);return o.length&&!X.isFunction(c)&&r.ErrorHelper.throw(new B("onToggleClassification must be passed to SubjectMemberItem")),d.createElement("tr",null,d.createElement("td",null,u?d.createElement(kl,{appLink:s(n)},i):i),!!o.length&&o.map((function(e){return d.createElement("td",{key:e.id},d.createElement(Dl,{selected:e.selected,onToggle:function(t){return c(e.id,t,n)}}))})),l&&d.createElement("td",null,d.createElement("span",{className:"d-flex justify-content-end"},d.createElement(lp,{actions:l}))))}var Mg=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 Ug(e,t){return function(n){var r=n[e],i=kp.length(r);return!!i&&i===t.length}}function Vg(e){var t=e.members,n=e.memberType,r=e.getActions,i=e.classifications,a=e.getClassificationAppLink,o=e.onToggleClassification,s=Mg(e,["members","memberType","getActions","classifications","getClassificationAppLink","onToggleClassification"]);if(!t.length)return d.createElement("div",{className:"py-5"},"No ".concat(n," in this subject."));var c=X.isFunction(r),l={memberType:n,classifications:i,getClassificationAppLink:a,getIsClassificationSelected:Ug(n,t),onToggleClassification:o,hasActions:c};return d.createElement(co.Table,{responsive:!0,bordered:!0},d.createElement(Rg,Object.assign({},l)),d.createElement("tbody",null,t.map((function(e,t){return d.createElement(Fg,Object.assign({key:t,member:e,actions:c&&r(e.id),onToggleClassification:o},s))}))))}function Bg(e){var t=e.navItems,n=e.currentAppLink;return d.createElement(co.Container,null,d.createElement(co.Navbar,{className:"justify-content-between align-items-center"},d.createElement(co.Nav,null,!!t&&t.map((function(e,t){return d.createElement(co.Nav.Item,{key:t},d.createElement(kl,{appLink:e.appLink,className:"nav-link".concat(Gl.isItemActive(e,n)?" text-primary":"")},e.label))})))))}function zg(e,t){d.useEffect((function(){e.presentations&&!e.currentPresentation&&wm.getSetStateByKey(t,"currentPresentation")(Mt.first(e.presentations))}),[e.presentations])}function Hg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qg(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Jg(e){var t=i.useBasicFetch(rm(e.playlistId)),n=i.useBasicFetch(mm),r=Hg(d.useState({}),2),a=r[0],s=r[1],c=Kd(f.SUBJECT);!function(e,t,n){var r=function(e){return wm.getSetStateByKey(n,e)};Am([Uh.getObjectLevelsFetchOptions(e,km.Playlists,r("playlistLevels"))],[e]),Tm(Uh.getObjectAudiencesFetchOptions(e,km.Playlists,r("playlistAudiences")),[e,t.playlistLevels]),Am([Uh.getPresentationsFetchOptions(r("presentations")),Uh.getLevelsFetchOptions(r("levels"))],[]),Tm(!!t.currentPresentation&&Uh.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(e.playlistId,a,s),zg(a,s);var l=!!(a.presentations&&a.levels&&a.presentationAudiences&&a.playlistLevels&&a.playlistAudiences);return d.createElement(d.Fragment,null,!!n.data&&d.createElement(Cm,{playlistId:e.playlistId,activeAction:o.Playlists.EDIT_PLAYLIST_AUDIENCES,currentUser:n.data}),d.createElement(up,{object:t.data}),!!l&&d.createElement(Yh,{objectLevels:a.playlistLevels,objectAudiences:a.playlistAudiences,presentations:a.presentations,currentPresentation:a.currentPresentation,setCurrentPresentation:wm.getSetStateByKey(s,"currentPresentation"),levels:a.levels,presentationAudiences:a.presentationAudiences,memberType:km.Playlists,saveLevels:function(t,n,r){return c.updateObjectLevels(e.playlistId,t,km.Playlists,n,r,r)},saveAudiences:function(t,n){return c.updateObjectAudiences(e.playlistId,a.currentPresentation.id,t,km.Playlists,n,n)}}))}function $g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||Yg(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kg(e){return function(e){if(Array.isArray(e))return Gg(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Yg(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yg(e,t){if(e){if("string"==typeof e)return Gg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gg(e,t):void 0}}function Gg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Wg(e){var t=i.useBasicFetch(rm(e.playlistId)),n=i.useBasicFetch(mm),r=$g(d.useState({}),2),a=r[0],s=r[1],c=Kd(f.SUBJECT);!function(e,t,n){var r=function(e){return wm.getSetStateByKey(n,e)};Am([Uh.getSubjectTreeFetchOptions(r("subjectTree")),Uh.getPresentationsFetchOptions(r("presentations"))],[]),Am([Uh.getObjectSubjectsFetchOptions(e,km.Playlists,r("playlistSubjects"))],[e]),Tm(!!t.currentPresentation&&Uh.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),d.useEffect((function(){return r("subjectClassifications")([])}),[t.playlistSubjects]);var i=function(e,t){return[].concat(Kg(t.subjectClassifications||[]),Kg(e))},a=t.playlistSubjects&&t.playlistSubjects.map((function(e){return Uh.getSubjectClassificationFetchOptions(e.id,wm.getSetStateByKey(n,"subjectClassifications",i))}));Am(a,[t.playlistSubjects],!!a),Tm(Uh.getObjectClassificationsFetchOptions(e,km.Playlists,r("playlistClassifications")),[e,t.playlistSubjects])}(e.playlistId,a,s),zg(a,s);var l=!!(a.playlistSubjects&&a.subjectTree&&a.presentations&&a.classificationTree&&a.playlistClassifications&&a.subjectClassifications);return d.createElement(d.Fragment,null,!!n.data&&d.createElement(Cm,{playlistId:e.playlistId,activeAction:o.Playlists.EDIT_PLAYLIST_SUBJECTS,currentUser:n.data}),d.createElement(up,{object:t.data}),l&&d.createElement(Cg,{objectSubjects:a.playlistSubjects,subjectTree:a.subjectTree,memberType:km.Playlists,presentations:a.presentations,currentPresentation:a.currentPresentation,setCurrentPresentation:wm.getSetStateByKey(s,"currentPresentation"),objectClassifications:a.playlistClassifications,objectSubjectClassifications:a.subjectClassifications,classificationTree:a.classificationTree,saveSubjects:function(t,n,r){return c.updateObjectSubjects(e.playlistId,t,km.Playlists,n,r,r)},saveClassifications:function(t,n){return c.updateObjectClassifications(e.playlistId,a.currentPresentation.id,t,km.Playlists,n,n)}}))}const Zg={reorder(e,t,n){if(t===n)return{reorderedItems:e,reorderRequest:null};const r=Mt.moveItem(e,t,n),i=n<e.length-1?r[n+1].id:null;return{reorderedItems:r,reorderRequest:{sourceMemberId:r[n].id,destinationMemberId:i}}},updateState(e,t,n){const r=[],i=pt.deepClone(n),a=[e];let o=n[e];const s=!!o&&!!o.data&&o.data.length;for(;o&&Array.isArray(o.data);){r.push(...o.data);const t=o.pagination&&o.pagination.cursors&&o.pagination.cursors.next,i=!!t&&`${e}:${t}`;o=t&&n[i],o&&a.push(i)}if(!r.length)return n;const c=Mt.findIndex(r,e=>e.id===t.sourceMemberId),l=[...r],u=l.splice(c,1),p=t.destinationMemberId?Mt.findIndex(l,e=>e.id===t.destinationMemberId):l.length;return l.splice(p,0,u[0]),a.forEach(e=>{const t=l.splice(0,s);i[e].data=t}),i}};function Qg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Xg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xg(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ey=function(e){return{application:u.VIDEOS,action:o.Videos.EDIT_VIDEO,args:[e.id]}};function ty(e){var t,n,r=Object(te.useDispatch)(),a=Qd(),s=i.useBasicFetch(rm(e.playlistId)),c=i.useBasicFetch(cm(e.playlistId)),l=i.useBasicFetch(mm),p=Qg(function(e){const[t,n]=Object(d.useState)();return Object(d.useEffect)(()=>{t&&(e.length!==t.length||function(e,t){let n=!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].id!==t[r].id){n=!1;break}return n}(e,t))&&n(null)},[e]),[t,n]}(null===(t=c.data)||void 0===t?void 0:t.data),2),f=p[0],m=p[1],h=f?{data:f,pagination:null}:c.data;return d.createElement(d.Fragment,null,!!l.data&&d.createElement(Cm,{playlistId:e.playlistId,activeAction:o.Playlists.EDIT_PLAYLIST_VIDEOS,currentUser:l.data}),d.createElement(up,{object:s.data}),!!h&&d.createElement(Hp,{onSortEnd:function(t,n){if(t!==n){var o=Zg.reorder(c.data.data,t,n),s=o.reorderRequest,l=o.reorderedItems;m(l);i.fetch(r,lm(e.playlistId,s,null,(function(){a.error("Failed to update playlist order."),m(null)})))}},videos:h,getVideoAppLink:ey,getVideoActions:(n=e.playlistId,function(e){return[{label:"Remove video",appLink:{application:u.PLAYLISTS,action:o.Playlists.REMOVE_VIDEO,args:[n.toString(),e.id.toString()]},className:"text-danger"}]}),emptyMessage:"There are no videos in this playlist."}))}function ny(){var e=Object(te.useDispatch)(),t=Qd(),n=i.useBasicFetch(mm);return d.createElement(d.Fragment,null,!!n.data&&d.createElement(Em,{savePlaylist:function(a,s){i.fetch(e,am(a,n.data.id,(function(e){t.success("Successfully created playlist."),function(e){e&&e.id&&r.AppLinkHelper.trigger({application:u.PLAYLISTS,action:o.Playlists.EDIT_PLAYLIST,args:[e.id]})}(e)}),(function(){t.error("Failed to create playlist.")}),s))}}))}var ry="rating,thumbnail,glance",iy=function(e){return{url:"/api/master/v2/objects/".concat(e,"?query=").concat(ry),key:"videos:".concat(e)}},ay=function(e){var t=e.slice().sort();return{key:"videos:".concat(t.join(",")),url:"/api/master/v2/objects?".concat(t.map((function(e){return"id=".concat(e)})).join("&"))}},oy=function(e){return{url:"/ajax/hostedlibraries/rightsline/programs/".concat(e),key:"rightsline:videos:".concat(e),normalizeOptions:{namespace:"rightsline"}}},sy=function(e,t,n,r,i){return{key:"videos:".concat(e),url:"/api/master/v2/objects/".concat(e),data:t,type:nt.PUT,success:n,error:r,always:i}};function cy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ly(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ly(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ly(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function uy(e){var t=Object(te.useDispatch)(),n=Qd(),r=i.useBasicFetch(rm(e.playlistId)),a=i.useBasicFetch(iy(e.videoId)),o=cy(d.useState(!1),2),s=o[0],c=o[1];var l=!!r.data&&!!a.data;return d.createElement(Of,{title:"Remove Video",closePopup:e.closePopup,showLoadingSpinner:!l},!!l&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to remove ",d.createElement("strong",null,a.data.name)," from ",d.createElement("strong",null,r.data.name),"?")),d.createElement(jf,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){c(!0),i.fetch(t,um(e.playlistId,e.videoId,(function(){n.success("Successfully removed video from playlist")}),(function(){n.error("Failed to remove video from playlist")}),e.closePopup))},buttonText:"Yes, remove video",isSpinnerButton:!0,showSpinner:s}]})))}function py(e){return r.AppLinkHelper.trigger(function(e){return{application:u.PLAYLISTS,action:o.Playlists.EDIT_PLAYLIST,args:[e.id]}}(e))}function fy(e){var t=e?{application:u.PLAYLISTS,action:o.Playlists.SEARCH_PLAYLISTS,params:{query:e}}:{application:u.PLAYLISTS,action:o.Playlists.PLAYLISTS};r.AppLinkHelper.trigger(t)}function dy(e){return d.createElement("div",{className:"pb-3 w-50"},d.createElement(Ll,{initialQuery:e.query,placeholder:"Search for a playlist",onSuggestionSelected:py,getRemoteUrl:function(e){return"".concat("/api/domain/v1/search/playlists/instant/raw","?query=").concat(e)},activationLength:2,onSubmit:fy}))}var my=u.PLAYLISTS,hy=function(e){return{application:my,action:o.Playlists.EDIT_PLAYLIST,args:[e.id]}};function gy(e){var t=i.useBasicFetch(tm(e.cursor));return d.createElement(d.Fragment,null,d.createElement(dy,null),d.createElement(ep,{collection:t&&t.data,collectionAppLink:{application:my,action:o.Playlists.PLAYLISTS},newObjectAppLink:{application:my,action:o.Playlists.NEW_PLAYLIST},getObjectAppLink:hy,objectName:"Playlist"}))}var yy=u.PLAYLISTS,vy=function(e){return{application:yy,action:o.Playlists.EDIT_PLAYLIST,args:[e.id]}};function by(e){var t=i.useBasicFetch(nm(e.query,e.cursor));return d.createElement(d.Fragment,null,d.createElement(dy,{query:e.query}),!!t.data&&(t.data.data.length?d.createElement(ep,{collection:t.data,collectionAppLink:{application:yy,action:o.Playlists.SEARCH_PLAYLISTS,params:{query:e.query}},newObjectAppLink:{application:yy,action:o.Playlists.NEW_PLAYLIST},getObjectAppLink:vy,objectName:"Playlist"}):d.createElement("p",null,"No playlists found, please try a different search query.")))}function Sy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ey(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ey(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ey(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Cy=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 Oy(e){var t=e.id,n=e.routeToOnDelete,i=e.closePopup,a=Sy(d.useState(),2),o=a[0],s=a[1],c=Sy(d.useState(!1),2),l=c[0],u=c[1],p=Kd(f.SUBJECT);Tm(Uh.getAudienceFetchOptions(t,s),[t]);return d.createElement(Of,{title:"Delete Audience",closePopup:i,showLoadingSpinner:!o},!!o&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,o.name),"?")),d.createElement(jf,{buttons:Cy((function(){u(!0);p.deleteAudience(t,(function(){i(),n&&r.AppLinkHelper.trigger(n)}),i)}),i,l)})))}function Iy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return jy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ay=function(e){return{application:u.SUBJECTS,action:o.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function Ty(e){var t=e.presentationId,n=e.audienceId,r=Iy(d.useState(),2),i=r[0],a=r[1],o=Iy(d.useState(),2),s=o[0],c=o[1],l=Iy(d.useState(),2),u=l[0],p=l[1],m=Kd(f.SUBJECT);Tm(Uh.getAudienceFetchOptions(n,a),[n]),Tm(Uh.getLevelsFetchOptions(c),[]),Tm(Uh.getPresentationFetchOptions(t,p),[t]);return d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-3"},d.createElement(_l,{appLink:Ay(t),backToName:"audiences"})),!!u&&d.createElement("h6",null,"Presentation: ".concat(u.name)),!!i&&!!s&&d.createElement($h,{audience:i,levels:s,saveAudience:function(e,r){return m.updateAudience(n,Object.assign(Object.assign({},e),{presentationId:t}),r,r)},presentationId:t}))}function wy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ly(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ly(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ly(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ky=function(e){return function(t){return{application:u.SUBJECTS,action:o.Subjects.EDIT_AUDIENCE,args:[e,t.masterId]}}},_y=function(e){return{application:u.SUBJECTS,action:o.Subjects.NEW_AUDIENCE,args:[e]}},xy={application:u.SUBJECTS,action:o.Subjects.AUDIENCES};function Py(e){var t=e.presentationId,n=wy(d.useState(),2),r=n[0],i=n[1];return Tm(Uh.getAudiencesFetchOptions(t,i),[]),d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-3"},d.createElement(_l,{appLink:xy,backToName:"presentations"})),d.createElement("div",{className:"d-flex justify-content-between mb-2"},d.createElement("h5",{className:"d-inline-block m-0"},"Select an audience to edit:"),d.createElement(kl,{appLink:_y(t),className:"d-block"},d.createElement(Il,{svgName:vl.Plus,size:Ol.Small}),d.createElement("span",null,"New Audience"))),d.createElement(dp,{objects:r,getAppLink:ky(e.presentationId),emptyMessage:"There are no audiences in this presentation yet. Click '+ New Audience' to create one."}))}function Ny(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Dy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ry=function(e){return{application:u.SUBJECTS,action:o.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function Fy(e){var t=e.presentationId,n=Ny(d.useState(),2),i=n[0],a=n[1],s=Ny(d.useState(),2),c=s[0],l=s[1],p=Kd(f.SUBJECT);Tm(Uh.getLevelsFetchOptions(a),[]),Tm(Uh.getPresentationFetchOptions(t,l),[t]);return d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-2"},d.createElement(_l,{appLink:Ry(t),backToName:"audiences"})),!!c&&d.createElement("h6",null,"Presentation: ".concat(c.name)),!!i&&d.createElement($h,{levels:i,presentationId:t,saveAudience:function(e,n){return p.createAudience(Object.assign(Object.assign({},e),{presentationId:t}),function(e,t){return function(n){t(),r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_AUDIENCE,args:[e,n.masterId]})}}(t,n),n)}}))}function My(e){return{application:u.SUBJECTS,action:o.Subjects.NEW_CLASSIFICATION,args:[e]}}function Uy(e){return[{label:"Add child",getAppLink:function(t){return Object.assign(Object.assign({},My(e)),{args:[e],params:{parentId:t.id}})}},{label:"Delete classification",getAppLink:function(t){return{application:u.SUBJECTS,action:o.Subjects.DELETE_CLASSIFICATION,args:[e,t.id]}},className:"text-danger"}]}var Vy=n(127),By=n.n(Vy);function zy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Hy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Hy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qy(e){var t=e.presentationId,n=e.selectedClassificationId,r=zy(d.useState(),2),i=r[0],a=r[1],s=zy(d.useState(),2),c=s[0],l=s[1];return function(e,t,n){Am([Uh.getClassificationTreeFetchOptions(e,t),Uh.getPresentationFetchOptions(e,n)],[e])}(t,a,l),d.createElement("div",{className:"".concat(By.a.navContainer," h-auto pr-2 border-right")},!!c&&d.createElement("h6",{className:"border-bottom pb-2"},"Classifications (".concat(c.name,")")),d.createElement(kl,{appLink:My(t),className:"d-inline-block pb-2"},d.createElement(Il,{svgName:vl.Plus,size:Ol.Small}),d.createElement("span",null,"New Classification")),!!i&&d.createElement("div",{className:"border-top pt-1"},d.createElement(Op,{tree:i,getAppLink:function(e){return function(e,t){return{application:u.SUBJECTS,action:o.Subjects.EDIT_CLASSIFICATION,args:[e,t.id]}}(t,e)},selectedIds:[n],actions:Uy(t)})))}function Jy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return $y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $y(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ky(e){var t=e.classificationId,n=e.routeToOnDelete,i=e.closePopup,a=Jy(d.useState(),2),o=a[0],s=a[1],c=Jy(d.useState(!1),2),l=c[0],u=c[1];Tm(Uh.getClassificationFetchOptions(t,s),[]);var p=Kd(f.SUBJECT),m=[{variant:"link",onClick:i,buttonText:"Cancel"},{variant:"danger",onClick:function(){u(!0);p.deleteClassification(t,(function(){i(),n&&r.AppLinkHelper.trigger(n)}),i)},buttonText:"Yes, delete this classification",isSpinnerButton:!0,showSpinner:l}];return d.createElement(Of,{title:"Delete Classification",closePopup:i,showLoadingSpinner:!o},!!o&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,o.name),"?")),d.createElement(jf,{buttons:m})))}function Yy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Gy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Wy(e){var t=e.presentationId,n=e.classificationId,r=Yy(d.useState(),2),i=r[0],a=r[1],o=Yy(d.useState(),2),s=o[0],c=o[1],l=Yy(d.useState(),2),u=l[0],p=l[1],m=Yy(d.useState(),2),h=m[0],g=m[1],y=Kd(f.SUBJECT),v=Uh.getClassificationFetchOptions(n,a),b=Uh.getPresentationFetchOptions(t,c),S=Uh.getClassificationTreeFetchOptions(t,p);Tm(Uh.getSubjectTreeFetchOptions(g),[]),Tm(v,[n]),Am([b,S],[t]);return d.createElement("div",null,d.createElement(lg,{presentation:s,classificationId:n}),!!i&&!!u&&!!h&&d.createElement(sg,{classification:i,presentationId:t,subjectTree:h,classificationTree:u,saveClassification:function(e,t){return y.updateClassification(n,e,t,t)}}))}function Zy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Qy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Qy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Xy(e){var t=e.presentationId,n=e.classificationId,r=e.memberType,i=Zy(d.useState(),2),a=i[0],o=i[1],s=Zy(d.useState(),2),c=s[0],l=s[1],u=Zy(d.useState(),2),p=u[0],m=u[1];Tm(Uh.getPresentationFetchOptions(t,o),[]),Tm(Uh.getClassificationFetchOptions(n,l),[n]),Tm(Uh.getClassificationMembersFetchOptions(n,r,m),[n,r]);var h=Kd(f.SUBJECT),g={items:p&&p.data,memberType:r,classification:c,updatePinnedVideo:function(e,t){var r=Object.assign(Object.assign({},c),{pinnedVideoMasterId:e});h.updateClassification(n,r,t)},getItemAppLink:function(e){return Um.getMemberAppLink(r,e.id)},getActions:function(e){return Um.getMemberActions(n,Lm.Classification,r,e.id)}},y={presentation:a,classificationId:n},v=Wl(g);return d.createElement(d.Fragment,null,d.createElement(lg,Object.assign({},y,{memberType:r})),v&&d.createElement(ng,Object.assign({},g)))}function ev(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return tv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function nv(e){var t=e.presentationId,n=e.parentId,i=ev(d.useState(),2),a=i[0],s=i[1],c=ev(d.useState(),2),l=c[0],p=c[1],m=Kd(f.SUBJECT),h=Uh.getClassificationTreeFetchOptions(t,s);Tm(Uh.getSubjectTreeFetchOptions(p),[]),Tm(h,[t]);return d.createElement("div",null,d.createElement("h4",{className:"py-2"},"Create New Classification"),!!l&&!!a&&d.createElement(sg,{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&&r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]})}}(t,n),n)}}))}var rv=function(e){return{key:"series:".concat(e),url:"/api/master/v2/objects/".concat(e,"?query=thumbnail,tallPoster,banner,rating")}},iv=function(e){var t=e.slice().sort();return{key:"series:".concat(t.join(",")),url:"/api/master/v2/objects?".concat(t.map((function(e){return"id=".concat(e)})).join("&"))}},av=function(e,t,n,r){return{url:"/api/master/v2/series",key:"series",data:e,type:nt.POST,success:t,error:n,always:r}},ov=function(e,t,n,r,i){return{url:"/api/master/v2/objects/".concat(e),key:"update:series:".concat(e),data:t,type:nt.PUT,success:n,error:r,always:i}};function sv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return cv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function lv(e){var t=sv(d.useState(),2),n=t[0],r=t[1],a=sv(d.useState(!1),2),o=a[0],s=a[1],c=i.useBasicFetch(function(e,t){switch(e){case km.Playlists:return rm(t);case km.Series:return rv(t);case km.Videos:return iy(t)}}(e.memberType,e.memberId)),l=Kd(f.SUBJECT);Tm(Uh.getClassificationFetchOptions(e.classificationId,r),[e.classificationId]);var u=!!n&&!!c.data,p="Remove ".concat(Ql(Um.singularizeMemberType(e.memberType)));return d.createElement(Of,{title:p,closePopup:e.closePopup,showLoadingSpinner:!u},u&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to remove ",d.createElement("strong",null,c.data.name)," from ",d.createElement("strong",null,n.name),"?"),d.createElement("p",null,"This will not remove it from the backbone subject.")),d.createElement(jf,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){s(!0),l.removeObjectsFromClassification(e.classificationId,[e.memberId],e.memberType,null,null,e.closePopup,e.closePopup),n.pinnedVideoMasterId===e.memberId&&l.updateClassification(e.classificationId,Object.assign(Object.assign({},n),{pinnedVideoMasterId:null}))},buttonText:"Yes, remove this ".concat(Um.singularizeMemberType(e.memberType)),isSpinnerButton:!0,showSpinner:o}]})))}function uv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return pv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fv(e){var t=e.id,n=uv(d.useState(),2),r=n[0],i=n[1],a=Kd(f.SUBJECT);Tm(Uh.getLevelFetchOptions(t,i),[t]);return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Edit Level"),!!r&&d.createElement(dg,{level:r,saveLevel:function(e,n){return a.updateLevel(t,e,n,n)}}))}function dv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return mv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var hv=function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_LEVEL,args:[e.id]}},gv={application:u.SUBJECTS,action:o.Subjects.NEW_LEVEL};function yv(){var e=dv(d.useState(),2),t=e[0],n=e[1];return Tm(Uh.getLevelsFetchOptions(n),[]),d.createElement("div",null,d.createElement("div",{className:"d-flex justify-content-between mb-2"},d.createElement("h5",{className:"d-inline-block m-0"},"Select a level to edit:"),d.createElement(kl,{appLink:gv,className:"d-block"},d.createElement(Il,{svgName:vl.Plus,size:Ol.Small}),d.createElement("span",null,"New Level"))),d.createElement(dp,{objects:t,getAppLink:hv}))}function vv(){var e=Kd(f.SUBJECT);return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Create New Level"),d.createElement(dg,{saveLevel:function(t,n){return e.createLevel(t,function(e){return function(t){e(),t&&t.id&&r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_LEVEL,args:[t.id]})}}(n),n)}}))}function bv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Sv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ev(e){var t=e.id,n=bv(d.useState(),2),r=n[0],i=n[1],a=Kd(f.SUBJECT);Tm(Uh.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)}))}},s=Wl(o);return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Edit Presentation"),!!s&&d.createElement(yg,Object.assign({},o)))}function Cv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ov(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ov(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ov(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Iv=function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_PRESENTATION,args:[e.id]}},jv={application:u.SUBJECTS,action:o.Subjects.NEW_PRESENTATION};function Av(){var e=Cv(d.useState(),2),t=e[0],n=e[1];return Tm(Uh.getPresentationsFetchOptions(n),[]),d.createElement("div",null,d.createElement("div",{className:"d-flex justify-content-between mb-2"},d.createElement("h5",{className:"d-inline-block m-0"},"Select a presentation to edit:"),d.createElement(kl,{appLink:jv,className:"d-block"},d.createElement(Il,{svgName:vl.Plus,size:Ol.Small}),d.createElement("span",null,"New Presentation"))),d.createElement(dp,{objects:t,getAppLink:Iv}))}function Tv(){var e=Kd(f.SUBJECT);return d.createElement(d.Fragment,null,d.createElement("h4",{className:"py-2"},"Create New Presentation"),d.createElement(yg,{savePresentation:function(t,n){var i=n.setSubmitting;e.createPresentation(t,(function(e){return function(e,t){t(!1),e&&e.id&&r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_PRESENTATION,args:[e.id]})}(e,i)}),(function(){return i(!1)}))}}))}function wv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Lv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kv(e){var t=e.objectType,n=e.getAppLink,r=wv(d.useState(),2),i=r[0],a=r[1];return Tm(Uh.getPresentationsFetchOptions(a),[]),d.createElement("div",null,d.createElement("h5",null,d.createElement(Ao,{namespace:"subjects.selectPresentation",phrase:"heading",options:{objectType:t}})),d.createElement(dp,{objects:i,getAppLink:n}))}function _v(e){const{title:t,onClickConfirm:n,confirmButtonText:r,cancelButtonText:i,closePopup:a}=e,[o,s]=d.useState(!1),c=[{variant:"link",onClick:a,buttonText:i},{variant:"primary",onClick:()=>{s(!0),n()},buttonText:r,isSpinnerButton:!0,showSpinner:o}];return d.createElement(Of,{title:t,closePopup:a},d.createElement(d.Fragment,null,e.children,d.createElement(jf,{buttons:c})))}function xv(e,t){return wm.getSetStateByKey(e,t)}function Pv(e,t,n,i,a){var s=i.selectedSubject,c=function(){return xv(a,"showConfirmationPopup")(!1)};t.addObjectsToSubject(s.id,e.map((function(e){return e.id})),n.memberType,i.addToClassifications,(function(){c(),r.AppLinkHelper.trigger(function(e,t){var n={application:u.SUBJECTS,args:[e]};switch(t){case km.Playlists:return Object.assign(Object.assign({},n),{action:o.Subjects.EDIT_SUBJECT_PLAYLISTS});case km.Series:return Object.assign(Object.assign({},n),{action:o.Subjects.EDIT_SUBJECT_SERIES});case km.Videos:return Object.assign(Object.assign({},n),{action:o.Subjects.EDIT_SUBJECT_VIDEOS})}}(s.id,n.memberType))}),c)}function Nv(e,t,n){if(t&&n){var r=1===t.length?"this ".concat(Um.singularizeMemberType(e)):"these ".concat(e);return"Add ".concat(r," to ").concat(n.name)}}function Dv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Rv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Fv(e,t){return function(n,r,i){i(),xv(t,"selectedSubject")(tu.find(e.subjectTree,Mt.first(n))),xv(t,"addToClassifications")(r),xv(t,"showConfirmationPopup")(!0)}}function Mv(e){var t=Dv(d.useState({}),2),n=t[0],r=t[1],a=i.useBasicFetch(function(e,t){switch(e){case km.Playlists:return im(t);case km.Series:return iv(t);case km.Videos:return ay(t)}}(e.memberType,e.objectIds)),o=Kd(f.SUBJECT);!function(e,t){e.memberType,e.objectIds,Tm(Uh.getSubjectTreeFetchOptions(xv(t,"subjectTree")),[])}(e,r);var s;return d.createElement(d.Fragment,null,!!a.data&&!!n.subjectTree&&d.createElement(bg,{memberType:e.memberType,objects:a.data,subjectTree:n.subjectTree,onClickAddToSubject:Fv(n,r)}),n.showConfirmationPopup&&d.createElement(_v,{title:Nv(e.memberType,a.data,n.selectedSubject),onClickConfirm:function(){return Pv(a.data,o,e,n,r)},closePopup:function(){return e=!1,xv(r,"showConfirmationPopup")(e);var e}},d.createElement("p",null,"The following ".concat(e.memberType," will be added to "),d.createElement("strong",null,n.selectedSubject.name),n.addToClassifications?" and its mapped classifications:":":"),d.createElement("ul",null,a.data.map((function(e){return d.createElement("li",{key:e.id},e.name)}))),!n.addToClassifications&&d.createElement("p",null,"".concat(1===a.data.length?"It":"They"," will not be added to its mapped classifications.")),d.createElement("p",null,"".concat((s=e.memberType,Ql(Um.singularizeMemberType(s)))," to classification mappings can be managed from the "),d.createElement("strong",null,"Edit Subject ".concat(Ql(e.memberType)," ")),"page.")))}function Uv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Vv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Bv(e){var t=e.subjectId,n=e.routeToOnDelete,i=e.closePopup,a=Uv(d.useState(),2),o=a[0],s=a[1],c=Uv(d.useState(!1),2),l=c[0],u=c[1];Tm(Uh.getSubjectFetchOptions(t,s),[]);var p=Kd(f.SUBJECT),m=[{variant:"link",onClick:i,buttonText:"Cancel"},{variant:"danger",onClick:function(){u(!0);p.deleteSubject(t,(function(){i(),n&&r.AppLinkHelper.trigger(n)}),i)},buttonText:"Yes, delete this subject",isSpinnerButton:!0,showSpinner:l}];return d.createElement(Of,{title:"Delete Subject",closePopup:i,showLoadingSpinner:!o},!!o&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,o.name),"?"),d.createElement("p",null,"Subjects that have mapped classifications cannot be deleted.")),d.createElement(jf,{buttons:m})))}function zv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Hv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Hv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qv(e){var t=e.subjectId,n=zv(d.useState(),2),r=n[0],i=n[1],a=zv(d.useState(),2),s=a[0],c=a[1],l=Kd(f.SUBJECT),u=Uh.getSubjectFetchOptions(t,i);Tm(Uh.getSubjectTreeFetchOptions(c),[]),Tm(u,[t]);return d.createElement(d.Fragment,null,d.createElement(wg,{subjectId:t,activeAction:o.Subjects.EDIT_SUBJECT}),!!r&&!!s&&d.createElement(Ag,{subject:r,subjectTree:s,saveSubject:function(e,n){return l.updateSubject(t,e,n,n)}}))}function Jv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return $v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $v(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}_v.defaultProps={confirmButtonText:"Confirm",cancelButtonText:"Cancel"};var Kv=d.createContext(void 0);function Yv(e){var t=e.children,n=Jv(d.useState(),2),r=n[0],i=n[1];return d.createElement(Kv.Provider,{value:[r,i]},t)}var Gv=function(e){var t=e.children;return d.createElement(Yv,null,d.createElement(su,null,t))};function Wv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Zv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Zv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Qv(e,t){return wm.getSetStateByKey(e,t)}function Xv(e){switch(e){case km.Playlists:return o.Subjects.EDIT_SUBJECT_PLAYLISTS;case km.Series:return o.Subjects.EDIT_SUBJECT_SERIES;case km.Videos:return o.Subjects.EDIT_SUBJECT_VIDEOS}}function eb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return tb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function nb(e){var t=eb(d.useState({}),2),n=t[0],r=t[1],a=n.presentations,s=n.classifications,c=n.memberIds,l=n.membersWithClassifications,p=i.useBasicFetch(Array.isArray(c)&&function(e,t){switch(e){case km.Playlists:return im(t);case km.Series:return iv(t);case km.Videos:return ay(t)}}(e.memberType,c)),m=eb(d.useContext(Kv),2),h=m[0],g=m[1],y=Kd(f.SUBJECT);!function(e,t,n){var r=e.subjectId,i=e.memberType,a=Wv(d.useContext(Kv),1)[0];Tm(Uh.getPresentationsFetchOptions(Qv(n,"presentations")),[]),Tm(Uh.getSubjectMemberIdsFetchOptions(r,i,Qv(n,"memberIds")),[r,i]),Tm(!!a&&Uh.getSubjectClassificationFetchOptions(r,Qv(n,"classifications"),a.id,i),[r,i,a],!!a)}(e,0,r),function(e,t,n,r){var i=n.classifications;d.useEffect((function(){Qv(r,"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}))}}))}(t.memberType,e,i))}),[e,i])}(p.data,e,n,r);var v,b,S=!!h&&!!s;return d.createElement(d.Fragment,null,d.createElement(wg,{subjectId:e.subjectId,activeAction:Xv(e.memberType)}),d.createElement(co.Alert,{variant:"info",className:"m-0"},"Select which ".concat(e.memberType," are shown for each classification in this subject.")+" Change the selected presentation to view different classifications."),d.createElement("div",{className:"w-50 py-2"},!!a&&d.createElement(vg,{presentations:a,currentPresentation:h,setCurrentPresentation:g})),S&&d.createElement(Vg,{members:l||[],memberType:e.memberType,getMemberAppLink:function(t){return Um.getMemberAppLink(e.memberType,t)},getActions:function(t){return Um.getMemberActions(e.subjectId,Lm.Subject,e.memberType,t)},classifications:s,getClassificationAppLink:h&&(v=e.memberType,b=h.id,function(e){var t,n=u.SUBJECTS,r=[b,e];switch(v){case km.Playlists:t=o.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;break;case km.Series:t=o.Subjects.EDIT_CLASSIFICATION_SERIES;break;case km.Videos:t=o.Subjects.EDIT_CLASSIFICATION_VIDEOS}return{application:n,action:t,args:r}}),onToggleClassification:function(t,n,r){return function(e,t,n,r,i,a,o){(o?e.addObjectsToClassification.bind(e):e.removeObjectsFromClassification.bind(e))(a,n,t,r,i)}(y,e.memberType,r?[r]:c,e.subjectId,h&&h.id,t,n)}}))}function rb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ib(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ib(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ib(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ab(e){var t=e.parentId,n=rb(d.useState(),2),i=n[0],a=n[1],s=Kd(f.SUBJECT);Tm(Uh.getSubjectTreeFetchOptions(a),[]);var c={application:u.SUBJECTS,action:o.Subjects.PRESENTATIONS};return d.createElement(d.Fragment,null,d.createElement("div",{className:"pb-2 border-bottom"},d.createElement(_l,{backToName:"Presentations",appLink:c})),d.createElement("h4",{className:"py-2"},"Create New Subject"),!!i&&d.createElement(Ag,{subject:{parentId:t},subjectTree:i,saveSubject:function(e,t){return s.createSubject(e,function(e){return function(t){e(),t&&t.id&&r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_SUBJECT,args:[t.id]})}}(t),t)}}))}function ob(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return sb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cb(e){var t=ob(d.useState(),2),n=t[0],r=t[1],a=ob(d.useState(!1),2),o=a[0],s=a[1],c=i.useBasicFetch(function(e,t){switch(e){case km.Playlists:return rm(t);case km.Series:return rv(t);case km.Videos:return iy(t)}}(e.memberType,e.memberId)),l=Kd(f.SUBJECT);Tm(Uh.getSubjectFetchOptions(e.subjectId,r),[e.subjectId]);var u=!!n&&!!c.data,p="Remove ".concat(Ql(Um.singularizeMemberType(e.memberType)));return d.createElement(Of,{title:p,closePopup:e.closePopup,showLoadingSpinner:!u},u&&d.createElement(d.Fragment,null,d.createElement("div",null,d.createElement("p",null,"Are you sure you want to remove ",d.createElement("strong",null,c.data.name)," from ",d.createElement("strong",null,n.name),"?"),d.createElement("p",null,"Please ensure that it is not in any classifications before removing.")),d.createElement(jf,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){s(!0),l.removeObjectsFromSubject(e.subjectId,[e.memberId],e.memberType,e.closePopup,e.closePopup)},buttonText:"Yes, remove this ".concat(Um.singularizeMemberType(e.memberType)),isSpinnerButton:!0,showSpinner:o}]})))}function lb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ub(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ub(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ub(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function pb(e){var t=e.subjectId,n=lb(d.useState({}),2),r=n[0];return function(e,t){var n=function(e){return wm.getSetStateByKey(t,e)};Tm(Uh.getSubjectClassificationFetchOptions(e,n("classifications")),[e]),Tm(Uh.getPresentationsFetchOptions(n("presentations")),[])}(t,n[1]),d.createElement(d.Fragment,null,d.createElement(wg,{subjectId:t,activeAction:o.Subjects.SUBJECT_CLASSIFICATIONS}),d.createElement(Pg,{presentations:r.presentations,classificationDictionary:Mt.groupBy(r.classifications,"presentationId")}))}var fb=n(128),db=n.n(fb);function mb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return hb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gb(e){var t=e.selectedSubjectId,n=mb(d.useState(),2),r=n[0],i=n[1];Tm(Uh.getSubjectTreeFetchOptions(i),[]);var a=d.useCallback((function(e){return{application:u.SUBJECTS,action:o.Subjects.EDIT_SUBJECT,args:[e.id]}}),[]),s={application:u.SUBJECTS,action:o.Subjects.NEW_SUBJECT},c=[{label:"Add child",getAppLink:function(e){return Object.assign(Object.assign({},s),{params:{parentId:e.id}})}},{label:"Delete subject",getAppLink:function(e){return{application:u.SUBJECTS,action:o.Subjects.DELETE_SUBJECT,args:[e.id]}},className:"text-danger"}];return d.createElement("div",{className:"".concat(db.a.navContainer," h-auto pr-2 border-right")},d.createElement("h5",{className:"border-bottom pb-2"},"Subjects"),d.createElement(kl,{appLink:s,className:"d-inline-block pb-2"},d.createElement(Il,{svgName:vl.Plus,size:Ol.Small}),d.createElement("span",null,"New Subject")),!!r&&d.createElement("div",{className:"border-top pt-1"},d.createElement(Op,{tree:r,getAppLink:a,selectedIds:[t],actions:c})))}function yb(e){var t=e.currentAppLink;return d.createElement(Bg,{navItems:Vm(),currentAppLink:t})}function vb(e){return(vb="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 bb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sb(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 Eb(e,t,n){return t&&Sb(e.prototype,t),n&&Sb(e,n),e}function Cb(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&&Ob(e,t)}function Ob(e,t){return(Ob=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ib(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ab(e);if(t){var i=Ab(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return jb(this,n)}}function jb(e,t){return!t||"object"!==vb(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 Ab(e){return(Ab=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Tb=function(e){Cb(n,e);var t=Ib(n);function n(){return bb(this,n),t.apply(this,arguments)}return Eb(n,[{key:"channelName",get:function(){return u.PLAYLISTS}},{key:"appRoutes",get:function(){return{"manage/playlists(/)":"index","manage/playlists/new(/)":"newPlaylist","manage/playlists/search(/)":"searchPlaylists","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"]}}]),n}(r.AppRouter),wb=function(e){Cb(n,e);var t=Ib(n);function n(){return bb(this,n),t.apply(this,arguments)}return Eb(n,[{key:"initialize",value:function(){var e=this;pt.values(f).forEach((function(t){return $d.getInstance(t,e)}))}},{key:"index",value:function(e){var t;this.layout.showChildView(ae,d.createElement(gy,{cursor:null===(t=e)||void 0===t?void 0:t.cursor}))}},{key:"searchPlaylists",value:function(e){var t,n;this.layout.showChildView(ae,d.createElement(by,{query:null===(t=e)||void 0===t?void 0:t.query,cursor:null===(n=e)||void 0===n?void 0:n.cursor}))}},{key:"newPlaylist",value:function(){this.layout.showChildView(ae,d.createElement(ny,null))}},{key:"editPlaylist",value:function(e){this.layout.showChildView(ae,d.createElement(Om,{key:e,playlistId:e}))}},{key:"editPlaylistVideos",value:function(e){this.layout.showChildView(ae,d.createElement(ty,{key:e,playlistId:e}))}},{key:"editPlaylistSubjects",value:function(e){this.layout.showChildView(ae,d.createElement(Wg,{key:e,playlistId:e}))}},{key:"editPlaylistAudiences",value:function(e){this.layout.showChildView(ae,d.createElement(Jg,{key:e,playlistId:e}))}},{key:"deletePlaylist",value:function(e){var t=Object.assign({playlistId:e},this.getPopupProps());this.layout.showChildView(oe,d.createElement(dm,Object.assign({},t)))}},{key:"removeVideo",value:function(e,t){var n=Object.assign({playlistId:e,videoId:t},this.getPopupProps());this.layout.showChildView(oe,d.createElement(uy,Object.assign({},n)))}},{key:"removeFromSubject",value:function(e,t){var n=Object.assign({subjectId:t,memberId:e,memberType:km.Playlists},this.getPopupProps());this.layout.showChildView(oe,d.createElement(cb,Object.assign({},n)))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(oe,d.createElement(Wd,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 h.Radio.channel(y.ALERT).trigger("remove:alert",e)};this.layout.showChildView(se,d.createElement(Ef,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Playlists Application"}},{key:"channelName",get:function(){return u.PLAYLISTS}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT,options:{provider:Zd}}}}],[{key:"router",get:function(){return Tb}}]),n}(r.Application),Lb=function(e){var t=e.children;return d.createElement(su,null,t)},kb=function(){return"/api/domain/v2/me/ratings"},_b="ratings",xb=function(){return{url:kb(),key:_b}},Pb=oo.object().shape({name:oo.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:oo.string().trim().max(350,"Description is too long").default(""),rating:oo.object().shape({id:oo.string()}).default({}).noUnknown(),tallPoster:oo.object().shape({fileId:oo.string(),fileIdType:oo.mixed(),url:oo.string()}).default({}).noUnknown(),banner:oo.object().shape({fileId:oo.string(),fileIdType:oo.mixed(),url:oo.string()}).default({}).noUnknown()}).noUnknown(),Nb=function(e,t){var n=u.SERIES,r=o.Series,i=[{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 vm(e)&&i.push.apply(i,[{label:"Subjects",appLink:{application:n,action:r.EDIT_SERIES_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_SERIES_AUDIENCES,args:[t]}}]),i};function Db(e){var t=za(),n=yo(t);return d.createElement(Qa,null,d.createElement(go,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this series",autoFocus:!0}),d.createElement(go,{label:"Description",as:"textarea",name:"description",id:"description",maxLength:350,value:t.values.description,placeholder:"Describe this series here",showCharacterCounter:!0}),d.createElement(mp,{ratings:e.ratings}),d.createElement(fu,{imageType:Fl.TallPosters,fieldName:"tallPoster",application:u.SERIES,uploadAction:o.Series.UPLOAD_IMAGE}),d.createElement(fu,{imageType:Fl.Banners,fieldName:"banner",application:u.SERIES,uploadAction:o.Playlists.UPLOAD_IMAGE}),d.createElement("div",{className:"d-flex justify-content-between align-items-center"},d.createElement(bo,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&d.createElement(lp,{actions:e.actions})))}function Rb(e){return d.createElement(ao,{initialValues:e.series,validationSchema:Pb,onSubmit:e.saveSeries},d.createElement(Db,{id:e.series&&e.series.id,ratings:e.ratings}))}function Fb(e){return d.createElement("div",{className:"py-2"},d.createElement(hp,{tabs:Nb(e.currentUser,e.seriesId),isItemActive:(t=e.activeAction,function(e){return e.appLink.action===t})}));var t}function Mb(e){var t,n=Object(te.useDispatch)(),r=Qd(),a=i.useBasicFetch(rv(e.seriesId)),s=i.useBasicFetch(xb()),c=i.useBasicFetch(mm);return d.createElement(d.Fragment,null,!!c.data&&d.createElement(Fb,{seriesId:e.seriesId,activeAction:o.Series.EDIT_SERIES,currentUser:c.data}),!!a.data&&!!s.data&&d.createElement(Rb,{series:a.data,saveSeries:function(t,a){i.fetch(n,ov(e.seriesId,t,(function(){r.success("Successfully updated series.")}),(function(){r.error("Failed to update series.")}),a))},ratings:s.data}),d.createElement("div",{className:"py-3 text-right"},"Can't find what you're looking for? Try the old edit series page ",d.createElement(kl,{className:"info-link",appLink:(t=e.seriesId,{application:u.SERIES,action:o.Series.LEGACY_EDIT_SERIES,args:[t]})},"here"),"."))}function Ub(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Vb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Bb(e){var t=Ub(d.useState({}),2),n=t[0],r=t[1],a=i.useBasicFetch(rv(e.seriesId)),s=i.useBasicFetch(mm),c=Kd(f.SUBJECT);!function(e,t,n){var r=function(e){return wm.getSetStateByKey(n,e)};Tm(Uh.getObjectLevelsFetchOptions(e,km.Series,r("seriesLevels")),[e]),Tm(Uh.getObjectAudiencesFetchOptions(e,km.Series,r("seriesAudiences")),[e,t.seriesLevels]),Am([Uh.getPresentationsFetchOptions(r("presentations")),Uh.getLevelsFetchOptions(r("levels"))],[]),Tm(!!t.currentPresentation&&Uh.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(e.seriesId,n,r),zg(n,r);var l=!!(n.presentations&&n.levels&&n.presentationAudiences&&n.seriesLevels&&n.seriesAudiences);return d.createElement(d.Fragment,null,!!s.data&&d.createElement(Fb,{seriesId:e.seriesId,activeAction:o.Series.EDIT_SERIES_AUDIENCES,currentUser:s.data}),d.createElement(up,{object:a.data}),!!l&&d.createElement(Yh,{objectLevels:n.seriesLevels,objectAudiences:n.seriesAudiences,presentations:n.presentations,currentPresentation:n.currentPresentation,setCurrentPresentation:wm.getSetStateByKey(r,"currentPresentation"),levels:n.levels,presentationAudiences:n.presentationAudiences,memberType:km.Series,saveLevels:function(t,n,r){return c.updateObjectLevels(e.seriesId,t,km.Series,n,r,r)},saveAudiences:function(t,r){return c.updateObjectAudiences(e.seriesId,n.currentPresentation.id,t,km.Series,r,r)}}))}function zb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||qb(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hb(e){return function(e){if(Array.isArray(e))return Jb(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||qb(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qb(e,t){if(e){if("string"==typeof e)return Jb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jb(e,t):void 0}}function Jb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $b(e){var t=zb(d.useState({}),2),n=t[0],r=t[1],a=i.useBasicFetch(rv(e.seriesId)),s=i.useBasicFetch(mm),c=Kd(f.SUBJECT);!function(e,t,n){var r=function(e){return wm.getSetStateByKey(n,e)};Am([Uh.getSubjectTreeFetchOptions(r("subjectTree")),Uh.getPresentationsFetchOptions(r("presentations"))],[]),Tm(Uh.getObjectSubjectsFetchOptions(e,km.Series,r("seriesSubjects")),[e]),Tm(!!t.currentPresentation&&Uh.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),d.useEffect((function(){return r("subjectClassifications")([])}),[t.seriesSubjects]);var i=function(e,t){return[].concat(Hb(t.subjectClassifications||[]),Hb(e))},a=t.seriesSubjects&&t.seriesSubjects.map((function(e){return Uh.getSubjectClassificationFetchOptions(e.id,wm.getSetStateByKey(n,"subjectClassifications",i))}));Am(a,[t.seriesSubjects],!!a),Tm(Uh.getObjectClassificationsFetchOptions(e,km.Series,r("seriesClassifications")),[e,t.seriesSubjects])}(e.seriesId,n,r),zg(n,r);var l=!!(n.seriesSubjects&&n.subjectTree&&n.presentations&&n.classificationTree&&n.seriesClassifications&&n.subjectClassifications);return d.createElement(d.Fragment,null,!!s.data&&d.createElement(Fb,{seriesId:e.seriesId,activeAction:o.Series.EDIT_SERIES_SUBJECTS,currentUser:s.data}),d.createElement(up,{object:a.data}),l&&d.createElement(Cg,{objectSubjects:n.seriesSubjects,subjectTree:n.subjectTree,memberType:km.Series,presentations:n.presentations,currentPresentation:n.currentPresentation,setCurrentPresentation:wm.getSetStateByKey(r,"currentPresentation"),objectClassifications:n.seriesClassifications,objectSubjectClassifications:n.subjectClassifications,classificationTree:n.classificationTree,saveSubjects:function(t,n,r){return c.updateObjectSubjects(e.seriesId,t,km.Series,n,r,r)},saveClassifications:function(t,r){return c.updateObjectClassifications(e.seriesId,n.currentPresentation.id,t,km.Series,r,r)}}))}function Kb(){var e=Object(te.useDispatch)(),t=Qd(),n=i.useBasicFetch(xb());return d.createElement(d.Fragment,null,!!n.data&&d.createElement(Rb,{saveSeries:function(n,a){var s=function(){t.error("Failed to create series.")},c=function(e){t.success("Successfully created series."),function(e){r.AppLinkHelper.trigger({application:u.SERIES,action:o.Series.EDIT_SERIES,args:[e.id]})}(e)};i.fetch(e,av(n,(function(t){var n={permissions:ym()};i.fetch(e,ov(t.id,n,c,s,a))}),s))},ratings:n.data}))}function Yb(e){return(Yb="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 Gb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wb(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 Zb(e,t,n){return t&&Wb(e.prototype,t),n&&Wb(e,n),e}function Qb(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&&Xb(e,t)}function Xb(e,t){return(Xb=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eS(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=nS(e);if(t){var i=nS(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return tS(this,n)}}function tS(e,t){return!t||"object"!==Yb(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 nS(e){return(nS=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var rS=function(e){Qb(n,e);var t=eS(n);function n(){return Gb(this,n),t.apply(this,arguments)}return Zb(n,[{key:"channelName",get:function(){return u.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","manage/legacy/series/:id(/)":"legacyEditSeries"}}},{key:"appLinks",get:function(){return["uploadImage"]}}]),n}(r.AppRouter),iS=function(e){Qb(n,e);var t=eS(n);function n(){return Gb(this,n),t.apply(this,arguments)}return Zb(n,[{key:"initialize",value:function(){var e=this;pt.values(f).forEach((function(t){return $d.getInstance(t,e)}))}},{key:"newSeries",value:function(){this.layout.showChildView(ae,d.createElement(Kb,null))}},{key:"editSeries",value:function(e){this.layout.showChildView(ae,d.createElement(Mb,{seriesId:e}))}},{key:"editSeriesVideos",value:function(e){this.legacyEditSeries(e)}},{key:"editSeriesSubjects",value:function(e){this.layout.showChildView(ae,d.createElement($b,{seriesId:e}))}},{key:"editSeriesAudiences",value:function(e){this.layout.showChildView(ae,d.createElement(Bb,{seriesId:e}))}},{key:"legacyEditSeries",value:function(e){r.LocationUtils.Redirect("/manage/legacy/series/".concat(e),!0)}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(oe,d.createElement(Wd,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 h.Radio.channel(y.ALERT).trigger("remove:alert",e)};this.layout.showChildView(se,d.createElement(Ef,{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 u.SERIES}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT,options:{provider:Lb}}}}],[{key:"router",get:function(){return rS}}]),n}(r.Application);function aS(e){return(aS="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 oS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sS(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 cS(e,t,n){return t&&sS(e.prototype,t),n&&sS(e,n),e}function lS(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&&uS(e,t)}function uS(e,t){return(uS=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pS(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=dS(e);if(t){var i=dS(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fS(this,n)}}function fS(e,t){return!t||"object"!==aS(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 dS(e){return(dS=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var mS=function(e){lS(n,e);var t=pS(n);function n(){return oS(this,n),t.apply(this,arguments)}return cS(n,[{key:"channelName",get:function(){return u.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"]}}]),n}(r.AppRouter),hS=function(e){lS(n,e);var t=pS(n);function n(){return oS(this,n),t.apply(this,arguments)}return cS(n,[{key:"initialize",value:function(){var e=this;this.subjectDataService=$d.getInstance(f.SUBJECT,this),pt.values(f).forEach((function(t){return $d.getInstance(t,e)}))}},{key:"subjects",value:function(){this.subjectDataService.getSubjectTree((function(e){var t=!!e.children&&e.children[0];t?r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_SUBJECT,args:[t.id]},{replace:!0}):r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.NEW_SUBJECT},{replace:!0})}))}},{key:"newSubject",value:function(e){var t={parentId:e.parentId};this.layout.showChildView(ae,d.createElement(ab,Object.assign({key:e.parentId},t))),this.renderSubjectsLeftNav()}},{key:"editSubject",value:function(e){this.layout.showChildView(ae,d.createElement(qv,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"editSubjectPlaylists",value:function(e){var t={subjectId:e,memberType:km.Playlists};this.layout.showChildView(ae,d.createElement(nb,Object.assign({key:"".concat(e,":playlists")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectSeries",value:function(e){var t={subjectId:e,memberType:km.Series};this.layout.showChildView(ae,d.createElement(nb,Object.assign({key:"".concat(e,":series")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectVideos",value:function(e){var t={subjectId:e,memberType:km.Videos};this.layout.showChildView(ae,d.createElement(nb,Object.assign({key:"".concat(e,":videos")},t))),this.renderSubjectsLeftNav(e)}},{key:"subjectClassifications",value:function(e){this.layout.showChildView(ae,d.createElement(pb,{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(ae,d.createElement(Mv,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(oe,d.createElement(cb,Object.assign({},r)))}},{key:"deleteSubject",value:function(e){var t=e.toString()===this.currentLeftNavId.toString()?{application:u.SUBJECTS,action:o.Subjects.NEW_SUBJECT}:null,n=Object.assign({subjectId:e,routeToOnDelete:t||null},this.getPopupProps());this.layout.showChildView(oe,d.createElement(Bv,Object.assign({},n)))}},{key:"classifications",value:function(){var e={objectType:"classifications",getAppLink:function(e){return{application:u.SUBJECTS,action:o.Subjects.PRESENTATION_CLASSIFICATIONS,args:[e.id]}}};this.layout.showChildView(ae,d.createElement(kv,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationClassifications",value:function(e){this.subjectDataService.getClassificationTree(e,(function(t){var n=!!t.children&&t.children[0];n?r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]},{replace:!0}):r.AppLinkHelper.trigger({application:u.SUBJECTS,action:o.Subjects.NEW_CLASSIFICATION,args:[e]},{replace:!0})}))}},{key:"newClassification",value:function(e,t){var n={presentationId:e,parentId:t.parentId};this.layout.showChildView(ae,d.createElement(nv,Object.assign({key:t.parentId},n))),this.renderClassificationLeftNav(e)}},{key:"editClassification",value:function(e,t){var n={presentationId:e,classificationId:t};this.layout.showChildView(ae,d.createElement(Wy,Object.assign({key:t},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationPlaylists",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:km.Playlists};this.layout.showChildView(ae,d.createElement(Xy,Object.assign({key:"".concat(t,":playlists")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationSeries",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:km.Series};this.layout.showChildView(ae,d.createElement(Xy,Object.assign({key:"".concat(t,":series")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationVideos",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:km.Videos};this.layout.showChildView(ae,d.createElement(Xy,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(oe,d.createElement(lv,Object.assign({},r)))}},{key:"deleteClassification",value:function(e,t){var n=t===this.currentLeftNavId?{application:u.SUBJECTS,action:o.Subjects.NEW_CLASSIFICATION,args:[e]}:null,r=Object.assign({classificationId:t,routeToOnDelete:n||null},this.getPopupProps());this.layout.showChildView(oe,d.createElement(Ky,Object.assign({},r)))}},{key:"levels",value:function(){this.layout.showChildView(ae,d.createElement(yv,null)),this.hideLeftNav()}},{key:"newLevel",value:function(){this.layout.showChildView(ae,d.createElement(vv,null)),this.hideLeftNav()}},{key:"editLevel",value:function(e){this.layout.showChildView(ae,d.createElement(fv,{key:e,id:e})),this.hideLeftNav()}},{key:"audiences",value:function(){var e={objectType:"audiences",getAppLink:function(e){return{application:u.SUBJECTS,action:o.Subjects.PRESENTATION_AUDIENCES,args:[e.id]}}};this.layout.showChildView(ae,d.createElement(kv,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationAudiences",value:function(e){this.layout.showChildView(ae,d.createElement(Py,{presentationId:e})),this.hideLeftNav()}},{key:"newAudience",value:function(e){this.layout.showChildView(ae,d.createElement(Fy,{presentationId:e})),this.hideLeftNav()}},{key:"editAudience",value:function(e,t){var n={presentationId:e,audienceId:t};this.layout.showChildView(ae,d.createElement(Ty,Object.assign({key:t},n))),this.hideLeftNav()}},{key:"deleteAudience",value:function(e,t){var n={application:u.SUBJECTS,action:o.Subjects.PRESENTATION_AUDIENCES,args:[e]},r=Object.assign({id:t,routeToOnDelete:n},this.getPopupProps());this.layout.showChildView(oe,d.createElement(Oy,Object.assign({},r)))}},{key:"presentations",value:function(){this.layout.showChildView(ae,d.createElement(Av,null)),this.hideLeftNav()}},{key:"newPresentation",value:function(){this.layout.showChildView(ae,d.createElement(Tv,null))}},{key:"editPresentation",value:function(e){this.layout.showChildView(ae,d.createElement(Ev,{key:e,id:e})),this.hideLeftNav()}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(oe,d.createElement(Wd,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 h.Radio.channel(y.ALERT).trigger("remove:alert",e)};this.layout.showChildView(se,d.createElement(Ef,{alerts:n,removeAlert:r}))}},{key:"renderClassificationLeftNav",value:function(e,t){this.setCurrentLeftNavItem(t);var n={presentationId:e,selectedClassificationId:t};this.layout.showChildView(ie,d.createElement(qy,Object.assign({},n)))}},{key:"renderSubjectsLeftNav",value:function(e){this.setCurrentLeftNavItem(e),this.layout.showChildView(ie,d.createElement(gb,{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 d.createElement(yb,{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 u.SUBJECTS}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT,options:{provider:Gv,getTopNavView:this.getTopNav}}}}],[{key:"router",get:function(){return mS}}]),n}(r.Application);class gS extends P{onShowAlert(e){if(!this.layoutOptions.options.alertRegion)return;const{ctor:t,collection:n}=e,r=n?n.toJSON():[];this.layout.showChildView(this.layoutOptions.options.alertRegion,d.createElement(t,{alerts:r,removeAlert:e=>h.Radio.channel(y.ALERT).trigger("remove:alert",e)}))}}var yS,vS=function(e){return{url:"/api/domain/v1/themes/".concat(e),key:"themes:".concat(e)}},bS=function(e){var t="/api/domain/v1/themes",n="themes";return e&&(t+="?type=".concat(e),n+=":type:".concat(e)),{url:t,key:n}},SS=function(e,t,n,r){return{url:"/api/domain/v1/themes",key:"theme",data:e,type:nt.POST,invalidationKeys:"themes",success:t,error:n,always:r}},ES=function(e,t,n,r,i){return{url:"/api/domain/v1/themes/".concat(e),key:"update:theme:".concat(e),data:t,type:nt.PUT,success:n,error:r,always:i}},CS=function(e,t,n,r){return{url:"/api/domain/v1/themes/".concat(e),key:"delete:theme:".concat(e),type:nt.DELETE,invalidationKeys:"themes",success:t,error:n,always:r}},OS=function(e){return{application:u.THEMES,action:o.Themes.EDIT_THEME,args:[e.id]}};function IS(){var e=i.useBasicFetch(bS());return e.data?d.createElement(fp,{objects:e.data,getObjectAppLink:OS,newObjectAppLink:{application:u.THEMES,action:o.Themes.NEW_THEME},objectName:"Theme"}):d.createElement(d.Fragment,null)}!function(e){e.Glance="glance"}(yS||(yS={}));var jS=[{key:"topLeft",label:"Top Left"},{key:"topRight",label:"Top Right"},{key:"bottomLeft",label:"Bottom Left"},{key:"bottomRight",label:"Bottom Right"}];function AS(){var e=za();return d.createElement("div",{className:"form-group"},jS.map((function(t){var n="data.".concat(t.key);return d.createElement(fu,{label:t.label,imageType:Fl.HeroBanners,fieldName:n,application:u.THEMES,uploadAction:o.Videos.UPLOAD_IMAGE,setSelectedImage:function(t){e.setFieldValue(n,{fileId:t.id,url:t.url,fileIdType:Ul.ImageAPIv2})}})})))}var TS=oo.object().shape({fileId:oo.string(),fileIdType:oo.mixed(),url:oo.string()}).default({}).noUnknown(),wS=oo.object().shape({name:oo.string().trim().max(255,"Name is too long").required("Name is required").default(""),type:oo.mixed().required("Type is required"),data:oo.mixed().when("type",{is:yS.Glance,then:oo.object().shape({topLeft:TS,topRight:TS,bottomLeft:TS,bottomRight:TS}).noUnknown(),otherwise:oo.mixed().strip(!0)}).default({})}).noUnknown();function LS(e){var t=za(),n=function(e){switch(e){case yS.Glance:return AS;default:return}}(t.values.type);return d.createElement(Qa,null,d.createElement(go,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this theme",autoFocus:!0}),d.createElement(go,{as:"select",label:"Type",name:"type",id:"type",value:t.values.type},d.createElement("option",{value:null},"Select a type..."),pt.getEnumKeys(yS).map((function(e){return d.createElement("option",{key:e,value:yS[e]},e)}))),!!n&&d.createElement(n,null),d.createElement("div",{className:"d-flex justify-content-between align-items-center"},d.createElement(To,{isNew:e.isNew}),!!e.actions&&d.createElement(lp,{actions:e.actions})))}function kS(e){var t;return d.createElement(ao,{initialValues:e.theme,validationSchema:wS,onSubmit:e.saveTheme},d.createElement(LS,{isNew:!(null===(t=e.theme)||void 0===t?void 0:t.id),actions:e.actions}))}function _S(){var e=Object(te.useDispatch)();return d.createElement(kS,{saveTheme:function(t,n){i.fetch(e,SS(t,(function(e){n(),r.AppLinkHelper.trigger({application:u.THEMES,action:o.Themes.EDIT_THEME,args:[e.id]})}),null,n))}})}function xS(e){var t=Object(te.useDispatch)(),n=Qd(),r=i.useBasicFetch(vS(e.id));return r.data?d.createElement(kS,{theme:r.data,saveTheme:function(r,a){i.fetch(t,ES(e.id,r,(function(){n.success("Successfully updated theme")}),(function(){n.error("Failed to update theme")}),a))},actions:[{label:"Delete theme",className:"btn btn-danger",button:!0,appLink:{application:u.THEMES,action:o.Themes.DELETE_THEME,args:[e.id]}}]}):d.createElement(d.Fragment,null)}function PS(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return NS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return NS(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function NS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function DS(e){var t=Object(te.useDispatch)(),n=Qd(),a=PS(d.useState(!1),2),s=a[0],c=a[1],l=i.useBasicFetch(vS(e.id));return d.createElement(Of,{title:"Delete Theme",closePopup:e.closePopup,showLoadingSpinner:!l.data},d.createElement(d.Fragment,null,d.createElement("p",null,"Are you sure you want to delete ",d.createElement("strong",null,l.data.name),"?"),d.createElement(jf,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){c(!0),i.fetch(t,CS(e.id,(function(){n.success("Successfully deleted theme"),r.AppLinkHelper.trigger({application:u.THEMES,action:o.Themes.THEMES})}),(function(){n.error("Failed to delete theme")})))},buttonText:"Yes, delete this theme",isSpinnerButton:!0,showSpinner:s}]})))}var RS=function(e){var t=e.children;return d.createElement(su,null,t)};function FS(e){return(FS="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function MS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function US(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 VS(e,t,n){return t&&US(e.prototype,t),n&&US(e,n),e}function BS(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zS(e,t)}function zS(e,t){return(zS=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function HS(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=JS(e);if(t){var i=JS(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return qS(this,n)}}function qS(e,t){return!t||"object"!==FS(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function JS(e){return(JS=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var $S=function(e){BS(n,e);var t=HS(n);function n(){return MS(this,n),t.apply(this,arguments)}return VS(n,[{key:"channelName",get:function(){return u.THEMES}},{key:"appRoutes",get:function(){return{"manage/themes(/)":"themes","manage/themes/new(/)":"newTheme","manage/themes/:id(/)":"editTheme"}}},{key:"appLinks",get:function(){return["deleteTheme","uploadImage"]}}]),n}(r.AppRouter),KS=function(e){BS(n,e);var t=HS(n);function n(){return MS(this,n),t.apply(this,arguments)}return VS(n,[{key:"themes",value:function(){this.layout.showChildView(ae,d.createElement(IS,null))}},{key:"newTheme",value:function(){this.layout.showChildView(ae,d.createElement(_S,null))}},{key:"editTheme",value:function(e){this.layout.showChildView(ae,d.createElement(xS,{id:e}))}},{key:"deleteTheme",value:function(e){var t=this;this.layout.showChildView(oe,d.createElement(DS,{id:e,closePopup:function(){return t.layout.closePopup()}}))}},{key:"uploadImage",value:function(e){var t=this;this.layout.showChildView(oe,d.createElement(Wd,{imageType:e,closePopup:function(){return t.layout.closePopup()}}))}},{key:"name",get:function(){return"Themes Application"}},{key:"channelName",get:function(){return u.THEMES}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT,options:{provider:RS}}}}],[{key:"router",get:function(){return $S}}]),n}(gS),YS=function(e){var t=e.children;return d.createElement(su,null,t)},GS=function(e,t){var n=u.VIDEOS,r=o.Videos,i=[{label:"Edit Video Details",appLink:{application:n,action:r.EDIT_VIDEO,args:[t]}}];return vm(e)?[].concat(i,[{label:"Subjects",appLink:{application:n,action:r.EDIT_VIDEO_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_VIDEO_AUDIENCES,args:[t]}},{label:"Aliases",appLink:{application:n,action:r.EDIT_VIDEO_ALIASES,args:[t]}}]):i};function WS(e){var t,n=GS(e.currentUser,e.videoId);return n.length<2?d.createElement(d.Fragment,null):d.createElement("div",{className:"py-2"},d.createElement(hp,{tabs:n,isItemActive:(t=e.activeAction,function(e){return e.appLink.action===t})}))}var ZS,QS=oo.object().shape({name:oo.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:oo.string().trim().default(""),status:oo.mixed().required("Status is required"),productionYear:oo.number().min(1900),rating:oo.object().shape({id:oo.string()}).default({}).noUnknown(),thumbnail:oo.object().shape({fileId:oo.string(),fileIdType:oo.mixed(),url:oo.string()}).default({}).noUnknown(),heroBanner:oo.object().shape({fileId:oo.string(),fileIdType:oo.mixed(),url:oo.string()}).default({}).noUnknown(),glance:oo.object().shape({theme:oo.string(),format:oo.mixed(),content:oo.string()}).default({}).noUnknown()}).noUnknown();!function(e){e[e.Draft=0]="Draft",e[e.Published=1]="Published",e[e.Archived=2]="Archived",e[e.Pending=3]="Pending",e[e.Rejected=4]="Rejected",e[e.Processing=5]="Processing"}(ZS||(ZS={}));var XS,eE=n(129);function tE(e){var t,n,r,i,a,o=za();return d.createElement("div",{className:"form-group p-2 border"},d.createElement("div",{className:"border-bottom mb-2"},d.createElement("label",null,"Summary")),d.createElement(go,{as:"select",label:"Theme",name:"glance.theme",id:"type",value:null===(t=o.values.glance)||void 0===t?void 0:t.theme},d.createElement("option",{value:null},"Select a theme..."),e.themes.map((function(e){return d.createElement("option",{key:e.id,value:e.name},e.name)}))),d.createElement(go,{as:"select",label:"Format",name:"glance.format",id:"type",value:null===(n=o.values.glance)||void 0===n?void 0:n.format},d.createElement("option",{value:null},"Select a format..."),pt.getEnumKeys(XS).map((function(e){return d.createElement("option",{key:e,value:XS[e]},e)}))),d.createElement(go,{label:"Content",as:"textarea",name:"glance.content",id:"content",value:null===(r=o.values.glance)||void 0===r?void 0:r.content}),(null===(i=o.values.glance)||void 0===i?void 0:i.format)===XS.Markdown&&d.createElement("div",{className:"form-group"},d.createElement("label",null,"Content Preview"),d.createElement("div",{className:"border rounded py-2",dangerouslySetInnerHTML:{__html:eE(null===(a=o.values.glance)||void 0===a?void 0:a.content)}})))}function nE(e){switch(e){case ZS.Published:return"badge-success";case ZS.Archived:return"badge-danger";case ZS.Draft:return"badge-warning";case ZS.Pending:return"badge-info";case ZS.Rejected:return"badge-dark";default:return"badge-secondary"}}function rE(e){var t=za(),n=!!e.rightslineId,r=vm(e.currentUser);return d.createElement(Qa,null,n&&d.createElement(go,{label:"Rightsline ID",name:"rightslineId",id:"rightslineId",value:e.rightslineId,disabled:!0}),d.createElement(go,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this video",disabled:n,autoFocus:!0}),d.createElement("div",{className:"form-group"},d.createElement("label",null,"Status"),d.createElement("div",null,d.createElement("span",{className:"badge ".concat(nE(t.values.status))},ZS[t.values.status]))),d.createElement(go,{label:"Description",as:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this video here",disabled:n,showCharacterCounter:!0}),d.createElement(go,{label:"Production Year",type:"number",name:"productionYear",id:"productionYear",value:t.values.productionYear,disabled:n}),d.createElement(mp,{ratings:e.ratings,disabled:n}),d.createElement(fu,{imageType:Fl.Thumbnails,fieldName:"thumbnail",application:u.VIDEOS,uploadAction:o.Videos.UPLOAD_IMAGE}),d.createElement(fu,{imageType:Fl.HeroBanners,fieldName:"heroBanner",application:u.VIDEOS,uploadAction:o.Videos.UPLOAD_IMAGE}),r&&d.createElement(tE,{themes:e.themes}),d.createElement(To,{isNew:!e.id}))}function iE(e,t){if(e)return t?Object.assign(Object.assign({},e),t):e}function aE(e){return d.createElement(ao,{initialValues:iE(e.video,e.rightslineVideo),validationSchema:QS,onSubmit:e.saveVideo,allowInitialSubmit:!!e.rightslineVideo},d.createElement(rE,{id:e.video&&e.video.id,ratings:e.ratings,themes:e.themes,currentUser:e.currentUser,rightslineId:e.rightslineId}))}function oE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return sE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sE(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sE(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cE(e){var t,n=Object(te.useDispatch)(),r=oE(d.useState(!1),2),a=r[0],s=r[1],c=i.useBasicFetch(iy(e.videoId)),l=i.useBasicFetch(oy(e.videoId)),p=i.useBasicFetch(xb()),f=i.useBasicFetch(bS(yS.Glance)),m=i.useBasicFetch(mm);var h,g=!!c.data&&!!p.data&&!!f.data&&!!m.data&&l.isComplete;return d.createElement(d.Fragment,null,!!m.data&&d.createElement(WS,{videoId:e.videoId,activeAction:o.Videos.EDIT_VIDEO,currentUser:m.data}),!!l.data&&d.createElement("div",{className:"pt-3 text-right"},d.createElement(co.Button,{variant:"outline-dark",size:"sm",onClick:function(){l.isFetching||(s(!0),i.fetch(n,oy(e.videoId)))}},"Sync from Rightsline")),g&&d.createElement(aE,{video:c.data,saveVideo:function(t,r){i.fetch(n,sy(e.videoId,t,null,null,r))},ratings:p.data,themes:f.data,currentUser:m.data,rightslineId:null===(t=l.data)||void 0===t?void 0:t.rightslineId,rightslineVideo:a&&l.data}),d.createElement("div",{className:"py-3 text-right"},"Can't find what you're looking for? Try the old edit video page ",d.createElement(kl,{className:"info-link",appLink:(h=e.videoId,{application:u.VIDEOS,action:o.Videos.LEGACY_EDIT_VIDEO,args:[h]})},"here"),"."))}function lE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return uE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uE(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function uE(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function pE(e){var t=lE(d.useState({}),2),n=t[0],r=t[1],a=i.useBasicFetch(iy(e.videoId)),s=i.useBasicFetch(mm),c=Kd(f.SUBJECT);!function(e,t,n){var r=function(e){return wm.getSetStateByKey(n,e)};Tm(Uh.getObjectLevelsFetchOptions(e,km.Videos,r("videoLevels")),[e]),Tm(Uh.getObjectAudiencesFetchOptions(e,km.Videos,r("videoAudiences")),[e,t.videoLevels]),Am([Uh.getPresentationsFetchOptions(r("presentations")),Uh.getLevelsFetchOptions(r("levels"))],[]),Tm(!!t.currentPresentation&&Uh.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(e.videoId,n,r),zg(n,r);var l=!!(n.presentations&&n.levels&&n.presentationAudiences&&n.videoLevels&&n.videoAudiences);return d.createElement(d.Fragment,null,!!s.data&&d.createElement(WS,{videoId:e.videoId,activeAction:o.Videos.EDIT_VIDEO_AUDIENCES,currentUser:s.data}),d.createElement(up,{object:a.data}),!!l&&d.createElement(Yh,{objectLevels:n.videoLevels,objectAudiences:n.videoAudiences,presentations:n.presentations,currentPresentation:n.currentPresentation,setCurrentPresentation:wm.getSetStateByKey(r,"currentPresentation"),levels:n.levels,presentationAudiences:n.presentationAudiences,memberType:km.Videos,saveLevels:function(t,n,r){return c.updateObjectLevels(e.videoId,t,km.Videos,n,r,r)},saveAudiences:function(t,r){return c.updateObjectAudiences(e.videoId,n.currentPresentation.id,t,km.Videos,r,r)}}))}function fE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||mE(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dE(e){return function(e){if(Array.isArray(e))return hE(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||mE(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mE(e,t){if(e){if("string"==typeof e)return hE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hE(e,t):void 0}}function hE(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gE(e){var t=fE(d.useState({}),2),n=t[0],r=t[1],a=i.useBasicFetch(iy(e.videoId)),s=i.useBasicFetch(mm),c=Kd(f.SUBJECT);!function(e,t,n){var r=function(e){return wm.getSetStateByKey(n,e)};Am([Uh.getSubjectTreeFetchOptions(r("subjectTree")),Uh.getPresentationsFetchOptions(r("presentations"))],[]),Tm(Uh.getObjectSubjectsFetchOptions(e,km.Videos,r("videoSubjects")),[e]),Tm(!!t.currentPresentation&&Uh.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),d.useEffect((function(){return r("subjectClassifications")([])}),[t.videoSubjects]);var i=function(e,t){return[].concat(dE(t.subjectClassifications||[]),dE(e))},a=t.videoSubjects&&t.videoSubjects.map((function(e){return Uh.getSubjectClassificationFetchOptions(e.id,wm.getSetStateByKey(n,"subjectClassifications",i))}));Am(a,[t.videoSubjects],!!a),Tm(Uh.getObjectClassificationsFetchOptions(e,km.Videos,r("videoClassifications")),[e,t.videoSubjects])}(e.videoId,n,r),zg(n,r);var l=!!(n.videoSubjects&&n.subjectTree&&n.presentations&&n.classificationTree&&n.videoClassifications&&n.subjectClassifications);return d.createElement(d.Fragment,null,!!s.data&&d.createElement(WS,{videoId:e.videoId,activeAction:o.Videos.EDIT_VIDEO_SUBJECTS,currentUser:s.data}),d.createElement(up,{object:a.data}),l&&d.createElement(Cg,{objectSubjects:n.videoSubjects,subjectTree:n.subjectTree,memberType:km.Videos,presentations:n.presentations,currentPresentation:n.currentPresentation,setCurrentPresentation:wm.getSetStateByKey(r,"currentPresentation"),objectClassifications:n.videoClassifications,objectSubjectClassifications:n.subjectClassifications,classificationTree:n.classificationTree,saveSubjects:function(t,n,r){return c.updateObjectSubjects(e.videoId,t,km.Videos,n,r,r)},saveClassifications:function(t,r){return c.updateObjectClassifications(e.videoId,n.currentPresentation.id,t,km.Videos,r,r)}}))}!function(e){e.Markdown="text/markdown"}(XS||(XS={}));var yE=function(e){return{key:"aliases:".concat(e),url:"/api/master/v2/objects/".concat(e,"/aliases")}},vE=function(e,t,n,r){return{key:"create:alias",url:"/api/master/v2/objects/".concat(e,"/aliases"),type:nt.POST,invalidationKeys:"aliases:".concat(e),data:t,success:n,error:r}},bE=function(e,t,n,r){return{key:"delete:alias",url:"/api/domain/v2/objects/".concat(e,"/aliases/").concat(t),type:nt.DELETE,invalidationKeys:"aliases:".concat(e),success:n,error:r}};function SE(e){var t=Object(te.useDispatch)(),n=Qd(),r=i.useBasicFetch(yE(e.videoId)),a=i.useBasicFetch(mm);return r.data?d.createElement(d.Fragment,null,!!a.data&&d.createElement(WS,{videoId:e.videoId,activeAction:o.Videos.EDIT_VIDEO_ALIASES,currentUser:a.data}),d.createElement(Gp,{aliases:r.data.data,onSave:function(r,a){i.fetch(t,vE(e.videoId,r,(function(){n.success("Successfully created alias"),a()}),(function(){n.error("Something went wrong creating your alias")})))},onDelete:function(r){i.fetch(t,bE(e.videoId,r,(function(){n.success("Successfully deleted alias")}),(function(){n.error("Something went wrong deleting your alias")})))}})):d.createElement(d.Fragment,null,"Loading...")}function EE(e){return(EE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function CE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function OE(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 IE(e,t,n){return t&&OE(e.prototype,t),n&&OE(e,n),e}function jE(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&AE(e,t)}function AE(e,t){return(AE=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function TE(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=LE(e);if(t){var i=LE(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return wE(this,n)}}function wE(e,t){return!t||"object"!==EE(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function LE(e){return(LE=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var kE,_E,xE=function(e){jE(n,e);var t=TE(n);function n(){return CE(this,n),t.apply(this,arguments)}return IE(n,[{key:"channelName",get:function(){return u.VIDEOS}},{key:"appRoutes",get:function(){return{"manage/videos/:id(/)":"editVideo","manage/videos/:id/audiences(/)":"editVideoAudiences","manage/videos/:id/subjects(/)":"editVideoSubjects","manage/videos/:id/aliases(/)":"editVideoAliases","tools/programlookup/:id":"legacyEditVideo"}}},{key:"appLinks",get:function(){return["uploadImage"]}}]),n}(r.AppRouter),PE=function(e){jE(n,e);var t=TE(n);function n(){return CE(this,n),t.apply(this,arguments)}return IE(n,[{key:"initialize",value:function(){var e=this;pt.values(f).forEach((function(t){return $d.getInstance(t,e)}))}},{key:"editVideo",value:function(e){this.layout.showChildView(ae,d.createElement(cE,{videoId:e}))}},{key:"editVideoAudiences",value:function(e){this.layout.showChildView(ae,d.createElement(pE,{videoId:e}))}},{key:"editVideoSubjects",value:function(e){this.layout.showChildView(ae,d.createElement(gE,{videoId:e}))}},{key:"editVideoAliases",value:function(e){this.layout.showChildView(ae,d.createElement(SE,{videoId:e}))}},{key:"legacyEditVideo",value:function(e){r.LocationUtils.Redirect("/tools/programlookup/".concat(e))}},{key:"uploadImage",value:function(e){var t=this;this.layout.showChildView(oe,d.createElement(Wd,{imageType:e,closePopup:function(){return t.layout.closePopup()}}))}},{key:"name",get:function(){return"Videos Application"}},{key:"channelName",get:function(){return u.VIDEOS}},{key:"layoutOptions",get:function(){return{name:l.CURATOR_LAYOUT,options:{provider:YS,alertRegion:se}}}}],[{key:"router",get:function(){return xE}}]),n}(gS);!function(e){e.Fifo="FifoMemoryCache"}(kE||(kE={}));class NE extends G{constructor(e){super(),this.size=e.size,this.cache={},this.cachedkeys=[]}get name(){return kE.Fifo}removeCacheKey(e){this.cachedkeys=m.without(this.cachedkeys,e)}has(e){return!!this.cache[e]}get(e){return this.cache[e]}set(e,t){e&&t||x.throw(new B("Must provide a cache key and a value to cache in FifoMemoryCache.")),this.has(e)&&this.removeCacheKey(e),this.cachedkeys.push(e),this.cache[e]=t,this.cachedkeys.length>this.size&&delete this.cache[this.cachedkeys.shift()]}getOrSet(e,t){if(this.has(e))return this.get(e);const n=t();return this.set(e,n),n}remove(e){return!!this.has(e)&&(delete this.cache[e],this.removeCacheKey(e),!0)}invalidate(e,t){const n=m.object(this.cachedkeys,this.cachedkeys);let r=[];m.each(e,e=>{n[e]&&r.push(e);const t=new RegExp(e,"i"),i=m.filter(n,e=>t.test(e));r.push(...i)}),r.length&&(r=m.uniq(r),m.each(r,e=>{delete this.cache[e],m.isFunction(t)&&t(e)}),this.cachedkeys=m.without(this.cachedkeys,...r))}}!function(e){e[e.Unknown=0]="Unknown",e[e.BadRequest=1]="BadRequest",e[e.Unauthorized=2]="Unauthorized",e[e.Forbidden=3]="Forbidden",e[e.NotFound=4]="NotFound",e[e.InternalServer=5]="InternalServer"}(_E||(_E={}));const DE={type:_E.Unknown,message:"",code:0};var RE;!function(e){e.Ajax="AjaxDataProvider",e.Notifications="NotificationsSignalRDataProvider"}(RE||(RE={}));const FE={parseErrorMessage(e,t,n){if(!n||!n.errorCode)return e[t];let r=""+n.errorCode;return n.errorSubCode&&(r+="."+n.errorSubCode),e[r]||e[t]}};class ME extends A.Object{constructor(e){super(e),$.ajaxSetup({cache:!1,contentType:"application/json; charset=utf-8"}),this.successMiddleware={},this.errorMiddleware={},this.dataServiceErrorMessageMappings=e.dataServiceErrorMessageMappings,this.defaultErrorMessageKey=e.defaultErrorMessageKey}get name(){return RE.Ajax}parseUrl(e){const t=document.createElement("a");return t.href=e,""===t.host&&(t.href=t.href),t}makeHttps(e){const t=this.parseUrl(e);return"http:"===t.protocol&&(t.protocol="https:"),t.href}base(e,t,n,r={}){n||(n=nt.GET);const i=m.defaults(r,{forceHttps:!1}),a={url:e,method:n,type:n};t&&(a.data=n===nt.POST||n===nt.PUT?JSON.stringify(t):t),i.forceHttps&&(a.url=this.makeHttps(a.url)),i.traditional&&(a.traditional=i.traditional);const o=$.ajax(a);return m.keys(this.successMiddleware).length&&o.done(m.values(this.successMiddleware)),m.keys(this.errorMiddleware).length&&o.fail(m.values(this.errorMiddleware)),o}create(e,t,n){const{channel:r,successEvent:i,errorEvent:a}=n;this.base(e,t,nt.POST).done((e,t,n)=>r.trigger(i,e,t,n)).fail((e,t,n)=>r.trigger(a,e,t,n))}read(e,t){const{channel:n,successEvent:r,errorEvent:i}=t;this.base(e,null,nt.GET).done((e,t,i)=>{n.trigger(r,e,t,i)}).fail((e,t,r)=>{n.trigger(i,e,t,r)})}update(e,t,n){const{channel:r,successEvent:i,errorEvent:a}=n;this.base(e,t,nt.PUT).done((e,t,n)=>r.trigger(i,e,t,n)).fail((e,t,n)=>r.trigger(a,e,t,n))}delete(e,t){const{channel:n,successEvent:r,errorEvent:i}=t;this.base(e,null,nt.DELETE).done((e,t,i)=>n.trigger(r,e,t,i)).fail((e,t,r)=>n.trigger(i,e,t,r))}useMiddleware(e,t){this.successMiddleware[e]||(this.successMiddleware[e]=t)}useErrorMiddleware(e,t){this.errorMiddleware[e]||(this.errorMiddleware[e]=t)}parseError(e,t,n){const r=e.responseJSON,i=DE;switch(i.code=e.status,i.message=FE.parseErrorMessage(this.dataServiceErrorMessageMappings,this.defaultErrorMessageKey,r),e.status){case 400:i.type=_E.BadRequest;break;case 401:i.type=_E.Unauthorized;break;case 403:i.type=_E.Forbidden;break;case 404:i.type=_E.NotFound;break;case 500:i.type=_E.InternalServer}return i}}n.d(t,"Actions",(function(){return o})),n.d(t,"DataPrefixes",(function(){return s})),n.d(t,"FileExtensions",(function(){return c})),n.d(t,"Layouts",(function(){return l})),n.d(t,"AppChannels",(function(){return u})),n.d(t,"DataChannels",(function(){return p})),n.d(t,"DataServices",(function(){return f})),n.d(t,"CuratorLayoutView",(function(){return be})),n.d(t,"LayoutComponent",(function(){return Ie})),n.d(t,"CuratorAppNavService",(function(){return Ne})),n.d(t,"ImageUploadDataService",(function(){return He})),n.d(t,"LanguageDataService",(function(){return Xe})),n.d(t,"CompaniesApplication",(function(){return df})),n.d(t,"DomainOptionsApplication",(function(){return md})),n.d(t,"PeopleApplication",(function(){return Jd})),n.d(t,"PlaylistsApplication",(function(){return wb})),n.d(t,"SeriesApplication",(function(){return iS})),n.d(t,"SubjectDataService",(function(){return Fh})),n.d(t,"SubjectDataServiceHelper",(function(){return Uh})),n.d(t,"SubjectsApplication",(function(){return hS})),n.d(t,"ThemesApplication",(function(){return KS})),n.d(t,"VideosApplication",(function(){return PE})),n.d(t,"DomainOptionsApplication",(function(){return md})),n.d(t,"Core",(function(){return r})),n.d(t,"InstanceManager",(function(){return $d})),n.d(t,"FifoMemoryCache",(function(){return NE})),n.d(t,"AjaxDataProvider",(function(){return ME})),n.d(t,"AlertType",(function(){return uf})),n.d(t,"BaseAlertService",(function(){return hf})),n.d(t,"LanguageService",(function(){return Io})),n.d(t,"Flight",(function(){return i})),n.d(t,"CacheDurations",(function(){return Je}))}])}));