@clickview/library-editor 1.59.0-rc.0 → 1.59.0-rc.2

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.
@@ -1,2 +1,2 @@
1
- /*! For license information please see 9471-a6affa0a79.chunk.js.LICENSE.txt */
2
- (self.webpackChunk_clickview_library_editor=self.webpackChunk_clickview_library_editor||[]).push([[9471],{23689:function(e,t,n){"use strict";n.d(t,{i:function(){return d}});var r=n(32735),i=n(43823),o=n(52765),a=n(11306),c=n(21679),l=n(53808),s={fetch:function(e,t){var n=e.dataServiceName,r=e.eventPrefix,s=e.fetchData,u=e.setData,f=e.onError,d=e.deleteEventPrefix;if(l.q.isFunction(s)){if(l.q.isFunction(u)){var p=f&&l.q.isFunction(f),m=c.u.getInstance(n),h=i.Radio.channel(m.channelName),v="".concat(r,":request"),y="".concat(r,":sync"),g="".concat(r,":error"),b="".concat(r,":invalidate"),w=d&&"".concat(d,":sync"),E=function(){return t(!1)},S=function(){return t(!0)},k=function(){return t(!1)},x=function(){return h.off(b,k)};h.once(v,E),h.once(y,S),h.once(b,k),p&&h.once(g,f),w&&h.once(w,x);var O=s(m);return O&&(t(!0),e.setData(O)),function(){c.u.releaseInstance(n),h.off(v,E),h.off(y,S),h.off(b,k),p&&h.off(g,f),w&&h.off(w,x)}}o.Ry.throw(new a.H("A setData function must be passed to fetch"))}else o.Ry.throw(new a.H("A fetchData function must be passed to fetch"))}};function u(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.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)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t){var n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=(n=r.useState(!1),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,i)||u(n,i)||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.")}()),c=a[0],l=a[1];r.useEffect((function(){l(!1)}),function(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(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.")}()}(t)),r.useEffect((function(){if(o)return s.fetch(e,l)}),[c,o])}},42120:function(e,t,n){"use strict";n.d(t,{e:function(){return s}});var r=n(32735),i=n(53808),o=n(19442),a=n(21326),c=n(31709),l=n(1471);function s(e){var t=r.useMemo((function(){return e.actions.sort((function(e,t){return e.order-t.order}))}),[e.actions]),n=[],s=[];t.forEach((function(e){e.button?n.push(e):s.push(e)}));var u="d-flex";return e.className&&(u+=" ".concat(e.className)),n.length||s.length?r.createElement("div",{className:u},n.length?n.map((function(t,n){return r.createElement(r.Fragment,{key:n},function(){if(t.label){var n=i.q.isFunction(t.label)?t.label:function(){return r.createElement(r.Fragment,null,t.label)};return r.createElement(c.K,{appLink:t.appLink,href:t.href,onClick:t.onClick,svgName:t.svgName,svgSize:e.dropdownToggleSvgSize,className:t.className,tooltip:t.tooltip,showSpinner:t.showSpinner,analyticsData:t.analyticsData,analyticsOptions:t.analyticsOptions,openInNewTab:t.openInNewTab,disabled:t.disabled},n())}var l=r.createElement(o.h,{appLink:t.appLink,href:t.href,onClick:t.onClick,svgName:t.svgName,className:t.className,analyticsData:t.analyticsData,analyticsOptions:t.analyticsOptions,openInNewTab:t.openInNewTab,disabled:t.disabled,showBorder:t.showBorder,customSize:e.customSize,ariaLabel:t.tooltip});return t.tooltip?r.createElement(a.u,{title:t.tooltip,spanHack:!0},l):l}())})):r.createElement(r.Fragment,null),e.sortComponent&&e.sortComponent,s.length?r.createElement(l.m,{actions:s,dropdownToggleClassName:e.actionsDropdownClassName,dropdownToggleSvgSize:e.dropdownToggleSvgSize,fetchMore:e.fetchMore}):r.createElement(r.Fragment,null)):r.createElement(r.Fragment,null)}},1471:function(e,t,n){"use strict";n.d(t,{m:function(){return v}});var r=n(32735),i=n(53808),o=n(31647),a=n(97874),c=n(52076),l=n(77105),s=n(39396),u=n(21326),f=n(85475),d={dropdownToggle:"UCAnJ"};function p(){return r.createElement(r.Fragment,null,r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"8rem"}})),r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"12rem"}})),r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"11rem"}})),r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"9rem"}})))}function m(e){var t="dropdown-item";return e&&(t+=" ".concat(e)),t}function h(e){var t=i.q.isFunction(e.action.label)?e.action.label:function(){return r.createElement(r.Fragment,null,e.action.label)};if(e.action.appLink)return r.createElement(l.F,{appLink:e.action.appLink,onClick:e.action.onClick,className:m(e.action.className),analyticsData:e.action.analyticsData,analyticsOptions:e.action.analyticsOptions,openInNewTab:e.action.openInNewTab,disabled:e.action.disabled},e.action.svgName&&r.createElement(s.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2 align-middle"}),r.createElement("span",{className:"align-middle"},t()));function n(t){t.preventDefault(),e.action.analyticsData&&e.action.analyticsOptions&&c.k.logUserAction(e.action.analyticsData,e.action.analyticsOptions),i.q.isFunction(e.action.onClick)&&e.action.onClick(),e.action.href&&o.Q.Ab.PageLoad(e.action.href,e.action.openInNewTab)}return e.action.href?r.createElement("a",{className:m(e.action.className),onClick:n,href:e.action.href},e.action.svgName&&r.createElement(s.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2 align-middle"}),r.createElement("span",{className:"align-middle"},t())):r.createElement("span",{className:"cursor-pointer ".concat(m(e.action.className)),onClick:n,role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&n(e)}},e.action.svgName&&r.createElement(s.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2"}),t())}function v(e){if(!e.actions||!e.actions.length)return r.createElement(r.Fragment,null);var t=e.actions.some((function(e){return e.lazyPlaceholder})),n="dropdown";e.className&&(n+=" ".concat(e.className));var i,o="actions-dropdown-".concat(a.Y.getRandomInt()),c="dropdown-toggle px-0 ".concat(d.dropdownToggle);return e.dropdownToggleClassName&&(c+=" ".concat(e.dropdownToggleClassName)),r.createElement("div",{className:n},r.createElement("button",{className:c,type:"button",id:o,"data-bs-toggle":"dropdown","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false","aria-label":"More actions dropdown",onClick:t?e.fetchMore:null},r.createElement(s.x,{svgName:f.vn.More,size:e.dropdownToggleSvgSize})),r.createElement("ul",{className:"dropdown-menu dropdown-menu-end dropdown-menu-right font-size-normal","aria-labelledby":o},t?r.createElement(p,null):e.actions.map((function(e,t){var n=void 0!==i&&i!==e.group;return i=e.group,e.tooltip?r.createElement("li",{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(u.u,{title:e.tooltip,spanHack:!0},r.createElement(h,{action:e}))):r.createElement("li",{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(h,{action:e}))}))))}v.defaultProps={dropdownToggleClassName:"btn btn-light",dropdownToggleSvgSize:s.S.Small}},56535:function(e,t,n){"use strict";n.d(t,{u:function(){return f}});var r=n(32735),i=n(53808),o=n(31647),a=n(52076),c=n(77105),l=n(19442);function s(e){var t=e.className||"btn btn-dark";return e.disabled&&(t+=" disabled"),e.icon?r.createElement(l.h,{className:t,onClick:e.onClick,appLink:e.appLink,svgName:e.icon,href:e.href,openInNewTab:e.openInNewTab,disabled:e.disabled},e.text):!e.appLink||i.q.isFunction(e.onClick)||e.disabled?e.href&&!e.disabled?r.createElement("a",{className:t,href:e.href,target:e.openInNewTab?"_blank":null},e.text):r.createElement("button",{disabled:e.disabled,onClick:function(){e.disabled||(i.q.isFunction(e.onClick)&&e.onClick(),e.appLink&&o.Q.C$.trigger(e.appLink),a.k.logUserAction(e.analyticsData,e.analyticsOptions))},className:t},e.text):r.createElement(c.F,{appLink:e.appLink,className:t,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions},e.text)}function u(e){var t;return r.createElement("img",{alt:e.altText||"",role:"presentation",src:e.src,className:"".concat("NsLci"," ").concat("small"===e.size?"h3RrK":""," ").concat(null!==(t=e.className)&&void 0!==t?t:"")})}function f(e){var t;return r.createElement("div",{className:"text-center d-flex flex-column align-items-center ".concat(null!==(t=e.className)&&void 0!==t?t:"")},e.children)}u.defaultProps={size:"medium"},f.defaultProps={className:"pt-5"},f.Image=function(e){return r.createElement(u,Object.assign({},e))},f.Cta=function(e){return r.createElement(s,Object.assign({},e))},f.Heading=function(e){return r.createElement("h2",{role:"status",className:e.className||"h3"},e.children)},f.Info=function(e){return e.injectHtml?r.createElement("p",{role:"status",className:e.className||"mb-3 w-50",dangerouslySetInnerHTML:{__html:e.children}}):r.createElement("p",{role:"status",className:e.className||"mb-3 w-50"},e.children)}},90305:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var r=n(32735),i=n(85887),o=n(77105),a=n(29267),c="fVSzb";function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var s=r.memo((function(e){var t,n,i=e.forceLoad,o=e.extraClasses,s=void 0===o?"":o,u=e.errorFallbackImageSrc,f=e.preventLoad,d=void 0!==f&&f,p=e.errorFallbackImageClassName,m=e.src,h=e.alt,v=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}(e,["forceLoad","extraClasses","errorFallbackImageSrc","preventLoad","errorFallbackImageClassName","src","alt"]),y=(0,a.Y)({rootMargin:"500px"}),g=y.ref,b=y.inView,w=(t=r.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.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)?l(e,t):void 0}}(t,n)||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.")}()),E=w[0],S=w[1];function k(){return E&&u?u:e.src}if(r.useEffect((function(){if((i||b)&&!d){var e=new Image;return e.onerror=function(){S(!0),u&&(e.src=u)},e.src=m,function(){return e.onerror=null}}}),[b,d]),E&&!u)return r.createElement(r.Fragment,null);if(!g)return r.createElement("img",Object.assign({className:"".concat(c," ").concat(s," ").concat(E&&p||""),alt:h,src:k()},v));var x=Object.assign(Object.assign({alt:h},v),!b&&!i||d?{src:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="}:{src:k()});return i||(x.ref=g),r.createElement("img",Object.assign({className:"".concat(c," ").concat(s," ").concat(E&&p||"")},x))})),u=n(88483),f=n(87013),d={image:"vdd4V",thumbnail:"Ez0E7",tallPoster:"H9bQA",cover:"Nudts",banner:"IOvDH",poster:"iiY56",pdf:"aDJiJ",link:"wDpui"};function p(e){var t=d.image,n="";return e.imageType===u.__.Thumbnails&&(n="thumbnail ".concat(d.thumbnail)),e.imageType===u.__.TallPosters&&(n=d.tallPoster),e.imageType===u.__.Covers&&(n=d.cover),e.imageType===u.__.Banners&&(n=d.banner),e.imageType===u.__.Posters&&(n=d.poster),e.imageType===u.__.Pdf&&(n=d.pdf),e.imageType===u.__.Link&&(n=d.link),n&&(t+=" ".concat(n)),e.className&&(t+=" ".concat(e.className)),t}function m(e){var t=e.data,n=e.imageOptions,a=e.appLink,c=e.preload,l=e.preventLoad,u=e.analyticsOptions,d=e.analyticsData,m=e.imageClassName,h=e.alt,v="";"string"==typeof t?v=t:i.t.isObject(t)&&(v=t.url);var y=v&&n?f.j.createUrl(v,n):v;return r.createElement("div",{className:p(e),style:e.imageStyle},r.createElement(o.F,{appLink:a,analyticsData:d,analyticsOptions:u,onClick:e.onClick,preventFocus:e.preventFocus,className:e.appLinkClassName},e.children,y&&r.createElement(s,{src:y,alt:h,forceLoad:c,preventLoad:l,extraClasses:m,errorFallbackImageSrc:e.errorFallbackImageSrc,errorFallbackImageClassName:e.errorFallbackImageClassName,onLoad:e.onLoad})))}},71012:function(e,t,n){"use strict";n.d(t,{m:function(){return a}});var r=n(32735),i=n(77105),o={subText:"F_1ii",sm:"BxmrB"};function a(e){var t="text-uppercase text-truncate mb-0 ".concat(o.subText," ").concat(e.className);return e.appLink?r.createElement(i.F,{className:t,appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,title:e.title,ariaLabel:e.ariaLabel},e.children):r.createElement("div",{className:t,title:e.title,"aria-label":e.ariaLabel},e.children)}},17977:function(e,t,n){"use strict";n.d(t,{y:function(){return p}});var r=n(32735),i=n(57857),o=n(39396),a=n(50028),c=n(74421),l=n(85475),s={topLeftContainer:"iwBld",draft:"QBpxh",badge:"KcvGx",svg:"gW733",text:"QiH5Q",sm:"tn2BH"},u=i.T.encloseNamespace("shared.typeBadge");function f(e){switch(e){case c.E.Clip:return l.vn.Clip;case c.E.Interactive:return l.vn.Interactive;case c.E.Resource:return l.vn.Resources;default:return""}}function d(e,t){switch(e){case c.E.Clip:return"bg-ultramarine";case c.E.Interactive:return t===a.X.Draft?s.draft:"bg-green";case c.E.Resource:return"bg-indigo";default:return""}}function p(e){var t="".concat(s.badge," rounded-pill text-white ps-0 ").concat("sm"===e.size?s.sm:"");return r.createElement("div",{className:e.inContainer?"":s.topLeftContainer},r.createElement("div",{className:"".concat(t," ").concat(d(e.typeId,e.status))},r.createElement(o.x,{className:"svg-container d-block ".concat(s.svg),size:"sm"===e.size?o.S.Small:o.S.Standard,svgName:f(e.typeId)}),r.createElement("span",{className:s.text},function(e){switch(e){case c.E.Clip:return u("clip");case c.E.Interactive:return u("interactive");case c.E.Resource:return u("resource");default:return""}}(e.typeId))))}p.default={size:"md"}},47673:function(e,t,n){"use strict";n.d(t,{Q:function(){return m},$:function(){return g}});var r=n(32735),i=n(57857),o=n(63151),a=n(22218),c={padNumber:function(e,t){var n=e.toString();if(n.length>=t)return n;for(t-=n.length;t>0;)n="0"+n,t--;return n}},l=n(74421),s={isSeries:function(e){return(null==e?void 0:e.typeId)===l.E.Series},buildSeriesSeasonEpisodeText:function(e,t,n){if(!e)return"";if(!t||!n)return e.toUpperCase();var r=c.padNumber(t,2),i=c.padNumber(n,2);return"".concat(e.toUpperCase()," S").concat(r," • E").concat(i)}},u=n(11275),f=n(71012),d={appLink:"yI6tx",hoverUnderline:"ehDUT"},p=i.T.encloseNamespace("shared.videoSubText");function m(e){var t=e.video,n=t.season;if(!t.episodeNumber||!n)return r.createElement(r.Fragment,null);var i=c.padNumber(n.number,2),o=c.padNumber(t.episodeNumber,2);return r.createElement("span",{className:"d-inline-block ".concat(e.appLink?d.hoverUnderline:"")},e.withSeriesTitle&&r.createElement(r.Fragment,null," "),!!i&&"S".concat(i," • "),"E",o)}function h(e){var t=u.M.getReleaseDate(e.video);return t?u.M.hasSeries(e.video)?r.createElement(r.Fragment,null," • ".concat(t)):r.createElement(r.Fragment,null,t):r.createElement(r.Fragment,null)}function v(e){var t,n=e.appLink,i=e.video,c=e.className,l=void 0===c?"":c,v=null==i?void 0:i.series,y=u.M.getReleaseDate(e.video);if(!(null==v?void 0:v.id)&&!y)return r.createElement(r.Fragment,null);var g=(null==v?void 0:v.id)&&n&&Object.assign(Object.assign({},n),{args:[v.id,o.m.slugify(v.name)]}),b=Object.assign(Object.assign({},e.analyticsData),{id:null==v?void 0:v.id,name:null==v?void 0:v.name,videoId:null==i?void 0:i.id,videoName:null==i?void 0:i.name}),w=Object.assign(Object.assign({},e.analyticsOptions),{entity:a.py.Series,actionType:a.Vw.Click,descriptor:a._S.Title}),E=s.buildSeriesSeasonEpisodeText(null==v?void 0:v.name,null===(t=i.season)||void 0===t?void 0:t.number,i.episodeNumber);return r.createElement(f.m,{appLink:g,className:"d-block ".concat(d.appLink," ").concat(l),analyticsData:b,analyticsOptions:w,title:E,ariaLabel:"".concat(p("ariaSeries")," ").concat(E)},(null==v?void 0:v.name)&&v.name,r.createElement(m,Object.assign({},e,{withSeriesTitle:!0})),r.createElement(h,Object.assign({},e)))}function y(e){var t,n,i=e.appLink,c=e.video,l=e.className,s=void 0===l?"":l,u=null===(n=null===(t=null==c?void 0:c.productionCompanies)||void 0===t?void 0:t.data)||void 0===n?void 0:n[0];if(!(null==u?void 0:u.id))return r.createElement(r.Fragment,null);var m=(null==u?void 0:u.id)&&i&&Object.assign(Object.assign({},i),{args:[u.id,o.m.slugify(u.name)]}),h=Object.assign(Object.assign({},e.analyticsData),{id:null==u?void 0:u.id,name:null==u?void 0:u.name,videoId:null==c?void 0:c.id,videoName:null==c?void 0:c.name}),v=Object.assign(Object.assign({},e.analyticsOptions),{entity:a.py.Company,actionType:a.Vw.Click,descriptor:a._S.Title});return r.createElement(f.m,{appLink:m,className:"d-block ".concat(d.appLink," ").concat(s),analyticsData:h,analyticsOptions:v,title:u.name,ariaLabel:"".concat(p("ariaCompany")," ").concat(u.name)},u.name)}function g(e){var t=e.type,n=void 0===t?"series":t;return"none"===n?r.createElement(r.Fragment,null):"series"===n?r.createElement(v,Object.assign({},e)):r.createElement(y,Object.assign({},e))}},24828:function(e,t,n){"use strict";n.d(t,{o:function(){return r}});var r=["bg-pink","bg-orange"].concat(["bg-green","bg-cyan","bg-teal","bg-blue","bg-indigo","bg-purple"])},99828:function(e,t,n){"use strict";n.d(t,{y:function(){return a}});var r=n(88483);function i(e){return i="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},i(e)}function o(e,t,n){return(t=function(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=o(o(o(o(o(o(o(o(o({},r.__.Thumbnails,{width:1280,height:720}),r.__.Banners,{width:1200,height:222}),r.__.Covers,{width:512,height:512}),r.__.Posters,{width:1e3,height:1500}),r.__.TallPosters,{width:1080,height:1920}),r.__.HeroBanners,{width:1920,height:640}),r.__.None,{width:1,height:1}),r.__.Avatars,{width:256,height:256}),r.__.Logos,{width:128,height:128})},8371:function(e,t,n){"use strict";var r;n.d(t,{b:function(){return r}}),function(e){e.AU="cv-ap-southeast-1",e.NZ="cv-ap-southeast-2",e.UK="cv-eu-west-1",e.US="cv-na-west-1"}(r||(r={}))},82378:function(e,t,n){"use strict";n.d(t,{i:function(){return o}});var r=n(32735),i=n(94223);function o(e,t){var n=e,o=t,a=(0,i.P)(e&&function(e){return n(e).key});return(0,r.useEffect)((function(){a&&a.shouldInitialFetch&&t&&o()}),[null==a?void 0:a.shouldInitialFetch,t]),(0,r.useEffect)((function(){a&&a.nextCursor&&!a.isFetching&&t&&o(a.nextCursor)}),[null==a?void 0:a.nextCursor,null==a?void 0:a.isFetching,t]),a}},32557:function(e,t,n){"use strict";n.d(t,{X:function(){return h},L:function(){return v}});var r=n(32735),i=n(53808),o=n(85887),a=function(){var e=r.useRef(!0);return r.useEffect((function(){return function(){e.current=!1}}),[]),e};function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.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)?l(e,t):void 0}}(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 l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var s=275,u=5,f={className:"",delay:0,style:null},d={screenX:0,screenY:0};function p(e,t){var n;e.current&&(t.className&&(null===(n=e.current.classList)||void 0===n||n.add(t.className)),t.style&&Object.keys(t.style).forEach((function(n){e.current.style[n]=t.style[n]})))}function m(e,t){var n;e.current&&(t.className&&(null===(n=e.current.classList)||void 0===n||n.remove(t.className)),t.style&&Object.keys(t.style).forEach((function(t){e.current.style[t]=null})))}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,t=a(),n=c(r.useState(e),2),l=n[0],s=n[1],u=c(r.useState(!1),2),d=u[0],h=u[1],v=r.useRef(null);r.useEffect((function(){o.t.isEqual(e,l)||s(e)}),[e]);var y=i.q.throttle((function(){p(v,l),t.current&&h(!0)}),l.delay,{leading:!1}),g=function(){i.q.isFunction(y.cancel)&&y.cancel(),m(v,l),t.current&&h(!1)};return r.useLayoutEffect((function(){var e=v.current;if(e)return e.addEventListener("mouseenter",y),e.addEventListener("mouseleave",g),function(){e.removeEventListener("mouseenter",y),e.removeEventListener("mouseleave",g)}}),[v.current,l]),[v,d]}function v(e){var t=c(r.useState(e),2),n=t[0],a=t[1],l=r.useRef(Object.assign({},d)),f=r.useRef(!1),h=r.useRef(0),v=r.useRef(null),y=c(r.useState(!1),2),g=y[0],b=y[1];function w(){h.current&&(window.clearTimeout(h.current),h.current=0)}function E(){f.current=!0}function S(e){if(f.current){var t,r,i=Object.assign({},l.current);l.current.screenX=e.screenX,l.current.screenY=e.screenY,function(e,t){return Math.abs(e.screenX-t.screenX)>u||Math.abs(e.screenY-t.screenY)>u}(i,e)&&w(),t=function(){p(v,n),b(!0)},r=n.delay||s,h.current||(h.current=window.setTimeout(t,r))}}function k(){w(),m(v,n),f.current=!1,b(!1)}return r.useEffect((function(){o.t.isEqual(e,n)||a(e)}),[e]),r.useLayoutEffect((function(){if(v.current){var e=i.q.throttle(S,25,{leading:!1});return v.current.addEventListener("mouseenter",E),v.current.addEventListener("mousemove",e),v.current.addEventListener("mouseleave",k),function(){v.current&&(v.current.removeEventListener("mouseenter",E),v.current.removeEventListener("mousemove",e),v.current.removeEventListener("mouseleave",k))}}}),[v.current,n]),[v,g]}},29267:function(e,t,n){"use strict";n.d(t,{Y:function(){return o}});var r=n(34152);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function o(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n.prevent,a=n.rootMargin,c=n.triggerOnce,l=void 0===c||c,s=(e=(0,r.YD)({triggerOnce:l,rootMargin:a}),t=3,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.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)?i(e,t):void 0}}(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.")}()),u=s[0],f=s[1],d=s[2];return!0!==o&&void 0!==window.IntersectionObserver||(f=!0,u=null),{ref:u,inView:f,initialized:!!d}}},94223:function(e,t,n){"use strict";n.d(t,{P:function(){return u}});var r=n(32735),i=n(70680),o=n(35656),a=n(53808),c=n(86120);function l(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.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)?s(e,t):void 0}}(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 s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n){function o(e){if(e)return a.q.isFunction(t)?l(t(e)):l(e.data)}function s(e){var t,r;if(e)return n?n(e):null===(r=null===(t=e.pagination)||void 0===t?void 0:t.cursors)||void 0===r?void 0:r.next}return(0,i.v9)((0,r.useMemo)((function(){return function(t){if(a.q.isFunction(e)){for(var n=e,r=a.q.isFunction(e)&&n(),i=r&&c.a.getResponse(t,r),u=i&&i.isFetching,f=i&&i.statusCode,d=i&&i.hasCompleted,p=d,m=i&&i.shouldFetch,h=o(i&&i.data),v=s(i&&i.data),y=function(e){if(e)return null==e?void 0:e.count}(i&&i.data);v&&(i=c.a.getResponse(t,n(v)),u=u||i.isFetching,f=i.statusCode,d=i.hasCompleted,!i.shouldFetch);){var g=o(i.data);g&&h.push.apply(h,l(g));var b=s(i.data);v=b===v?null:b}var w={shouldInitialFetch:m,items:h,nextCursor:v,isFetching:u,statusCode:f,hasCompleted:d,hasFirstPageCompleted:p};return"number"==typeof y&&(w.totalItems=y),w}}}),[e]))}o.o.Ok},51547:function(e,t,n){"use strict";n.r(t),n.d(t,{CropperHelper:function(){return v}});var r=n(32735),i=n(44645),o=n(51934),a=n.n(o),c=n(57857),l=n(4231),s=n(83996),u=n(99828);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.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)?d(e,t):void 0}}(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 d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var p=c.T.encloseNamespace("shared.imageCropper"),m=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function h(e){var t=f(r.useState(!1),2),n=t[0],i=t[1],o=f(r.useState(!1),2),c=o[0],d=o[1],h=r.useRef(null),v=r.useRef(null);return r.useEffect((function(){var t=new Image;t.src=e.src;var n=h.current.offsetWidth/t.width,r=u.y[e.imageType],o={viewMode:2,autoCropArea:1,ready:function(){return i(!0)}};return r&&(o.minCropBoxWidth=r.width*n,o.minCropBoxHeight=r.height*n,o.aspectRatio=r.width/r.height),v.current=new(a())(h.current,o),function(){v.current.destroy()}}),[]),r.createElement(l.G,{title:p("title"),closePopup:e.closePopup,size:e.popupSize},r.createElement("div",null,r.createElement("img",{src:e.src,alt:e.alt,ref:h,className:"img img-fluid"})),r.createElement(s.u,null,r.createElement(s.u.Cancel,{onClick:e.closePopup}),r.createElement(s.u.Submit,{onClick:function(){if(n){var t=v.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(m);if(t)return t[1]}(e.src));d(!0),e.onClickCrop(t,e.closePopup)}},text:p("crop"),variant:"dark",showSpinner:c})))}h.defaultProps={popupSize:"lg"};var v={renderCropper:function(e){var t=(0,i.s)(document.getElementById("dialog-region"));t.render(r.createElement(h,Object.assign({},e,{closePopup:function(){return t.unmount()}})))}}},22231:function(e,t,n){"use strict";function r(e,t){return t[e.charCodeAt(0)%t.length]}n.d(t,{x:function(){return r}})},38611:function(e,t,n){"use strict";n.d(t,{x:function(){return hu}});var r=n(32735),i=n(66703),o=n(8371),a=n(11275);n(30582),n(85887);var c=r.createContext({setPageMetadata:function(e){return e},revertPageMetadata:function(){},hasPageMetadataChanged:function(){return!1},hasProvider:!1}),l=n(53808);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e){var t,n,i=e.view,o=e.options,a=void 0===o?{}:o,u=e.className,f=void 0===u?"":u,d=e.dependencies,p=void 0===d?[]:d,m=r.useMemo((function(){return new i(a)}),p);t=m.title,n=r.useContext(c),r.useEffect((function(){"boolean"!=typeof t&&n.setPageMetadata({title:t})}),[t]);var h=function(e,t){var n,i=r.useRef(null);return r.useEffect((function(){if(e){var t=i.current;return e.render(),t.hasChildNodes()?t.replaceChild(e.el,t.firstChild):t.appendChild(e.el),e.triggerMethod&&e.triggerMethod("attach"),e.trigger("rendered"),function(){l.q.isFunction(e.close)?e.close():l.q.isFunction(e.destroy)&&e.destroy()}}}),function(e){if(Array.isArray(e))return s(e)}(n=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.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)?s(e,t):void 0}}(n)||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.")}()),i}(m,[m]);return i?r.createElement("div",{ref:h,className:f}):r.createElement(r.Fragment,null)}var f=n(70065),d=n(61356),p=n(85847);function m(e){var t,n=e.config.get("webPlayerUrl"),i=e.config.get("playerApiUrl");return r.createElement("div",{className:"col-12 mb-3 p-0"},r.createElement(u,{view:d.c,options:{model:new p.n(e.video,{parse:!0}),analyticsOptions:{location:f.LZ.VideoRequest},currentUser:e.user,createViewKey:e.createViewKey,webPlayerUrl:n,playerApiUrl:i},dependencies:[null===(t=e.video)||void 0===t?void 0:t.id]}))}var h=n(27866),v="libraryRequests.videoDetail";function y(e){return r.createElement(r.Fragment,null,r.createElement("div",{className:"col-3"},r.createElement("label",null,r.createElement(i.x,{namespace:v,phrase:e.phrase}))),r.createElement("div",{className:"col-9 mb-3"},e.children))}function g(e){var t,n=e.clip,i=n.endTime-n.startTime;function o(e){return h.T.ToDisplayDuration(Math.floor(e))}function a(){var e;return i/((null===(e=n._parentVideo)||void 0===e?void 0:e.duration)/1e3)*100+"%"}return r.createElement(r.Fragment,null,r.createElement("p",null,h.T.ToDisplayDurationNewStyle(1e3*Math.floor(i))),r.createElement("div",{className:"overflow-hidden rounded-3 border p-3"},r.createElement("div",{className:"position-relative z-1"},r.createElement("div",{className:"position-absolute w-100"},r.createElement("span",null," "),r.createElement("div",{className:"bg-light rounded-3",style:{height:10}}))),r.createElement("div",{className:"position-relative z-1",style:{left:function(){var e;return n.startTime/((null===(e=n._parentVideo)||void 0===e?void 0:e.duration)/1e3)*100+"%"}()}},r.createElement("div",{className:"d-flex justify-content-between",style:{width:a()}},r.createElement("span",null,o(1e3*n.startTime)),r.createElement("span",{className:"text-secondary"}," - "),r.createElement("span",null,o(1e3*n.endTime))),r.createElement("div",{className:"bg-blue rounded-3 px-1",style:{width:a(),height:10}})),r.createElement("div",{className:"d-flex justify-content-between text-secondary"},r.createElement("span",null,"0:00"),r.createElement("span",null,o(null===(t=n._parentVideo)||void 0===t?void 0:t.duration)))))}function b(e){var t=e.libraryRequest.object;return r.createElement("div",{className:"row"},((null==t?void 0:t.name)||e.libraryRequest.name)&&r.createElement(y,{phrase:"title"},(null==t?void 0:t.name)||e.libraryRequest.name),t.description&&r.createElement(y,{phrase:"description"},r.createElement("span",{className:"pre-wrap"},t.description)),r.createElement(y,{phrase:"duration"},r.createElement(g,{clip:t})))}var w,E=n(42648),S=n(58424),k=n(39396);!function(e){e[e.Correct=0]="Correct",e[e.Incorrect=1]="Incorrect",e[e.AwaitingMarking=2]="AwaitingMarking",e[e.Answered=3]="Answered",e[e.UnAnswered=4]="UnAnswered",e[e.NotApplicable=5]="NotApplicable"}(w||(w={}));var x=n(71551),O=n(85475),C=n(77105),N=n(58542);function j(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e&&t.length?t.reduce((function(e,t){return function(e,t,n){return e.replace(new RegExp("<".concat(t,".*?>"),"gi"),"").replace(new RegExp("</".concat(t,">"),"gi"),n?"<br>":"")}(e,t,n)}),e):e}function P(e){var t,n;if(e)return e=j(e,["ul","ol","b","i","u","old","em","strong","sup","sub","a","span"]),(null===(n=null===(t=(e=j(e,["li","p","div"],!0)).split("<br>"))||void 0===t?void 0:t.filter((function(e){return!!e}))[0])||void 0===n?void 0:n.trim())||"Annotation"}function I(e){var t=N.w.getTypeInfo(e.interaction.typeId),n=t.name,i=t.bgClassName,o=t.Svg,a=e.questionNumber?"".concat(e.questionNumber,". "):"",c="interaction-type-icon flex-shrink-0 ".concat(i);return e.smallIcon&&(c+=" sm"),(e.showQuestion||e.showTypeName)&&(c+=e.smallIcon?" me-1":" me-2"),e.iconClassName&&(c+=" ".concat(e.iconClassName)),r.createElement("span",{className:e.containerClassName},!!e.showIcon&&r.createElement("span",{className:c},r.createElement(o,null)),r.createElement(C.F,{appLink:e.appLink,onClick:e.onClick},!!e.showTypeName&&r.createElement("span",{className:e.typeNameClassName},r.createElement("strong",null,a,n)),!!e.showQuestion&&r.createElement("span",{className:e.questionClassName},e.interaction.typeId===x.Z9.Annotation?r.createElement("span",{dangerouslySetInnerHTML:{__html:P(e.interaction.data.annotation)}}):e.interaction.name)))}I.defaultProps={showIcon:!0,showQuestion:!0};var L={timeTag:"ShZvf",hide:"FHzDr",time:"JDp5N",type:"AzIWg",question:"UhEYq",deleteContainer:"wBqoo",delete:"OAQQu",correctness:"W5sR9",selected:"tfrDf",row:"sGk59"},T="shared.interactiveQuestions";function _(e){var t=e.interaction;switch((0,e.getCorrectness)(t)){case w.Correct:return r.createElement("span",{className:"text-success"},r.createElement(k.x,{size:k.S.Medium,svgName:O.vn.Check}));case w.Incorrect:return r.createElement("span",{className:"text-danger"},r.createElement(k.x,{size:k.S.Medium,svgName:O.vn.Close}));case w.AwaitingMarking:return r.createElement("span",{className:"text-secondary italic"},r.createElement("i",null,r.createElement(i.x,{namespace:T,phrase:"pending"})));case w.UnAnswered:return r.createElement("button",{className:"btn btn-outline-dark"},r.createElement(i.x,{namespace:T,phrase:"answer"}));case w.Answered:return r.createElement("span",{className:"text-secondary italic"},r.createElement("i",null,r.createElement(i.x,{namespace:T,phrase:"answered"})));case w.NotApplicable:return r.createElement(r.Fragment,null)}}function A(e){var t=e.interaction,n=e.visibleAt,i=e.selectedInteractionId,o=e.goToTimepoint,a=e.scrollTo,c=e.isFirstInteraction,l=t.id.toString()===(null==i?void 0:i.toString()),s=r.useRef(null);r.useEffect((function(){if(l&&s.current){var e=s.current,t=e.getBoundingClientRect(),n=t.top-e.offsetParent.getBoundingClientRect().top;a(n,t.height)}}),[l]);var u=o?"cursor-pointer":"cursor-default";return r.createElement("div",{ref:s},r.createElement(S.L,{className:"py-2 ".concat(u," ").concat(L.row," ").concat(l?L.selected:""),onClick:l?function(){}:function(){o&&o(t.id)}},r.createElement("div",{className:"me-3 d-inline-flex rounded-pill justify-content-center align-items-center text-info fw-semibold bg-light-blue ".concat(L.timeTag," ").concat(c?"":L.hide)},c?h.T.ToDisplayDuration(n):""),r.createElement(I,{interaction:t,showTypeName:!0,typeNameClassName:L.type,questionClassName:L.question}),e.onClickDelete&&r.createElement(S.L,{onClick:function(n){n.stopPropagation(),e.onClickDelete(t.id)},className:"".concat(L.deleteContainer)},r.createElement("span",{className:"text-end ".concat(L.delete)},r.createElement(k.x,{size:k.S.Medium,svgName:O.vn.Delete}))),e.getCorrectness&&r.createElement("span",{className:"text-end ".concat(L.correctness)},r.createElement(_,{interaction:t,getCorrectness:e.getCorrectness}))))}function F(e){var t=e.timepoint,n=e.scrollTo,i=e.onClickDelete,o=e.selectedInteractionId,a=e.getCorrectness;function c(n){e.goToTimepoint(t.id,n,t.visibleAt)}return t.interactions?r.createElement(r.Fragment,null,t.interactions.map((function(l,s){return!e.experimentalInteractiveQuestions&&x.IL[l.typeId]?r.createElement(r.Fragment,{key:s}):r.createElement(A,{interaction:l,visibleAt:t.visibleAt,goToTimepoint:e.goToTimepoint&&c,onClickDelete:i,scrollTo:n,selectedInteractionId:o,isFirstInteraction:0===s,getCorrectness:a,key:s})}))):r.createElement(r.Fragment,null)}function D(e){var t=e.interactive,n=e.goToTimepoint,i=e.selectedInteractionId,o=e.maxHeight,a=e.onClickDelete,c=e.getCorrectness,l=r.useRef(null);function s(e,t){if(l.current){var n=l.current.getClientHeight(),r=l.current.getScrollTop(),i=e+r;(i<r||i+t>r+n)&&l.current.scrollTop(i-n/2+t/2)}}var u=n?"border rounded":"";return r.createElement(E.$B,{autoHeight:!0,autoHeightMax:o,className:u,hideTracksWhenNotNeeded:!0,ref:l},r.createElement("div",{className:"px-3 py-2"},t.timepoints.map((function(t,o){return r.createElement(F,{key:o,timepoint:t,goToTimepoint:n,selectedInteractionId:i,scrollTo:s,onClickDelete:a,getCorrectness:c,experimentalInteractiveQuestions:e.experimentalInteractiveQuestions})}))))}var R,M="libraryRequests.interactiveDetails";function U(e){var t=e.interactive;return r.createElement(r.Fragment,null,r.createElement("p",{className:"fw-semibold mb-2"},r.createElement(i.x,{namespace:M,phrase:"questionList",options:{length:t._timepoints.value.length}})),t._timepoints.value.map((function(e,t){return r.createElement(F,{key:t,timepoint:e})})))}function V(e){var t=e.libraryRequest.object;return r.createElement("div",{className:"row"},((null==t?void 0:t.name)||e.libraryRequest.name)&&r.createElement(y,{phrase:"title"},(null==t?void 0:t.name)||e.libraryRequest.name),!!t.description&&r.createElement(y,{phrase:"description"},r.createElement("span",{className:"pre-wrap"},t.description)),r.createElement(U,{interactive:t}))}!function(e){e[e.View=0]="View",e[e.Create=1]="Create"}(R||(R={}));var B=n(31647);function q(e){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(e)}function G(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,Z(r.key),r)}}function Z(e){var t=function(e){if("object"!=q(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==q(t)?t:t+""}function z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(z=function(){return!!e})()}function H(e){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},H(e)}function W(e,t){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},W(e,t)}var Q=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t,n){return t=H(t),function(e,t){if(t&&("object"==q(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,z()?Reflect.construct(t,n||[],H(e).constructor):t.apply(e,n))}(this,t,["Could not connect to submit interactive results"])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&W(e,t)}(t,e),n=t,(r=[{key:"name",get:function(){return"InternetConnectivityError"}},{key:"dialogOptions",get:function(){return{title:"Connection issues",text:"There seems to be an issue with your internet connection. Refresh the page to try again. ",buttons:[{text:"Refresh",className:"btn btn-dark",success:!0}]}}},{key:"onDone",value:function(){window.location.reload()}}])&&G(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(n(85835).S),Y=n(61380);function K(e){return K="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},K(e)}function $(){$=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==K(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(K(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function X(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,J(r.key),r)}}function J(e){var t=function(e){if("object"!=K(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=K(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==K(t)?t:t+""}var ee=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},te=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=t,this.save=this.save.bind(this)},(t=[{key:"start",value:function(e){e&&(this.resultId=e),this.startSession()}},{key:"startSession",value:function(){return ee(this,void 0,void 0,$().mark((function e(){var t,n,r,i,o,a,c,l,s,u,f;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.resultId){e.next=2;break}return e.abrupt("return");case 2:return t=this.options,n=t.interactiveId,r=t.metadataId,i=t.userId,o=t.customerId,a=t.shareId,c=t.playerApi,l=t.publicName,s=t.profileId,u={interactiveId:n,metadataId:r,userId:i,customerId:o,shareId:a,publicName:l,profileId:s,anonymous:!i},e.prev=4,e.next=7,Y.e.post(c+"interactive/start-session",JSON.stringify(u));case 7:f=e.sent,this.resultId=f.resultId,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),B.Q.Ry.throw(new Q);case 14:case"end":return e.stop()}}),e,this,[[4,11]])})))}},{key:"save",value:function(e,t){return ee(this,void 0,void 0,$().mark((function n(){var r;return $().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.resultId){n.next=3;break}return n.next=3,this.startSession();case 3:return r={resultId:this.resultId,interactionId:e,results:t},n.prev=4,n.next=7,Y.e.post(this.options.playerApi+"interactive/save-actions",JSON.stringify(r),void 0,!1);case 7:n.next=13;break;case 9:n.prev=9,n.t0=n.catch(4),console.log(n.t0),B.Q.Ry.throw(new Q);case 13:case"end":return n.stop()}}),n,this,[[4,9]])})))}}])&&X(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),ne=n(11306),re=n(61415),ie=(n(96263),n(56775),n(76032));function oe(e){return oe="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},oe(e)}function ae(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,ce(r.key),r)}}function ce(e){var t=function(e){if("object"!=oe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==oe(t)?t:t+""}function le(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(le=function(){return!!e})()}function se(e,t,n,r){var i=ue(fe(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function ue(){return ue="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=fe(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},ue.apply(null,arguments)}function fe(e){return fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},fe(e)}function de(e,t){return de=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},de(e,t)}var pe=function(e){function t(e,n){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=fe(t),function(e,t){if(t&&("object"==oe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,le()?Reflect.construct(t,n||[],fe(e).constructor):t.apply(e,n))}(this,t,[e,n])).timepoint_=n.timepoint,r.time_=n.timepoint.visibleAt/1e3;var i=n.timepoint.interactions[0];i||r.hide();var o=N.w.getTypeInfo(i.typeId).bgClassName;return r.$(".vjs-icon-placeholder").classList.add(o),r.controlText(i.name),r.update(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&de(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-item ".concat(se(t,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(e,n,r){return se(t,"createEl",this,3)([e,Object.assign(Object.assign({},n),{className:this.buildCSSClass()}),Object.assign(Object.assign({},r),{tabindex:0})])}},{key:"update",value:function(){var e=this.player_.duration(),t=this.time_/e;this.el().style.left=100*t+"%",t>100||t<0?this.hide():this.show()}},{key:"handleClick",value:function(e){e.stopPropagation(),this.player_.currentTime(this.time_)}}],r&&ae(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("Button"));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},me(e)}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}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,ye(r.key),r)}}function ye(e){var t=function(e){if("object"!=me(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=me(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==me(t)?t:t+""}function ge(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ge=function(){return!!e})()}function be(e,t,n,r){var i=we(Ee(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function we(){return we="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ee(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},we.apply(null,arguments)}function Ee(e){return Ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ee(e)}function Se(e,t){return Se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Se(e,t)}var ke=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=Ee(t),function(e,t){if(t&&("object"==me(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ge()?Reflect.construct(t,n||[],Ee(e).constructor):t.apply(e,n))}(this,t,[e,n])).track_=n.track,r.interactive_=n.interactive,r.onDurationChange=r.onDurationChange.bind(r),r.createInteractionItems=r.createInteractionItems.bind(r),r.createInteractionItems(),r.track_.on("cv:cuechange",r.createInteractionItems),r.player_.on("durationchange",r.onDurationChange),r.player_.on("dispose",(function(){r.track_.off("cv:cuechange"),r.player_.off("durationchange",r.onDurationChange)})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Se(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-items ".concat(be(t,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(e,n,r){return be(t,"createEl",this,3)([e,Object.assign(Object.assign({},n),{className:this.buildCSSClass()}),r])}},{key:"update",value:function(){this.children_.forEach((function(e){e.update()}))}},{key:"createInteractionItems",value:function(){var e,t=this;if(this.track_){(function(e){return function(e){if(Array.isArray(e))return he(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return he(e,t);var n={}.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}}(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.")}()})(this.children_).forEach((function(e){t.removeChild(e)}));for(var n=0;n<this.track_.cues.length;n++){var r=this.track_.cues[n],i=this.getTimepointById(r.text);i&&(null===(e=i.interactions)||void 0===e?void 0:e.length)&&this.addChild(new pe(this.player_,{timepoint:i}))}}}},{key:"onDurationChange",value:function(){this.update()}},{key:"getTimepointById",value:function(e){var t;return null===(t=this.interactive_.timepoints)||void 0===t?void 0:t.find((function(t){return t.id.toString()===e.toString()}))}}],r&&ve(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("Component")),xe=n(94878);function Oe(e){var t=e.className,n=e.svgName,i=e.children,o=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}(e,["className","svgName","children"]),a="".concat(t," ").concat("Mr0S0");a+=" ".concat(i?"vHTVo":"vIGn0");var c=r.createElement(k.x,{svgName:n,className:"cDUaE"});return r.createElement(S.L,Object.assign({className:a},o),c,i)}function Ce(e){var t=e.isCreate,n=e.open,i=e.showTypeSelector;return!t||n?r.createElement(r.Fragment,null):r.createElement(Oe,{className:"btn btn-outline-dark cv-add-question",onClick:i,svgName:O.vn.Plus},"Add question")}var Ne,je=n(80247),Pe=n(17082),Ie=n(19442),Le=n(90305),Te=n(88483),_e=n(77037);function Ae(e){return Ae="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},Ae(e)}function Fe(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ae(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ae(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function De(){return w.NotApplicable}function Re(e,t){var n=e.actionableItems.filter((function(e){return e.isCorrect}));return n.every((function(e){return!t(e.id)}))?w.UnAnswered:n.every((function(e){var n;return e.name.trim().toLowerCase()===(null===(n=t(e.id))||void 0===n?void 0:n.trim().toLowerCase())}))?w.Correct:w.Incorrect}function Me(e,t){return e.actionableItems.every((function(e){return!t(e.id)}))?w.UnAnswered:e.actionableItems.filter((function(e){return e.isCorrect})).every((function(e){var n,r=t(e.id);return(null==r?void 0:r.toString())===(null===(n=e.id)||void 0===n?void 0:n.toString())||r===e.name}))?w.Correct:w.Incorrect}function Ue(e,t){return function(n){var r=t.attempts.find((function(t){return t.id===e.id}));return null==r?void 0:r.answers.find((function(e){return e.id===n}))}}function Ve(e,t){var n=Ue(e,t);return Me(e,(function(e){var t=n(e);return null==t?void 0:t.text}))}function Be(e,t){return function(e,t){var n;return e.actionableItems.forEach((function(e){var r=t(e.id);n=r?r.status!==Ne.Correct?r.status!==Ne.Incorrect?w.AwaitingMarking:w.Incorrect:w.Correct:w.UnAnswered})),n}(e,Ue(e,t))}!function(e){e[e.Incorrect=0]="Incorrect",e[e.Correct=1]="Correct",e[e.PendingReview=2]="PendingReview"}(Ne||(Ne={}));var qe=Fe(Fe(Fe(Fe(Fe(Fe(Fe({},x.Z9.Annotation,De),x.Z9.Image,De),x.Z9.MissingWord,(function(e,t){var n=Ue(e,t);return Re(e,(function(e){var t=n(e);return null==t?void 0:t.text}))})),x.Z9.MultipleChoice,Ve),x.Z9.ShortAnswer,Be),x.Z9.TrueOrFalse,Ve),x.Z9.Illustration,Be),Ge={notApplicable:De,awaitingMarking:function(){return w.AwaitingMarking},isMissingWordCorrect:Re,isMultipleChoiceCorrect:Me,isInteractionCorrect:function(e,t){return(0,qe[e.typeId])(e,t)}},Ze=n(40221);function ze(e){return Ze.m.last(e.results)}function He(e,t){return Ze.m.findWhere(null==t?void 0:t.attempts,{id:e})}var We=n(76044),Qe=n(57857),Ye=Qe.T.encloseNamespace("interactives.responseTypes");function Ke(){return r.createElement("p",{className:"p-2"},r.createElement("em",null,Ye("noResponse")))}var $e="cv-missing-word-",Xe=n(4234),Je="KpbWq";function et(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var tt=["A","B","C","D"];function nt(e){var t,n,i=(t=r.useState(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return et(e,t);var n={}.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)?et(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1],c=!!e.interaction.actionableItems.find((function(e){var t;return!!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)})),l=r.useRef(null),s="sm"===e.size||c&&e.interaction.actionableItems.length>2;return r.createElement("ul",{className:"".concat(c?"row ".concat(s&&!e.isDisplayOnly?"px-lg-5 p-0":""):""," list-unstyled")},e.interaction.actionableItems.map((function(t,n){var i,u,f=null===(i=e.getSelectedAnswer)||void 0===i?void 0:i.call(e,t.id),d=null===(u=t.data)||void 0===u?void 0:u.imageUrl,p=!!t.name;function m(){e.submitted||(e.onSelectAnswer&&e.onSelectAnswer(t,!f),a(f?null:t.id))}if(e.onlyShowSelectedAnswer&&!f)return r.createElement(r.Fragment,{key:n});var h=f?"bg-blue text-white":e.unCheckedBackground,v=function(){return r.createElement(r.Fragment,null,tt[n])};e.showFeedback&&(e.showCorrectnessIcons||(h=t.isCorrect?"bg-success text-white":"bg-danger text-white ".concat("yodaE")),e.hideFeedbackIcons||(v=function(){return r.createElement(r.Fragment,null,t.isCorrect?r.createElement(k.x,{size:k.S.Small,svgName:O.vn.Check}):r.createElement(k.x,{size:k.S.Small,svgName:O.vn.Close}))}));var y=e.showFeedback?{}:{role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&m()}},g="";c&&(g="col-6");var b=t.id.toString()===(null==o?void 0:o.toString())&&e.leftHandSidePortalNode&&d&&!e.submitted;return r.createElement(r.Fragment,{key:n},b&&r.createElement(Pe.Nq,{node:e.leftHandSidePortalNode},r.createElement(Xe.Z,{className:"h-100",ref:l},r.createElement("div",{className:"p-3 d-flex flex-column h-100"},r.createElement("div",{className:"flex-grow-1"},r.createElement("div",{className:"cv-image-container text-center"},r.createElement("img",{className:"img-fluid rounded",src:d,alt:t.name||tt[n]})),r.createElement("div",{className:"".concat(Je," h6 text-center text-dark p-3")},r.createElement("span",{className:"d-inline-block ".concat(p?"me-3":""," cv-multiple-choice-bullet")},r.createElement(v,null)),p&&r.createElement("span",{className:"flex-grow-1 pe-4"},t.name))),r.createElement("div",{className:"text-end"},r.createElement(S.L,{className:"btn btn-link",onClick:function(){return a(null)}},"Close"))))),r.createElement("li",{className:"".concat(g," mb-3")},r.createElement("label",Object.assign({className:"\n d-block\n rounded-3\n shadow-sm\n position-relative\n ".concat(e.showFeedback?"":"cursor-pointer","\n ").concat(Je,"\n ").concat(h,"\n ").concat(c?"mb-0 h-100":"","\n "),key:n,onClick:m},y),c&&r.createElement("div",null,e.showCorrectnessIcons&&r.createElement("div",{className:"".concat("xnG9h"," position-absolute top-0 start-0 p-2 z-1")},t.isCorrect?r.createElement(k.x,{svgName:O.vn.CheckCircle,size:k.S.ExtraLarge,className:"svg-container text-success"}):r.createElement(k.x,{svgName:O.vn.CrossCircleFilled,size:k.S.Large,className:"svg-container text-red"})),r.createElement("span",{className:"d-block position-relative ".concat("TeByp")},r.createElement("span",{className:"\n ".concat("zWcu2","\n position-absolute\n start-0\n end-0\n top-0\n bottom-0\n rounded-top\n "),style:{backgroundImage:d?"url(".concat(d,")"):void 0},title:t.name||tt[n]}))),r.createElement("span",{className:"d-flex ".concat(p||e.isDisplayOnly?"justify-content-between":"justify-content-center"," ").concat(s?"p-2":"p-3")},r.createElement("span",{className:"d-inline-block ".concat(p?"me-3":""," cv-multiple-choice-bullet")},r.createElement(v,null)),p&&r.createElement("span",{className:"flex-grow-1 pe-4"},t.name),e.userAvatar&&!e.onlyShowSelectedAnswer&&r.createElement("span",{className:"".concat("uKRg2"," ").concat(c?"_LpCq":"")},f&&r.createElement(_e.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white"}))))))})))}nt.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var rt="Y7ls8";function it(e){function t(t){e.onSelectAnswer&&e.onSelectAnswer(t)}return r.createElement("div",{className:"d-flex ".concat(e.className?e.className:""," ").concat("sm"===e.size?"mx-n1":"mx-n2")},e.interaction.actionableItems.map((function(n,i){var o=e.getSelectedAnswer(n.id),a=o?"bg-blue text-white":e.unCheckedBackground,c=function(){return r.createElement(r.Fragment,null)};e.showFeedback&&(a=n.isCorrect?"bg-success text-white":"bg-danger text-white ".concat("ZCkyL"),e.hideFeedbackIcons||(c=function(){return r.createElement(r.Fragment,null,n.isCorrect?r.createElement(k.x,{size:k.S.Small,svgName:O.vn.Check}):r.createElement(k.x,{size:k.S.Small,svgName:O.vn.Close}))}));var l=e.showFeedback?{}:{role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&t(n)}};return r.createElement("label",Object.assign({key:i,htmlFor:n.id,className:"\n rounded-3\n shadow-sm\n my-0\n position-relative\n overflow-hidden\n d-flex\n align-items-center\n justify-content-center\n ".concat("sm"===e.size?"".concat("_2qC40"," mx-1 h5"):"".concat("TKjXy"," mx-2 h4"),"\n ").concat(e.showFeedback?"":"cursor-pointer","\n ").concat(a)},l),r.createElement("input",{id:n.id,type:"radio",name:"multiple-choice",checked:!!o,onChange:function(){return t(n)},disabled:e.showFeedback,hidden:!0}),n.name,r.createElement("span",{className:"position-absolute p-2 ".concat("CBgCv")},r.createElement(c,null)),r.createElement("span",{className:"".concat("CVTEm").concat("sm"===e.size?" ".concat("tbPTs"):"")},o&&r.createElement(_e.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white ".concat("sm"===e.size?"GUAUz":"")})))})))}function ot(e){return ot="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},ot(e)}function at(e,t,n){return(t=function(e){var t=function(e){if("object"!=ot(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ot(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}it.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var ct=function(){return r.createElement(r.Fragment,null)},lt=at(at(at(at(at(at(at({},x.Z9.Annotation,ct),x.Z9.Image,ct),x.Z9.MissingWord,(function(e){var t=e.interaction.data.sentence.replace(/{([^{}]*)}/g,(function(e,t){return"{".concat($e).concat(t,"}")})).split(/{([^{}]*)}/g),n="p-2";return e.reportsStyling||(n+=" border rounded"),r.createElement("div",{className:n},t.map((function(t,n){if(!t.startsWith($e))return t;var i=t.replace($e,""),o=e.interaction.actionableItems.find((function(e){return e.order.toString()===i}));if(o){var a=e.answers.find((function(e){return e.id==o.id}));if(a){if(!e.showFeedback)return r.createElement("strong",{key:n,className:"text-info"},a.text);var c=a.status===Ne.Correct;return r.createElement(r.Fragment,{key:n},!c&&r.createElement(r.Fragment,null,r.createElement("del",{className:"text-danger"},r.createElement("strong",null,a.text))," "),r.createElement("strong",{className:"text-success"},o.name))}}})))})),x.Z9.MultipleChoice,(function(e){var t,n,i,o,a="my-2";return e.reportsStyling&&(a+=" mx-2"),r.createElement("div",{className:a},r.createElement(nt,{interaction:e.interaction,showFeedback:e.showFeedback,getSelectedAnswer:function(t){var n=e.answers.find((function(e){return e.id==t}));return null==n?void 0:n.id},imageApi:e.imageCdnUrl,userInitials:e.anonymisedUserName?We.l.getInitialsFromFullName(e.anonymisedUserName):We.l.getInitials(null===(t=e.user)||void 0===t?void 0:t.name,null===(n=e.user)||void 0===n?void 0:n.surname),userAvatar:e.anonymisedUserName?null:null===(o=null===(i=e.user)||void 0===i?void 0:i.avatar)||void 0===o?void 0:o.url,onlyShowSelectedAnswer:!e.showAvatar,size:"sm",unCheckedBackground:e.showFeedback?"":"".concat(rt," text-white"),isDisplayOnly:!0}))})),x.Z9.TrueOrFalse,(function(e){var t,n,i,o,a="justify-content-start";return e.reportsStyling&&(a="justify-content-center"),r.createElement("div",{className:"my-2"},r.createElement(it,{className:a,interaction:e.interaction,showFeedback:e.showFeedback,hideFeedbackIcons:!e.showAvatar,getSelectedAnswer:function(t){var n=e.answers.find((function(e){return e.id==t}));return null==n?void 0:n.text},imageApi:e.imageCdnUrl,userInitials:e.anonymisedUserName?We.l.getInitialsFromFullName(e.anonymisedUserName):We.l.getInitials(null===(t=e.user)||void 0===t?void 0:t.name,null===(n=e.user)||void 0===n?void 0:n.surname),userAvatar:e.anonymisedUserName?null:null===(o=null===(i=e.user)||void 0===i?void 0:i.avatar)||void 0===o?void 0:o.url,size:"sm",unCheckedBackground:e.showFeedback?"":"".concat(rt," text-white")}))})),x.Z9.ShortAnswer,(function(e){var t=Ze.m.first(e.answers);if(!t)return r.createElement(r.Fragment,null);var n="rounded p-2 mb-2";return e.reportsStyling||(n+=" bg-blue text-white"),r.createElement("div",{className:n},t.text)})),x.Z9.Illustration,(function(e){var t=Ze.m.first(e.answers);if(!t)return r.createElement(r.Fragment,null);var n="rounded p-2 mb-2 w-50";return e.reportsStyling||(n+=" text-white"),r.createElement("div",{className:n},r.createElement("img",{className:"img-fluid border rounded",src:t.text,alt:"Illustrated answer to the question: ".concat(e.interaction.name)}))}));function st(e){return r.createElement(r.Fragment,null,e.correctness===w.Correct&&r.createElement("div",{className:"ms-2 text-success"},r.createElement(k.x,{svgName:O.vn.Tick})),e.correctness===w.Incorrect&&r.createElement("div",{className:"ms-2 text-danger"},r.createElement(k.x,{svgName:O.vn.Close})))}function ut(e){return r.createElement("div",{className:"d-flex align-items-center justify-content-between mb-2"},r.createElement("p",{className:"fw-semibold mb-0"},e.anonymisedUserName||We.l.getFullName(e.studentResults.user)),r.createElement(st,{correctness:e.correctness}))}function ft(e){return e.correctness!==w.AwaitingMarking?r.createElement(r.Fragment,null):r.createElement("div",{className:"d-flex justify-content-end gap-2 mt-2"},r.createElement("div",{className:"d-flex flex-column justify-content-end cursor-pointer\n ".concat(e.markedStatus===Ne.Correct?"text-success":"")},r.createElement(k.x,{svgName:e.markedStatus===Ne.Correct?O.vn.CheckCircle:O.vn.CheckCircleOutline,onClick:function(){return e.markInteraction(e.studentAttempt.answers,Ne.Correct)}})),r.createElement("div",{className:"d-flex flex-column justify-content-end cursor-pointer\n ".concat(e.markedStatus===Ne.Incorrect?" text-danger":"")},r.createElement(k.x,{svgName:e.markedStatus===Ne.Incorrect?O.vn.CrossCircleFilled:O.vn.CrossCircle,onClick:function(){return e.markInteraction(e.studentAttempt.answers,Ne.Incorrect)}})))}function dt(e){var t,n,i,o,a,c=lt[e.interaction.typeId];if(!c)return r.createElement(r.Fragment,null);var l=ze(e.studentResults),s=He(e.interaction.id,l),u=Ge.isInteractionCorrect(e.interaction,l);return r.createElement("div",{className:"position-relative mt-2"},r.createElement("div",{className:"rounded ".concat(null!==(t=e.className)&&void 0!==t?t:"")},r.createElement("div",{className:"d-flex"},!!e.showStudentDetails&&r.createElement("div",{className:"me-2"},r.createElement("div",{className:"FEdgT"},r.createElement(_e.q,{imageCdnUrl:e.imageCdnUrl,initials:e.anonymisedUserName?We.l.getInitialsFromFullName(e.anonymisedUserName):We.l.getInitials(null===(n=e.studentResults.user)||void 0===n?void 0:n.name,null===(i=e.studentResults.user)||void 0===i?void 0:i.surname),imageUrl:e.anonymisedUserName?null:null===(a=null===(o=e.studentResults.user)||void 0===o?void 0:o.avatar)||void 0===a?void 0:a.url}))),r.createElement("div",{className:"flex-grow-1"},!!e.showStudentDetails&&r.createElement(ut,{studentResults:e.studentResults,correctness:u,anonymisedUserName:e.anonymisedUserName}),r.createElement("div",{className:"d-flex justify-content-between"},r.createElement("div",{className:"flex-grow-1 ".concat(e.responseComponentClass?e.responseComponentClass:"")},s?r.createElement(c,{interaction:e.interaction,answers:s.answers,imageCdnUrl:e.imageCdnUrl,user:e.studentResults.user,showFeedback:e.showFeedback,showAvatar:e.showAvatar,reportsStyling:e.reportsStyling}):r.createElement(Ke,null)),!e.showStudentDetails&&r.createElement(st,{correctness:u})))),r.createElement(ft,{studentAttempt:s,correctness:u,markInteraction:e.markInteraction,markedStatus:e.markedStatus})))}var pt,mt,ht=n(44645),vt=n(4231),yt=n(83996),gt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.getElementById("dialog-region");n||((n=document.createElement("div")).id="dialog-region",document.appendChild(n));var i=(0,ht.s)(n);function o(){var e;l.q.isFunction(null===(e=t.cancelButtonProps)||void 0===e?void 0:e.onClick)&&t.cancelButtonProps.onClick(),i.unmount()}var a=Object.assign(Object.assign({},t.submitButtonProps?t.submitButtonProps:{}),{onClick:function(){!function(){var e;if(l.q.isFunction(null===(e=t.submitButtonProps)||void 0===e?void 0:e.onClick)){var n=t.submitButtonProps.onClick();if(n instanceof Promise)return void n.then((function(){i.unmount()}))}i.unmount()}()}}),c=Object.assign(Object.assign({},t.cancelButtonProps?t.cancelButtonProps:{}),{onClick:function(){o()}});i.render(r.createElement(vt.G,{title:t.title,closePopup:o,size:t.size,centered:t.centered,bodyClassName:"overflow-hidden",dialogClassName:t.dialogClassName},e,!t.hideButtons&&r.createElement(yt.u,{className:t.buttonContainerClassName},t.cancelButtonProps&&r.createElement(yt.u.Cancel,Object.assign({},c)),t.submitButtonProps&&r.createElement(yt.u.Submit,Object.assign({},a)))))},bt=n(99785),wt={colourButton:"y6pnq",colourButtonSelected:"PAPVX",canvasDrawContainer:"__tFu",strokeButtonContainer:"D1zMW",strokeButton:"J7C_3",selectedButton:"aJKor"};function Et(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return St(e,t);var n={}.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)?St(e,t):void 0}}(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 St(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}!function(e){e[e.Small=2]="Small",e[e.Medium=4]="Medium",e[e.Large=8]="Large"}(pt||(pt={})),function(e){e.Black="#000000",e.Red="#D9584F",e.Orange="#F8981D",e.Yellow="#FFCD52",e.Green="#5DC786",e.Blue="#38A2E8",e.Purple="#7A76E8",e.Grey="#979797",e.White="#FFFFFF"}(mt||(mt={}));var kt=r.forwardRef((function(e,t){var n=r.useRef(null);r.useImperativeHandle(t,(function(){return n.current}),[n.current]);var i=r.useRef(null),o=Et(r.useState([0,0]),2),a=Et(o[0],2),c=a[0],l=a[1],s=o[1],u=Et(r.useState(mt.Black),2),f=u[0],d=u[1],p=Et(r.useState(pt.Small),2),m=p[0],h=p[1],v=Et(r.useState(!1),2),y=v[0],g=v[1],b=Et(r.useState(mt.Black),2),w=b[0],E=b[1];function k(){if(i.current){var e=i.current.getBoundingClientRect();s([e.width,.5625*e.width])}}function x(e){d(e),E(f),g(!1)}return r.useLayoutEffect((function(){if(i.current){var e=new ResizeObserver(k);return e.observe(i.current),function(){return e.disconnect()}}}),[i.current]),r.createElement("section",null,r.createElement("div",{className:"d-flex align-items-start"},r.createElement("div",{className:"d-flex flex-lg-column"},r.createElement("ul",{className:"me-3-lg me-2 list-unstyled"},Object.entries(mt).slice(0,4).map((function(e,t){var n=Et(e,2),i=n[0],o=n[1];return r.createElement("li",{key:t},r.createElement(S.L,{className:"".concat(wt.colourButton," ").concat(f===o?wt.colourButtonSelected:""," rounded-circle"),style:{backgroundColor:o},onClick:function(){return x(o)},"aria-label":"Select the colour: ".concat(i)}," "))}))),r.createElement("ul",{className:"me-3-lg me-2 list-unstyled"},Object.entries(mt).slice(4).map((function(e,t){var n=Et(e,2),i=n[0],o=n[1];return r.createElement("li",{key:t},r.createElement(S.L,{className:"".concat(wt.colourButton," ").concat(f===o?wt.colourButtonSelected:""," rounded-circle"),style:{backgroundColor:o},onClick:function(){return x(o)},"aria-label":"Select the colour: ".concat(i)}," "))})))),r.createElement("div",{className:"flex-grow-1 position-relative",ref:i},r.createElement("div",{className:wt.canvasDrawContainer},c&&r.createElement(bt.Z,{canvasHeight:l,canvasWidth:c,brushRadius:m,lazyRadius:10,hideGrid:!0,brushColor:f,className:"position-absolute top-0 left-0 border",ref:n}))),r.createElement("div",{className:"d-flex flex-column align-self-stretch ms-2"},r.createElement("div",{className:"d-flex flex-column gap-2 flex-grow-1"},r.createElement("ul",{className:"d-lg-flex flex-column gap-2 list-unstyled d-none"},r.createElement(Oe,{svgName:O.vn.Edit,className:"btn btn-outline-dark ".concat(y?"":wt.selectedButton),onClick:function(){y&&(d(w),g(!1))},"aria-label":"Pen"}),r.createElement(Oe,{svgName:O.vn.Erase,className:"btn btn-outline-dark mb-2 ".concat(y?wt.selectedButton:""),onClick:function(){if(y)return d(w),void g(!1);E(f),d(mt.White),g(!0)},"aria-label":"Eraser"})),r.createElement("ul",{className:"d-flex flex-column mb-2 list-unstyled"},r.createElement("li",{className:wt.strokeButtonContainer},r.createElement(Oe,{svgName:O.vn.SmallStroke,className:"btn btn-outline-dark ".concat(m===pt.Small?wt.selectedButton:""," ").concat(wt.strokeButton),onClick:function(){return h(pt.Small)},style:{color:f!==mt.White?f:mt.Black},"aria-label":"Small stroke"})),r.createElement("li",{className:wt.strokeButtonContainer},r.createElement(Oe,{svgName:O.vn.MediumStroke,className:"btn btn-outline-dark ".concat(m===pt.Medium?wt.selectedButton:""," ").concat(wt.strokeButton),onClick:function(){return h(pt.Medium)},style:{color:f!==mt.White?f:mt.Black},"aria-label":"Medium stroke"})),r.createElement("li",{className:wt.strokeButtonContainer},r.createElement(Oe,{svgName:O.vn.LargeStroke,className:"btn btn-outline-dark ".concat(m===pt.Large?wt.selectedButton:""," ").concat(wt.strokeButton),onClick:function(){return h(pt.Large)},style:{color:f!==mt.White?f:mt.Black},"aria-label":"Large stroke"})))),r.createElement("ul",{className:"d-flex flex-column gap-lg-2 list-unstyled"},r.createElement("li",null,r.createElement(Oe,{svgName:O.vn.Undo,className:"btn btn-outline-dark",onClick:function(){return n.current.undo()},"aria-label":"Undo"})),r.createElement("li",null,r.createElement(Oe,{svgName:O.vn.Delete,onClick:function(){gt(r.createElement("p",null,"Are you sure you want to discard your drawing?"),{title:"Discard your drawing?",submitButtonProps:{onClick:function(){return n.current.clear()},variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}})},className:"btn btn-outline-danger d-lg-block d-none ".concat(wt.myRight),"aria-label":"Clear canvas"}))))))}));function xt(e){var t=r.useRef(null),n=N.w.getTypeInfo(e.interaction.typeId),i=n.bgClassName,o=n.Svg;return r.createElement(Xe.Z,{className:"h-100"},r.createElement("section",{className:"d-flex flex-column h-100"},r.createElement("div",{className:"text-center text-body d-flex justify-content-between align-items-center p-2"},r.createElement("div",{className:"d-flex align-items-center"},r.createElement("span",{className:"".concat("sTvDl"," me-3 rounded my-1 text-white align-middle d-inline-block ").concat(i)},r.createElement(o,null)),r.createElement("span",{className:"text-start flex-grow-1"},r.createElement("h2",{className:"h6 mb-0"},r.createElement("strong",null,e.interaction.name)))),r.createElement("div",null,r.createElement(S.L,{className:"btn btn-link",onClick:function(){gt(r.createElement("p",null,"Are you sure you want to discard your drawing?"),{title:"Discard your drawing?",submitButtonProps:{onClick:e.onCancel,variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}})}},"Cancel"),r.createElement(S.L,{className:"btn btn-dark ms-2",onClick:function(){t.current&&e.onSave(t.current.getDataURL("image/png"))}},"Save"))),r.createElement("div",{className:"cv-timepoint bg-gray-100 flex-grow-1 rounded-bottom"},r.createElement("div",{className:"cv-timepoint-padding h-100"},r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"mx-auto ".concat("kFxi6")},r.createElement(kt,{ref:t})))))))}function Ot(e){var t=e.error;return e.error?r.createElement("p",{className:"mt-2 small text-danger"},t):r.createElement(r.Fragment,null)}function Ct(e){return Ct="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},Ct(e)}function Nt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function jt(){jt=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Ct(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ct(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Pt(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ct(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ct(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var It="data:image/png;base64,";function Lt(e){return Lt="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},Lt(e)}var Tt="cv-missing-word-";function _t(e){return _t="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},_t(e)}function At(e,t,n){return(t=function(e){var t=function(e){if("object"!=_t(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=_t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_t(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ft=n(56108);function Dt(e){return Dt="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},Dt(e)}function Rt(e){return Rt="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},Rt(e)}function Mt(e){return Mt="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},Mt(e)}function Ut(e,t,n){return(t=function(e){var t=function(e){if("object"!=Mt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Mt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vt=function(){return!0},Bt=function(){return!1},qt=Ut(Ut(Ut(Ut(Ut(Ut(Ut({},x.Z9.Annotation,Bt),x.Z9.Image,Bt),x.Z9.MissingWord,Vt),x.Z9.MultipleChoice,Vt),x.Z9.ShortAnswer,(function(e){return!!e.data.suggestedResponse})),x.Z9.TrueOrFalse,Vt),x.Z9.Illustration,Bt);function Gt(e){return qt[e]}var Zt=Ut(Ut(Ut(Ut(Ut(Ut(Ut({},x.Z9.Annotation,(function(e){var t=e.interaction.data.annotation.replace(/<(a)(.*?)>/g,'<$1 target="_blank" $2>');return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"mb-2 h4",dangerouslySetInnerHTML:{__html:t}}))})),x.Z9.Image,(function(e){var t=e.interaction,n=e.recalculateScroll,i=r.useCallback((function(e){e&&(e.onload=function(){n()})}),[]);return r.createElement("div",{className:"cv-interactive-question cv-image-interactive"},r.createElement("div",{className:"cv-image-container text-center"},r.createElement("img",{className:"img-fluid rounded",src:t.data.url,ref:i}),t.data.caption&&r.createElement(r.Fragment,null,r.createElement("p",{className:"mt-3 h4"},t.data.caption))))})),x.Z9.MissingWord,(function(e){var t=e.state,n=e.setState,i=e.interaction,o=e.showFeedback,a=i.data.sentence.replace(/{([^{}]*)}/g,(function(e,t){return"{".concat(Tt).concat(t,"}")})).split(/{([^{}]*)}/g);return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"mb-2 h4"},a.map((function(e,a){var c;if(!e.startsWith(Tt))return e;var l=e.replace(Tt,""),s=i.actionableItems.find((function(e){return e.order.toString()===l}));if(s){var u,f,d=t[s.id]||"",p=(u=s.name,(f=document.createElement("canvas").getContext("2d")).font="20pt arial",f.measureText(u).width);if(o){var m=s.name.toLowerCase().toString()===(null===(c=t[s.id])||void 0===c?void 0:c.toLowerCase().toString());return r.createElement(r.Fragment,{key:a},!m&&r.createElement(r.Fragment,null,r.createElement("del",{className:"text-danger"},d)," "),r.createElement("span",{className:"text-success"},s.name))}return r.createElement("span",{className:"cv-missing-word-input-container",key:a},r.createElement("input",{style:{width:p/16+"rem"},onChange:function(e){return function(e,r){if(r.stopPropagation(),r.target.value)n(function(e,t,n){return(t=function(e){var t=function(e){if("object"!=Lt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Lt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Lt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},e.id,r.target.value));else{var i=t,o=e.id,a=(i[o],function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(i,["symbol"===Lt(o)?o:o+""]));n(a,!0)}}(s,e)},value:d,maxLength:45,disabled:!!t.submitted,className:"cv-missing-word-input",autoComplete:"off"}))}}))),r.createElement(Ot,{error:t.error}))})),x.Z9.MultipleChoice,(function(e){var t=e.state,n=e.setState,i=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,l=1===i.actionableItems.filter((function(e){return e.isCorrect})).length;return r.createElement("div",{className:"cv-interactive-question"},r.createElement("p",{className:"h4"},i.name),!l&&r.createElement("div",{className:"rounded bg-light-blue p-2 mb-2 text-small"},r.createElement(k.x,{svgName:O.vn.Resources,className:"d-inline-block svg-container sm align-text-bottom me-1"}),r.createElement("small",null,r.createElement("strong",null,"Multi-select: "),"This question has multiple correct answers")),r.createElement(nt,{interaction:i,showFeedback:o,onSelectAnswer:function(e,r){if(!t.submitted)if(l)n(r?At({},e.id,e.id):{},!0);else if(r)n(At({},e.id,e.id));else{var i=t,o=e.id,a=(i[o],function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(i,["symbol"===_t(o)?o:o+""]));n(a,!0)}},getSelectedAnswer:function(e){return t[e]},imageApi:a.toString(),userInitials:We.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar,leftHandSidePortalNode:e.leftHandSidePortalNode,submitted:!!t.submitted}),r.createElement(Ot,{error:t.error}))})),x.Z9.ShortAnswer,(function(e){var t=e.interaction,n=e.state,i=e.setState;return e.showFeedback?r.createElement("div",{className:"cv-interactive-question"},r.createElement("p",{className:"h4"},t.name),r.createElement("label",{className:"h4 fw-bold"},"My answer"),r.createElement("p",{className:"h4"},n[t.actionableItems[0].id]),t.data.suggestedResponse&&r.createElement(r.Fragment,null,r.createElement("label",{className:"h4 fw-bold"},"Teacher's suggested answer"),r.createElement("p",{className:"h4"},t.data.suggestedResponse))):r.createElement("div",{className:"cv-interactive-question"},r.createElement("p",{className:"h4"},t.name),r.createElement(Ft.Z,{id:"short-answer-answer",className:"form-control mt-2",minRows:3,value:n[t.actionableItems[0].id]||"",onChange:function(e){var r,o,a;i(Object.assign(Object.assign({},n),(r={},o=t.actionableItems[0].id,a=e.target.value,(o=function(e){var t=function(e){if("object"!=Dt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Dt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Dt(t)?t:t+""}(o))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,r)))},disabled:!!n.submitted}),r.createElement(Ot,{error:n.error}))})),x.Z9.TrueOrFalse,(function(e){var t=e.state,n=e.setState,i=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,l=i.actionableItems.find((function(e){return e.isCorrect}));return r.createElement("div",{className:"cv-interactive-question"},r.createElement("p",{className:"h4"},i.name),r.createElement(it,{className:"justify-content-center",interaction:i,showFeedback:o,onSelectAnswer:function(e){var r,i,o;t.submitted||n((r={},i=e.id,o=e.name,(i=function(e){var t=function(e){if("object"!=Rt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Rt(t)?t:t+""}(i))in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,r),!0)},getSelectedAnswer:function(e){return t[e]},imageApi:a.toString(),userInitials:We.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar}),o&&r.createElement("div",{className:"text-center px-5 mt-3"},r.createElement("p",{className:"h4"},"The answer is ",r.createElement("strong",null,l.name)),i.data.feedback&&r.createElement("p",{className:"h4"},i.data.feedback)),r.createElement(Ot,{error:t.error}))})),x.Z9.Illustration,(function(e){var t,n,i=e.interaction,o=e.state,a=e.fullWidthPortalNode,c=e.setState,l=(t=r.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Nt(e,t);var n={}.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)?Nt(e,t):void 0}}(t,n)||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.")}()),s=l[0],u=l[1],f=o[i.actionableItems[0].id];return r.createElement("div",{className:"cv-interactive-question"},r.createElement("p",{className:"h4 mb-3"},i.name),f?r.createElement(r.Fragment,null,r.createElement("img",{className:"img-fluid border rounded mb-2 w-75",src:f,alt:"Illustration"}),!o.submitted&&r.createElement(S.L,{className:"btn btn-outline-dark",onClick:function(){return u(!0)}},"Re-draw my answer")):r.createElement(S.L,{className:"btn btn-outline-dark",onClick:function(){return u(!0)}},"Draw my answer"),r.createElement(Ot,{error:o.error}),s&&r.createElement(Pe.Nq,{node:a},r.createElement(xt,{interaction:i,onSave:function(t){c(Object.assign(Object.assign({},o),Pt({},i.actionableItems[0].id,t))),u(!1),e.recalculateScroll()},onCancel:function(){return u(!1)}})))}));function zt(){return""}var Ht=Ut(Ut(Ut(Ut(Ut(Ut(Ut({},x.Z9.Annotation,zt),x.Z9.Image,zt),x.Z9.MissingWord,(function(e,t){var n=Object.keys(e).filter((function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.trim())})).length;return n?n!==t.actionableItems.length?"Please fill in all of the blanks":null:"Please fill in the blanks"})),x.Z9.MultipleChoice,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),x.Z9.ShortAnswer,(function(e,t){var n;return Object.keys(e).filter((function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.trim())})).length?(null===(n=e[t.actionableItems[0].id])||void 0===n?void 0:n.length)>4e3?"Max answer length is ".concat(4e3," characters"):null:"Please provide an answer to the question"})),x.Z9.TrueOrFalse,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),x.Z9.Illustration,(function(e){return Object.keys(e).filter((function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.trim())})).length?null:"Please submit an illustration"})),Wt=Ut(Ut(Ut(Ut(Ut(Ut(Ut({},x.Z9.Annotation,null),x.Z9.Image,null),x.Z9.MissingWord,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),x.Z9.MultipleChoice,(function(e,t,n){return n(t.id,Object.keys(e).map((function(e){var n=t.actionableItems.find((function(t){var n;return(null===(n=t.id)||void 0===n?void 0:n.toString())===(null==e?void 0:e.toString())}));return{actionableItemId:e,value:null==n?void 0:n.name}})))})),x.Z9.ShortAnswer,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),x.Z9.TrueOrFalse,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t]}})))})),x.Z9.Illustration,(function(e,t,n,r){return i=this,o=void 0,a=void 0,c=jt().mark((function i(){var o,a,c,l;return jt().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!(o=e[t.actionableItems[0].id]||"").startsWith(It)){i.next=7;break}return a=o.replace(It,""),i.next=5,Y.e.post("".concat(r.imageApi,"v2/thumbnails/base64"),'"'.concat(a,'"'),{tokenName:"gateway"});case 5:c=i.sent,o=c.location;case 7:return l=Object.keys(e).map((function(e){return{actionableItemId:e,value:o}})),i.next=10,n(t.id,l);case 10:return i.abrupt("return",Pt({},t.actionableItems[0].id,o));case 11:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}));var i,o,a,c}));function Qt(e){return Wt[e]}var Yt=Ut(Ut(Ut(Ut(Ut(Ut(Ut({},x.Z9.Annotation,Ge.notApplicable),x.Z9.Image,Ge.notApplicable),x.Z9.MissingWord,(function(e,t){return Ge.isMissingWordCorrect(t,(function(t){return e[t]}))})),x.Z9.MultipleChoice,(function(e,t){return Ge.isMultipleChoiceCorrect(t,(function(t){return e[t]}))})),x.Z9.ShortAnswer,Ge.awaitingMarking),x.Z9.TrueOrFalse,(function(e,t){return t.actionableItems.filter((function(e){return e.isCorrect})).every((function(t){return e[t.id]===t.name}))?w.Correct:w.Incorrect})),x.Z9.Illustration,Ge.awaitingMarking);function Kt(e){return Yt[e]}function $t(e){var t=e.studentResults,n=e.interaction,i=e.timepoint,o=e.interactive,a=e.state,c=e.goToTimepoint,l=e.interactionNumber,s=e.imageCdnUrl,u=ze(t),f=He(n.id,u),d=a.interactions[n.id],p=Kt(n.typeId)(d||{},n),m=n.typeId!==x.Z9.Annotation&&n.typeId!==x.Z9.Image,h=m;n.typeId===x.Z9.MissingWord&&f&&(h=!1);var v=n.data.suggestedResponse||n.data.feedback;return r.createElement("li",{className:"mb-3 position-relative"},r.createElement("div",{className:"d-flex flex-wrap mb-2 cursor-pointer",onClick:function(){return c(i.id,n.id)}},o.immediateFeedback&&r.createElement("div",{className:"O6oD6"},!!f&&(p===w.AwaitingMarking?r.createElement("span",{className:"text-secondary fst-italic"},"Waiting to be marked"):p===w.Correct?r.createElement("span",{className:"text-success"},"Correct ",r.createElement(k.x,{className:"svg-container align-middle",svgName:O.vn.Check})):p===w.Incorrect&&r.createElement("span",{className:"text-danger"},"Incorrect ",r.createElement(k.x,{className:"svg-container align-middle",svgName:O.vn.Close})))),r.createElement(I,{interaction:n,iconClassName:"flex-shrink-0",showQuestion:h,showTypeName:!0,questionClassName:"d-block w-100 mt-2",questionNumber:l})),m&&!f&&r.createElement("button",{className:"btn btn-dark",onClick:function(){return c(i.id,n.id)}},"Answer question"),f&&m&&r.createElement(dt,{interaction:n,studentResults:t,markedStatus:Ne.PendingReview,markInteraction:function(){},imageCdnUrl:s,showFeedback:o.immediateFeedback,showAvatar:!0}),o.immediateFeedback&&f&&v&&r.createElement("div",{className:"bg-light rounded p-2"},r.createElement("div",null,r.createElement("strong",null,n.typeId===x.Z9.TrueOrFalse?"Teacher's feedback":"Teacher's suggested response")),v))}function Xt(e){var t=e.interactive,n=e.duration;return n?r.createElement(r.Fragment,null,t.timepoints.map((function(t,i){if(!t.interactions.length)return r.createElement(r.Fragment,null);var o=N.w.getTypeInfo(t.interactions[0].typeId).bgClassName,a=t.visibleAt/1e3/n*100;return r.createElement("span",{key:i,className:"".concat("pUo8u"," ").concat(o),style:{left:"".concat(a,"%")},onClick:function(n){return r=t.id,i=t.interactions[0].id,n.stopPropagation(),void e.goToTimepoint(r,i);var r,i}})}))):r.createElement(r.Fragment,null)}function Jt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function en(e){var t,n,i=e.duration,o=e.progress,a=e.player,c=(t=r.useState(o.length),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Jt(e,t);var n={}.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)?Jt(e,t):void 0}}(t,n)||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.")}())[1],l=[];if(o.length){var s=o[0];l.push(s),o.forEach((function(e,t){0!==t&&(s.end.time+1>e.start.time&&s.start.time<e.start.time?s.end=e.end:(s=e,l.push(s)))}))}return r.useEffect((function(){var e=function(){c(o.length)};return a.on("progressflush",e),function(){return a.off("progressflush",e)}}),[]),r.createElement(r.Fragment,null,l.map((function(e,t){var n=e.start.time/i*100,o=100*(1-e.end.time/i);return r.createElement("span",{key:t,className:"BnKli",style:{left:"".concat(n,"%"),right:"".concat(o,"%")}})})))}function tn(e){return!!(null==e?void 0:e.toString().startsWith("new_"))}function nn(e){return e.error,e.hasChanges,e.submitted,e.spinner,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}(e,["error","hasChanges","submitted","spinner"])}function rn(e){return function(e){if(Array.isArray(e))return an(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||on(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 on(e,t){if(e){if("string"==typeof e)return an(e,t);var n={}.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)?an(e,t):void 0}}function an(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function cn(e){var t,n,i=e.showSummary,o=e.setShowSummary,a=e.state,c=e.interactive,l=e.player,s=e.progress,u=e.portalNode,f=r.useRef(null),d=(t=r.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||on(t,n)||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.")}()),p=d[0],m=d[1];function h(){o(!1),l.show(),l.play()}function v(t,n){h(),e.goToTimepoint(t,n)}if(!u||!i)return r.createElement(r.Fragment,null);var y=function(e){var t=e.state,n=0,r=0,i=0,o=!1,a=[];return e.interactive.timepoints.forEach((function(e){e.interactions.forEach((function(e){var c=t.interactions[e.id],l=Kt(e.typeId)(c||{},e);l===w.Correct&&n++,l!==w.NotApplicable&&r++,l!==w.NotApplicable&&(null==c?void 0:c.submitted)&&i++,l===w.AwaitingMarking&&(o=!0);var s=nn(c||{}),u=Object.keys(s).map((function(e){var t;return{id:e,text:null===(t=s[e])||void 0===t?void 0:t.toString()}}));u.length&&a.push({id:e.id,answeredAt:1,answers:u})}))})),{correctCount:n,total:r,answered:i,studentAttempts:a,awaitingMarking:o}}({interactive:c,state:a}),g=y.correctCount,b=y.total,E=y.answered,k=y.studentAttempts,x=y.awaitingMarking,C={user:{name:e.currentUser.givenName,surname:e.currentUser.familyName,avatar:{url:e.currentUser.avatar}},results:[{id:c.id,attempts:k}]},N=0,j=l.ended(),P=l.duration();return r.createElement(Pe.Nq,{node:u},r.createElement("div",{className:"row pb-3"},r.createElement("div",{className:"col-4 col-xs-12"},r.createElement(Le.Z,{data:l.poster(),imageType:Te.__.Thumbnails,imageOptions:{size:Te.h2.Medium}})),r.createElement("div",{className:"col-8 col-xs-12"},r.createElement("span",{className:"float-end"},r.createElement(Ie.h,{svgName:O.vn.Play,className:"btn btn-outline-dark",onClick:function(){h(),l.ended()&&l.currentTime(0)}},j?"Play again":"Continue watching"),l.gradePassbackPlugin().enabled&&(p?r.createElement(S.L,{className:"btn btn-dark ms-2",onClick:function(){}},r.createElement(je.Z,{as:"span",animation:"border",role:"status",size:"sm"})):r.createElement(Ie.h,{svgName:O.vn.Check,className:"btn btn-dark ms-2",onClick:function(){m(!0),l.gradePassbackPlugin().submit(g/b,!x)}},"Submit"))),r.createElement("h1",{className:"h3"},e.title),r.createElement("p",null))),r.createElement("div",{className:"border rounder px-2 mb-3"},r.createElement("div",{className:"cursor-pointer my-4 ".concat("gxTA_"),onClick:function(e){if(f.current){var t=f.current.getBoundingClientRect(),n=(e.pageX-t.left)/t.width*P;h(),l.currentTime(n)}},ref:f},r.createElement(en,{duration:P,progress:s,interactive:c,player:l}),r.createElement(Xt,{duration:P,interactive:c,goToTimepoint:v}))),r.createElement("h2",{className:"h4"},"My Answers"),r.createElement("div",{className:"d-flex justify-content-between"},r.createElement("span",null,c.immediateFeedback&&r.createElement("div",null,"Score: ",g,"/",b),r.createElement("div",{className:"mb-3"},"You have answered ",r.createElement("strong",{className:E!==b?"text-danger":""},E)," of ",r.createElement("strong",null,b)," questions"))),r.createElement("div",{className:"row"},r.createElement("div",{className:"col-lg-7 col-12"},r.createElement("ul",{className:"list-unstyled"},c.timepoints.reduce((function(t,n){return[].concat(rn(t),rn(n.interactions.map((function(t){return N++,r.createElement($t,{key:t.id,studentResults:C,interaction:t,timepoint:n,interactive:c,state:a,goToTimepoint:v,interactionNumber:N,imageCdnUrl:e.imageCdnUrl})}))))}),[])))))}function ln(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sn(e,t);var n={}.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)?sn(e,t):void 0}}(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 sn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function un(e){var t=e.player,n=e.resultsService,i=e.interactive,o=e.setShowSummary,a=e.mobile,c=ln(r.useState(!1),2),l=c[0],s=c[1],u=ln(r.useState(!1),2),f=u[0],d=u[1],p=e.player.activePlugins_.activityStatusPlugin,m=e.player.activePlugins_.favouritePlugin;function h(){var e=t.currentTime(),n=i.timepoints[i.timepoints.length-1];f||e>n.visibleAt/1e3+1?s(!0):s(!1)}function v(){d(!0)}if(r.useEffect((function(){return t.on("ended",v),function(){return t.off("ended",v)}}),[]),r.useEffect((function(){if(n&&!a)return t.on("timeupdate",h),function(){return t.off("timeupdate",h)}}),[f]),!l)return null;var y="btn btn-outline-dark cv-show-summary";return m&&(y+=" cv-has-favourite-plugin"),p&&(y+=" cv-has-activity-status-plugin"),r.createElement(S.L,{className:y,onClick:function(){o(!0),t.pause(),t.hide()}},t.gradePassbackPlugin().enabled?"Submit answers":"View summary")}function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function dn(e){var t,n,i=e.resultsService,o=e.player,a=e.onShowSummary,c=e.mobile,l=(t=r.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return fn(e,t);var n={}.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)?fn(e,t):void 0}}(t,n)||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.")}()),s=l[0],u=l[1];function f(e){u(e),a&&a(e)}function d(){f(!0),o.hide()}return r.useEffect((function(){if(i&&!c)return o.on("ended",d),function(){return o.off("ended",d)}}),[]),r.useEffect((function(){s&&o.isFullscreen()&&o.exitFullscreen()}),[s]),r.createElement(r.Fragment,null,r.createElement(un,Object.assign({setShowSummary:f},e)),r.createElement(cn,Object.assign({showSummary:s,setShowSummary:f},e)))}var pn=n(25692),mn=n(98985);function hn(){var e=mn.o.getLiteArticle(pn.b.MakeInteractive);return r.createElement("div",{className:"my-5 text-center"},r.createElement("h2",{className:"h3"},"Select an interaction to get started"),r.createElement("p",{className:"mb-0"},"Choose a point in the video and add a question to interact and engage your students."),!!e&&r.createElement("a",{href:e,target:"_blank",className:"btn btn-link text-info"},"How do I make interactives?"))}function vn(e){var t=e.isCreate,n=e.interactive,i=e.interaction,o=e.portalNode,a=e.goToTimepoint,c=e.promptDelete;if(!o)return r.createElement(r.Fragment,null);var l=n.timepoints.reduce((function(e,t){return e+t.interactions.length}),0);return r.createElement(Pe.Nq,{node:o},l?r.createElement(r.Fragment,null,r.createElement("h2",{className:"h4 mt-3"},"Question List (",l,")"),r.createElement(D,{interactive:n,maxHeight:300,goToTimepoint:a,selectedInteractionId:null==i?void 0:i.id,onClickDelete:t?c:void 0,experimentalInteractiveQuestions:e.experimentalInteractiveQuestions})):t?r.createElement(hn,null):r.createElement(r.Fragment,null))}var yn=n(90547),gn=n(5256),bn=n(30708);function wn(e,t){if(e){if("string"==typeof e)return En(e,t);var n={}.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)?En(e,t):void 0}}function En(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Sn=[x.Z9.MissingWord,x.Z9.MultipleChoice,x.Z9.TrueOrFalse,x.Z9.ShortAnswer,x.Z9.Image,x.Z9.Annotation];function kn(e){var t,n,i=e.addInteraction,o=e.cancelTypeSelector,a=e.player,c=e.timepoint,l=e.open,s=e.isCreate,u=e.interaction,f=e.experimentalInteractiveQuestions,d=(t=r.useState((0,bn.m)(a.currentTime()||0)),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||wn(t,n)||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.")}()),p=d[0],m=d[1],h=[].concat(Sn);return f&&h.push.apply(h,function(e){return function(e){if(Array.isArray(e))return En(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||wn(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.")}()}(Object.keys(x.IL))),r.useEffect((function(){var e=function(){m((0,bn.m)(a.currentTime()))};return a.on("timeupdate",e),function(){return a.off("timeupdate",e)}}),[]),!u&&s&&l?r.createElement("div",{className:"d-flex align-items-center justify-content-center h-100\n ".concat(f?"cv-experimental-types":"","\n ")},r.createElement("div",{className:"cv-interactive-type-selector justify-content-center align-items-center"},r.createElement("h2",{className:"text-center fw-bold w-100 text-body mb-3 cv-add-question-copy"},c?"Add another question at:":"Add a question at:"," ",p),r.createElement("ul",{className:"list-unstyled row g-2\n ".concat(f?"row-cols-2":"row-cols-3")},h.map((function(e,t){var n=N.w.getTypeInfo(e),o=n.name,a=n.bgClassName,c=n.Svg;return r.createElement("li",{className:"col",key:t},r.createElement(S.L,{className:"cv-type-selector rounded\n ".concat(f?" p-2 w-100 d-flex border justify-content-start align-items-center":"py-2 w-100 ".concat(a),"\n "),onClick:function(){return i(e)}},r.createElement("span",{className:"cv-create-type-icon\n ".concat(f?"text-shadow rounded ".concat(a," me-2"):"mb-1","\n ")},r.createElement(c,null)),r.createElement("div",{className:"d-flex align-items-center justify-content-center cv-interaction-type-name\n ".concat(f?"text-dark":"px-1 text-shadow","\n ")},o)))}))),(c||l)&&r.createElement("div",{className:"text-center w-100 mt-2 ".concat(c?"":"cv-adding-first-cancel")},r.createElement(S.L,{className:"btn btn-link",onClick:o},"Cancel")))):r.createElement(r.Fragment,null)}var xn=n(1471);function On(e){var t=e.timepoint,n=e.interaction,i=e.promptDelete,o=e.optionsPortalNode,a=e.setView;if(!n)return r.createElement(r.Fragment,null);var c=[];if(c.push({label:"Move time point",onClick:function(){return a("move")}}),t.interactions.length>1){var l=tn(n.id);c.push({label:"Re-order questions",onClick:function(){return a("reorder")},className:l?"disabled":""})}return c.push({label:"Delete",onClick:function(){return i(n.id)},className:"text-danger"}),r.createElement(Pe.Nq,{node:o},!!n&&r.createElement(xn.m,{actions:c,className:"p-0 mt-n2",dropdownToggleClassName:"p-0"}))}function Cn(e){var t=e.interaction,n=e.interactionState,i=e.onClickContinue,o=e.onClickSave,a=e.onClickCancel,c=e.onClickAddAnother,l=e.onClickDiscard,s=tn(t.id),u=!!(null==n?void 0:n.hasChanges),f=!!(null==n?void 0:n.spinner);return r.createElement("div",{className:"cv-timpoint-button-container"},s?r.createElement(S.L,{className:"btn btn-link",onClick:a},"Cancel"):u?r.createElement(S.L,{className:"btn btn-link",onClick:l},"Discard"):r.createElement(S.L,{className:"btn btn-link",onClick:c},"Add another question"),f?r.createElement(S.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(je.Z,{as:"span",animation:"border",role:"status",size:"sm"})):s?u?r.createElement(S.L,{className:"btn btn-dark ms-2",onClick:o},"Save"):r.createElement(S.L,{className:"btn btn-dark ms-2 disabled",onClick:function(){}},"Save"):u?r.createElement(S.L,{className:"btn btn-dark ms-2",onClick:o},"Save"):r.createElement(Oe,{className:"btn btn-dark ms-2",onClick:i,svgName:O.vn.Play},"Continue"))}function Nn(e){var t=e.typeId,n=e.interactionState,i=e.onClickSkip,o=e.numberOfInteractions,a=e.currentIndex,c=e.changeIndex,l=!!(null==n?void 0:n.submitted),s=!!(null==n?void 0:n.hasChanges),u=!!(null==n?void 0:n.spinner),f=!!Qt(t),d=a<o-1;var p=a>0;return r.createElement("div",{className:"cv-timpoint-button-container flex-wrap"},!l&&f&&r.createElement(S.L,{className:"btn btn-link",onClick:i},"Come back later"),o>1&&a>0&&r.createElement(Oe,{className:"btn btn-dark ms-2 ".concat(p?"":"disabled"),onClick:function(){p&&c(a-1)},svgName:O.vn.ChevronUp}),u?r.createElement(S.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(je.Z,{as:"span",animation:"border",role:"status",size:"sm"})):l||!f?1===o||a===o-1?r.createElement(Oe,{className:"btn btn-dark ms-2",onClick:i,svgName:O.vn.Play},"Continue"):r.createElement(S.L,{className:"btn btn-dark ms-2 ".concat(d?"":"disabled"),onClick:function(){d&&c(a+1)}},"Next"):r.createElement(S.L,{className:"btn btn-dark ms-2 ".concat(s?"":"disabled"),onClick:function(){s&&e.onClickSubmit()}},"Save"))}function jn(e){var t=e.isCreate,n=e.interaction,i=e.interactionState,o=e.continueInteractive,a=e.saveInteraction,c=e.cancel,l=e.addAnotherQuestion,s=e.discardChanges,u=e.submitInteractionAnswer,f=e.onClickSkip,d=e.changeIndex,p=e.timepoint,m=e.currentIndex;return r.createElement(r.Fragment,null,t?r.createElement(Cn,{interaction:n,interactionState:i,onClickContinue:o,onClickSave:a,onClickCancel:c,onClickAddAnother:l,onClickDiscard:function(){return s()}}):r.createElement(Nn,{typeId:n.typeId,interactionState:i,onClickSubmit:u,onClickSkip:f,changeIndex:d,currentIndex:m,numberOfInteractions:p.interactions.length}))}function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function In(e){var t,n,i=e.typeId,o=e.currentIndex,a=e.numberOfInteractions,c=e.changeIndex,l=e.player,s=(t=r.useState((0,bn.m)(l.currentTime()||0)),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Pn(e,t);var n={}.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)?Pn(e,t):void 0}}(t,n)||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.")}()),u=s[0],f=s[1];r.useEffect((function(){var e=function(){f((0,bn.m)(l.currentTime()))};return l.on("timeupdate",e),function(){return l.off("timeupdate",e)}}),[]);var d=N.w.getTypeInfo(i),p=d.name,m=d.bgClassName,h=o<a-1,v=o>0;return r.createElement("div",{className:"text-center d-flex justify-content-between align-items-center p-1 ".concat(m)},r.createElement(S.L,{onClick:function(){v&&c(o-1)},className:v?"":"invisible"},r.createElement(k.x,{size:k.S.Medium,svgName:O.vn.ChevronLeft})),r.createElement("div",null,r.createElement("h2",{className:"h6 mb-0"},p),a>1&&r.createElement("div",null,o+1," of ",a," at ",u)),r.createElement(S.L,{onClick:function(){h&&c(o+1)},className:h?"":"invisible"},r.createElement(k.x,{size:k.S.Medium,svgName:O.vn.ChevronRight})))}var Ln=n(29014),Tn=n(2248),_n=n(3026),An=n(52076);function Fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Dn=null,Rn=!1;function Mn(e){var t,n,i=(t=r.useState(Dn),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Fn(e,t);var n={}.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)?Fn(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1];return Dn||Rn||(Rn=!0,(0,_n.ajaxRequest)({resource:"/api/integrations/token/immersive-reader",type:Tn.k.GET,success:function(e){Dn=e,a(e),window.setTimeout((function(){Dn=null,Rn=!1}),9e5)},error:function(){}})),o?(e.title||(e.title=Qe.T.getPhrase("shared.immersiveReader","titleFallback")),r.createElement("span",{className:"".concat("nckQw"," ").concat(e.className||""),onClick:function(){l.q.isFunction(e.onLaunch)&&e.onLaunch(),An.k.logUserAction(e.analyticsData,e.analyticsOptions);var t={title:e.title,chunks:[{content:e.text,mimeType:e.html?"text/html":"text/plain"}]},n=o.subdomain,r=o.token,i={uiZIndex:5e3,onExit:function(){l.q.isFunction(e.onExit)&&e.onExit()}};Ln.launchAsync(r,n,t,i)}},r.createElement("svg",{viewBox:"0 0 40 37"},r.createElement("path",{d:"M37.4,0.9 L37.4,9.6 L35.4,9.6 L35.4,2.9 L24.4,2.9 C22.9,3.3 20,4.5 20,6 L20,17.2 L18,17.2 L18,6 C18,5 15.6,3.6 13.8,2.9 L2,2.9 L2,29 L12.4,29 L12.4,31 L0,31 L0,0.9 L14.1,0.9 L14.3,1 C15,1.2 17.5,2.2 18.9,3.7 C20.5,1.9 23.5,1.1 23.9,1 L24.1,1 L37.4,1 L37.4,0.9 Z",fill:"#000000"}),r.createElement("path",{d:"M27.4,37 L25.8,37 L18.4,29.4 L14,29.4 L14,21 L18.4,20.9 L26.1,13 L27.4,13 L27.4,37 Z M16,27.4 L19.2,27.4 L25.3,33.7 L25.3,16.6 L19.2,22.9 L15.9,22.9 L15.9,27.4 L16,27.4 Z",fill:"#0197F2"}),r.createElement("path",{d:"M31.3,32.7 L29.6,31.7 C29.6,31.7 31.7,28.3 31.7,25.2 C31.7,21.9 29.6,18.5 29.6,18.4 L31.3,17.4 C31.4,17.6 33.7,21.3 33.7,25.2 C33.7,28.8 31.4,32.6 31.3,32.7 Z",fill:"#0197F2"}),r.createElement("path",{d:"M36.4,36.2 L34.8,35 C34.8,35 38,30.8 38,25.2 C38,19.6 34.8,15.4 34.8,15.4 L36.4,14.2 C36.5,14.4 40,19 40,25.3 C40,31.5 36.5,36 36.4,36.2 Z",fill:"#0197F2"})))):r.createElement(r.Fragment,null)}var Un=["A","B","C","D"];function Vn(e){if(!e.enableImmersiveReader)return r.createElement(r.Fragment,null);var t=e.interaction,n=e.className,i=N.w.getTypeInfo(t.typeId),o=i.name,a=i.typeName,c="";switch(t.typeId){case x.Z9.Annotation:c=t.data.annotation;break;case x.Z9.Image:c=t.data.caption;break;case x.Z9.MissingWord:c=t.data.sentence.replace(/{([^{}]*)}/g,(function(){return"<u>&nbsp;&nbsp;&nbsp;&nbsp;</u>"}));break;case x.Z9.MultipleChoice:c=t.name,t.actionableItems.map((function(e,t){return c+="<br />".concat(Un[t],": ").concat(e.name)}));break;case x.Z9.ShortAnswer:c=t.name;break;case x.Z9.TrueOrFalse:c="True or false: ".concat(t.name)}var l=t.typeId===x.Z9.Annotation||t.typeId===x.Z9.MissingWord||t.typeId===x.Z9.MultipleChoice;return r.createElement(Mn,{title:o,text:c,html:l,className:"".concat("Erirh"," ").concat(n||""),analyticsData:{id:t.interactiveId,type:a},analyticsOptions:{location:f.LZ.InteractivePlayer,entity:f.py.Interactive,actionType:f.Vw.Click,descriptor:f._S.LaunchImmersiveReader}})}function Bn(e){var t=N.w.getTypeInfo(e.interaction.typeId),n=t.name,i=t.prompt,o=t.bgClassName,a=t.Svg;return r.createElement("div",{className:"text-center text-body d-flex justify-content-between align-items-center px-3 pt-3"},r.createElement("div",{className:"d-flex align-items-center"},r.createElement("span",{className:"cv-interaction-icon rounded my-1 text-white ".concat(o)},r.createElement(a,null)),r.createElement("span",{className:"text-start flex-grow-1"},r.createElement("div",{className:"h5 ".concat(i?"":"mb-0")},r.createElement("strong",null,n)),i&&r.createElement("div",{className:"h6 mb-0"},i))),r.createElement(Vn,{interaction:e.interaction,className:"ms-2",enableImmersiveReader:e.enableImmersiveReader}))}function qn(e){var t=e.isCreate,n=e.interaction,i=e.player,o=e.changeIndex,a=e.timepointState,c=e.timepoint;return t?r.createElement(In,{typeId:n.typeId,changeIndex:o,player:i,currentIndex:a.interactionIndex,numberOfInteractions:c.interactions.length}):r.createElement(Bn,{interaction:n,enableImmersiveReader:e.enableImmersiveReader})}var Gn=n(10671),Zn=n(98886),zn=n(6880);function Hn(e){var t=e.error;return e.error?r.createElement("p",{id:e.id,className:"mt-2 small text-danger",role:"status"},t):r.createElement(r.Fragment,null)}function Wn(e){return Wn="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},Wn(e)}function Qn(){Qn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Wn(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Wn(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Yn(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,Kn(r.key),r)}}function Kn(e){var t=function(e){if("object"!=Wn(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Wn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wn(t)?t:t+""}var $n=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Xn=function(e){return"/api/domain/v1/interactions/".concat(e)},Jn=function(e){return"/api/domain/v1/timepoints/".concat(e)},er={},tr=new(function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"saveInteraction",value:function(e){return $n(this,void 0,void 0,Qn().mark((function t(){var n,r,i,o,a;return Qn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=tn(e.id),r=n?"/api/domain/v1/interactions/bulk":(c=e.id,"/api/domain/v1/interactions/bulk/".concat(c)),i={name:e.name,data:e.data,timepointId:e.timepointId,interactiveId:e.interactiveId,typeId:e.typeId,actionableItems:e.actionableItems,order:e.order},n||(i.id=e.id),o=n?Y.e.post(r,JSON.stringify(i),er):Y.e.put(r,JSON.stringify(i),er),t.next=7,o;case 7:a=t.sent,n&&(e.id=a.id);case 9:case"end":return t.stop()}var c}),t)})))}},{key:"deleteInteraction",value:function(e){return $n(this,void 0,void 0,Qn().mark((function t(){return Qn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y.e.delete(Xn(e),er);case 2:case"end":return t.stop()}}),t)})))}},{key:"saveTimepoint",value:function(e){return $n(this,void 0,void 0,Qn().mark((function t(){var n,r;return Qn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={interactiveId:e.interactiveId,shouldPause:1,visibleAt:e.visibleAt},t.next=3,Y.e.post("/api/domain/v1/timepoints",JSON.stringify(n),er);case 3:r=t.sent,e.id=r.id;case 5:case"end":return t.stop()}}),t)})))}},{key:"updateTimepoint",value:function(e){return $n(this,void 0,void 0,Qn().mark((function t(){return Qn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y.e.put((n=e.id,"/api/domain/v1/timepoints/".concat(n)),JSON.stringify(e),er);case 2:case"end":return t.stop()}var n}),t)})))}},{key:"deleteTimepoint",value:function(e){return $n(this,void 0,void 0,Qn().mark((function t(){return Qn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y.e.delete(Jn(e),er);case 2:case"end":return t.stop()}}),t)})))}}])&&Yn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()),nr={styleToHTML:function(e){return"SUPERSCRIPT"===e?{start:"<sup>",end:"</sup>"}:"SUBSCRIPT"===e?{start:"<sub>",end:"</sub>"}:void 0},entityToHTML:function(e,t){return"LINK"===e.type?r.createElement("a",{href:e.data.url},t):t},htmlToStyle:function(e,t,n){return"sup"===e?n.add("SUPERSCRIPT"):"sub"===e?n.add("SUBSCRIPT"):n},htmlToEntity:function(e,t,n){if("a"===e)return n("LINK","MUTABLE",{url:t.href})}};function rr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ir(e,t);var n={}.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)?ir(e,t):void 0}}(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 ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function or(e){var t=rr(r.useState(""),2),n=t[0],i=t[1],o=rr(r.useState(""),2),a=o[0],c=o[1];return r.createElement("div",{"aria-haspopup":"true","aria-expanded":e.expanded,"aria-label":"rdw-color-picker"},r.createElement("div",{className:"rdw-option-wrapper cv-annotation-toolbar-option cv-annotation-link",onClick:e.onExpandEvent}," "),e.expanded&&r.createElement("div",{className:"rdw-link-modal",onClick:function(e){return e.stopPropagation()}},r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"cv-annotation-url"},"URL"),r.createElement("input",{id:"cv-annotation-url",className:"form-control",onChange:function(e){return i(e.target.value)},value:n,placeholder:"Enter URL",autoComplete:"off"})),r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"cv-annotation-text"},"Text"),r.createElement("input",{id:"cv-annotation-text",className:"form-control",onChange:function(e){return c(e.target.value)},value:a,placeholder:"Enter Text",autoComplete:"off"})),r.createElement(S.L,{onClick:function(){return e.onChange("link",a||n,n,"_blank")},className:"btn btn-dark"},"Add")))}function ar(e){return ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ar(e)}function cr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return lr(e,t);var n={}.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)?lr(e,t):void 0}}(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 lr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sr(){sr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ar(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ar(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ur(e){return ur="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},ur(e)}function fr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dr(e,t);var n={}.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)?dr(e,t):void 0}}(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 dr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pr(){pr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ur(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ur(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var mr=n(43823);function hr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var vr=!0;function yr(){var e=function(){var e,t,n=(e=r.useState(vr),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hr(e,t);var n={}.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)?hr(e,t):void 0}}(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.")}()),i=n[0],o=n[1],a=mr.Radio.channel("video:drag:drop:lock");function c(){o(vr)}return r.useEffect((function(){if(vr)return a.on("update",c),function(){a.off("update",c)}}),[]),{enabled:i,disable:function(){vr=!1,a.trigger("update")},enable:function(){vr=!0,a.trigger("update")}}}(),t=e.enable,n=e.disable;r.useEffect((function(){return n(),function(){return t()}}),[])}var gr=n(51547),br=n(99828),wr={onFileSelect:function(e,t,n,r){if(t&&t.length)if(t.length>1)alert("Please only select one file");else{var i=t[0];if(i.type.startsWith("image/")){var o=new FileReader;o.addEventListener("load",(function(){return wr.onReaderLoad(o,e,n,r)})),o.readAsDataURL(i)}else alert("Please select an image file")}},onReaderLoad:function(e,t,n,r){var i,o,a=new Image;a.src=e.result;var c=null!==(i=null==r?void 0:r.width)&&void 0!==i?i:br.y[t].width,s=null!==(o=null==r?void 0:r.height)&&void 0!==o?o:br.y[t].height;a.addEventListener("load",(function(){wr.isImageValid(t,a,r)&&l.q.isFunction(n)?n(a):alert("Image too small: minimum dimensions are ".concat(c," x ").concat(s))}))},isImageValid:function(e,t,n){var r,i,o=null!==(r=null==n?void 0:n.width)&&void 0!==r?r:br.y[e].width,a=null!==(i=null==n?void 0:n.height)&&void 0!==i?i:br.y[e].height;return!(o&&t.width<o||a&&t.height<a)},mapImageTypeToString:function(e){switch(e){case Te.__.Avatars:return"avatars";case Te.__.Thumbnails:return"thumbnails";case Te.__.Logos:return"logos";case Te.__.Covers:return"covers";case Te.__.Posters:return"posters";case Te.__.TallPosters:return"tallposters";case Te.__.HeroBanners:return"herobanners";case Te.__.None:default:return""}}};function Er(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Sr(e,t);var n={}.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)?Sr(e,t):void 0}}(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 Sr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function kr(e){var t=Er(r.useState(!1),2),n=t[0],i=t[1],o=Er(r.useState(0),2),a=o[0],c=o[1];return r.useEffect((function(){0===a&&n&&i(!1)}),[a,n,i]),r.createElement("div",{onDragOver:function(e){e.preventDefault(),e.stopPropagation()},onDragEnter:function(e){e.preventDefault(),e.stopPropagation(),c((function(e){return e+1})),e.dataTransfer.items&&e.dataTransfer.items.length>0&&!n&&i(!0)},onDragLeave:function(e){e.preventDefault(),e.stopPropagation(),c((function(e){return e-1}))},onDrop:function(t){t.preventDefault(),t.stopPropagation(),i(!1),a>0&&c(0),t.dataTransfer.files&&t.dataTransfer.files.length>0&&(e.onDropImage(t.dataTransfer.files),t.dataTransfer.clearData())},className:n?e.dragClassName:""},e.children)}function xr(e){return xr="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},xr(e)}function Or(){Or=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==xr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(xr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Cr(e){return Cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cr(e)}function Nr(){Nr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Cr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Cr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var jr=/[.\?!,;:\-''\(\)]/g;function Pr(e){for(var t=e.split("");t.length&&t[0].match(jr);)t.shift();for(;t.length&&t[t.length-1].match(jr);)t.pop();return t.join("")}function Ir(e,t){for(var n=e.split(""),r=[],i=[];n.length&&n[0].match(jr);)r.push(n.shift());for(;n.length&&n[n.length-1].match(jr);)i.unshift(n.pop());return r.join("")+t+i.join("")}function Lr(e){return e.map((function(e){if(!e.selected)return e.text;var t=Pr(e.text).length,n=new Array(t).fill("_").join("");return Ir(e.text,n)})).join(" ")}function Tr(e){return e.map((function(e){var t;return e.selected?null===(t=Ir(e.text,"{".concat(e.order,"}")))||void 0===t?void 0:t.trim():e.text})).join(" ")}var _r=n(21326);function Ar(e){return r.createElement(_r.u,{title:e.tooltipText,spanHack:!0,spanHackClassName:"d-inline-block"},r.createElement(k.x,{svgName:O.vn.Info}))}function Fr(){return r.createElement("svg",{viewBox:"0 0 43 38",className:"cv-upload-image-icon"},r.createElement("g",{transform:"translate(-1193.000000, -185.000000)"},r.createElement("g",{transform:"translate(1183.000000, 173.000000)"},r.createElement("path",{d:"M49.875,12.9166667 C51.3247475,12.9166667 52.5,14.0732644 52.5,15.5 L52.5,46.5 C52.5,47.9267356 51.3247475,49.0833333 49.875,49.0833333 L13.125,49.0833333 C11.6752525,49.0833333 10.5,47.9267356 10.5,46.5 L10.5,15.5 C10.5,14.0732644 11.6752525,12.9166667 13.125,12.9166667 L49.875,12.9166667 Z M49.875,15.5 L13.125,15.5 L13.125,46.5 L49.875,46.5 L49.875,15.5 Z M35.5085905,22.5470241 L45.7260956,38.0470241 C46.1206004,38.6454897 45.9474325,39.445375 45.3393142,39.8336178 C44.731196,40.2218607 43.9184093,40.0514415 43.5239044,39.4529759 L34.3641741,25.5576247 L29.9489593,31.7425222 C29.4803332,32.3989804 28.5233602,32.4806343 27.9469223,31.9133463 L26.3920049,30.38311 L19.425,39.525 C18.9900758,40.0956942 18.167399,40.211354 17.5875,39.7833333 C17.007601,39.3553127 16.8900758,38.5456942 17.325,37.975 L25.2,27.6416667 C25.6792326,27.0128323 26.6132966,26.9475041 27.1780777,27.5033204 L28.6987913,28.9998957 L33.3335357,22.5074778 C33.8680838,21.758675 35.0025121,21.7793009 35.5085905,22.5470241 Z M21,19.375 C23.1746212,19.375 24.9375,21.1098966 24.9375,23.25 C24.9375,25.3901034 23.1746212,27.125 21,27.125 C18.8253788,27.125 17.0625,25.3901034 17.0625,23.25 C17.0625,21.1098966 18.8253788,19.375 21,19.375 Z M21,21.9583333 C20.2751263,21.9583333 19.6875,22.5366322 19.6875,23.25 C19.6875,23.9633678 20.2751263,24.5416667 21,24.5416667 C21.7248737,24.5416667 22.3125,23.9633678 22.3125,23.25 C22.3125,22.5366322 21.7248737,21.9583333 21,21.9583333 Z",id:"Combined-Shape"}))))}function Dr(e){var t,n,i=r.useRef(null),o=r.useRef(null);function a(){e.onChange(Object.assign(Object.assign({},e.answer),{isCorrect:!e.answer.isCorrect}))}function c(t){e.isTrueOrFalse||t&&t[0]&&wr.onFileSelect(Te.__.None,t,(function(e){gr.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:l})}))}function l(t,n){var r=t.split(",")[1];Y.e.post("".concat(e.imageApi,"v2/thumbnails/base64"),'"'.concat(r,'"'),{tokenName:"gateway"}).then((function(t){e.onChange(Object.assign(Object.assign({},e.answer),{data:{imageUrl:t.location}})),n()})).catch((function(){return alert("Something went wrong while trying to upload image. Please try again.")}))}return r.createElement(kr,{onDropImage:c,dragClassName:"cv-multiple-choice-upload-mask"},r.createElement("div",{className:"p-2 my-1 w-100 bg-white d-flex align-items-center rounded cv-multiple-choice-answer"},r.createElement("div",{className:"form-check",onKeyDown:function(e){return"Enter"===e.key&&a()}},r.createElement("input",{id:"multiple-choice--".concat(e.answer.order),type:e.isTrueOrFalse?"radio":"checkbox",className:"form-check-input me-2",name:"multiple-choice-answer",checked:e.answer.isCorrect,onChange:a,disabled:!e.answer.name&&!(null===(t=e.answer.data)||void 0===t?void 0:t.imageUrl),"aria-label":"Correct answer ".concat(e.answer.order)}),r.createElement("label",{ref:i,htmlFor:"multiple-choice--".concat(e.answer.order),className:"cursor-pointer form-check-label"})),e.isTrueOrFalse?r.createElement("label",{className:"mb-0",htmlFor:"multiple-choice--".concat(e.answer.order)},e.answer.name):r.createElement("input",{placeholder:"Answer",onChange:function(t){e.onChange(Object.assign(Object.assign({},e.answer),{name:t.target.value}))},value:e.answer.name,className:"border-0 outline-none w-100 me-2",autoComplete:"off"}),!e.isTrueOrFalse&&r.createElement(r.Fragment,null,r.createElement("input",{type:"file",className:"file-select d-none",multiple:!1,accept:"image/jpg,image/jpeg,image/png",ref:o,onChange:function(e){return c(e.target.files)}}),(null===(n=e.answer.data)||void 0===n?void 0:n.imageUrl)?r.createElement(_r.u,{key:"1",title:"Remove image",spanHack:!0,spanHackClassName:"mt-n2 mb-n2 me-n2"},r.createElement(S.L,{type:"button",className:"cv-multiple-choice-create-image rounded-end bg-gray-400",style:{backgroundImage:"url(".concat(e.answer.data.imageUrl,")")},onClick:function(){e.onChange(Object.assign(Object.assign({},e.answer),{data:void 0}))}},r.createElement("span",{className:"cv-multiple-choice-remove-image"},r.createElement(k.x,{svgName:O.vn.Delete})))):r.createElement(_r.u,{key:"2",title:"Upload an image",spanHack:!0},r.createElement(S.L,{type:"button",className:"svg-container",onClick:function(){o.current.value=null,o.current.click(null)}},r.createElement(Fr,null))))))}function Rr(e){return Rr="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},Rr(e)}function Mr(){Mr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Rr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Rr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ur(e){var t,n;if(!(null===(t=e.question)||void 0===t?void 0:t.trim()))return"Please provide a question";if((null===(n=e.question)||void 0===n?void 0:n.trim().length)>500)return"Max question length is ".concat(500," characters");if(!e.answers.find((function(e){return e.isCorrect})))return"Please select the correct answer";if(e.answers.find((function(e){var t;return(null===(t=e.name)||void 0===t?void 0:t.length)>255})))return"Max answer length is ".concat(255," characters");var r=e.answers.filter((function(e){var t,n;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())||!!(null===(n=e.data)||void 0===n?void 0:n.imageUrl)}));if(r.length<2)return"Please provide at least two answers";var i=e.answers.filter((function(e){var t;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())}));if(i.length&&i.length!==r.length)return"Please add text to every question or none of the questions.";var o=!1,a={};if(i.forEach((function(e){o||(a[e.name]?o=!0:a[e.name]=!0)})),o)return"There are duplicates in your answers";var c=r.filter((function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.imageUrl})).length;return c&&c<r.length?"Please add an image to all answers":null}function Vr(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=Mr().mark((function r(){return Mr().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t.name=null===(n=e.question)||void 0===n?void 0:n.trim(),t.actionableItems=e.answers.filter((function(e){var t,n;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())||!!(null===(n=e.data)||void 0===n?void 0:n.imageUrl)})),e.feedback&&(t.data.feedback=e.feedback),r.next=5,tr.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))}function Br(e){var t=e.state,n=void 0===t?function(e){var t,n=e.typeId===x.Z9.TrueOrFalse,r=null===(t=e.actionableItems)||void 0===t?void 0:t.map((function(e){return{order:e.order,name:e.name,isCorrect:e.isCorrect,data:e.data?{imageUrl:e.data.imageUrl}:null}}));return(null==r?void 0:r.length)?!n&&(null==r?void 0:r.length)<4&&r.push({order:r.length,name:"",isCorrect:!1,data:null}):r=[{order:0,name:n?"True":"",isCorrect:!1,data:null},{order:1,name:n?"False":"",isCorrect:!1,data:null}],{question:e.name||"",answers:r,feedback:e.data.feedback||""}}(e.interaction):t,i=e.setState,o=e.interaction,a=e.optionsPortalNode,c=e.showFeedback,l=o.typeId===x.Z9.TrueOrFalse;function s(e){var t,r,o=n.answers.map((function(t){return t.order!==e.order?Object.assign(Object.assign({},t),{isCorrect:!l&&t.isCorrect}):e}));if(o.find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)}))&&(r=(t=o).find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)})),o=t.length>2?t.filter((function(e){return e.order!==r.order})).map((function(e,t){return Object.assign(Object.assign({},e),{order:t})})):t.map((function(e){return e.order!==r.order?e:Object.assign(Object.assign({},e),{isCorrect:!1})}))),!l&&o.length<4&&!o.find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)}))){var a=Ze.m.last(o);o.push({name:"",order:a.order+1,isCorrect:!1,data:void 0})}i(Object.assign(Object.assign({},n),{answers:o}))}return yr(),r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"multiple-choice-question"},"Question"),r.createElement(Pe.t0,{node:a})),r.createElement("input",{id:"multiple-choice-question",className:"form-control",placeholder:"Enter your question here",value:n.question,onChange:function(e){i(Object.assign(Object.assign({},n),{question:e.target.value}))},autoComplete:"off"}),!n.question&&r.createElement(Hn,{error:n.error})),r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"multiple-choice-answer"},l?r.createElement(r.Fragment,null,"Answer"):r.createElement(r.Fragment,null,"Answers")),r.createElement("ul",{className:"list-unstyled"},n.answers.map((function(t){return r.createElement("li",{key:t.order},r.createElement(Dr,{answer:t,onChange:s,isTrueOrFalse:l,imageApi:e.imageApi}))}))),n.question&&r.createElement(Hn,{error:n.error})),c&&l&&r.createElement("div",{className:"form-group mb-0"},r.createElement("label",{className:"cv-interaction-field-label d-flex justify-content-between align-items-end",htmlFor:"true-or-false-feedback"},r.createElement("span",null,"Feedback  ",r.createElement("small",{className:"text-secondary"},"(optional)")),r.createElement(Ar,{tooltipText:"Provide answer feedback for your students"})),r.createElement(Ft.Z,{id:"true-or-false-feedback",className:"form-control",minRows:2,value:n.feedback||"",onChange:function(e){i(Object.assign(Object.assign({},n),{feedback:e.target.value}))},placeholder:"Give feedback for this question"})))}function qr(e){return qr="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},qr(e)}function Gr(){Gr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==qr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(qr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var Zr,zr="Please provide a question",Hr="Max question length is ".concat(255," characters"),Wr="Max answer length is ".concat(4e3," characters");function Qr(e){return Qr="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},Qr(e)}function Yr(e,t,n){return(t=function(e){var t=function(e){if("object"!=Qr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Qr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e[e.QUESTION=0]="QUESTION",e[e.ANSWER=1]="ANSWER"}(Zr||(Zr={}));var Kr=Yr(Yr(Yr(Yr(Yr(Yr(Yr({},x.Z9.Annotation,(function(e){var t=e.state,n=void 0===t?function(e){var t;return{annotation:(null===(t=e.data)||void 0===t?void 0:t.annotation)||""}}(e.interaction):t,i=e.setState,o=e.interaction,a=e.optionsPortalNode,c=cr(r.useState(function(){var e=o.data.annotation;if(e){var t=(0,Zn.h4)(nr)(e);return zn.EditorState.createWithContent(t)}return zn.EditorState.createEmpty()}()),2),l=c[0],s=c[1],u=cr(r.useState(null),2),f=u[0],d=u[1];return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center"},r.createElement("label",{className:"cv-interaction-field-label",onClick:function(){return null==f?void 0:f.focusEditor()}},"Annotation"),r.createElement(Pe.t0,{node:a})),r.createElement("div",{className:"cv-annotation ".concat(function(){if(!l)return!1;var e=l.getCurrentContent();return e.hasText()||"unstyled"!==e.getBlockMap().first().getType()}()?"Editor--hide-placeholder":"")},l&&r.createElement(Gn.Editor,{editorState:l,onEditorStateChange:function(e){s(e);var t=e.getCurrentContent();if(t.hasText()){var r=(0,Zn.cn)(nr)(t);i(Object.assign(Object.assign({},n),{annotation:r}))}else i(Object.assign(Object.assign({},n),{annotation:""}))},toolbarClassName:"cv-annotation-toolbar",editorClassName:"form-control cv-annotation-editor",ref:d,placeholder:"Enter your annotation here",spellCheck:!0,toolbar:{options:["inline","list","link"],inline:{options:["bold","italic","underline","superscript","subscript"],bold:{className:"cv-annotation-toolbar-option cv-annotation-bold",icon:""},italic:{className:"cv-annotation-toolbar-option cv-annotation-italic",icon:""},underline:{className:"cv-annotation-toolbar-option cv-annotation-underline",icon:""},superscript:{className:"cv-annotation-toolbar-option cv-annotation-superscript",icon:""},subscript:{className:"cv-annotation-toolbar-option cv-annotation-subscript",icon:""}},list:{options:["unordered","ordered"],unordered:{className:"cv-annotation-toolbar-option cv-annotation-bullet-list",icon:""},ordered:{className:"cv-annotation-toolbar-option cv-annotation-number-list",icon:""}},link:{component:or,options:["link"]}}}),r.createElement(Hn,{error:n.error}))))})),x.Z9.Image,(function(e){var t=e.state,n=void 0===t?function(e){var t;return{url:(null===(t=e.data)||void 0===t?void 0:t.url)||"",caption:e.data.caption}}(e.interaction):t,i=e.setState,o=e.interaction,a=e.optionsPortalNode;yr();var c=r.useRef(null);function l(e){e&&e[0]&&wr.onFileSelect(Te.__.None,e,(function(e){gr.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:s})}))}function s(t,r){var o=t.split(",")[1];Y.e.post("".concat(e.imageApi,"v2/thumbnails/base64"),'"'.concat(o,'"'),{tokenName:"gateway"}).then((function(e){i(Object.assign(Object.assign({},n),{url:e.location})),r()})).catch((function(){return alert("Something went wrong while trying to upload image. Please try again.")}))}return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center mb-2"},r.createElement("label",{className:"cv-interaction-field-label"},"Image"),r.createElement(Pe.t0,{node:a})),n.url?r.createElement("div",{className:"text-center"},r.createElement("div",{className:"cv-uploaded-image-container"},r.createElement("img",{className:"img img-fluid rounded",src:n.url,alt:n.caption}),r.createElement(S.L,{className:"cv-remove-uploaded-image d-flex justify-content-center align-items-center",onClick:function(){i(Object.assign(Object.assign({},n),{url:""}))}},r.createElement("div",{className:"btn btn-link text-light"},"Remove")))):r.createElement(kr,{onDropImage:l,dragClassName:"cv-image-upload-mask"},r.createElement("div",{className:"cv-image-interaction-upload-container bg-white rounded py-3 text-center"},r.createElement("div",{className:"cv-upload-scenery-image mx-auto"}),r.createElement("p",{className:"mb-0"},"Drag and drop an image file or"),r.createElement(S.L,{type:"button",className:"text-underline d-inline-block",onClick:function(){c.current.value=null,c.current.click(null)}},"upload from your device"),r.createElement("input",{type:"file",className:"file-select d-none",multiple:!1,accept:"image/jpg,image/jpeg,image/png",ref:c,onChange:function(e){return l(e.target.files)}}))),r.createElement(Hn,{error:n.error})),r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"image-caption"},"Caption  ",r.createElement("small",{className:"text-secondary"},"(optional)")),r.createElement("textarea",{id:"image-caption",className:"form-control",placeholder:"Caption your image",value:n.caption||o.data.caption||"",onChange:function(e){i(Object.assign(Object.assign({},n),{caption:e.target.value}))},rows:2})))})),x.Z9.MissingWord,(function(e){var t,n,i,o,a,c,l=e.state,s=void 0===l?(o=(null===(n=(t=e.interaction).data)||void 0===n?void 0:n.sentence)||"",a=o.split(" ").filter(Boolean),c=a.map((function(e,t){return{text:e,order:t,selected:!1}})),null===(i=t.actionableItems)||void 0===i||i.forEach((function(e){var t=e.order,n=Ir(a[t],e.name);a[t]=n,c[t].text=n,c[t].selected=!0})),{fullSentence:a.join(" "),sentence:o,preview:t.name,words:c}):l,u=e.setState,f=e.optionsPortalNode,d=!!s.sentence;return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"missing-word-sentence"},"Sentence"),r.createElement(Pe.t0,{node:f})),r.createElement("input",{id:"missing-word-sentence",className:"form-control",placeholder:"Enter your sentence here",value:s.fullSentence||"",onChange:function(e){var t=e.target.value,n=t.split(" ").filter(Boolean).map((function(e,t){return{text:e,order:t,selected:!1}}));u(Object.assign(Object.assign({},s),{fullSentence:t,sentence:Tr(n),preview:Lr(n),words:n}))},autoComplete:"off"})),d&&r.createElement(r.Fragment,null,r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label"},"Select the missing word(s)"),r.createElement("ul",{className:"list-unstyled d-flex flex-wrap mx-n1 mb-n1"},s.words.map((function(e,t){var n;return(null===(n=Pr(e.text))||void 0===n?void 0:n.trim())?r.createElement("li",{key:"".concat(t,"-").concat(e.text)},r.createElement(S.L,{className:"rounded border p-2 mx-1 mb-1 cursor-pointer ".concat(e.selected?"bg-dark text-white":"bg-white"),onClick:function(){return e=t,n=s.words.map((function(t){return t.order!==e?t:Object.assign(Object.assign({},t),{selected:!t.selected})})),void u(Object.assign(Object.assign({},s),{words:n,preview:Lr(n),sentence:Tr(n)}));var e,n}},Pr(e.text))):r.createElement(r.Fragment,{key:"".concat(t,"-").concat(e.text)})})))),r.createElement("div",null,r.createElement("label",{className:"cv-interaction-field-label"},"Preview"),r.createElement("p",null,s.preview))),r.createElement(Hn,{error:s.error}))})),x.Z9.MultipleChoice,Br),x.Z9.ShortAnswer,(function(e){var t=e.state,n=void 0===t?function(e){return{question:e.name,suggestedResponse:e.data.suggestedResponse||""}}(e.interaction):t,i=e.setState,o=e.interaction,a=e.optionsPortalNode,c=e.showFeedback;function l(){switch(n.error){case zr:case Hr:return Zr.QUESTION;case Wr:return Zr.ANSWER}}return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"short-answer-question"},"Question"),r.createElement(Pe.t0,{node:a})),r.createElement("input",{id:"short-answer-question",className:"form-control",onChange:function(e){i(Object.assign(Object.assign({},n),{question:e.target.value}))},value:n.question||o.data.text||"",placeholder:"Enter your question here",autoComplete:"off","aria-errormessage":"question-error"}),l()===Zr.QUESTION&&r.createElement(Hn,{id:"question-error",error:n.error})),c&&r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label d-flex justify-content-between align-items-end",htmlFor:"short-answer-suggested-response"},r.createElement("span",null,"Suggested Response  ",r.createElement("small",{className:"text-secondary"},"(optional)")),r.createElement(Ar,{tooltipText:"Provide a suggested response for your students"})),r.createElement(Ft.Z,{id:"short-answer-suggested-response",className:"form-control",minRows:2,value:n.suggestedResponse||"",onChange:function(e){i(Object.assign(Object.assign({},n),{suggestedResponse:e.target.value}))},placeholder:"Give a suggested response for this question","aria-errormessage":"answer-error"}),l()===Zr.ANSWER&&r.createElement(Hn,{id:"answer-error",error:n.error})))})),x.Z9.TrueOrFalse,Br),x.Z9.Illustration,(function(e){var t=fr(r.useState(),2),n=t[0],i=t[1],o=fr(r.useState(!1),2),a=o[0],c=o[1],l=e.state,s=void 0===l?{question:e.interaction.name}:l,u=e.setState,f=e.optionsPortalNode;return r.createElement("div",{className:"cv-interactive-question"},r.createElement("fieldset",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"illustration-question"},"Prompt"),r.createElement(Pe.t0,{node:f})),r.createElement("input",{id:"illustration-question",className:"form-control",onChange:function(e){u(Object.assign(Object.assign({},s),{question:e.target.value}))},value:s.question||"",placeholder:"Enter your prompt here",autoComplete:"off","aria-invalid":!!s.error,"aria-errormessage":"illustrationQuestionError"}),r.createElement(Hn,{id:"illustrationQuestionError",error:s.error})),r.createElement("div",{className:"alert text-dark bg-light-blue px-2 rounded-3"},"Students attempting this question will be prompted to draw their answer. ",r.createElement(S.L,{onClick:function(){return c(!0)},className:"btn-link text-underline d-inline"},"Preview how students will answer.")),a&&r.createElement(Pe.Nq,{node:e.fullWidthPortalNode},r.createElement(xt,{interaction:Object.assign(Object.assign({},e.interaction),{name:s.question}),onSave:function(e){i(e),c(!1)},onCancel:function(){return c(!1)}})),n&&r.createElement("img",{className:"img-fluid border rounded mt-2 w-50 d-block",src:n,alt:"Illustration you just created."}))})),$r=Yr(Yr(Yr(Yr(Yr(Yr(Yr({},x.Z9.Annotation,(function(e){var t,n;return(null===(t=e.annotation)||void 0===t?void 0:t.trim())?(null===(n=e.annotation)||void 0===n?void 0:n.trim()).replace(/<[^>]*>/g,"").length>3500?"Max length is ".concat(3500," characters"):null:"Please provide an annotation"})),x.Z9.Image,(function(e){return e.url?null:"Please upload an image"})),x.Z9.MissingWord,(function(e){var t,n;return(null===(t=e.sentence)||void 0===t?void 0:t.trim())?(null===(n=e.sentence)||void 0===n?void 0:n.trim().length)>255?"Max length is ".concat(255," characters"):e.words.find((function(e){return e.selected}))?null:"Please select a missing word":"Please provide a sentence"})),x.Z9.MultipleChoice,Ur),x.Z9.ShortAnswer,(function(e){var t,n,r;return(null===(t=e.question)||void 0===t?void 0:t.trim())?(null===(n=e.question)||void 0===n?void 0:n.trim().length)>255?Hr:(null===(r=e.suggestedResponse)||void 0===r?void 0:r.trim().length)>4e3?Wr:null:zr})),x.Z9.TrueOrFalse,Ur),x.Z9.Illustration,(function(e){var t;return(null===(t=e.question)||void 0===t?void 0:t.trim())?null:"Please provide a question"})),Xr=Yr(Yr(Yr(Yr(Yr(Yr(Yr({},x.Z9.Annotation,(function(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=sr().mark((function r(){return sr().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t.name="Annotation",t.data.annotation=null===(n=e.annotation)||void 0===n?void 0:n.trim(),t.actionableItems=[{name:"Answer"}],r.next=5,tr.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))})),x.Z9.Image,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=Or().mark((function i(){return Or().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return t.data.url=e.url,t.name=(null===(n=e.caption)||void 0===n?void 0:n.trim())||"Image",t.data.caption=null===(r=e.caption)||void 0===r?void 0:r.trim(),t.actionableItems=[{name:"Answer"}],i.next=6,tr.saveInteraction(t);case 6:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}))})),x.Z9.MissingWord,(function(e,t){return n=this,r=void 0,i=void 0,o=Nr().mark((function n(){var r;return Nr().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.data.sentence=Tr(e.words),t.name=e.preview,r=e.words.filter((function(e){return e.selected})),t.actionableItems=r.map((function(e){return{name:Pr(e.text),order:e.order,isCorrect:!0}})),n.next=6,tr.saveInteraction(t);case 6:case"end":return n.stop()}}),n)})),new(i||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function c(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}l((o=o.apply(n,r||[])).next())}));var n,r,i,o})),x.Z9.MultipleChoice,Vr),x.Z9.ShortAnswer,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=Gr().mark((function i(){return Gr().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return t.name=null===(n=e.question)||void 0===n?void 0:n.trim(),t.data.suggestedResponse=null===(r=e.suggestedResponse)||void 0===r?void 0:r.trim(),t.actionableItems=[{name:"Answer"}],i.next=5,tr.saveInteraction(t);case 5:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}))})),x.Z9.TrueOrFalse,Vr),x.Z9.Illustration,(function(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=pr().mark((function r(){return pr().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t.name=null===(n=e.question)||void 0===n?void 0:n.trim(),t.actionableItems=[{name:"Answer"}],r.next=4,tr.saveInteraction(t);case 4:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))}));function Jr(e){return Xr[e]}function ei(e){return ei="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},ei(e)}function ti(){ti=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ei(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ei(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ni(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ri(e,t);var n={}.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)?ri(e,t):void 0}}(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 ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ii=null,oi=0,ai=1;function ci(e){var t=e.timepoint,n=e.updateTimepointTime,i=e.saveTimepoint,o=e.back,a=e.clearTimepointTimeState,c=ni(r.useState((0,bn.m)(t.visibleAt/1e3)),2),l=c[0],s=c[1],u=ni(r.useState(!1),2),f=u[0],d=u[1];function p(e){n(e*ai),s((0,bn.m)(t.visibleAt/1e3)),2==++oi?ai=5:4===oi?ai=20:6===oi?ai=60:8===oi&&(ai=120),ii||(ii=window.setInterval((function(){return p(e)}),200),window.addEventListener("mouseup",m))}function m(){window.removeEventListener("mouseup",m),window.clearInterval(ii),ii=null,oi=0,ai=1}return r.useEffect((function(){return m}),[]),r.createElement(r.Fragment,null,r.createElement("div",{className:"cv-timepoint flex-grow-1"},r.createElement("div",{className:"cv-timepoint-padding"},r.createElement("div",{className:"cv-interactive-question"},r.createElement("label",{htmlFor:"move-time-point",className:"cv-interaction-field-label mb-0"},"Move time point"),r.createElement("div",{className:"text-center mt-3"},r.createElement(S.L,{className:"cv-left-arrow d-inline-block cursor-pointer",onClick:function(){},onMouseDown:function(){return p(-1)},onKeyDown:function(e){e.stopPropagation(),13===e.keyCode&&0===oi&&p(-1)},onKeyUp:m}),r.createElement("input",{id:"move-time-point",className:"form-control text-center d-inline-block cv-move-timepoint-input",value:l,onChange:function(){},onKeyDown:function(e){e.stopPropagation(),37===e.keyCode&&0===oi&&p(-1),39===e.keyCode&&0===oi&&p(1)},onKeyUp:m}),r.createElement(S.L,{className:"cv-right-arrow d-inline-block cursor-pointer",onClick:function(){},onMouseDown:function(){return p(1)},onKeyDown:function(e){e.stopPropagation(),13===e.keyCode&&0===oi&&p(1)},onKeyUp:m}))))),r.createElement("div",{className:"cv-timpoint-button-container"},r.createElement(S.L,{className:"btn btn-link",onClick:function(){a(!0),o()}},"Cancel"),f?r.createElement(S.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(je.Z,{as:"span",animation:"border",role:"status",size:"sm"})):r.createElement(S.L,{className:"btn btn-dark",onClick:function(){return e=this,t=void 0,n=void 0,r=ti().mark((function e(){return ti().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d(!0),e.next=3,i();case 3:o();case 4:case"end":return e.stop()}}),e)})),new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}},"Save")))}var li=n(20455),si=n(95339),ui=n(67445);function fi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function di(e){var t,n,i=(t=r.useState(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return fi(e,t);var n={}.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)?fi(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1],c=(0,li.Dy)((0,li.VT)(li.we,{activationConstraint:{distance:10}}),(0,li.VT)(li.Lg,{coordinateGetter:ui.is}));return e.disabled?r.createElement(r.Fragment,null,e.children):r.createElement(li.LB,{sensors:c,collisionDetection:li.pE,onDragStart:function(t){var n;a(t.active.id),null===(n=e.onSortStart)||void 0===n||n.call(e,t)},onDragEnd:function(t){a(null),e.onSortEnd(t)},modifiers:e.vertical?[si.DL]:[]},r.createElement(ui.Fo,{items:e.ids,strategy:e.vertical?ui.qw:ui.U2},e.children),r.createElement(li.y9,{dropAnimation:e.dropAnimation},o?e.getDragOverlay(o):null))}di.defaultProps={dropAnimation:{duration:250,easing:"ease"},vertical:!0};var pi=n(17592);function mi(e){var t=(0,ui.nB)({id:e.id}),n=t.setNodeRef,i=t.transform,o=t.transition,a=t.isSorting,c=t.listeners,l=t.attributes,s=t.activeIndex,u=t.overIndex,f=t.index,d={transform:pi.ux.Transform.toString(i),transition:o,touchAction:"none",position:"relative"};a&&f===s&&(d.visibility="hidden");var p=e.childComponent,m=function(e,t,n){return t!==e?null:n>t?"down":n<t?"up":null}(f,s,u);return r.createElement(p,Object.assign({},e.childProps,{ref:n,style:d,dragListeners:c,dragAttributes:l,dragDirection:m}))}function hi(e){return hi="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},hi(e)}function vi(){vi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==hi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(hi(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function yi(e){return function(e){if(Array.isArray(e))return wi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||bi(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 gi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||bi(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 bi(e,t){if(e){if("string"==typeof e)return wi(e,t);var n={}.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)?wi(e,t):void 0}}function wi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ei=function(e){var t=e.interaction,n=N.w.getTypeInfo(t.typeId).bgClassName,i=r.forwardRef((function(e,i){return r.createElement("div",Object.assign({className:"py-2 text-start"},e.dragAttributes,e.dragListeners,{ref:i,style:e.style}),r.createElement("span",{className:"fB8W8"},r.createElement(k.x,{size:k.S.Small,svgName:O.vn.Handle})),r.createElement(I,{interaction:t,iconClassName:"".concat("GSE1a"," ").concat(n),questionClassName:"".concat("qKMzc"," clamp-1")}))}));return r.createElement(mi,{id:t.id,childComponent:i,childProps:{}})},Si=function(e){var t=e.interactions,n=function(){var e=r.useRef(null);function t(){document.body.style.cursor="",document.removeEventListener("mouseup",t),e.current&&(e.current.style.cursor="grab")}return{ref:e,style:{cursor:"grab"},onMouseDown:function(){document.body.style.cursor="grabbing",document.addEventListener("mouseup",t),e.current&&(e.current.style.cursor="grabbing")},onMouseUp:t}}();return r.createElement(di,{ids:t.map((function(e){return e.id})),getDragOverlay:function(e){return r.createElement(Ei,{key:e,interaction:t.find((function(t){return t.id===e}))})},onSortEnd:e.onSortEnd},r.createElement("div",Object.assign({tabIndex:0},n),t.map((function(e){return r.createElement(Ei,{key:e.id,interaction:e})}))))};function ki(e){var t=gi(r.useState(!1),2),n=t[0],i=t[1],o=gi(r.useState(yi(e.interactions)),2),a=o[0],c=o[1],l=gi(r.useState(!1),2),s=l[0],u=l[1];return r.createElement(r.Fragment,null,r.createElement("div",{className:"cv-timepoint flex-grow-1"},r.createElement("div",{className:"cv-timepoint-padding"},r.createElement("div",{className:"cv-interactive-question"},r.createElement("label",{className:"cv-interaction-field-label mb-0"},"Re-order questions"),r.createElement("div",{className:"text-center mt-3"},r.createElement(Si,{onSortEnd:function(e){var t=e.active,n=e.over,r=a.findIndex((function(e){return e.id.toString()===t.id.toString()})),i=a.findIndex((function(e){return e.id.toString()===n.id.toString()}));r!==i&&(c(yi(function(e,t,n){for(;t<0;)t+=e.length;for(;n<0;)n+=e.length;if(n>=e.length)for(var r=n-e.length+1;r--;)e.push(void 0);return e.splice(n,0,e.splice(t,1)[0]),e}(a,r,i))),u(!0))},interactions:a}))))),r.createElement("div",{className:"cv-timpoint-button-container"},r.createElement(S.L,{className:"btn btn-link",onClick:function(){c(yi(e.interactions)),u(!1),e.back()}},"Cancel"),n?r.createElement(S.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(je.Z,{as:"span",animation:"border",role:"status",size:"sm"})):r.createElement(S.L,{className:"btn btn-dark ".concat(s?"":"disabled"),onClick:function(){return t=this,n=void 0,r=void 0,o=vi().mark((function t(){return vi().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s){t.next=2;break}return t.abrupt("return");case 2:return i(!0),t.next=5,e.reOrderQuestions(a);case 5:i(!1),e.back();case 7:case"end":return t.stop()}}),t)})),new(r||(r=Promise))((function(e,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function c(e){try{l(o.throw(e))}catch(e){i(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,c)}l((o=o.apply(t,n||[])).next())}));var t,n,r,o}},"Save")))}function xi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Oi(e,t);var n={}.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)?Oi(e,t):void 0}}(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 Oi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ci(e){var t=e.isCreate,n=e.interaction,i=e.mode,o=e.immediateFeedback,a=e.interactionState,c=e.shouldFocus,l=e.delayFocus,s=e.open,u=e.timepoint,f=e.userUpdateInteractionState,d=e.submitInteractionAnswer,p=e.saveInteraction,m=e.skip,h=r.useRef(null),v=r.useRef(null),y=r.useRef(0),g=(0,gn.a)(yn.r.XLDown),b=!t||g;function w(){return!!h.current&&!!c&&!!s}function E(){h.current&&(h.current.focus(),x(!0))}var S=xi(r.useState(!1),2),k=S[0],x=S[1];r.useEffect((function(){w()&&(k||(l&&b?y.current=window.setTimeout((function(){y.current=0,w()&&E()}),400):E()))}),[h.current,k]);var O=xi(r.useState("question"),2),C=O[0],N=O[1],j=r.useMemo((function(){return(0,Pe.oD)()}),[]),P=n?function(e,t){if(t===R.Create)return function(e){return Kr[e]}(e);if(t===R.View)return function(e){return Zt[e]}(e);throw new Error("Cannot find components for the mode ".concat(t))}(n.typeId,i):null,I=o;return t||(I=I&&(null==a?void 0:a.submitted)),r.createElement(r.Fragment,null,r.createElement(On,Object.assign({optionsPortalNode:j,setView:N},e)),r.createElement(Xe.Z,{className:"h-100",ref:v},r.createElement(kn,Object.assign({},e)),!!n&&r.createElement("div",{className:"d-flex flex-column h-100"},r.createElement(qn,Object.assign({},e)),"question"===C&&r.createElement(r.Fragment,null,r.createElement("form",{className:"cv-timepoint flex-grow-1",tabIndex:-1,onSubmit:function(e){e.preventDefault(),t?p():d()}},r.createElement("div",{className:"cv-timepoint-padding h-100"},r.createElement("div",{ref:h,tabIndex:0}),r.createElement(P,Object.assign({state:a,setState:f,recalculateScroll:function(){v.current.recalculate()},showFeedback:I,optionsPortalNode:j},e)))),r.createElement(jn,Object.assign({onClickSkip:function(){y.current&&window.clearTimeout(y.current),m()}},e))),"move"===C&&r.createElement(ci,Object.assign({back:function(){return N("question")}},e)),"reorder"===C&&r.createElement(ki,Object.assign({back:function(){return N("question")},interactions:u.interactions},e)))))}function Ni(e){var t=e.open,n=e.nextInteraction,i=e.nextInteractionState,o=e.timepointState,a=e.interaction,c=e.delayFocus,l=e.experimentalInteractiveQuestions,s=r.useMemo((function(){return(0,Pe.oD)({attributes:{class:"cv-interactive-lhs"}})}),[]),u=r.useMemo((function(){return(0,Pe.oD)({attributes:{class:"cv-interactive-full"}})}),[]),f=n&&o.nextInteractionIndex<o.interactionIndex,d=n&&o.nextInteractionIndex>o.interactionIndex,p=d&&o.slideIn,m=f&&o.slideIn,h=t&&!f&&!d;return r.createElement(r.Fragment,null,r.createElement("div",{className:"cv-interactive-full-container ".concat(h?"":"cv-closed-full")},r.createElement(Pe.t0,{node:u})),r.createElement("div",{className:"cv-interactive-lhs-container ".concat(h?"":"cv-closed-lhs")},r.createElement(Pe.t0,{node:s})),r.createElement("div",{className:"cv-interactive ".concat(t?"cv-open":"")},f&&r.createElement("div",{className:"cv-prev-interaction ".concat(o.slideIn?"cv-slide-in":"")},r.createElement(Ci,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:i}))),r.createElement("div",{className:"\n cv-main-slide\n ".concat(p?"cv-slide-out-up":"","\n ").concat(m?"cv-slide-out-down":"","\n ").concat(n?"cv-transitioning":"","\n ")},r.createElement(Ci,Object.assign({key:null==a?void 0:a.id},e,{currentIndex:o.interactionIndex,shouldFocus:a&&!f&&!d,delayFocus:c,leftHandSidePortalNode:s,fullWidthPortalNode:u,experimentalInteractiveQuestions:l}))),d&&r.createElement("div",{className:"cv-next-interaction ".concat(o.slideIn?"cv-slide-in":"")},r.createElement(Ci,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:i})))))}function ji(e){return ji="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},ji(e)}function Pi(e,t,n){return(t=function(e){var t=function(e){if("object"!=ji(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ji(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ji(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ii={interactions:{},timepoints:{}};function Li(e,t){return"interaction"===t.type?{timepoints:e.timepoints,interactions:Object.assign(Object.assign({},e.interactions),Pi({},t.id,t.value))}:"timepoint"===t.type?{interactions:e.interactions,timepoints:Object.assign(Object.assign({},e.timepoints),Pi({},t.id,t.value))}:void 0}function Ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var _i={interactionIndex:0},Ai=function(e){var t,n,i=e.mode,o=e.timepoint,a=e.latestSession,c=i===R.Create,l=r.useReducer(Li,null,(function(){return function(e){return e?{timepoints:{},interactions:e.actions.reduce((function(e,t){return e[t.interactionId]=Object.assign(Object.assign({},e[t.interactionId]),Pi(Pi({},t.actionableItemId,t.data),"submitted",!0)),e}),{})}:Ii}(a)})),s=(n=2,function(e){if(Array.isArray(e))return e}(t=l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ti(e,t);var n={}.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)?Ti(e,t):void 0}}(t,n)||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.")}()),u=s[0],f=s[1],d=y(null==o?void 0:o.id),p=null==o?void 0:o.interactions[d.interactionIndex],m="number"==typeof d.nextInteractionIndex?null==o?void 0:o.interactions[d.nextInteractionIndex]:null,h=g(null==p?void 0:p.id),v=g(null==m?void 0:m.id);function y(e){return e&&u.timepoints[e]||_i}function g(e){if(!e)return{};var t=u.interactions[e];return t||c?t:{}}function b(e,t,n){var r=g(e);f({type:"interaction",id:e,value:Object.assign(Object.assign({},n?{}:r),t)})}return{state:u,interaction:p,interactionState:h,timepointState:d,nextInteraction:m,nextInteractionState:v,getTimepointState:y,getInteractionState:g,updateTimepointState:function(e,t){var n=y(e);f({type:"timepoint",id:e,value:Object.assign(Object.assign({},n),t)})},updateInteractionState:b,clearTimepointState:function(e){f({type:"timepoint",id:e,value:void 0})},clearInteractionState:function(e){f({type:"interaction",id:e,value:void 0})},userUpdateInteractionState:function(e,t){b(p.id,Object.assign(Object.assign({},e),{hasChanges:!0,error:null}),t)}}};function Fi(e){return Fi="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},Fi(e)}function Di(){Di=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Fi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Fi(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var Ri=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Mi=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},Ui=!1;function Vi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bi(e,t);var n={}.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)?Bi(e,t):void 0}}(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 Bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var qi=n(25417),Gi=n(81937),Zi=n(69184);function zi(e,t){if(e){if("string"==typeof e)return Hi(e,t);var n={}.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)?Hi(e,t):void 0}}function Hi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Wi=Qe.T.encloseNamespace("shared.hooks"),Qi=function(){var e,t,n=(e=r.useState([]),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||zi(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.")}()),i=n[0],o=n[1],a=mr.Radio.channel(qi.G.SHELL);function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.find((function(t){return t.id===e.id}))||(e.allowAppLinks||a.trigger(B.Q.Vy.LOCK_NAV),o([].concat(function(e){return function(e){if(Array.isArray(e))return Hi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||zi(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.")}()}(i),[e])))}function s(e){var t=i.filter((function(t){return t.id!==e}));0!==t.length&&t.find((function(e){return!e.allowAppLinks}))||a.trigger(B.Q.Vy.UNLOCK_NAV),o(t)}function u(e){var t;if(i.length){var n=i.find((function(e){return!e.allowAppLinks}));if(null===(t=n.appLinkWhitelist)||void 0===t?void 0:t.find((function(t){return t.action===e.action&&t.application===e.application})))return a.trigger(B.Q.Vy.UNLOCK_NAV),void window.setTimeout((function(){B.Q.C$.trigger(e),a.trigger(B.Q.Vy.LOCK_NAV)}),0);l.q.isFunction(n.renderCustomDialog)?n.renderCustomDialog():gt(r.createElement("p",null,n.text),{title:n.title,submitButtonProps:{onClick:function(){n.onConfirmUnlock&&n.onConfirmUnlock(),function(e){a.trigger(B.Q.Vy.NAV_UNLOCKED_BY_USER),i.forEach((function(e){e.allowAppLinks||s(e.id)})),window.removeEventListener("beforeunload",f),B.Q.C$.trigger(e)}(e)},variant:"danger",text:Wi("discard")},cancelButtonProps:{text:Wi("cancel"),variant:"link"}})}}function f(e){var t=i.find((function(e){return e.allowAppLinks}));return t||(t=Ze.m.first(i)),e.returnValue=t.text,t.text}return r.useEffect((function(){return i.find((function(e){return!e.allowAppLinks}))&&a.on(B.Q.Vy.NAV_IS_LOCKED,u),i.length&&window.addEventListener("beforeunload",f),function(){a.off(B.Q.Vy.NAV_IS_LOCKED,u),window.removeEventListener("beforeunload",f)}}),[i]),r.useEffect((function(){function e(){c({id:"upload",title:Wi("navLockTitle"),text:Wi("navLockBody"),allowAppLinks:!0})}var t=mr.Radio.channel(Zi.Q4.VIDEO_UPLOAD);return t.on(Gi.S.FILES_ADDED,e),t.on(Gi.S.UNLOCK_NAV,s),function(){t.off(Gi.S.FILES_ADDED,e),t.off(Gi.S.UNLOCK_NAV,s)}}),[]),{lock:c,unlock:s}};function Yi(e){return Yi="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},Yi(e)}function Ki(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $i(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,Ji(r.key),r)}}function Xi(e,t,n){return t&&$i(e.prototype,t),n&&$i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ji(e){var t=function(e){if("object"!=Yi(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Yi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Yi(t)?t:t+""}function eo(e,t,n){return t=ro(t),function(e,t){if(t&&("object"==Yi(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,to()?Reflect.construct(t,n||[],ro(e).constructor):t.apply(e,n))}function to(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(to=function(){return!!e})()}function no(){return no="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ro(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},no.apply(null,arguments)}function ro(e){return ro=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ro(e)}function io(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&oo(e,t)}function oo(e,t){return oo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},oo(e,t)}var ao=function(e){function t(e,n){return Ki(this,t),eo(this,t,[e,n])}return io(t,e),Xi(t,[{key:"dispose",value:function(){var e,n,r,i=this;setImmediate((function(){var e;null===(e=i.root)||void 0===e||e.unmount()})),(e=t,n=this,"function"==typeof(r=no(ro(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}}])}(ie.Z.getComponent("Component")),co={tagName:"div"};function lo(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:co;if(!e)throw new Error("componentCtor is required");var n=function(n){function r(){return Ki(this,r),eo(this,r,arguments)}return io(r,n),Xi(r,[{key:"createEl",value:function(){var n=ie.Z.dom.createEl(t.tagName,t.properties,t.attributes),r=(0,ht.s)(n);return r.render(e(this.player_,this.options_)),this.root=r,n}}])}(ao);return n}var so=n(42120),uo=n(50028);function fo(e){var t,n=!e.parentVideo||(null===(t=e.parentVideo)||void 0===t?void 0:t.status)===uo.X.Published,i=function(e){var t,n=0;return null===(t=null==e?void 0:e.timepoints)||void 0===t||t.forEach((function(e){var t;return null===(t=e.interactions)||void 0===t?void 0:t.forEach((function(){return n++}))})),n>0}(e.interactive)&&n,o=[];return e.onClickEditDetails&&o.push({label:"Edit details",svgName:O.vn.Edit,button:!0,className:"btn btn-outline-dark",onClick:e.onClickEditDetails}),e.onClickPublish&&o.push({label:"Publish",button:!0,className:"btn btn-dark ms-2".concat(i?"":" disabled"),disabled:!i,tooltip:i?"":n?"Interactives cannot be published without questions":"Parent video must be published before interactives can be published",onClick:function(){i&&e.onClickPublish&&e.onClickPublish()}}),e.onClickCopy&&o.push({label:"Copy interactive",button:!1,onClick:e.onClickCopy}),e.onClickDelete&&o.push({label:"Delete interactive",button:!1,onClick:e.onClickDelete,className:"text-danger"}),o.length?r.createElement(Pe.Nq,{node:e.portalNode},r.createElement(so.e,{actions:o,actionsDropdownClassName:"btn btn-outline-dark ms-2"})):r.createElement(r.Fragment,null)}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 mo(e){var t=e.title,n=e.player,i=e.track,o=e.mode,a=e.interactive,c=e.imageApi,l=e.actionsPortalNode,s=e.questionListPortalNode,u=e.summaryPortalNode,d=e.resultsService,p=e.currentUser,m=e.progress,h=e.latestSession,v=e.clipOffset,y=e.analyticsService,g=e.enableImmersiveReader,b=e.mobile,w=e.parentVideo,E=e.experimentalInteractiveQuestions,S=function(e){var t=e.player,n=e.track,i=e.interactive,o=e.clipOffset,a=Vi(r.useState(!1),2),c=a[0],l=a[1],s=Vi(r.useState(!1),2),u=s[0],f=s[1],d=Vi(r.useState(null),2),p=d[0],m=d[1];function h(e){return o?e+o:e}function v(e){f(!!e&&c),l(e)}function y(){var e=n.activeCues;if(!e.length)return v(!1),void m(null);var r=i.timepoints.find((function(t){return t.id.toString()===e[0].text.toString()}));if(!r)return v(!1),void m(null);r.shouldPause&&(t.seeking()?t.one("play",(function(){return t.pause()})):t.pause()),v(!0),m(r)}function g(e){for(var t=0;t<n.cues.length;t++){var r=n.cues[t];if(r.text.toString()===e.toString())return r}}return r.useEffect((function(){return n.addEventListener("cuechange",y),function(){return n.removeEventListener("cuechange",y)}})),{open:c,setOpen:v,wasOpen:u,timepoint:p,continueInteractive:function(){v(!1),t.play()},updateCue:function(e,t){var n=g(e);n.text=t.toString(),n.originalCue_.text=t.toString()},addCue:function(e){var r=t.currentTime();n.addCue({startTime:h(r)-.001,endTime:h(r+1),text:e}),n.trigger("cv:cuechange"),t.paused()&&n.trigger("cuechange")},removeCue:function(e){e=h(e);for(var t=0;t<n.cues.length;){var r=n.cues[t];if(r.startTime<=e&&r.endTime>=e){n.removeCue(r),n.trigger("cv:cuechange"),n.trigger("cuechange");break}t++}},moveTimepoint:function(e){var r=g(p.id);if(r){var i=e/1e3;r.startTime=h(i),r.endTime=h(i+1),t.currentTime(i+.5,!0),p.visibleAt=e,n.trigger("cv:cuechange")}},getClipOffset:h}}({player:n,track:i,interactive:a,mode:o,clipOffset:v}),k=S.open,x=S.timepoint,O=S.wasOpen,C=po(S,["open","timepoint","wasOpen"]),j=function(e){var t=e.interactive,n=e.timepoint,i=e.player,o=e.mode,a=e.resultsService,c=e.latestSession,l=e.analyticsService,s=e.imageApi,u=Mi(e,["interactive","timepoint","player","mode","resultsService","latestSession","analyticsService","imageApi"]),d=Ai({mode:o,timepoint:n,latestSession:c}),p=d.state,m=d.interaction,h=d.interactionState,v=d.timepointState,y=d.nextInteraction,g=d.nextInteractionState,b=Mi(d,["state","interaction","interactionState","timepointState","nextInteraction","nextInteractionState"]),w=o===R.Create;function E(e){for(var n=0;n<t.timepoints.length;){for(var r=t.timepoints[n],i=0;i<r.interactions.length;){var o=r.interactions[i];if(o.id===e)return{localTimepoint:r,localInteraction:o};i++}n++}return{localInteraction:null,localTimepoint:null}}function S(e){var n=N.w.getTypeInfo(e.typeId);return{id:tn(e.id)?void 0:e.id,typeId:e.typeId,type:n.typeName,interactiveId:t.id,timepointId:tn(e.timepointId)?void 0:e.timepointId,order:e.order}}function k(e){return Ri(this,void 0,void 0,Di().mark((function n(){var r,i,o,a,c,s,d;return Di().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=E(e),i=r.localInteraction,o=r.localTimepoint,i&&o){n.next=3;break}throw new Error("Could not find the interaction and timepoint for the interactionId ".concat(e));case 3:if(a=S(i),tn(i.id)){n.next=10;break}return n.next=7,tr.deleteInteraction(i.id);case 7:null==l||l.logUserAction(a,{actionType:f.Vw.Delete,entity:f.py.Interaction,workflowPhase:f.eu.Complete}),n.next=11;break;case 10:null==l||l.logUserAction(a,{actionType:f.Vw.Create,entity:f.py.Interaction,workflowPhase:f.eu.Discard});case 11:if(c=o.interactions.findIndex((function(e){return e.id===i.id})),o.interactions.splice(c,1),b.clearInteractionState(i.id),s=b.getTimepointState(o.id),c<s.interactionIndex&&b.updateTimepointState(o.id,{interactionIndex:s.interactionIndex-1}),!(o.interactions.length>0)){n.next=18;break}return n.abrupt("return");case 18:if(tn(o.id)){n.next=21;break}return n.next=21,tr.deleteTimepoint(o.id);case 21:d=t.timepoints.findIndex((function(e){return e.id===o.id})),t.timepoints.splice(d,1),u.removeCue(o.visibleAt/1e3),b.clearTimepointState(o.id);case 25:case"end":return n.stop()}}),n)})))}function x(e){if(m){var t=tn(m.id);t||(null==h?void 0:h.hasChanges)||(null==v?void 0:v.hasChanges)?gt(r.createElement("p",null,"Do you want to discard your changes?"),{title:"Unsaved changes",submitButtonProps:{onClick:function(){(null==v?void 0:v.hasChanges)&&I(!0),t?k(m.id):b.clearInteractionState(m.id),e&&e()},variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}}):e&&e()}else e&&e()}function O(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(w)x((function(){b.updateTimepointState(n.id,{interactionIndex:e})}));else{var r=function(){b.updateTimepointState(n.id,{nextInteractionIndex:e}),window.requestAnimationFrame((function(){b.updateTimepointState(n.id,{nextInteractionIndex:e,slideIn:!0}),window.setTimeout((function(){b.updateTimepointState(n.id,{interactionIndex:e,nextInteractionIndex:null,slideIn:null})}),400)}))};t?x(r):r()}}function C(){v.interactionIndex+1>=n.interactions.length?u.continueInteractive():O(v.interactionIndex+1,!1)}function j(){t.timepoints.sort((function(e,t){return e.visibleAt>t.visibleAt?1:t.visibleAt>e.visibleAt?-1:0}))}function P(){O(n.interactions.length)}function I(e){(null==v?void 0:v.hasChanges)&&(e&&u.moveTimepoint(v.originalVisibleAt),b.updateTimepointState(n.id,{hasChanges:void 0,originalVisibleAt:void 0}),Ui=!1)}return{state:p,interaction:m,interactionState:h,timepointState:v,nextInteraction:y,nextInteractionState:g,skip:C,cancel:function(){return Ri(this,void 0,void 0,Di().mark((function e(){return Di().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==h?void 0:h.hasChanges)){e.next=3;break}return x(),e.abrupt("return");case 3:return e.next=5,k(m.id);case 5:u.setOpen(!0);case 6:case"end":return e.stop()}}),e)})))},addAnotherQuestion:P,goToTimepoint:function(e,n){var r=function(e){for(var n=0;n<t.timepoints.length;){var r=t.timepoints[n];if(r.id===e)return r;n++}return null}(e),o=r.interactions.find((function(e){return e.id.toString()===n.toString()}));i.currentTime(r.visibleAt/1e3),b.updateTimepointState(r.id,{interactionIndex:r.interactions.indexOf(o)})},discardChanges:x,changeIndex:O,promptDelete:function(e){var t=S(E(e).localInteraction);null==l||l.logUserAction(t,{actionType:f.Vw.Delete,entity:f.py.Interaction,workflowPhase:f.eu.Start}),gt(r.createElement("p",null,"Are you sure you want to delete this question?"),{title:"Delete question",submitButtonProps:{onClick:function(){return k(e)},variant:"danger",text:"Delete question"},cancelButtonProps:{variant:"link",text:"Cancel"}})},showTypeSelector:function(){i.pause(),u.setOpen(!0),n&&P()},cancelTypeSelector:function(){n?O(v.interactionIndex-1):(u.setOpen(!1),i.play())},deleteInteraction:k,saveInteraction:function(){return Ri(this,void 0,void 0,Di().mark((function e(){var t,r,i,o,a,c,s;return Di().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(w){e.next=2;break}throw new Error("Should not be calling onClickSave while viewing an interactive");case 2:if(d=m.typeId,t=$r[d],!(r=t(b.getInteractionState(m.id),m))){e.next=7;break}return b.updateInteractionState(m.id,{error:r}),e.abrupt("return");case 7:if(b.updateInteractionState(m.id,{spinner:!0}),!tn(n.id)){e.next=15;break}return i=n.id,e.next=12,tr.saveTimepoint(n);case 12:u.updateCue(i,n.id),b.clearTimepointState(i),(null==v?void 0:v.hasChanges)&&(j(),I());case 15:return m.timepointId=n.id,o=m.id,a=Jr(m.typeId),e.next=20,a(b.getInteractionState(m.id),m);case 20:b.clearInteractionState(o),c=tn(o),s=S(m),null==l||l.logUserAction(s,{actionType:c?f.Vw.Create:f.Vw.Edit,entity:f.py.Interaction,workflowPhase:c?f.eu.Complete:f.eu.Save});case 24:case"end":return e.stop()}var d}),e)})))},addInteraction:function(e){var r;i.pause();var o=(null==n?void 0:n.id)||"new_".concat(Math.round(Math.random()*Number.MAX_SAFE_INTEGER)),a={id:"new_".concat(Math.round(Math.random()*Number.MAX_SAFE_INTEGER)),timepointId:o,typeId:e,order:(null===(r=null==n?void 0:n.interactions)||void 0===r?void 0:r.length)||0,interactiveId:t.id,data:{}},c=S(a);if(null==l||l.logUserAction(c,{actionType:f.Vw.Create,entity:f.py.Interaction,workflowPhase:f.eu.Start}),n)return n.interactions.push(a),void O(v.interactionIndex);var s=i.currentTime();t.timepoints||(t.timepoints=[]),t.timepoints.push({id:o,visibleAt:1e3*s,interactiveId:t.id,shouldPause:1,interactions:[a]}),j(),u.addCue(o)},submitInteractionAnswer:function(){return Ri(this,void 0,void 0,Di().mark((function e(){var r,i,c,d,p,y;return Di().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o===R.View){e.next=2;break}throw new Error("Should not be calling onClickSubmit while creating an interactive");case 2:if(!h.submitted){e.next=8;break}if(!(v.interactionIndex>=n.interactions.length)){e.next=6;break}return u.continueInteractive(),e.abrupt("return");case 6:return O(v.interactionIndex+1),e.abrupt("return");case 8:if(r=nn(h),g=m.typeId,i=Ht[g],!(c=i(r,m))){e.next=14;break}return b.updateInteractionState(m.id,{error:c}),e.abrupt("return");case 14:if(d={},!a||!h.hasChanges){e.next=27;break}if(p=Qt(m.typeId),b.updateInteractionState(m.id,{spinner:!0}),!p){e.next=27;break}return e.next=21,p(r,m,a.save,{imageApi:s});case 21:if(e.t0=e.sent,e.t0){e.next=24;break}e.t0={};case 24:d=e.t0,y=S(m),null==l||l.logUserAction(y,{actionType:f.Vw.Submit,entity:f.py.Interaction});case 27:if(b.updateInteractionState(m.id,Object.assign(Object.assign({},d),{submitted:!0,error:null,hasChanges:!1,spinner:!1})),t.immediateFeedback){e.next=31;break}return C(),e.abrupt("return");case 31:Gt(m.typeId)(m)||C();case 34:case"end":return e.stop()}var g}),e)})))},userUpdateInteractionState:b.userUpdateInteractionState,updateTimepointTime:function(e){var r=i.duration(),o=function(e){for(var r=n.visibleAt+1e3*e,i=e>0,o=0;o<t.timepoints.length;o++){var a=t.timepoints[o];r<a.visibleAt-1e3||r>a.visibleAt+1e3||(r=i?a.visibleAt+1001:a.visibleAt-1001,o=0)}return r}(e);if(!(o/1e3>r||o<0)){var a=n.visibleAt;Ui||(Ui=!0,b.updateTimepointState(n.id,{originalVisibleAt:a,hasChanges:!0})),u.moveTimepoint(o)}},saveTimepoint:function(){return Ri(this,void 0,void 0,Di().mark((function e(){return Di().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!tn(n.id)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,tr.updateTimepoint(n);case 4:j(),I();case 6:case"end":return e.stop()}}),e)})))},clearTimepointTimeState:I,reOrderQuestions:function(e){return Ri(this,void 0,void 0,Di().mark((function t(){var r,i;return Di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=0;case 1:if(!(r<e.length)){t.next=7;break}return t.next=4,tr.saveInteraction(Object.assign(Object.assign({},e[r]),{order:r}));case 4:r++,t.next=1;break;case 7:i=n.interactions[v.interactionIndex],n.interactions=e,b.updateTimepointState(n.id,{interactionIndex:e.indexOf(i)});case 10:case"end":return t.stop()}}),t)})))}}}(Object.assign({mode:o,interactive:a,timepoint:x,player:n,resultsService:d,latestSession:h,analyticsService:y,imageApi:c},C)),P=j.interaction,I=j.interactionState,L=j.nextInteraction,T=j.nextInteractionState,_=j.timepointState,A=j.state,F=po(j,["interaction","interactionState","nextInteraction","nextInteractionState","timepointState","state"]);!function(e){var t,n=e.mode,i=e.player,o=e.timepoint,a=e.interaction,c=e.discardChanges,l=e.interactionState,s=e.timepointState,u=Qi(),f=n===R.Create;r.useEffect((function(){if(f){if(tn(null==a?void 0:a.id)||(null==l?void 0:l.hasChanges)||(null==s?void 0:s.hasChanges))return u.lock({id:"interactive",title:"Are you sure you want to leave?",text:"Your interactive still has unsaved changes"}),void i.lock((function(e){c(e)}));i.unlock(),u.unlock("interactive")}}),[a,null==l?void 0:l.hasChanges,null===(t=null==o?void 0:o.interactions)||void 0===t?void 0:t.length,null==s?void 0:s.hasChanges])}({mode:o,player:n,timepoint:x,interaction:P,discardChanges:F.discardChanges,interactionState:I,timepointState:_});var D={mode:o,open:k,isCreate:o===R.Create,interaction:P,nextInteraction:L,timepoint:x,interactive:a,interactionState:I,nextInteractionState:T,timepointState:_,player:n};return r.createElement(r.Fragment,null,!!l&&r.createElement(fo,{interactive:a,onClickEditDetails:e.onClickEditDetails,onClickPublish:e.onClickPublish,onClickDelete:e.onClickDelete,onClickCopy:e.onClickCopy,portalNode:l,parentVideo:w}),r.createElement(Ce,Object.assign({},D,F)),r.createElement(Ni,Object.assign({imageApi:c,currentUser:p,immediateFeedback:a.immediateFeedback,delayFocus:!O,enableImmersiveReader:g,experimentalInteractiveQuestions:E},D,F,C)),r.createElement(dn,Object.assign({title:t,currentUser:p,state:A,portalNode:u,progress:m,resultsService:d,imageCdnUrl:c.toString(),onShowSummary:e.onShowSummary,mobile:b},D,F)),r.createElement(vn,Object.assign({portalNode:s,experimentalInteractiveQuestions:E},D,F)))}ie.Z.registerComponent("Interactive",lo((function(e,t){return r.createElement(mo,Object.assign({player:e},t))})));function ho(e){var t=e.player;function n(){var e=t.getChild("ContinueSession");t.removeChild(e),e.dispose()}function i(){e.continue(!0),n()}return r.createElement(vt.G,{title:"Continue interactive?",closePopup:i,dialogClassName:"VVqKz"},r.createElement("p",null,"It looks like you've already started this interactive. Would you like to continue your attempt or start a new one?"),r.createElement(yt.u,{className:"kw8gW"},r.createElement(yt.u.Cancel,{text:"Start again",onClick:function(){e.continue(!1),n()}}),r.createElement(yt.u.Submit,{variant:"dark",text:"Continue",onClick:i})))}function vo(e){return vo="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},vo(e)}function yo(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,go(r.key),r)}}function go(e){var t=function(e){if("object"!=vo(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=vo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vo(t)?t:t+""}function bo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(bo=function(){return!!e})()}function wo(e){return wo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},wo(e)}function Eo(e,t){return Eo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Eo(e,t)}ie.Z.registerComponent("ContinueSession",lo((function(e,t){return r.createElement(ho,Object.assign({player:e},t))})));var So=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=wo(t),function(e,t){if(t&&("object"==vo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,bo()?Reflect.construct(t,n||[],wo(e).constructor):t.apply(e,n))}(this,t,[e])).enabled=!1,n.player.ready((function(){return n.initialize()})),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Eo(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.onReceiveMessage=this.onReceiveMessage.bind(this),window.addEventListener("message",this.onReceiveMessage,!1),window.parent.postMessage(JSON.stringify({type:"cv-app-loaded"}),"*")}},{key:"dispose",value:function(){window.removeEventListener("message",this.onReceiveMessage)}},{key:"onReceiveMessage",value:function(e){var t={};try{t=JSON.parse(e.data)}catch(e){return}"enable-grade-passback"===t.type&&(this.enabled=!0,window.removeEventListener("message",this.onReceiveMessage))}},{key:"submit",value:function(e,t){var n={type:"cv-lms-submit-score",data:{score:e,fullyGraded:t}};window.parent.postMessage(JSON.stringify(n),"*")}}])&&yo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getPlugin("plugin"));function ko(e){return ko="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},ko(e)}function xo(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,Oo(r.key),r)}}function Oo(e){var t=function(e){if("object"!=ko(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ko(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ko(t)?t:t+""}function Co(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Co=function(){return!!e})()}function No(e){return No=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},No(e)}function jo(e,t){return jo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},jo(e,t)}ie.Z.registerPlugin("gradePassbackPlugin",So);var Po=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=No(t),function(e,t){if(t&&("object"==ko(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Co()?Reflect.construct(t,n||[],No(e).constructor):t.apply(e,n))}(this,t,[e])).continueSession=!1,r.options=n,e.ready((function(){return r.initialize()})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jo(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this;this.player.gradePassbackPlugin(),xe.O.useTrack(this.player,"metadata","interactive",this.onTrackLoaded.bind(this)),this.player.addClass("cv-interactive-plugin"),this.options.resultsService&&!this.options.latestSession&&(this.startSession=this.startSession.bind(this),this.player.one("play",this.startSession),this.on("dispose",(function(){e.player.off("play",e.startSession)})))}},{key:"startSession",value:function(){var e,t=null===(e=this.options.latestSession)||void 0===e?void 0:e.resultId;this.continueSession||(t=null),this.options.resultsService.start(t)}},{key:"onTrackLoaded",value:function(e){var t=this;this.options.resultsService&&this.options.latestSession?this.player.addChild("ContinueSession",{continue:function(n){var r;null===(r=t.options.analyticsService)||void 0===r||r.logUserAction({},{actionType:f.Vw.Click,entity:f.py.Interactive,descriptor:n?f.r.ContinueSession:f.r.NewSession}),t.continueSession=n,t.startSession(),t.addChildren(e),t.continueSession||t.player.currentTime(0),t.player.play()}}):this.addChildren(e)}},{key:"getClipOffset",value:function(){return this.options.clipOffset?parseFloat(this.options.clipOffset.toPrecision(4)):null}},{key:"addChildren",value:function(e){this.player.addChild("Interactive",Object.assign(Object.assign({},this.options),{track:e,clipOffset:this.getClipOffset(),mode:this.options.mode||R.View,latestSession:this.continueSession&&this.options.latestSession})),this.player.controlBar.getChild("progressControl").getChild("SeekBar").addChild(new ke(this.player,{interactive:this.options.interactive,track:e}))}}])&&xo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getPlugin("plugin"));function Io(e){return Io="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},Io(e)}function Lo(){Lo=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Io(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Io(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function To(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ao(r.key),r)}}function Ao(e){var t=function(e){if("object"!=Io(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Io(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Io(t)?t:t+""}function Fo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Fo=function(){return!!e})()}function Do(e,t,n,r){var i=Ro(Mo(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function Ro(){return Ro="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Mo(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ro.apply(null,arguments)}function Mo(e){return Mo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Mo(e)}function Uo(e,t){return Uo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Uo(e,t)}ie.Z.registerPlugin("viewInteractivePlugin",Po),n(56728);var Vo=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=Mo(t),function(e,t){if(t&&("object"==Io(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Fo()?Reflect.construct(t,n||[],Mo(e).constructor):t.apply(e,n))}(this,t,[e,n])).totalProgress=[],Y.e.setToken("gateway",r.options.authToken),r.options.mode===R.Create&&r.player.addClass("cv-create-interactives"),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Uo(e,t)}(t,e),n=t,r=[{key:"togglePreviewPreventScrubbing",value:function(){var e=this.player.preventScrubbingPlugin();e&&e.togglePreview(!e.isPreviewing)}},{key:"getPlayerOptions",value:function(){var e=Do(t,"getPlayerOptions",this,3)([]);return e.setMaxHeight=!1,this.options.embed||(e.aspectRatio="16:9"),e.preferFullWindow=!0,e}},{key:"onFlushProgress",value:function(e){var n;Do(t,"onFlushProgress",this,3)([e]),this.options.mode!==R.Create&&(n=this.totalProgress).push.apply(n,function(e){return function(e){if(Array.isArray(e))return To(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return To(e,t);var n={}.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)?To(e,t):void 0}}(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.")}()}(e))}},{key:"additionalSetup",value:function(e){var n,r,i,o,a=this,c=Object.create(null,{additionalSetup:{get:function(){return Do(t,"additionalSetup",a,1)}}});return n=this,r=void 0,i=void 0,o=Lo().mark((function t(){return Lo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:c.additionalSetup.call(this,e),this.setupClipPlugin(e),this.setupPreventScrubbingPlugin(e);case 3:case"end":return t.stop()}}),t,this)})),new(i||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function c(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}l((o=o.apply(n,r||[])).next())}))}},{key:"setupAnalyticsDependentPlugins",value:function(e){Do(t,"setupAnalyticsDependentPlugins",this,3)([e]),this.setupViewInteractivePlugin(e)}},{key:"handleAutoplay",value:function(e){var n;this.options.collectResults&&this.options.currentUser&&this.options.shareId&&(null===(n=e.additionalData)||void 0===n?void 0:n.latestSession)?this.options.autoplay&&this.showSplash():Do(t,"handleAutoplay",this,3)([e])}},{key:"setupPreventScrubbingPlugin",value:function(e){var t,n;if(null===(t=e.additionalData)||void 0===t?void 0:t.interactive){var r=e.additionalData.interactive,i=this.options.mode===R.Create||!this.options.collectResults;this.player.preventScrubbingPlugin({isEnabled:!i&&r.preventScrubbing,furthestVisitedTime:null!==(n=this.options.furthestVisitedTime)&&void 0!==n?n:0})}}},{key:"setupClipPlugin",value:function(e){var t;if(null===(t=null==e?void 0:e.additionalData)||void 0===t?void 0:t.clipData){var n=e.additionalData.clipData;this.player.clipPlugin({startTime:n.startTime,endTime:n.endTime})}}},{key:"filterNewQuestionTypes",value:function(e){var t;return Object.assign(Object.assign({},e),{timepoints:null===(t=e.timepoints)||void 0===t?void 0:t.map((function(e){var t;return Object.assign(Object.assign({},e),{interactions:null===(t=e.interactions)||void 0===t?void 0:t.filter((function(e){return!x.IL[e.typeId]}))})})).filter((function(e){var t;return!!(null===(t=e.interactions)||void 0===t?void 0:t.length)}))})}},{key:"validateCollectResultsOptions",value:function(){var e=!!this.options.publicName&&!!this.options.profileId;this.options.currentUser||e||B.Q.Ry.throw(new ne.H("Must provide a currentUser or PublicName and ProfileId in order to collect interactive results")),this.options.shareId||B.Q.Ry.throw(new ne.H("Must provide a shareId in order to collect interactive results"))}},{key:"setupViewInteractivePlugin",value:function(e){var t;this.track=function(e,t){var n,r=e.addTextTrack("metadata","interactive"),i=t.additionalData.interactive,o=null===(n=t.additionalData.clipData)||void 0===n?void 0:n.startTime;return i.timepoints.forEach((function(e){var t,n=e.visibleAt/1e3,i=e.visibleFor?n+e.visibleFor/1e3:n+1;o&&(n+=o,i+=o),(null===(t=e.interactions)||void 0===t?void 0:t.length)&&r.addCue({startTime:Math.max(.001,n-.001),endTime:i,text:e.id})})),r}(this.player,e);var n=e.additionalData.interactive;this.options.experimentalInteractiveQuestions||(n=this.filterNewQuestionTypes(n));var r=null===(t=e.additionalData.clipData)||void 0===t?void 0:t.startTime;this.options.collectResults&&(this.validateCollectResultsOptions(),this.resultsService=new te({interactiveId:n.id,metadataId:e.mediaId,userId:this.options.currentUser.id,customerId:this.options.currentUser.customerId,playerApi:this.options.playerApi,shareId:this.options.shareId,publicName:this.options.publicName,profileId:this.options.profileId})),this.player.viewInteractivePlugin({interactive:n,title:e.title,mode:this.options.mode,imageApi:this.options.imageApi,resultsService:this.resultsService,actionsPortalNode:this.options.actionsPortalNode,questionListPortalNode:this.options.questionListPortalNode,summaryPortalNode:this.options.summaryPortalNode,currentUser:this.options.currentUser,latestSession:e.additionalData.latestSession,progress:this.totalProgress,parentVideo:this.options.parentVideo,clipOffset:r,analyticsService:this.analyticsService,enableImmersiveReader:this.options.enableImmersiveReader,onShowSummary:this.options.onShowSummary,onClickCopy:this.options.onClickCopy,onClickEditDetails:this.options.onClickEditDetails,onClickPublish:this.options.onClickPublish,onClickDelete:this.options.onClickDelete,mobile:this.options.mobile,experimentalInteractiveQuestions:this.options.experimentalInteractiveQuestions})}},{key:"getAdditionalAnalyticsData",value:function(e){var t,n,r,i;return(null===(n=null===(t=e.additionalData)||void 0===t?void 0:t.clipData)||void 0===n?void 0:n.clipId)?{clip:{id:null===(i=null===(r=e.additionalData)||void 0===r?void 0:r.clipData)||void 0===i?void 0:i.clipId}}:{}}},{key:"getSeekBarOptions",value:function(){return{ignoreChapters:!0}}},{key:"getAnalyticsPlayerType",value:function(){return"interactive-player"}},{key:"setActivityStatus",value:function(e,t){this.player.activityStatusPlugin().setActivityStatus(e,t)}}],r&&_o(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(re.r);function Bo(e){return new Proxy(e,{get:function(e,t,n){if("off"===t||!e.isDisposed())return Reflect.get(e,t,n)}})}var qo=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 Go(e){var t=e.onReady,n=e.className,i=qo(e,["onReady","className"]),o=r.useRef(null);return r.useEffect((function(){var e=new Vo(o.current,i);return t&&e.ready((function(){t(Bo(e))})),function(){window.requestAnimationFrame((function(){return e.dispose()}))}}),[]),r.createElement(r.Fragment,null,r.createElement("div",{ref:o,className:n}),r.createElement("div",{id:"popup-region"}))}var Zo={placeholder:"YUoDl"};function zo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ho(){return r.createElement("div",{className:"".concat(Zo.placeholder," partial-loading-background")})}function Wo(e){var t,n,i,o=(n=r.useState(),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,i)||function(e,t){if(e){if("string"==typeof e)return zo(e,t);var n={}.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)?zo(e,t):void 0}}(n,i)||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.")}()),a=o[0],c=o[1];return r.useEffect((function(){e.createViewKey(null,(function(e){c(e.get("viewKey"))}))}),[e.video.id]),a?r.createElement("div",{className:"col-12 mb-3 p-0"},r.createElement(Go,{playerApi:new URL(e.config.get("playerApiUrl")),viewKey:a,currentUser:e.currentUser,imageApi:new URL(e.config.get("imageCdnUrl")),furthestVisitedTime:null===(t=e.video._videoProgress)||void 0===t?void 0:t.furthest})):r.createElement(Ho,null)}var Qo=n(82602),Yo={avatarContainer:"hwnEk",comment:"LyFKD"},Ko="libraryRequests.comments",$o=Qe.T.encloseNamespace(Ko);function Xo(e){var t,n,i,o,a,c,l=e.comment,s="".concat(null===(t=l.user)||void 0===t?void 0:t.name," ").concat(null===(n=l.user)||void 0===n?void 0:n.surname);return l.user||(s=$o("deletedUser")),r.createElement("div",{className:"d-flex ".concat(Yo.comment)},r.createElement("div",{className:"".concat(Yo.avatarContainer," me-2 flex-shrink-0")},r.createElement(_e.q,{imageUrl:null===(o=null===(i=l.user)||void 0===i?void 0:i.avatar)||void 0===o?void 0:o.url,imageCdnUrl:e.imageCdnUrl,initials:We.l.getInitials(null===(a=l.user)||void 0===a?void 0:a.name,null===(c=l.user)||void 0===c?void 0:c.surname)})),r.createElement("div",null,r.createElement("span",{className:"fw-bold pe-2"},s),r.createElement("span",{className:"text-secondary"},(0,Qo.WU)(l.dateCreated)),r.createElement("p",{className:"mb-0"},l.message)))}function Jo(e){var t;return(null===(t=e.comments)||void 0===t?void 0:t.length)?r.createElement("div",{className:"pb-3 border-bottom mb-3"},r.createElement("h2",{className:"h5"},r.createElement(i.x,{namespace:Ko,phrase:"comments"})),r.createElement("div",{className:"border rounded p-2"},e.comments.map((function(t,n){return r.createElement(Xo,{key:n,comment:t,imageCdnUrl:e.imageCdnUrl})})))):r.createElement(r.Fragment,null)}var ea=n(10657),ta=n(41087),na=n(47673),ra=n(50997),ia=n(89707),oa={seriesLink:"Z5BW7"};function aa(e){var t,n;return(null===(n=null===(t=e.items)||void 0===t?void 0:t.data)||void 0===n?void 0:n.length)?r.createElement("p",{className:"mb-0"},e.items.data.map((function(e,t){return r.createElement("span",{key:t},e.name)}))):null}function ca(e){var t,n,i,o,a,c,l,s,u,f,d,p,m,h,v=e.libraryRequest.object;return r.createElement("div",{className:"row"},((null==v?void 0:v.name)||e.libraryRequest.name)&&r.createElement(y,{phrase:"title"},(null==v?void 0:v.name)||e.libraryRequest.name),!!v&&r.createElement(r.Fragment,null,!!v.series&&r.createElement(y,{phrase:"series"},r.createElement("a",{target:"_blank",href:(p=v.series,m=e.config,h="series/".concat(p.id),ia.k.getMainProductUrl(m,h,h)),className:"".concat(oa.seriesLink," text-reset")},v.series.name,r.createElement(na.Q,{video:v,withSeriesTitle:!0}))),!!(null===(t=v.rating)||void 0===t?void 0:t.code)&&r.createElement(y,{phrase:"rating"},r.createElement("div",{className:"d-flex"},r.createElement(ta.C,{type:ta.g.Rating,data:v.rating}))),!!v.description&&r.createElement(y,{phrase:"description"},r.createElement("span",{className:"pre-wrap"},v.description)),!!v.productionYear&&r.createElement(y,{phrase:"productionYear"},v.productionYear),!!(null===(i=null===(n=v.producers)||void 0===n?void 0:n.data)||void 0===i?void 0:i.length)&&r.createElement(y,{phrase:"producers"},r.createElement(aa,{items:v.producers})),!!(null===(a=null===(o=v.directors)||void 0===o?void 0:o.data)||void 0===a?void 0:a.length)&&r.createElement(y,{phrase:"directors"},r.createElement(aa,{items:v.directors})),!!(null===(l=null===(c=v.productionCompanies)||void 0===c?void 0:c.data)||void 0===l?void 0:l.length)&&r.createElement(y,{phrase:"productionCompanies"},r.createElement(aa,{items:v.productionCompanies})),!!(null===(u=null===(s=v.distributors)||void 0===s?void 0:s.data)||void 0===u?void 0:u.length)&&r.createElement(y,{phrase:"distributors"},r.createElement(aa,{items:v.distributors})),!e.hideBroadcastInfo&&!!(null===(f=v.channel)||void 0===f?void 0:f.name)&&r.createElement(y,{phrase:"channel"},null===(d=v.channel)||void 0===d?void 0:d.name),!e.hideBroadcastInfo&&!!v.dateBroadcast&&r.createElement(y,{phrase:"broadcastDate"},ea.O.format(v.dateBroadcast,ra.K4.FULL_YEAR))))}var la,sa,ua=n(38465),fa=n(33937);function da(e){return da="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},da(e)}function pa(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,ma(r.key),r)}}function ma(e){var t=function(e){if("object"!=da(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=da(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==da(t)?t:t+""}!function(e){e.AppleTv="apple-tv",e.Vivi="vivi"}(la||(la={})),function(e){e.Available="available",e.Offline="offline",e.Busy="busy"}(sa||(sa={}));var ha=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this[Symbol.toStringTag]=t[Symbol.toStringTag],this.innerPromise=t,this.onTimeout=n,this.bindFunctions()}return t=e,r=[{key:"reject",value:function(t){return new e(Promise.reject(t))}},{key:"fromPromise",value:function(t){return new e(t)}}],(n=[{key:"bindFunctions",value:function(){this.timeout=this.timeout.bind(this),this.then=this.then.bind(this),this.catch=this.catch.bind(this),this.finally=this.finally.bind(this)}},{key:"timeout",value:function(e){var t=this;return new Promise((function(n,r){t.then(n).catch(r).finally((function(){return clearTimeout(i)}));var i=setTimeout((function(){var e;null===(e=t.onTimeout)||void 0===e||e.call(t),r(new Error("Promise timed out"))}),e)}))}},{key:"then",value:function(e,t){return this.innerPromise.then(e,t)}},{key:"catch",value:function(e){return this.innerPromise.catch(e)}},{key:"finally",value:function(e){return this.innerPromise.finally(e)}}])&&pa(t.prototype,n),r&&pa(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function va(e){return va="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},va(e)}function ya(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ga(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,wa(r.key),r)}}function ba(e,t,n){return t&&ga(e.prototype,t),n&&ga(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function wa(e){var t=function(e){if("object"!=va(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=va(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==va(t)?t:t+""}Symbol.toStringTag;var Ea=function(){return ba((function e(){ya(this,e),this.callbacks=[],this.predicates=[],this.controller=new AbortController,this.signal=this.controller.signal,this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.isDisposed=this.isDisposed.bind(this)}),[{key:"trigger",value:function(e){var t=this;this.callbacks.forEach((function(n,r){var i=t.predicates[r];i&&!i(e)||n(e)}))}},{key:"on",value:function(e){var t=this;this.isDisposed()&&console.warn("This EventChannel instance been disposed - this is a no-op");var n=this.callbacks.length;this.callbacks[n]=e,this.predicates[n]=function(){return!0};var r=function(){t.off(e)};return{off:r,filter:function(e){return t.predicates[n]=e,r}}}},{key:"one",value:function(){var e,t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0};return this.isDisposed()?ha.reject(new Error("This EventChannel instance has been disposed")):new ha(new Promise((function(r,i){e=t.on((function(n){t.signal.removeEventListener("abort",o),e(),r(n)})).filter(n);var o=function(){e(),i(new Error("Aborted while waiting for message"))};t.signal.addEventListener("abort",o,{once:!0})})),(function(){e()}))}},{key:"off",value:function(e){var t=this.callbacks.indexOf(e);-1!==t&&(this.callbacks.splice(t,1),this.predicates.splice(t,1))}},{key:"dispose",value:function(){this.callbacks.length=0,this.predicates.length=0,this.controller.abort()}},{key:"isDisposed",value:function(){return this.signal.aborted}}])}(),Sa=function(){return ba((function e(){ya(this,e),this.channels={},this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.getChannel=this.getChannel.bind(this)}),[{key:"trigger",value:function(e,t){this.getChannel(e).trigger(t)}},{key:"on",value:function(e,t){return this.getChannel(e).on(t)}},{key:"one",value:function(e,t){return this.getChannel(e).one(t)}},{key:"off",value:function(e,t){this.getChannel(e).off(t)}},{key:"dispose",value:function(){this.trigger("dispose",ka.void),Object.values(this.channels).forEach((function(e){return e.dispose()})),this.channels={}}},{key:"getChannel",value:function(e){return this.channels[e]||(this.channels[e]=new Ea),this.channels[e]}}])}(),ka={void:void 0};function xa(e){return xa="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},xa(e)}function Oa(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,Ca(r.key),r)}}function Ca(e){var t=function(e){if("object"!=xa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=xa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xa(t)?t:t+""}var Na,ja,Pa,Ia=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bindFunctions()},(t=[{key:"bindFunctions",value:function(){this.schedule=this.schedule.bind(this),this.every=this.every.bind(this),this.trigger=this.trigger.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this)}},{key:"schedule",value:function(e){return this.task=e,this}},{key:"every",value:function(e){return this.intervalInMilliseconds=e,this}},{key:"trigger",value:function(){var e;return null===(e=this.task)||void 0===e||e.call(this,this),this}},{key:"start",value:function(){var e=this;return this.intervalId||(this.intervalId=setInterval((function(){return e.trigger()}),this.intervalInMilliseconds)),this}},{key:"stop",value:function(){return this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this}}])&&Oa(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),La=n(90244),Ta=function(e,t){return e._lastModified||(e._lastModified={}),new Proxy(e,{set:function(n,r,i,o){var a=e._lastModified[r.toString()];return!!(a&&Date.now()<a+t)||Reflect.set(n,r,i,o)}})},_a=function(e){return e._lastModified||(e._lastModified={}),new Proxy(e,{set:function(t,n,r,i){return e._lastModified[n.toString()]=Date.now(),Reflect.set(t,n,r,i)}})};function Aa(e){return Aa="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},Aa(e)}function Fa(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,Ra(r.key),r)}}function Da(e,t,n){return t&&Fa(e.prototype,t),n&&Fa(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ra(e){var t=function(e){if("object"!=Aa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Aa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Aa(t)?t:t+""}!function(e){e[e.Offline=0]="Offline",e[e.Online=1]="Online",e[e.Locked=2]="Locked",e[e.Suspended=3]="Suspended"}(Na||(Na={})),function(e){e[e.PlaybackStatusChange=0]="PlaybackStatusChange",e[e.PositionChange=1]="PositionChange"}(ja||(ja={})),function(e){e.Begin="BEGIN",e.Play="PLAY",e.Pause="PAUSE",e.Load="LOAD",e.Scan="SCAN",e.Stop="STOP"}(Pa||(Pa={}));var Ma=Da((function e(t,n){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.title=t,this.device=n,this.locked=!1,this.position=0,this.playbackStatus=Pa.Load,this.debounced=Ta(this,2e3),_a(this)}));function Ua(e){return Ua="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},Ua(e)}function Va(){Va=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Ua(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ua(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ba(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,qa(r.key),r)}}function qa(e){var t=function(e){if("object"!=Ua(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ua(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ua(t)?t:t+""}function Ga(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ga=function(){return!!e})()}function Za(){return Za="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=za(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Za.apply(null,arguments)}function za(e){return za=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},za(e)}function Ha(e,t){return Ha=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ha(e,t)}var Wa=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=za(t),function(e,t){if(t&&("object"==Ua(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Ga()?Reflect.construct(t,n||[],za(e).constructor):t.apply(e,n))}(this,t)).client=e,r.localState=new Ma(n.title,n.device),r.bindFunctions(),r.initialize(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ha(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.handleDisconnected=this.handleDisconnected.bind(this),this.handleAllVideoMessages=this.handleAllVideoMessages.bind(this),this.handlePlaybackChange=this.handlePlaybackChange.bind(this),this.handlePositionChange=this.handlePositionChange.bind(this),this.loadSource=this.loadSource.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.isPlaying=this.isPlaying.bind(this),this.getPosition=this.getPosition.bind(this),this.getDuration=this.getDuration.bind(this),this.getVolume=this.getVolume.bind(this)}},{key:"initialize",value:function(){this.client.on("dispose",this.dispose),this.client.on("disconnected",this.handleDisconnected),this.client.on("message",this.handleAllVideoMessages)}},{key:"dispose",value:function(){var e,n,r;this.client.off("dispose",this.dispose),this.client.off("disconnected",this.handleDisconnected),this.client.off("message",this.handleAllVideoMessages),this.client.stop(this.getDevice().id).catch((function(e){return console.error(e)})),(e=t,n=this,"function"==typeof(r=Za(za(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{key:"handleDisconnected",value:function(){this.trigger("error",new Error("The connection to the Apple TV has been lost and cannot be recovered"))}},{key:"handleAllVideoMessages",value:function(e){if(e.deviceId===this.getDevice().id){var t=this.localState.debounced;switch(e.event){case ja.PlaybackStatusChange:this.handlePlaybackChange(t,e);break;case ja.PositionChange:this.handlePositionChange(t,e)}}}},{key:"handlePlaybackChange",value:function(e,t){e.playbackStatus!==t.params.playbackStatus&&(e.playbackStatus=t.params.playbackStatus,this.trigger("playingchange",ka.void),e.playbackStatus===Pa.Stop&&this.dispose())}},{key:"handlePositionChange",value:function(e,t){e.position!==t.params.position&&(e.position=t.params.position,this.trigger("positionchange",ka.void))}},{key:"loadSource",value:function(){return e=this,t=void 0,n=void 0,r=Va().mark((function e(){return Va().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!this.localState.locked){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.client.lock(this.getDevice().id);case 5:return this.localState.locked=!0,e.next=8,this.client.loadVideo(this.getDevice().id);case 8:this.trigger("sourceloaded",ka.void),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(0),console.error(e.t0),this.trigger("error",new Error("Could not load video on Apple TV device"));case 15:case"end":return e.stop()}}),e,this,[[0,11]])})),new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}},{key:"play",value:function(){this.localState.locked&&this.localState.playbackStatus!==Pa.Play&&(this.localState.playbackStatus=Pa.Play,this.client.play(this.getDevice().id),this.trigger("playingchange",ka.void))}},{key:"pause",value:function(){this.localState.locked&&this.localState.playbackStatus!==Pa.Pause&&(this.localState.playbackStatus=Pa.Pause,this.client.pause(this.getDevice().id),this.trigger("playingchange",ka.void))}},{key:"seek",value:function(e){this.localState.locked&&this.localState.position!==e&&(this.localState.position=e,this.client.seek(this.getDevice().id,e),this.trigger("positionchange",ka.void))}},{key:"setVolume",value:function(){console.info("Setting the volume is not supported on Apple TV")}},{key:"setMuted",value:function(){console.info("Muting is not supported on Apple TV")}},{key:"setSubtitles",value:function(){console.info("Subtitles are not supported on Apple TV")}},{key:"isPlaying",value:function(){return this.localState.playbackStatus===Pa.Play||this.localState.playbackStatus===Pa.Begin||this.localState.playbackStatus===Pa.Load}},{key:"isPlaybackFinished",value:function(){return this.localState.playbackStatus===Pa.Stop}},{key:"getPosition",value:function(){return this.localState.position}},{key:"getDuration",value:function(){}},{key:"getVolume",value:function(){return 1}},{key:"getMuted",value:function(){return!1}},{key:"getSubtitles",value:function(){}},{key:"getDevice",value:function(){return this.localState.device}},{key:"getTitle",value:function(){return this.localState.title}}],r&&Ba(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Sa);function Qa(e){return Qa="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},Qa(e)}function Ya(){Ya=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Qa(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Qa(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ka(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,$a(r.key),r)}}function $a(e){var t=function(e){if("object"!=Qa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Qa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qa(t)?t:t+""}function Xa(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Xa=function(){return!!e})()}function Ja(){return Ja="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ec(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ja.apply(null,arguments)}function ec(e){return ec=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ec(e)}function tc(e,t){return tc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},tc(e,t)}var nc,rc,ic,oc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))};!function(e){e.DeviceList="DeviceList",e.DeviceStateChange="DeviceStateChange",e.Paired="Paired",e.Unpaired="Unpaired",e.PlayStatusChange="PlayStatusChange",e.TimeSync="TimeSync"}(nc||(nc={})),function(e){e.Command="Command",e.Pair="Pair",e.Unpair="Unpair",e.RenameDevice="Renamedevice",e.Subscribe="Subscribe",e.Lock="Lock"}(rc||(rc={})),function(e){e[e.Connecting=0]="Connecting",e[e.Connected=1]="Connected",e[e.Reconnecting=2]="Reconnecting",e[e.Disconnected=4]="Disconnected"}(ic||(ic={}));var ac=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=ec(t),function(e,t){if(t&&("object"==Qa(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Xa()?Reflect.construct(t,n||[],ec(e).constructor):t.apply(e,n))}(this,t)).options=e,n.accessToken=void 0,n.devices=[],n.heartbeat=new Ia,n.bindFunctions(),n.initialize(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&tc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.connect=this.connect.bind(this),this.subscribe=this.subscribe.bind(this),this.tryFixConnection=this.tryFixConnection.bind(this),this.invoke=this.invoke.bind(this),this.invokeDebounced=(0,La.Ds)(this.invoke,500,!0),this.handleDeviceList=this.handleDeviceList.bind(this),this.handleDeviceStateChange=this.handleDeviceStateChange.bind(this),this.handleDevicePaired=this.handleDevicePaired.bind(this),this.handleDeviceUnpaired=this.handleDeviceUnpaired.bind(this),this.handlePlayStatusChange=this.handlePlayStatusChange.bind(this),this.handleTimeSync=this.handleTimeSync.bind(this),this.dispose=this.dispose.bind(this),this.canCastToDevice=this.canCastToDevice.bind(this),this.getDevices=this.getDevices.bind(this),this.startCastSession=this.startCastSession.bind(this),this.lock=this.lock.bind(this),this.loadVideo=this.loadVideo.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.stop=this.stop.bind(this),this.pair=this.pair.bind(this),this.unpair=this.unpair.bind(this),this.renameDevice=this.renameDevice.bind(this)}},{key:"initialize",value:function(){return oc(this,void 0,void 0,Ya().mark((function e(){return Ya().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.options.fetchAccessToken();case 3:return this.accessToken=e.sent,this.connection=(0,fa.OB)(this.accessToken.host,{logging:!1}),this.hubProxy=this.connection.createHubProxy("DeviceUserHub"),this.hubProxy.on(nc.DeviceList,this.handleDeviceList),this.hubProxy.on(nc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.on(nc.Paired,this.handleDevicePaired),this.hubProxy.on(nc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.on(nc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.on(nc.TimeSync,this.handleTimeSync),e.next=14,this.connect();case 14:return e.next=16,this.subscribe(this.accessToken.token);case 16:this.heartbeat.schedule(this.tryFixConnection).every(5e3).start(),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(0),console.error(e.t0),this.trigger("error",new Error("Could not connect to Online API"));case 23:case"end":return e.stop()}}),e,this,[[0,19]])})))}},{key:"connect",value:function(){return oc(this,void 0,void 0,Ya().mark((function e(){var t=this;return Ya().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){t.connection.start({jsonp:!1,withCredentials:!1}).done((function(){return e()})).fail((function(){return n(new Error("Could not connect to SignalR hub"))}))})));case 1:case"end":return e.stop()}}),e)})))}},{key:"subscribe",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Subscribe,e);case 2:if(t.sent){t.next=5;break}throw new Error("The subscription request was rejected by Online API");case 5:case"end":return t.stop()}}),t,this)})))}},{key:"tryFixConnection",value:function(){return oc(this,void 0,void 0,Ya().mark((function e(){return Ya().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection.state===ic.Disconnected){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,this.heartbeat.stop(),e.next=6,this.options.fetchAccessToken();case 6:return this.accessToken=e.sent,e.next=9,this.connect();case 9:return e.next=11,this.subscribe(this.accessToken.token);case 11:e.next=17;break;case 13:e.prev=13,e.t0=e.catch(2),console.warn(e.t0),console.warn("Could not reconnect to Online API");case 17:return e.prev=17,this.heartbeat.start(),e.finish(17);case 20:case"end":return e.stop()}}),e,this,[[2,13,17,20]])})))}},{key:"invoke",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return oc(this,void 0,void 0,Ya().mark((function t(){var r,i=this;return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new Promise((function(t,r){var o,a;(null===(a=i.hubProxy)||void 0===a?void 0:(o=a).invoke.apply(o,[e].concat(n))).done(t).fail(r)})),t.abrupt("return",ha.fromPromise(r).timeout(2e4));case 2:case"end":return t.stop()}}),t)})))}},{key:"handleDeviceList",value:function(e){this.devices=e.filter((function(e){return"vivi"!==e.type})).map(t.convertToGenericDevice),this.trigger("deviceschange",ka.void)}},{key:"handleDeviceStateChange",value:function(e){var n=this.devices.findIndex((function(t){return t.id===e.deviceId}));n>=0&&(this.devices[n]=t.convertToGenericDevice(e),this.trigger("deviceschange",ka.void))}},{key:"handleDevicePaired",value:function(e){"vivi"!==e.type&&(this.devices.push(t.convertToGenericDevice(e)),this.trigger("deviceschange",ka.void))}},{key:"handleDeviceUnpaired",value:function(e){this.devices=this.devices.filter((function(t){return t.id!==e})),this.trigger("deviceschange",ka.void)}},{key:"handlePlayStatusChange",value:function(e,t){this.trigger("message",{event:ja.PlaybackStatusChange,deviceId:e,params:{playbackStatus:t.commandType}})}},{key:"handleTimeSync",value:function(e,t){this.trigger("message",{event:ja.PositionChange,deviceId:e,params:{position:t}})}},{key:"dispose",value:function(){var e,n,r;this.hubProxy.off(nc.DeviceList,this.handleDeviceList),this.hubProxy.off(nc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.off(nc.Paired,this.handleDevicePaired),this.hubProxy.off(nc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.off(nc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.off(nc.TimeSync,this.handleTimeSync),this.hubProxy.connection.stop(!1,!0),this.heartbeat.stop(),(e=t,n=this,"function"==typeof(r=Ja(ec(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{key:"canCastToDevice",value:function(e){return e===la.AppleTv}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new Wa(this,e)}},{key:"lock",value:function(e){var t;return oc(this,void 0,void 0,Ya().mark((function n(){return Ya().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.invoke(rc.Lock,e,this.options.userId,null!==(t=this.options.username)&&void 0!==t?t:"");case 2:if(n.sent){n.next=5;break}throw new Error("Could not lock device");case 5:case"end":return n.stop()}}),n,this)})))}},{key:"loadVideo",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.options.trackingCode){t.next=2;break}throw new Error("Tracking code must be provided to cast videos");case 2:return t.next=4,this.invoke(rc.Command,{DeviceId:e,CommandType:Pa.Play,Data:this.options.trackingCode});case 4:case"end":return t.stop()}}),t,this)})))}},{key:"play",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Command,{DeviceId:e,CommandType:Pa.Play});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Command,{DeviceId:e,CommandType:Pa.Pause});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"seek",value:function(e,t){this.invokeDebounced(rc.Command,{DeviceId:e,CommandType:Pa.Play,Params:"1,".concat(Math.trunc(t))})}},{key:"stop",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Command,{DeviceId:e,CommandType:Pa.Stop});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pair",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){var n;return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Pair,e);case 2:if(n=t.sent){t.next=5;break}throw new Error("Could not pair device");case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"unpair",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Unpair,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"renameDevice",value:function(e){var t=e.deviceId,n=e.deviceName;return oc(this,void 0,void 0,Ya().mark((function e(){return Ya().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke(rc.RenameDevice,t,n);case 2:if(e.sent){e.next=5;break}throw new Error("Could not rename device");case 5:case"end":return e.stop()}}),e,this)})))}}],i=[{key:"convertToGenericDeviceStatus",value:function(e){switch(e){case Na.Online:return sa.Available;case Na.Locked:return sa.Busy;case Na.Suspended:case Na.Offline:return sa.Offline}}},{key:"convertToGenericDevice",value:function(e){return{id:e.deviceId,name:e.name,type:la.AppleTv,status:t.convertToGenericDeviceStatus(e.status)}}}],r&&Ka(n.prototype,r),i&&Ka(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Sa);function cc(e){return cc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cc(e)}function lc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,sc(r.key),r)}}function sc(e){var t=function(e){if("object"!=cc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=cc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==cc(t)?t:t+""}var uc={reconnectIntervalInMilliseconds:3e3,heartbeatEnabled:!1,heartbeatIntervalInMillseconds:1e4,heartbeatMessage:""},fc=function(){return e=function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:uc;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bindFunctions(),this.url=t,this.options=Object.assign(Object.assign({},uc),r),this.webSocket=this.connect(),this.heartbeat=(new Ia).schedule((function(){return n.send(n.options.heartbeatMessage)})).every(this.options.heartbeatIntervalInMillseconds)},(t=[{key:"bindFunctions",value:function(){this.cleanup=this.cleanup.bind(this),this.handleOpen=this.handleOpen.bind(this),this.handleMessage=this.handleMessage.bind(this),this.handleClose=this.handleClose.bind(this),this.handleError=this.handleError.bind(this),this.connect=this.connect.bind(this),this.send=this.send.bind(this),this.dipose=this.dipose.bind(this)}},{key:"cleanup",value:function(){this.heartbeat.stop(),this.webSocket.removeEventListener("error",this.handleError),this.webSocket.removeEventListener("message",this.handleMessage),this.webSocket.removeEventListener("open",this.handleOpen),this.webSocket.removeEventListener("close",this.handleClose)}},{key:"handleOpen",value:function(e){var t;null===(t=this.onOpen)||void 0===t||t.call(this,e),this.options.heartbeatEnabled&&this.heartbeat.start()}},{key:"handleMessage",value:function(e){var t;null===(t=this.onMessage)||void 0===t||t.call(this,e)}},{key:"handleClose",value:function(e){var t,n=this;null===(t=this.onClose)||void 0===t||t.call(this,e),this.cleanup(),setTimeout((function(){n.webSocket=n.connect()}),this.options.reconnectIntervalInMilliseconds)}},{key:"handleError",value:function(e){var t;null===(t=this.onError)||void 0===t||t.call(this,e),this.handleClose()}},{key:"connect",value:function(){var e=new WebSocket(this.url);return e.addEventListener("open",this.handleOpen),e.addEventListener("message",this.handleMessage),e.addEventListener("close",this.handleClose),e.addEventListener("error",this.handleError),e}},{key:"send",value:function(e){this.webSocket.send(e)}},{key:"dipose",value:function(){this.cleanup(),this.webSocket.close()}}])&&lc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),dc=n(27993);function pc(e){return pc="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},pc(e)}function mc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,hc(r.key),r)}}function hc(e){var t=function(e){if("object"!=pc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=pc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pc(t)?t:t+""}var vc,yc=function(){return e=function e(t,n){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._timerStartedAt=0,this.position=0,this.duration=void 0,this.playing=!1,this.mute=!1,this.videoSource="",this.subtitleSource="",this.subtitles=!1,this.volume=0,this.title=t,this.device=n,this.ready=!1,this.playbackFinished=!1,this.debounced=Ta(this,2e3),_a(this)},(t=[{key:"position",get:function(){return this._position+this.getTimerDurationInSeconds()},set:function(e){this._position=e,this.restartTimer()}},{key:"playing",get:function(){return this._playing},set:function(e){this._playing=e,e?this.restartTimer():(this._position+=this.getTimerDurationInSeconds(),this.stopTimer())}},{key:"restartTimer",value:function(){this._timerStartedAt=Date.now()}},{key:"stopTimer",value:function(){this._timerStartedAt=0}},{key:"getTimerDurationInSeconds",value:function(){return this._timerStartedAt?(Date.now()-this._timerStartedAt)/1e3:0}}])&&mc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function gc(e){return gc="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},gc(e)}function bc(){bc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==gc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(gc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function wc(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,Ec(r.key),r)}}function Ec(e){var t=function(e){if("object"!=gc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=gc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gc(t)?t:t+""}function Sc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Sc=function(){return!!e})()}function kc(){return kc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=xc(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},kc.apply(null,arguments)}function xc(e){return xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xc(e)}function Oc(e,t){return Oc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Oc(e,t)}!function(e){e.Update="update",e.Volume="volume",e.Playing="playing",e.Paused="paused",e.NewChapter="new_chapter",e.Stopped="stopped",e.Ready="ready",e.Mute="mute",e.Finished="finished",e.Subtitles="subtitles"}(vc||(vc={}));var Cc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Nc=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=xc(t),function(e,t){if(t&&("object"==gc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Sc()?Reflect.construct(t,n||[],xc(e).constructor):t.apply(e,n))}(this,t)).client=e,r.localState=new yc(n.title,n.device),r.bindFunctions(),r.initialize(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Oc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.handleClientConnected=this.handleClientConnected.bind(this),this.handleDisconnectMessage=this.handleDisconnectMessage.bind(this),this.handleAllVideoMessages=this.handleAllVideoMessages.bind(this),this.handleUpdateMessage=this.handleUpdateMessage.bind(this),this.handleVolumeMessage=this.handleVolumeMessage.bind(this),this.handlePlayingMessage=this.handlePlayingMessage.bind(this),this.handlePausedMessage=this.handlePausedMessage.bind(this),this.handleFinishedMessage=this.handleFinishedMessage.bind(this),this.handleNewChapterMessage=this.handleNewChapterMessage.bind(this),this.handleStoppedMessage=this.handleStoppedMessage.bind(this),this.loadSource=this.loadSource.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.isPlaying=this.isPlaying.bind(this),this.getPosition=this.getPosition.bind(this),this.getDuration=this.getDuration.bind(this),this.getVolume=this.getVolume.bind(this)}},{key:"initialize",value:function(){var e=this;this.client.on("dispose",this.dispose),this.client.on("connected",this.handleClientConnected),this.client.on("message",this.handleDisconnectMessage).filter((function(t){return t.source===e.getDevice().id&&"disconnect"===t.message.type})),this.client.on("message",this.handleAllVideoMessages).filter((function(t){return t.source===e.getDevice().id&&"video_event"===t.message.type}))}},{key:"dispose",value:function(){var e,n,r;this.client.off("dispose",this.dispose),this.client.off("connected",this.handleClientConnected),this.client.off("message",this.handleDisconnectMessage),this.client.off("message",this.handleAllVideoMessages),this.client.stop(this.getDevice().id).catch((function(e){return console.error(e)})),(e=t,n=this,"function"==typeof(r=kc(xc(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{key:"handleClientConnected",value:function(){return Cc(this,void 0,void 0,bc().mark((function e(){return bc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.client.joinRoom(this.getDevice().id);case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),this.trigger("error",e.t0);case 8:case"end":return e.stop()}}),e,this,[[0,5]])})))}},{key:"handleDisconnectMessage",value:function(){this.dispose()}},{key:"handleAllVideoMessages",value:function(e){var t=this.localState.debounced,n=e.message.payload.params||{};switch(e.message.payload.event){case vc.Update:this.handleUpdateMessage(t,n);break;case vc.NewChapter:this.handleNewChapterMessage(t,n);break;case vc.Volume:this.handleVolumeMessage(t,n);break;case vc.Playing:this.handlePlayingMessage(t);break;case vc.Paused:this.handlePausedMessage(t);break;case vc.Finished:this.handleFinishedMessage(t);break;case vc.Stopped:this.handleStoppedMessage()}}},{key:"handleUpdateMessage",value:function(e,t){e.duration!==t.duration&&(e.duration=t.duration,this.trigger("durationchange",ka.void)),e.position!==t.position&&(e.position=t.position,this.trigger("positionchange",ka.void)),e.subtitles!==t.subtitles&&(e.subtitles=t.subtitles,this.trigger("subtitleschange",ka.void))}},{key:"handleVolumeMessage",value:function(e,t){e.volume!==t.level&&(e.volume=t.level,e.mute=0===t.level,this.trigger("volumechange",ka.void))}},{key:"handlePlayingMessage",value:function(e){!0!==e.playing&&(e.playing=!0,e.playbackFinished=!1,this.trigger("playingchange",ka.void))}},{key:"handlePausedMessage",value:function(e){!1!==e.playing&&(e.playing=!1,this.trigger("playingchange",ka.void))}},{key:"handleFinishedMessage",value:function(e){!0!==e.playbackFinished&&(e.playing=!1,e.playbackFinished=!0,this.trigger("playingchange",ka.void))}},{key:"handleNewChapterMessage",value:function(e,t){var n,r=(null!==(n=t.queue)&&void 0!==n?n:[]).find((function(t){return t.url===e.videoSource}));if(!r)return console.info("The device is no longer playing the source we loaded - disposing the session"),void this.dispose();e.subtitleSource!==r.suburl&&(e.subtitleSource=r.suburl,this.trigger("subtitleschange",ka.void))}},{key:"handleStoppedMessage",value:function(){this.dispose()}},{key:"loadSource",value:function(e,t){return Cc(this,void 0,void 0,bc().mark((function n(){var r,i;return bc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.localState.videoSource!==e||this.localState.subtitleSource!==t){n.next=2;break}return n.abrupt("return");case 2:return n.prev=2,r=this.getDevice().id,i=this.getPosition(),this.localState.videoSource=e,this.localState.subtitleSource=t,this.localState.ready=!1,n.next=10,this.client.joinRoom(r);case 10:return n.next=12,this.client.loadQueue({title:this.getTitle(),roomId:r,videoSource:e,subtitleSource:t});case 12:this.localState.ready=!0,this.trigger("sourceloaded",ka.void),i>0&&this.seek(i),t&&this.setSubtitles(t),n.next=22;break;case 18:n.prev=18,n.t0=n.catch(2),console.error(n.t0),this.trigger("error",new Error("Could not load video on Vivi device"));case 22:case"end":return n.stop()}}),n,this,[[2,18]])})))}},{key:"play",value:function(){this.localState.ready&&!0!==this.localState.playing&&(this.localState.playing=!0,this.client.play(this.getDevice().id),this.trigger("playingchange",ka.void))}},{key:"pause",value:function(){this.localState.ready&&!1!==this.localState.playing&&(this.localState.playing=!1,this.client.pause(this.getDevice().id),this.trigger("playingchange",ka.void))}},{key:"seek",value:function(e){this.localState.ready&&this.localState.position!==e&&(this.localState.position=e,this.client.seek(this.getDevice().id,e),this.trigger("positionchange",ka.void))}},{key:"setVolume",value:function(e){this.localState.ready&&this.localState.volume!==e&&(this.localState.volume=e,this.client.setVolume(this.getDevice().id,e),this.trigger("volumechange",ka.void))}},{key:"setMuted",value:function(e){this.localState.ready&&this.localState.mute!==e&&(this.localState.mute=e,this.client.setMuted(this.getDevice().id,e),this.trigger("volumechange",ka.void))}},{key:"setSubtitles",value:function(e){return Cc(this,void 0,void 0,bc().mark((function t(){var n;return bc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.localState.ready){t.next=2;break}return t.abrupt("return");case 2:if(!e){t.next=5;break}return t.next=5,this.loadSource(this.localState.videoSource,e);case 5:n=!!e,this.localState.subtitles!==n&&(this.localState.subtitles=n,this.client.setSubtitles(this.getDevice().id,n),this.trigger("subtitleschange",ka.void));case 7:case"end":return t.stop()}}),t,this)})))}},{key:"isPlaying",value:function(){return this.localState.playing}},{key:"isPlaybackFinished",value:function(){return this.localState.playbackFinished}},{key:"getPosition",value:function(){return this.localState.position}},{key:"getDuration",value:function(){return this.localState.duration}},{key:"getVolume",value:function(){return this.localState.volume}},{key:"getMuted",value:function(){return this.localState.mute}},{key:"getSubtitles",value:function(){if(this.localState.subtitles)return this.localState.subtitleSource}},{key:"getDevice",value:function(){return this.localState.device}},{key:"getTitle",value:function(){return this.localState.title}}],r&&wc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Sa);function jc(e){return jc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jc(e)}function Pc(){Pc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==jc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(jc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ic(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,Lc(r.key),r)}}function Lc(e){var t=function(e){if("object"!=jc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=jc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jc(t)?t:t+""}function Tc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Tc=function(){return!!e})()}function _c(){return _c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ac(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},_c.apply(null,arguments)}function Ac(e){return Ac=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ac(e)}function Fc(e,t){return Fc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fc(e,t)}var Dc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Rc=1e4,Mc=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=Ac(t),function(e,t){if(t&&("object"==jc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Tc()?Reflect.construct(t,n||[],Ac(e).constructor):t.apply(e,n))}(this,t)).options=e,n.accessToken="",n.devices=[],n.devicesFingerprint="",n.deviceDiscovery=new Ia,n.bindFunctions(),n.initialize(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendMessageDebounced=(0,La.Ds)(this.sendMessage,500,!0),this.beginDeviceDiscovery=this.beginDeviceDiscovery.bind(this),this.dispose=this.dispose.bind(this),this.canCastToDevice=this.canCastToDevice.bind(this),this.getDevices=this.getDevices.bind(this),this.startCastSession=this.startCastSession.bind(this),this.authenticateWithVivi=this.authenticateWithVivi.bind(this),this.getRoomList=this.getRoomList.bind(this),this.joinRoom=this.joinRoom.bind(this),this.query=this.query.bind(this),this.loadQueue=this.loadQueue.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.stop=this.stop.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.setMuted=this.setMuted.bind(this),this.setSubtitles=this.setSubtitles.bind(this)}},{key:"initialize",value:function(){var e=this;this.webSocket=new fc(this.options.url),this.webSocket.onMessage=function(t){return e.trigger("message",JSON.parse(t.data))},this.webSocket.onOpen=function(){return Dc(e,void 0,void 0,Pc().mark((function e(){return Pc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.options.fetchAccessToken();case 3:return this.accessToken=e.sent,e.next=6,this.authenticateWithVivi();case 6:this.beginDeviceDiscovery(),this.trigger("connected",ka.void),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.error(e.t0),this.trigger("error",new Error("Could not connect to Vivi"));case 14:case"end":return e.stop()}}),e,this,[[0,10]])})))}}},{key:"sendMessage",value:function(e){var t;null===(t=this.webSocket)||void 0===t||t.send(JSON.stringify(e))}},{key:"beginDeviceDiscovery",value:function(){var e=this;this.deviceDiscovery.every(1e4).schedule((function(){return Dc(e,void 0,void 0,Pc().mark((function e(){var n,r,i,o;return Pc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getRoomList();case 3:if(n=e.sent,(r=t.calculateFingerprint(n))!==this.devicesFingerprint){e.next=7;break}return e.abrupt("return");case 7:i=new Set(n.map((function(e){var t;return null!==(t=e.organisation)&&void 0!==t?t:""}))).size,o=new Set(n.map((function(e){var t;return null!==(t=e.location)&&void 0!==t?t:""}))).size,this.devices=n.map((function(e){return{id:e.id,name:e.name,schoolName:i>1?e.organisation:"",description:o>1?e.location:"",type:la.Vivi,status:sa.Available}})),this.devicesFingerprint=r,this.trigger("deviceschange",ka.void),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(0),console.warn(e.t0);case 17:case"end":return e.stop()}}),e,this,[[0,14]])})))})).trigger().start()}},{key:"dispose",value:function(){var e,n,r,i;this.deviceDiscovery.stop(),null===(e=this.webSocket)||void 0===e||e.dipose(),(n=t,r=this,"function"==typeof(i=_c(Ac(1&3?n.prototype:n),"dispose",r))?function(e){return i.apply(r,e)}:i)([])}},{key:"canCastToDevice",value:function(e){return e===la.Vivi}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new Nc(this,e)}},{key:"authenticateWithVivi",value:function(){return Dc(this,void 0,void 0,Pc().mark((function e(){return Pc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:"relay",message:{token:this.accessToken,type:"identify_video_api"}}),e.next=3,this.one("message",(function(e){return"video_api_identified"===e.message.type})).timeout(Rc).catch((function(){throw new Error("Failed to authenticate with Vivi")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getRoomList",value:function(){return Dc(this,void 0,void 0,Pc().mark((function e(){var t;return Pc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:"relay",message:{type:"video_api_rooms"}}),e.next=3,this.one("message",(function(e){return"video_api_rooms"===e.message.type})).timeout(Rc).catch((function(){throw new Error("Failed to fetch rooms")}));case 3:return t=e.sent,e.abrupt("return",t.message.rooms||[]);case 5:case"end":return e.stop()}}),e,this)})))}},{key:"joinRoom",value:function(e){return Dc(this,void 0,void 0,Pc().mark((function t(){return Pc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:"relay",message:{destination_type:"box",new_destination:e,token:this.accessToken,type:"connect"}}),t.next=3,this.one("message",(function(t){return t.source===e&&"connect"===t.message.type||"error"===t.message.type&&"already_connected"===t.message.error_type||void 0})).timeout(Rc).catch((function(){throw new Error("Failed to join room")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"query",value:function(e){return Dc(this,void 0,void 0,Pc().mark((function n(){var r;return Pc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.createAckId(),this.sendMessage({destination:e,message:{type:"message_with_ack",ack_id:r,name:"query"}}),n.next=4,this.one("message",(function(e){return e.message.ack_id===r})).timeout(Rc).catch((function(){throw new Error("Failed to fetch query")}));case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),n,this)})))}},{key:"loadQueue",value:function(e){var n=e.roomId,r=e.title,i=e.videoSource,o=e.subtitleSource;return Dc(this,void 0,void 0,Pc().mark((function e(){return Pc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:n,message:{type:"message_with_ack",ack_id:t.createAckId(),name:"queue_load",payload:{urls:[{title:r,url:i,suburl:o}]}}}),e.next=3,this.one("message",(function(e){var t;return e.source===n&&"ready"===(null===(t=e.message.payload)||void 0===t?void 0:t.event)})).timeout(Rc).catch((function(){throw new Error("Failed to load media")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"play",value:function(e){return Dc(this,void 0,void 0,Pc().mark((function t(){return Pc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"video_play",payload:{}}}),t.next=3,this.one("message",(function(t){var n;return t.source===e&&"playing"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to play video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return Dc(this,void 0,void 0,Pc().mark((function t(){return Pc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"video_pause"}}),t.next=3,this.one("message",(function(t){var n;return t.source===e&&"paused"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to pause video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"stop",value:function(e){return Dc(this,void 0,void 0,Pc().mark((function t(){return Pc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"video_stop"}}),t.next=3,this.one("message",(function(t){var n;return t.source===e&&"stopped"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to stop video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"seek",value:function(e,t){return Dc(this,void 0,void 0,Pc().mark((function n(){return Pc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this.sendMessageDebounced({destination:e,message:{type:"message",name:"video_seek",payload:{position:t}}})){n.next=4;break}return n.next=4,this.one("message",(function(t){var n;return t.source===e&&"playing"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to seek video")}));case 4:case"end":return n.stop()}}),n,this)})))}},{key:"setVolume",value:function(e,t){return Dc(this,void 0,void 0,Pc().mark((function n(){return Pc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this.sendMessageDebounced({destination:e,message:{type:"message",name:"set_volume",payload:{volume:t}}})){n.next=4;break}return n.next=4,this.one("message",(function(t){var n;return t.source===e&&"volume"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to set volume")}));case 4:case"end":return n.stop()}}),n,this)})))}},{key:"setMuted",value:function(e,t){return Dc(this,void 0,void 0,Pc().mark((function n(){return Pc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"set_mute",payload:{mute:t}}}),n.next=3,this.one("message",(function(t){var n;return t.source===e&&"mute"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to set mute")}));case 3:case"end":return n.stop()}}),n,this)})))}},{key:"setSubtitles",value:function(e,n){return Dc(this,void 0,void 0,Pc().mark((function r(){var i;return Pc().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=t.createAckId(),this.sendMessage({destination:e,message:{type:"message_with_ack",ack_id:i,name:"set_subtitles",payload:{subtitles:n}}}),r.next=4,this.one("message",(function(t){var n;return t.source===e&&"subtitles"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to set subtitles")}));case 4:case"end":return r.stop()}}),r,this)})))}}],i=[{key:"createAckId",value:function(){return dc.x.generateRandomId()}},{key:"calculateFingerprint",value:function(e){return e.map((function(e){return e.id})).sort().join(",")}}],r&&Ic(n.prototype,r),i&&Ic(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Sa);function Uc(e){return Uc="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},Uc(e)}function Vc(e){return function(e){if(Array.isArray(e))return Bc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Bc(e,t);var n={}.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)?Bc(e,t):void 0}}(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 Bc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function qc(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,Gc(r.key),r)}}function Gc(e){var t=function(e){if("object"!=Uc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Uc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Uc(t)?t:t+""}function Zc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Zc=function(){return!!e})()}function zc(){return zc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Hc(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},zc.apply(null,arguments)}function Hc(e){return Hc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Hc(e)}function Wc(e,t){return Wc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Wc(e,t)}var Qc=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=Hc(t),function(e,t){if(t&&("object"==Uc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Zc()?Reflect.construct(t,n||[],Hc(e).constructor):t.apply(e,n))}(this,t)).instanceId=e,n.clients=[],n.bindFunctions(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Wc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.addClient=this.addClient.bind(this),this.hasInstanceOfClient=this.hasInstanceOfClient.bind(this),this.startCastSession=this.startCastSession.bind(this),this.gatherAndPublishDevices=this.gatherAndPublishDevices.bind(this),this.dispose=this.dispose.bind(this)}},{key:"addClient",value:function(e){var t=this;e.on("deviceschange",this.gatherAndPublishDevices),e.on("error",(function(e){return t.trigger("error",e)})),this.clients.push(e)}},{key:"hasInstanceOfClient",value:function(e){return this.clients.some((function(t){return t instanceof e}))}},{key:"startCastSession",value:function(e){var t=this;if(this.castSession){if(this.castSession.getDevice().id===e.device.id)return void console.info("A session with device ".concat(e.device.id," already exists - this is a no-op"));this.castSession.dispose()}var n=this.clients.find((function(t){return t.canCastToDevice(e.device.type)}));n&&(this.castSession=n.startCastSession(e),this.castSession.on("error",(function(e){t.castSession.dispose(),t.trigger("error",e)})),this.castSession.on("dispose",(function(){t.castSession=void 0,t.trigger("castsessionchange",void 0)})),this.trigger("castsessionchange",this.castSession))}},{key:"getCastSession",value:function(){return this.castSession}},{key:"gatherAndPublishDevices",value:function(){var e=this.clients.map((function(e){return e.getDevices()})).reduce((function(e,t){return[].concat(Vc(e),Vc(t))}),[]);this.trigger("deviceschange",e)}},{key:"dispose",value:function(){var e,n,r,i;null===(e=this.castSession)||void 0===e||e.dispose(),this.clients.forEach((function(e){return e.dispose()})),this.castSession=void 0,this.clients=[],(n=t,r=this,"function"==typeof(i=zc(Hc(1&3?n.prototype:n),"dispose",r))?function(e){return i.apply(r,e)}:i)([])}}],i=[{key:"getOrCreateInstance",value:function(e){if(!e)throw new Error("instanceId is required");return this.instances[e]||(this.instances[e]=new t(e)),this.instances[e]}},{key:"disposeAndRemoveInstance",value:function(e){e.dispose(),delete this.instances[e.instanceId]}},{key:"isActive",value:function(){return Object.keys(this.instances).length>0}}],r&&qc(n.prototype,r),i&&qc(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Sa);Qc.instances={};var Yc=n(12424),Kc=n(29206);function $c(e){return $c="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},$c(e)}function Xc(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,Jc(r.key),r)}}function Jc(e){var t=function(e){if("object"!=$c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=$c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$c(t)?t:t+""}function el(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(el=function(){return!!e})()}function tl(e,t,n,r){var i=nl(rl(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function nl(){return nl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=rl(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},nl.apply(null,arguments)}function rl(e){return rl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},rl(e)}function il(e,t){return il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},il(e,t)}var ol=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=rl(t),function(e,t){if(t&&("object"==$c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,el()?Reflect.construct(t,n||[],rl(e).constructor):t.apply(e,n))}(this,t,[e,n])).isVisible=r.isVisible.bind(r),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&il(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){var e,n;return tl(t,"createEl",this,3)(["li",{className:"vjs-menu-item cv-device-menu-item",innerHTML:'\n <div class="cv-device-menu-item-body">\n <span class="cv-device-icon '.concat({vivi:"cv-vivi-icon","apple-tv":"cv-apple-icon"}[this.options_.type],'"></span>\n <div>\n <span class="vjs-menu-item-text">').concat(this.options_.label,'</span>\n <span class="vjs-menu-item-text cv-device-truncated-text">').concat(null!==(e=this.options_.schoolName)&&void 0!==e?e:"",'</span>\n <span class="vjs-menu-item-text cv-device-truncated-text cv-device-description">').concat(null!==(n=this.options_.description)&&void 0!==n?n:"","</span>\n </div>\n </div>\n ")}])}},{key:"handleClick",value:function(){this.options_.onClick()}},{key:"show",value:function(){tl(t,"show",this,3)([])}},{key:"hide",value:function(){tl(t,"hide",this,3)([])}},{key:"isVisible",value:function(){return!tl(t,"hasClass",this,3)(["vjs-hidden"])}}])&&Xc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("MenuItem")),al=n(86777),cl=n(46620);function ll(e){return ll="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},ll(e)}function sl(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,ul(r.key),r)}}function ul(e){var t=function(e){if("object"!=ll(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ll(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ll(t)?t:t+""}function fl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(fl=function(){return!!e})()}function dl(e){return dl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dl(e)}function pl(e,t){return pl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pl(e,t)}var ml=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t,n){return t=dl(t),function(e,t){if(t&&("object"==ll(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,fl()?Reflect.construct(t,n||[],dl(e).constructor):t.apply(e,n))}(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pl(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){var e=cl.W.apply(this),t=this.contentEl_;return this.contentWrapper=ie.Z.dom.createEl("div",{className:"vjs-menu-content"}),e.className="vjs-menu cv-devices-menu",t.className="cv-devices-menu-item-list",e.removeChild(t),e.appendChild(this.contentWrapper),this.contentWrapper.appendChild(t),this.simpleBar=new al.Z(t,{autoHide:!1}),e}},{key:"addCta",value:function(e){this.ctaElement?console.warn("CTA has already been added to the menu - this is a no-op"):(this.ctaElement=e.el(),this.contentWrapper.prepend(this.ctaElement),this.el().classList.add("has-cta"))}},{key:"removeCta",value:function(){this.ctaElement&&(this.contentWrapper.removeChild(this.ctaElement),this.el().classList.remove("has-cta"))}}])&&sl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("Menu"));function hl(e){var t=e.inactiveIntegrations,n=e.canUserManageIntegrations,i=e.player,o=e.onDismiss,a=e.onInstall,c=e.onLearnMore,l=e.onContactSupport;if(0===t.length)return r.createElement(r.Fragment,null);var s,u=function(e){return i.localize(e)},f=function(e){return-1!==t.indexOf(e)};return s=f(la.AppleTv)&&f(la.Vivi)?"vivi_and_apple_tv":f(la.Vivi)?"vivi":"apple_tv",r.createElement("div",{className:"cv-devices-cta",tabIndex:-1},r.createElement(vl,{context:s,localize:u,onDismiss:function(){return o(s)}}),r.createElement(yl,{context:s}),r.createElement(gl,{context:s,canUserManageIntegrations:n,localize:u,onContactSupport:function(){return l(s)},onInstall:function(){return a(s)},onLearnMore:function(){return c(s)}}))}function vl(e){var t=e.context,n=e.localize,i=e.onDismiss;return r.createElement("div",{className:"cv-devices-cta-header"},r.createElement("span",{className:"cv-devices-badge"},n("New")),r.createElement("span",{className:"cv-devices-title"},"vivi_and_apple_tv"===t&&n("Cast to Vivi and Apple TV"),"vivi"===t&&n("Cast to Vivi"),"apple_tv"===t&&n("Cast to Apple TV")),r.createElement("span",{className:"cv-devices-close",onClick:i},r.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"white",d:"M11.9588 10.6413L16.3612 6.34478C16.7361 5.97191 17.3439 5.97191 17.7188 6.34478C18.0937 6.71764 18.0937 7.32218 17.7188 7.69505L13.3165 11.9916L17.7188 16.3701C18.0937 16.7429 18.0937 17.3475 17.7188 17.7203C17.3439 18.0932 16.7361 18.0932 16.3612 17.7203L11.9588 13.3419L7.63882 17.7203C7.26392 18.0932 6.65608 18.0932 6.28118 17.7203C5.90627 17.3475 5.90627 16.7429 6.28118 16.3701L10.6012 11.9916L6.28118 7.62993C5.90627 7.25706 5.90627 6.65252 6.28118 6.27965C6.65608 5.90678 7.26392 5.90678 7.63882 6.27965L11.9588 10.6413Z"}))))}function yl(e){var t=e.context,n="vivi_and_apple_tv"===t?"bg-vivi-and-apple":"vivi"===t?"bg-vivi":"bg-apple";return r.createElement("div",{className:"cv-devices-cta-body ".concat(n)},("vivi_and_apple_tv"===t||"apple_tv"===t)&&r.createElement("div",{className:"cv-devices-icon-container"},r.createElement("span",{className:"cv-devices-icon apple"})),("vivi_and_apple_tv"===t||"vivi"===t)&&r.createElement("div",{className:"cv-devices-icon-container"},r.createElement("span",{className:"cv-devices-icon vivi"})))}function gl(e){var t=e.context,n=e.canUserManageIntegrations,i=e.localize,o=e.onInstall,a=e.onLearnMore,c=e.onContactSupport;return n?r.createElement("div",{className:"cv-devices-cta-footer"},r.createElement("span",null,"vivi_and_apple_tv"===t&&i("Discover our new device integrations to make presenting in the classroom easy!"),"vivi"===t&&i("Discover our new Vivi integration."),"apple_tv"===t&&i("Discover our new Apple TV integration.")),r.createElement("br",null),r.createElement("span",{className:"cv-devices-link",onClick:o},i("Click here to install"))):r.createElement("div",{className:"cv-devices-cta-footer"},r.createElement("span",null,"vivi_and_apple_tv"===t&&i("Cast to Vivi and Apple TV is now available! Please contact "),"vivi"===t&&i("Cast to Vivi is now available! Please contact "),"apple_tv"===t&&i("Cast to Apple TV is now available! Please contact ")),r.createElement("span",{className:"cv-devices-link",onClick:c},"ClickView Support"),r.createElement("span",null,"vivi_and_apple_tv"===t&&i(" or your administrator to set up Apple TV and Vivi."),"vivi"===t&&i(" or your administrator to set up Vivi."),"apple_tv"===t&&i(" or your administrator to set up Apple TV.")),r.createElement("br",null),r.createElement("span",{className:"cv-devices-link",onClick:a},"Learn more"))}function bl(e){return bl="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},bl(e)}function wl(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,El(r.key),r)}}function El(e){var t=function(e){if("object"!=bl(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=bl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bl(t)?t:t+""}function Sl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Sl=function(){return!!e})()}function kl(e,t,n,r){var i=xl(Ol(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function xl(){return xl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ol(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},xl.apply(null,arguments)}function Ol(e){return Ol=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ol(e)}function Cl(e,t){return Cl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Cl(e,t)}ie.Z.registerComponent("DevicesMenu",ml),ie.Z.registerComponent("DevicesCta",lo((function(e,t){return r.createElement(hl,Object.assign({player:e},t))}),{properties:{className:"cv-devices-cta-wrapper"}}));var Nl=ie.Z.getComponent("DevicesCta"),jl=ie.Z.getComponent("MenuButton"),Pl=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=Ol(t),function(e,t){if(t&&("object"==bl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Sl()?Reflect.construct(t,n||[],Ol(e).constructor):t.apply(e,n))}(this,t,[e,n])).alwaysCollapsed=!1,r.isCollapsed=!1,r.isCollabsible=!0,r.className="cv-devices-menu-button",r.searchText="",r.devices=[],r.castSession=void 0,r.bindFunctions(),r.bindEventListeners(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Cl(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.bindEventListeners=this.bindEventListeners.bind(this),this.setDevices=this.setDevices.bind(this),this.setCastSession=this.setCastSession.bind(this),this.setSearchText=this.setSearchText.bind(this),this.getDeviceMenuItems=this.getDeviceMenuItems.bind(this),this.showNotificationBadge=this.showNotificationBadge.bind(this),this.hideNotificationBadge=this.hideNotificationBadge.bind(this),this.render=this.render.bind(this),this.removeMenuItems=this.removeMenuItems.bind(this),this.addMenuItemsForDevices=this.addMenuItemsForDevices.bind(this),this.shouldShowSearchInput=this.shouldShowSearchInput.bind(this),this.toggleSearchInput=this.toggleSearchInput.bind(this),this.toggleDeviceMenuItems=this.toggleDeviceMenuItems.bind(this),this.toggleEmptyStatePlaceholder=this.toggleEmptyStatePlaceholder.bind(this)}},{key:"bindEventListeners",value:function(){var e=this,t=this.$("button"),n=function(t){e.menu.handleBlur(t)};t.addEventListener("blur",n),this.one("dispose",(function(){var r;t.removeEventListener("blur",n),null===(r=e.cta)||void 0===r||r.dispose()}))}},{key:"createEl",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=jl.prototype.createEl).apply.apply(e,[this].concat(n))}},{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-devices-button ".concat(kl(t,"buildWrapperCSSClass",this,3)([]))}},{key:"createMenu",value:function(){var e=this,t=new ml(this.player_,{menuButton:this});if(!this.options_.ctaOptions.hasBeenDismissed&&this.options_.ctaOptions.inactiveIntegrations.length>0){var n=this.options_.ctaOptions,r=n.onDismiss,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(n,["onDismiss"]);this.cta=new Nl(this.player(),Object.assign(Object.assign({},i),{onDismiss:function(n){e.hideNotificationBadge(),t.removeCta(),r(n)}})),this.showNotificationBadge(),t.addCta(this.cta)}return this.createItems().forEach((function(e){return t.addItem(e)})),t}},{key:"createItems",value:function(){var e=this,t=[];return this.headingItem=new Yc.Z(this.player_,{label:this.localize("Select a device"),selectable:!1}),this.searchInputItem=new Kc.Z(this.player_,{menuButton:this,search:function(t){return e.setSearchText(t)},className:"cv-devices-search-input"}),this.emptyPlaceholder=new Kc.C(this.player_,{label:"No devices found",selected:!1,selectable:!1,multiSelectable:!1}),this.headingItem.show(),this.searchInputItem.hide(),this.emptyPlaceholder.show(),t.push(this.headingItem,this.searchInputItem,this.emptyPlaceholder),t}},{key:"pressButton",value:function(){var e;kl(t,"pressButton",this,3)([]),this.shouldShowSearchInput()&&(null===(e=this.searchInputItem)||void 0===e||e.focus())}},{key:"setDevices",value:function(e){this.devices=e,this.render()}},{key:"setCastSession",value:function(e){this.castSession=e,this.render()}},{key:"setSearchText",value:function(e){this.searchText=e,this.render()}},{key:"getDeviceMenuItems",value:function(){return this.menu.children_.filter((function(e){return e instanceof ol}))}},{key:"showNotificationBadge",value:function(){this.addClass("notification-badge")}},{key:"hideNotificationBadge",value:function(){this.removeClass("notification-badge")}},{key:"render",value:function(){this.removeMenuItems(this.getDeviceMenuItems()),this.addMenuItemsForDevices(this.devices),this.toggleSearchInput(),this.toggleDeviceMenuItems(),this.toggleEmptyStatePlaceholder()}},{key:"removeMenuItems",value:function(e){var t=this;e.forEach((function(e){t.menu.removeChild(e),e.dispose()}))}},{key:"addMenuItemsForDevices",value:function(e){var t=this;e.sort((function(e,t){var n,r,i,o,a="".concat(e.type).concat(null!==(n=e.schoolName)&&void 0!==n?n:"").concat(null!==(r=e.description)&&void 0!==r?r:"").concat(e.name),c="".concat(t.type).concat(null!==(i=t.schoolName)&&void 0!==i?i:"").concat(null!==(o=t.description)&&void 0!==o?o:"").concat(t.name);return a.localeCompare(c)})).forEach((function(e){var n=new ol(t.player(),{id:e.id,label:e.name,schoolName:e.schoolName,description:e.description,selected:!1,multiSelectable:!1,selectable:!0,available:e.status===sa.Available,type:e.type,onClick:function(){t.options_.onDeviceMenuItemClick(n,e)}});t.menu.addItem(n)}))}},{key:"shouldShowSearchInput",value:function(){return this.getDeviceMenuItems().length>=20}},{key:"toggleSearchInput",value:function(){this.shouldShowSearchInput()?(this.searchInputItem.show(),this.menu.addClass("vertical-fill")):(this.searchInputItem.hide(),this.menu.removeClass("vertical-fill"))}},{key:"toggleDeviceMenuItems",value:function(){var e=this,t=this.getDeviceMenuItems(),n=this.shouldShowSearchInput(),r=this.searchText.toLowerCase();t.forEach((function(t){var i,o,a,c=e.devices.find((function(e){return e.id===t.options_.id}));if(c){var l=c.status===sa.Available,s=c.id===(null===(i=e.castSession)||void 0===i?void 0:i.getDevice().id),u=!n||-1!=="".concat(c.name," ").concat(null!==(o=c.schoolName)&&void 0!==o?o:""," ").concat(null!==(a=c.description)&&void 0!==a?a:"").trim().toLowerCase().indexOf(r);l?t.enable():t.disable(),u?t.show():t.hide(),s?t.selected(!0):t.selected(!1)}}))}},{key:"toggleEmptyStatePlaceholder",value:function(){var e=this.getDeviceMenuItems();e.filter((function(e){return e.isVisible()})).length?this.emptyPlaceholder.hide():this.emptyPlaceholder.show(),e.length?this.emptyPlaceholder.setLabel(this.localize("No matching results")):this.emptyPlaceholder.setLabel(this.localize("No devices found"))}},{key:"getCollabsibleName",value:function(){return this.controlText_}},{key:"getCollabsibleValue",value:function(){var e,t;return null!==(t=null===(e=this.castSession)||void 0===e?void 0:e.getDevice().name)&&void 0!==t?t:" "}},{key:"showInCollabsibleMenu",value:function(){return!0}},{key:"showCollapsibleMenu",value:function(){this.handleClick()}},{key:"handleClick",value:function(){kl(t,"handleClick",this,3)([null]),this.options_.onClick()}}],r&&wl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(jl);function Il(e){return Il="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},Il(e)}function Ll(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,Tl(r.key),r)}}function Tl(e){var t=function(e){if("object"!=Il(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Il(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Il(t)?t:t+""}function _l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_l=function(){return!!e})()}function Al(){return Al="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Fl(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Al.apply(null,arguments)}function Fl(e){return Fl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Fl(e)}function Dl(e,t){return Dl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Dl(e,t)}Pl.prototype.controlText_="Devices",ie.Z.registerComponent("DevicesButton",Pl);var Rl=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t,n){return t=Fl(t),function(e,t){if(t&&("object"==Il(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_l()?Reflect.construct(t,n||[],Fl(e).constructor):t.apply(e,n))}(this,t,[null,e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Dl(e,t)}(t,e),n=t,r=[{key:"createEl",value:function(){return(e=t,n=this,"function"==typeof(r=Al(Fl(1&3?e.prototype:e),"createEl",n))?function(e){return r.apply(n,e)}:r)(["div",{className:"cv-devices-tech"}]);var e,n,r}},{key:"setPoster",value:function(e){this.poster=e,this.update()}},{key:"setDevice",value:function(e){this.device=e,this.update()}},{key:"update",value:function(){var e,t,n,r,i=this;this.el_.innerHTML='\n <div class="cv-devices-content">\n <p>'.concat(this.localize("Currently playing on"),'</p>\n <h2><span class="cv-device-icon ').concat({vivi:"cv-vivi-icon","apple-tv":"cv-apple-icon"}[null!==(t=null===(e=this.device)||void 0===e?void 0:e.type)&&void 0!==t?t:la.Vivi],'"></span>').concat(null!==(r=null===(n=this.device)||void 0===n?void 0:n.name)&&void 0!==r?r:"",'</h2>\n </div>\n <div class="cv-devices-background" style="background-image: url(').concat(this.poster,')"></div>\n ');var o=document.createElement("button"),a=function(e){e.stopPropagation(),i.options_.onStopCasting()};o.onclick=a,o.ontouchstart=a,o.className="stop-casting-button",o.innerHTML=this.localize("Stop casting"),this.el_.querySelector(".cv-devices-content").appendChild(o)}},{key:"play",value:function(){}}],r&&Ll(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("Component"));function Ml(e){return Ml="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},Ml(e)}function Ul(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,Vl(r.key),r)}}function Vl(e){var t=function(e){if("object"!=Ml(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ml(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ml(t)?t:t+""}function Bl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Bl=function(){return!!e})()}function ql(e,t,n,r){var i=Gl(Zl(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function Gl(){return Gl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Zl(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Gl.apply(null,arguments)}function Zl(e){return Zl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Zl(e)}function zl(e,t){return zl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},zl(e,t)}var Hl=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=Zl(t),function(e,t){if(t&&("object"==Ml(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Bl()?Reflect.construct(t,n||[],Zl(e).constructor):t.apply(e,n))}(this,t,[e,n])).featuresVolumeControl=!0,r.featuresPlaybackRate=!1,r.movingMediaElementInDOM=!1,r.featuresFullscreenResize=!0,r.featuresTimeupdateEvents=!0,r.featuresProgressEvents=!1,r.featuresNativeTextTracks=!1,r.featuresNativeAudioTracks=!1,r.featuresNativeVideoTracks=!1,r.featuresMuteControl=!0,r.featuresSourceset=!1,r.videojsPlayer=(0,ie.Z)(r.options_.playerId),r.bindFunctions(),r.bindEventListeners(),r.ready((function(){r.setSource(r.options_.source)})),r.triggerReady(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zl(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.bindEventListeners=this.bindEventListeners.bind(this),this.onTextTrackChanged=this.onTextTrackChanged.bind(this),this.getSelectedTextTrack=this.getSelectedTextTrack.bind(this),this.setSelectedTextTrack=this.setSelectedTextTrack.bind(this),this.showUI=this.showUI.bind(this),this.hideUI=this.hideUI.bind(this),this.dispose=this.dispose.bind(this),this.setSource=this.setSource.bind(this),this.getCastSession=this.getCastSession.bind(this)}},{key:"bindEventListeners",value:function(){var e=this,t=this.getCastSession();t&&(this.textTracks().on("change",this.onTextTrackChanged),this.videojsPlayer.one("ended",(function(){t.dispose()})),t.on("durationchange",(function(){e.trigger("durationchange")})),t.on("dispose",(function(){e.trigger("ended"),e.hideUI()})),t.on("playingchange",(function(){t.isPlaying()?(e.trigger("play"),e.trigger("playing")):e.trigger("pause")})),t.on("volumechange",(function(){e.trigger("volumechange")})),t.on("sourceloaded",(function(){e.trigger("loadeddata")})),t.on("subtitleschange",(function(){e.setSelectedTextTrack(t.getSubtitles())})))}},{key:"onTextTrackChanged",value:function(){var e,t=this.getSelectedTextTrack();null===(e=this.getCastSession())||void 0===e||e.setSubtitles(null==t?void 0:t.src)}},{key:"getSelectedTextTrack",value:function(){return xe.O.findTrackByPredicate(this.videojsPlayer.player_,(function(e){return"showing"===e.mode&&!!e.src}))}},{key:"setSelectedTextTrack",value:function(e){xe.O.forEachTrack(this.videojsPlayer.player_,(function(t){t.src===e?t.mode="showing":t.mode="hidden"}))}},{key:"showUI",value:function(e){this.ui&&(this.ui.setPoster(this.options_.poster),this.ui.setDevice(e),this.ui.show())}},{key:"hideUI",value:function(){var e;null===(e=this.ui)||void 0===e||e.hide()}},{key:"dispose",value:function(){this.textTracks().off("change",this.onTextTrackChanged);var e=this.getCastSession();e&&e.dispose(),ql(t,"cleanupAutoTextTracks",this,3)([]),ql(t,"dispose",this,3)([])}},{key:"createEl",value:function(){var e=this;return this.ui=this.ui||new Rl({onStopCasting:function(){var t;null===(t=e.getCastSession())||void 0===t||t.dispose()}}),this.ui.el()}},{key:"setSource",value:function(e){var t=this.getCastSession();if(t){this.showUI(t.getDevice()),this.trigger("loadstart");var n=this.getSelectedTextTrack();t.loadSource(e.src,null==n?void 0:n.src)}}},{key:"addRemoteTextTrack",value:function(e){return ql(t,"addRemoteTextTrack",this,3)([e,!0])}},{key:"getCastSession",value:function(){var e;return Qc.getOrCreateInstance(null!==(e=this.options_.instanceId)&&void 0!==e?e:"").getCastSession()}},{key:"play",value:function(){var e;null===(e=this.getCastSession())||void 0===e||e.play()}},{key:"pause",value:function(){var e;null===(e=this.getCastSession())||void 0===e||e.pause()}},{key:"paused",value:function(){var e;return!1===(null===(e=this.getCastSession())||void 0===e?void 0:e.isPlaying())}},{key:"ended",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.isPlaybackFinished())&&void 0!==t&&t}},{key:"setCurrentTime",value:function(e){var t;null===(t=this.getCastSession())||void 0===t||t.seek(null!=e?e:0)}},{key:"currentTime",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getPosition())&&void 0!==t?t:0}},{key:"duration",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getDuration())&&void 0!==t?t:this.videojsPlayer.duration()}},{key:"volume",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getVolume())&&void 0!==t?t:1}},{key:"setVolume",value:function(e){var t;null===(t=this.getCastSession())||void 0===t||t.setVolume(e)}},{key:"muted",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getMuted())&&void 0!==t&&t}},{key:"setMuted",value:function(e){var t;null===(t=this.getCastSession())||void 0===t||t.setMuted(e)}},{key:"buffered",value:function(){}},{key:"seekable",value:function(){return ie.Z.createTimeRanges(0,this.duration())}},{key:"playbackRate",value:function(){return 1}},{key:"readyState",value:function(){return 4}},{key:"controls",value:function(){return!1}},{key:"playsinline",value:function(){return!0}},{key:"supportsFullScreen",value:function(){return!0}},{key:"setAutoplay",value:function(){}},{key:"preload",value:function(){}},{key:"load",value:function(){}},{key:"setPlaybackRate",value:function(){}}],i=[{key:"canPlayType",value:function(){return""}},{key:"canPlaySource",value:function(e,t){var n;return!!Qc.getOrCreateInstance(null!==(n=null==t?void 0:t.instanceId)&&void 0!==n?n:"").getCastSession()}},{key:"isSupported",value:function(){return Qc.isActive()}}],r&&Ul(n.prototype,r),i&&Ul(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(ie.Z.getComponent("Tech"));function Wl(e){return Wl="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},Wl(e)}function Ql(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,Yl(r.key),r)}}function Yl(e){var t=function(e){if("object"!=Wl(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Wl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wl(t)?t:t+""}function Kl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Kl=function(){return!!e})()}function $l(){return $l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Xl(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},$l.apply(null,arguments)}function Xl(e){return Xl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Xl(e)}function Jl(e,t){return Jl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Jl(e,t)}ie.Z.registerTech("devices",Hl);var es=function(e){function t(e,n){var r,i,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=Xl(t),function(e,t){if(t&&("object"==Wl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Kl()?Reflect.construct(t,n||[],Xl(e).constructor):t.apply(e,n))}(this,t,[e,n])).options=n,r.instanceId=null!==(o=null===(i=r.player.options_.devices)||void 0===i?void 0:i.instanceId)&&void 0!==o?o:"",r.bindFunctions(),r.initialize(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Jl(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.onReady=this.onReady.bind(this),this.onDevicesChanged=this.onDevicesChanged.bind(this),this.onCastSessionChanged=this.onCastSessionChanged.bind(this),this.onDevicesError=this.onDevicesError.bind(this),this.addViviClient=this.addViviClient.bind(this),this.addAppleTvClient=this.addAppleTvClient.bind(this),this.reloadTech=this.reloadTech.bind(this),this.getSessionManager=this.getSessionManager.bind(this),this.dispose=this.dispose.bind(this)}},{key:"initialize",value:function(){this.player.ready(this.onReady)}},{key:"onReady",value:function(){var e=this,t=this.player.getChild("collapserator"),n=null==t?void 0:t.children().findIndex((function(e){return"CustomControlSpacer"===e.name()})),r=null==t?void 0:t.children().findIndex((function(e){return"OpenExternallyButton"===e.name()})),i=Math.max(n,r)+1,o=this.getSessionManager();if(t&&n&&-1!==n&&o){o.on("deviceschange",this.onDevicesChanged),o.on("castsessionchange",this.onCastSessionChanged),o.on("error",this.onDevicesError);var a=this.options.ctaOptions,c=this.options.vivi,l=[];this.options.appleTv.enabled||l.push(la.AppleTv),c.enabled&&c.accountConnected||l.push(la.Vivi);var s={onClick:function(){e.addViviClient(o),e.addAppleTvClient(o)},onDeviceMenuItemClick:function(t,n){var r;o.startCastSession({device:n,title:e.options.title}),null===(r=e.options.analyticsService)||void 0===r||r.logUserAction(n,{actionType:f.Vw.Select,workflowPhase:f.eu.Complete,descriptor:f.UX.ChangeDevice,entity:f.py.Device,eventVersion:f.eq.V3})},ctaOptions:Object.assign(Object.assign({},a),{inactiveIntegrations:l})};this.devicesButton=t.addChild("DevicesButton",s,i)}}},{key:"onDevicesChanged",value:function(e){var t;null===(t=this.devicesButton)||void 0===t||t.setDevices(e)}},{key:"onCastSessionChanged",value:function(e){var t;null===(t=this.devicesButton)||void 0===t||t.setCastSession(e),this.reloadTech(),e?(this.player.addClass("cv-device-casting"),this.player.addClass("cv-device-".concat(e.getDevice().type)),this.player.isFullscreen()&&this.player.exitFullscreen()):(this.player.removeClass("cv-device-casting"),this.player.removeClass("cv-device-".concat(la.AppleTv)),this.player.removeClass("cv-device-".concat(la.Vivi)))}},{key:"onDevicesError",value:function(e){this.player.error(e.message),this.player.pause()}},{key:"addViviClient",value:function(e){if(this.options.vivi.enabled&&this.options.vivi.accountConnected&&this.options.vivi.apiUrl&&!e.hasInstanceOfClient(Mc)){var t=new Mc({url:this.options.vivi.apiUrl,fetchAccessToken:this.options.vivi.fetchAccessToken});e.addClient(t)}}},{key:"addAppleTvClient",value:function(e){if(this.options.appleTv.enabled&&this.options.trackingCode&&this.options.userId&&!e.hasInstanceOfClient(ac)){var t=new ac({fetchAccessToken:this.options.appleTv.fetchAccessToken,trackingCode:this.options.trackingCode,userId:this.options.userId});e.addClient(t)}}},{key:"reloadTech",value:function(){var e=this.player,t=e.currentSources(),n=e.volume(),r=e.muted(),i=e.currentTime(),o=e.paused();e.src(t),e.one("playing",(function(){e.volume(n),e.muted(r),e.currentTime(i),o?e.pause():e.play()}))}},{key:"getSessionManager",value:function(){if(this.instanceId)return Qc.getOrCreateInstance(this.instanceId)}},{key:"dispose",value:function(){var e,n,r,i=this.getSessionManager();i&&(i.off("deviceschange",this.onDevicesChanged),i.off("castsessionchange",this.onCastSessionChanged),i.off("error",this.onDevicesError),Qc.disposeAndRemoveInstance(i),(e=t,n=this,"function"==typeof(r=$l(Xl(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([]))}}],r&&Ql(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getPlugin("plugin"));function ts(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ns(e){var t,n,i,o=r.useRef(e.player.duration()-e.player.currentTime()),a=(n=r.useState(o.current),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,i)||function(e,t){if(e){if("string"==typeof e)return ts(e,t);var n={}.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)?ts(e,t):void 0}}(n,i)||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.")}()),c=a[0],l=a[1];function s(){var t=e.player.duration()-e.player.currentTime();l(t),t>o.current&&(o.current=t)}if(r.useEffect((function(){return e.player.on("timeupdate",s),function(){e.player.off("timeupdate",s)}}),[]),!e.nextVideo||!e.onPlayNext)return r.createElement(r.Fragment,null);var u=Math.ceil(c),f=1===u?"second":"seconds";return r.createElement(r.Fragment,null,r.createElement("div",{className:"cv-up-next-container"},r.createElement("div",{className:"cv-cancel-up-next cursor-pointer",role:"button",onClick:e.onCancel},"×"),r.createElement("div",{className:"cv-up-next-heading"},"Up next in ",u," ",f,":"),r.createElement("div",{className:"cv-up-next-image cursor-pointer",onClick:e.onPlayNext,style:{backgroundImage:"url(".concat(null===(t=e.nextVideo)||void 0===t?void 0:t.thumbnailUrl,")")}}),r.createElement("div",{className:"cv-up-next-title"},e.nextVideo.name)))}function rs(e){return rs="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},rs(e)}function is(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,os(r.key),r)}}function os(e){var t=function(e){if("object"!=rs(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=rs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rs(t)?t:t+""}function as(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(as=function(){return!!e})()}function cs(){return cs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ls(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},cs.apply(null,arguments)}function ls(e){return ls=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ls(e)}function ss(e,t){return ss=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ss(e,t)}ie.Z.registerPlugin("devicesPlugin",es),ie.Z.registerComponent("UpNext",lo((function(e,t){return r.createElement(ns,Object.assign({player:e},t))})));var us=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=ls(t),function(e,t){if(t&&("object"==rs(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,as()?Reflect.construct(t,n||[],ls(e).constructor):t.apply(e,n))}(this,t,[e,n])).playNext=e.nextVideoPlugin().getShouldPlayNext(),r.toggle(r.playNext),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ss(e,t)}(t,e),n=t,r=[{key:"handleToggle",value:function(){this.toggle(!this.playNext)}},{key:"toggle",value:function(e){e?this.toggleOn():this.toggleOff()}},{key:"toggleOn",value:function(){this.playNext=!0,ie.Z.dom.addClass(this.toggleEl,"on"),this.player_.nextVideoPlugin().setShouldPlayNext(this.playNext,!0)}},{key:"toggleOff",value:function(){this.playNext=!1,ie.Z.dom.removeClass(this.toggleEl,"on"),this.player_.nextVideoPlugin().setShouldPlayNext(this.playNext,!0)}},{key:"handleClick",value:function(e){e.stopImmediatePropagation()}},{key:"createEl",value:function(e,n,r){this.handlerBound||(this.handleToggle=this.handleToggle.bind(this),this.handlerBound=!0),this.toggleEl&&this.toggleEl.removeEventListener("click",this.handleToggle),this.toggleEl=ie.Z.dom.createEl("div",{className:"custom-toggle custom-toggle-info toggle-option float-end",innerHTML:'<span class="handle"></span></div>'}),this.toggleEl.addEventListener("click",this.handleToggle);var i,o,a,c=(i=t,o=this,"function"==typeof(a=cs(ls(1&3?i.prototype:i),"createEl",o))?function(e){return a.apply(o,e)}:a)([e,{className:"vjs-menu-item cv-cog-menu-item cv-play-next-toggle",innerHTML:'\n <span class="vjs-menu-item-text">Play next video</span>\n <span class="cv-toggle-container"></span>'},r]);return c.children[1].appendChild(this.toggleEl),c}}],r&&is(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("MenuItem"));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},fs(e)}function ds(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ps(r.key),r)}}function ps(e){var t=function(e){if("object"!=fs(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=fs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==fs(t)?t:t+""}function ms(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ms=function(){return!!e})()}function hs(){return hs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=vs(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},hs.apply(null,arguments)}function vs(e){return vs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vs(e)}function ys(e,t){return ys=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ys(e,t)}ie.Z.registerComponent("NextVideoMenuItem",us);var gs="cv-persisttest",bs="cv-play-next-video",ws=ie.Z.getPlugin("plugin"),Es=(ie.Z.getComponent("MenuItem"),ie.Z.getComponent("NextVideoMenuItem")),Ss=function(e){function t(e){var n;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=vs(t),function(e,t){if(t&&("object"==fs(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ms()?Reflect.construct(t,n||[],vs(e).constructor):t.apply(e,n))}(this,t,[e])).setShouldPlayNext=n.setShouldPlayNext.bind(n),n.getShouldPlayNext=n.getShouldPlayNext.bind(n),n.getChapterTrack=n.getChapterTrack.bind(n),n.onTimeUpdate=n.onTimeUpdate.bind(n),n.hasLocalStorage=n.testHasLocalStorage(),n.shouldPlayNextVideo=!1,n.hasLocalStorage){var r=window.localStorage.getItem(bs);n.shouldPlayNextVideo="true"===r}return e.ready((function(){n.initialize()})),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ys(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){this.player.isDisposed()||this.bindListeners()}},{key:"getChapterTrack",value:function(){return xe.O.getTrack(this.player,"chapters",null)}},{key:"setNextVideo",value:function(e,t,n){var r;this.nextVideo=e,this.callback=n,t&&this.setShouldPlayNext(!0),(null===(r=this.player.getChild("collapserator"))||void 0===r?void 0:r.getChild("cogButton")).addItem({index:0,ctor:Es,name:"NextVideoMenuItem"})}},{key:"getShouldPlayNext",value:function(){return this.shouldPlayNextVideo}},{key:"setShouldPlayNext",value:function(e,t){this.shouldPlayNextVideo=e,this.hasLocalStorage&&t&&window.localStorage.setItem(bs,e.toString())}},{key:"bindListeners",value:function(){this.player.on("timeupdate",this.onTimeUpdate)}},{key:"dispose",value:function(){var e,n,r;this.player.off("timeupdate",this.onTimeUpdate),this.hideUpNext(),(e=t,n=this,"function"==typeof(r=hs(vs(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{key:"onTimeUpdate",value:function(){var e,t;if(!this.player.pictureInPicture||!this.player.isInPictureInPicture())if(this.getShouldPlayNext()){if(this.player.ended())return this.callback(),void this.hideUpNext();if(!(this.player.duration()<=0||this.upNextRendered&&this.player.currentTime()>this.upNextTimepoint)){var n=this.getChapterTrack(),r=(null===(e=null==n?void 0:n.activeCues)||void 0===e?void 0:e.length)&&n.activeCues[0];"credits"===(null===(t=null==r?void 0:r.text)||void 0===t?void 0:t.toLowerCase())||this.player.currentTime()>=this.player.duration()-5?this.showUpNext():this.hideUpNext()}}else this.hideUpNext()}},{key:"showUpNext",value:function(){var e=this;this.upNextRendered||(this.upNextRendered=!0,this.upNextTimepoint=this.player.currentTime(),this.player.addChild("UpNext",{nextVideo:this.nextVideo,onPlayNext:this.callback,onCancel:function(){e.hideUpNext(),e.setShouldPlayNext(!1)}}))}},{key:"hideUpNext",value:function(){if(this.upNextRendered){this.upNextRendered=!1,this.upNextTimepoint=null;var e=this.player.getChild("UpNext");e&&(this.player.removeChild(e),e.dispose())}}},{key:"testHasLocalStorage",value:function(){try{return window.localStorage.setItem(gs,"persistPlayNext"),window.localStorage.removeItem(gs),!0}catch(e){return!1}}}],r&&ds(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ws);ie.Z.registerPlugin("nextVideoPlugin",Ss);var ks=n(52765),xs=n(75390),Os=n(86257),Cs=n(87013),Ns=n(38e3),js={width:200,resizeType:Te.Nq.Cover};function Ps(e){var t;return Ns.G.isResource(e)?e.metadata.type===Os.L.Pdf||(null===(t=e.pdf)||void 0===t?void 0:t.url)?Te.__.Pdf:Te.__.Thumbnails:Te.__.Link}function Is(e){var t,n,i,o=null,a=0;Ns.G.isResource(e.resource)&&(o=e.resource.metadata,a=null!==(i=null===(n=null===(t=e.resource.thumbnail)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.rotation)&&void 0!==i?i:0);var c=function(e,t){var n,r,i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:js,a=Ps(t);if("thumbnail"in t&&(null===(n=t.thumbnail)||void 0===n?void 0:n.url))return Cs.j.createUrl(null===(r=t.thumbnail)||void 0===r?void 0:r.url,Object.assign({},o));var c=xs._.safeUrlConcat(e,"/v1/previews");return Ns.G.isResource(t)?a===Te.__.Pdf?t.metadata.type===Os.L.Pdf?Cs.j.createResourceImage(c,t.url,Object.assign({},o)):Cs.j.createResourceImage(c,null===(i=t.pdf)||void 0===i?void 0:i.url,Object.assign({},o)):t.metadata.type!==Os.L.Zip?Cs.j.createUrl(t.url,{size:Te.h2.Medium,resizeType:Te.Nq.Cover}):"/images/zip-resource.png":Cs.j.createResourceImage(c,t.url,Object.assign({},o))}(e.imageCdnUrl,e.resource,e.dynamicRatioImageOptions);return r.createElement(Le.Z,{data:c,imageType:Ps(e.resource),imageStyle:{transform:"rotate(".concat(a,"deg)")},alt:e.resource.name,errorFallbackImageSrc:e.imageErrorFallbackUrl,errorFallbackImageClassName:"Xy4zX",imageClassName:(null==o?void 0:o.type)===Os.L.Image?"".concat("z4O5p"," ").concat("FFgf3"):"",preload:e.preloadImage,preventLoad:!e.preloadImage})}var Ls=n(71012),Ts=n(17977),_s=n(74421),As=n(13799);function Fs(e){var t,n,i,o,a=null;"metadata"in e.data&&(a=e.data.metadata);var c=Ns.G.isType(e.data,_s.E.Resource);return r.createElement(r.Fragment,null,r.createElement("div",{className:"OnJDH"},r.createElement("div",{className:"CIFy7"},r.createElement("div",{className:function(t){var n,r="\n d-flex flex-column align-items-center justify-content-end rounded-3 h-100\n position-relative ".concat(function(e){switch(e){case"atom-guide":return"X39wU";case"student-activity":return"X9pMl";case"teacher-pack":return"_tdVE";case"additional-materials":return"qRVUo";default:return"_18JaV"}}(t)," ").concat("oUZPD");return(null===(n=e.theme)||void 0===n?void 0:n.containerClass)?r+=" ".concat(e.theme.containerClass):r+=" pt-3 px-3",e.applyHoverState&&(r+=" ".concat("xRYhX")),r}(null==a?void 0:a.resourceType)},"above"===e.titlePosition&&r.createElement(_r.u,{title:e.data.name},r.createElement("h3",{className:"text-center text-break h5 mb-3 ".concat("g5NWS")},r.createElement("span",{className:"clamp-1"},e.data.name))),r.createElement("div",{className:"\n ".concat(null!==(n=null===(t=e.theme)||void 0===t?void 0:t.thumbnailContainerClass)&&void 0!==n?n:""," w-75 overflow-hidden \n ").concat("EDiGi"," ").concat("above"===e.titlePosition?"e9ejn":""," \n ").concat("I9E5O","\n ")},r.createElement(Is,{resource:e.data,imageCdnUrl:e.imageCdnUrl,imageErrorFallbackUrl:e.imageErrorFallbackUrl,preloadImage:e.preloadImage})),c&&e.onClickDownload&&"normal"===e.actionBehaviour&&r.createElement("div",{className:"jzGAm"},r.createElement(S.L,{onClick:function(t){return e.onClickDownload(t,e.data)},className:"".concat("fbb_e"," d-flex align-items-center justify-content-center")},r.createElement(k.x,{svgName:O.vn.Download}))),!e.hideTypeBadge&&c&&r.createElement(Ts.y,{typeId:_s.E.Resource})))),"below"===e.titlePosition&&r.createElement("div",{className:"mt-1 ".concat("Cpjs3")},Ns.G.isType(e.data,_s.E.Resource)&&!!(null===(o=null===(i=e.data)||void 0===i?void 0:i.metadata)||void 0===o?void 0:o.resourceType)&&r.createElement(Ls.m,null,function(e){switch(e){case"additional-materials":return"Additional Materials";case"atom-guide":return"ATOM Guide";case"teacher-pack":return"Teacher Pack";case"student-activity":return"Student Activity";default:return"N/A"}}(e.data.metadata.resourceType)),r.createElement("h3",{className:"h6 clamp-2"},e.data.name)))}function Ds(e){return Ds="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},Ds(e)}function Rs(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,Ms(r.key),r)}}function Ms(e){var t=function(e){if("object"!=Ds(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ds(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ds(t)?t:t+""}function Us(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Us=function(){return!!e})()}function Vs(){return Vs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Bs(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Vs.apply(null,arguments)}function Bs(e){return Bs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Bs(e)}function qs(e,t){return qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},qs(e,t)}function Gs(e){return r.createElement("div",{className:"cv-resource-item"},r.createElement(Fs,{data:e.resource,imageCdnUrl:e.imageCdnUrl,titlePosition:"above",hideTypeBadge:!0}))}Fs.defaultProps={preloadImage:!0,actionBehaviour:"normal"},r.memo((function(e){var t,n,i,o,a=(t=e.data,n=e.actionBehaviour,o=r.useContext(As.X),"public"===n||!o.xs&&!o.sm&&"resource"===t.type&&"metadata"in t&&(t.metadata.type===Os.L.Image||(t.metadata.type===Os.L.Pdf?!!t.url:!!(null===(i=t.pdf)||void 0===i?void 0:i.url)))),c=Object.assign(Object.assign({},e.analyticsData),e.data),l=Object.assign(Object.assign({},e.analyticsOptions),{actionType:f.Vw.Click,entity:e.data.typeId===_s.E.Resource?f.py.Resource:f.py.Link});function s(){An.k.logUserAction(c,l)}var u,d=Object.assign(Object.assign({},e),{applyHoverState:a||!!e.data.url});return r.createElement("div",{className:"px-1 flex-shrink-0 ".concat("tqUFn"," ").concat("play-page"===e.location?"V2RwX":"o7j7p"," ").concat("resource-item")},(u="d-block no-decoration","link"===e.data.type?r.createElement("a",{href:e.data.url,target:"_blank",className:u,onClick:s},r.createElement(Fs,Object.assign({},d))):a?"public"===e.actionBehaviour?r.createElement("div",{className:"".concat(u," cursor-pointer d-inline"),onClick:function(){s(),ks.C$.trigger(e.getAppLink(e.data))}},r.createElement(Fs,Object.assign({},d))):r.createElement(C.F,{appLink:e.getAppLink(e.data),className:u,analyticsData:c,analyticsOptions:l},r.createElement(Fs,Object.assign({},d))):e.data.url?r.createElement("a",{href:e.data.url,className:u,onClick:s},r.createElement(Fs,Object.assign({},d))):r.createElement("div",{className:u},r.createElement(Fs,Object.assign({},d)))))}));var Zs=lo((function(e,t){return r.createElement(Gs,Object.assign({},t))})),zs=function(e){function t(e,n){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=function(e,t,n){return t=Bs(t),function(e,t){if(t&&("object"==Ds(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Us()?Reflect.construct(t,n||[],Bs(e).constructor):t.apply(e,n))}(this,t,[e,n]);var i=new Zs(e,{resource:n.resource,imageCdnUrl:n.imageCdnUrl});return r.addChild(i),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&qs(e,t)}(t,e),n=t,r=[{key:"createEl",value:function(e){var n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;return(n=t,r=this,"function"==typeof(i=Vs(Bs(1&3?n.prototype:n),"createEl",r))?function(e){return i.apply(r,e)}:i)([e,Object.assign(Object.assign({},o),{className:"".concat(o.className," cv-resource-menu-item")}),a])}},{key:"handleClick",value:function(e){e.stopImmediatePropagation(),this.options_.downloadResource(this.options_.resource)}}],r&&Rs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("MenuItem"));function Hs(e){return Hs="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},Hs(e)}function Ws(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,Qs(r.key),r)}}function Qs(e){var t=function(e){if("object"!=Hs(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Hs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Hs(t)?t:t+""}function Ys(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ys=function(){return!!e})()}function Ks(e,t,n,r){var i=$s(Xs(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function $s(){return $s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Xs(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},$s.apply(null,arguments)}function Xs(e){return Xs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Xs(e)}function Js(e,t){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Js(e,t)}var eu=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=function(e,t,n){return t=Xs(t),function(e,t){if(t&&("object"==Hs(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Ys()?Reflect.construct(t,n||[],Xs(e).constructor):t.apply(e,n))}(this,t,arguments)).alwaysCollapsed=!1,e.isCollapsed=!1,e.isCollabsible=!0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Js(e,t)}(t,e),n=t,(r=[{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-resources-button-wrapper ".concat(Ks(t,"buildWrapperCSSClass",this,3)([]))}},{key:"buildCSSClass",value:function(){return"cv-resources-button ".concat(Ks(t,"buildCSSClass",this,3)([]))}},{key:"update",value:function(){Ks(t,"update",this,3)([])}},{key:"createItems",value:function(){var e=this,t=[];return t.push(new Yc.Z(this.player_,{label:"Resources"})),this.options_.resources.forEach((function(n){var r=new zs(e.player(),{resource:n,imageCdnUrl:e.options_.imageCdnUrl,downloadResource:function(t){return e.downloadResource(t)},label:n.name});t.push(r)})),t}},{key:"downloadResource",value:function(e){"link"!==e.type?this.getDownloadIframe().src=e.url:ks.Ab.PageLoad(e.url,!0)}},{key:"getDownloadIframe",value:function(){return this.downloadIframe||(this.downloadIframe=ie.Z.dom.createEl("iframe"),this.downloadIframe.style.display="none",ie.Z.dom.appendContent(ie.Z.dom.$("body"),this.downloadIframe)),this.downloadIframe}},{key:"getCollabsibleName",value:function(){return this.controlText_}},{key:"getCollabsibleValue",value:function(){return""}},{key:"showInCollabsibleMenu",value:function(){return!0}},{key:"showCollapsibleMenu",value:function(){Ks(t,"handleClick",this,3)([null])}}])&&Ws(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("MenuButton"));function tu(e){return tu="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},tu(e)}function nu(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,ru(r.key),r)}}function ru(e){var t=function(e){if("object"!=tu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=tu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==tu(t)?t:t+""}function iu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(iu=function(){return!!e})()}function ou(e){return ou=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ou(e)}function au(e,t){return au=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},au(e,t)}eu.prototype.controlText_="Resources",ie.Z.registerComponent("ResourcesButton",eu);var cu=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=ou(t),function(e,t){if(t&&("object"==tu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,iu()?Reflect.construct(t,n||[],ou(e).constructor):t.apply(e,n))}(this,t,[e,n])).options=n,e.ready((function(){return r.onReady()})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&au(e,t)}(t,e),n=t,(r=[{key:"onReady",value:function(){if(this.options.resources.length){var e=this.player.getChild("collapserator");e.addChild("ResourcesButton",{resources:this.options.resources,imageCdnUrl:this.options.imageCdnUrl},e.children_.length-4)}}}])&&nu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getPlugin("plugin"));ie.Z.registerPlugin("resourcesPlugin",cu);var lu=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 su(e){var t=e.className,n=void 0===t?"":t,i=e.playerApi,o=e.onReady,a=e.onDispose,c=lu(e,["className","playerApi","onReady","onDispose"]),l=r.useRef(null);return r.useEffect((function(){if(l){var e=new ua.J(l.current,Object.assign(Object.assign({},c),{playerApi:i}));return o&&e.ready((function(){o(Bo(e))})),a&&e.one("dispose",a),function(){null==e||e.dispose()}}}),[e.viewKey]),r.createElement("div",{ref:l,className:n})}var uu={placeholder:"JemW5"};function fu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function du(){return r.createElement("div",{className:"".concat(uu.placeholder," partial-loading-background")})}function pu(e){var t,n,i=(t=r.useState(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return fu(e,t);var n={}.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)?fu(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1];return r.useEffect((function(){e.createViewKey(null,(function(e){a(e.get("viewKey"))}))}),[e.video.id]),o?r.createElement("div",{className:"col-12 mb-3 p-0"},r.createElement(su,{playerApi:new URL(e.config.get("playerApiUrl")),viewKey:o})):r.createElement(du,null)}var mu="libraryRequests.info";function hu(e){var t=a.M.isVideo(e.libraryRequest.object),n=a.M.isInteractive(e.libraryRequest.object),c=a.M.isClip(e.libraryRequest.object);return r.createElement("div",{className:"bg-white rounded p-3"},r.createElement(Jo,{comments:e.comments,imageCdnUrl:e.config.get("imageCdnUrl")}),r.createElement("h2",{className:"h5"},r.createElement(i.x,{namespace:mu,phrase:"videoDetails"})),t&&r.createElement(r.Fragment,null,r.createElement(m,{video:e.libraryRequest.object,user:e.user,createViewKey:e.createViewKey,config:e.config}),r.createElement(ca,{libraryRequest:e.libraryRequest,hideBroadcastInfo:e.user.get("instanceRegion")===o.b.US,config:e.config})),n&&r.createElement(r.Fragment,null,r.createElement(Wo,{video:e.libraryRequest.object,currentUser:e.currentUser,createViewKey:e.createViewKey,config:e.config}),r.createElement(V,{libraryRequest:e.libraryRequest})),c&&r.createElement(r.Fragment,null,r.createElement(pu,{video:e.libraryRequest.object,currentUser:e.currentUser,createViewKey:e.createViewKey,config:e.config}),r.createElement(b,{libraryRequest:e.libraryRequest})))}},49824:function(e,t,n){"use strict";n.d(t,{j:function(){return i}});var r=n(32735);function i(){return r.createElement("div",{className:"bg-white rounded p-3"},r.createElement("div",{className:"partial-loading-background mb-2",style:{height:"1.25rem",width:"9rem"}}),r.createElement("div",{className:"col-12 mb-3 p-0"},r.createElement("div",{className:"responsive-img partial-loading-background rounded"})),r.createElement("div",{className:"row"},r.createElement("div",{className:"col-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"3.4rem"}})),r.createElement("div",{className:"col-9 mb-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"9rem"}})),r.createElement("div",{className:"col-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"5rem"}})),r.createElement("div",{className:"col-9 mb-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"2rem"}})),r.createElement("div",{className:"col-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"7rem"}})),r.createElement("div",{className:"col-9 mb-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"16rem"}}))))}},90083:function(e,t,n){"use strict";n.d(t,{q:function(){return wt}});var r=n(32735),i=n(42648),o=n(82602),a=n(70868),c=n(70065),l=n(77105),s=n(80247),u=n(34152),f=n(39396),d=n(85475),p={container:"VwD1b",spinner:"eJ85e"};function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e){var t,n,i=(t=(0,u.YD)(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.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)?m(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1];return r.useEffect((function(){var t;e.fetchOnScroll&&a&&!e.isFetching&&(null===(t=e.fetchNext)||void 0===t||t.call(e,e.nextCursor))}),[a,e.isFetching]),r.createElement("div",{className:"p-3 text-center ".concat(p.container),ref:o},e.isFetching?r.createElement(s.Z,{as:"span",animation:"border",role:"status",className:p.spinner}):r.createElement(f.x,{svgName:d.vn.ChevronDown,className:"svg-container cursor-pointer",size:f.S.Large,onClick:function(){var t;return null===(t=e.fetchNext)||void 0===t?void 0:t.call(e,e.nextCursor)}}))}h.defaultProps={fetchOnScroll:!1};var v=n(66703),y=n(85887),g=n(41087),b=n(44550),w=n(57857),E=n(53808),S=n(58424),k=n(2491),x=n(37360),O=n(40221),C=n(11275),N={isFavouritedByCurrentUser:function(e){var t;return!(1!==(null===(t=null==e?void 0:e.favouritedBy)||void 0===t?void 0:t.data.length))},isFavouritedByUser:function(e,t){var n;return!!O.m.findWhere(null===(n=null==e?void 0:e.favouritedBy)||void 0===n?void 0:n.data,{id:null==t?void 0:t.id})},updateVideoState:function(e,t,n){return{id:e.id,favouritedBy:{data:n?[{id:t.id}]:[],pagination:{limit:25,cursors:{next:"",previous:""}}}}},showFavouriteButton:function(e,t){var n;return!(!(null===(n=C.M.getCanBeConsumed(e))||void 0===n?void 0:n.canConsume)||!t&&!x.V.isTabletOrMobile()&&!N.isFavouritedByCurrentUser(e))}},j={favourited:"t0svX",favouriteButton:"CFRo3",heart:"ZMMQu",heartOutline:"truFo"};function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var I=w.T.encloseNamespace("shared.favouriteButton");function L(e){var t,n,i=(0,k.Z)(),o=N.isFavouritedByCurrentUser(e.video),a=(t=r.useState(o),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var n={}.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)?P(e,t):void 0}}(t,n)||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.")}()),c=a[0],l=a[1];r.useEffect((function(){l(o)}),[o]);var s="".concat("d-flex align-items-center justify-content-center"," cursor-pointer ").concat(j.favouriteButton," ").concat(c?j.favourited:"");return e.className&&(s+=" ".concat(e.className)),E.q.isFunction(e.setFavourite)&&E.q.isFunction(e.canFavourite)&&e.canFavourite(e.video)?r.createElement(S.L,{className:s,onClick:function(){var t=!c;l(t),e.setFavourite(e.video,t,null,(function(){i.error(I(C.M.isClip(e.video)?t?"favouriteClipError":"unfavouriteClipError":C.M.isInteractive(e.video)?t?"favouriteInteractiveError":"unfavouriteInteractiveError":t?"favouriteVideoError":"unfavouriteVideoError")),l(!t)}),e.analyticsData,e.analyticsOptions)},tabIndex:e.preventFocus?-1:void 0},r.createElement(f.x,{svgName:d.vn.Heart,className:"svg-container ".concat(j.heart)}),r.createElement(f.x,{svgName:d.vn.HeartOutline,className:"svg-container ".concat(j.heartOutline)})):r.createElement(r.Fragment,null)}var T,_,A,F=n(90305),D=n(24828),R=n(22231),M={baseFallbackContainer:"ZvbeV",svgFallbackContainer:"atIHN",subjectFallbackContainer:"m20L7",subjectFallbackContainerSmall:"QIbxu",subjectFallbackContainerLarge:"z_sHT",seriesItemFallback:"epoLB",playlistItemFallback:"h1S5T",playlistFallback:"ZbKBN",posterFallback:"I1mTo",subjectFallback:"kNG8Z",fallbackThumbnailImage:"nKsWZ",videoFallback:"LolCW",folderFallback:"mdrT5"};function U(e){var t,n=e.type,i=e.mediaType,o=e.extraClasses,a=e.containerClassSize;if(n===T.Video)return r.createElement("div",{className:"".concat(M.videoFallback," ").concat(e.extraClasses," bg-light-blue")});if(n===T.Folder)return r.createElement("div",{className:"".concat(M.folderFallback," ").concat(e.extraClasses," ").concat((0,R.x)(e.name,D.o))});var c=function(e){return e===T.SeriesThumbnail?M.seriesItemFallback:e===T.PlaylistThumbnail?M.playlistItemFallback:e===T.Playlist?M.playlistFallback:e===T.Series||e===T.TallSubject?M.posterFallback:e===T.Subject?"".concat(M.subjectFallback," svg-container d-inline-block"):""}(n),l=function(e){return e===T.SeriesThumbnail||e===T.PlaylistThumbnail?d.vn.Play:e===T.Playlist?d.vn.Image:e===T.Series?d.vn.Series:e===T.Subject||e===T.TallSubject?d.vn.FileImg:""}(n),s=function(e){return e===T.Subject?f.S.ExtraLarge:f.S.Standard}(n),u="".concat(function(e,t,n){if(t===T.Subject){var r=n===A.Large?M.subjectFallbackContainerLarge:M.subjectFallbackContainerSmall;return"".concat(M.subjectFallbackContainer," ").concat(r)}return e===_.Svg?t===T.SeriesThumbnail||t===T.PlaylistThumbnail?"".concat(M.svgFallbackContainer," rounded-3"):M.svgFallbackContainer:M.baseFallbackContainer}(i,n,a));return o&&(u+=" ".concat(e.extraClasses)),r.createElement("div",{className:u},i===_.Svg?r.createElement(f.x,{svgName:l,className:"".concat(c," ").concat(null!==(t=e.svgContainerClassName)&&void 0!==t?t:""),tagName:"div",size:s}):r.createElement("div",{className:M.fallbackThumbnailImage,style:{backgroundImage:"url('".concat(l,"')")}}))}function V(e){var t=C.M.getVideoProgress(e.video),n=t&&e.video.duration&&t/e.video.duration*1e5;return n?r.createElement("div",{className:"bg-primary h-100",style:{width:"".concat(n,"%")}}):r.createElement(r.Fragment,null)}!function(e){e[e.Playlist=0]="Playlist",e[e.PlaylistThumbnail=1]="PlaylistThumbnail",e[e.Series=2]="Series",e[e.SeriesThumbnail=3]="SeriesThumbnail",e[e.Subject=4]="Subject",e[e.TallSubject=5]="TallSubject",e[e.Video=6]="Video",e[e.Folder=7]="Folder"}(T||(T={})),function(e){e[e.Svg=0]="Svg",e[e.Image=1]="Image"}(_||(_={})),function(e){e[e.Large=0]="Large",e[e.Small=1]="Small"}(A||(A={})),U.defaultProps={mediaType:_.Svg,containerClassSize:A.Large};var B={bottomBar:"YnXtZ"};function q(e){return C.M.isVideo(e.video)?r.createElement("div",{className:B.bottomBar},r.createElement(V,{video:e.video})):r.createElement(r.Fragment,null)}var G=n(77037),Z=n(21326),z="d-inline-block svg-container",H="span";function W(e){var t=e.children,n=e.className,i=void 0===n?z:n,o=e.tagName,a=void 0===o?H:o,c=e.size,l=void 0===c?f.S.Standard:c,s=e.onClick,u=e.title,d=e.tooltipPlacement,p=void 0===d?"right":d,m=a,h={className:"".concat(i," svg-container ").concat(l),onClick:E.q.isFunction(s)?s:null};return u?r.createElement(Z.u,{title:u,placement:p},r.createElement(m,Object.assign({},h),t)):r.createElement(m,Object.assign({},h),t)}function Q(){return r.createElement("svg",{viewBox:"0 0 41 70"},r.createElement("g",null,r.createElement("path",{fill:"#F8981D",d:"M 0 0 41 35 0 70z"})))}var Y=n(76044),K={std:"ct8Ht",sm:"dvCes",stdIcon:"iy0pu",smIcon:"Z_mZf"};function $(e){var t,n,i;return(C.M.isInteractive(e.video)||C.M.isClip(e.video))&&(e.video._liteOwner||(null===(t=e.video._isClickViewCurated)||void 0===t?void 0:t.value))?(null===(n=e.video._isClickViewCurated)||void 0===n?void 0:n.value)?r.createElement("div",{className:"".concat("sm"===e.size?K.sm:K.std," me-1 rounded-circle position-relative bg-white")},r.createElement(W,{className:"me-1 ".concat("sm"===e.size?K.smIcon:K.stdIcon)},r.createElement(Q,null))):r.createElement("div",{className:"".concat("sm"===e.size?K.sm:K.std," me-1")},r.createElement(G.q,{imageCdnUrl:e.imageCdnUrl,initials:Y.l.getInitials(e.video._liteOwner.name,e.video._liteOwner.surname),imageUrl:null===(i=e.video._liteOwner.avatar)||void 0===i?void 0:i.url})):r.createElement(r.Fragment,null)}var X={pluginHover:"h4RQa"},J="shared.pluginHover";function ee(e){return e.isPlugin?r.createElement(l.F,{appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,onClick:e.onClick,className:"\n position-absolute top-0 start-0 end-0 bottom-0 opacity-0 cursor-pointer\n ".concat(X.pluginHover,"\n ").concat(e.className?e.className:"","\n ")},r.createElement("span",{className:"position-absolute top-50 start-50 translate-middle text-nowrap h4 text-white"},r.createElement(v.x,{namespace:J,phrase:"embed"}))):r.createElement(r.Fragment,null)}var te={padlock:"w4cg8",sm:"JpIYd"};function ne(e){var t="sm"===e.size?f.S.Small:f.S.Standard;return r.createElement("div",{className:"".concat(te.padlock," ").concat("sm"===e.size?te.sm:""," bg-white cursor-default d-flex align-items-center justify-content-center")},r.createElement(f.x,{svgName:d.vn.Lock,size:t}))}var re=n(88483),ie=n(87013),oe={logo:"OA9ft",sm:"fyo2J"};function ae(e){var t,n,i,o,a,c;if(!C.M.isVideo(e.video)||!e.companyLogoFallbackUrl)return r.createElement(r.Fragment,null);var l=null===(n=null===(t=e.video.productionCompanies)||void 0===t?void 0:t.data)||void 0===n?void 0:n[0],s=ie.j.createUrl(null!==(o=null===(i=null==l?void 0:l.logo)||void 0===i?void 0:i.url)&&void 0!==o?o:e.companyLogoFallbackUrl,{size:re.h2.Small}),u=(0,R.x)(l.name,D.o);return s?r.createElement("div",null,r.createElement(Z.u,{title:null==l?void 0:l.name,spanHack:!0},r.createElement("div",{className:"".concat(oe.logo," ").concat("sm"===e.size?oe.sm:""," ").concat(!(null===(a=null==l?void 0:l.metadata)||void 0===a?void 0:a.colour)&&u),style:{backgroundImage:"url(".concat(s,")"),backgroundColor:null===(c=null==l?void 0:l.metadata)||void 0===c?void 0:c.colour}}))):r.createElement(r.Fragment,null)}ae.defaultProps={size:"md"};var ce=n(47673),le=n(74421),se=n(17977);function ue(e){return C.M.isClip(e.video)?r.createElement(se.y,{typeId:le.E.Clip,size:e.size,inContainer:!0}):C.M.isInteractive(e.video)?r.createElement(se.y,{typeId:le.E.Interactive,status:e.video.status,size:e.size,inContainer:!0}):r.createElement(r.Fragment,null)}ue.default={size:"md"};var fe=n(17082);n(33755);var de=r.createContext({hasProvider:!1}),pe={hoverContainer:"TzWQw",hovering:"gdTcW"};function me(e){var t,n=r.useContext(de);if(null===(t=n.useInitialize)||void 0===t||t.call(n,e),!n.hasProvider)return r.createElement(r.Fragment,null);if("picture-in-picture"===n.mode)return r.createElement(r.Fragment,null);if("hover"===e.mode&&n.isOnPlayPage)return r.createElement(r.Fragment,null);if("play-page"===e.location)return r.createElement(fe.t0,{node:n.portalNode});var i=n.started,o="rounded-3";"popout-video"===e.location&&(o="rounded-top-3");var a="".concat(pe.hoverContainer," ").concat(i?pe.hovering:""," ").concat(o," overflow-hidden");return r.createElement("div",{className:a},r.createElement(fe.t0,{node:n.portalNode}))}var he=n(32557),ve={overlayContainer:"qu3A3",topLeftContainer:"gjhMe",topRightContainer:"XAfZW",overlay:"NTrtm",downScale:"puKcM",title:"_6FukN",gradient:"rXzR8",playIcon:"dndOA",videoProgress:"yhWf4",badgeContainer:"AtgmC",clipProgress:"E2egN",interactiveProgress:"WycwR"};function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ge(e){var t,n,i,o,a,l,s,u=C.M.getCanBeConsumed(e.video),p=u.canNavigate,m=u.canConsume,h=y.t.isObject(null===(t=e.appLink)||void 0===t?void 0:t.params)?null===(n=e.appLink)||void 0===n?void 0:n.params:{},v=Object.assign(Object.assign({},e.analyticsOptions),{entity:C.M.getAnalyticsEntity(e.video)}),w=N.showFavouriteButton(e.video,e.hovering),E=C.M.isVideo(e.video),S=C.M.getRating(e.video),k=(l=(0,he.L)({delay:100}),s=2,function(e){if(Array.isArray(e))return e}(l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(l,s)||function(e,t){if(e){if("string"==typeof e)return ye(e,t);var n={}.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)?ye(e,t):void 0}}(l,s)||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.")}()),x=k[0],O=k[1]&&m&&e.hoverToPlay,j=Object.assign(Object.assign({},e.analyticsData),{id:e.video.id,name:e.video.name}),P=Object.assign(Object.assign({},v),{actionType:c.Vw.Click,descriptor:c._S.Thumbnail});return r.createElement(Z.u,{title:C.M.getPrivacyReasoning(e.video),spanHack:!0,spanHackClassName:""},r.createElement("div",{className:"position-relative rounded-3 overflow-hidden",ref:x},r.createElement(ee,{isPlugin:e.commonVideoProps.isPlugin,className:"rounded-3",appLink:p?e.appLink:null,analyticsData:j,analyticsOptions:P}),w&&r.createElement("div",{className:ve.topRightContainer},r.createElement(L,{setFavourite:e.commonVideoProps.setFavourite,canFavourite:e.commonVideoProps.canFavourite,video:e.video,analyticsData:e.analyticsData,analyticsOptions:v})),!p&&r.createElement("div",{className:ve.topRightContainer},r.createElement(ne,null)),r.createElement("div",{className:"".concat(ve.topLeftContainer," d-flex flex-no-wrap")},e.showOwner&&r.createElement($,{video:e.video,imageCdnUrl:e.commonVideoProps.imageCdnUrl}),r.createElement(ue,{video:e.video}),r.createElement(ae,{video:e.video,companyLogoFallbackUrl:e.commonVideoProps.companyLogoFallbackUrl})),r.createElement(F.Z,{data:C.M.getThumbnail(e.video),appLink:p?e.appLink:null,imageType:re.__.Thumbnails,imageOptions:e.imageOptions,preload:e.preload,className:ve.gradient,alt:("series"in e.video&&(null===(i=e.video.series)||void 0===i?void 0:i.name)?"".concat(e.video.series.name,": "):"")+e.video.name,analyticsData:j,analyticsOptions:P,preventFocus:!0},!(!e.hovering||!p)&&r.createElement(f.x,{className:ve.playIcon,svgName:d.vn.PlayCircle}),r.createElement(U,{type:T.Video}),r.createElement("div",{className:ve.overlayContainer},r.createElement("div",{className:ve.overlay},r.createElement("div",{className:"".concat((o=e.hovering,a="mb-1",o&&(a+=ve.downScale),a)," ").concat(ve.title)},E&&r.createElement(ce.$,{type:e.commonVideoProps.subTextType,className:"text-shadow clamp-1",video:e.video,appLink:null,analyticsOptions:null}),r.createElement("span",{className:"h6 text-reset text-shadow clamp-1"},C.M.getTitle(e.video))),r.createElement(q,{video:e.video}),e.hovering&&r.createElement(b.c,{className:"mt-1"},C.M.isVideo(e.video)&&r.createElement(r.Fragment,null,r.createElement(g.C,{type:g.g.Rating,data:S}),e.video.hasSubtitle&&r.createElement("span",{className:"badge p-0"},r.createElement(f.x,{svgName:d.vn.CloseCaptionBadge})),r.createElement(g.C,{type:g.g.Interactive,data:e.video.hasInteractives}),r.createElement(g.C,{type:g.g.DurationExact,data:C.M.getDuration(e.video)})))))),O&&r.createElement(me,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:h.context,contextId:h.contextId,moviesAndTv:h.mtv})))}var be,we=n(11306),Ee=n(31647),Se=r.createContext({}),ke=n(52076);function xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}!function(e){e.Left="8px",e.Right="calc(100% - 8px)",e.Center="center"}(be||(be={}));var Oe=function(e,t,n){var r,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.2,o=e.x,a=e.y,c=e.width,l=e.height,s=document.getElementById("content-width-reference");if(!s)return{};var u=t||c*i,f=t?t*(l/c):l*i,d=t?u/c:i;r=o-(u-c)/2,u<n&&(r-=(n-u)/2,f=l*(d=(u=n)/c));var p=a-(f-l)/2+window.scrollY,m=r,h=be.Center;return r-s.offsetLeft<8&&(m=o-4,h=be.Left),s.offsetWidth+s.offsetLeft-(r+u)<8&&(m=t?o+c-t:o-c*(d-1)+8,h=be.Right),{left:m,top:p,height:f,width:u,transformOrigin:h,position:"absolute",originalWidth:c,originalHeight:l}},Ce={positionWrapper:"jO7pW",animationWrapper:"xXfXO",zoom:"BrrtL"};function Ne(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return je(e,t);var n={}.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)?je(e,t):void 0}}(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 je(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Pe(e){var t,n,i=e.hoverableComponent,o=e.componentProps,a=e.minHoverWidth,l=e.fixedHoverWidth,s=e.hoverScale,u=r.useContext(Se).setPreviewContentNode;void 0===u&&Ee.Q.Ry.throw(new we.H("Please use VideoPreviewContext inside a VideoPreviewContextProvider"));var f=r.useMemo((function(){return(0,fe.oD)()}),[]),d=Ne((0,he.L)({delay:100}),2),p=d[0],m=d[1],h=Ne((0,he.X)(),2),v=h[0],y=h[1],g=Ne(r.useState(!1),2),b=g[0],w=(g[1],r.useRef(null)),E=r.useRef(!1),S=m||y;!function(e,t,n){var i,o,a=(i=r.useState(e),o=2,function(e){if(Array.isArray(e))return e}(i)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(i,o)||function(e,t){if(e){if("string"==typeof e)return xe(e,t);var n={}.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}}(i,o)||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.")}()),l=a[0],s=a[1],u=r.useRef(e?new Date:null);r.useEffect((function(){if(t&&n&&n.entity&&t.location)if(e)l||s(!0),u.current=new Date,ke.k.logUserAction(t,Object.assign(Object.assign({},n),{actionType:c.Vw.Hover}));else{if(!l)return;var r=(new Date).getTime()-u.current.getTime();u.current=null,ke.k.logUserAction(Object.assign(Object.assign({},t),{timeHoveredInMilliseconds:r,timeHoveredInSeconds:r/1e3}),Object.assign(Object.assign({},n),{actionType:c.Vw.Unhover}))}}),[e])}(S,e.analyticsData,e.analyticsOptions),r.useEffect((function(){E.current!==S&&(u(S||b?f:null),E.current=S)}),[S]);var k=(null===(n=null===(t=w.current)||void 0===t?void 0:t.getBoundingClientRect)||void 0===n?void 0:n.call(t))||{},x=k.x,O=k.y,C=k.width,N=k.height,j=r.useMemo((function(){return Oe({x:x,y:O,width:C,height:N},l,a,s)}),[x,O,C,N,s]),P=j?j.originalWidth/j.width:1,I=i;return r.createElement("div",{ref:w},r.createElement("div",{ref:p},r.createElement(I,Object.assign({isHovering:!1},o))),(S||b)&&r.createElement(fe.Nq,{node:f},r.createElement("div",{className:"".concat(Ce.positionWrapper," ").concat(Ce.animationWrapper),style:Object.assign({"--scale":P},j),ref:v},r.createElement(I,Object.assign({isHovering:!0,hoverPositionConfig:j,cleanPortalNode:function(){return u(null)}},o)))))}function Ie(e){return e.audience?r.createElement("div",{className:"audience-label border rounded-pill d-inline-block px-2 text-nowrap \n ".concat("border-"+e.border," ").concat(e.className?e.className:"")},e.audience.name):r.createElement(r.Fragment,null)}Pe.ReferenceContainer=function(e){return r.createElement("div",{id:"content-width-reference",className:"flex-grow-1"},e.children)};var Le={badgeContainer:"fy9Un",sm:"Rb0TL"};function Te(e){var t=C.M.getRating(e.video),n=!!e.audience&&"sm"!==e.size,i=!n&&!e.hideRating&&!!t&&"sm"!==e.size;return!e.hideDuration||n||i?r.createElement(b.c,{className:"".concat(Le.badgeContainer," ").concat("sm"===e.size?Le.sm:"")},n&&r.createElement(Ie,{audience:e.audience,className:"bg-white text-dark",border:"dark"}),i&&r.createElement(g.C,{type:g.g.Rating,data:t}),!e.hideDuration&&r.createElement(g.C,{type:e.newDurationStyle?g.g.DurationApproximate:g.g.DurationExact,data:e.duration||C.M.getDuration(e.video)})):r.createElement(r.Fragment,null)}Te.defaultProps={newDurationStyle:!0,size:"md"};var _e=n(10657),Ae=n(45428);function Fe(e){if(!e.yearGroups)return r.createElement(r.Fragment,null);var t=Ae.l.mapRestrictionToText(e.video._restrictions,e.yearGroups);return C.M.getCanBeConsumed(e.video).canConsume&&t?r.createElement(Z.u,{spanHack:!0,spanHackClassName:e.className||"d-inline-block ps-1",title:t,placement:e.tooltipPlacement||"top"},r.createElement(f.x,{svgName:d.vn.Lock,size:"sm"===e.size?f.S.Small:f.S.Standard})):r.createElement(r.Fragment,null)}var De={dot:"VrK4W",smallText:"OScyH",title:"svw3F"},Re=w.T.encloseNamespace("shared.videoTitle"),Me=new Date;function Ue(e){var t,n,i=e.video.dateReleased,o=i&&(n=i,_e.O.isSame(n,Me,"year")&&_e.O.isSame(n,Me,"month")),a=e.showNewVideoIndicator&&o&&(null===(t=e.video._isClickViewCurated)||void 0===t?void 0:t.value);return r.createElement(r.Fragment,null,r.createElement(Z.u,{title:"".concat(a?Re("newVideo"):""),spanHack:!0,spanHackClassName:"d-inline-block"},a&&r.createElement("span",{className:"rounded-circle bg-green d-inline-block me-1 ".concat(De.dot," ").concat("h6"===e.titleSize?De.smallText:"")})),r.createElement("h2",{className:"".concat(e.titleSize," ").concat(De.title," ").concat(e.className," d-inline")},e.title||e.video.name),e.showPadlock&&r.createElement(Fe,{video:e.video,yearGroups:e.yearGroups,size:e.lockSize}))}Ue.defaultProps={titleSize:"h6",className:""};function Ve(e){var t,n,i=e.video,o=e.appLink,a=C.M.getCanBeConsumed(i).canNavigate;return r.createElement("div",{className:"mt-2 ".concat("r70GR")},r.createElement("div",{className:"d-flex flex-column ".concat("rULXI")},C.M.isVideo(i)&&r.createElement(ce.$,{type:e.commonVideoProps.subTextType,className:"text-truncate",video:i,appLink:null===(n=(t=e.commonVideoProps).getSubTextAppLink)||void 0===n?void 0:n.call(t,e.video),analyticsOptions:{location:c.LZ.VideoThumbnail}}),r.createElement(l.F,{className:"text-reset clamp-2 align-middle",appLink:a?o:null},r.createElement(Ue,{video:e.video,yearGroups:e.commonVideoProps.yearGroups,lockSize:"sm",showNewVideoIndicator:e.commonVideoProps.showNewVideoIndicator,showPadlock:!e.commonVideoProps.hasStudentExperience}))))}var Be="OjHQZ";function qe(e){var t,n;return e.appLink?r.createElement(l.F,{appLink:e.appLink,analyticsData:e.appLinkAnalyticsData,analyticsOptions:e.appLinkAnalyticsOptions,className:"\n p-1 pe-2 rounded-pill d-inline-flex align-items-center cursor-pointer\n text-decoration-none ".concat(null===(t=e.theme)||void 0===t?void 0:t.container," ").concat(Be," ").concat(e.active?"kD1xM":"","\n ")},r.createElement(Ge,Object.assign({},e))):r.createElement("div",{className:"p-1 pe-2 rounded-pill d-inline-flex align-items-center ".concat(null===(n=e.theme)||void 0===n?void 0:n.container," ").concat(Be," ").concat("eGiNR")},r.createElement(Ge,Object.assign({},e)))}function Ge(e){var t;return r.createElement(r.Fragment,null,r.createElement(f.x,{className:"".concat("SS2zL"," rounded-circle bg-").concat(e.iconVariant," text-white"),svgName:e.svgName}),r.createElement("span",{className:"ps-1 text-nowrap user-select-none ".concat(null===(t=e.theme)||void 0===t?void 0:t.tabLabel)},e.text))}function Ze(e){var t;return!e.video||C.M.isInteractive(e.video)||C.M.isClip(e.video)?r.createElement(r.Fragment,null):(null===(t=e.video._hasCurriculumLinks)||void 0===t?void 0:t.value)?r.createElement(qe,{theme:{container:"classroom-guide-tag",tabLabel:"classroom-guide-tag-label"},svgName:d.vn.GraduationCap,iconVariant:"navy",text:w.T.getPhrase("shared.classroomGuideTag","curriculum"),appLink:e.appLink,appLinkAnalyticsData:Object.assign(Object.assign({videoGuidanceType:"curriculum"},C.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:c.Vw.Click,entity:C.M.getAnalyticsEntity(e.video)},e.analyticsOptions)}):r.createElement(r.Fragment,null)}function ze(e){var t;if(!C.M.showInteractivesGuidance(e.video))return r.createElement(r.Fragment,null);var n=!C.M.isInteractive(e.video)&&((null===(t=e.video.interactives)||void 0===t?void 0:t.data.length)||0);return r.createElement(qe,{svgName:d.vn.Interactive,iconVariant:"green",text:w.T.getPhrase("shared.interactivesTag","interactives",{smartCount:n}),appLink:e.appLink,appLinkAnalyticsData:Object.assign(Object.assign({videoGuidanceType:"interactive",videoGuidanceTotalItems:n},C.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:c.Vw.Click,entity:C.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}function He(e){if(!C.M.showResourcesGuidance(e.video))return r.createElement(r.Fragment,null);var t,n,i,o=(t=e.video,C.M.isInteractive(t)?0:((null===(n=t.resources)||void 0===n?void 0:n.data.length)||0)+((null===(i=t.links)||void 0===i?void 0:i.data.length)||0));return r.createElement(qe,{svgName:d.vn.Resources,iconVariant:"indigo",text:w.T.getPhrase("shared.resourcesTag","resources",{smartCount:o}),appLink:e.appLink,appLinkAnalyticsData:Object.assign(Object.assign({videoGuidanceType:"resource",videoGuidanceTotalItems:o},C.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:c.Vw.Click,entity:C.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}function We(e){var t,n,i,o,a,c,l=C.M.showInteractivesGuidance(e.video)&&C.M.showResourcesGuidance(e.video);return r.createElement("div",{className:"".concat(e.containerClassName," ").concat(l?e.responsiveClassName:"")},r.createElement(Ze,{appLink:null===(n=(t=e.commonVideoProps).getClassroomGuideAppLink)||void 0===n?void 0:n.call(t,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}),r.createElement(He,{appLink:null===(o=(i=e.commonVideoProps).getResourceGuidanceAppLink)||void 0===o?void 0:o.call(i,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}),r.createElement(ze,{appLink:null===(c=(a=e.commonVideoProps).getInteractiveGuidanceAppLink)||void 0===c?void 0:c.call(a,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}))}var Qe={button:"CXHmZ"};function Ye(e){var t=e.removeButtonTooltip||w.T.getPhrase("shared.removeVideoButton","removeFromRow");return r.createElement("div",{className:"me-2"},r.createElement(Z.u,{title:t,spanHack:!0},r.createElement(S.L,{onClick:e.onClickRemove,className:"d-flex align-items-center justify-content-center ".concat(Qe.button),tabIndex:e.preventFocus?-1:void 0},r.createElement(f.x,{svgName:d.vn.Close,className:"svg-container ".concat(Qe.heart)}))))}var Ke=function(e){var t,n=e.video,i=e.appLink,o=e.imageOptions,a=e.preload,l=e.isHovering,s=e.hoverToPlay,u=y.t.isObject(null==i?void 0:i.params)?null==i?void 0:i.params:{},f=C.M.getCanBeConsumed(n),d=f.canNavigate,p=f.canConsume;r.useEffect((function(){return function(){var t;null===(t=e.cleanPortalNode)||void 0===t||t.call(e)}}),[]);var m="position-relative bg-white";e.extraClasses&&(m+=" ".concat(e.extraClasses)),l&&(m+=" rounded-3 shadow-lg");var h=Object.assign(Object.assign({},e.analyticsOptions),{entity:C.M.getAnalyticsEntity(n)}),v=e.isHovering&&p&&s,g=N.showFavouriteButton(e.video,l),b=Object.assign(Object.assign({},e.analyticsData),{id:n.id,name:n.name}),w=Object.assign(Object.assign({},h),{actionType:c.Vw.Click,descriptor:c._S.Thumbnail});return r.createElement("div",{className:m},r.createElement("div",{className:"FAuzc"},!!E.q.isFunction(e.onClickRemove)&&(!!x.V.isTabletOrMobile()||l)&&r.createElement(Ye,{onClickRemove:function(t){var n;t.preventDefault(),null===(n=e.onClickRemove)||void 0===n||n.call(e)},removeButtonTooltip:e.removeButtonTooltip,preventFocus:!0}),g&&r.createElement(L,{setFavourite:e.commonVideoProps.setFavourite,canFavourite:e.commonVideoProps.canFavourite,video:n,analyticsData:e.analyticsData,analyticsOptions:h,preventFocus:!0}),!d&&r.createElement(Z.u,{title:C.M.getPrivacyReasoning(e.video),spanHack:!0,spanHackClassName:""},r.createElement(ne,null))),r.createElement("div",{className:"position-relative"},r.createElement(ee,{isPlugin:e.commonVideoProps.isPlugin,className:l?"rounded-top-3":"rounded-3",onClick:function(){var t;return null===(t=e.cleanPortalNode)||void 0===t?void 0:t.call(e)},appLink:d?i:null,analyticsData:b,analyticsOptions:w}),r.createElement(F.Z,{onClick:function(){var t;return null===(t=e.cleanPortalNode)||void 0===t?void 0:t.call(e)},data:C.M.getThumbnail(n),appLink:d?i:null,imageType:re.__.Thumbnails,imageOptions:o,preload:a,alt:("series"in n&&(null===(t=n.series)||void 0===t?void 0:t.name)?"".concat(n.series.name,": "):"")+n.name,analyticsData:b,analyticsOptions:w,preventFocus:!e.hideTitle,appLinkClassName:"position-absolute top-0 start-0 h-100 w-100 overflow-hidden ".concat(l?"rounded-top-3":"rounded-3"),imageClassName:l?"rounded-top-3":"rounded-3"},r.createElement(U,{type:T.Video}),r.createElement("div",{className:"p-absolute w-100 h-100 text-white"},r.createElement("div",{className:"".concat("wHY80"," d-flex flex-no-wrap")},e.showOwner&&r.createElement($,{video:n,imageCdnUrl:e.commonVideoProps.imageCdnUrl}),r.createElement(ue,{video:n}),r.createElement(ae,{video:n,companyLogoFallbackUrl:e.commonVideoProps.companyLogoFallbackUrl})),r.createElement(Te,{video:e.video,audience:e.audience,hideRating:e.hideRating,hideDuration:e.hideDuration}),r.createElement(q,{video:n}))),v&&r.createElement(me,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:u.context,contextId:u.contextId,moviesAndTv:u.mtv,location:"popout-video"})),!l&&!e.hideTitle&&r.createElement(Ve,Object.assign({},e)),r.createElement("div",{className:"".concat("vMaXP"," ").concat(l?"".concat("tR1jA"," box-shadow"):"")},l&&r.createElement(r.Fragment,null,r.createElement("div",{className:"".concat(l?"KJrT1":"")},r.createElement(Ve,Object.assign({},e)),e.showVideoGuidance&&l&&r.createElement(We,{commonVideoProps:e.commonVideoProps,video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,responsiveClassName:"OixHb",containerClassName:"d-flex justify-content-start align-items-center pt-2"})))))};function $e(e){return r.createElement(r.Fragment,null,r.createElement(Pe,{hoverableComponent:Ke,componentProps:e,fixedHoverWidth:400,minHoverWidth:400,analyticsData:Object.assign(Object.assign({},e.analyticsData),{id:e.video.id,name:e.video.name}),analyticsOptions:Object.assign(Object.assign({},e.analyticsOptions),{entity:C.M.getAnalyticsEntity(e.video)})}))}var Xe,Je={mask:"qpc7L",small:"L8Oxs",video:"b8kJW",playlist:"eo2p2",maskContainer:"lpwag"};function et(e){var t=e.type,n=e.size,i=function(e){return e===Xe.Video?Je.video:e===Xe.Playlist?Je.playlist:""}(t),o=function(e){return e===Xe.Video?d.vn.PlayCircle:""}(t);return r.createElement("div",{className:"".concat(Je.maskContainer," ").concat("sm"===n?Je.small:"")},r.createElement("div",{className:Je.mask}),r.createElement(f.x,{svgName:o,className:i}))}!function(e){e[e.Video=0]="Video",e[e.Playlist=1]="Playlist",e[e.Series=2]="Series"}(Xe||(Xe={})),et.defaults={size:"md"};var tt,nt={unchecked:"bup9I",outline:"ealw_",checked:"A1Ov0",checkMark:"c14lI"};function rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function it(e){var t,n,i=(t=r.useState(e.status===tt.Complete),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return rt(e,t);var n={}.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)?rt(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1];r.useEffect((function(){a(e.status===tt.Complete)}),[e.status]);var c="cursor-pointer rounded-circle ".concat(o?nt.checked:nt.unchecked);return e.className&&(c+=" ".concat(e.className)),"outline"===e.style&&(c+=" ".concat(nt.outline)),e.status&&e.status!==tt.None&&E.q.isFunction(e.setStatus)?r.createElement(S.L,{className:c,onClick:function(){var t=!o;a(t);var n=t?tt.Complete:tt.Incomplete;e.setStatus(n).catch((function(){a(!t)}))},disabled:e.disabled},r.createElement(f.x,{svgName:d.vn.Tick,className:"svg-container ".concat(nt.checkMark)})):r.createElement(r.Fragment,null)}!function(e){e.None="None",e.Complete="Complete",e.Incomplete="Incomplete"}(tt||(tt={})),it.defaultProps={style:"filled"};var ot,at={container:"efxnE",cvIcon:"OJ_ZQ",action:"vWvGn"};function ct(e){return C.M.getCanBeConsumed(e.video).canNavigate?function(e){var t;return!(null===(t=C.M.getCanBeConsumed(e.video))||void 0===t?void 0:t.canConsume)||!(!E.q.isFunction(e.setFavourite)||!E.q.isFunction(e.canFavourite))||!!E.q.isFunction(e.setCheckMarkStatus)}(e)?r.createElement("div",{className:"".concat(at.container," d-flex align-items-center")},r.createElement(L,{setFavourite:e.setFavourite,canFavourite:e.canFavourite,video:e.video,className:at.action,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,preventFocus:!0}),r.createElement(it,{status:e.checkMarkStatus,setStatus:e.setCheckMarkStatus,className:at.action})):r.createElement(r.Fragment,null):r.createElement("div",{className:at.container},r.createElement(ne,{size:e.size}))}!function(e){e[e.Below=1]="Below",e[e.Overlay=2]="Overlay",e[e.Independent=3]="Independent"}(ot||(ot={}));var lt={titleOverlay:"krg9f",clip:"MPRU6",large:"g5_ww",interactive:"Zzo3e",titleBelow:"tZjPt",overlayContainer:"EElm1",topLeftContainer:"hrw3I",gradient:"LS_EH"};function st(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ut(e,t);var n={}.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)?ut(e,t):void 0}}(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 ut(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ft="shared.staticVideoThumbnail";function dt(e){var t,n,i,o=e.type,a=e.video,s="static"===o,u=e.textPosition===ot.Overlay,f=C.M.getCanBeConsumed(e.video).canNavigate,d="";return u?(d=lt.titleOverlay,f&&(C.M.isClip(a)&&(d+=" "+lt.clip),C.M.isInteractive(a)&&(d+=" "+lt.interactive))):d=lt.titleBelow,r.createElement("div",{className:d},C.M.isVideo(a)&&r.createElement(ce.$,{type:s?e.commonVideoProps.subTextType:"series",className:u?"text-shadow clamp-1":"clamp-2",video:a,appLink:s&&!u?null===(n=(t=e.commonVideoProps).getSubTextAppLink)||void 0===n?void 0:n.call(t,e.video):null,analyticsOptions:{location:c.LZ.VideoThumbnail}}),!u&&f&&s?r.createElement(l.F,{className:"h6 text-reset clamp-2",appLink:e.appLink},r.createElement(Ue,{video:a,showNewVideoIndicator:e.commonVideoProps.showNewVideoIndicator,showPadlock:!e.commonVideoProps.hasStudentExperience})):r.createElement("span",{className:"h6 text-reset clamp-1"},r.createElement(Ue,{video:a,title:null!==(i=a.name)&&void 0!==i?i:w.T.getPhrase(ft,"videoUnavailable"),showNewVideoIndicator:s&&e.commonVideoProps.showNewVideoIndicator,showPadlock:s&&!e.commonVideoProps.hasStudentExperience})))}function pt(e){var t,n,i,o,a=e.type,l=e.video,s=e.textPosition,u=e.imageOptions,f=e.preload,d="static"===a,p=d&&y.t.isObject(null===(t=e.appLink)||void 0===t?void 0:t.params)?null===(n=e.appLink)||void 0===n?void 0:n.params:{},m=st((0,he.X)(),2),h=m[0],v=m[1],g=st((0,he.L)({delay:100}),2),b=g[0],w=g[1],E=C.M.getCanBeConsumed(l),S=E.canNavigate,k=E.canConsume,x=d&&w&&k&&e.hoverToPlay,O=d?Object.assign(Object.assign({},e.analyticsOptions),{entity:C.M.getAnalyticsEntity(l)}):{},j=d&&!!e.appLink&&!e.hideMask&&S,P=d?C.M.getPrivacyReasoning(e.video,e.showSignIn):"",I=d?Object.assign(Object.assign({},e.analyticsData),{id:l.id,name:l.name}):{},L=Object.assign(Object.assign({},O),{actionType:c.Vw.Click,descriptor:c._S.Thumbnail});return r.createElement(Z.u,{title:P,spanHack:!0,spanHackClassName:""},r.createElement("div",{className:(o="position-relative",o+=d&&e.appLink&&S?" cursor-pointer":"",e.extraClasses&&(o+=" ".concat(e.extraClasses)),s===ot.Overlay&&(o+=" rounded overflow-hidden"),o),ref:function(e){h.current=e,b.current=e}},d&&r.createElement(ee,{isPlugin:e.commonVideoProps.isPlugin,className:"sm"===e.size?"rounded":"rounded-3",appLink:S?e.appLink:null,analyticsData:I,analyticsOptions:L}),r.createElement(ct,{video:l,checkMarkStatus:!d&&e.checkMarkStatus,setCheckMarkStatus:!d&&e.setCheckMarkStatus,setFavourite:d&&e.commonVideoProps.setFavourite,canFavourite:function(){var t,n;if(d)return!e.disableFavourite&&(null===(n=(t=e.commonVideoProps).canFavourite)||void 0===n?void 0:n.call(t,e.video))&&N.showFavouriteButton(l,v)},analyticsData:d&&e.analyticsData,analyticsOptions:d&&O,size:e.size}),r.createElement(F.Z,{data:C.M.getThumbnail(l),appLink:d&&S?e.appLink:null,onClick:d&&S?e.onClick:void 0,imageType:re.__.Thumbnails,imageOptions:u,preload:f,className:function(){var t="overflow-hidden ".concat("sm"===e.size?"rounded":"rounded-3");return e.imageClassName&&(t+=" ".concat(e.imageClassName)),s===ot.Overlay&&(t+=" ".concat(lt.gradient)),t}(),alt:("series"in l&&(null===(i=l.series)||void 0===i?void 0:i.name)?"".concat(l.series.name,": "):"")+l.name,analyticsData:I,analyticsOptions:L,preventFocus:!0},j&&r.createElement(et,{type:Xe.Video,size:e.size}),r.createElement(U,{type:T.Video}),r.createElement("div",{className:lt.overlayContainer},s===ot.Overlay&&r.createElement(dt,Object.assign({},e)),r.createElement("div",{className:"".concat(lt.topLeftContainer," d-flex flex-no-wrap")},d&&e.showOwner&&r.createElement($,{video:l,imageCdnUrl:e.commonVideoProps.imageCdnUrl}),!e.hideVideoTypeBadge&&r.createElement(ue,{video:l,size:e.size}),d&&r.createElement(ae,{video:l,companyLogoFallbackUrl:e.commonVideoProps.companyLogoFallbackUrl,size:e.size})),r.createElement(q,{video:l}),r.createElement(Te,{video:e.video,audience:e.audience,hideRating:e.hideRating,hideDuration:e.hideDuration,newDurationStyle:e.newDurationStyle,size:e.size}))),x&&r.createElement(me,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:p.context,contextId:p.contextId,moviesAndTv:p.mtv}),s===ot.Below&&r.createElement(dt,Object.assign({},e))))}function mt(e){switch(e.type){case"static":case"cosmetic":return r.createElement(pt,Object.assign({},e));case"expandable":return r.createElement(ge,Object.assign({},e));case"popout":return r.createElement($e,Object.assign({},e));default:return}}mt.defaultProps={hideRating:!0,size:"md",hoverToPlay:!1};var ht=n(50072),vt=n(5984),yt={navItem:"GyyRT",active:"aVNhj",navContainer:"uQ6as",navItemHeading:"NjJLh"},gt="libraryRequests.leftNav";function bt(e){var t,n,i=e.libraryRequest,s=i.sender&&"".concat(i.sender.name," ").concat(i.sender.surname),u=(null===(t=i.object)||void 0===t?void 0:t.name)||i.name;return r.createElement(l.F,{className:"d-flex py-3 px-3 text-decoration-none ".concat(yt.navItem," ").concat(e.active?yt.active:""),appLink:Object.assign(Object.assign({},e.appLink),{args:[i.id],params:e.queryParams}),onClick:function(){return a.t.preventScrollTop()}},r.createElement("div",{className:"col-5 px-0"},r.createElement(mt,{video:null!==(n=i.object)&&void 0!==n?n:{},type:"cosmetic",imageOptions:{size:re.h2.Small},textPosition:ot.Independent,hideMask:!0})),r.createElement("div",{className:"col-7 ps-2"},r.createElement("div",{className:"d-flex justify-content-between w-100"},r.createElement("div",{className:"overflow-hidden"},r.createElement(ce.$,{type:"series",video:i.object,analyticsOptions:{location:c.LZ.LibraryRequestDetails}}),!!u&&r.createElement("h5",{className:"m-0 mb-0 h6",title:u},r.createElement("span",{className:"text-truncate pb-1 d-block ".concat(yt.navItemHeading)},u))),i.status!==ht.l.Pending&&r.createElement("div",{className:"flex-shrink-0 ms-1"},r.createElement(vt.h,{status:i.status}))),!!s&&r.createElement("div",null,r.createElement(v.x,{namespace:gt,phrase:i.status===ht.l.AutoApproved?"addedBy":"requestedBy",options:{fullName:s}})),r.createElement("div",null,(0,o.WU)(i.dateCreated))))}function wt(e){return r.createElement("div",{className:"".concat(yt.navContainer," bg-white rounded overflow-hidden")},r.createElement(i.$B,{hideTracksWhenNotNeeded:!0},e.libraryRequests.map((function(t,n){return r.createElement(bt,{libraryRequest:t,key:n,active:e.selectedId===t.id,appLink:e.appLink,queryParams:e.queryParams})})),(e.nextCursor||e.isFetching)&&r.createElement(h,{isFetching:e.isFetching,fetchNext:e.fetchNext,nextCursor:e.nextCursor,fetchOnScroll:!0})))}},7044:function(e,t,n){"use strict";n.d(t,{p:function(){return o}});var r=n(32735);function i(){return r.createElement("div",{className:"d-flex p-3"},r.createElement("div",{className:"col-5 px-0"},r.createElement("div",{className:"responsive-img partial-loading-background rounded"})),r.createElement("div",{className:"col-7 ps-2"},r.createElement("div",{className:"partial-loading-background mb-1",style:{height:"1.25rem",width:"9rem"}}),r.createElement("div",{className:"partial-loading-background",style:{height:"1rem",width:"4rem"}})))}function o(){return r.createElement("div",{className:"bg-white rounded"},Array(5).fill(null).map((function(e,t){return r.createElement(i,{key:t})})))}},17950:function(e,t,n){"use strict";n.d(t,{F:function(){return g}});var r=n(32735),i=n(57857),o=n(70065),a=n(53808),c=n(77105),l=n(90335);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function u(e,t,n){return(t=function(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var f="shared.videoSortSelect",d=a.q.memoize((function(){return u(u(u(u(u(u({},l.D.RecentlyAdded,{name:i.T.getPhrase(f,"recentlyAdded")}),l.D.AtoZ,{name:i.T.getPhrase(f,"atoz")}),l.D.ZtoA,{name:i.T.getPhrase(f,"ztoa")}),l.D.Newest,{name:i.T.getPhrase(f,"newest")}),l.D.Oldest,{name:i.T.getPhrase(f,"oldest")}),l.D.Series,{name:i.T.getPhrase(f,"series")})}));function p(e){var t,n,o=e.sortTypes||(t=e.includeProductionYear,n=d(),t&&(n=Object.assign(u({},l.D.ProductionYear,{name:i.T.getPhrase(f,"productionYear")}),n)),n);return r.createElement("div",{className:"dropdown"},r.createElement("button",{className:"btn btn-".concat(e.variant," ms-2 dropdown-toggle"),type:"button",id:"sort-select","data-bs-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},o[e.type].name),r.createElement("ul",{className:"dropdown-menu dropdown-menu-end","aria-labelledby":"sort-select"},Object.keys(o).map((function(t){var n="dropdown-item";return t===e.type&&(n+=" active"),r.createElement("li",{key:t},r.createElement(c.F,{className:n,appLink:e.getSortAppLink(t),analyticsData:{sort:o[t].name},analyticsOptions:e.analyticsOptions},o[t].name))}))))}function m(e){return m="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},m(e)}function h(e,t,n){return(t=function(e){var t=function(e){if("object"!=m(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=m(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}p.defaultProps={variant:"light"};var v=i.T.encloseNamespace("libraryRequests.sort"),y=function(){return h(h({},l.D.Newest,{name:v("newest")}),l.D.Oldest,{name:v("oldest")})};function g(e){var t=y();return r.createElement(p,{variant:"outline-dark",type:e.queryParams.sort||l.D.Newest,getSortAppLink:function(t){return Object.assign(Object.assign({},e.appLink),{params:Object.assign(Object.assign({},e.queryParams),{sort:t})})},sortTypes:t,analyticsOptions:{location:o.LZ.LibraryRequestDetails,entity:o.py.LibraryRequest,actionType:o.Vw.Sort,workflowPhase:o.eu.Complete}})}},5984:function(e,t,n){"use strict";n.d(t,{h:function(){return f},$:function(){return u}});var r=n(32735),i=n(57857),o=n(39396),a=n(85475),c=n(50072),l={svgContainer:"O2Czg"},s=i.T.encloseNamespace("libraryRequests.statusIcon");function u(e){switch(e){case c.l.AutoApproved:return s("autoApproved");case c.l.Approved:return s("approved");case c.l.Closed:return s("closed");case c.l.Rejected:return s("rejected")}return""}function f(e){var t="",n="".concat(l.svgContainer," text-white d-inline-block svg-container rounded-circle ");switch(e.status){case c.l.AutoApproved:t=a.vn.Check,n+="bg-gray-500";break;case c.l.Approved:t=a.vn.Check,n+="bg-success";break;case c.l.Closed:t=a.vn.Minus,n+="bg-gray-500";break;case c.l.Rejected:t=a.vn.Close,n+="bg-danger"}return r.createElement(o.x,{svgName:t,className:n,size:o.S.Small,title:u(e.status),tooltipSpanHack:!0,tooltipPlacement:"top"})}},32178:function(e,t,n){"use strict";n.d(t,{A:function(){return h}});var r=n(32735),i=n(57857),o=n(52076),a=n(77105),c=n(41087),l=n(58424),s=n(39396),u={pillTabSelector:"Hdi6o",tab:"RvNxr",minWidth:"GHSz9",radiusSmall:"VhJJa",tabLink:"WFyvo"};function f(e){return r.createElement(r.Fragment,null,!!e.tab.svgName&&r.createElement("div",{className:e.tab.name?"pe-1":""},r.createElement(s.x,{svgName:e.tab.svgName})),e.tab.name,"number"==typeof e.tab.count&&r.createElement("div",{className:"ps-2"},r.createElement(c.C,{type:c.g.Count,data:e.tab.count})))}function d(e){var t;return r.createElement("nav",{className:null!==(t=e.className)&&void 0!==t?t:"",ref:e.containerRef},r.createElement("ul",{className:"\n list-unstyled d-inline-block m-0 ".concat(u.pillTabSelector,"\n ").concat(e.borderRadius?u.radiusSmall:"","\n ").concat(e.listClassName,"\n ")},e.tabs.map((function(e,t){return r.createElement("li",{className:"\n p-0 ".concat(u.tab," ").concat(e.active?"btn btn-dark":"btn btn-outline-dark","\n ").concat(e.name?u.minWidth:""," ").concat(e.className,"\n "),key:t},e.appLink?r.createElement(a.F,{appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,className:"\n cursor-pointer d-flex align-items-center justify-content-center\n text-decoration-none text-reset px-2 text-nowrap ".concat(u.tabLink,"\n ")},r.createElement(f,{tab:e})):r.createElement(l.L,{className:"\n cursor-pointer d-flex align-items-center justify-content-center\n text-decoration-none text-reset px-2 text-nowrap ".concat(u.tabLink,"\n "),onClick:function(){return function(e){!e.active&&e.onSelect&&(e.onSelect(),e.analyticsData&&e.analyticsOptions&&o.k.logUserAction(e.analyticsData,e.analyticsOptions))}(e)}},r.createElement(f,{tab:e})))}))))}d.defaultProps={borderRadius:"lg"};var p=n(50997),m=i.T.encloseNamespace("libraryRequests.tabs");function h(e){var t=[{name:m("pending"),appLink:{application:p.OV.LIBRARY_REQUESTS,action:p.eX.LibraryRequests.PENDING_REQUESTS,args:[""]},active:"pending"===e.active},{name:m("past"),appLink:{application:p.OV.LIBRARY_REQUESTS,action:p.eX.LibraryRequests.PAST_REQUESTS,args:[""]},active:"past"===e.active}];return r.createElement("div",{className:"mb-3"},r.createElement(d,{tabs:t}))}},50072:function(e,t,n){"use strict";var r;n.d(t,{l:function(){return r}}),function(e){e.Pending="Pending",e.Approved="Approved",e.Rejected="Rejected",e.Closed="Closed",e.AutoApproved="AutoApproved"}(r||(r={}))},41026:function(e,t,n){"use strict";n.d(t,{K:function(){return c}});var r=n(32735),i=n(57857),o=n(89375),a=i.T.encloseNamespace("libraryRequests.libraryRequestTitle");function c(e){var t,n=(null===(t=null==e?void 0:e.object)||void 0===t?void 0:t.name)||(null==e?void 0:e.name),i=a("title")+(n?" - ".concat(n):"");r.useEffect((function(){return o.j.setPageTitle(i)}),[i])}},59198:function(e,t,n){"use strict";n.d(t,{s:function(){return a}});var r=n(86120),i=n(82378),o=n(25796);function a(e){var t=r.a.useGetFetch(),n=function(t){return o.y.comments(e,t)};return(0,i.i)(!!e&&n,(function(e){return t(n(e))}))}},85739:function(e,t,n){"use strict";n.d(t,{p:function(){return c}});var r=n(32735),i=n(86120),o=n(94223),a=n(25796);function c(e,t){var n=i.a.useGetFetch(),c=function(n){return a.y.libraryRequests(e,t,n)},l=function(e){return n(c(e))},s=(0,o.P)(c&&function(e){return c(e).key});return r.useEffect((function(){s&&s.shouldInitialFetch&&l()}),[e,t]),Object.assign(Object.assign({},s),{fetchNext:l})}},30328:function(e,t,n){"use strict";n.d(t,{A:function(){return o}});var r=n(32735),i=n(31647);function o(e){var t=e.id,n=e.appLink,o=e.requests;r.useEffect((function(){!t&&(null==o?void 0:o.length)&&i.Q.C$.trigger(Object.assign(Object.assign({},n),{args:[o[0].id]}),{replace:!0})}),[t,null==o?void 0:o.length])}},64429:function(e,t,n){"use strict";n.d(t,{m:function(){return c}});var r=n(32735),i=n(31647),o=n(50997),a=n(50072);function c(e,t,n){r.useEffect((function(){e&&(e.status===a.l.Pending&&"pending"!==t&&i.Q.C$.trigger({application:o.OV.LIBRARY_REQUESTS,action:o.eX.LibraryRequests.PENDING_REQUESTS,args:[e.id],params:n},{replace:!0}),e.status!==a.l.Pending&&"pending"===t&&i.Q.C$.trigger({application:o.OV.LIBRARY_REQUESTS,action:o.eX.LibraryRequests.PAST_REQUESTS,args:[e.id],params:n},{replace:!0}))}),[e,t])}},39123:function(e,t,n){"use strict";n.d(t,{g:function(){return c}});var r=n(32735),i=n(43823),o=n(54096),a=n(50997);function c(e){var t=(0,o.G)(a.Or.Library);function n(n){t.getLibraries((function(t){return e(t.toJSON(),n.toJSON())}))}r.useEffect((function(){return i.Radio.channel(a.Vk.LIBRARY).on("folder:created",n),function(){i.Radio.channel(a.Vk.LIBRARY).off("folder:created",n)}}),[e])}},61356:function(e,t,n){"use strict";n.d(t,{c:function(){return x}});var r=n(43823),i=n(21161),o=n(31647),a=n(52076),c=n(70065),l=n(88483),s=n(53825),u=n(10101),f=n(10079),d=n(45390),p=n(93569),m=n(264),h=n(57e3),v=n(37339),y=n.n(v);function g(e){return g="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},g(e)}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}function w(e){var t=function(e){if("object"!=g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(t)?t:t+""}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(E=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function k(e,t){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},k(e,t)}var x=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=S(t),function(e,t){if(t&&("object"==g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,E()?Reflect.construct(t,n||[],S(e).constructor):t.apply(e,n))}(this,t,[e]))._viewKeyRequested=!1,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&k(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){this.bindListeners()}},{key:"name",get:function(){return"VideoPreviewComponent"}},{key:"template",get:function(){return y()}},{key:"instanceChannelName",get:function(){return p.N0.generateUniqueChannelName(this)}},{key:"defaults",get:function(){return{captureAnalytics:!0}}},{key:"behaviors",get:function(){var e=this;return[{behaviorClass:u.Im,selector:".lazy-img",callback:function(){r.Radio.channel(e.instanceChannelName).trigger("show:play:icon")},minBrowserSupportVersion:d.v9}]}},{key:"regions",value:function(){return{player:{el:".video-player-region",replaceElement:!1},thumbnail:{el:".thumbnail-region",replaceElement:!0}}}},{key:"events",value:function(){return{click:"onClick"}}},{key:"bindListeners",value:function(){this.options.channelName&&this.listenTo(this.options.channelName,"update:chapter:time",this.onUpdateWebplayer)}},{key:"onUpdateWebplayer",value:function(e){return m.g.hasLite?this.playerViewKey?this.player?void this.seekToChapter(e):(this.listenToOnce(this.options.channelName,"player:loaded",i.bind(this.seekToChapter,this,e)),void this.renderVideoPreview()):(this.listenToOnce(this.options.channelName,"player:loaded",i.bind(this.seekToChapter,this,e)),void this.requestViewKey()):this.webPlayer?void this.seekToChapter(e):(this.listenToOnce(this.options.channelName,"webplayer:loaded",i.bind(this.seekToChapter,this,e)),void this.renderVideoPreview())}},{key:"seekToChapter",value:function(e){this.player?this.player.currentTime(e):this.webPlayer.seekTo(e)}},{key:"requestViewKey",value:function(){var e=this;this.playerViewKey||this._viewKeyRequested||(this._viewKeyRequested=!0,this.options.createViewKey(this.model.get("id"),(function(t){e.playerViewKey=t,e.renderVideoPreview()})))}},{key:"onClick",value:function(){this.model.get("id")&&(m.g.hasLite?this.requestViewKey():this.webPlayer||this.renderVideoPreview())}},{key:"renderThumbnail",value:function(){this.showChildView("thumbnail",new s.Z({model:this.model,thumbnailOptions:{size:l.h2.Medium},playIcon:!0,lazyload:!0,channelName:this.instanceChannelName,thumbnail:p.M2.getThumbnail(this.model),duration:p.M2.getDuration(this.model),durationNewStyle:!0}))}},{key:"renderVideoPreview",value:function(){if(this.playerViewKey)return this.player=new h.l({model:this.playerViewKey,playerApiUrl:this.options.playerApiUrl,channelName:this.options.channelName}),void this.showChildView("player",this.player);this.webPlayer=new f.Q({model:this.model,webPlayerUrl:this.options.webPlayerUrl,parentChannelName:this.options.channelName,autoplay:!0,analyticsOptions:a.k.mergeOptions(this.options.analyticsOptions,{entity:c.py.Video}),captureAnalytics:this.options.captureAnalytics,currentUser:this.options.currentUser}),this.showChildView("player",this.webPlayer)}},{key:"onRender",value:function(){this.playerViewKey?this.renderVideoPreview():this.renderThumbnail()}}])&&b(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o}(o.Q.wA)},37339:function(e,t,n){var r=n(31197);e.exports=(r.default||r).template({1:function(e,t,n,r,i){return"cursor-pointer "},compiler:[8,">= 4.3.0"],main:function(e,t,n,r,i){var o;return e.propertyIsEnumerable,'<div class="video-player-region '+(null!=(o=n.if.call(null!=t?t:e.nullContext||{},null!=t?t.id:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))?o:"")+'">\n <div class="thumbnail-region"></div>\n</div>'},useData:!0})}}]);
1
+ /*! For license information please see 9471-48cf12a8aa.chunk.js.LICENSE.txt */
2
+ (self.webpackChunk_clickview_library_editor=self.webpackChunk_clickview_library_editor||[]).push([[9471],{23689:function(e,t,n){"use strict";n.d(t,{i:function(){return d}});var r=n(32735),i=n(43823),o=n(52765),a=n(11306),c=n(21679),l=n(53808),s={fetch:function(e,t){var n=e.dataServiceName,r=e.eventPrefix,s=e.fetchData,u=e.setData,f=e.onError,d=e.deleteEventPrefix;if(l.q.isFunction(s)){if(l.q.isFunction(u)){var p=f&&l.q.isFunction(f),m=c.u.getInstance(n),h=i.Radio.channel(m.channelName),v="".concat(r,":request"),y="".concat(r,":sync"),g="".concat(r,":error"),b="".concat(r,":invalidate"),w=d&&"".concat(d,":sync"),E=function(){return t(!1)},S=function(){return t(!0)},k=function(){return t(!1)},x=function(){return h.off(b,k)};h.once(v,E),h.once(y,S),h.once(b,k),p&&h.once(g,f),w&&h.once(w,x);var O=s(m);return O&&(t(!0),e.setData(O)),function(){c.u.releaseInstance(n),h.off(v,E),h.off(y,S),h.off(b,k),p&&h.off(g,f),w&&h.off(w,x)}}o.Ry.throw(new a.H("A setData function must be passed to fetch"))}else o.Ry.throw(new a.H("A fetchData function must be passed to fetch"))}};function u(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.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)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t){var n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=(n=r.useState(!1),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,i)||u(n,i)||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.")}()),c=a[0],l=a[1];r.useEffect((function(){l(!1)}),function(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(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.")}()}(t)),r.useEffect((function(){if(o)return s.fetch(e,l)}),[c,o])}},42120:function(e,t,n){"use strict";n.d(t,{e:function(){return s}});var r=n(32735),i=n(53808),o=n(19442),a=n(21326),c=n(31709),l=n(1471);function s(e){var t=r.useMemo((function(){return e.actions.sort((function(e,t){return e.order-t.order}))}),[e.actions]),n=[],s=[];t.forEach((function(e){e.button?n.push(e):s.push(e)}));var u="d-flex";return e.className&&(u+=" ".concat(e.className)),n.length||s.length?r.createElement("div",{className:u},n.length?n.map((function(t,n){return r.createElement(r.Fragment,{key:n},function(){if(t.label){var n=i.q.isFunction(t.label)?t.label:function(){return r.createElement(r.Fragment,null,t.label)};return r.createElement(c.K,{appLink:t.appLink,href:t.href,onClick:t.onClick,svgName:t.svgName,svgSize:e.dropdownToggleSvgSize,className:t.className,tooltip:t.tooltip,showSpinner:t.showSpinner,analyticsData:t.analyticsData,analyticsOptions:t.analyticsOptions,openInNewTab:t.openInNewTab,disabled:t.disabled},n())}var l=r.createElement(o.h,{appLink:t.appLink,href:t.href,onClick:t.onClick,svgName:t.svgName,className:t.className,analyticsData:t.analyticsData,analyticsOptions:t.analyticsOptions,openInNewTab:t.openInNewTab,disabled:t.disabled,showBorder:t.showBorder,customSize:e.customSize,ariaLabel:t.tooltip});return t.tooltip?r.createElement(a.u,{title:t.tooltip,spanHack:!0},l):l}())})):r.createElement(r.Fragment,null),e.sortComponent&&e.sortComponent,s.length?r.createElement(l.m,{actions:s,dropdownToggleClassName:e.actionsDropdownClassName,dropdownToggleSvgSize:e.dropdownToggleSvgSize,fetchMore:e.fetchMore}):r.createElement(r.Fragment,null)):r.createElement(r.Fragment,null)}},1471:function(e,t,n){"use strict";n.d(t,{m:function(){return v}});var r=n(32735),i=n(53808),o=n(31647),a=n(97874),c=n(52076),l=n(77105),s=n(39396),u=n(21326),f=n(85475),d={dropdownToggle:"UCAnJ"};function p(){return r.createElement(r.Fragment,null,r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"8rem"}})),r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"12rem"}})),r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"11rem"}})),r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"9rem"}})))}function m(e){var t="dropdown-item";return e&&(t+=" ".concat(e)),t}function h(e){var t=i.q.isFunction(e.action.label)?e.action.label:function(){return r.createElement(r.Fragment,null,e.action.label)};if(e.action.appLink)return r.createElement(l.F,{appLink:e.action.appLink,onClick:e.action.onClick,className:m(e.action.className),analyticsData:e.action.analyticsData,analyticsOptions:e.action.analyticsOptions,openInNewTab:e.action.openInNewTab,disabled:e.action.disabled},e.action.svgName&&r.createElement(s.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2 align-middle"}),r.createElement("span",{className:"align-middle"},t()));function n(t){t.preventDefault(),e.action.analyticsData&&e.action.analyticsOptions&&c.k.logUserAction(e.action.analyticsData,e.action.analyticsOptions),i.q.isFunction(e.action.onClick)&&e.action.onClick(),e.action.href&&o.Q.Ab.PageLoad(e.action.href,e.action.openInNewTab)}return e.action.href?r.createElement("a",{className:m(e.action.className),onClick:n,href:e.action.href},e.action.svgName&&r.createElement(s.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2 align-middle"}),r.createElement("span",{className:"align-middle"},t())):r.createElement("span",{className:"cursor-pointer ".concat(m(e.action.className)),onClick:n,role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&n(e)}},e.action.svgName&&r.createElement(s.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2"}),t())}function v(e){if(!e.actions||!e.actions.length)return r.createElement(r.Fragment,null);var t=e.actions.some((function(e){return e.lazyPlaceholder})),n="dropdown";e.className&&(n+=" ".concat(e.className));var i,o="actions-dropdown-".concat(a.Y.getRandomInt()),c="dropdown-toggle px-0 ".concat(d.dropdownToggle);return e.dropdownToggleClassName&&(c+=" ".concat(e.dropdownToggleClassName)),r.createElement("div",{className:n},r.createElement("button",{className:c,type:"button",id:o,"data-bs-toggle":"dropdown","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false","aria-label":"More actions dropdown",onClick:t?e.fetchMore:null},r.createElement(s.x,{svgName:f.vn.More,size:e.dropdownToggleSvgSize})),r.createElement("ul",{className:"dropdown-menu dropdown-menu-end dropdown-menu-right font-size-normal","aria-labelledby":o},t?r.createElement(p,null):e.actions.map((function(e,t){var n=void 0!==i&&i!==e.group;return i=e.group,e.tooltip?r.createElement("li",{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(u.u,{title:e.tooltip,spanHack:!0},r.createElement(h,{action:e}))):r.createElement("li",{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(h,{action:e}))}))))}v.defaultProps={dropdownToggleClassName:"btn btn-light",dropdownToggleSvgSize:s.S.Small}},56535:function(e,t,n){"use strict";n.d(t,{u:function(){return f}});var r=n(32735),i=n(53808),o=n(31647),a=n(52076),c=n(77105),l=n(19442);function s(e){var t=e.className||"btn btn-dark";return e.disabled&&(t+=" disabled"),e.icon?r.createElement(l.h,{className:t,onClick:e.onClick,appLink:e.appLink,svgName:e.icon,href:e.href,openInNewTab:e.openInNewTab,disabled:e.disabled},e.text):!e.appLink||i.q.isFunction(e.onClick)||e.disabled?e.href&&!e.disabled?r.createElement("a",{className:t,href:e.href,target:e.openInNewTab?"_blank":null},e.text):r.createElement("button",{disabled:e.disabled,onClick:function(){e.disabled||(i.q.isFunction(e.onClick)&&e.onClick(),e.appLink&&o.Q.C$.trigger(e.appLink),a.k.logUserAction(e.analyticsData,e.analyticsOptions))},className:t},e.text):r.createElement(c.F,{appLink:e.appLink,className:t,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions},e.text)}function u(e){var t;return r.createElement("img",{alt:e.altText||"",role:"presentation",src:e.src,className:"".concat("NsLci"," ").concat("small"===e.size?"h3RrK":""," ").concat(null!==(t=e.className)&&void 0!==t?t:"")})}function f(e){var t;return r.createElement("div",{className:"text-center d-flex flex-column align-items-center ".concat(null!==(t=e.className)&&void 0!==t?t:"")},e.children)}u.defaultProps={size:"medium"},f.defaultProps={className:"pt-5"},f.Image=function(e){return r.createElement(u,Object.assign({},e))},f.Cta=function(e){return r.createElement(s,Object.assign({},e))},f.Heading=function(e){return r.createElement("h2",{role:"status",className:e.className||"h3"},e.children)},f.Info=function(e){return e.injectHtml?r.createElement("p",{role:"status",className:e.className||"mb-3 w-50",dangerouslySetInnerHTML:{__html:e.children}}):r.createElement("p",{role:"status",className:e.className||"mb-3 w-50"},e.children)}},90305:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var r=n(32735),i=n(85887),o=n(77105),a=n(29267),c="fVSzb";function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var s=r.memo((function(e){var t,n,i=e.forceLoad,o=e.extraClasses,s=void 0===o?"":o,u=e.errorFallbackImageSrc,f=e.preventLoad,d=void 0!==f&&f,p=e.errorFallbackImageClassName,m=e.src,h=e.alt,v=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}(e,["forceLoad","extraClasses","errorFallbackImageSrc","preventLoad","errorFallbackImageClassName","src","alt"]),y=(0,a.Y)({rootMargin:"500px"}),g=y.ref,b=y.inView,w=(t=r.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.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)?l(e,t):void 0}}(t,n)||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.")}()),E=w[0],S=w[1];function k(){return E&&u?u:e.src}if(r.useEffect((function(){if((i||b)&&!d){var e=new Image;return e.onerror=function(){S(!0),u&&(e.src=u)},e.src=m,function(){return e.onerror=null}}}),[b,d]),E&&!u)return r.createElement(r.Fragment,null);if(!g)return r.createElement("img",Object.assign({className:"".concat(c," ").concat(s," ").concat(E&&p||""),alt:h,src:k()},v));var x=Object.assign(Object.assign({alt:h},v),!b&&!i||d?{src:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="}:{src:k()});return i||(x.ref=g),r.createElement("img",Object.assign({className:"".concat(c," ").concat(s," ").concat(E&&p||"")},x))})),u=n(88483),f=n(87013),d={image:"vdd4V",thumbnail:"Ez0E7",tallPoster:"H9bQA",cover:"Nudts",banner:"IOvDH",poster:"iiY56",pdf:"aDJiJ",link:"wDpui"};function p(e){var t=d.image,n="";return e.imageType===u.__.Thumbnails&&(n="thumbnail ".concat(d.thumbnail)),e.imageType===u.__.TallPosters&&(n=d.tallPoster),e.imageType===u.__.Covers&&(n=d.cover),e.imageType===u.__.Banners&&(n=d.banner),e.imageType===u.__.Posters&&(n=d.poster),e.imageType===u.__.Pdf&&(n=d.pdf),e.imageType===u.__.Link&&(n=d.link),n&&(t+=" ".concat(n)),e.className&&(t+=" ".concat(e.className)),t}function m(e){var t=e.data,n=e.imageOptions,a=e.appLink,c=e.preload,l=e.preventLoad,u=e.analyticsOptions,d=e.analyticsData,m=e.imageClassName,h=e.alt,v="";"string"==typeof t?v=t:i.t.isObject(t)&&(v=t.url);var y=v&&n?f.j.createUrl(v,n):v;return r.createElement("div",{className:p(e),style:e.imageStyle},r.createElement(o.F,{appLink:a,analyticsData:d,analyticsOptions:u,onClick:e.onClick,preventFocus:e.preventFocus,className:e.appLinkClassName},e.children,y&&r.createElement(s,{src:y,alt:h,forceLoad:c,preventLoad:l,extraClasses:m,errorFallbackImageSrc:e.errorFallbackImageSrc,errorFallbackImageClassName:e.errorFallbackImageClassName,onLoad:e.onLoad})))}},71012:function(e,t,n){"use strict";n.d(t,{m:function(){return a}});var r=n(32735),i=n(77105),o={subText:"F_1ii",sm:"BxmrB"};function a(e){var t="text-uppercase text-truncate mb-0 ".concat(o.subText," ").concat(e.className);return e.appLink?r.createElement(i.F,{className:t,appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,title:e.title,ariaLabel:e.ariaLabel},e.children):r.createElement("div",{className:t,title:e.title,"aria-label":e.ariaLabel},e.children)}},17977:function(e,t,n){"use strict";n.d(t,{y:function(){return p}});var r=n(32735),i=n(57857),o=n(39396),a=n(50028),c=n(74421),l=n(85475),s={topLeftContainer:"iwBld",draft:"QBpxh",badge:"KcvGx",svg:"gW733",text:"QiH5Q",sm:"tn2BH"},u=i.T.encloseNamespace("shared.typeBadge");function f(e){switch(e){case c.E.Clip:return l.vn.Clip;case c.E.Interactive:return l.vn.Interactive;case c.E.Resource:return l.vn.Resources;default:return""}}function d(e,t){switch(e){case c.E.Clip:return"bg-ultramarine";case c.E.Interactive:return t===a.X.Draft?s.draft:"bg-green";case c.E.Resource:return"bg-indigo";default:return""}}function p(e){var t="".concat(s.badge," rounded-pill text-white ps-0 ").concat("sm"===e.size?s.sm:"");return r.createElement("div",{className:e.inContainer?"":s.topLeftContainer},r.createElement("div",{className:"".concat(t," ").concat(d(e.typeId,e.status))},r.createElement(o.x,{className:"svg-container d-block ".concat(s.svg),size:"sm"===e.size?o.S.Small:o.S.Standard,svgName:f(e.typeId)}),r.createElement("span",{className:s.text},function(e){switch(e){case c.E.Clip:return u("clip");case c.E.Interactive:return u("interactive");case c.E.Resource:return u("resource");default:return""}}(e.typeId))))}p.default={size:"md"}},47673:function(e,t,n){"use strict";n.d(t,{Q:function(){return m},$:function(){return g}});var r=n(32735),i=n(57857),o=n(63151),a=n(22218),c={padNumber:function(e,t){var n=e.toString();if(n.length>=t)return n;for(t-=n.length;t>0;)n="0"+n,t--;return n}},l=n(74421),s={isSeries:function(e){return(null==e?void 0:e.typeId)===l.E.Series},buildSeriesSeasonEpisodeText:function(e,t,n){if(!e)return"";if(!t||!n)return e.toUpperCase();var r=c.padNumber(t,2),i=c.padNumber(n,2);return"".concat(e.toUpperCase()," S").concat(r," • E").concat(i)}},u=n(11275),f=n(71012),d={appLink:"yI6tx",hoverUnderline:"ehDUT"},p=i.T.encloseNamespace("shared.videoSubText");function m(e){var t=e.video,n=t.season;if(!t.episodeNumber||!n)return r.createElement(r.Fragment,null);var i=c.padNumber(n.number,2),o=c.padNumber(t.episodeNumber,2);return r.createElement("span",{className:"d-inline-block ".concat(e.appLink?d.hoverUnderline:"")},e.withSeriesTitle&&r.createElement(r.Fragment,null," "),!!i&&"S".concat(i," • "),"E",o)}function h(e){var t=u.M.getReleaseDate(e.video);return t?u.M.hasSeries(e.video)?r.createElement(r.Fragment,null," • ".concat(t)):r.createElement(r.Fragment,null,t):r.createElement(r.Fragment,null)}function v(e){var t,n=e.appLink,i=e.video,c=e.className,l=void 0===c?"":c,v=null==i?void 0:i.series,y=u.M.getReleaseDate(e.video);if(!(null==v?void 0:v.id)&&!y)return r.createElement(r.Fragment,null);var g=(null==v?void 0:v.id)&&n&&Object.assign(Object.assign({},n),{args:[v.id,o.m.slugify(v.name)]}),b=Object.assign(Object.assign({},e.analyticsData),{id:null==v?void 0:v.id,name:null==v?void 0:v.name,videoId:null==i?void 0:i.id,videoName:null==i?void 0:i.name}),w=Object.assign(Object.assign({},e.analyticsOptions),{entity:a.py.Series,actionType:a.Vw.Click,descriptor:a._S.Title}),E=s.buildSeriesSeasonEpisodeText(null==v?void 0:v.name,null===(t=i.season)||void 0===t?void 0:t.number,i.episodeNumber);return r.createElement(f.m,{appLink:g,className:"d-block ".concat(d.appLink," ").concat(l),analyticsData:b,analyticsOptions:w,title:E,ariaLabel:"".concat(p("ariaSeries")," ").concat(E)},(null==v?void 0:v.name)&&v.name,r.createElement(m,Object.assign({},e,{withSeriesTitle:!0})),r.createElement(h,Object.assign({},e)))}function y(e){var t,n,i=e.appLink,c=e.video,l=e.className,s=void 0===l?"":l,u=null===(n=null===(t=null==c?void 0:c.productionCompanies)||void 0===t?void 0:t.data)||void 0===n?void 0:n[0];if(!(null==u?void 0:u.id))return r.createElement(r.Fragment,null);var m=(null==u?void 0:u.id)&&i&&Object.assign(Object.assign({},i),{args:[u.id,o.m.slugify(u.name)]}),h=Object.assign(Object.assign({},e.analyticsData),{id:null==u?void 0:u.id,name:null==u?void 0:u.name,videoId:null==c?void 0:c.id,videoName:null==c?void 0:c.name}),v=Object.assign(Object.assign({},e.analyticsOptions),{entity:a.py.Company,actionType:a.Vw.Click,descriptor:a._S.Title});return r.createElement(f.m,{appLink:m,className:"d-block ".concat(d.appLink," ").concat(s),analyticsData:h,analyticsOptions:v,title:u.name,ariaLabel:"".concat(p("ariaCompany")," ").concat(u.name)},u.name)}function g(e){var t=e.type,n=void 0===t?"series":t;return"none"===n?r.createElement(r.Fragment,null):"series"===n?r.createElement(v,Object.assign({},e)):r.createElement(y,Object.assign({},e))}},24828:function(e,t,n){"use strict";n.d(t,{o:function(){return r}});var r=["bg-pink","bg-orange"].concat(["bg-green","bg-cyan","bg-teal","bg-blue","bg-indigo","bg-purple"])},99828:function(e,t,n){"use strict";n.d(t,{y:function(){return a}});var r=n(88483);function i(e){return i="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},i(e)}function o(e,t,n){return(t=function(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=o(o(o(o(o(o(o(o(o({},r.__.Thumbnails,{width:1280,height:720}),r.__.Banners,{width:1200,height:222}),r.__.Covers,{width:512,height:512}),r.__.Posters,{width:1e3,height:1500}),r.__.TallPosters,{width:1080,height:1920}),r.__.HeroBanners,{width:1920,height:640}),r.__.None,{width:1,height:1}),r.__.Avatars,{width:256,height:256}),r.__.Logos,{width:128,height:128})},8371:function(e,t,n){"use strict";var r;n.d(t,{b:function(){return r}}),function(e){e.AU="cv-ap-southeast-1",e.NZ="cv-ap-southeast-2",e.UK="cv-eu-west-1",e.US="cv-na-west-1"}(r||(r={}))},82378:function(e,t,n){"use strict";n.d(t,{i:function(){return o}});var r=n(32735),i=n(94223);function o(e,t){var n=e,o=t,a=(0,i.P)(e&&function(e){return n(e).key});return(0,r.useEffect)((function(){a&&a.shouldInitialFetch&&t&&o()}),[null==a?void 0:a.shouldInitialFetch,t]),(0,r.useEffect)((function(){a&&a.nextCursor&&!a.isFetching&&t&&o(a.nextCursor)}),[null==a?void 0:a.nextCursor,null==a?void 0:a.isFetching,t]),a}},32557:function(e,t,n){"use strict";n.d(t,{X:function(){return h},L:function(){return v}});var r=n(32735),i=n(53808),o=n(85887),a=function(){var e=r.useRef(!0);return r.useEffect((function(){return function(){e.current=!1}}),[]),e};function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.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)?l(e,t):void 0}}(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 l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var s=275,u=5,f={className:"",delay:0,style:null},d={screenX:0,screenY:0};function p(e,t){var n;e.current&&(t.className&&(null===(n=e.current.classList)||void 0===n||n.add(t.className)),t.style&&Object.keys(t.style).forEach((function(n){e.current.style[n]=t.style[n]})))}function m(e,t){var n;e.current&&(t.className&&(null===(n=e.current.classList)||void 0===n||n.remove(t.className)),t.style&&Object.keys(t.style).forEach((function(t){e.current.style[t]=null})))}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,t=a(),n=c(r.useState(e),2),l=n[0],s=n[1],u=c(r.useState(!1),2),d=u[0],h=u[1],v=r.useRef(null);r.useEffect((function(){o.t.isEqual(e,l)||s(e)}),[e]);var y=i.q.throttle((function(){p(v,l),t.current&&h(!0)}),l.delay,{leading:!1}),g=function(){i.q.isFunction(y.cancel)&&y.cancel(),m(v,l),t.current&&h(!1)};return r.useLayoutEffect((function(){var e=v.current;if(e)return e.addEventListener("mouseenter",y),e.addEventListener("mouseleave",g),function(){e.removeEventListener("mouseenter",y),e.removeEventListener("mouseleave",g)}}),[v.current,l]),[v,d]}function v(e){var t=c(r.useState(e),2),n=t[0],a=t[1],l=r.useRef(Object.assign({},d)),f=r.useRef(!1),h=r.useRef(0),v=r.useRef(null),y=c(r.useState(!1),2),g=y[0],b=y[1];function w(){h.current&&(window.clearTimeout(h.current),h.current=0)}function E(){f.current=!0}function S(e){if(f.current){var t,r,i=Object.assign({},l.current);l.current.screenX=e.screenX,l.current.screenY=e.screenY,function(e,t){return Math.abs(e.screenX-t.screenX)>u||Math.abs(e.screenY-t.screenY)>u}(i,e)&&w(),t=function(){p(v,n),b(!0)},r=n.delay||s,h.current||(h.current=window.setTimeout(t,r))}}function k(){w(),m(v,n),f.current=!1,b(!1)}return r.useEffect((function(){o.t.isEqual(e,n)||a(e)}),[e]),r.useLayoutEffect((function(){if(v.current){var e=i.q.throttle(S,25,{leading:!1});return v.current.addEventListener("mouseenter",E),v.current.addEventListener("mousemove",e),v.current.addEventListener("mouseleave",k),function(){v.current&&(v.current.removeEventListener("mouseenter",E),v.current.removeEventListener("mousemove",e),v.current.removeEventListener("mouseleave",k))}}}),[v.current,n]),[v,g]}},29267:function(e,t,n){"use strict";n.d(t,{Y:function(){return o}});var r=n(34152);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function o(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n.prevent,a=n.rootMargin,c=n.triggerOnce,l=void 0===c||c,s=(e=(0,r.YD)({triggerOnce:l,rootMargin:a}),t=3,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.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)?i(e,t):void 0}}(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.")}()),u=s[0],f=s[1],d=s[2];return!0!==o&&void 0!==window.IntersectionObserver||(f=!0,u=null),{ref:u,inView:f,initialized:!!d}}},94223:function(e,t,n){"use strict";n.d(t,{P:function(){return u}});var r=n(32735),i=n(70680),o=n(35656),a=n(53808),c=n(86120);function l(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.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)?s(e,t):void 0}}(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 s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n){function o(e){if(e)return a.q.isFunction(t)?l(t(e)):l(e.data)}function s(e){var t,r;if(e)return n?n(e):null===(r=null===(t=e.pagination)||void 0===t?void 0:t.cursors)||void 0===r?void 0:r.next}return(0,i.v9)((0,r.useMemo)((function(){return function(t){if(a.q.isFunction(e)){for(var n=e,r=a.q.isFunction(e)&&n(),i=r&&c.a.getResponse(t,r),u=i&&i.isFetching,f=i&&i.statusCode,d=i&&i.hasCompleted,p=d,m=i&&i.shouldFetch,h=o(i&&i.data),v=s(i&&i.data),y=function(e){if(e)return null==e?void 0:e.count}(i&&i.data);v&&(i=c.a.getResponse(t,n(v)),u=u||i.isFetching,f=i.statusCode,d=i.hasCompleted,!i.shouldFetch);){var g=o(i.data);g&&h.push.apply(h,l(g));var b=s(i.data);v=b===v?null:b}var w={shouldInitialFetch:m,items:h,nextCursor:v,isFetching:u,statusCode:f,hasCompleted:d,hasFirstPageCompleted:p};return"number"==typeof y&&(w.totalItems=y),w}}}),[e]))}o.o.Ok},51547:function(e,t,n){"use strict";n.r(t),n.d(t,{CropperHelper:function(){return v}});var r=n(32735),i=n(44645),o=n(51934),a=n.n(o),c=n(57857),l=n(4231),s=n(83996),u=n(99828);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.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)?d(e,t):void 0}}(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 d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var p=c.T.encloseNamespace("shared.imageCropper"),m=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function h(e){var t=f(r.useState(!1),2),n=t[0],i=t[1],o=f(r.useState(!1),2),c=o[0],d=o[1],h=r.useRef(null),v=r.useRef(null);return r.useEffect((function(){var t=new Image;t.src=e.src;var n=h.current.offsetWidth/t.width,r=u.y[e.imageType],o={viewMode:2,autoCropArea:1,ready:function(){return i(!0)}};return r&&(o.minCropBoxWidth=r.width*n,o.minCropBoxHeight=r.height*n,o.aspectRatio=r.width/r.height),v.current=new(a())(h.current,o),function(){v.current.destroy()}}),[]),r.createElement(l.G,{title:p("title"),closePopup:e.closePopup,size:e.popupSize},r.createElement("div",null,r.createElement("img",{src:e.src,alt:e.alt,ref:h,className:"img img-fluid"})),r.createElement(s.u,null,r.createElement(s.u.Cancel,{onClick:e.closePopup}),r.createElement(s.u.Submit,{onClick:function(){if(n){var t=v.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(m);if(t)return t[1]}(e.src));d(!0),e.onClickCrop(t,e.closePopup)}},text:p("crop"),variant:"dark",showSpinner:c})))}h.defaultProps={popupSize:"lg"};var v={renderCropper:function(e){var t=(0,i.s)(document.getElementById("dialog-region"));t.render(r.createElement(h,Object.assign({},e,{closePopup:function(){return t.unmount()}})))}}},22231:function(e,t,n){"use strict";function r(e,t){return t[e.charCodeAt(0)%t.length]}n.d(t,{x:function(){return r}})},38611:function(e,t,n){"use strict";n.d(t,{x:function(){return hu}});var r=n(32735),i=n(66703),o=n(8371),a=n(11275);n(30582),n(85887);var c=r.createContext({setPageMetadata:function(e){return e},revertPageMetadata:function(){},hasPageMetadataChanged:function(){return!1},hasProvider:!1}),l=n(53808);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e){var t,n,i=e.view,o=e.options,a=void 0===o?{}:o,u=e.className,f=void 0===u?"":u,d=e.dependencies,p=void 0===d?[]:d,m=r.useMemo((function(){return new i(a)}),p);t=m.title,n=r.useContext(c),r.useEffect((function(){"boolean"!=typeof t&&n.setPageMetadata({title:t})}),[t]);var h=function(e,t){var n,i=r.useRef(null);return r.useEffect((function(){if(e){var t=i.current;return e.render(),t.hasChildNodes()?t.replaceChild(e.el,t.firstChild):t.appendChild(e.el),e.triggerMethod&&e.triggerMethod("attach"),e.trigger("rendered"),function(){l.q.isFunction(e.close)?e.close():l.q.isFunction(e.destroy)&&e.destroy()}}}),function(e){if(Array.isArray(e))return s(e)}(n=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.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)?s(e,t):void 0}}(n)||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.")}()),i}(m,[m]);return i?r.createElement("div",{ref:h,className:f}):r.createElement(r.Fragment,null)}var f=n(70065),d=n(61356),p=n(85847);function m(e){var t,n=e.config.get("webPlayerUrl"),i=e.config.get("playerApiUrl");return r.createElement("div",{className:"col-12 mb-3 p-0"},r.createElement(u,{view:d.c,options:{model:new p.n(e.video,{parse:!0}),analyticsOptions:{location:f.LZ.VideoRequest},currentUser:e.user,createViewKey:e.createViewKey,webPlayerUrl:n,playerApiUrl:i},dependencies:[null===(t=e.video)||void 0===t?void 0:t.id]}))}var h=n(27866),v="libraryRequests.videoDetail";function y(e){return r.createElement(r.Fragment,null,r.createElement("div",{className:"col-3"},r.createElement("label",null,r.createElement(i.x,{namespace:v,phrase:e.phrase}))),r.createElement("div",{className:"col-9 mb-3"},e.children))}function g(e){var t,n=e.clip,i=n.endTime-n.startTime;function o(e){return h.T.ToDisplayDuration(Math.floor(e))}function a(){var e;return i/((null===(e=n._parentVideo)||void 0===e?void 0:e.duration)/1e3)*100+"%"}return r.createElement(r.Fragment,null,r.createElement("p",null,h.T.ToDisplayDurationNewStyle(1e3*Math.floor(i))),r.createElement("div",{className:"overflow-hidden rounded-3 border p-3"},r.createElement("div",{className:"position-relative z-1"},r.createElement("div",{className:"position-absolute w-100"},r.createElement("span",null," "),r.createElement("div",{className:"bg-light rounded-3",style:{height:10}}))),r.createElement("div",{className:"position-relative z-1",style:{left:function(){var e;return n.startTime/((null===(e=n._parentVideo)||void 0===e?void 0:e.duration)/1e3)*100+"%"}()}},r.createElement("div",{className:"d-flex justify-content-between",style:{width:a()}},r.createElement("span",null,o(1e3*n.startTime)),r.createElement("span",{className:"text-secondary"}," - "),r.createElement("span",null,o(1e3*n.endTime))),r.createElement("div",{className:"bg-blue rounded-3 px-1",style:{width:a(),height:10}})),r.createElement("div",{className:"d-flex justify-content-between text-secondary"},r.createElement("span",null,"0:00"),r.createElement("span",null,o(null===(t=n._parentVideo)||void 0===t?void 0:t.duration)))))}function b(e){var t=e.libraryRequest.object;return r.createElement("div",{className:"row"},((null==t?void 0:t.name)||e.libraryRequest.name)&&r.createElement(y,{phrase:"title"},(null==t?void 0:t.name)||e.libraryRequest.name),t.description&&r.createElement(y,{phrase:"description"},r.createElement("span",{className:"pre-wrap"},t.description)),r.createElement(y,{phrase:"duration"},r.createElement(g,{clip:t})))}var w,E=n(42648),S=n(58424),k=n(39396);!function(e){e[e.Correct=0]="Correct",e[e.Incorrect=1]="Incorrect",e[e.AwaitingMarking=2]="AwaitingMarking",e[e.Answered=3]="Answered",e[e.UnAnswered=4]="UnAnswered",e[e.NotApplicable=5]="NotApplicable"}(w||(w={}));var x=n(71551),O=n(85475),C=n(77105),N=n(58542);function j(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e&&t.length?t.reduce((function(e,t){return function(e,t,n){return e.replace(new RegExp("<".concat(t,".*?>"),"gi"),"").replace(new RegExp("</".concat(t,">"),"gi"),n?"<br>":"")}(e,t,n)}),e):e}function P(e){var t,n;if(e)return e=j(e,["ul","ol","b","i","u","old","em","strong","sup","sub","a","span"]),(null===(n=null===(t=(e=j(e,["li","p","div"],!0)).split("<br>"))||void 0===t?void 0:t.filter((function(e){return!!e}))[0])||void 0===n?void 0:n.trim())||"Annotation"}function I(e){var t=N.w.getTypeInfo(e.interaction.typeId),n=t.name,i=t.bgClassName,o=t.Svg,a=e.questionNumber?"".concat(e.questionNumber,". "):"",c="interaction-type-icon flex-shrink-0 ".concat(i);return e.smallIcon&&(c+=" sm"),(e.showQuestion||e.showTypeName)&&(c+=e.smallIcon?" me-1":" me-2"),e.iconClassName&&(c+=" ".concat(e.iconClassName)),r.createElement("span",{className:e.containerClassName},!!e.showIcon&&r.createElement("span",{className:c},r.createElement(o,null)),r.createElement(C.F,{appLink:e.appLink,onClick:e.onClick},!!e.showTypeName&&r.createElement("span",{className:e.typeNameClassName},r.createElement("strong",null,a,n)),!!e.showQuestion&&r.createElement("span",{className:e.questionClassName},e.interaction.typeId===x.Z9.Annotation?r.createElement("span",{dangerouslySetInnerHTML:{__html:P(e.interaction.data.annotation)}}):e.interaction.name)))}I.defaultProps={showIcon:!0,showQuestion:!0};var L={timeTag:"ShZvf",hide:"FHzDr",time:"JDp5N",type:"AzIWg",question:"UhEYq",deleteContainer:"wBqoo",delete:"OAQQu",correctness:"W5sR9",selected:"tfrDf",row:"sGk59"},T="shared.interactiveQuestions";function _(e){var t=e.interaction;switch((0,e.getCorrectness)(t)){case w.Correct:return r.createElement("span",{className:"text-success"},r.createElement(k.x,{size:k.S.Medium,svgName:O.vn.Check}));case w.Incorrect:return r.createElement("span",{className:"text-danger"},r.createElement(k.x,{size:k.S.Medium,svgName:O.vn.Close}));case w.AwaitingMarking:return r.createElement("span",{className:"text-secondary italic"},r.createElement("i",null,r.createElement(i.x,{namespace:T,phrase:"pending"})));case w.UnAnswered:return r.createElement("button",{className:"btn btn-outline-dark"},r.createElement(i.x,{namespace:T,phrase:"answer"}));case w.Answered:return r.createElement("span",{className:"text-secondary italic"},r.createElement("i",null,r.createElement(i.x,{namespace:T,phrase:"answered"})));case w.NotApplicable:return r.createElement(r.Fragment,null)}}function A(e){var t=e.interaction,n=e.visibleAt,i=e.selectedInteractionId,o=e.goToTimepoint,a=e.scrollTo,c=e.isFirstInteraction,l=t.id.toString()===(null==i?void 0:i.toString()),s=r.useRef(null);r.useEffect((function(){if(l&&s.current){var e=s.current,t=e.getBoundingClientRect(),n=t.top-e.offsetParent.getBoundingClientRect().top;a(n,t.height)}}),[l]);var u=o?"cursor-pointer":"cursor-default";return r.createElement("div",{ref:s},r.createElement(S.L,{className:"py-2 ".concat(u," ").concat(L.row," ").concat(l?L.selected:""),onClick:l?function(){}:function(){o&&o(t.id)}},r.createElement("div",{className:"me-3 d-inline-flex rounded-pill justify-content-center align-items-center text-info fw-semibold bg-light-blue ".concat(L.timeTag," ").concat(c?"":L.hide)},c?h.T.ToDisplayDuration(n):""),r.createElement(I,{interaction:t,showTypeName:!0,typeNameClassName:L.type,questionClassName:L.question}),e.onClickDelete&&r.createElement(S.L,{onClick:function(n){n.stopPropagation(),e.onClickDelete(t.id)},className:"".concat(L.deleteContainer)},r.createElement("span",{className:"text-end ".concat(L.delete)},r.createElement(k.x,{size:k.S.Medium,svgName:O.vn.Delete}))),e.getCorrectness&&r.createElement("span",{className:"text-end ".concat(L.correctness)},r.createElement(_,{interaction:t,getCorrectness:e.getCorrectness}))))}function F(e){var t=e.timepoint,n=e.scrollTo,i=e.onClickDelete,o=e.selectedInteractionId,a=e.getCorrectness;function c(n){e.goToTimepoint(t.id,n,t.visibleAt)}return t.interactions?r.createElement(r.Fragment,null,t.interactions.map((function(l,s){return!e.experimentalInteractiveQuestions&&x.IL[l.typeId]?r.createElement(r.Fragment,{key:s}):r.createElement(A,{interaction:l,visibleAt:t.visibleAt,goToTimepoint:e.goToTimepoint&&c,onClickDelete:i,scrollTo:n,selectedInteractionId:o,isFirstInteraction:0===s,getCorrectness:a,key:s})}))):r.createElement(r.Fragment,null)}function D(e){var t=e.interactive,n=e.goToTimepoint,i=e.selectedInteractionId,o=e.maxHeight,a=e.onClickDelete,c=e.getCorrectness,l=r.useRef(null);function s(e,t){if(l.current){var n=l.current.getClientHeight(),r=l.current.getScrollTop(),i=e+r;(i<r||i+t>r+n)&&l.current.scrollTop(i-n/2+t/2)}}var u=n?"border rounded":"";return r.createElement(E.$B,{autoHeight:!0,autoHeightMax:o,className:u,hideTracksWhenNotNeeded:!0,ref:l},r.createElement("div",{className:"px-3 py-2"},t.timepoints.map((function(t,o){return r.createElement(F,{key:o,timepoint:t,goToTimepoint:n,selectedInteractionId:i,scrollTo:s,onClickDelete:a,getCorrectness:c,experimentalInteractiveQuestions:e.experimentalInteractiveQuestions})}))))}var R,M="libraryRequests.interactiveDetails";function U(e){var t=e.interactive;return r.createElement(r.Fragment,null,r.createElement("p",{className:"fw-semibold mb-2"},r.createElement(i.x,{namespace:M,phrase:"questionList",options:{length:t._timepoints.value.length}})),t._timepoints.value.map((function(e,t){return r.createElement(F,{key:t,timepoint:e})})))}function V(e){var t=e.libraryRequest.object;return r.createElement("div",{className:"row"},((null==t?void 0:t.name)||e.libraryRequest.name)&&r.createElement(y,{phrase:"title"},(null==t?void 0:t.name)||e.libraryRequest.name),!!t.description&&r.createElement(y,{phrase:"description"},r.createElement("span",{className:"pre-wrap"},t.description)),r.createElement(U,{interactive:t}))}!function(e){e[e.View=0]="View",e[e.Create=1]="Create"}(R||(R={}));var B=n(31647);function q(e){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(e)}function G(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,Z(r.key),r)}}function Z(e){var t=function(e){if("object"!=q(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==q(t)?t:t+""}function z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(z=function(){return!!e})()}function H(e){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},H(e)}function W(e,t){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},W(e,t)}var Q=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t,n){return t=H(t),function(e,t){if(t&&("object"==q(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,z()?Reflect.construct(t,n||[],H(e).constructor):t.apply(e,n))}(this,t,["Could not connect to submit interactive results"])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&W(e,t)}(t,e),n=t,(r=[{key:"name",get:function(){return"InternetConnectivityError"}},{key:"dialogOptions",get:function(){return{title:"Connection issues",text:"There seems to be an issue with your internet connection. Refresh the page to try again. ",buttons:[{text:"Refresh",className:"btn btn-dark",success:!0}]}}},{key:"onDone",value:function(){window.location.reload()}}])&&G(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(n(85835).S),Y=n(61380);function K(e){return K="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},K(e)}function $(){$=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==K(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(K(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function X(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,J(r.key),r)}}function J(e){var t=function(e){if("object"!=K(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=K(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==K(t)?t:t+""}var ee=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},te=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=t,this.save=this.save.bind(this)},(t=[{key:"start",value:function(e){e&&(this.resultId=e),this.startSession()}},{key:"startSession",value:function(){return ee(this,void 0,void 0,$().mark((function e(){var t,n,r,i,o,a,c,l,s,u,f;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.resultId){e.next=2;break}return e.abrupt("return");case 2:return t=this.options,n=t.interactiveId,r=t.metadataId,i=t.userId,o=t.customerId,a=t.shareId,c=t.playerApi,l=t.publicName,s=t.profileId,u={interactiveId:n,metadataId:r,userId:i,customerId:o,shareId:a,publicName:l,profileId:s,anonymous:!i},e.prev=4,e.next=7,Y.e.post(c+"interactive/start-session",JSON.stringify(u));case 7:f=e.sent,this.resultId=f.resultId,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),B.Q.Ry.throw(new Q);case 14:case"end":return e.stop()}}),e,this,[[4,11]])})))}},{key:"save",value:function(e,t){return ee(this,void 0,void 0,$().mark((function n(){var r;return $().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.resultId){n.next=3;break}return n.next=3,this.startSession();case 3:return r={resultId:this.resultId,interactionId:e,results:t},n.prev=4,n.next=7,Y.e.post(this.options.playerApi+"interactive/save-actions",JSON.stringify(r),void 0,!1);case 7:n.next=13;break;case 9:n.prev=9,n.t0=n.catch(4),console.log(n.t0),B.Q.Ry.throw(new Q);case 13:case"end":return n.stop()}}),n,this,[[4,9]])})))}}])&&X(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),ne=n(11306),re=n(61415),ie=(n(96263),n(56775),n(76032));function oe(e){return oe="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},oe(e)}function ae(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,ce(r.key),r)}}function ce(e){var t=function(e){if("object"!=oe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==oe(t)?t:t+""}function le(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(le=function(){return!!e})()}function se(e,t,n,r){var i=ue(fe(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function ue(){return ue="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=fe(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},ue.apply(null,arguments)}function fe(e){return fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},fe(e)}function de(e,t){return de=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},de(e,t)}var pe=function(e){function t(e,n){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=fe(t),function(e,t){if(t&&("object"==oe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,le()?Reflect.construct(t,n||[],fe(e).constructor):t.apply(e,n))}(this,t,[e,n])).timepoint_=n.timepoint,r.time_=n.timepoint.visibleAt/1e3;var i=n.timepoint.interactions[0];i||r.hide();var o=N.w.getTypeInfo(i.typeId).bgClassName;return r.$(".vjs-icon-placeholder").classList.add(o),r.controlText(i.name),r.update(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&de(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-item ".concat(se(t,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(e,n,r){return se(t,"createEl",this,3)([e,Object.assign(Object.assign({},n),{className:this.buildCSSClass()}),Object.assign(Object.assign({},r),{tabindex:0})])}},{key:"update",value:function(){var e=this.player_.duration(),t=this.time_/e;this.el().style.left=100*t+"%",t>100||t<0?this.hide():this.show()}},{key:"handleClick",value:function(e){e.stopPropagation(),this.player_.currentTime(this.time_)}}],r&&ae(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("Button"));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},me(e)}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}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,ye(r.key),r)}}function ye(e){var t=function(e){if("object"!=me(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=me(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==me(t)?t:t+""}function ge(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ge=function(){return!!e})()}function be(e,t,n,r){var i=we(Ee(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function we(){return we="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ee(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},we.apply(null,arguments)}function Ee(e){return Ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ee(e)}function Se(e,t){return Se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Se(e,t)}var ke=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=Ee(t),function(e,t){if(t&&("object"==me(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ge()?Reflect.construct(t,n||[],Ee(e).constructor):t.apply(e,n))}(this,t,[e,n])).track_=n.track,r.interactive_=n.interactive,r.onDurationChange=r.onDurationChange.bind(r),r.createInteractionItems=r.createInteractionItems.bind(r),r.createInteractionItems(),r.track_.on("cv:cuechange",r.createInteractionItems),r.player_.on("durationchange",r.onDurationChange),r.player_.on("dispose",(function(){r.track_.off("cv:cuechange"),r.player_.off("durationchange",r.onDurationChange)})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Se(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-items ".concat(be(t,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(e,n,r){return be(t,"createEl",this,3)([e,Object.assign(Object.assign({},n),{className:this.buildCSSClass()}),r])}},{key:"update",value:function(){this.children_.forEach((function(e){e.update()}))}},{key:"createInteractionItems",value:function(){var e,t=this;if(this.track_){(function(e){return function(e){if(Array.isArray(e))return he(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return he(e,t);var n={}.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}}(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.")}()})(this.children_).forEach((function(e){t.removeChild(e)}));for(var n=0;n<this.track_.cues.length;n++){var r=this.track_.cues[n],i=this.getTimepointById(r.text);i&&(null===(e=i.interactions)||void 0===e?void 0:e.length)&&this.addChild(new pe(this.player_,{timepoint:i}))}}}},{key:"onDurationChange",value:function(){this.update()}},{key:"getTimepointById",value:function(e){var t;return null===(t=this.interactive_.timepoints)||void 0===t?void 0:t.find((function(t){return t.id.toString()===e.toString()}))}}],r&&ve(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("Component")),xe=n(94878);function Oe(e){var t=e.className,n=e.svgName,i=e.children,o=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}(e,["className","svgName","children"]),a="".concat(t," ").concat("Mr0S0");a+=" ".concat(i?"vHTVo":"vIGn0");var c=r.createElement(k.x,{svgName:n,className:"cDUaE"});return r.createElement(S.L,Object.assign({className:a},o),c,i)}function Ce(e){var t=e.isCreate,n=e.open,i=e.showTypeSelector;return!t||n?r.createElement(r.Fragment,null):r.createElement(Oe,{className:"btn btn-outline-dark cv-add-question",onClick:i,svgName:O.vn.Plus},"Add question")}var Ne,je=n(80247),Pe=n(17082),Ie=n(19442),Le=n(90305),Te=n(88483),_e=n(77037);function Ae(e){return Ae="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},Ae(e)}function Fe(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ae(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ae(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function De(){return w.NotApplicable}function Re(e,t){var n=e.actionableItems.filter((function(e){return e.isCorrect}));return n.every((function(e){return!t(e.id)}))?w.UnAnswered:n.every((function(e){var n;return e.name.trim().toLowerCase()===(null===(n=t(e.id))||void 0===n?void 0:n.trim().toLowerCase())}))?w.Correct:w.Incorrect}function Me(e,t){return e.actionableItems.every((function(e){return!t(e.id)}))?w.UnAnswered:e.actionableItems.filter((function(e){return e.isCorrect})).every((function(e){var n,r=t(e.id);return(null==r?void 0:r.toString())===(null===(n=e.id)||void 0===n?void 0:n.toString())||r===e.name}))?w.Correct:w.Incorrect}function Ue(e,t){return function(n){var r=t.attempts.find((function(t){return t.id===e.id}));return null==r?void 0:r.answers.find((function(e){return e.id===n}))}}function Ve(e,t){var n=Ue(e,t);return Me(e,(function(e){var t=n(e);return null==t?void 0:t.text}))}function Be(e,t){return function(e,t){var n;return e.actionableItems.forEach((function(e){var r=t(e.id);n=r?r.status!==Ne.Correct?r.status!==Ne.Incorrect?w.AwaitingMarking:w.Incorrect:w.Correct:w.UnAnswered})),n}(e,Ue(e,t))}!function(e){e[e.Incorrect=0]="Incorrect",e[e.Correct=1]="Correct",e[e.PendingReview=2]="PendingReview"}(Ne||(Ne={}));var qe=Fe(Fe(Fe(Fe(Fe(Fe(Fe({},x.Z9.Annotation,De),x.Z9.Image,De),x.Z9.MissingWord,(function(e,t){var n=Ue(e,t);return Re(e,(function(e){var t=n(e);return null==t?void 0:t.text}))})),x.Z9.MultipleChoice,Ve),x.Z9.ShortAnswer,Be),x.Z9.TrueOrFalse,Ve),x.Z9.Illustration,Be),Ge={notApplicable:De,awaitingMarking:function(){return w.AwaitingMarking},isMissingWordCorrect:Re,isMultipleChoiceCorrect:Me,isInteractionCorrect:function(e,t){return(0,qe[e.typeId])(e,t)}},Ze=n(40221);function ze(e){return Ze.m.last(e.results)}function He(e,t){return Ze.m.findWhere(null==t?void 0:t.attempts,{id:e})}var We=n(76044),Qe=n(57857),Ye=Qe.T.encloseNamespace("interactives.responseTypes");function Ke(){return r.createElement("p",{className:"p-2"},r.createElement("em",null,Ye("noResponse")))}var $e="cv-missing-word-",Xe=n(4234),Je="KpbWq";function et(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var tt=["A","B","C","D"];function nt(e){var t,n,i=(t=r.useState(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return et(e,t);var n={}.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)?et(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1],c=!!e.interaction.actionableItems.find((function(e){var t;return!!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)})),l=r.useRef(null),s="sm"===e.size||c&&e.interaction.actionableItems.length>2;return r.createElement("ul",{className:"".concat(c?"row ".concat(s&&!e.isDisplayOnly?"px-lg-5 p-0":""):""," list-unstyled")},e.interaction.actionableItems.map((function(t,n){var i,u,f=null===(i=e.getSelectedAnswer)||void 0===i?void 0:i.call(e,t.id),d=null===(u=t.data)||void 0===u?void 0:u.imageUrl,p=!!t.name;function m(){e.submitted||(e.onSelectAnswer&&e.onSelectAnswer(t,!f),a(f?null:t.id))}if(e.onlyShowSelectedAnswer&&!f)return r.createElement(r.Fragment,{key:n});var h=f?"bg-blue text-white":e.unCheckedBackground,v=function(){return r.createElement(r.Fragment,null,tt[n])};e.showFeedback&&(e.showCorrectnessIcons||(h=t.isCorrect?"bg-success text-white":"bg-danger text-white ".concat("yodaE")),e.hideFeedbackIcons||(v=function(){return r.createElement(r.Fragment,null,t.isCorrect?r.createElement(k.x,{size:k.S.Small,svgName:O.vn.Check}):r.createElement(k.x,{size:k.S.Small,svgName:O.vn.Close}))}));var y=e.showFeedback?{}:{role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&m()}},g="";c&&(g="col-6");var b=t.id.toString()===(null==o?void 0:o.toString())&&e.leftHandSidePortalNode&&d&&!e.submitted;return r.createElement(r.Fragment,{key:n},b&&r.createElement(Pe.Nq,{node:e.leftHandSidePortalNode},r.createElement(Xe.Z,{className:"h-100",ref:l},r.createElement("div",{className:"p-3 d-flex flex-column h-100"},r.createElement("div",{className:"flex-grow-1"},r.createElement("div",{className:"cv-image-container text-center"},r.createElement("img",{className:"img-fluid rounded",src:d,alt:t.name||tt[n]})),r.createElement("div",{className:"".concat(Je," h6 text-center text-dark p-3")},r.createElement("span",{className:"d-inline-block ".concat(p?"me-3":""," cv-multiple-choice-bullet")},r.createElement(v,null)),p&&r.createElement("span",{className:"flex-grow-1 pe-4"},t.name))),r.createElement("div",{className:"text-end"},r.createElement(S.L,{className:"btn btn-link",onClick:function(){return a(null)}},"Close"))))),r.createElement("li",{className:"".concat(g," mb-3")},r.createElement("label",Object.assign({className:"\n d-block\n rounded-3\n shadow-sm\n position-relative\n ".concat(e.showFeedback?"":"cursor-pointer","\n ").concat(Je,"\n ").concat(h,"\n ").concat(c?"mb-0 h-100":"","\n "),key:n,onClick:m},y),c&&r.createElement("div",null,e.showCorrectnessIcons&&r.createElement("div",{className:"".concat("xnG9h"," position-absolute top-0 start-0 p-2 z-1")},t.isCorrect?r.createElement(k.x,{svgName:O.vn.CheckCircle,size:k.S.ExtraLarge,className:"svg-container text-success"}):r.createElement(k.x,{svgName:O.vn.CrossCircleFilled,size:k.S.Large,className:"svg-container text-red"})),r.createElement("span",{className:"d-block position-relative ".concat("TeByp")},r.createElement("span",{className:"\n ".concat("zWcu2","\n position-absolute\n start-0\n end-0\n top-0\n bottom-0\n rounded-top\n "),style:{backgroundImage:d?"url(".concat(d,")"):void 0},title:t.name||tt[n]}))),r.createElement("span",{className:"d-flex ".concat(p||e.isDisplayOnly?"justify-content-between":"justify-content-center"," ").concat(s?"p-2":"p-3")},r.createElement("span",{className:"d-inline-block ".concat(p?"me-3":""," cv-multiple-choice-bullet")},r.createElement(v,null)),p&&r.createElement("span",{className:"flex-grow-1 pe-4"},t.name),e.userAvatar&&!e.onlyShowSelectedAnswer&&r.createElement("span",{className:"".concat("uKRg2"," ").concat(c?"_LpCq":"")},f&&r.createElement(_e.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white"}))))))})))}nt.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var rt="Y7ls8";function it(e){function t(t){e.onSelectAnswer&&e.onSelectAnswer(t)}return r.createElement("div",{className:"d-flex ".concat(e.className?e.className:""," ").concat("sm"===e.size?"mx-n1":"mx-n2")},e.interaction.actionableItems.map((function(n,i){var o=e.getSelectedAnswer(n.id),a=o?"bg-blue text-white":e.unCheckedBackground,c=function(){return r.createElement(r.Fragment,null)};e.showFeedback&&(a=n.isCorrect?"bg-success text-white":"bg-danger text-white ".concat("ZCkyL"),e.hideFeedbackIcons||(c=function(){return r.createElement(r.Fragment,null,n.isCorrect?r.createElement(k.x,{size:k.S.Small,svgName:O.vn.Check}):r.createElement(k.x,{size:k.S.Small,svgName:O.vn.Close}))}));var l=e.showFeedback?{}:{role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&t(n)}};return r.createElement("label",Object.assign({key:i,htmlFor:n.id,className:"\n rounded-3\n shadow-sm\n my-0\n position-relative\n overflow-hidden\n d-flex\n align-items-center\n justify-content-center\n ".concat("sm"===e.size?"".concat("_2qC40"," mx-1 h5"):"".concat("TKjXy"," mx-2 h4"),"\n ").concat(e.showFeedback?"":"cursor-pointer","\n ").concat(a)},l),r.createElement("input",{id:n.id,type:"radio",name:"multiple-choice",checked:!!o,onChange:function(){return t(n)},disabled:e.showFeedback,hidden:!0}),n.name,r.createElement("span",{className:"position-absolute p-2 ".concat("CBgCv")},r.createElement(c,null)),r.createElement("span",{className:"".concat("CVTEm").concat("sm"===e.size?" ".concat("tbPTs"):"")},o&&r.createElement(_e.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white ".concat("sm"===e.size?"GUAUz":"")})))})))}function ot(e){return ot="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},ot(e)}function at(e,t,n){return(t=function(e){var t=function(e){if("object"!=ot(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ot(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}it.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var ct=function(){return r.createElement(r.Fragment,null)},lt=at(at(at(at(at(at(at({},x.Z9.Annotation,ct),x.Z9.Image,ct),x.Z9.MissingWord,(function(e){var t=e.interaction.data.sentence.replace(/{([^{}]*)}/g,(function(e,t){return"{".concat($e).concat(t,"}")})).split(/{([^{}]*)}/g),n="p-2";return e.reportsStyling||(n+=" border rounded"),r.createElement("div",{className:n},t.map((function(t,n){if(!t.startsWith($e))return t;var i=t.replace($e,""),o=e.interaction.actionableItems.find((function(e){return e.order.toString()===i}));if(o){var a=e.answers.find((function(e){return e.id==o.id}));if(a){if(!e.showFeedback)return r.createElement("strong",{key:n,className:"text-info"},a.text);var c=a.status===Ne.Correct;return r.createElement(r.Fragment,{key:n},!c&&r.createElement(r.Fragment,null,r.createElement("del",{className:"text-danger"},r.createElement("strong",null,a.text))," "),r.createElement("strong",{className:"text-success"},o.name))}}})))})),x.Z9.MultipleChoice,(function(e){var t,n,i,o,a="my-2";return e.reportsStyling&&(a+=" mx-2"),r.createElement("div",{className:a},r.createElement(nt,{interaction:e.interaction,showFeedback:e.showFeedback,getSelectedAnswer:function(t){var n=e.answers.find((function(e){return e.id==t}));return null==n?void 0:n.id},imageApi:e.imageCdnUrl,userInitials:e.anonymisedUserName?We.l.getInitialsFromFullName(e.anonymisedUserName):We.l.getInitials(null===(t=e.user)||void 0===t?void 0:t.name,null===(n=e.user)||void 0===n?void 0:n.surname),userAvatar:e.anonymisedUserName?null:null===(o=null===(i=e.user)||void 0===i?void 0:i.avatar)||void 0===o?void 0:o.url,onlyShowSelectedAnswer:!e.showAvatar,size:"sm",unCheckedBackground:e.showFeedback?"":"".concat(rt," text-white"),isDisplayOnly:!0}))})),x.Z9.TrueOrFalse,(function(e){var t,n,i,o,a="justify-content-start";return e.reportsStyling&&(a="justify-content-center"),r.createElement("div",{className:"my-2"},r.createElement(it,{className:a,interaction:e.interaction,showFeedback:e.showFeedback,hideFeedbackIcons:!e.showAvatar,getSelectedAnswer:function(t){var n=e.answers.find((function(e){return e.id==t}));return null==n?void 0:n.text},imageApi:e.imageCdnUrl,userInitials:e.anonymisedUserName?We.l.getInitialsFromFullName(e.anonymisedUserName):We.l.getInitials(null===(t=e.user)||void 0===t?void 0:t.name,null===(n=e.user)||void 0===n?void 0:n.surname),userAvatar:e.anonymisedUserName?null:null===(o=null===(i=e.user)||void 0===i?void 0:i.avatar)||void 0===o?void 0:o.url,size:"sm",unCheckedBackground:e.showFeedback?"":"".concat(rt," text-white")}))})),x.Z9.ShortAnswer,(function(e){var t=Ze.m.first(e.answers);if(!t)return r.createElement(r.Fragment,null);var n="rounded p-2 mb-2";return e.reportsStyling||(n+=" bg-blue text-white"),r.createElement("div",{className:n},t.text)})),x.Z9.Illustration,(function(e){var t=Ze.m.first(e.answers);if(!t)return r.createElement(r.Fragment,null);var n="rounded p-2 mb-2 w-50";return e.reportsStyling||(n+=" text-white"),r.createElement("div",{className:n},r.createElement("img",{className:"img-fluid border rounded",src:t.text,alt:"Illustrated answer to the question: ".concat(e.interaction.name)}))}));function st(e){return r.createElement(r.Fragment,null,e.correctness===w.Correct&&r.createElement("div",{className:"ms-2 text-success"},r.createElement(k.x,{svgName:O.vn.Tick})),e.correctness===w.Incorrect&&r.createElement("div",{className:"ms-2 text-danger"},r.createElement(k.x,{svgName:O.vn.Close})))}function ut(e){return r.createElement("div",{className:"d-flex align-items-center justify-content-between mb-2"},r.createElement("p",{className:"fw-semibold mb-0"},e.anonymisedUserName||We.l.getFullName(e.studentResults.user)),r.createElement(st,{correctness:e.correctness}))}function ft(e){return e.correctness!==w.AwaitingMarking?r.createElement(r.Fragment,null):r.createElement("div",{className:"d-flex justify-content-end gap-2 mt-2"},r.createElement("div",{className:"d-flex flex-column justify-content-end cursor-pointer\n ".concat(e.markedStatus===Ne.Correct?"text-success":"")},r.createElement(k.x,{svgName:e.markedStatus===Ne.Correct?O.vn.CheckCircle:O.vn.CheckCircleOutline,onClick:function(){return e.markInteraction(e.studentAttempt.answers,Ne.Correct)}})),r.createElement("div",{className:"d-flex flex-column justify-content-end cursor-pointer\n ".concat(e.markedStatus===Ne.Incorrect?" text-danger":"")},r.createElement(k.x,{svgName:e.markedStatus===Ne.Incorrect?O.vn.CrossCircleFilled:O.vn.CrossCircle,onClick:function(){return e.markInteraction(e.studentAttempt.answers,Ne.Incorrect)}})))}function dt(e){var t,n,i,o,a,c=lt[e.interaction.typeId];if(!c)return r.createElement(r.Fragment,null);var l=ze(e.studentResults),s=He(e.interaction.id,l),u=Ge.isInteractionCorrect(e.interaction,l);return r.createElement("div",{className:"position-relative mt-2"},r.createElement("div",{className:"rounded ".concat(null!==(t=e.className)&&void 0!==t?t:"")},r.createElement("div",{className:"d-flex"},!!e.showStudentDetails&&r.createElement("div",{className:"me-2"},r.createElement("div",{className:"FEdgT"},r.createElement(_e.q,{imageCdnUrl:e.imageCdnUrl,initials:e.anonymisedUserName?We.l.getInitialsFromFullName(e.anonymisedUserName):We.l.getInitials(null===(n=e.studentResults.user)||void 0===n?void 0:n.name,null===(i=e.studentResults.user)||void 0===i?void 0:i.surname),imageUrl:e.anonymisedUserName?null:null===(a=null===(o=e.studentResults.user)||void 0===o?void 0:o.avatar)||void 0===a?void 0:a.url}))),r.createElement("div",{className:"flex-grow-1"},!!e.showStudentDetails&&r.createElement(ut,{studentResults:e.studentResults,correctness:u,anonymisedUserName:e.anonymisedUserName}),r.createElement("div",{className:"d-flex justify-content-between"},r.createElement("div",{className:"flex-grow-1 ".concat(e.responseComponentClass?e.responseComponentClass:"")},s?r.createElement(c,{interaction:e.interaction,answers:s.answers,imageCdnUrl:e.imageCdnUrl,user:e.studentResults.user,showFeedback:e.showFeedback,showAvatar:e.showAvatar,reportsStyling:e.reportsStyling}):r.createElement(Ke,null)),!e.showStudentDetails&&r.createElement(st,{correctness:u})))),r.createElement(ft,{studentAttempt:s,correctness:u,markInteraction:e.markInteraction,markedStatus:e.markedStatus})))}var pt,mt,ht=n(44645),vt=n(4231),yt=n(83996),gt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.getElementById("dialog-region");n||((n=document.createElement("div")).id="dialog-region",document.appendChild(n));var i=(0,ht.s)(n);function o(){var e;l.q.isFunction(null===(e=t.cancelButtonProps)||void 0===e?void 0:e.onClick)&&t.cancelButtonProps.onClick(),i.unmount()}var a=Object.assign(Object.assign({},t.submitButtonProps?t.submitButtonProps:{}),{onClick:function(){!function(){var e;if(l.q.isFunction(null===(e=t.submitButtonProps)||void 0===e?void 0:e.onClick)){var n=t.submitButtonProps.onClick();if(n instanceof Promise)return void n.then((function(){i.unmount()}))}i.unmount()}()}}),c=Object.assign(Object.assign({},t.cancelButtonProps?t.cancelButtonProps:{}),{onClick:function(){o()}});i.render(r.createElement(vt.G,{title:t.title,closePopup:o,size:t.size,centered:t.centered,bodyClassName:"overflow-hidden",dialogClassName:t.dialogClassName},e,!t.hideButtons&&r.createElement(yt.u,{className:t.buttonContainerClassName},t.cancelButtonProps&&r.createElement(yt.u.Cancel,Object.assign({},c)),t.submitButtonProps&&r.createElement(yt.u.Submit,Object.assign({},a)))))},bt=n(99785),wt={colourButton:"y6pnq",colourButtonSelected:"PAPVX",canvasDrawContainer:"__tFu",strokeButtonContainer:"D1zMW",strokeButton:"J7C_3",selectedButton:"aJKor"};function Et(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return St(e,t);var n={}.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)?St(e,t):void 0}}(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 St(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}!function(e){e[e.Small=2]="Small",e[e.Medium=4]="Medium",e[e.Large=8]="Large"}(pt||(pt={})),function(e){e.Black="#000000",e.Red="#D9584F",e.Orange="#F8981D",e.Yellow="#FFCD52",e.Green="#5DC786",e.Blue="#38A2E8",e.Purple="#7A76E8",e.Grey="#979797",e.White="#FFFFFF"}(mt||(mt={}));var kt=r.forwardRef((function(e,t){var n=r.useRef(null);r.useImperativeHandle(t,(function(){return n.current}),[n.current]);var i=r.useRef(null),o=Et(r.useState([0,0]),2),a=Et(o[0],2),c=a[0],l=a[1],s=o[1],u=Et(r.useState(mt.Black),2),f=u[0],d=u[1],p=Et(r.useState(pt.Small),2),m=p[0],h=p[1],v=Et(r.useState(!1),2),y=v[0],g=v[1],b=Et(r.useState(mt.Black),2),w=b[0],E=b[1];function k(){if(i.current){var e=i.current.getBoundingClientRect();s([e.width,.5625*e.width])}}function x(e){d(e),E(f),g(!1)}return r.useLayoutEffect((function(){if(i.current){var e=new ResizeObserver(k);return e.observe(i.current),function(){return e.disconnect()}}}),[i.current]),r.createElement("section",null,r.createElement("div",{className:"d-flex align-items-start"},r.createElement("div",{className:"d-flex flex-lg-column"},r.createElement("ul",{className:"me-3-lg me-2 list-unstyled"},Object.entries(mt).slice(0,4).map((function(e,t){var n=Et(e,2),i=n[0],o=n[1];return r.createElement("li",{key:t},r.createElement(S.L,{className:"".concat(wt.colourButton," ").concat(f===o?wt.colourButtonSelected:""," rounded-circle"),style:{backgroundColor:o},onClick:function(){return x(o)},"aria-label":"Select the colour: ".concat(i)}," "))}))),r.createElement("ul",{className:"me-3-lg me-2 list-unstyled"},Object.entries(mt).slice(4).map((function(e,t){var n=Et(e,2),i=n[0],o=n[1];return r.createElement("li",{key:t},r.createElement(S.L,{className:"".concat(wt.colourButton," ").concat(f===o?wt.colourButtonSelected:""," rounded-circle"),style:{backgroundColor:o},onClick:function(){return x(o)},"aria-label":"Select the colour: ".concat(i)}," "))})))),r.createElement("div",{className:"flex-grow-1 position-relative",ref:i},r.createElement("div",{className:wt.canvasDrawContainer},c&&r.createElement(bt.Z,{canvasHeight:l,canvasWidth:c,brushRadius:m,lazyRadius:10,hideGrid:!0,brushColor:f,className:"position-absolute top-0 left-0 border",ref:n}))),r.createElement("div",{className:"d-flex flex-column align-self-stretch ms-2"},r.createElement("div",{className:"d-flex flex-column gap-2 flex-grow-1"},r.createElement("ul",{className:"d-lg-flex flex-column gap-2 list-unstyled d-none"},r.createElement(Oe,{svgName:O.vn.Edit,className:"btn btn-outline-dark ".concat(y?"":wt.selectedButton),onClick:function(){y&&(d(w),g(!1))},"aria-label":"Pen"}),r.createElement(Oe,{svgName:O.vn.Erase,className:"btn btn-outline-dark mb-2 ".concat(y?wt.selectedButton:""),onClick:function(){if(y)return d(w),void g(!1);E(f),d(mt.White),g(!0)},"aria-label":"Eraser"})),r.createElement("ul",{className:"d-flex flex-column mb-2 list-unstyled"},r.createElement("li",{className:wt.strokeButtonContainer},r.createElement(Oe,{svgName:O.vn.SmallStroke,className:"btn btn-outline-dark ".concat(m===pt.Small?wt.selectedButton:""," ").concat(wt.strokeButton),onClick:function(){return h(pt.Small)},style:{color:f!==mt.White?f:mt.Black},"aria-label":"Small stroke"})),r.createElement("li",{className:wt.strokeButtonContainer},r.createElement(Oe,{svgName:O.vn.MediumStroke,className:"btn btn-outline-dark ".concat(m===pt.Medium?wt.selectedButton:""," ").concat(wt.strokeButton),onClick:function(){return h(pt.Medium)},style:{color:f!==mt.White?f:mt.Black},"aria-label":"Medium stroke"})),r.createElement("li",{className:wt.strokeButtonContainer},r.createElement(Oe,{svgName:O.vn.LargeStroke,className:"btn btn-outline-dark ".concat(m===pt.Large?wt.selectedButton:""," ").concat(wt.strokeButton),onClick:function(){return h(pt.Large)},style:{color:f!==mt.White?f:mt.Black},"aria-label":"Large stroke"})))),r.createElement("ul",{className:"d-flex flex-column gap-lg-2 list-unstyled"},r.createElement("li",null,r.createElement(Oe,{svgName:O.vn.Undo,className:"btn btn-outline-dark",onClick:function(){return n.current.undo()},"aria-label":"Undo"})),r.createElement("li",null,r.createElement(Oe,{svgName:O.vn.Delete,onClick:function(){gt(r.createElement("p",null,"Are you sure you want to discard your drawing?"),{title:"Discard your drawing?",submitButtonProps:{onClick:function(){return n.current.clear()},variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}})},className:"btn btn-outline-danger d-lg-block d-none ".concat(wt.myRight),"aria-label":"Clear canvas"}))))))}));function xt(e){var t=r.useRef(null),n=N.w.getTypeInfo(e.interaction.typeId),i=n.bgClassName,o=n.Svg;return r.createElement(Xe.Z,{className:"h-100"},r.createElement("section",{className:"d-flex flex-column h-100"},r.createElement("div",{className:"text-center text-body d-flex justify-content-between align-items-center p-2"},r.createElement("div",{className:"d-flex align-items-center"},r.createElement("span",{className:"".concat("sTvDl"," me-3 rounded my-1 text-white align-middle d-inline-block ").concat(i)},r.createElement(o,null)),r.createElement("span",{className:"text-start flex-grow-1"},r.createElement("h2",{className:"h6 mb-0"},r.createElement("strong",null,e.interaction.name)))),r.createElement("div",null,r.createElement(S.L,{className:"btn btn-link",onClick:function(){gt(r.createElement("p",null,"Are you sure you want to discard your drawing?"),{title:"Discard your drawing?",submitButtonProps:{onClick:e.onCancel,variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}})}},"Cancel"),r.createElement(S.L,{className:"btn btn-dark ms-2",onClick:function(){t.current&&e.onSave(t.current.getDataURL("image/png"))}},"Save"))),r.createElement("div",{className:"cv-timepoint bg-gray-100 flex-grow-1 rounded-bottom"},r.createElement("div",{className:"cv-timepoint-padding h-100"},r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"mx-auto ".concat("kFxi6")},r.createElement(kt,{ref:t})))))))}function Ot(e){var t=e.error;return e.error?r.createElement("p",{className:"mt-2 small text-danger"},t):r.createElement(r.Fragment,null)}function Ct(e){return Ct="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},Ct(e)}function Nt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function jt(){jt=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Ct(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ct(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Pt(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ct(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ct(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var It="data:image/png;base64,";function Lt(e){return Lt="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},Lt(e)}var Tt="cv-missing-word-";function _t(e){return _t="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},_t(e)}function At(e,t,n){return(t=function(e){var t=function(e){if("object"!=_t(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=_t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_t(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ft=n(56108);function Dt(e){return Dt="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},Dt(e)}function Rt(e){return Rt="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},Rt(e)}function Mt(e){return Mt="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},Mt(e)}function Ut(e,t,n){return(t=function(e){var t=function(e){if("object"!=Mt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Mt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vt=function(){return!0},Bt=function(){return!1},qt=Ut(Ut(Ut(Ut(Ut(Ut(Ut({},x.Z9.Annotation,Bt),x.Z9.Image,Bt),x.Z9.MissingWord,Vt),x.Z9.MultipleChoice,Vt),x.Z9.ShortAnswer,(function(e){return!!e.data.suggestedResponse})),x.Z9.TrueOrFalse,Vt),x.Z9.Illustration,Bt);function Gt(e){return qt[e]}var Zt=Ut(Ut(Ut(Ut(Ut(Ut(Ut({},x.Z9.Annotation,(function(e){var t=e.interaction.data.annotation.replace(/<(a)(.*?)>/g,'<$1 target="_blank" $2>');return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"mb-2 h4",dangerouslySetInnerHTML:{__html:t}}))})),x.Z9.Image,(function(e){var t=e.interaction,n=e.recalculateScroll,i=r.useCallback((function(e){e&&(e.onload=function(){n()})}),[]);return r.createElement("div",{className:"cv-interactive-question cv-image-interactive"},r.createElement("div",{className:"cv-image-container text-center"},r.createElement("img",{className:"img-fluid rounded",src:t.data.url,ref:i}),t.data.caption&&r.createElement(r.Fragment,null,r.createElement("p",{className:"mt-3 h4"},t.data.caption))))})),x.Z9.MissingWord,(function(e){var t=e.state,n=e.setState,i=e.interaction,o=e.showFeedback,a=i.data.sentence.replace(/{([^{}]*)}/g,(function(e,t){return"{".concat(Tt).concat(t,"}")})).split(/{([^{}]*)}/g);return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"mb-2 h4"},a.map((function(e,a){var c;if(!e.startsWith(Tt))return e;var l=e.replace(Tt,""),s=i.actionableItems.find((function(e){return e.order.toString()===l}));if(s){var u,f,d=t[s.id]||"",p=(u=s.name,(f=document.createElement("canvas").getContext("2d")).font="20pt arial",f.measureText(u).width);if(o){var m=s.name.toLowerCase().toString()===(null===(c=t[s.id])||void 0===c?void 0:c.toLowerCase().toString());return r.createElement(r.Fragment,{key:a},!m&&r.createElement(r.Fragment,null,r.createElement("del",{className:"text-danger"},d)," "),r.createElement("span",{className:"text-success"},s.name))}return r.createElement("span",{className:"cv-missing-word-input-container",key:a},r.createElement("input",{style:{width:p/16+"rem"},onChange:function(e){return function(e,r){if(r.stopPropagation(),r.target.value)n(function(e,t,n){return(t=function(e){var t=function(e){if("object"!=Lt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Lt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Lt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},e.id,r.target.value));else{var i=t,o=e.id,a=(i[o],function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(i,["symbol"===Lt(o)?o:o+""]));n(a,!0)}}(s,e)},value:d,maxLength:45,disabled:!!t.submitted,className:"cv-missing-word-input",autoComplete:"off"}))}}))),r.createElement(Ot,{error:t.error}))})),x.Z9.MultipleChoice,(function(e){var t=e.state,n=e.setState,i=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,l=1===i.actionableItems.filter((function(e){return e.isCorrect})).length;return r.createElement("div",{className:"cv-interactive-question"},r.createElement("p",{className:"h4"},i.name),!l&&r.createElement("div",{className:"rounded bg-light-blue p-2 mb-2 text-small"},r.createElement(k.x,{svgName:O.vn.Resources,className:"d-inline-block svg-container sm align-text-bottom me-1"}),r.createElement("small",null,r.createElement("strong",null,"Multi-select: "),"This question has multiple correct answers")),r.createElement(nt,{interaction:i,showFeedback:o,onSelectAnswer:function(e,r){if(!t.submitted)if(l)n(r?At({},e.id,e.id):{},!0);else if(r)n(At({},e.id,e.id));else{var i=t,o=e.id,a=(i[o],function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(i,["symbol"===_t(o)?o:o+""]));n(a,!0)}},getSelectedAnswer:function(e){return t[e]},imageApi:a.toString(),userInitials:We.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar,leftHandSidePortalNode:e.leftHandSidePortalNode,submitted:!!t.submitted}),r.createElement(Ot,{error:t.error}))})),x.Z9.ShortAnswer,(function(e){var t=e.interaction,n=e.state,i=e.setState;return e.showFeedback?r.createElement("div",{className:"cv-interactive-question"},r.createElement("p",{className:"h4"},t.name),r.createElement("label",{className:"h4 fw-bold"},"My answer"),r.createElement("p",{className:"h4"},n[t.actionableItems[0].id]),t.data.suggestedResponse&&r.createElement(r.Fragment,null,r.createElement("label",{className:"h4 fw-bold"},"Teacher's suggested answer"),r.createElement("p",{className:"h4"},t.data.suggestedResponse))):r.createElement("div",{className:"cv-interactive-question"},r.createElement("p",{className:"h4"},t.name),r.createElement(Ft.Z,{id:"short-answer-answer",className:"form-control mt-2",minRows:3,value:n[t.actionableItems[0].id]||"",onChange:function(e){var r,o,a;i(Object.assign(Object.assign({},n),(r={},o=t.actionableItems[0].id,a=e.target.value,(o=function(e){var t=function(e){if("object"!=Dt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Dt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Dt(t)?t:t+""}(o))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,r)))},disabled:!!n.submitted}),r.createElement(Ot,{error:n.error}))})),x.Z9.TrueOrFalse,(function(e){var t=e.state,n=e.setState,i=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,l=i.actionableItems.find((function(e){return e.isCorrect}));return r.createElement("div",{className:"cv-interactive-question"},r.createElement("p",{className:"h4"},i.name),r.createElement(it,{className:"justify-content-center",interaction:i,showFeedback:o,onSelectAnswer:function(e){var r,i,o;t.submitted||n((r={},i=e.id,o=e.name,(i=function(e){var t=function(e){if("object"!=Rt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Rt(t)?t:t+""}(i))in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,r),!0)},getSelectedAnswer:function(e){return t[e]},imageApi:a.toString(),userInitials:We.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar}),o&&r.createElement("div",{className:"text-center px-5 mt-3"},r.createElement("p",{className:"h4"},"The answer is ",r.createElement("strong",null,l.name)),i.data.feedback&&r.createElement("p",{className:"h4"},i.data.feedback)),r.createElement(Ot,{error:t.error}))})),x.Z9.Illustration,(function(e){var t,n,i=e.interaction,o=e.state,a=e.fullWidthPortalNode,c=e.setState,l=(t=r.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Nt(e,t);var n={}.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)?Nt(e,t):void 0}}(t,n)||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.")}()),s=l[0],u=l[1],f=o[i.actionableItems[0].id];return r.createElement("div",{className:"cv-interactive-question"},r.createElement("p",{className:"h4 mb-3"},i.name),f?r.createElement(r.Fragment,null,r.createElement("img",{className:"img-fluid border rounded mb-2 w-75",src:f,alt:"Illustration"}),!o.submitted&&r.createElement(S.L,{className:"btn btn-outline-dark",onClick:function(){return u(!0)}},"Re-draw my answer")):r.createElement(S.L,{className:"btn btn-outline-dark",onClick:function(){return u(!0)}},"Draw my answer"),r.createElement(Ot,{error:o.error}),s&&r.createElement(Pe.Nq,{node:a},r.createElement(xt,{interaction:i,onSave:function(t){c(Object.assign(Object.assign({},o),Pt({},i.actionableItems[0].id,t))),u(!1),e.recalculateScroll()},onCancel:function(){return u(!1)}})))}));function zt(){return""}var Ht=Ut(Ut(Ut(Ut(Ut(Ut(Ut({},x.Z9.Annotation,zt),x.Z9.Image,zt),x.Z9.MissingWord,(function(e,t){var n=Object.keys(e).filter((function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.trim())})).length;return n?n!==t.actionableItems.length?"Please fill in all of the blanks":null:"Please fill in the blanks"})),x.Z9.MultipleChoice,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),x.Z9.ShortAnswer,(function(e,t){var n;return Object.keys(e).filter((function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.trim())})).length?(null===(n=e[t.actionableItems[0].id])||void 0===n?void 0:n.length)>4e3?"Max answer length is ".concat(4e3," characters"):null:"Please provide an answer to the question"})),x.Z9.TrueOrFalse,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),x.Z9.Illustration,(function(e){return Object.keys(e).filter((function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.trim())})).length?null:"Please submit an illustration"})),Wt=Ut(Ut(Ut(Ut(Ut(Ut(Ut({},x.Z9.Annotation,null),x.Z9.Image,null),x.Z9.MissingWord,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),x.Z9.MultipleChoice,(function(e,t,n){return n(t.id,Object.keys(e).map((function(e){var n=t.actionableItems.find((function(t){var n;return(null===(n=t.id)||void 0===n?void 0:n.toString())===(null==e?void 0:e.toString())}));return{actionableItemId:e,value:null==n?void 0:n.name}})))})),x.Z9.ShortAnswer,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),x.Z9.TrueOrFalse,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t]}})))})),x.Z9.Illustration,(function(e,t,n,r){return i=this,o=void 0,a=void 0,c=jt().mark((function i(){var o,a,c,l;return jt().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!(o=e[t.actionableItems[0].id]||"").startsWith(It)){i.next=7;break}return a=o.replace(It,""),i.next=5,Y.e.post("".concat(r.imageApi,"v2/thumbnails/base64"),'"'.concat(a,'"'),{tokenName:"gateway"});case 5:c=i.sent,o=c.location;case 7:return l=Object.keys(e).map((function(e){return{actionableItemId:e,value:o}})),i.next=10,n(t.id,l);case 10:return i.abrupt("return",Pt({},t.actionableItems[0].id,o));case 11:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}));var i,o,a,c}));function Qt(e){return Wt[e]}var Yt=Ut(Ut(Ut(Ut(Ut(Ut(Ut({},x.Z9.Annotation,Ge.notApplicable),x.Z9.Image,Ge.notApplicable),x.Z9.MissingWord,(function(e,t){return Ge.isMissingWordCorrect(t,(function(t){return e[t]}))})),x.Z9.MultipleChoice,(function(e,t){return Ge.isMultipleChoiceCorrect(t,(function(t){return e[t]}))})),x.Z9.ShortAnswer,Ge.awaitingMarking),x.Z9.TrueOrFalse,(function(e,t){return t.actionableItems.filter((function(e){return e.isCorrect})).every((function(t){return e[t.id]===t.name}))?w.Correct:w.Incorrect})),x.Z9.Illustration,Ge.awaitingMarking);function Kt(e){return Yt[e]}function $t(e){var t=e.studentResults,n=e.interaction,i=e.timepoint,o=e.interactive,a=e.state,c=e.goToTimepoint,l=e.interactionNumber,s=e.imageCdnUrl,u=ze(t),f=He(n.id,u),d=a.interactions[n.id],p=Kt(n.typeId)(d||{},n),m=n.typeId!==x.Z9.Annotation&&n.typeId!==x.Z9.Image,h=m;n.typeId===x.Z9.MissingWord&&f&&(h=!1);var v=n.data.suggestedResponse||n.data.feedback;return r.createElement("li",{className:"mb-3 position-relative"},r.createElement("div",{className:"d-flex flex-wrap mb-2 cursor-pointer",onClick:function(){return c(i.id,n.id)}},o.immediateFeedback&&r.createElement("div",{className:"O6oD6"},!!f&&(p===w.AwaitingMarking?r.createElement("span",{className:"text-secondary fst-italic"},"Waiting to be marked"):p===w.Correct?r.createElement("span",{className:"text-success"},"Correct ",r.createElement(k.x,{className:"svg-container align-middle",svgName:O.vn.Check})):p===w.Incorrect&&r.createElement("span",{className:"text-danger"},"Incorrect ",r.createElement(k.x,{className:"svg-container align-middle",svgName:O.vn.Close})))),r.createElement(I,{interaction:n,iconClassName:"flex-shrink-0",showQuestion:h,showTypeName:!0,questionClassName:"d-block w-100 mt-2",questionNumber:l})),m&&!f&&r.createElement("button",{className:"btn btn-dark",onClick:function(){return c(i.id,n.id)}},"Answer question"),f&&m&&r.createElement(dt,{interaction:n,studentResults:t,markedStatus:Ne.PendingReview,markInteraction:function(){},imageCdnUrl:s,showFeedback:o.immediateFeedback,showAvatar:!0}),o.immediateFeedback&&f&&v&&r.createElement("div",{className:"bg-light rounded p-2"},r.createElement("div",null,r.createElement("strong",null,n.typeId===x.Z9.TrueOrFalse?"Teacher's feedback":"Teacher's suggested response")),v))}function Xt(e){var t=e.interactive,n=e.duration;return n?r.createElement(r.Fragment,null,t.timepoints.map((function(t,i){if(!t.interactions.length)return r.createElement(r.Fragment,null);var o=N.w.getTypeInfo(t.interactions[0].typeId).bgClassName,a=t.visibleAt/1e3/n*100;return r.createElement("span",{key:i,className:"".concat("pUo8u"," ").concat(o),style:{left:"".concat(a,"%")},onClick:function(n){return r=t.id,i=t.interactions[0].id,n.stopPropagation(),void e.goToTimepoint(r,i);var r,i}})}))):r.createElement(r.Fragment,null)}function Jt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function en(e){var t,n,i=e.duration,o=e.progress,a=e.player,c=(t=r.useState(o.length),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Jt(e,t);var n={}.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)?Jt(e,t):void 0}}(t,n)||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.")}())[1],l=[];if(o.length){var s=o[0];l.push(s),o.forEach((function(e,t){0!==t&&(s.end.time+1>e.start.time&&s.start.time<e.start.time?s.end=e.end:(s=e,l.push(s)))}))}return r.useEffect((function(){var e=function(){c(o.length)};return a.on("progressflush",e),function(){return a.off("progressflush",e)}}),[]),r.createElement(r.Fragment,null,l.map((function(e,t){var n=e.start.time/i*100,o=100*(1-e.end.time/i);return r.createElement("span",{key:t,className:"BnKli",style:{left:"".concat(n,"%"),right:"".concat(o,"%")}})})))}function tn(e){return!!(null==e?void 0:e.toString().startsWith("new_"))}function nn(e){return e.error,e.hasChanges,e.submitted,e.spinner,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}(e,["error","hasChanges","submitted","spinner"])}function rn(e){return function(e){if(Array.isArray(e))return an(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||on(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 on(e,t){if(e){if("string"==typeof e)return an(e,t);var n={}.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)?an(e,t):void 0}}function an(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function cn(e){var t,n,i=e.showSummary,o=e.setShowSummary,a=e.state,c=e.interactive,l=e.player,s=e.progress,u=e.portalNode,f=r.useRef(null),d=(t=r.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||on(t,n)||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.")}()),p=d[0],m=d[1];function h(){o(!1),l.show(),l.play()}function v(t,n){h(),e.goToTimepoint(t,n)}if(!u||!i)return r.createElement(r.Fragment,null);var y=function(e){var t=e.state,n=0,r=0,i=0,o=!1,a=[];return e.interactive.timepoints.forEach((function(e){e.interactions.forEach((function(e){var c=t.interactions[e.id],l=Kt(e.typeId)(c||{},e);l===w.Correct&&n++,l!==w.NotApplicable&&r++,l!==w.NotApplicable&&(null==c?void 0:c.submitted)&&i++,l===w.AwaitingMarking&&(o=!0);var s=nn(c||{}),u=Object.keys(s).map((function(e){var t;return{id:e,text:null===(t=s[e])||void 0===t?void 0:t.toString()}}));u.length&&a.push({id:e.id,answeredAt:1,answers:u})}))})),{correctCount:n,total:r,answered:i,studentAttempts:a,awaitingMarking:o}}({interactive:c,state:a}),g=y.correctCount,b=y.total,E=y.answered,k=y.studentAttempts,x=y.awaitingMarking,C={user:{name:e.currentUser.givenName,surname:e.currentUser.familyName,avatar:{url:e.currentUser.avatar}},results:[{id:c.id,attempts:k}]},N=0,j=l.ended(),P=l.duration();return r.createElement(Pe.Nq,{node:u},r.createElement("div",{className:"row pb-3"},r.createElement("div",{className:"col-4 col-xs-12"},r.createElement(Le.Z,{data:l.poster(),imageType:Te.__.Thumbnails,imageOptions:{size:Te.h2.Medium}})),r.createElement("div",{className:"col-8 col-xs-12"},r.createElement("span",{className:"float-end"},r.createElement(Ie.h,{svgName:O.vn.Play,className:"btn btn-outline-dark",onClick:function(){h(),l.ended()&&l.currentTime(0)}},j?"Play again":"Continue watching"),l.gradePassbackPlugin().enabled&&(p?r.createElement(S.L,{className:"btn btn-dark ms-2",onClick:function(){}},r.createElement(je.Z,{as:"span",animation:"border",role:"status",size:"sm"})):r.createElement(Ie.h,{svgName:O.vn.Check,className:"btn btn-dark ms-2",onClick:function(){m(!0),l.gradePassbackPlugin().submit(g/b,!x)}},"Submit"))),r.createElement("h1",{className:"h3"},e.title),r.createElement("p",null))),r.createElement("div",{className:"border rounder px-2 mb-3"},r.createElement("div",{className:"cursor-pointer my-4 ".concat("gxTA_"),onClick:function(e){if(f.current){var t=f.current.getBoundingClientRect(),n=(e.pageX-t.left)/t.width*P;h(),l.currentTime(n)}},ref:f},r.createElement(en,{duration:P,progress:s,interactive:c,player:l}),r.createElement(Xt,{duration:P,interactive:c,goToTimepoint:v}))),r.createElement("h2",{className:"h4"},"My Answers"),r.createElement("div",{className:"d-flex justify-content-between"},r.createElement("span",null,c.immediateFeedback&&r.createElement("div",null,"Score: ",g,"/",b),r.createElement("div",{className:"mb-3"},"You have answered ",r.createElement("strong",{className:E!==b?"text-danger":""},E)," of ",r.createElement("strong",null,b)," questions"))),r.createElement("div",{className:"row"},r.createElement("div",{className:"col-lg-7 col-12"},r.createElement("ul",{className:"list-unstyled"},c.timepoints.reduce((function(t,n){return[].concat(rn(t),rn(n.interactions.map((function(t){return N++,r.createElement($t,{key:t.id,studentResults:C,interaction:t,timepoint:n,interactive:c,state:a,goToTimepoint:v,interactionNumber:N,imageCdnUrl:e.imageCdnUrl})}))))}),[])))))}function ln(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sn(e,t);var n={}.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)?sn(e,t):void 0}}(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 sn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function un(e){var t=e.player,n=e.resultsService,i=e.interactive,o=e.setShowSummary,a=e.mobile,c=ln(r.useState(!1),2),l=c[0],s=c[1],u=ln(r.useState(!1),2),f=u[0],d=u[1],p=e.player.activePlugins_.activityStatusPlugin,m=e.player.activePlugins_.favouritePlugin;function h(){var e=t.currentTime(),n=i.timepoints[i.timepoints.length-1];f||e>n.visibleAt/1e3+1?s(!0):s(!1)}function v(){d(!0)}if(r.useEffect((function(){return t.on("ended",v),function(){return t.off("ended",v)}}),[]),r.useEffect((function(){if(n&&!a)return t.on("timeupdate",h),function(){return t.off("timeupdate",h)}}),[f]),!l)return null;var y="btn btn-outline-dark cv-show-summary";return m&&(y+=" cv-has-favourite-plugin"),p&&(y+=" cv-has-activity-status-plugin"),r.createElement(S.L,{className:y,onClick:function(){o(!0),t.pause(),t.hide()}},t.gradePassbackPlugin().enabled?"Submit answers":"View summary")}function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function dn(e){var t,n,i=e.resultsService,o=e.player,a=e.onShowSummary,c=e.mobile,l=(t=r.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return fn(e,t);var n={}.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)?fn(e,t):void 0}}(t,n)||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.")}()),s=l[0],u=l[1];function f(e){u(e),a&&a(e)}function d(){f(!0),o.hide()}return r.useEffect((function(){if(i&&!c)return o.on("ended",d),function(){return o.off("ended",d)}}),[]),r.useEffect((function(){s&&o.isFullscreen()&&o.exitFullscreen()}),[s]),r.createElement(r.Fragment,null,r.createElement(un,Object.assign({setShowSummary:f},e)),r.createElement(cn,Object.assign({showSummary:s,setShowSummary:f},e)))}var pn=n(25692),mn=n(98985);function hn(){var e=mn.o.getLiteArticle(pn.b.MakeInteractive);return r.createElement("div",{className:"my-5 text-center"},r.createElement("h2",{className:"h3"},"Select an interaction to get started"),r.createElement("p",{className:"mb-0"},"Choose a point in the video and add a question to interact and engage your students."),!!e&&r.createElement("a",{href:e,target:"_blank",className:"btn btn-link text-info"},"How do I make interactives?"))}function vn(e){var t=e.isCreate,n=e.interactive,i=e.interaction,o=e.portalNode,a=e.goToTimepoint,c=e.promptDelete;if(!o)return r.createElement(r.Fragment,null);var l=n.timepoints.reduce((function(e,t){return e+t.interactions.length}),0);return r.createElement(Pe.Nq,{node:o},l?r.createElement(r.Fragment,null,r.createElement("h2",{className:"h4 mt-3"},"Question List (",l,")"),r.createElement(D,{interactive:n,maxHeight:300,goToTimepoint:a,selectedInteractionId:null==i?void 0:i.id,onClickDelete:t?c:void 0,experimentalInteractiveQuestions:e.experimentalInteractiveQuestions})):t?r.createElement(hn,null):r.createElement(r.Fragment,null))}var yn=n(90547),gn=n(5256),bn=n(30708);function wn(e,t){if(e){if("string"==typeof e)return En(e,t);var n={}.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)?En(e,t):void 0}}function En(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Sn=[x.Z9.MissingWord,x.Z9.MultipleChoice,x.Z9.TrueOrFalse,x.Z9.ShortAnswer,x.Z9.Image,x.Z9.Annotation];function kn(e){var t,n,i=e.addInteraction,o=e.cancelTypeSelector,a=e.player,c=e.timepoint,l=e.open,s=e.isCreate,u=e.interaction,f=e.experimentalInteractiveQuestions,d=(t=r.useState((0,bn.m)(a.currentTime()||0)),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||wn(t,n)||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.")}()),p=d[0],m=d[1],h=[].concat(Sn);return f&&h.push.apply(h,function(e){return function(e){if(Array.isArray(e))return En(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||wn(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.")}()}(Object.keys(x.IL))),r.useEffect((function(){var e=function(){m((0,bn.m)(a.currentTime()))};return a.on("timeupdate",e),function(){return a.off("timeupdate",e)}}),[]),!u&&s&&l?r.createElement("div",{className:"d-flex align-items-center justify-content-center h-100\n ".concat(f?"cv-experimental-types":"","\n ")},r.createElement("div",{className:"cv-interactive-type-selector justify-content-center align-items-center"},r.createElement("h2",{className:"text-center fw-bold w-100 text-body mb-3 cv-add-question-copy"},c?"Add another question at:":"Add a question at:"," ",p),r.createElement("ul",{className:"list-unstyled row g-2\n ".concat(f?"row-cols-2":"row-cols-3")},h.map((function(e,t){var n=N.w.getTypeInfo(e),o=n.name,a=n.bgClassName,c=n.Svg;return r.createElement("li",{className:"col",key:t},r.createElement(S.L,{className:"cv-type-selector rounded\n ".concat(f?" p-2 w-100 d-flex border justify-content-start align-items-center":"py-2 w-100 ".concat(a),"\n "),onClick:function(){return i(e)}},r.createElement("span",{className:"cv-create-type-icon\n ".concat(f?"text-shadow rounded ".concat(a," me-2"):"mb-1","\n ")},r.createElement(c,null)),r.createElement("div",{className:"d-flex align-items-center justify-content-center cv-interaction-type-name\n ".concat(f?"text-dark":"px-1 text-shadow","\n ")},o)))}))),(c||l)&&r.createElement("div",{className:"text-center w-100 mt-2 ".concat(c?"":"cv-adding-first-cancel")},r.createElement(S.L,{className:"btn btn-link",onClick:o},"Cancel")))):r.createElement(r.Fragment,null)}var xn=n(1471);function On(e){var t=e.timepoint,n=e.interaction,i=e.promptDelete,o=e.optionsPortalNode,a=e.setView;if(!n)return r.createElement(r.Fragment,null);var c=[];if(c.push({label:"Move time point",onClick:function(){return a("move")}}),t.interactions.length>1){var l=tn(n.id);c.push({label:"Re-order questions",onClick:function(){return a("reorder")},className:l?"disabled":""})}return c.push({label:"Delete",onClick:function(){return i(n.id)},className:"text-danger"}),r.createElement(Pe.Nq,{node:o},!!n&&r.createElement(xn.m,{actions:c,className:"p-0 mt-n2",dropdownToggleClassName:"p-0"}))}function Cn(e){var t=e.interaction,n=e.interactionState,i=e.onClickContinue,o=e.onClickSave,a=e.onClickCancel,c=e.onClickAddAnother,l=e.onClickDiscard,s=tn(t.id),u=!!(null==n?void 0:n.hasChanges),f=!!(null==n?void 0:n.spinner);return r.createElement("div",{className:"cv-timpoint-button-container"},s?r.createElement(S.L,{className:"btn btn-link",onClick:a},"Cancel"):u?r.createElement(S.L,{className:"btn btn-link",onClick:l},"Discard"):r.createElement(S.L,{className:"btn btn-link",onClick:c},"Add another question"),f?r.createElement(S.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(je.Z,{as:"span",animation:"border",role:"status",size:"sm"})):s?u?r.createElement(S.L,{className:"btn btn-dark ms-2",onClick:o},"Save"):r.createElement(S.L,{className:"btn btn-dark ms-2 disabled",onClick:function(){}},"Save"):u?r.createElement(S.L,{className:"btn btn-dark ms-2",onClick:o},"Save"):r.createElement(Oe,{className:"btn btn-dark ms-2",onClick:i,svgName:O.vn.Play},"Continue"))}function Nn(e){var t=e.typeId,n=e.interactionState,i=e.onClickSkip,o=e.numberOfInteractions,a=e.currentIndex,c=e.changeIndex,l=!!(null==n?void 0:n.submitted),s=!!(null==n?void 0:n.hasChanges),u=!!(null==n?void 0:n.spinner),f=!!Qt(t),d=a<o-1;var p=a>0;return r.createElement("div",{className:"cv-timpoint-button-container flex-wrap"},!l&&f&&r.createElement(S.L,{className:"btn btn-link",onClick:i},"Come back later"),o>1&&a>0&&r.createElement(Oe,{className:"btn btn-dark ms-2 ".concat(p?"":"disabled"),onClick:function(){p&&c(a-1)},svgName:O.vn.ChevronUp}),u?r.createElement(S.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(je.Z,{as:"span",animation:"border",role:"status",size:"sm"})):l||!f?1===o||a===o-1?r.createElement(Oe,{className:"btn btn-dark ms-2",onClick:i,svgName:O.vn.Play},"Continue"):r.createElement(S.L,{className:"btn btn-dark ms-2 ".concat(d?"":"disabled"),onClick:function(){d&&c(a+1)}},"Next"):r.createElement(S.L,{className:"btn btn-dark ms-2 ".concat(s?"":"disabled"),onClick:function(){s&&e.onClickSubmit()}},"Save"))}function jn(e){var t=e.isCreate,n=e.interaction,i=e.interactionState,o=e.continueInteractive,a=e.saveInteraction,c=e.cancel,l=e.addAnotherQuestion,s=e.discardChanges,u=e.submitInteractionAnswer,f=e.onClickSkip,d=e.changeIndex,p=e.timepoint,m=e.currentIndex;return r.createElement(r.Fragment,null,t?r.createElement(Cn,{interaction:n,interactionState:i,onClickContinue:o,onClickSave:a,onClickCancel:c,onClickAddAnother:l,onClickDiscard:function(){return s()}}):r.createElement(Nn,{typeId:n.typeId,interactionState:i,onClickSubmit:u,onClickSkip:f,changeIndex:d,currentIndex:m,numberOfInteractions:p.interactions.length}))}function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function In(e){var t,n,i=e.typeId,o=e.currentIndex,a=e.numberOfInteractions,c=e.changeIndex,l=e.player,s=(t=r.useState((0,bn.m)(l.currentTime()||0)),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Pn(e,t);var n={}.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)?Pn(e,t):void 0}}(t,n)||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.")}()),u=s[0],f=s[1];r.useEffect((function(){var e=function(){f((0,bn.m)(l.currentTime()))};return l.on("timeupdate",e),function(){return l.off("timeupdate",e)}}),[]);var d=N.w.getTypeInfo(i),p=d.name,m=d.bgClassName,h=o<a-1,v=o>0;return r.createElement("div",{className:"text-center d-flex justify-content-between align-items-center p-1 ".concat(m)},r.createElement(S.L,{onClick:function(){v&&c(o-1)},className:v?"":"invisible"},r.createElement(k.x,{size:k.S.Medium,svgName:O.vn.ChevronLeft})),r.createElement("div",null,r.createElement("h2",{className:"h6 mb-0"},p),a>1&&r.createElement("div",null,o+1," of ",a," at ",u)),r.createElement(S.L,{onClick:function(){h&&c(o+1)},className:h?"":"invisible"},r.createElement(k.x,{size:k.S.Medium,svgName:O.vn.ChevronRight})))}var Ln=n(29014),Tn=n(2248),_n=n(3026),An=n(52076);function Fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Dn=null,Rn=!1;function Mn(e){var t,n,i=(t=r.useState(Dn),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Fn(e,t);var n={}.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)?Fn(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1];return Dn||Rn||(Rn=!0,(0,_n.ajaxRequest)({resource:"/api/integrations/token/immersive-reader",type:Tn.k.GET,success:function(e){Dn=e,a(e),window.setTimeout((function(){Dn=null,Rn=!1}),9e5)},error:function(){}})),o?(e.title||(e.title=Qe.T.getPhrase("shared.immersiveReader","titleFallback")),r.createElement("span",{className:"".concat("nckQw"," ").concat(e.className||""),onClick:function(){l.q.isFunction(e.onLaunch)&&e.onLaunch(),An.k.logUserAction(e.analyticsData,e.analyticsOptions);var t={title:e.title,chunks:[{content:e.text,mimeType:e.html?"text/html":"text/plain"}]},n=o.subdomain,r=o.token,i={uiZIndex:5e3,onExit:function(){l.q.isFunction(e.onExit)&&e.onExit()}};Ln.launchAsync(r,n,t,i)}},r.createElement("svg",{viewBox:"0 0 40 37"},r.createElement("path",{d:"M37.4,0.9 L37.4,9.6 L35.4,9.6 L35.4,2.9 L24.4,2.9 C22.9,3.3 20,4.5 20,6 L20,17.2 L18,17.2 L18,6 C18,5 15.6,3.6 13.8,2.9 L2,2.9 L2,29 L12.4,29 L12.4,31 L0,31 L0,0.9 L14.1,0.9 L14.3,1 C15,1.2 17.5,2.2 18.9,3.7 C20.5,1.9 23.5,1.1 23.9,1 L24.1,1 L37.4,1 L37.4,0.9 Z",fill:"#000000"}),r.createElement("path",{d:"M27.4,37 L25.8,37 L18.4,29.4 L14,29.4 L14,21 L18.4,20.9 L26.1,13 L27.4,13 L27.4,37 Z M16,27.4 L19.2,27.4 L25.3,33.7 L25.3,16.6 L19.2,22.9 L15.9,22.9 L15.9,27.4 L16,27.4 Z",fill:"#0197F2"}),r.createElement("path",{d:"M31.3,32.7 L29.6,31.7 C29.6,31.7 31.7,28.3 31.7,25.2 C31.7,21.9 29.6,18.5 29.6,18.4 L31.3,17.4 C31.4,17.6 33.7,21.3 33.7,25.2 C33.7,28.8 31.4,32.6 31.3,32.7 Z",fill:"#0197F2"}),r.createElement("path",{d:"M36.4,36.2 L34.8,35 C34.8,35 38,30.8 38,25.2 C38,19.6 34.8,15.4 34.8,15.4 L36.4,14.2 C36.5,14.4 40,19 40,25.3 C40,31.5 36.5,36 36.4,36.2 Z",fill:"#0197F2"})))):r.createElement(r.Fragment,null)}var Un=["A","B","C","D"];function Vn(e){if(!e.enableImmersiveReader)return r.createElement(r.Fragment,null);var t=e.interaction,n=e.className,i=N.w.getTypeInfo(t.typeId),o=i.name,a=i.typeName,c="";switch(t.typeId){case x.Z9.Annotation:c=t.data.annotation;break;case x.Z9.Image:c=t.data.caption;break;case x.Z9.MissingWord:c=t.data.sentence.replace(/{([^{}]*)}/g,(function(){return"<u>&nbsp;&nbsp;&nbsp;&nbsp;</u>"}));break;case x.Z9.MultipleChoice:c=t.name,t.actionableItems.map((function(e,t){return c+="<br />".concat(Un[t],": ").concat(e.name)}));break;case x.Z9.ShortAnswer:c=t.name;break;case x.Z9.TrueOrFalse:c="True or false: ".concat(t.name)}var l=t.typeId===x.Z9.Annotation||t.typeId===x.Z9.MissingWord||t.typeId===x.Z9.MultipleChoice;return r.createElement(Mn,{title:o,text:c,html:l,className:"".concat("Erirh"," ").concat(n||""),analyticsData:{id:t.interactiveId,type:a},analyticsOptions:{location:f.LZ.InteractivePlayer,entity:f.py.Interactive,actionType:f.Vw.Click,descriptor:f._S.LaunchImmersiveReader}})}function Bn(e){var t=N.w.getTypeInfo(e.interaction.typeId),n=t.name,i=t.prompt,o=t.bgClassName,a=t.Svg;return r.createElement("div",{className:"text-center text-body d-flex justify-content-between align-items-center px-3 pt-3"},r.createElement("div",{className:"d-flex align-items-center"},r.createElement("span",{className:"cv-interaction-icon rounded my-1 text-white ".concat(o)},r.createElement(a,null)),r.createElement("span",{className:"text-start flex-grow-1"},r.createElement("div",{className:"h5 ".concat(i?"":"mb-0")},r.createElement("strong",null,n)),i&&r.createElement("div",{className:"h6 mb-0"},i))),r.createElement(Vn,{interaction:e.interaction,className:"ms-2",enableImmersiveReader:e.enableImmersiveReader}))}function qn(e){var t=e.isCreate,n=e.interaction,i=e.player,o=e.changeIndex,a=e.timepointState,c=e.timepoint;return t?r.createElement(In,{typeId:n.typeId,changeIndex:o,player:i,currentIndex:a.interactionIndex,numberOfInteractions:c.interactions.length}):r.createElement(Bn,{interaction:n,enableImmersiveReader:e.enableImmersiveReader})}var Gn=n(10671),Zn=n(98886),zn=n(6880);function Hn(e){var t=e.error;return e.error?r.createElement("p",{id:e.id,className:"mt-2 small text-danger",role:"status"},t):r.createElement(r.Fragment,null)}function Wn(e){return Wn="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},Wn(e)}function Qn(){Qn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Wn(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Wn(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Yn(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,Kn(r.key),r)}}function Kn(e){var t=function(e){if("object"!=Wn(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Wn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wn(t)?t:t+""}var $n=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Xn=function(e){return"/api/domain/v1/interactions/".concat(e)},Jn=function(e){return"/api/domain/v1/timepoints/".concat(e)},er={},tr=new(function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"saveInteraction",value:function(e){return $n(this,void 0,void 0,Qn().mark((function t(){var n,r,i,o,a;return Qn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=tn(e.id),r=n?"/api/domain/v1/interactions/bulk":(c=e.id,"/api/domain/v1/interactions/bulk/".concat(c)),i={name:e.name,data:e.data,timepointId:e.timepointId,interactiveId:e.interactiveId,typeId:e.typeId,actionableItems:e.actionableItems,order:e.order},n||(i.id=e.id),o=n?Y.e.post(r,JSON.stringify(i),er):Y.e.put(r,JSON.stringify(i),er),t.next=7,o;case 7:a=t.sent,n&&(e.id=a.id);case 9:case"end":return t.stop()}var c}),t)})))}},{key:"deleteInteraction",value:function(e){return $n(this,void 0,void 0,Qn().mark((function t(){return Qn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y.e.delete(Xn(e),er);case 2:case"end":return t.stop()}}),t)})))}},{key:"saveTimepoint",value:function(e){return $n(this,void 0,void 0,Qn().mark((function t(){var n,r;return Qn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={interactiveId:e.interactiveId,shouldPause:1,visibleAt:e.visibleAt},t.next=3,Y.e.post("/api/domain/v1/timepoints",JSON.stringify(n),er);case 3:r=t.sent,e.id=r.id;case 5:case"end":return t.stop()}}),t)})))}},{key:"updateTimepoint",value:function(e){return $n(this,void 0,void 0,Qn().mark((function t(){return Qn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y.e.put((n=e.id,"/api/domain/v1/timepoints/".concat(n)),JSON.stringify(e),er);case 2:case"end":return t.stop()}var n}),t)})))}},{key:"deleteTimepoint",value:function(e){return $n(this,void 0,void 0,Qn().mark((function t(){return Qn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y.e.delete(Jn(e),er);case 2:case"end":return t.stop()}}),t)})))}}])&&Yn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()),nr={styleToHTML:function(e){return"SUPERSCRIPT"===e?{start:"<sup>",end:"</sup>"}:"SUBSCRIPT"===e?{start:"<sub>",end:"</sub>"}:void 0},entityToHTML:function(e,t){return"LINK"===e.type?r.createElement("a",{href:e.data.url},t):t},htmlToStyle:function(e,t,n){return"sup"===e?n.add("SUPERSCRIPT"):"sub"===e?n.add("SUBSCRIPT"):n},htmlToEntity:function(e,t,n){if("a"===e)return n("LINK","MUTABLE",{url:t.href})}};function rr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ir(e,t);var n={}.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)?ir(e,t):void 0}}(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 ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function or(e){var t=rr(r.useState(""),2),n=t[0],i=t[1],o=rr(r.useState(""),2),a=o[0],c=o[1];return r.createElement("div",{"aria-haspopup":"true","aria-expanded":e.expanded,"aria-label":"rdw-color-picker"},r.createElement("div",{className:"rdw-option-wrapper cv-annotation-toolbar-option cv-annotation-link",onClick:e.onExpandEvent}," "),e.expanded&&r.createElement("div",{className:"rdw-link-modal",onClick:function(e){return e.stopPropagation()}},r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"cv-annotation-url"},"URL"),r.createElement("input",{id:"cv-annotation-url",className:"form-control",onChange:function(e){return i(e.target.value)},value:n,placeholder:"Enter URL",autoComplete:"off"})),r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"cv-annotation-text"},"Text"),r.createElement("input",{id:"cv-annotation-text",className:"form-control",onChange:function(e){return c(e.target.value)},value:a,placeholder:"Enter Text",autoComplete:"off"})),r.createElement(S.L,{onClick:function(){return e.onChange("link",a||n,n,"_blank")},className:"btn btn-dark"},"Add")))}function ar(e){return ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ar(e)}function cr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return lr(e,t);var n={}.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)?lr(e,t):void 0}}(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 lr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sr(){sr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ar(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ar(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ur(e){return ur="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},ur(e)}function fr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dr(e,t);var n={}.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)?dr(e,t):void 0}}(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 dr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pr(){pr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ur(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ur(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var mr=n(43823);function hr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var vr=!0;function yr(){var e=function(){var e,t,n=(e=r.useState(vr),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hr(e,t);var n={}.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)?hr(e,t):void 0}}(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.")}()),i=n[0],o=n[1],a=mr.Radio.channel("video:drag:drop:lock");function c(){o(vr)}return r.useEffect((function(){if(vr)return a.on("update",c),function(){a.off("update",c)}}),[]),{enabled:i,disable:function(){vr=!1,a.trigger("update")},enable:function(){vr=!0,a.trigger("update")}}}(),t=e.enable,n=e.disable;r.useEffect((function(){return n(),function(){return t()}}),[])}var gr=n(51547),br=n(99828),wr={onFileSelect:function(e,t,n,r){if(t&&t.length)if(t.length>1)alert("Please only select one file");else{var i=t[0];if(i.type.startsWith("image/")){var o=new FileReader;o.addEventListener("load",(function(){return wr.onReaderLoad(o,e,n,r)})),o.readAsDataURL(i)}else alert("Please select an image file")}},onReaderLoad:function(e,t,n,r){var i,o,a=new Image;a.src=e.result;var c=null!==(i=null==r?void 0:r.width)&&void 0!==i?i:br.y[t].width,s=null!==(o=null==r?void 0:r.height)&&void 0!==o?o:br.y[t].height;a.addEventListener("load",(function(){wr.isImageValid(t,a,r)&&l.q.isFunction(n)?n(a):alert("Image too small: minimum dimensions are ".concat(c," x ").concat(s))}))},isImageValid:function(e,t,n){var r,i,o=null!==(r=null==n?void 0:n.width)&&void 0!==r?r:br.y[e].width,a=null!==(i=null==n?void 0:n.height)&&void 0!==i?i:br.y[e].height;return!(o&&t.width<o||a&&t.height<a)},mapImageTypeToString:function(e){switch(e){case Te.__.Avatars:return"avatars";case Te.__.Thumbnails:return"thumbnails";case Te.__.Logos:return"logos";case Te.__.Covers:return"covers";case Te.__.Posters:return"posters";case Te.__.TallPosters:return"tallposters";case Te.__.HeroBanners:return"herobanners";case Te.__.None:default:return""}}};function Er(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Sr(e,t);var n={}.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)?Sr(e,t):void 0}}(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 Sr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function kr(e){var t=Er(r.useState(!1),2),n=t[0],i=t[1],o=Er(r.useState(0),2),a=o[0],c=o[1];return r.useEffect((function(){0===a&&n&&i(!1)}),[a,n,i]),r.createElement("div",{onDragOver:function(e){e.preventDefault(),e.stopPropagation()},onDragEnter:function(e){e.preventDefault(),e.stopPropagation(),c((function(e){return e+1})),e.dataTransfer.items&&e.dataTransfer.items.length>0&&!n&&i(!0)},onDragLeave:function(e){e.preventDefault(),e.stopPropagation(),c((function(e){return e-1}))},onDrop:function(t){t.preventDefault(),t.stopPropagation(),i(!1),a>0&&c(0),t.dataTransfer.files&&t.dataTransfer.files.length>0&&(e.onDropImage(t.dataTransfer.files),t.dataTransfer.clearData())},className:n?e.dragClassName:""},e.children)}function xr(e){return xr="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},xr(e)}function Or(){Or=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==xr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(xr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Cr(e){return Cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cr(e)}function Nr(){Nr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Cr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Cr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var jr=/[.\?!,;:\-''\(\)]/g;function Pr(e){for(var t=e.split("");t.length&&t[0].match(jr);)t.shift();for(;t.length&&t[t.length-1].match(jr);)t.pop();return t.join("")}function Ir(e,t){for(var n=e.split(""),r=[],i=[];n.length&&n[0].match(jr);)r.push(n.shift());for(;n.length&&n[n.length-1].match(jr);)i.unshift(n.pop());return r.join("")+t+i.join("")}function Lr(e){return e.map((function(e){if(!e.selected)return e.text;var t=Pr(e.text).length,n=new Array(t).fill("_").join("");return Ir(e.text,n)})).join(" ")}function Tr(e){return e.map((function(e){var t;return e.selected?null===(t=Ir(e.text,"{".concat(e.order,"}")))||void 0===t?void 0:t.trim():e.text})).join(" ")}var _r=n(21326);function Ar(e){return r.createElement(_r.u,{title:e.tooltipText,spanHack:!0,spanHackClassName:"d-inline-block"},r.createElement(k.x,{svgName:O.vn.Info}))}function Fr(){return r.createElement("svg",{viewBox:"0 0 43 38",className:"cv-upload-image-icon"},r.createElement("g",{transform:"translate(-1193.000000, -185.000000)"},r.createElement("g",{transform:"translate(1183.000000, 173.000000)"},r.createElement("path",{d:"M49.875,12.9166667 C51.3247475,12.9166667 52.5,14.0732644 52.5,15.5 L52.5,46.5 C52.5,47.9267356 51.3247475,49.0833333 49.875,49.0833333 L13.125,49.0833333 C11.6752525,49.0833333 10.5,47.9267356 10.5,46.5 L10.5,15.5 C10.5,14.0732644 11.6752525,12.9166667 13.125,12.9166667 L49.875,12.9166667 Z M49.875,15.5 L13.125,15.5 L13.125,46.5 L49.875,46.5 L49.875,15.5 Z M35.5085905,22.5470241 L45.7260956,38.0470241 C46.1206004,38.6454897 45.9474325,39.445375 45.3393142,39.8336178 C44.731196,40.2218607 43.9184093,40.0514415 43.5239044,39.4529759 L34.3641741,25.5576247 L29.9489593,31.7425222 C29.4803332,32.3989804 28.5233602,32.4806343 27.9469223,31.9133463 L26.3920049,30.38311 L19.425,39.525 C18.9900758,40.0956942 18.167399,40.211354 17.5875,39.7833333 C17.007601,39.3553127 16.8900758,38.5456942 17.325,37.975 L25.2,27.6416667 C25.6792326,27.0128323 26.6132966,26.9475041 27.1780777,27.5033204 L28.6987913,28.9998957 L33.3335357,22.5074778 C33.8680838,21.758675 35.0025121,21.7793009 35.5085905,22.5470241 Z M21,19.375 C23.1746212,19.375 24.9375,21.1098966 24.9375,23.25 C24.9375,25.3901034 23.1746212,27.125 21,27.125 C18.8253788,27.125 17.0625,25.3901034 17.0625,23.25 C17.0625,21.1098966 18.8253788,19.375 21,19.375 Z M21,21.9583333 C20.2751263,21.9583333 19.6875,22.5366322 19.6875,23.25 C19.6875,23.9633678 20.2751263,24.5416667 21,24.5416667 C21.7248737,24.5416667 22.3125,23.9633678 22.3125,23.25 C22.3125,22.5366322 21.7248737,21.9583333 21,21.9583333 Z",id:"Combined-Shape"}))))}function Dr(e){var t,n,i=r.useRef(null),o=r.useRef(null);function a(){e.onChange(Object.assign(Object.assign({},e.answer),{isCorrect:!e.answer.isCorrect}))}function c(t){e.isTrueOrFalse||t&&t[0]&&wr.onFileSelect(Te.__.None,t,(function(e){gr.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:l})}))}function l(t,n){var r=t.split(",")[1];Y.e.post("".concat(e.imageApi,"v2/thumbnails/base64"),'"'.concat(r,'"'),{tokenName:"gateway"}).then((function(t){e.onChange(Object.assign(Object.assign({},e.answer),{data:{imageUrl:t.location}})),n()})).catch((function(){return alert("Something went wrong while trying to upload image. Please try again.")}))}return r.createElement(kr,{onDropImage:c,dragClassName:"cv-multiple-choice-upload-mask"},r.createElement("div",{className:"p-2 my-1 w-100 bg-white d-flex align-items-center rounded cv-multiple-choice-answer"},r.createElement("div",{className:"form-check",onKeyDown:function(e){return"Enter"===e.key&&a()}},r.createElement("input",{id:"multiple-choice--".concat(e.answer.order),type:e.isTrueOrFalse?"radio":"checkbox",className:"form-check-input me-2",name:"multiple-choice-answer",checked:e.answer.isCorrect,onChange:a,disabled:!e.answer.name&&!(null===(t=e.answer.data)||void 0===t?void 0:t.imageUrl),"aria-label":"Correct answer ".concat(e.answer.order)}),r.createElement("label",{ref:i,htmlFor:"multiple-choice--".concat(e.answer.order),className:"cursor-pointer form-check-label"})),e.isTrueOrFalse?r.createElement("label",{className:"mb-0",htmlFor:"multiple-choice--".concat(e.answer.order)},e.answer.name):r.createElement("input",{placeholder:"Answer",onChange:function(t){e.onChange(Object.assign(Object.assign({},e.answer),{name:t.target.value}))},value:e.answer.name,className:"border-0 outline-none w-100 me-2",autoComplete:"off"}),!e.isTrueOrFalse&&r.createElement(r.Fragment,null,r.createElement("input",{type:"file",className:"file-select d-none",multiple:!1,accept:"image/jpg,image/jpeg,image/png",ref:o,onChange:function(e){return c(e.target.files)}}),(null===(n=e.answer.data)||void 0===n?void 0:n.imageUrl)?r.createElement(_r.u,{key:"1",title:"Remove image",spanHack:!0,spanHackClassName:"mt-n2 mb-n2 me-n2"},r.createElement(S.L,{type:"button",className:"cv-multiple-choice-create-image rounded-end bg-gray-400",style:{backgroundImage:"url(".concat(e.answer.data.imageUrl,")")},onClick:function(){e.onChange(Object.assign(Object.assign({},e.answer),{data:void 0}))}},r.createElement("span",{className:"cv-multiple-choice-remove-image"},r.createElement(k.x,{svgName:O.vn.Delete})))):r.createElement(_r.u,{key:"2",title:"Upload an image",spanHack:!0},r.createElement(S.L,{type:"button",className:"svg-container",onClick:function(){o.current.value=null,o.current.click(null)}},r.createElement(Fr,null))))))}function Rr(e){return Rr="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},Rr(e)}function Mr(){Mr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Rr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Rr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ur(e){var t,n;if(!(null===(t=e.question)||void 0===t?void 0:t.trim()))return"Please provide a question";if((null===(n=e.question)||void 0===n?void 0:n.trim().length)>500)return"Max question length is ".concat(500," characters");if(!e.answers.find((function(e){return e.isCorrect})))return"Please select the correct answer";if(e.answers.find((function(e){var t;return(null===(t=e.name)||void 0===t?void 0:t.length)>255})))return"Max answer length is ".concat(255," characters");var r=e.answers.filter((function(e){var t,n;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())||!!(null===(n=e.data)||void 0===n?void 0:n.imageUrl)}));if(r.length<2)return"Please provide at least two answers";var i=e.answers.filter((function(e){var t;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())}));if(i.length&&i.length!==r.length)return"Please add text to every question or none of the questions.";var o=!1,a={};if(i.forEach((function(e){o||(a[e.name]?o=!0:a[e.name]=!0)})),o)return"There are duplicates in your answers";var c=r.filter((function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.imageUrl})).length;return c&&c<r.length?"Please add an image to all answers":null}function Vr(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=Mr().mark((function r(){return Mr().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t.name=null===(n=e.question)||void 0===n?void 0:n.trim(),t.actionableItems=e.answers.filter((function(e){var t,n;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())||!!(null===(n=e.data)||void 0===n?void 0:n.imageUrl)})),e.feedback&&(t.data.feedback=e.feedback),r.next=5,tr.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))}function Br(e){var t=e.state,n=void 0===t?function(e){var t,n=e.typeId===x.Z9.TrueOrFalse,r=null===(t=e.actionableItems)||void 0===t?void 0:t.map((function(e){return{order:e.order,name:e.name,isCorrect:e.isCorrect,data:e.data?{imageUrl:e.data.imageUrl}:null}}));return(null==r?void 0:r.length)?!n&&(null==r?void 0:r.length)<4&&r.push({order:r.length,name:"",isCorrect:!1,data:null}):r=[{order:0,name:n?"True":"",isCorrect:!1,data:null},{order:1,name:n?"False":"",isCorrect:!1,data:null}],{question:e.name||"",answers:r,feedback:e.data.feedback||""}}(e.interaction):t,i=e.setState,o=e.interaction,a=e.optionsPortalNode,c=e.showFeedback,l=o.typeId===x.Z9.TrueOrFalse;function s(e){var t,r,o=n.answers.map((function(t){return t.order!==e.order?Object.assign(Object.assign({},t),{isCorrect:!l&&t.isCorrect}):e}));if(o.find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)}))&&(r=(t=o).find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)})),o=t.length>2?t.filter((function(e){return e.order!==r.order})).map((function(e,t){return Object.assign(Object.assign({},e),{order:t})})):t.map((function(e){return e.order!==r.order?e:Object.assign(Object.assign({},e),{isCorrect:!1})}))),!l&&o.length<4&&!o.find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)}))){var a=Ze.m.last(o);o.push({name:"",order:a.order+1,isCorrect:!1,data:void 0})}i(Object.assign(Object.assign({},n),{answers:o}))}return yr(),r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"multiple-choice-question"},"Question"),r.createElement(Pe.t0,{node:a})),r.createElement("input",{id:"multiple-choice-question",className:"form-control",placeholder:"Enter your question here",value:n.question,onChange:function(e){i(Object.assign(Object.assign({},n),{question:e.target.value}))},autoComplete:"off"}),!n.question&&r.createElement(Hn,{error:n.error})),r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"multiple-choice-answer"},l?r.createElement(r.Fragment,null,"Answer"):r.createElement(r.Fragment,null,"Answers")),r.createElement("ul",{className:"list-unstyled"},n.answers.map((function(t){return r.createElement("li",{key:t.order},r.createElement(Dr,{answer:t,onChange:s,isTrueOrFalse:l,imageApi:e.imageApi}))}))),n.question&&r.createElement(Hn,{error:n.error})),c&&l&&r.createElement("div",{className:"form-group mb-0"},r.createElement("label",{className:"cv-interaction-field-label d-flex justify-content-between align-items-end",htmlFor:"true-or-false-feedback"},r.createElement("span",null,"Feedback  ",r.createElement("small",{className:"text-secondary"},"(optional)")),r.createElement(Ar,{tooltipText:"Provide answer feedback for your students"})),r.createElement(Ft.Z,{id:"true-or-false-feedback",className:"form-control",minRows:2,value:n.feedback||"",onChange:function(e){i(Object.assign(Object.assign({},n),{feedback:e.target.value}))},placeholder:"Give feedback for this question"})))}function qr(e){return qr="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},qr(e)}function Gr(){Gr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==qr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(qr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var Zr,zr="Please provide a question",Hr="Max question length is ".concat(255," characters"),Wr="Max answer length is ".concat(4e3," characters");function Qr(e){return Qr="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},Qr(e)}function Yr(e,t,n){return(t=function(e){var t=function(e){if("object"!=Qr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Qr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e[e.QUESTION=0]="QUESTION",e[e.ANSWER=1]="ANSWER"}(Zr||(Zr={}));var Kr=Yr(Yr(Yr(Yr(Yr(Yr(Yr({},x.Z9.Annotation,(function(e){var t=e.state,n=void 0===t?function(e){var t;return{annotation:(null===(t=e.data)||void 0===t?void 0:t.annotation)||""}}(e.interaction):t,i=e.setState,o=e.interaction,a=e.optionsPortalNode,c=cr(r.useState(function(){var e=o.data.annotation;if(e){var t=(0,Zn.h4)(nr)(e);return zn.EditorState.createWithContent(t)}return zn.EditorState.createEmpty()}()),2),l=c[0],s=c[1],u=cr(r.useState(null),2),f=u[0],d=u[1];return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center"},r.createElement("label",{className:"cv-interaction-field-label",onClick:function(){return null==f?void 0:f.focusEditor()}},"Annotation"),r.createElement(Pe.t0,{node:a})),r.createElement("div",{className:"cv-annotation ".concat(function(){if(!l)return!1;var e=l.getCurrentContent();return e.hasText()||"unstyled"!==e.getBlockMap().first().getType()}()?"Editor--hide-placeholder":"")},l&&r.createElement(Gn.Editor,{editorState:l,onEditorStateChange:function(e){s(e);var t=e.getCurrentContent();if(t.hasText()){var r=(0,Zn.cn)(nr)(t);i(Object.assign(Object.assign({},n),{annotation:r}))}else i(Object.assign(Object.assign({},n),{annotation:""}))},toolbarClassName:"cv-annotation-toolbar",editorClassName:"form-control cv-annotation-editor",ref:d,placeholder:"Enter your annotation here",spellCheck:!0,toolbar:{options:["inline","list","link"],inline:{options:["bold","italic","underline","superscript","subscript"],bold:{className:"cv-annotation-toolbar-option cv-annotation-bold",icon:""},italic:{className:"cv-annotation-toolbar-option cv-annotation-italic",icon:""},underline:{className:"cv-annotation-toolbar-option cv-annotation-underline",icon:""},superscript:{className:"cv-annotation-toolbar-option cv-annotation-superscript",icon:""},subscript:{className:"cv-annotation-toolbar-option cv-annotation-subscript",icon:""}},list:{options:["unordered","ordered"],unordered:{className:"cv-annotation-toolbar-option cv-annotation-bullet-list",icon:""},ordered:{className:"cv-annotation-toolbar-option cv-annotation-number-list",icon:""}},link:{component:or,options:["link"]}}}),r.createElement(Hn,{error:n.error}))))})),x.Z9.Image,(function(e){var t=e.state,n=void 0===t?function(e){var t;return{url:(null===(t=e.data)||void 0===t?void 0:t.url)||"",caption:e.data.caption}}(e.interaction):t,i=e.setState,o=e.interaction,a=e.optionsPortalNode;yr();var c=r.useRef(null);function l(e){e&&e[0]&&wr.onFileSelect(Te.__.None,e,(function(e){gr.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:s})}))}function s(t,r){var o=t.split(",")[1];Y.e.post("".concat(e.imageApi,"v2/thumbnails/base64"),'"'.concat(o,'"'),{tokenName:"gateway"}).then((function(e){i(Object.assign(Object.assign({},n),{url:e.location})),r()})).catch((function(){return alert("Something went wrong while trying to upload image. Please try again.")}))}return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center mb-2"},r.createElement("label",{className:"cv-interaction-field-label"},"Image"),r.createElement(Pe.t0,{node:a})),n.url?r.createElement("div",{className:"text-center"},r.createElement("div",{className:"cv-uploaded-image-container"},r.createElement("img",{className:"img img-fluid rounded",src:n.url,alt:n.caption}),r.createElement(S.L,{className:"cv-remove-uploaded-image d-flex justify-content-center align-items-center",onClick:function(){i(Object.assign(Object.assign({},n),{url:""}))}},r.createElement("div",{className:"btn btn-link text-light"},"Remove")))):r.createElement(kr,{onDropImage:l,dragClassName:"cv-image-upload-mask"},r.createElement("div",{className:"cv-image-interaction-upload-container bg-white rounded py-3 text-center"},r.createElement("div",{className:"cv-upload-scenery-image mx-auto"}),r.createElement("p",{className:"mb-0"},"Drag and drop an image file or"),r.createElement(S.L,{type:"button",className:"text-underline d-inline-block",onClick:function(){c.current.value=null,c.current.click(null)}},"upload from your device"),r.createElement("input",{type:"file",className:"file-select d-none",multiple:!1,accept:"image/jpg,image/jpeg,image/png",ref:c,onChange:function(e){return l(e.target.files)}}))),r.createElement(Hn,{error:n.error})),r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"image-caption"},"Caption  ",r.createElement("small",{className:"text-secondary"},"(optional)")),r.createElement("textarea",{id:"image-caption",className:"form-control",placeholder:"Caption your image",value:n.caption||o.data.caption||"",onChange:function(e){i(Object.assign(Object.assign({},n),{caption:e.target.value}))},rows:2})))})),x.Z9.MissingWord,(function(e){var t,n,i,o,a,c,l=e.state,s=void 0===l?(o=(null===(n=(t=e.interaction).data)||void 0===n?void 0:n.sentence)||"",a=o.split(" ").filter(Boolean),c=a.map((function(e,t){return{text:e,order:t,selected:!1}})),null===(i=t.actionableItems)||void 0===i||i.forEach((function(e){var t=e.order,n=Ir(a[t],e.name);a[t]=n,c[t].text=n,c[t].selected=!0})),{fullSentence:a.join(" "),sentence:o,preview:t.name,words:c}):l,u=e.setState,f=e.optionsPortalNode,d=!!s.sentence;return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"missing-word-sentence"},"Sentence"),r.createElement(Pe.t0,{node:f})),r.createElement("input",{id:"missing-word-sentence",className:"form-control",placeholder:"Enter your sentence here",value:s.fullSentence||"",onChange:function(e){var t=e.target.value,n=t.split(" ").filter(Boolean).map((function(e,t){return{text:e,order:t,selected:!1}}));u(Object.assign(Object.assign({},s),{fullSentence:t,sentence:Tr(n),preview:Lr(n),words:n}))},autoComplete:"off"})),d&&r.createElement(r.Fragment,null,r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label"},"Select the missing word(s)"),r.createElement("ul",{className:"list-unstyled d-flex flex-wrap mx-n1 mb-n1"},s.words.map((function(e,t){var n;return(null===(n=Pr(e.text))||void 0===n?void 0:n.trim())?r.createElement("li",{key:"".concat(t,"-").concat(e.text)},r.createElement(S.L,{className:"rounded border p-2 mx-1 mb-1 cursor-pointer ".concat(e.selected?"bg-dark text-white":"bg-white"),onClick:function(){return e=t,n=s.words.map((function(t){return t.order!==e?t:Object.assign(Object.assign({},t),{selected:!t.selected})})),void u(Object.assign(Object.assign({},s),{words:n,preview:Lr(n),sentence:Tr(n)}));var e,n}},Pr(e.text))):r.createElement(r.Fragment,{key:"".concat(t,"-").concat(e.text)})})))),r.createElement("div",null,r.createElement("label",{className:"cv-interaction-field-label"},"Preview"),r.createElement("p",null,s.preview))),r.createElement(Hn,{error:s.error}))})),x.Z9.MultipleChoice,Br),x.Z9.ShortAnswer,(function(e){var t=e.state,n=void 0===t?function(e){return{question:e.name,suggestedResponse:e.data.suggestedResponse||""}}(e.interaction):t,i=e.setState,o=e.interaction,a=e.optionsPortalNode,c=e.showFeedback;function l(){switch(n.error){case zr:case Hr:return Zr.QUESTION;case Wr:return Zr.ANSWER}}return r.createElement("div",{className:"cv-interactive-question"},r.createElement("div",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"short-answer-question"},"Question"),r.createElement(Pe.t0,{node:a})),r.createElement("input",{id:"short-answer-question",className:"form-control",onChange:function(e){i(Object.assign(Object.assign({},n),{question:e.target.value}))},value:n.question||o.data.text||"",placeholder:"Enter your question here",autoComplete:"off","aria-errormessage":"question-error"}),l()===Zr.QUESTION&&r.createElement(Hn,{id:"question-error",error:n.error})),c&&r.createElement("div",{className:"form-group"},r.createElement("label",{className:"cv-interaction-field-label d-flex justify-content-between align-items-end",htmlFor:"short-answer-suggested-response"},r.createElement("span",null,"Suggested Response  ",r.createElement("small",{className:"text-secondary"},"(optional)")),r.createElement(Ar,{tooltipText:"Provide a suggested response for your students"})),r.createElement(Ft.Z,{id:"short-answer-suggested-response",className:"form-control",minRows:2,value:n.suggestedResponse||"",onChange:function(e){i(Object.assign(Object.assign({},n),{suggestedResponse:e.target.value}))},placeholder:"Give a suggested response for this question","aria-errormessage":"answer-error"}),l()===Zr.ANSWER&&r.createElement(Hn,{id:"answer-error",error:n.error})))})),x.Z9.TrueOrFalse,Br),x.Z9.Illustration,(function(e){var t=fr(r.useState(),2),n=t[0],i=t[1],o=fr(r.useState(!1),2),a=o[0],c=o[1],l=e.state,s=void 0===l?{question:e.interaction.name}:l,u=e.setState,f=e.optionsPortalNode;return r.createElement("div",{className:"cv-interactive-question"},r.createElement("fieldset",{className:"form-group"},r.createElement("div",{className:"d-flex justify-content-between align-items-center"},r.createElement("label",{className:"cv-interaction-field-label",htmlFor:"illustration-question"},"Prompt"),r.createElement(Pe.t0,{node:f})),r.createElement("input",{id:"illustration-question",className:"form-control",onChange:function(e){u(Object.assign(Object.assign({},s),{question:e.target.value}))},value:s.question||"",placeholder:"Enter your prompt here",autoComplete:"off","aria-invalid":!!s.error,"aria-errormessage":"illustrationQuestionError"}),r.createElement(Hn,{id:"illustrationQuestionError",error:s.error})),r.createElement("div",{className:"alert text-dark bg-light-blue px-2 rounded-3"},"Students attempting this question will be prompted to draw their answer. ",r.createElement(S.L,{onClick:function(){return c(!0)},className:"btn-link text-underline d-inline"},"Preview how students will answer.")),a&&r.createElement(Pe.Nq,{node:e.fullWidthPortalNode},r.createElement(xt,{interaction:Object.assign(Object.assign({},e.interaction),{name:s.question}),onSave:function(e){i(e),c(!1)},onCancel:function(){return c(!1)}})),n&&r.createElement("img",{className:"img-fluid border rounded mt-2 w-50 d-block",src:n,alt:"Illustration you just created."}))})),$r=Yr(Yr(Yr(Yr(Yr(Yr(Yr({},x.Z9.Annotation,(function(e){var t,n;return(null===(t=e.annotation)||void 0===t?void 0:t.trim())?(null===(n=e.annotation)||void 0===n?void 0:n.trim()).replace(/<[^>]*>/g,"").length>3500?"Max length is ".concat(3500," characters"):null:"Please provide an annotation"})),x.Z9.Image,(function(e){return e.url?null:"Please upload an image"})),x.Z9.MissingWord,(function(e){var t,n;return(null===(t=e.sentence)||void 0===t?void 0:t.trim())?(null===(n=e.sentence)||void 0===n?void 0:n.trim().length)>255?"Max length is ".concat(255," characters"):e.words.find((function(e){return e.selected}))?null:"Please select a missing word":"Please provide a sentence"})),x.Z9.MultipleChoice,Ur),x.Z9.ShortAnswer,(function(e){var t,n,r;return(null===(t=e.question)||void 0===t?void 0:t.trim())?(null===(n=e.question)||void 0===n?void 0:n.trim().length)>255?Hr:(null===(r=e.suggestedResponse)||void 0===r?void 0:r.trim().length)>4e3?Wr:null:zr})),x.Z9.TrueOrFalse,Ur),x.Z9.Illustration,(function(e){var t;return(null===(t=e.question)||void 0===t?void 0:t.trim())?null:"Please provide a question"})),Xr=Yr(Yr(Yr(Yr(Yr(Yr(Yr({},x.Z9.Annotation,(function(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=sr().mark((function r(){return sr().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t.name="Annotation",t.data.annotation=null===(n=e.annotation)||void 0===n?void 0:n.trim(),t.actionableItems=[{name:"Answer"}],r.next=5,tr.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))})),x.Z9.Image,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=Or().mark((function i(){return Or().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return t.data.url=e.url,t.name=(null===(n=e.caption)||void 0===n?void 0:n.trim())||"Image",t.data.caption=null===(r=e.caption)||void 0===r?void 0:r.trim(),t.actionableItems=[{name:"Answer"}],i.next=6,tr.saveInteraction(t);case 6:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}))})),x.Z9.MissingWord,(function(e,t){return n=this,r=void 0,i=void 0,o=Nr().mark((function n(){var r;return Nr().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.data.sentence=Tr(e.words),t.name=e.preview,r=e.words.filter((function(e){return e.selected})),t.actionableItems=r.map((function(e){return{name:Pr(e.text),order:e.order,isCorrect:!0}})),n.next=6,tr.saveInteraction(t);case 6:case"end":return n.stop()}}),n)})),new(i||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function c(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}l((o=o.apply(n,r||[])).next())}));var n,r,i,o})),x.Z9.MultipleChoice,Vr),x.Z9.ShortAnswer,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=Gr().mark((function i(){return Gr().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return t.name=null===(n=e.question)||void 0===n?void 0:n.trim(),t.data.suggestedResponse=null===(r=e.suggestedResponse)||void 0===r?void 0:r.trim(),t.actionableItems=[{name:"Answer"}],i.next=5,tr.saveInteraction(t);case 5:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}))})),x.Z9.TrueOrFalse,Vr),x.Z9.Illustration,(function(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=pr().mark((function r(){return pr().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t.name=null===(n=e.question)||void 0===n?void 0:n.trim(),t.actionableItems=[{name:"Answer"}],r.next=4,tr.saveInteraction(t);case 4:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))}));function Jr(e){return Xr[e]}function ei(e){return ei="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},ei(e)}function ti(){ti=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ei(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ei(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ni(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ri(e,t);var n={}.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)?ri(e,t):void 0}}(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 ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ii=null,oi=0,ai=1;function ci(e){var t=e.timepoint,n=e.updateTimepointTime,i=e.saveTimepoint,o=e.back,a=e.clearTimepointTimeState,c=ni(r.useState((0,bn.m)(t.visibleAt/1e3)),2),l=c[0],s=c[1],u=ni(r.useState(!1),2),f=u[0],d=u[1];function p(e){n(e*ai),s((0,bn.m)(t.visibleAt/1e3)),2==++oi?ai=5:4===oi?ai=20:6===oi?ai=60:8===oi&&(ai=120),ii||(ii=window.setInterval((function(){return p(e)}),200),window.addEventListener("mouseup",m))}function m(){window.removeEventListener("mouseup",m),window.clearInterval(ii),ii=null,oi=0,ai=1}return r.useEffect((function(){return m}),[]),r.createElement(r.Fragment,null,r.createElement("div",{className:"cv-timepoint flex-grow-1"},r.createElement("div",{className:"cv-timepoint-padding"},r.createElement("div",{className:"cv-interactive-question"},r.createElement("label",{htmlFor:"move-time-point",className:"cv-interaction-field-label mb-0"},"Move time point"),r.createElement("div",{className:"text-center mt-3"},r.createElement(S.L,{className:"cv-left-arrow d-inline-block cursor-pointer",onClick:function(){},onMouseDown:function(){return p(-1)},onKeyDown:function(e){e.stopPropagation(),13===e.keyCode&&0===oi&&p(-1)},onKeyUp:m}),r.createElement("input",{id:"move-time-point",className:"form-control text-center d-inline-block cv-move-timepoint-input",value:l,onChange:function(){},onKeyDown:function(e){e.stopPropagation(),37===e.keyCode&&0===oi&&p(-1),39===e.keyCode&&0===oi&&p(1)},onKeyUp:m}),r.createElement(S.L,{className:"cv-right-arrow d-inline-block cursor-pointer",onClick:function(){},onMouseDown:function(){return p(1)},onKeyDown:function(e){e.stopPropagation(),13===e.keyCode&&0===oi&&p(1)},onKeyUp:m}))))),r.createElement("div",{className:"cv-timpoint-button-container"},r.createElement(S.L,{className:"btn btn-link",onClick:function(){a(!0),o()}},"Cancel"),f?r.createElement(S.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(je.Z,{as:"span",animation:"border",role:"status",size:"sm"})):r.createElement(S.L,{className:"btn btn-dark",onClick:function(){return e=this,t=void 0,n=void 0,r=ti().mark((function e(){return ti().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d(!0),e.next=3,i();case 3:o();case 4:case"end":return e.stop()}}),e)})),new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}},"Save")))}var li=n(20455),si=n(95339),ui=n(67445);function fi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function di(e){var t,n,i=(t=r.useState(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return fi(e,t);var n={}.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)?fi(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1],c=(0,li.Dy)((0,li.VT)(li.we,{activationConstraint:{distance:10}}),(0,li.VT)(li.Lg,{coordinateGetter:ui.is}));return e.disabled?r.createElement(r.Fragment,null,e.children):r.createElement(li.LB,{sensors:c,collisionDetection:li.pE,onDragStart:function(t){var n;a(t.active.id),null===(n=e.onSortStart)||void 0===n||n.call(e,t)},onDragEnd:function(t){a(null),e.onSortEnd(t)},modifiers:e.vertical?[si.DL]:[]},r.createElement(ui.Fo,{items:e.ids,strategy:e.vertical?ui.qw:ui.U2},e.children),r.createElement(li.y9,{dropAnimation:e.dropAnimation},o?e.getDragOverlay(o):null))}di.defaultProps={dropAnimation:{duration:250,easing:"ease"},vertical:!0};var pi=n(17592);function mi(e){var t=(0,ui.nB)({id:e.id}),n=t.setNodeRef,i=t.transform,o=t.transition,a=t.isSorting,c=t.listeners,l=t.attributes,s=t.activeIndex,u=t.overIndex,f=t.index,d={transform:pi.ux.Transform.toString(i),transition:o,touchAction:"none",position:"relative"};a&&f===s&&(d.visibility="hidden");var p=e.childComponent,m=function(e,t,n){return t!==e?null:n>t?"down":n<t?"up":null}(f,s,u);return r.createElement(p,Object.assign({},e.childProps,{ref:n,style:d,dragListeners:c,dragAttributes:l,dragDirection:m}))}function hi(e){return hi="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},hi(e)}function vi(){vi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==hi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(hi(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function yi(e){return function(e){if(Array.isArray(e))return wi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||bi(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 gi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||bi(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 bi(e,t){if(e){if("string"==typeof e)return wi(e,t);var n={}.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)?wi(e,t):void 0}}function wi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ei=function(e){var t=e.interaction,n=N.w.getTypeInfo(t.typeId).bgClassName,i=r.forwardRef((function(e,i){return r.createElement("div",Object.assign({className:"py-2 text-start"},e.dragAttributes,e.dragListeners,{ref:i,style:e.style}),r.createElement("span",{className:"fB8W8"},r.createElement(k.x,{size:k.S.Small,svgName:O.vn.Handle})),r.createElement(I,{interaction:t,iconClassName:"".concat("GSE1a"," ").concat(n),questionClassName:"".concat("qKMzc"," clamp-1")}))}));return r.createElement(mi,{id:t.id,childComponent:i,childProps:{}})},Si=function(e){var t=e.interactions,n=function(){var e=r.useRef(null);function t(){document.body.style.cursor="",document.removeEventListener("mouseup",t),e.current&&(e.current.style.cursor="grab")}return{ref:e,style:{cursor:"grab"},onMouseDown:function(){document.body.style.cursor="grabbing",document.addEventListener("mouseup",t),e.current&&(e.current.style.cursor="grabbing")},onMouseUp:t}}();return r.createElement(di,{ids:t.map((function(e){return e.id})),getDragOverlay:function(e){return r.createElement(Ei,{key:e,interaction:t.find((function(t){return t.id===e}))})},onSortEnd:e.onSortEnd},r.createElement("div",Object.assign({tabIndex:0},n),t.map((function(e){return r.createElement(Ei,{key:e.id,interaction:e})}))))};function ki(e){var t=gi(r.useState(!1),2),n=t[0],i=t[1],o=gi(r.useState(yi(e.interactions)),2),a=o[0],c=o[1],l=gi(r.useState(!1),2),s=l[0],u=l[1];return r.createElement(r.Fragment,null,r.createElement("div",{className:"cv-timepoint flex-grow-1"},r.createElement("div",{className:"cv-timepoint-padding"},r.createElement("div",{className:"cv-interactive-question"},r.createElement("label",{className:"cv-interaction-field-label mb-0"},"Re-order questions"),r.createElement("div",{className:"text-center mt-3"},r.createElement(Si,{onSortEnd:function(e){var t=e.active,n=e.over,r=a.findIndex((function(e){return e.id.toString()===t.id.toString()})),i=a.findIndex((function(e){return e.id.toString()===n.id.toString()}));r!==i&&(c(yi(function(e,t,n){for(;t<0;)t+=e.length;for(;n<0;)n+=e.length;if(n>=e.length)for(var r=n-e.length+1;r--;)e.push(void 0);return e.splice(n,0,e.splice(t,1)[0]),e}(a,r,i))),u(!0))},interactions:a}))))),r.createElement("div",{className:"cv-timpoint-button-container"},r.createElement(S.L,{className:"btn btn-link",onClick:function(){c(yi(e.interactions)),u(!1),e.back()}},"Cancel"),n?r.createElement(S.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(je.Z,{as:"span",animation:"border",role:"status",size:"sm"})):r.createElement(S.L,{className:"btn btn-dark ".concat(s?"":"disabled"),onClick:function(){return t=this,n=void 0,r=void 0,o=vi().mark((function t(){return vi().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s){t.next=2;break}return t.abrupt("return");case 2:return i(!0),t.next=5,e.reOrderQuestions(a);case 5:i(!1),e.back();case 7:case"end":return t.stop()}}),t)})),new(r||(r=Promise))((function(e,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function c(e){try{l(o.throw(e))}catch(e){i(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,c)}l((o=o.apply(t,n||[])).next())}));var t,n,r,o}},"Save")))}function xi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Oi(e,t);var n={}.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)?Oi(e,t):void 0}}(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 Oi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ci(e){var t=e.isCreate,n=e.interaction,i=e.mode,o=e.immediateFeedback,a=e.interactionState,c=e.shouldFocus,l=e.delayFocus,s=e.open,u=e.timepoint,f=e.userUpdateInteractionState,d=e.submitInteractionAnswer,p=e.saveInteraction,m=e.skip,h=r.useRef(null),v=r.useRef(null),y=r.useRef(0),g=(0,gn.a)(yn.r.XLDown),b=!t||g;function w(){return!!h.current&&!!c&&!!s}function E(){h.current&&(h.current.focus(),x(!0))}var S=xi(r.useState(!1),2),k=S[0],x=S[1];r.useEffect((function(){w()&&(k||(l&&b?y.current=window.setTimeout((function(){y.current=0,w()&&E()}),400):E()))}),[h.current,k]);var O=xi(r.useState("question"),2),C=O[0],N=O[1],j=r.useMemo((function(){return(0,Pe.oD)()}),[]),P=n?function(e,t){if(t===R.Create)return function(e){return Kr[e]}(e);if(t===R.View)return function(e){return Zt[e]}(e);throw new Error("Cannot find components for the mode ".concat(t))}(n.typeId,i):null,I=o;return t||(I=I&&(null==a?void 0:a.submitted)),r.createElement(r.Fragment,null,r.createElement(On,Object.assign({optionsPortalNode:j,setView:N},e)),r.createElement(Xe.Z,{className:"h-100",ref:v},r.createElement(kn,Object.assign({},e)),!!n&&r.createElement("div",{className:"d-flex flex-column h-100"},r.createElement(qn,Object.assign({},e)),"question"===C&&r.createElement(r.Fragment,null,r.createElement("form",{className:"cv-timepoint flex-grow-1",tabIndex:-1,onSubmit:function(e){e.preventDefault(),t?p():d()}},r.createElement("div",{className:"cv-timepoint-padding h-100"},r.createElement("div",{ref:h,tabIndex:0}),r.createElement(P,Object.assign({state:a,setState:f,recalculateScroll:function(){v.current.recalculate()},showFeedback:I,optionsPortalNode:j},e)))),r.createElement(jn,Object.assign({onClickSkip:function(){y.current&&window.clearTimeout(y.current),m()}},e))),"move"===C&&r.createElement(ci,Object.assign({back:function(){return N("question")}},e)),"reorder"===C&&r.createElement(ki,Object.assign({back:function(){return N("question")},interactions:u.interactions},e)))))}function Ni(e){var t=e.open,n=e.nextInteraction,i=e.nextInteractionState,o=e.timepointState,a=e.interaction,c=e.delayFocus,l=e.experimentalInteractiveQuestions,s=r.useMemo((function(){return(0,Pe.oD)({attributes:{class:"cv-interactive-lhs"}})}),[]),u=r.useMemo((function(){return(0,Pe.oD)({attributes:{class:"cv-interactive-full"}})}),[]),f=n&&o.nextInteractionIndex<o.interactionIndex,d=n&&o.nextInteractionIndex>o.interactionIndex,p=d&&o.slideIn,m=f&&o.slideIn,h=t&&!f&&!d;return r.createElement(r.Fragment,null,r.createElement("div",{className:"cv-interactive-full-container ".concat(h?"":"cv-closed-full")},r.createElement(Pe.t0,{node:u})),r.createElement("div",{className:"cv-interactive-lhs-container ".concat(h?"":"cv-closed-lhs")},r.createElement(Pe.t0,{node:s})),r.createElement("div",{className:"cv-interactive ".concat(t?"cv-open":"")},f&&r.createElement("div",{className:"cv-prev-interaction ".concat(o.slideIn?"cv-slide-in":"")},r.createElement(Ci,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:i}))),r.createElement("div",{className:"\n cv-main-slide\n ".concat(p?"cv-slide-out-up":"","\n ").concat(m?"cv-slide-out-down":"","\n ").concat(n?"cv-transitioning":"","\n ")},r.createElement(Ci,Object.assign({key:null==a?void 0:a.id},e,{currentIndex:o.interactionIndex,shouldFocus:a&&!f&&!d,delayFocus:c,leftHandSidePortalNode:s,fullWidthPortalNode:u,experimentalInteractiveQuestions:l}))),d&&r.createElement("div",{className:"cv-next-interaction ".concat(o.slideIn?"cv-slide-in":"")},r.createElement(Ci,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:i})))))}function ji(e){return ji="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},ji(e)}function Pi(e,t,n){return(t=function(e){var t=function(e){if("object"!=ji(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ji(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ji(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ii={interactions:{},timepoints:{}};function Li(e,t){return"interaction"===t.type?{timepoints:e.timepoints,interactions:Object.assign(Object.assign({},e.interactions),Pi({},t.id,t.value))}:"timepoint"===t.type?{interactions:e.interactions,timepoints:Object.assign(Object.assign({},e.timepoints),Pi({},t.id,t.value))}:void 0}function Ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var _i={interactionIndex:0},Ai=function(e){var t,n,i=e.mode,o=e.timepoint,a=e.latestSession,c=i===R.Create,l=r.useReducer(Li,null,(function(){return function(e){return e?{timepoints:{},interactions:e.actions.reduce((function(e,t){return e[t.interactionId]=Object.assign(Object.assign({},e[t.interactionId]),Pi(Pi({},t.actionableItemId,t.data),"submitted",!0)),e}),{})}:Ii}(a)})),s=(n=2,function(e){if(Array.isArray(e))return e}(t=l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ti(e,t);var n={}.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)?Ti(e,t):void 0}}(t,n)||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.")}()),u=s[0],f=s[1],d=y(null==o?void 0:o.id),p=null==o?void 0:o.interactions[d.interactionIndex],m="number"==typeof d.nextInteractionIndex?null==o?void 0:o.interactions[d.nextInteractionIndex]:null,h=g(null==p?void 0:p.id),v=g(null==m?void 0:m.id);function y(e){return e&&u.timepoints[e]||_i}function g(e){if(!e)return{};var t=u.interactions[e];return t||c?t:{}}function b(e,t,n){var r=g(e);f({type:"interaction",id:e,value:Object.assign(Object.assign({},n?{}:r),t)})}return{state:u,interaction:p,interactionState:h,timepointState:d,nextInteraction:m,nextInteractionState:v,getTimepointState:y,getInteractionState:g,updateTimepointState:function(e,t){var n=y(e);f({type:"timepoint",id:e,value:Object.assign(Object.assign({},n),t)})},updateInteractionState:b,clearTimepointState:function(e){f({type:"timepoint",id:e,value:void 0})},clearInteractionState:function(e){f({type:"interaction",id:e,value:void 0})},userUpdateInteractionState:function(e,t){b(p.id,Object.assign(Object.assign({},e),{hasChanges:!0,error:null}),t)}}};function Fi(e){return Fi="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},Fi(e)}function Di(){Di=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Fi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Fi(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var Ri=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Mi=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},Ui=!1;function Vi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bi(e,t);var n={}.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)?Bi(e,t):void 0}}(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 Bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var qi=n(25417),Gi=n(81937),Zi=n(69184);function zi(e,t){if(e){if("string"==typeof e)return Hi(e,t);var n={}.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)?Hi(e,t):void 0}}function Hi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Wi=Qe.T.encloseNamespace("shared.hooks"),Qi=function(){var e,t,n=(e=r.useState([]),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||zi(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.")}()),i=n[0],o=n[1],a=mr.Radio.channel(qi.G.SHELL);function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.find((function(t){return t.id===e.id}))||(e.allowAppLinks||a.trigger(B.Q.Vy.LOCK_NAV),o([].concat(function(e){return function(e){if(Array.isArray(e))return Hi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||zi(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.")}()}(i),[e])))}function s(e){var t=i.filter((function(t){return t.id!==e}));0!==t.length&&t.find((function(e){return!e.allowAppLinks}))||a.trigger(B.Q.Vy.UNLOCK_NAV),o(t)}function u(e){var t;if(i.length){var n=i.find((function(e){return!e.allowAppLinks}));if(null===(t=n.appLinkWhitelist)||void 0===t?void 0:t.find((function(t){return t.action===e.action&&t.application===e.application})))return a.trigger(B.Q.Vy.UNLOCK_NAV),void window.setTimeout((function(){B.Q.C$.trigger(e),a.trigger(B.Q.Vy.LOCK_NAV)}),0);l.q.isFunction(n.renderCustomDialog)?n.renderCustomDialog():gt(r.createElement("p",null,n.text),{title:n.title,submitButtonProps:{onClick:function(){n.onConfirmUnlock&&n.onConfirmUnlock(),function(e){a.trigger(B.Q.Vy.NAV_UNLOCKED_BY_USER),i.forEach((function(e){e.allowAppLinks||s(e.id)})),window.removeEventListener("beforeunload",f),B.Q.C$.trigger(e)}(e)},variant:"danger",text:Wi("discard")},cancelButtonProps:{text:Wi("cancel"),variant:"link"}})}}function f(e){var t=i.find((function(e){return e.allowAppLinks}));return t||(t=Ze.m.first(i)),e.returnValue=t.text,t.text}return r.useEffect((function(){return i.find((function(e){return!e.allowAppLinks}))&&a.on(B.Q.Vy.NAV_IS_LOCKED,u),i.length&&window.addEventListener("beforeunload",f),function(){a.off(B.Q.Vy.NAV_IS_LOCKED,u),window.removeEventListener("beforeunload",f)}}),[i]),r.useEffect((function(){function e(){c({id:"upload",title:Wi("navLockTitle"),text:Wi("navLockBody"),allowAppLinks:!0})}var t=mr.Radio.channel(Zi.Q4.VIDEO_UPLOAD);return t.on(Gi.S.FILES_ADDED,e),t.on(Gi.S.UNLOCK_NAV,s),function(){t.off(Gi.S.FILES_ADDED,e),t.off(Gi.S.UNLOCK_NAV,s)}}),[]),{lock:c,unlock:s}};function Yi(e){return Yi="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},Yi(e)}function Ki(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $i(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,Ji(r.key),r)}}function Xi(e,t,n){return t&&$i(e.prototype,t),n&&$i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ji(e){var t=function(e){if("object"!=Yi(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Yi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Yi(t)?t:t+""}function eo(e,t,n){return t=ro(t),function(e,t){if(t&&("object"==Yi(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,to()?Reflect.construct(t,n||[],ro(e).constructor):t.apply(e,n))}function to(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(to=function(){return!!e})()}function no(){return no="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ro(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},no.apply(null,arguments)}function ro(e){return ro=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ro(e)}function io(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&oo(e,t)}function oo(e,t){return oo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},oo(e,t)}var ao=function(e){function t(e,n){return Ki(this,t),eo(this,t,[e,n])}return io(t,e),Xi(t,[{key:"dispose",value:function(){var e,n,r,i=this;setImmediate((function(){var e;null===(e=i.root)||void 0===e||e.unmount()})),(e=t,n=this,"function"==typeof(r=no(ro(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}}])}(ie.Z.getComponent("Component")),co={tagName:"div"};function lo(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:co;if(!e)throw new Error("componentCtor is required");var n=function(n){function r(){return Ki(this,r),eo(this,r,arguments)}return io(r,n),Xi(r,[{key:"createEl",value:function(){var n=ie.Z.dom.createEl(t.tagName,t.properties,t.attributes),r=(0,ht.s)(n);return r.render(e(this.player_,this.options_)),this.root=r,n}}])}(ao);return n}var so=n(42120),uo=n(50028);function fo(e){var t,n=!e.parentVideo||(null===(t=e.parentVideo)||void 0===t?void 0:t.status)===uo.X.Published,i=function(e){var t,n=0;return null===(t=null==e?void 0:e.timepoints)||void 0===t||t.forEach((function(e){var t;return null===(t=e.interactions)||void 0===t?void 0:t.forEach((function(){return n++}))})),n>0}(e.interactive)&&n,o=[];return e.onClickEditDetails&&o.push({label:"Edit details",svgName:O.vn.Edit,button:!0,className:"btn btn-outline-dark",onClick:e.onClickEditDetails}),e.onClickPublish&&o.push({label:"Publish",button:!0,className:"btn btn-dark ms-2".concat(i?"":" disabled"),disabled:!i,tooltip:i?"":n?"Interactives cannot be published without questions":"Parent video must be published before interactives can be published",onClick:function(){i&&e.onClickPublish&&e.onClickPublish()}}),e.onClickCopy&&o.push({label:"Copy interactive",button:!1,onClick:e.onClickCopy}),e.onClickDelete&&o.push({label:"Delete interactive",button:!1,onClick:e.onClickDelete,className:"text-danger"}),o.length?r.createElement(Pe.Nq,{node:e.portalNode},r.createElement(so.e,{actions:o,actionsDropdownClassName:"btn btn-outline-dark ms-2"})):r.createElement(r.Fragment,null)}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 mo(e){var t=e.title,n=e.player,i=e.track,o=e.mode,a=e.interactive,c=e.imageApi,l=e.actionsPortalNode,s=e.questionListPortalNode,u=e.summaryPortalNode,d=e.resultsService,p=e.currentUser,m=e.progress,h=e.latestSession,v=e.clipOffset,y=e.analyticsService,g=e.enableImmersiveReader,b=e.mobile,w=e.parentVideo,E=e.experimentalInteractiveQuestions,S=function(e){var t=e.player,n=e.track,i=e.interactive,o=e.clipOffset,a=Vi(r.useState(!1),2),c=a[0],l=a[1],s=Vi(r.useState(!1),2),u=s[0],f=s[1],d=Vi(r.useState(null),2),p=d[0],m=d[1];function h(e){return o?e+o:e}function v(e){f(!!e&&c),l(e)}function y(){var e=n.activeCues;if(!e.length)return v(!1),void m(null);var r=i.timepoints.find((function(t){return t.id.toString()===e[0].text.toString()}));if(!r)return v(!1),void m(null);r.shouldPause&&(t.seeking()?t.one("play",(function(){return t.pause()})):t.pause()),v(!0),m(r)}function g(e){for(var t=0;t<n.cues.length;t++){var r=n.cues[t];if(r.text.toString()===e.toString())return r}}return r.useEffect((function(){return n.addEventListener("cuechange",y),function(){return n.removeEventListener("cuechange",y)}})),{open:c,setOpen:v,wasOpen:u,timepoint:p,continueInteractive:function(){v(!1),t.play()},updateCue:function(e,t){var n=g(e);n.text=t.toString(),n.originalCue_.text=t.toString()},addCue:function(e){var r=t.currentTime();n.addCue({startTime:h(r)-.001,endTime:h(r+1),text:e}),n.trigger("cv:cuechange"),t.paused()&&n.trigger("cuechange")},removeCue:function(e){e=h(e);for(var t=0;t<n.cues.length;){var r=n.cues[t];if(r.startTime<=e&&r.endTime>=e){n.removeCue(r),n.trigger("cv:cuechange"),n.trigger("cuechange");break}t++}},moveTimepoint:function(e){var r=g(p.id);if(r){var i=e/1e3;r.startTime=h(i),r.endTime=h(i+1),t.currentTime(i+.5,!0),p.visibleAt=e,n.trigger("cv:cuechange")}},getClipOffset:h}}({player:n,track:i,interactive:a,mode:o,clipOffset:v}),k=S.open,x=S.timepoint,O=S.wasOpen,C=po(S,["open","timepoint","wasOpen"]),j=function(e){var t=e.interactive,n=e.timepoint,i=e.player,o=e.mode,a=e.resultsService,c=e.latestSession,l=e.analyticsService,s=e.imageApi,u=Mi(e,["interactive","timepoint","player","mode","resultsService","latestSession","analyticsService","imageApi"]),d=Ai({mode:o,timepoint:n,latestSession:c}),p=d.state,m=d.interaction,h=d.interactionState,v=d.timepointState,y=d.nextInteraction,g=d.nextInteractionState,b=Mi(d,["state","interaction","interactionState","timepointState","nextInteraction","nextInteractionState"]),w=o===R.Create;function E(e){for(var n=0;n<t.timepoints.length;){for(var r=t.timepoints[n],i=0;i<r.interactions.length;){var o=r.interactions[i];if(o.id===e)return{localTimepoint:r,localInteraction:o};i++}n++}return{localInteraction:null,localTimepoint:null}}function S(e){var n=N.w.getTypeInfo(e.typeId);return{id:tn(e.id)?void 0:e.id,typeId:e.typeId,type:n.typeName,interactiveId:t.id,timepointId:tn(e.timepointId)?void 0:e.timepointId,order:e.order}}function k(e){return Ri(this,void 0,void 0,Di().mark((function n(){var r,i,o,a,c,s,d;return Di().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=E(e),i=r.localInteraction,o=r.localTimepoint,i&&o){n.next=3;break}throw new Error("Could not find the interaction and timepoint for the interactionId ".concat(e));case 3:if(a=S(i),tn(i.id)){n.next=10;break}return n.next=7,tr.deleteInteraction(i.id);case 7:null==l||l.logUserAction(a,{actionType:f.Vw.Delete,entity:f.py.Interaction,workflowPhase:f.eu.Complete}),n.next=11;break;case 10:null==l||l.logUserAction(a,{actionType:f.Vw.Create,entity:f.py.Interaction,workflowPhase:f.eu.Discard});case 11:if(c=o.interactions.findIndex((function(e){return e.id===i.id})),o.interactions.splice(c,1),b.clearInteractionState(i.id),s=b.getTimepointState(o.id),c<s.interactionIndex&&b.updateTimepointState(o.id,{interactionIndex:s.interactionIndex-1}),!(o.interactions.length>0)){n.next=18;break}return n.abrupt("return");case 18:if(tn(o.id)){n.next=21;break}return n.next=21,tr.deleteTimepoint(o.id);case 21:d=t.timepoints.findIndex((function(e){return e.id===o.id})),t.timepoints.splice(d,1),u.removeCue(o.visibleAt/1e3),b.clearTimepointState(o.id);case 25:case"end":return n.stop()}}),n)})))}function x(e){if(m){var t=tn(m.id);t||(null==h?void 0:h.hasChanges)||(null==v?void 0:v.hasChanges)?gt(r.createElement("p",null,"Do you want to discard your changes?"),{title:"Unsaved changes",submitButtonProps:{onClick:function(){(null==v?void 0:v.hasChanges)&&I(!0),t?k(m.id):b.clearInteractionState(m.id),e&&e()},variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}}):e&&e()}else e&&e()}function O(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(w)x((function(){b.updateTimepointState(n.id,{interactionIndex:e})}));else{var r=function(){b.updateTimepointState(n.id,{nextInteractionIndex:e}),window.requestAnimationFrame((function(){b.updateTimepointState(n.id,{nextInteractionIndex:e,slideIn:!0}),window.setTimeout((function(){b.updateTimepointState(n.id,{interactionIndex:e,nextInteractionIndex:null,slideIn:null})}),400)}))};t?x(r):r()}}function C(){v.interactionIndex+1>=n.interactions.length?u.continueInteractive():O(v.interactionIndex+1,!1)}function j(){t.timepoints.sort((function(e,t){return e.visibleAt>t.visibleAt?1:t.visibleAt>e.visibleAt?-1:0}))}function P(){O(n.interactions.length)}function I(e){(null==v?void 0:v.hasChanges)&&(e&&u.moveTimepoint(v.originalVisibleAt),b.updateTimepointState(n.id,{hasChanges:void 0,originalVisibleAt:void 0}),Ui=!1)}return{state:p,interaction:m,interactionState:h,timepointState:v,nextInteraction:y,nextInteractionState:g,skip:C,cancel:function(){return Ri(this,void 0,void 0,Di().mark((function e(){return Di().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==h?void 0:h.hasChanges)){e.next=3;break}return x(),e.abrupt("return");case 3:return e.next=5,k(m.id);case 5:u.setOpen(!0);case 6:case"end":return e.stop()}}),e)})))},addAnotherQuestion:P,goToTimepoint:function(e,n){var r=function(e){for(var n=0;n<t.timepoints.length;){var r=t.timepoints[n];if(r.id===e)return r;n++}return null}(e),o=r.interactions.find((function(e){return e.id.toString()===n.toString()}));i.currentTime(r.visibleAt/1e3),b.updateTimepointState(r.id,{interactionIndex:r.interactions.indexOf(o)})},discardChanges:x,changeIndex:O,promptDelete:function(e){var t=S(E(e).localInteraction);null==l||l.logUserAction(t,{actionType:f.Vw.Delete,entity:f.py.Interaction,workflowPhase:f.eu.Start}),gt(r.createElement("p",null,"Are you sure you want to delete this question?"),{title:"Delete question",submitButtonProps:{onClick:function(){return k(e)},variant:"danger",text:"Delete question"},cancelButtonProps:{variant:"link",text:"Cancel"}})},showTypeSelector:function(){i.pause(),u.setOpen(!0),n&&P()},cancelTypeSelector:function(){n?O(v.interactionIndex-1):(u.setOpen(!1),i.play())},deleteInteraction:k,saveInteraction:function(){return Ri(this,void 0,void 0,Di().mark((function e(){var t,r,i,o,a,c,s;return Di().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(w){e.next=2;break}throw new Error("Should not be calling onClickSave while viewing an interactive");case 2:if(d=m.typeId,t=$r[d],!(r=t(b.getInteractionState(m.id),m))){e.next=7;break}return b.updateInteractionState(m.id,{error:r}),e.abrupt("return");case 7:if(b.updateInteractionState(m.id,{spinner:!0}),!tn(n.id)){e.next=15;break}return i=n.id,e.next=12,tr.saveTimepoint(n);case 12:u.updateCue(i,n.id),b.clearTimepointState(i),(null==v?void 0:v.hasChanges)&&(j(),I());case 15:return m.timepointId=n.id,o=m.id,a=Jr(m.typeId),e.next=20,a(b.getInteractionState(m.id),m);case 20:b.clearInteractionState(o),c=tn(o),s=S(m),null==l||l.logUserAction(s,{actionType:c?f.Vw.Create:f.Vw.Edit,entity:f.py.Interaction,workflowPhase:c?f.eu.Complete:f.eu.Save});case 24:case"end":return e.stop()}var d}),e)})))},addInteraction:function(e){var r;i.pause();var o=(null==n?void 0:n.id)||"new_".concat(Math.round(Math.random()*Number.MAX_SAFE_INTEGER)),a={id:"new_".concat(Math.round(Math.random()*Number.MAX_SAFE_INTEGER)),timepointId:o,typeId:e,order:(null===(r=null==n?void 0:n.interactions)||void 0===r?void 0:r.length)||0,interactiveId:t.id,data:{}},c=S(a);if(null==l||l.logUserAction(c,{actionType:f.Vw.Create,entity:f.py.Interaction,workflowPhase:f.eu.Start}),n)return n.interactions.push(a),void O(v.interactionIndex);var s=i.currentTime();t.timepoints||(t.timepoints=[]),t.timepoints.push({id:o,visibleAt:1e3*s,interactiveId:t.id,shouldPause:1,interactions:[a]}),j(),u.addCue(o)},submitInteractionAnswer:function(){return Ri(this,void 0,void 0,Di().mark((function e(){var r,i,c,d,p,y;return Di().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o===R.View){e.next=2;break}throw new Error("Should not be calling onClickSubmit while creating an interactive");case 2:if(!h.submitted){e.next=8;break}if(!(v.interactionIndex>=n.interactions.length)){e.next=6;break}return u.continueInteractive(),e.abrupt("return");case 6:return O(v.interactionIndex+1),e.abrupt("return");case 8:if(r=nn(h),g=m.typeId,i=Ht[g],!(c=i(r,m))){e.next=14;break}return b.updateInteractionState(m.id,{error:c}),e.abrupt("return");case 14:if(d={},!a||!h.hasChanges){e.next=27;break}if(p=Qt(m.typeId),b.updateInteractionState(m.id,{spinner:!0}),!p){e.next=27;break}return e.next=21,p(r,m,a.save,{imageApi:s});case 21:if(e.t0=e.sent,e.t0){e.next=24;break}e.t0={};case 24:d=e.t0,y=S(m),null==l||l.logUserAction(y,{actionType:f.Vw.Submit,entity:f.py.Interaction});case 27:if(b.updateInteractionState(m.id,Object.assign(Object.assign({},d),{submitted:!0,error:null,hasChanges:!1,spinner:!1})),t.immediateFeedback){e.next=31;break}return C(),e.abrupt("return");case 31:Gt(m.typeId)(m)||C();case 34:case"end":return e.stop()}var g}),e)})))},userUpdateInteractionState:b.userUpdateInteractionState,updateTimepointTime:function(e){var r=i.duration(),o=function(e){for(var r=n.visibleAt+1e3*e,i=e>0,o=0;o<t.timepoints.length;o++){var a=t.timepoints[o];r<a.visibleAt-1e3||r>a.visibleAt+1e3||(r=i?a.visibleAt+1001:a.visibleAt-1001,o=0)}return r}(e);if(!(o/1e3>r||o<0)){var a=n.visibleAt;Ui||(Ui=!0,b.updateTimepointState(n.id,{originalVisibleAt:a,hasChanges:!0})),u.moveTimepoint(o)}},saveTimepoint:function(){return Ri(this,void 0,void 0,Di().mark((function e(){return Di().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!tn(n.id)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,tr.updateTimepoint(n);case 4:j(),I();case 6:case"end":return e.stop()}}),e)})))},clearTimepointTimeState:I,reOrderQuestions:function(e){return Ri(this,void 0,void 0,Di().mark((function t(){var r,i;return Di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=0;case 1:if(!(r<e.length)){t.next=7;break}return t.next=4,tr.saveInteraction(Object.assign(Object.assign({},e[r]),{order:r}));case 4:r++,t.next=1;break;case 7:i=n.interactions[v.interactionIndex],n.interactions=e,b.updateTimepointState(n.id,{interactionIndex:e.indexOf(i)});case 10:case"end":return t.stop()}}),t)})))}}}(Object.assign({mode:o,interactive:a,timepoint:x,player:n,resultsService:d,latestSession:h,analyticsService:y,imageApi:c},C)),P=j.interaction,I=j.interactionState,L=j.nextInteraction,T=j.nextInteractionState,_=j.timepointState,A=j.state,F=po(j,["interaction","interactionState","nextInteraction","nextInteractionState","timepointState","state"]);!function(e){var t,n=e.mode,i=e.player,o=e.timepoint,a=e.interaction,c=e.discardChanges,l=e.interactionState,s=e.timepointState,u=Qi(),f=n===R.Create;r.useEffect((function(){if(f){if(tn(null==a?void 0:a.id)||(null==l?void 0:l.hasChanges)||(null==s?void 0:s.hasChanges))return u.lock({id:"interactive",title:"Are you sure you want to leave?",text:"Your interactive still has unsaved changes"}),void i.lock((function(e){c(e)}));i.unlock(),u.unlock("interactive")}}),[a,null==l?void 0:l.hasChanges,null===(t=null==o?void 0:o.interactions)||void 0===t?void 0:t.length,null==s?void 0:s.hasChanges])}({mode:o,player:n,timepoint:x,interaction:P,discardChanges:F.discardChanges,interactionState:I,timepointState:_});var D={mode:o,open:k,isCreate:o===R.Create,interaction:P,nextInteraction:L,timepoint:x,interactive:a,interactionState:I,nextInteractionState:T,timepointState:_,player:n};return r.createElement(r.Fragment,null,!!l&&r.createElement(fo,{interactive:a,onClickEditDetails:e.onClickEditDetails,onClickPublish:e.onClickPublish,onClickDelete:e.onClickDelete,onClickCopy:e.onClickCopy,portalNode:l,parentVideo:w}),r.createElement(Ce,Object.assign({},D,F)),r.createElement(Ni,Object.assign({imageApi:c,currentUser:p,immediateFeedback:a.immediateFeedback,delayFocus:!O,enableImmersiveReader:g,experimentalInteractiveQuestions:E},D,F,C)),r.createElement(dn,Object.assign({title:t,currentUser:p,state:A,portalNode:u,progress:m,resultsService:d,imageCdnUrl:c.toString(),onShowSummary:e.onShowSummary,mobile:b},D,F)),r.createElement(vn,Object.assign({portalNode:s,experimentalInteractiveQuestions:E},D,F)))}ie.Z.registerComponent("Interactive",lo((function(e,t){return r.createElement(mo,Object.assign({player:e},t))})));function ho(e){var t=e.player;function n(){var e=t.getChild("ContinueSession");t.removeChild(e),e.dispose()}function i(){e.continue(!0),n()}return r.createElement(vt.G,{title:"Continue interactive?",closePopup:i,dialogClassName:"VVqKz"},r.createElement("p",null,"It looks like you've already started this interactive. Would you like to continue your attempt or start a new one?"),r.createElement(yt.u,{className:"kw8gW"},r.createElement(yt.u.Cancel,{text:"Start again",onClick:function(){e.continue(!1),n()}}),r.createElement(yt.u.Submit,{variant:"dark",text:"Continue",onClick:i})))}function vo(e){return vo="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},vo(e)}function yo(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,go(r.key),r)}}function go(e){var t=function(e){if("object"!=vo(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=vo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vo(t)?t:t+""}function bo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(bo=function(){return!!e})()}function wo(e){return wo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},wo(e)}function Eo(e,t){return Eo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Eo(e,t)}ie.Z.registerComponent("ContinueSession",lo((function(e,t){return r.createElement(ho,Object.assign({player:e},t))})));var So=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=wo(t),function(e,t){if(t&&("object"==vo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,bo()?Reflect.construct(t,n||[],wo(e).constructor):t.apply(e,n))}(this,t,[e])).enabled=!1,n.player.ready((function(){return n.initialize()})),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Eo(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.onReceiveMessage=this.onReceiveMessage.bind(this),window.addEventListener("message",this.onReceiveMessage,!1),window.parent.postMessage(JSON.stringify({type:"cv-app-loaded"}),"*")}},{key:"dispose",value:function(){window.removeEventListener("message",this.onReceiveMessage)}},{key:"onReceiveMessage",value:function(e){var t={};try{t=JSON.parse(e.data)}catch(e){return}"enable-grade-passback"===t.type&&(this.enabled=!0,window.removeEventListener("message",this.onReceiveMessage))}},{key:"submit",value:function(e,t){var n={type:"cv-lms-submit-score",data:{score:e,fullyGraded:t}};window.parent.postMessage(JSON.stringify(n),"*")}}])&&yo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getPlugin("plugin"));function ko(e){return ko="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},ko(e)}function xo(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,Oo(r.key),r)}}function Oo(e){var t=function(e){if("object"!=ko(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ko(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ko(t)?t:t+""}function Co(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Co=function(){return!!e})()}function No(e){return No=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},No(e)}function jo(e,t){return jo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},jo(e,t)}ie.Z.registerPlugin("gradePassbackPlugin",So);var Po=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=No(t),function(e,t){if(t&&("object"==ko(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Co()?Reflect.construct(t,n||[],No(e).constructor):t.apply(e,n))}(this,t,[e])).continueSession=!1,r.options=n,e.ready((function(){return r.initialize()})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jo(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this;this.player.gradePassbackPlugin(),xe.O.useTrack(this.player,"metadata","interactive",this.onTrackLoaded.bind(this)),this.player.addClass("cv-interactive-plugin"),this.options.resultsService&&!this.options.latestSession&&(this.startSession=this.startSession.bind(this),this.player.one("play",this.startSession),this.on("dispose",(function(){e.player.off("play",e.startSession)})))}},{key:"startSession",value:function(){var e,t=null===(e=this.options.latestSession)||void 0===e?void 0:e.resultId;this.continueSession||(t=null),this.options.resultsService.start(t)}},{key:"onTrackLoaded",value:function(e){var t=this;this.options.resultsService&&this.options.latestSession?this.player.addChild("ContinueSession",{continue:function(n){var r;null===(r=t.options.analyticsService)||void 0===r||r.logUserAction({},{actionType:f.Vw.Click,entity:f.py.Interactive,descriptor:n?f.r.ContinueSession:f.r.NewSession}),t.continueSession=n,t.startSession(),t.addChildren(e),t.continueSession||t.player.currentTime(0),t.player.play()}}):this.addChildren(e)}},{key:"getClipOffset",value:function(){return this.options.clipOffset?parseFloat(this.options.clipOffset.toPrecision(4)):null}},{key:"addChildren",value:function(e){this.player.addChild("Interactive",Object.assign(Object.assign({},this.options),{track:e,clipOffset:this.getClipOffset(),mode:this.options.mode||R.View,latestSession:this.continueSession&&this.options.latestSession})),this.player.controlBar.getChild("progressControl").getChild("SeekBar").addChild(new ke(this.player,{interactive:this.options.interactive,track:e}))}}])&&xo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getPlugin("plugin"));function Io(e){return Io="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},Io(e)}function Lo(){Lo=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Io(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Io(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function To(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ao(r.key),r)}}function Ao(e){var t=function(e){if("object"!=Io(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Io(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Io(t)?t:t+""}function Fo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Fo=function(){return!!e})()}function Do(e,t,n,r){var i=Ro(Mo(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function Ro(){return Ro="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Mo(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ro.apply(null,arguments)}function Mo(e){return Mo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Mo(e)}function Uo(e,t){return Uo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Uo(e,t)}ie.Z.registerPlugin("viewInteractivePlugin",Po),n(56728);var Vo=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=Mo(t),function(e,t){if(t&&("object"==Io(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Fo()?Reflect.construct(t,n||[],Mo(e).constructor):t.apply(e,n))}(this,t,[e,n])).totalProgress=[],Y.e.setToken("gateway",r.options.authToken),r.options.mode===R.Create&&r.player.addClass("cv-create-interactives"),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Uo(e,t)}(t,e),n=t,r=[{key:"togglePreviewPreventScrubbing",value:function(){var e=this.player.preventScrubbingPlugin();e&&e.togglePreview(!e.isPreviewing)}},{key:"getPlayerOptions",value:function(){var e=Do(t,"getPlayerOptions",this,3)([]);return e.setMaxHeight=!1,this.options.embed||(e.aspectRatio="16:9"),e.preferFullWindow=!0,e}},{key:"onFlushProgress",value:function(e){var n;Do(t,"onFlushProgress",this,3)([e]),this.options.mode!==R.Create&&(n=this.totalProgress).push.apply(n,function(e){return function(e){if(Array.isArray(e))return To(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return To(e,t);var n={}.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)?To(e,t):void 0}}(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.")}()}(e))}},{key:"additionalSetup",value:function(e){var n,r,i,o,a=this,c=Object.create(null,{additionalSetup:{get:function(){return Do(t,"additionalSetup",a,1)}}});return n=this,r=void 0,i=void 0,o=Lo().mark((function t(){return Lo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:c.additionalSetup.call(this,e),this.setupClipPlugin(e),this.setupPreventScrubbingPlugin(e);case 3:case"end":return t.stop()}}),t,this)})),new(i||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function c(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}l((o=o.apply(n,r||[])).next())}))}},{key:"setupAnalyticsDependentPlugins",value:function(e){Do(t,"setupAnalyticsDependentPlugins",this,3)([e]),this.setupViewInteractivePlugin(e)}},{key:"handleAutoplay",value:function(e){var n;this.options.collectResults&&this.options.currentUser&&this.options.shareId&&(null===(n=e.additionalData)||void 0===n?void 0:n.latestSession)?this.options.autoplay&&this.showSplash():Do(t,"handleAutoplay",this,3)([e])}},{key:"setupPreventScrubbingPlugin",value:function(e){var t,n;if(null===(t=e.additionalData)||void 0===t?void 0:t.interactive){var r=e.additionalData.interactive,i=this.options.mode===R.Create||!this.options.collectResults;this.player.preventScrubbingPlugin({isEnabled:!i&&r.preventScrubbing,furthestVisitedTime:null!==(n=this.options.furthestVisitedTime)&&void 0!==n?n:0})}}},{key:"setupClipPlugin",value:function(e){var t;if(null===(t=null==e?void 0:e.additionalData)||void 0===t?void 0:t.clipData){var n=e.additionalData.clipData;this.player.clipPlugin({startTime:n.startTime,endTime:n.endTime})}}},{key:"filterNewQuestionTypes",value:function(e){var t;return Object.assign(Object.assign({},e),{timepoints:null===(t=e.timepoints)||void 0===t?void 0:t.map((function(e){var t;return Object.assign(Object.assign({},e),{interactions:null===(t=e.interactions)||void 0===t?void 0:t.filter((function(e){return!x.IL[e.typeId]}))})})).filter((function(e){var t;return!!(null===(t=e.interactions)||void 0===t?void 0:t.length)}))})}},{key:"validateCollectResultsOptions",value:function(){var e=!!this.options.publicName&&!!this.options.profileId;this.options.currentUser||e||B.Q.Ry.throw(new ne.H("Must provide a currentUser or PublicName and ProfileId in order to collect interactive results")),this.options.shareId||B.Q.Ry.throw(new ne.H("Must provide a shareId in order to collect interactive results"))}},{key:"setupViewInteractivePlugin",value:function(e){var t;this.track=function(e,t){var n,r=e.addTextTrack("metadata","interactive"),i=t.additionalData.interactive,o=null===(n=t.additionalData.clipData)||void 0===n?void 0:n.startTime;return i.timepoints.forEach((function(e){var t,n=e.visibleAt/1e3,i=e.visibleFor?n+e.visibleFor/1e3:n+1;o&&(n+=o,i+=o),(null===(t=e.interactions)||void 0===t?void 0:t.length)&&r.addCue({startTime:Math.max(.001,n-.001),endTime:i,text:e.id})})),r}(this.player,e);var n=e.additionalData.interactive;this.options.experimentalInteractiveQuestions||(n=this.filterNewQuestionTypes(n));var r=null===(t=e.additionalData.clipData)||void 0===t?void 0:t.startTime;this.options.collectResults&&(this.validateCollectResultsOptions(),this.resultsService=new te({interactiveId:n.id,metadataId:e.mediaId,userId:this.options.currentUser.id,customerId:this.options.currentUser.customerId,playerApi:this.options.playerApi,shareId:this.options.shareId,publicName:this.options.publicName,profileId:this.options.profileId})),this.player.viewInteractivePlugin({interactive:n,title:e.title,mode:this.options.mode,imageApi:this.options.imageApi,resultsService:this.resultsService,actionsPortalNode:this.options.actionsPortalNode,questionListPortalNode:this.options.questionListPortalNode,summaryPortalNode:this.options.summaryPortalNode,currentUser:this.options.currentUser,latestSession:e.additionalData.latestSession,progress:this.totalProgress,parentVideo:this.options.parentVideo,clipOffset:r,analyticsService:this.analyticsService,enableImmersiveReader:this.options.enableImmersiveReader,onShowSummary:this.options.onShowSummary,onClickCopy:this.options.onClickCopy,onClickEditDetails:this.options.onClickEditDetails,onClickPublish:this.options.onClickPublish,onClickDelete:this.options.onClickDelete,mobile:this.options.mobile,experimentalInteractiveQuestions:this.options.experimentalInteractiveQuestions})}},{key:"getAdditionalAnalyticsData",value:function(e){var t,n,r,i;return(null===(n=null===(t=e.additionalData)||void 0===t?void 0:t.clipData)||void 0===n?void 0:n.clipId)?{clip:{id:null===(i=null===(r=e.additionalData)||void 0===r?void 0:r.clipData)||void 0===i?void 0:i.clipId}}:{}}},{key:"getSeekBarOptions",value:function(){return{ignoreChapters:!0}}},{key:"getAnalyticsPlayerType",value:function(){return"interactive-player"}},{key:"setActivityStatus",value:function(e,t){this.player.activityStatusPlugin().setActivityStatus(e,t)}}],r&&_o(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(re.r);function Bo(e){return new Proxy(e,{get:function(e,t,n){if("off"===t||!e.isDisposed())return Reflect.get(e,t,n)}})}var qo=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 Go(e){var t=e.onReady,n=e.className,i=qo(e,["onReady","className"]),o=r.useRef(null);return r.useEffect((function(){var e=new Vo(o.current,i);return t&&e.ready((function(){t(Bo(e))})),function(){window.requestAnimationFrame((function(){return e.dispose()}))}}),[]),r.createElement(r.Fragment,null,r.createElement("div",{ref:o,className:n}),r.createElement("div",{id:"popup-region"}))}var Zo={placeholder:"YUoDl"};function zo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ho(){return r.createElement("div",{className:"".concat(Zo.placeholder," partial-loading-background")})}function Wo(e){var t,n,i,o=(n=r.useState(),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,i)||function(e,t){if(e){if("string"==typeof e)return zo(e,t);var n={}.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)?zo(e,t):void 0}}(n,i)||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.")}()),a=o[0],c=o[1];return r.useEffect((function(){e.createViewKey(null,(function(e){c(e.get("viewKey"))}))}),[e.video.id]),a?r.createElement("div",{className:"col-12 mb-3 p-0"},r.createElement(Go,{playerApi:new URL(e.config.get("playerApiUrl")),viewKey:a,currentUser:e.currentUser,imageApi:new URL(e.config.get("imageCdnUrl")),furthestVisitedTime:null===(t=e.video._videoProgress)||void 0===t?void 0:t.furthest})):r.createElement(Ho,null)}var Qo=n(82602),Yo={avatarContainer:"hwnEk",comment:"LyFKD"},Ko="libraryRequests.comments",$o=Qe.T.encloseNamespace(Ko);function Xo(e){var t,n,i,o,a,c,l=e.comment,s="".concat(null===(t=l.user)||void 0===t?void 0:t.name," ").concat(null===(n=l.user)||void 0===n?void 0:n.surname);return l.user||(s=$o("deletedUser")),r.createElement("div",{className:"d-flex ".concat(Yo.comment)},r.createElement("div",{className:"".concat(Yo.avatarContainer," me-2 flex-shrink-0")},r.createElement(_e.q,{imageUrl:null===(o=null===(i=l.user)||void 0===i?void 0:i.avatar)||void 0===o?void 0:o.url,imageCdnUrl:e.imageCdnUrl,initials:We.l.getInitials(null===(a=l.user)||void 0===a?void 0:a.name,null===(c=l.user)||void 0===c?void 0:c.surname)})),r.createElement("div",null,r.createElement("span",{className:"fw-bold pe-2"},s),r.createElement("span",{className:"text-secondary"},(0,Qo.WU)(l.dateCreated)),r.createElement("p",{className:"mb-0"},l.message)))}function Jo(e){var t;return(null===(t=e.comments)||void 0===t?void 0:t.length)?r.createElement("div",{className:"pb-3 border-bottom mb-3"},r.createElement("h2",{className:"h5"},r.createElement(i.x,{namespace:Ko,phrase:"comments"})),r.createElement("div",{className:"border rounded p-2"},e.comments.map((function(t,n){return r.createElement(Xo,{key:n,comment:t,imageCdnUrl:e.imageCdnUrl})})))):r.createElement(r.Fragment,null)}var ea=n(10657),ta=n(41087),na=n(47673),ra=n(50997),ia=n(89707),oa={seriesLink:"Z5BW7"};function aa(e){var t,n;return(null===(n=null===(t=e.items)||void 0===t?void 0:t.data)||void 0===n?void 0:n.length)?r.createElement("p",{className:"mb-0"},e.items.data.map((function(e,t){return r.createElement("span",{key:t},e.name)}))):null}function ca(e){var t,n,i,o,a,c,l,s,u,f,d,p,m,h,v=e.libraryRequest.object;return r.createElement("div",{className:"row"},((null==v?void 0:v.name)||e.libraryRequest.name)&&r.createElement(y,{phrase:"title"},(null==v?void 0:v.name)||e.libraryRequest.name),!!v&&r.createElement(r.Fragment,null,!!v.series&&r.createElement(y,{phrase:"series"},r.createElement("a",{target:"_blank",href:(p=v.series,m=e.config,h="series/".concat(p.id),ia.k.getMainProductUrl(m,h,h)),className:"".concat(oa.seriesLink," text-reset")},v.series.name,r.createElement(na.Q,{video:v,withSeriesTitle:!0}))),!!(null===(t=v.rating)||void 0===t?void 0:t.code)&&r.createElement(y,{phrase:"rating"},r.createElement("div",{className:"d-flex"},r.createElement(ta.C,{type:ta.g.Rating,data:v.rating}))),!!v.description&&r.createElement(y,{phrase:"description"},r.createElement("span",{className:"pre-wrap"},v.description)),!!v.productionYear&&r.createElement(y,{phrase:"productionYear"},v.productionYear),!!(null===(i=null===(n=v.producers)||void 0===n?void 0:n.data)||void 0===i?void 0:i.length)&&r.createElement(y,{phrase:"producers"},r.createElement(aa,{items:v.producers})),!!(null===(a=null===(o=v.directors)||void 0===o?void 0:o.data)||void 0===a?void 0:a.length)&&r.createElement(y,{phrase:"directors"},r.createElement(aa,{items:v.directors})),!!(null===(l=null===(c=v.productionCompanies)||void 0===c?void 0:c.data)||void 0===l?void 0:l.length)&&r.createElement(y,{phrase:"productionCompanies"},r.createElement(aa,{items:v.productionCompanies})),!!(null===(u=null===(s=v.distributors)||void 0===s?void 0:s.data)||void 0===u?void 0:u.length)&&r.createElement(y,{phrase:"distributors"},r.createElement(aa,{items:v.distributors})),!e.hideBroadcastInfo&&!!(null===(f=v.channel)||void 0===f?void 0:f.name)&&r.createElement(y,{phrase:"channel"},null===(d=v.channel)||void 0===d?void 0:d.name),!e.hideBroadcastInfo&&!!v.dateBroadcast&&r.createElement(y,{phrase:"broadcastDate"},ea.O.format(v.dateBroadcast,ra.K4.FULL_YEAR))))}var la,sa,ua=n(38465),fa=n(33937);function da(e){return da="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},da(e)}function pa(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,ma(r.key),r)}}function ma(e){var t=function(e){if("object"!=da(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=da(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==da(t)?t:t+""}!function(e){e.AppleTv="apple-tv",e.Vivi="vivi"}(la||(la={})),function(e){e.Available="available",e.Offline="offline",e.Busy="busy"}(sa||(sa={}));var ha=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this[Symbol.toStringTag]=t[Symbol.toStringTag],this.innerPromise=t,this.onTimeout=n,this.bindFunctions()}return t=e,r=[{key:"reject",value:function(t){return new e(Promise.reject(t))}},{key:"fromPromise",value:function(t){return new e(t)}}],(n=[{key:"bindFunctions",value:function(){this.timeout=this.timeout.bind(this),this.then=this.then.bind(this),this.catch=this.catch.bind(this),this.finally=this.finally.bind(this)}},{key:"timeout",value:function(e){var t=this;return new Promise((function(n,r){t.then(n).catch(r).finally((function(){return clearTimeout(i)}));var i=setTimeout((function(){var e;null===(e=t.onTimeout)||void 0===e||e.call(t),r(new Error("Promise timed out"))}),e)}))}},{key:"then",value:function(e,t){return this.innerPromise.then(e,t)}},{key:"catch",value:function(e){return this.innerPromise.catch(e)}},{key:"finally",value:function(e){return this.innerPromise.finally(e)}}])&&pa(t.prototype,n),r&&pa(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function va(e){return va="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},va(e)}function ya(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ga(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,wa(r.key),r)}}function ba(e,t,n){return t&&ga(e.prototype,t),n&&ga(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function wa(e){var t=function(e){if("object"!=va(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=va(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==va(t)?t:t+""}Symbol.toStringTag;var Ea=function(){return ba((function e(){ya(this,e),this.callbacks=[],this.predicates=[],this.controller=new AbortController,this.signal=this.controller.signal,this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.isDisposed=this.isDisposed.bind(this)}),[{key:"trigger",value:function(e){var t=this;this.callbacks.forEach((function(n,r){var i=t.predicates[r];i&&!i(e)||n(e)}))}},{key:"on",value:function(e){var t=this;this.isDisposed()&&console.warn("This EventChannel instance been disposed - this is a no-op");var n=this.callbacks.length;this.callbacks[n]=e,this.predicates[n]=function(){return!0};var r=function(){t.off(e)};return{off:r,filter:function(e){return t.predicates[n]=e,r}}}},{key:"one",value:function(){var e,t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0};return this.isDisposed()?ha.reject(new Error("This EventChannel instance has been disposed")):new ha(new Promise((function(r,i){e=t.on((function(n){t.signal.removeEventListener("abort",o),e(),r(n)})).filter(n);var o=function(){e(),i(new Error("Aborted while waiting for message"))};t.signal.addEventListener("abort",o,{once:!0})})),(function(){e()}))}},{key:"off",value:function(e){var t=this.callbacks.indexOf(e);-1!==t&&(this.callbacks.splice(t,1),this.predicates.splice(t,1))}},{key:"dispose",value:function(){this.callbacks.length=0,this.predicates.length=0,this.controller.abort()}},{key:"isDisposed",value:function(){return this.signal.aborted}}])}(),Sa=function(){return ba((function e(){ya(this,e),this.channels={},this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.getChannel=this.getChannel.bind(this)}),[{key:"trigger",value:function(e,t){this.getChannel(e).trigger(t)}},{key:"on",value:function(e,t){return this.getChannel(e).on(t)}},{key:"one",value:function(e,t){return this.getChannel(e).one(t)}},{key:"off",value:function(e,t){this.getChannel(e).off(t)}},{key:"dispose",value:function(){this.trigger("dispose",ka.void),Object.values(this.channels).forEach((function(e){return e.dispose()})),this.channels={}}},{key:"getChannel",value:function(e){return this.channels[e]||(this.channels[e]=new Ea),this.channels[e]}}])}(),ka={void:void 0};function xa(e){return xa="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},xa(e)}function Oa(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,Ca(r.key),r)}}function Ca(e){var t=function(e){if("object"!=xa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=xa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xa(t)?t:t+""}var Na,ja,Pa,Ia=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bindFunctions()},(t=[{key:"bindFunctions",value:function(){this.schedule=this.schedule.bind(this),this.every=this.every.bind(this),this.trigger=this.trigger.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this)}},{key:"schedule",value:function(e){return this.task=e,this}},{key:"every",value:function(e){return this.intervalInMilliseconds=e,this}},{key:"trigger",value:function(){var e;return null===(e=this.task)||void 0===e||e.call(this,this),this}},{key:"start",value:function(){var e=this;return this.intervalId||(this.intervalId=setInterval((function(){return e.trigger()}),this.intervalInMilliseconds)),this}},{key:"stop",value:function(){return this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this}}])&&Oa(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),La=n(90244),Ta=function(e,t){return e._lastModified||(e._lastModified={}),new Proxy(e,{set:function(n,r,i,o){var a=e._lastModified[r.toString()];return!!(a&&Date.now()<a+t)||Reflect.set(n,r,i,o)}})},_a=function(e){return e._lastModified||(e._lastModified={}),new Proxy(e,{set:function(t,n,r,i){return e._lastModified[n.toString()]=Date.now(),Reflect.set(t,n,r,i)}})};function Aa(e){return Aa="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},Aa(e)}function Fa(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,Ra(r.key),r)}}function Da(e,t,n){return t&&Fa(e.prototype,t),n&&Fa(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ra(e){var t=function(e){if("object"!=Aa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Aa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Aa(t)?t:t+""}!function(e){e[e.Offline=0]="Offline",e[e.Online=1]="Online",e[e.Locked=2]="Locked",e[e.Suspended=3]="Suspended"}(Na||(Na={})),function(e){e[e.PlaybackStatusChange=0]="PlaybackStatusChange",e[e.PositionChange=1]="PositionChange"}(ja||(ja={})),function(e){e.Begin="BEGIN",e.Play="PLAY",e.Pause="PAUSE",e.Load="LOAD",e.Scan="SCAN",e.Stop="STOP"}(Pa||(Pa={}));var Ma=Da((function e(t,n){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.title=t,this.device=n,this.locked=!1,this.position=0,this.playbackStatus=Pa.Load,this.debounced=Ta(this,2e3),_a(this)}));function Ua(e){return Ua="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},Ua(e)}function Va(){Va=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Ua(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ua(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ba(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,qa(r.key),r)}}function qa(e){var t=function(e){if("object"!=Ua(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ua(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ua(t)?t:t+""}function Ga(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ga=function(){return!!e})()}function Za(){return Za="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=za(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Za.apply(null,arguments)}function za(e){return za=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},za(e)}function Ha(e,t){return Ha=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ha(e,t)}var Wa=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=za(t),function(e,t){if(t&&("object"==Ua(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Ga()?Reflect.construct(t,n||[],za(e).constructor):t.apply(e,n))}(this,t)).client=e,r.localState=new Ma(n.title,n.device),r.bindFunctions(),r.initialize(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ha(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.handleDisconnected=this.handleDisconnected.bind(this),this.handleAllVideoMessages=this.handleAllVideoMessages.bind(this),this.handlePlaybackChange=this.handlePlaybackChange.bind(this),this.handlePositionChange=this.handlePositionChange.bind(this),this.loadSource=this.loadSource.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.isPlaying=this.isPlaying.bind(this),this.getPosition=this.getPosition.bind(this),this.getDuration=this.getDuration.bind(this),this.getVolume=this.getVolume.bind(this)}},{key:"initialize",value:function(){this.client.on("dispose",this.dispose),this.client.on("disconnected",this.handleDisconnected),this.client.on("message",this.handleAllVideoMessages)}},{key:"dispose",value:function(){var e,n,r;this.client.off("dispose",this.dispose),this.client.off("disconnected",this.handleDisconnected),this.client.off("message",this.handleAllVideoMessages),this.client.stop(this.getDevice().id).catch((function(e){return console.error(e)})),(e=t,n=this,"function"==typeof(r=Za(za(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{key:"handleDisconnected",value:function(){this.trigger("error",new Error("The connection to the Apple TV has been lost and cannot be recovered"))}},{key:"handleAllVideoMessages",value:function(e){if(e.deviceId===this.getDevice().id){var t=this.localState.debounced;switch(e.event){case ja.PlaybackStatusChange:this.handlePlaybackChange(t,e);break;case ja.PositionChange:this.handlePositionChange(t,e)}}}},{key:"handlePlaybackChange",value:function(e,t){e.playbackStatus!==t.params.playbackStatus&&(e.playbackStatus=t.params.playbackStatus,this.trigger("playingchange",ka.void),e.playbackStatus===Pa.Stop&&this.dispose())}},{key:"handlePositionChange",value:function(e,t){e.position!==t.params.position&&(e.position=t.params.position,this.trigger("positionchange",ka.void))}},{key:"loadSource",value:function(){return e=this,t=void 0,n=void 0,r=Va().mark((function e(){return Va().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!this.localState.locked){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.client.lock(this.getDevice().id);case 5:return this.localState.locked=!0,e.next=8,this.client.loadVideo(this.getDevice().id);case 8:this.trigger("sourceloaded",ka.void),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(0),console.error(e.t0),this.trigger("error",new Error("Could not load video on Apple TV device"));case 15:case"end":return e.stop()}}),e,this,[[0,11]])})),new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}},{key:"play",value:function(){this.localState.locked&&this.localState.playbackStatus!==Pa.Play&&(this.localState.playbackStatus=Pa.Play,this.client.play(this.getDevice().id),this.trigger("playingchange",ka.void))}},{key:"pause",value:function(){this.localState.locked&&this.localState.playbackStatus!==Pa.Pause&&(this.localState.playbackStatus=Pa.Pause,this.client.pause(this.getDevice().id),this.trigger("playingchange",ka.void))}},{key:"seek",value:function(e){this.localState.locked&&this.localState.position!==e&&(this.localState.position=e,this.client.seek(this.getDevice().id,e),this.trigger("positionchange",ka.void))}},{key:"setVolume",value:function(){console.info("Setting the volume is not supported on Apple TV")}},{key:"setMuted",value:function(){console.info("Muting is not supported on Apple TV")}},{key:"setSubtitles",value:function(){console.info("Subtitles are not supported on Apple TV")}},{key:"isPlaying",value:function(){return this.localState.playbackStatus===Pa.Play||this.localState.playbackStatus===Pa.Begin||this.localState.playbackStatus===Pa.Load}},{key:"isPlaybackFinished",value:function(){return this.localState.playbackStatus===Pa.Stop}},{key:"getPosition",value:function(){return this.localState.position}},{key:"getDuration",value:function(){}},{key:"getVolume",value:function(){return 1}},{key:"getMuted",value:function(){return!1}},{key:"getSubtitles",value:function(){}},{key:"getDevice",value:function(){return this.localState.device}},{key:"getTitle",value:function(){return this.localState.title}}],r&&Ba(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Sa);function Qa(e){return Qa="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},Qa(e)}function Ya(){Ya=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Qa(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Qa(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ka(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,$a(r.key),r)}}function $a(e){var t=function(e){if("object"!=Qa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Qa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qa(t)?t:t+""}function Xa(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Xa=function(){return!!e})()}function Ja(){return Ja="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ec(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ja.apply(null,arguments)}function ec(e){return ec=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ec(e)}function tc(e,t){return tc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},tc(e,t)}var nc,rc,ic,oc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))};!function(e){e.DeviceList="DeviceList",e.DeviceStateChange="DeviceStateChange",e.Paired="Paired",e.Unpaired="Unpaired",e.PlayStatusChange="PlayStatusChange",e.TimeSync="TimeSync"}(nc||(nc={})),function(e){e.Command="Command",e.Pair="Pair",e.Unpair="Unpair",e.RenameDevice="Renamedevice",e.Subscribe="Subscribe",e.Lock="Lock"}(rc||(rc={})),function(e){e[e.Connecting=0]="Connecting",e[e.Connected=1]="Connected",e[e.Reconnecting=2]="Reconnecting",e[e.Disconnected=4]="Disconnected"}(ic||(ic={}));var ac=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=ec(t),function(e,t){if(t&&("object"==Qa(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Xa()?Reflect.construct(t,n||[],ec(e).constructor):t.apply(e,n))}(this,t)).options=e,n.accessToken=void 0,n.devices=[],n.heartbeat=new Ia,n.bindFunctions(),n.initialize(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&tc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.connect=this.connect.bind(this),this.subscribe=this.subscribe.bind(this),this.tryFixConnection=this.tryFixConnection.bind(this),this.invoke=this.invoke.bind(this),this.invokeDebounced=(0,La.Ds)(this.invoke,500,!0),this.handleDeviceList=this.handleDeviceList.bind(this),this.handleDeviceStateChange=this.handleDeviceStateChange.bind(this),this.handleDevicePaired=this.handleDevicePaired.bind(this),this.handleDeviceUnpaired=this.handleDeviceUnpaired.bind(this),this.handlePlayStatusChange=this.handlePlayStatusChange.bind(this),this.handleTimeSync=this.handleTimeSync.bind(this),this.dispose=this.dispose.bind(this),this.canCastToDevice=this.canCastToDevice.bind(this),this.getDevices=this.getDevices.bind(this),this.startCastSession=this.startCastSession.bind(this),this.lock=this.lock.bind(this),this.loadVideo=this.loadVideo.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.stop=this.stop.bind(this),this.pair=this.pair.bind(this),this.unpair=this.unpair.bind(this),this.renameDevice=this.renameDevice.bind(this)}},{key:"initialize",value:function(){return oc(this,void 0,void 0,Ya().mark((function e(){return Ya().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.options.fetchAccessToken();case 3:return this.accessToken=e.sent,this.connection=(0,fa.OB)(this.accessToken.host,{logging:!1}),this.hubProxy=this.connection.createHubProxy("DeviceUserHub"),this.hubProxy.on(nc.DeviceList,this.handleDeviceList),this.hubProxy.on(nc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.on(nc.Paired,this.handleDevicePaired),this.hubProxy.on(nc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.on(nc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.on(nc.TimeSync,this.handleTimeSync),e.next=14,this.connect();case 14:return e.next=16,this.subscribe(this.accessToken.token);case 16:this.heartbeat.schedule(this.tryFixConnection).every(5e3).start(),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(0),console.error(e.t0),this.trigger("error",new Error("Could not connect to Online API"));case 23:case"end":return e.stop()}}),e,this,[[0,19]])})))}},{key:"connect",value:function(){return oc(this,void 0,void 0,Ya().mark((function e(){var t=this;return Ya().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){t.connection.start({jsonp:!1,withCredentials:!1}).done((function(){return e()})).fail((function(){return n(new Error("Could not connect to SignalR hub"))}))})));case 1:case"end":return e.stop()}}),e)})))}},{key:"subscribe",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Subscribe,e);case 2:if(t.sent){t.next=5;break}throw new Error("The subscription request was rejected by Online API");case 5:case"end":return t.stop()}}),t,this)})))}},{key:"tryFixConnection",value:function(){return oc(this,void 0,void 0,Ya().mark((function e(){return Ya().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection.state===ic.Disconnected){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,this.heartbeat.stop(),e.next=6,this.options.fetchAccessToken();case 6:return this.accessToken=e.sent,e.next=9,this.connect();case 9:return e.next=11,this.subscribe(this.accessToken.token);case 11:e.next=17;break;case 13:e.prev=13,e.t0=e.catch(2),console.warn(e.t0),console.warn("Could not reconnect to Online API");case 17:return e.prev=17,this.heartbeat.start(),e.finish(17);case 20:case"end":return e.stop()}}),e,this,[[2,13,17,20]])})))}},{key:"invoke",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return oc(this,void 0,void 0,Ya().mark((function t(){var r,i=this;return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new Promise((function(t,r){var o,a;(null===(a=i.hubProxy)||void 0===a?void 0:(o=a).invoke.apply(o,[e].concat(n))).done(t).fail(r)})),t.abrupt("return",ha.fromPromise(r).timeout(2e4));case 2:case"end":return t.stop()}}),t)})))}},{key:"handleDeviceList",value:function(e){this.devices=e.filter((function(e){return"vivi"!==e.type})).map(t.convertToGenericDevice),this.trigger("deviceschange",ka.void)}},{key:"handleDeviceStateChange",value:function(e){var n=this.devices.findIndex((function(t){return t.id===e.deviceId}));n>=0&&(this.devices[n]=t.convertToGenericDevice(e),this.trigger("deviceschange",ka.void))}},{key:"handleDevicePaired",value:function(e){"vivi"!==e.type&&(this.devices.push(t.convertToGenericDevice(e)),this.trigger("deviceschange",ka.void))}},{key:"handleDeviceUnpaired",value:function(e){this.devices=this.devices.filter((function(t){return t.id!==e})),this.trigger("deviceschange",ka.void)}},{key:"handlePlayStatusChange",value:function(e,t){this.trigger("message",{event:ja.PlaybackStatusChange,deviceId:e,params:{playbackStatus:t.commandType}})}},{key:"handleTimeSync",value:function(e,t){this.trigger("message",{event:ja.PositionChange,deviceId:e,params:{position:t}})}},{key:"dispose",value:function(){var e,n,r;this.hubProxy.off(nc.DeviceList,this.handleDeviceList),this.hubProxy.off(nc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.off(nc.Paired,this.handleDevicePaired),this.hubProxy.off(nc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.off(nc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.off(nc.TimeSync,this.handleTimeSync),this.hubProxy.connection.stop(!1,!0),this.heartbeat.stop(),(e=t,n=this,"function"==typeof(r=Ja(ec(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{key:"canCastToDevice",value:function(e){return e===la.AppleTv}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new Wa(this,e)}},{key:"lock",value:function(e){var t;return oc(this,void 0,void 0,Ya().mark((function n(){return Ya().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.invoke(rc.Lock,e,this.options.userId,null!==(t=this.options.username)&&void 0!==t?t:"");case 2:if(n.sent){n.next=5;break}throw new Error("Could not lock device");case 5:case"end":return n.stop()}}),n,this)})))}},{key:"loadVideo",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.options.trackingCode){t.next=2;break}throw new Error("Tracking code must be provided to cast videos");case 2:return t.next=4,this.invoke(rc.Command,{DeviceId:e,CommandType:Pa.Play,Data:this.options.trackingCode});case 4:case"end":return t.stop()}}),t,this)})))}},{key:"play",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Command,{DeviceId:e,CommandType:Pa.Play});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Command,{DeviceId:e,CommandType:Pa.Pause});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"seek",value:function(e,t){this.invokeDebounced(rc.Command,{DeviceId:e,CommandType:Pa.Play,Params:"1,".concat(Math.trunc(t))})}},{key:"stop",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Command,{DeviceId:e,CommandType:Pa.Stop});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pair",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){var n;return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Pair,e);case 2:if(n=t.sent){t.next=5;break}throw new Error("Could not pair device");case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"unpair",value:function(e){return oc(this,void 0,void 0,Ya().mark((function t(){return Ya().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(rc.Unpair,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"renameDevice",value:function(e){var t=e.deviceId,n=e.deviceName;return oc(this,void 0,void 0,Ya().mark((function e(){return Ya().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke(rc.RenameDevice,t,n);case 2:if(e.sent){e.next=5;break}throw new Error("Could not rename device");case 5:case"end":return e.stop()}}),e,this)})))}}],i=[{key:"convertToGenericDeviceStatus",value:function(e){switch(e){case Na.Online:return sa.Available;case Na.Locked:return sa.Busy;case Na.Suspended:case Na.Offline:return sa.Offline}}},{key:"convertToGenericDevice",value:function(e){return{id:e.deviceId,name:e.name,type:la.AppleTv,status:t.convertToGenericDeviceStatus(e.status)}}}],r&&Ka(n.prototype,r),i&&Ka(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Sa);function cc(e){return cc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cc(e)}function lc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,sc(r.key),r)}}function sc(e){var t=function(e){if("object"!=cc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=cc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==cc(t)?t:t+""}var uc={reconnectIntervalInMilliseconds:3e3,heartbeatEnabled:!1,heartbeatIntervalInMillseconds:1e4,heartbeatMessage:""},fc=function(){return e=function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:uc;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bindFunctions(),this.url=t,this.options=Object.assign(Object.assign({},uc),r),this.webSocket=this.connect(),this.heartbeat=(new Ia).schedule((function(){return n.send(n.options.heartbeatMessage)})).every(this.options.heartbeatIntervalInMillseconds)},(t=[{key:"bindFunctions",value:function(){this.cleanup=this.cleanup.bind(this),this.handleOpen=this.handleOpen.bind(this),this.handleMessage=this.handleMessage.bind(this),this.handleClose=this.handleClose.bind(this),this.handleError=this.handleError.bind(this),this.connect=this.connect.bind(this),this.send=this.send.bind(this),this.dipose=this.dipose.bind(this)}},{key:"cleanup",value:function(){this.heartbeat.stop(),this.webSocket.removeEventListener("error",this.handleError),this.webSocket.removeEventListener("message",this.handleMessage),this.webSocket.removeEventListener("open",this.handleOpen),this.webSocket.removeEventListener("close",this.handleClose)}},{key:"handleOpen",value:function(e){var t;null===(t=this.onOpen)||void 0===t||t.call(this,e),this.options.heartbeatEnabled&&this.heartbeat.start()}},{key:"handleMessage",value:function(e){var t;null===(t=this.onMessage)||void 0===t||t.call(this,e)}},{key:"handleClose",value:function(e){var t,n=this;null===(t=this.onClose)||void 0===t||t.call(this,e),this.cleanup(),setTimeout((function(){n.webSocket=n.connect()}),this.options.reconnectIntervalInMilliseconds)}},{key:"handleError",value:function(e){var t;null===(t=this.onError)||void 0===t||t.call(this,e),this.handleClose()}},{key:"connect",value:function(){var e=new WebSocket(this.url);return e.addEventListener("open",this.handleOpen),e.addEventListener("message",this.handleMessage),e.addEventListener("close",this.handleClose),e.addEventListener("error",this.handleError),e}},{key:"send",value:function(e){this.webSocket.send(e)}},{key:"dipose",value:function(){this.cleanup(),this.webSocket.close()}}])&&lc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),dc=n(27993);function pc(e){return pc="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},pc(e)}function mc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,hc(r.key),r)}}function hc(e){var t=function(e){if("object"!=pc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=pc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pc(t)?t:t+""}var vc,yc=function(){return e=function e(t,n){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._timerStartedAt=0,this.position=0,this.duration=void 0,this.playing=!1,this.mute=!1,this.videoSource="",this.subtitleSource="",this.subtitles=!1,this.volume=0,this.title=t,this.device=n,this.ready=!1,this.playbackFinished=!1,this.debounced=Ta(this,2e3),_a(this)},(t=[{key:"position",get:function(){return this._position+this.getTimerDurationInSeconds()},set:function(e){this._position=e,this.restartTimer()}},{key:"playing",get:function(){return this._playing},set:function(e){this._playing=e,e?this.restartTimer():(this._position+=this.getTimerDurationInSeconds(),this.stopTimer())}},{key:"restartTimer",value:function(){this._timerStartedAt=Date.now()}},{key:"stopTimer",value:function(){this._timerStartedAt=0}},{key:"getTimerDurationInSeconds",value:function(){return this._timerStartedAt?(Date.now()-this._timerStartedAt)/1e3:0}}])&&mc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function gc(e){return gc="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},gc(e)}function bc(){bc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==gc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(gc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function wc(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,Ec(r.key),r)}}function Ec(e){var t=function(e){if("object"!=gc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=gc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gc(t)?t:t+""}function Sc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Sc=function(){return!!e})()}function kc(){return kc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=xc(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},kc.apply(null,arguments)}function xc(e){return xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xc(e)}function Oc(e,t){return Oc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Oc(e,t)}!function(e){e.Update="update",e.Volume="volume",e.Playing="playing",e.Paused="paused",e.NewChapter="new_chapter",e.Stopped="stopped",e.Ready="ready",e.Mute="mute",e.Finished="finished",e.Subtitles="subtitles"}(vc||(vc={}));var Cc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Nc=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=xc(t),function(e,t){if(t&&("object"==gc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Sc()?Reflect.construct(t,n||[],xc(e).constructor):t.apply(e,n))}(this,t)).client=e,r.localState=new yc(n.title,n.device),r.bindFunctions(),r.initialize(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Oc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.handleClientConnected=this.handleClientConnected.bind(this),this.handleDisconnectMessage=this.handleDisconnectMessage.bind(this),this.handleAllVideoMessages=this.handleAllVideoMessages.bind(this),this.handleUpdateMessage=this.handleUpdateMessage.bind(this),this.handleVolumeMessage=this.handleVolumeMessage.bind(this),this.handlePlayingMessage=this.handlePlayingMessage.bind(this),this.handlePausedMessage=this.handlePausedMessage.bind(this),this.handleFinishedMessage=this.handleFinishedMessage.bind(this),this.handleNewChapterMessage=this.handleNewChapterMessage.bind(this),this.handleStoppedMessage=this.handleStoppedMessage.bind(this),this.loadSource=this.loadSource.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.isPlaying=this.isPlaying.bind(this),this.getPosition=this.getPosition.bind(this),this.getDuration=this.getDuration.bind(this),this.getVolume=this.getVolume.bind(this)}},{key:"initialize",value:function(){var e=this;this.client.on("dispose",this.dispose),this.client.on("connected",this.handleClientConnected),this.client.on("message",this.handleDisconnectMessage).filter((function(t){return t.source===e.getDevice().id&&"disconnect"===t.message.type})),this.client.on("message",this.handleAllVideoMessages).filter((function(t){return t.source===e.getDevice().id&&"video_event"===t.message.type}))}},{key:"dispose",value:function(){var e,n,r;this.client.off("dispose",this.dispose),this.client.off("connected",this.handleClientConnected),this.client.off("message",this.handleDisconnectMessage),this.client.off("message",this.handleAllVideoMessages),this.client.stop(this.getDevice().id).catch((function(e){return console.error(e)})),(e=t,n=this,"function"==typeof(r=kc(xc(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{key:"handleClientConnected",value:function(){return Cc(this,void 0,void 0,bc().mark((function e(){return bc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.client.joinRoom(this.getDevice().id);case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),this.trigger("error",e.t0);case 8:case"end":return e.stop()}}),e,this,[[0,5]])})))}},{key:"handleDisconnectMessage",value:function(){this.dispose()}},{key:"handleAllVideoMessages",value:function(e){var t=this.localState.debounced,n=e.message.payload.params||{};switch(e.message.payload.event){case vc.Update:this.handleUpdateMessage(t,n);break;case vc.NewChapter:this.handleNewChapterMessage(t,n);break;case vc.Volume:this.handleVolumeMessage(t,n);break;case vc.Playing:this.handlePlayingMessage(t);break;case vc.Paused:this.handlePausedMessage(t);break;case vc.Finished:this.handleFinishedMessage(t);break;case vc.Stopped:this.handleStoppedMessage()}}},{key:"handleUpdateMessage",value:function(e,t){e.duration!==t.duration&&(e.duration=t.duration,this.trigger("durationchange",ka.void)),e.position!==t.position&&(e.position=t.position,this.trigger("positionchange",ka.void)),e.subtitles!==t.subtitles&&(e.subtitles=t.subtitles,this.trigger("subtitleschange",ka.void))}},{key:"handleVolumeMessage",value:function(e,t){e.volume!==t.level&&(e.volume=t.level,e.mute=0===t.level,this.trigger("volumechange",ka.void))}},{key:"handlePlayingMessage",value:function(e){!0!==e.playing&&(e.playing=!0,e.playbackFinished=!1,this.trigger("playingchange",ka.void))}},{key:"handlePausedMessage",value:function(e){!1!==e.playing&&(e.playing=!1,this.trigger("playingchange",ka.void))}},{key:"handleFinishedMessage",value:function(e){!0!==e.playbackFinished&&(e.playing=!1,e.playbackFinished=!0,this.trigger("playingchange",ka.void))}},{key:"handleNewChapterMessage",value:function(e,t){var n,r=(null!==(n=t.queue)&&void 0!==n?n:[]).find((function(t){return t.url===e.videoSource}));if(!r)return console.info("The device is no longer playing the source we loaded - disposing the session"),void this.dispose();e.subtitleSource!==r.suburl&&(e.subtitleSource=r.suburl,this.trigger("subtitleschange",ka.void))}},{key:"handleStoppedMessage",value:function(){this.dispose()}},{key:"loadSource",value:function(e,t){return Cc(this,void 0,void 0,bc().mark((function n(){var r,i;return bc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.localState.videoSource!==e||this.localState.subtitleSource!==t){n.next=2;break}return n.abrupt("return");case 2:return n.prev=2,r=this.getDevice().id,i=this.getPosition(),this.localState.videoSource=e,this.localState.subtitleSource=t,this.localState.ready=!1,n.next=10,this.client.joinRoom(r);case 10:return n.next=12,this.client.loadQueue({title:this.getTitle(),roomId:r,videoSource:e,subtitleSource:t});case 12:this.localState.ready=!0,this.trigger("sourceloaded",ka.void),i>0&&this.seek(i),t&&this.setSubtitles(t),n.next=22;break;case 18:n.prev=18,n.t0=n.catch(2),console.error(n.t0),this.trigger("error",new Error("Could not load video on Vivi device"));case 22:case"end":return n.stop()}}),n,this,[[2,18]])})))}},{key:"play",value:function(){this.localState.ready&&!0!==this.localState.playing&&(this.localState.playing=!0,this.client.play(this.getDevice().id),this.trigger("playingchange",ka.void))}},{key:"pause",value:function(){this.localState.ready&&!1!==this.localState.playing&&(this.localState.playing=!1,this.client.pause(this.getDevice().id),this.trigger("playingchange",ka.void))}},{key:"seek",value:function(e){this.localState.ready&&this.localState.position!==e&&(this.localState.position=e,this.client.seek(this.getDevice().id,e),this.trigger("positionchange",ka.void))}},{key:"setVolume",value:function(e){this.localState.ready&&this.localState.volume!==e&&(this.localState.volume=e,this.client.setVolume(this.getDevice().id,e),this.trigger("volumechange",ka.void))}},{key:"setMuted",value:function(e){this.localState.ready&&this.localState.mute!==e&&(this.localState.mute=e,this.client.setMuted(this.getDevice().id,e),this.trigger("volumechange",ka.void))}},{key:"setSubtitles",value:function(e){return Cc(this,void 0,void 0,bc().mark((function t(){var n;return bc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.localState.ready){t.next=2;break}return t.abrupt("return");case 2:if(!e){t.next=5;break}return t.next=5,this.loadSource(this.localState.videoSource,e);case 5:n=!!e,this.localState.subtitles!==n&&(this.localState.subtitles=n,this.client.setSubtitles(this.getDevice().id,n),this.trigger("subtitleschange",ka.void));case 7:case"end":return t.stop()}}),t,this)})))}},{key:"isPlaying",value:function(){return this.localState.playing}},{key:"isPlaybackFinished",value:function(){return this.localState.playbackFinished}},{key:"getPosition",value:function(){return this.localState.position}},{key:"getDuration",value:function(){return this.localState.duration}},{key:"getVolume",value:function(){return this.localState.volume}},{key:"getMuted",value:function(){return this.localState.mute}},{key:"getSubtitles",value:function(){if(this.localState.subtitles)return this.localState.subtitleSource}},{key:"getDevice",value:function(){return this.localState.device}},{key:"getTitle",value:function(){return this.localState.title}}],r&&wc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Sa);function jc(e){return jc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jc(e)}function Pc(){Pc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==jc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(jc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ic(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,Lc(r.key),r)}}function Lc(e){var t=function(e){if("object"!=jc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=jc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jc(t)?t:t+""}function Tc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Tc=function(){return!!e})()}function _c(){return _c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ac(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},_c.apply(null,arguments)}function Ac(e){return Ac=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ac(e)}function Fc(e,t){return Fc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fc(e,t)}var Dc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Rc=1e4,Mc=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=Ac(t),function(e,t){if(t&&("object"==jc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Tc()?Reflect.construct(t,n||[],Ac(e).constructor):t.apply(e,n))}(this,t)).options=e,n.accessToken="",n.devices=[],n.devicesFingerprint="",n.deviceDiscovery=new Ia,n.bindFunctions(),n.initialize(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendMessageDebounced=(0,La.Ds)(this.sendMessage,500,!0),this.beginDeviceDiscovery=this.beginDeviceDiscovery.bind(this),this.dispose=this.dispose.bind(this),this.canCastToDevice=this.canCastToDevice.bind(this),this.getDevices=this.getDevices.bind(this),this.startCastSession=this.startCastSession.bind(this),this.authenticateWithVivi=this.authenticateWithVivi.bind(this),this.getRoomList=this.getRoomList.bind(this),this.joinRoom=this.joinRoom.bind(this),this.query=this.query.bind(this),this.loadQueue=this.loadQueue.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.stop=this.stop.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.setMuted=this.setMuted.bind(this),this.setSubtitles=this.setSubtitles.bind(this)}},{key:"initialize",value:function(){var e=this;this.webSocket=new fc(this.options.url),this.webSocket.onMessage=function(t){return e.trigger("message",JSON.parse(t.data))},this.webSocket.onOpen=function(){return Dc(e,void 0,void 0,Pc().mark((function e(){return Pc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.options.fetchAccessToken();case 3:return this.accessToken=e.sent,e.next=6,this.authenticateWithVivi();case 6:this.beginDeviceDiscovery(),this.trigger("connected",ka.void),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.error(e.t0),this.trigger("error",new Error("Could not connect to Vivi"));case 14:case"end":return e.stop()}}),e,this,[[0,10]])})))}}},{key:"sendMessage",value:function(e){var t;null===(t=this.webSocket)||void 0===t||t.send(JSON.stringify(e))}},{key:"beginDeviceDiscovery",value:function(){var e=this;this.deviceDiscovery.every(1e4).schedule((function(){return Dc(e,void 0,void 0,Pc().mark((function e(){var n,r,i,o;return Pc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getRoomList();case 3:if(n=e.sent,(r=t.calculateFingerprint(n))!==this.devicesFingerprint){e.next=7;break}return e.abrupt("return");case 7:i=new Set(n.map((function(e){var t;return null!==(t=e.organisation)&&void 0!==t?t:""}))).size,o=new Set(n.map((function(e){var t;return null!==(t=e.location)&&void 0!==t?t:""}))).size,this.devices=n.map((function(e){return{id:e.id,name:e.name,schoolName:i>1?e.organisation:"",description:o>1?e.location:"",type:la.Vivi,status:sa.Available}})),this.devicesFingerprint=r,this.trigger("deviceschange",ka.void),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(0),console.warn(e.t0);case 17:case"end":return e.stop()}}),e,this,[[0,14]])})))})).trigger().start()}},{key:"dispose",value:function(){var e,n,r,i;this.deviceDiscovery.stop(),null===(e=this.webSocket)||void 0===e||e.dipose(),(n=t,r=this,"function"==typeof(i=_c(Ac(1&3?n.prototype:n),"dispose",r))?function(e){return i.apply(r,e)}:i)([])}},{key:"canCastToDevice",value:function(e){return e===la.Vivi}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new Nc(this,e)}},{key:"authenticateWithVivi",value:function(){return Dc(this,void 0,void 0,Pc().mark((function e(){return Pc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:"relay",message:{token:this.accessToken,type:"identify_video_api"}}),e.next=3,this.one("message",(function(e){return"video_api_identified"===e.message.type})).timeout(Rc).catch((function(){throw new Error("Failed to authenticate with Vivi")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getRoomList",value:function(){return Dc(this,void 0,void 0,Pc().mark((function e(){var t;return Pc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:"relay",message:{type:"video_api_rooms"}}),e.next=3,this.one("message",(function(e){return"video_api_rooms"===e.message.type})).timeout(Rc).catch((function(){throw new Error("Failed to fetch rooms")}));case 3:return t=e.sent,e.abrupt("return",t.message.rooms||[]);case 5:case"end":return e.stop()}}),e,this)})))}},{key:"joinRoom",value:function(e){return Dc(this,void 0,void 0,Pc().mark((function t(){return Pc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:"relay",message:{destination_type:"box",new_destination:e,token:this.accessToken,type:"connect"}}),t.next=3,this.one("message",(function(t){return t.source===e&&"connect"===t.message.type||"error"===t.message.type&&"already_connected"===t.message.error_type||void 0})).timeout(Rc).catch((function(){throw new Error("Failed to join room")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"query",value:function(e){return Dc(this,void 0,void 0,Pc().mark((function n(){var r;return Pc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.createAckId(),this.sendMessage({destination:e,message:{type:"message_with_ack",ack_id:r,name:"query"}}),n.next=4,this.one("message",(function(e){return e.message.ack_id===r})).timeout(Rc).catch((function(){throw new Error("Failed to fetch query")}));case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),n,this)})))}},{key:"loadQueue",value:function(e){var n=e.roomId,r=e.title,i=e.videoSource,o=e.subtitleSource;return Dc(this,void 0,void 0,Pc().mark((function e(){return Pc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:n,message:{type:"message_with_ack",ack_id:t.createAckId(),name:"queue_load",payload:{urls:[{title:r,url:i,suburl:o}]}}}),e.next=3,this.one("message",(function(e){var t;return e.source===n&&"ready"===(null===(t=e.message.payload)||void 0===t?void 0:t.event)})).timeout(Rc).catch((function(){throw new Error("Failed to load media")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"play",value:function(e){return Dc(this,void 0,void 0,Pc().mark((function t(){return Pc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"video_play",payload:{}}}),t.next=3,this.one("message",(function(t){var n;return t.source===e&&"playing"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to play video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return Dc(this,void 0,void 0,Pc().mark((function t(){return Pc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"video_pause"}}),t.next=3,this.one("message",(function(t){var n;return t.source===e&&"paused"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to pause video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"stop",value:function(e){return Dc(this,void 0,void 0,Pc().mark((function t(){return Pc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"video_stop"}}),t.next=3,this.one("message",(function(t){var n;return t.source===e&&"stopped"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to stop video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"seek",value:function(e,t){return Dc(this,void 0,void 0,Pc().mark((function n(){return Pc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this.sendMessageDebounced({destination:e,message:{type:"message",name:"video_seek",payload:{position:t}}})){n.next=4;break}return n.next=4,this.one("message",(function(t){var n;return t.source===e&&"playing"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to seek video")}));case 4:case"end":return n.stop()}}),n,this)})))}},{key:"setVolume",value:function(e,t){return Dc(this,void 0,void 0,Pc().mark((function n(){return Pc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this.sendMessageDebounced({destination:e,message:{type:"message",name:"set_volume",payload:{volume:t}}})){n.next=4;break}return n.next=4,this.one("message",(function(t){var n;return t.source===e&&"volume"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to set volume")}));case 4:case"end":return n.stop()}}),n,this)})))}},{key:"setMuted",value:function(e,t){return Dc(this,void 0,void 0,Pc().mark((function n(){return Pc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"set_mute",payload:{mute:t}}}),n.next=3,this.one("message",(function(t){var n;return t.source===e&&"mute"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to set mute")}));case 3:case"end":return n.stop()}}),n,this)})))}},{key:"setSubtitles",value:function(e,n){return Dc(this,void 0,void 0,Pc().mark((function r(){var i;return Pc().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=t.createAckId(),this.sendMessage({destination:e,message:{type:"message_with_ack",ack_id:i,name:"set_subtitles",payload:{subtitles:n}}}),r.next=4,this.one("message",(function(t){var n;return t.source===e&&"subtitles"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(Rc).catch((function(){throw new Error("Failed to set subtitles")}));case 4:case"end":return r.stop()}}),r,this)})))}}],i=[{key:"createAckId",value:function(){return dc.x.generateRandomId()}},{key:"calculateFingerprint",value:function(e){return e.map((function(e){return e.id})).sort().join(",")}}],r&&Ic(n.prototype,r),i&&Ic(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Sa);function Uc(e){return Uc="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},Uc(e)}function Vc(e){return function(e){if(Array.isArray(e))return Bc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Bc(e,t);var n={}.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)?Bc(e,t):void 0}}(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 Bc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function qc(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,Gc(r.key),r)}}function Gc(e){var t=function(e){if("object"!=Uc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Uc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Uc(t)?t:t+""}function Zc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Zc=function(){return!!e})()}function zc(){return zc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Hc(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},zc.apply(null,arguments)}function Hc(e){return Hc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Hc(e)}function Wc(e,t){return Wc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Wc(e,t)}var Qc=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=Hc(t),function(e,t){if(t&&("object"==Uc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Zc()?Reflect.construct(t,n||[],Hc(e).constructor):t.apply(e,n))}(this,t)).instanceId=e,n.clients=[],n.bindFunctions(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Wc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.addClient=this.addClient.bind(this),this.hasInstanceOfClient=this.hasInstanceOfClient.bind(this),this.startCastSession=this.startCastSession.bind(this),this.gatherAndPublishDevices=this.gatherAndPublishDevices.bind(this),this.dispose=this.dispose.bind(this)}},{key:"addClient",value:function(e){var t=this;e.on("deviceschange",this.gatherAndPublishDevices),e.on("error",(function(e){return t.trigger("error",e)})),this.clients.push(e)}},{key:"hasInstanceOfClient",value:function(e){return this.clients.some((function(t){return t instanceof e}))}},{key:"startCastSession",value:function(e){var t=this;if(this.castSession){if(this.castSession.getDevice().id===e.device.id)return void console.info("A session with device ".concat(e.device.id," already exists - this is a no-op"));this.castSession.dispose()}var n=this.clients.find((function(t){return t.canCastToDevice(e.device.type)}));n&&(this.castSession=n.startCastSession(e),this.castSession.on("error",(function(e){t.castSession.dispose(),t.trigger("error",e)})),this.castSession.on("dispose",(function(){t.castSession=void 0,t.trigger("castsessionchange",void 0)})),this.trigger("castsessionchange",this.castSession))}},{key:"getCastSession",value:function(){return this.castSession}},{key:"gatherAndPublishDevices",value:function(){var e=this.clients.map((function(e){return e.getDevices()})).reduce((function(e,t){return[].concat(Vc(e),Vc(t))}),[]);this.trigger("deviceschange",e)}},{key:"dispose",value:function(){var e,n,r,i;null===(e=this.castSession)||void 0===e||e.dispose(),this.clients.forEach((function(e){return e.dispose()})),this.castSession=void 0,this.clients=[],(n=t,r=this,"function"==typeof(i=zc(Hc(1&3?n.prototype:n),"dispose",r))?function(e){return i.apply(r,e)}:i)([])}}],i=[{key:"getOrCreateInstance",value:function(e){if(!e)throw new Error("instanceId is required");return this.instances[e]||(this.instances[e]=new t(e)),this.instances[e]}},{key:"disposeAndRemoveInstance",value:function(e){e.dispose(),delete this.instances[e.instanceId]}},{key:"isActive",value:function(){return Object.keys(this.instances).length>0}}],r&&qc(n.prototype,r),i&&qc(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Sa);Qc.instances={};var Yc=n(12424),Kc=n(29206);function $c(e){return $c="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},$c(e)}function Xc(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,Jc(r.key),r)}}function Jc(e){var t=function(e){if("object"!=$c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=$c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$c(t)?t:t+""}function el(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(el=function(){return!!e})()}function tl(e,t,n,r){var i=nl(rl(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function nl(){return nl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=rl(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},nl.apply(null,arguments)}function rl(e){return rl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},rl(e)}function il(e,t){return il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},il(e,t)}var ol=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=rl(t),function(e,t){if(t&&("object"==$c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,el()?Reflect.construct(t,n||[],rl(e).constructor):t.apply(e,n))}(this,t,[e,n])).isVisible=r.isVisible.bind(r),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&il(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){var e,n,r=tl(t,"createEl",this,3)(["li",{className:"vjs-menu-item cv-device-menu-item"}]),i=ie.Z.dom.createEl("div",{className:"cv-device-menu-item-body",innerHTML:'\n <span class="cv-device-icon '.concat({vivi:"cv-vivi-icon","apple-tv":"cv-apple-icon"}[this.options_.type],'"></span>\n <div>\n <span class="vjs-menu-item-text">').concat(this.options_.label,'</span>\n <span class="vjs-menu-item-text cv-device-truncated-text">').concat(null!==(e=this.options_.schoolName)&&void 0!==e?e:"",'</span>\n <span class="vjs-menu-item-text cv-device-truncated-text cv-device-description">').concat(null!==(n=this.options_.description)&&void 0!==n?n:"","</span>\n </div>\n ")});return r.replaceChildren(i),r}},{key:"handleClick",value:function(){this.options_.onClick()}},{key:"show",value:function(){tl(t,"show",this,3)([])}},{key:"hide",value:function(){tl(t,"hide",this,3)([])}},{key:"isVisible",value:function(){return!tl(t,"hasClass",this,3)(["vjs-hidden"])}}])&&Xc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("MenuItem")),al=n(86777),cl=n(46620);function ll(e){return ll="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},ll(e)}function sl(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,ul(r.key),r)}}function ul(e){var t=function(e){if("object"!=ll(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ll(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ll(t)?t:t+""}function fl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(fl=function(){return!!e})()}function dl(e){return dl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dl(e)}function pl(e,t){return pl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pl(e,t)}var ml=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t,n){return t=dl(t),function(e,t){if(t&&("object"==ll(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,fl()?Reflect.construct(t,n||[],dl(e).constructor):t.apply(e,n))}(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pl(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){var e=cl.W.apply(this),t=this.contentEl_;return this.contentWrapper=ie.Z.dom.createEl("div",{className:"vjs-menu-content"}),e.className="vjs-menu cv-devices-menu",t.className="cv-devices-menu-item-list",e.removeChild(t),e.appendChild(this.contentWrapper),this.contentWrapper.appendChild(t),this.simpleBar=new al.Z(t,{autoHide:!1}),e}},{key:"addCta",value:function(e){this.ctaElement?console.warn("CTA has already been added to the menu - this is a no-op"):(this.ctaElement=e.el(),this.contentWrapper.prepend(this.ctaElement),this.el().classList.add("has-cta"))}},{key:"removeCta",value:function(){this.ctaElement&&(this.contentWrapper.removeChild(this.ctaElement),this.el().classList.remove("has-cta"))}}])&&sl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("Menu"));function hl(e){var t=e.inactiveIntegrations,n=e.canUserManageIntegrations,i=e.player,o=e.onDismiss,a=e.onInstall,c=e.onLearnMore,l=e.onContactSupport;if(0===t.length)return r.createElement(r.Fragment,null);var s,u=function(e){return i.localize(e)},f=function(e){return-1!==t.indexOf(e)};return s=f(la.AppleTv)&&f(la.Vivi)?"vivi_and_apple_tv":f(la.Vivi)?"vivi":"apple_tv",r.createElement("div",{className:"cv-devices-cta",tabIndex:-1},r.createElement(vl,{context:s,localize:u,onDismiss:function(){return o(s)}}),r.createElement(yl,{context:s}),r.createElement(gl,{context:s,canUserManageIntegrations:n,localize:u,onContactSupport:function(){return l(s)},onInstall:function(){return a(s)},onLearnMore:function(){return c(s)}}))}function vl(e){var t=e.context,n=e.localize,i=e.onDismiss;return r.createElement("div",{className:"cv-devices-cta-header"},r.createElement("span",{className:"cv-devices-badge"},n("New")),r.createElement("span",{className:"cv-devices-title"},"vivi_and_apple_tv"===t&&n("Cast to Vivi and Apple TV"),"vivi"===t&&n("Cast to Vivi"),"apple_tv"===t&&n("Cast to Apple TV")),r.createElement("span",{className:"cv-devices-close",onClick:i},r.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"white",d:"M11.9588 10.6413L16.3612 6.34478C16.7361 5.97191 17.3439 5.97191 17.7188 6.34478C18.0937 6.71764 18.0937 7.32218 17.7188 7.69505L13.3165 11.9916L17.7188 16.3701C18.0937 16.7429 18.0937 17.3475 17.7188 17.7203C17.3439 18.0932 16.7361 18.0932 16.3612 17.7203L11.9588 13.3419L7.63882 17.7203C7.26392 18.0932 6.65608 18.0932 6.28118 17.7203C5.90627 17.3475 5.90627 16.7429 6.28118 16.3701L10.6012 11.9916L6.28118 7.62993C5.90627 7.25706 5.90627 6.65252 6.28118 6.27965C6.65608 5.90678 7.26392 5.90678 7.63882 6.27965L11.9588 10.6413Z"}))))}function yl(e){var t=e.context,n="vivi_and_apple_tv"===t?"bg-vivi-and-apple":"vivi"===t?"bg-vivi":"bg-apple";return r.createElement("div",{className:"cv-devices-cta-body ".concat(n)},("vivi_and_apple_tv"===t||"apple_tv"===t)&&r.createElement("div",{className:"cv-devices-icon-container"},r.createElement("span",{className:"cv-devices-icon apple"})),("vivi_and_apple_tv"===t||"vivi"===t)&&r.createElement("div",{className:"cv-devices-icon-container"},r.createElement("span",{className:"cv-devices-icon vivi"})))}function gl(e){var t=e.context,n=e.canUserManageIntegrations,i=e.localize,o=e.onInstall,a=e.onLearnMore,c=e.onContactSupport;return n?r.createElement("div",{className:"cv-devices-cta-footer"},r.createElement("span",null,"vivi_and_apple_tv"===t&&i("Discover our new device integrations to make presenting in the classroom easy!"),"vivi"===t&&i("Discover our new Vivi integration."),"apple_tv"===t&&i("Discover our new Apple TV integration.")),r.createElement("br",null),r.createElement("span",{className:"cv-devices-link",onClick:o},i("Click here to install"))):r.createElement("div",{className:"cv-devices-cta-footer"},r.createElement("span",null,"vivi_and_apple_tv"===t&&i("Cast to Vivi and Apple TV is now available! Please contact "),"vivi"===t&&i("Cast to Vivi is now available! Please contact "),"apple_tv"===t&&i("Cast to Apple TV is now available! Please contact ")),r.createElement("span",{className:"cv-devices-link",onClick:c},"ClickView Support"),r.createElement("span",null,"vivi_and_apple_tv"===t&&i(" or your administrator to set up Apple TV and Vivi."),"vivi"===t&&i(" or your administrator to set up Vivi."),"apple_tv"===t&&i(" or your administrator to set up Apple TV.")),r.createElement("br",null),r.createElement("span",{className:"cv-devices-link",onClick:a},"Learn more"))}function bl(e){return bl="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},bl(e)}function wl(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,El(r.key),r)}}function El(e){var t=function(e){if("object"!=bl(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=bl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bl(t)?t:t+""}function Sl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Sl=function(){return!!e})()}function kl(e,t,n,r){var i=xl(Ol(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function xl(){return xl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ol(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},xl.apply(null,arguments)}function Ol(e){return Ol=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ol(e)}function Cl(e,t){return Cl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Cl(e,t)}ie.Z.registerComponent("DevicesMenu",ml),ie.Z.registerComponent("DevicesCta",lo((function(e,t){return r.createElement(hl,Object.assign({player:e},t))}),{properties:{className:"cv-devices-cta-wrapper"}}));var Nl=ie.Z.getComponent("DevicesCta"),jl=ie.Z.getComponent("MenuButton"),Pl=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=Ol(t),function(e,t){if(t&&("object"==bl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Sl()?Reflect.construct(t,n||[],Ol(e).constructor):t.apply(e,n))}(this,t,[e,n])).alwaysCollapsed=!1,r.isCollapsed=!1,r.isCollabsible=!0,r.className="cv-devices-menu-button",r.searchText="",r.devices=[],r.castSession=void 0,r.bindFunctions(),r.bindEventListeners(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Cl(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.bindEventListeners=this.bindEventListeners.bind(this),this.setDevices=this.setDevices.bind(this),this.setCastSession=this.setCastSession.bind(this),this.setSearchText=this.setSearchText.bind(this),this.getDeviceMenuItems=this.getDeviceMenuItems.bind(this),this.showNotificationBadge=this.showNotificationBadge.bind(this),this.hideNotificationBadge=this.hideNotificationBadge.bind(this),this.render=this.render.bind(this),this.removeMenuItems=this.removeMenuItems.bind(this),this.addMenuItemsForDevices=this.addMenuItemsForDevices.bind(this),this.shouldShowSearchInput=this.shouldShowSearchInput.bind(this),this.toggleSearchInput=this.toggleSearchInput.bind(this),this.toggleDeviceMenuItems=this.toggleDeviceMenuItems.bind(this),this.toggleEmptyStatePlaceholder=this.toggleEmptyStatePlaceholder.bind(this)}},{key:"bindEventListeners",value:function(){var e=this,t=this.$("button"),n=function(t){e.menu.handleBlur(t)};t.addEventListener("blur",n),this.one("dispose",(function(){var r;t.removeEventListener("blur",n),null===(r=e.cta)||void 0===r||r.dispose()}))}},{key:"createEl",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=jl.prototype.createEl).apply.apply(e,[this].concat(n))}},{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-devices-button ".concat(kl(t,"buildWrapperCSSClass",this,3)([]))}},{key:"createMenu",value:function(){var e=this,t=new ml(this.player_,{menuButton:this});if(!this.options_.ctaOptions.hasBeenDismissed&&this.options_.ctaOptions.inactiveIntegrations.length>0){var n=this.options_.ctaOptions,r=n.onDismiss,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(n,["onDismiss"]);this.cta=new Nl(this.player(),Object.assign(Object.assign({},i),{onDismiss:function(n){e.hideNotificationBadge(),t.removeCta(),r(n)}})),this.showNotificationBadge(),t.addCta(this.cta)}return this.createItems().forEach((function(e){return t.addItem(e)})),t}},{key:"createItems",value:function(){var e=this,t=[];return this.headingItem=new Yc.Z(this.player_,{label:this.localize("Select a device"),selectable:!1}),this.searchInputItem=new Kc.Z(this.player_,{menuButton:this,search:function(t){return e.setSearchText(t)},className:"cv-devices-search-input"}),this.emptyPlaceholder=new Kc.C(this.player_,{label:"No devices found",selected:!1,selectable:!1,multiSelectable:!1}),this.headingItem.show(),this.searchInputItem.hide(),this.emptyPlaceholder.show(),t.push(this.headingItem,this.searchInputItem,this.emptyPlaceholder),t}},{key:"pressButton",value:function(){var e;kl(t,"pressButton",this,3)([]),this.shouldShowSearchInput()&&(null===(e=this.searchInputItem)||void 0===e||e.focus())}},{key:"setDevices",value:function(e){this.devices=e,this.render()}},{key:"setCastSession",value:function(e){this.castSession=e,this.render()}},{key:"setSearchText",value:function(e){this.searchText=e,this.render()}},{key:"getDeviceMenuItems",value:function(){return this.menu.children_.filter((function(e){return e instanceof ol}))}},{key:"showNotificationBadge",value:function(){this.addClass("notification-badge")}},{key:"hideNotificationBadge",value:function(){this.removeClass("notification-badge")}},{key:"render",value:function(){this.removeMenuItems(this.getDeviceMenuItems()),this.addMenuItemsForDevices(this.devices),this.toggleSearchInput(),this.toggleDeviceMenuItems(),this.toggleEmptyStatePlaceholder()}},{key:"removeMenuItems",value:function(e){var t=this;e.forEach((function(e){t.menu.removeChild(e),e.dispose()}))}},{key:"addMenuItemsForDevices",value:function(e){var t=this;e.sort((function(e,t){var n,r,i,o,a="".concat(e.type).concat(null!==(n=e.schoolName)&&void 0!==n?n:"").concat(null!==(r=e.description)&&void 0!==r?r:"").concat(e.name),c="".concat(t.type).concat(null!==(i=t.schoolName)&&void 0!==i?i:"").concat(null!==(o=t.description)&&void 0!==o?o:"").concat(t.name);return a.localeCompare(c)})).forEach((function(e){var n=new ol(t.player(),{id:e.id,label:e.name,schoolName:e.schoolName,description:e.description,selected:!1,multiSelectable:!1,selectable:!0,available:e.status===sa.Available,type:e.type,onClick:function(){t.options_.onDeviceMenuItemClick(n,e)}});t.menu.addItem(n)}))}},{key:"shouldShowSearchInput",value:function(){return this.getDeviceMenuItems().length>=20}},{key:"toggleSearchInput",value:function(){this.shouldShowSearchInput()?(this.searchInputItem.show(),this.menu.addClass("vertical-fill")):(this.searchInputItem.hide(),this.menu.removeClass("vertical-fill"))}},{key:"toggleDeviceMenuItems",value:function(){var e=this,t=this.getDeviceMenuItems(),n=this.shouldShowSearchInput(),r=this.searchText.toLowerCase();t.forEach((function(t){var i,o,a,c=e.devices.find((function(e){return e.id===t.options_.id}));if(c){var l=c.status===sa.Available,s=c.id===(null===(i=e.castSession)||void 0===i?void 0:i.getDevice().id),u=!n||-1!=="".concat(c.name," ").concat(null!==(o=c.schoolName)&&void 0!==o?o:""," ").concat(null!==(a=c.description)&&void 0!==a?a:"").trim().toLowerCase().indexOf(r);l?t.enable():t.disable(),u?t.show():t.hide(),s?t.selected(!0):t.selected(!1)}}))}},{key:"toggleEmptyStatePlaceholder",value:function(){var e=this.getDeviceMenuItems();e.filter((function(e){return e.isVisible()})).length?this.emptyPlaceholder.hide():this.emptyPlaceholder.show(),e.length?this.emptyPlaceholder.setLabel(this.localize("No matching results")):this.emptyPlaceholder.setLabel(this.localize("No devices found"))}},{key:"getCollabsibleName",value:function(){return this.controlText_}},{key:"getCollabsibleValue",value:function(){var e,t;return null!==(t=null===(e=this.castSession)||void 0===e?void 0:e.getDevice().name)&&void 0!==t?t:" "}},{key:"showInCollabsibleMenu",value:function(){return!0}},{key:"showCollapsibleMenu",value:function(){this.handleClick()}},{key:"handleClick",value:function(){kl(t,"handleClick",this,3)([null]),this.options_.onClick()}}],r&&wl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(jl);function Il(e){return Il="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},Il(e)}function Ll(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,Tl(r.key),r)}}function Tl(e){var t=function(e){if("object"!=Il(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Il(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Il(t)?t:t+""}function _l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_l=function(){return!!e})()}function Al(){return Al="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Fl(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Al.apply(null,arguments)}function Fl(e){return Fl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Fl(e)}function Dl(e,t){return Dl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Dl(e,t)}Pl.prototype.controlText_="Devices",ie.Z.registerComponent("DevicesButton",Pl);var Rl=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t,n){return t=Fl(t),function(e,t){if(t&&("object"==Il(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_l()?Reflect.construct(t,n||[],Fl(e).constructor):t.apply(e,n))}(this,t,[null,e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Dl(e,t)}(t,e),n=t,r=[{key:"createEl",value:function(){return(e=t,n=this,"function"==typeof(r=Al(Fl(1&3?e.prototype:e),"createEl",n))?function(e){return r.apply(n,e)}:r)(["div",{className:"cv-devices-tech"}]);var e,n,r}},{key:"setPoster",value:function(e){this.poster=e,this.update()}},{key:"setDevice",value:function(e){this.device=e,this.update()}},{key:"update",value:function(){var e,t,n,r,i=this;this.el_.innerHTML='\n <div class="cv-devices-content">\n <p>'.concat(this.localize("Currently playing on"),'</p>\n <h2><span class="cv-device-icon ').concat({vivi:"cv-vivi-icon","apple-tv":"cv-apple-icon"}[null!==(t=null===(e=this.device)||void 0===e?void 0:e.type)&&void 0!==t?t:la.Vivi],'"></span>').concat(null!==(r=null===(n=this.device)||void 0===n?void 0:n.name)&&void 0!==r?r:"",'</h2>\n </div>\n <div class="cv-devices-background" style="background-image: url(').concat(this.poster,')"></div>\n ');var o=document.createElement("button"),a=function(e){e.stopPropagation(),i.options_.onStopCasting()};o.onclick=a,o.ontouchstart=a,o.className="stop-casting-button",o.innerHTML=this.localize("Stop casting"),this.el_.querySelector(".cv-devices-content").appendChild(o)}},{key:"play",value:function(){}}],r&&Ll(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("Component"));function Ml(e){return Ml="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},Ml(e)}function Ul(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,Vl(r.key),r)}}function Vl(e){var t=function(e){if("object"!=Ml(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ml(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ml(t)?t:t+""}function Bl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Bl=function(){return!!e})()}function ql(e,t,n,r){var i=Gl(Zl(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function Gl(){return Gl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Zl(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Gl.apply(null,arguments)}function Zl(e){return Zl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Zl(e)}function zl(e,t){return zl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},zl(e,t)}var Hl=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=Zl(t),function(e,t){if(t&&("object"==Ml(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Bl()?Reflect.construct(t,n||[],Zl(e).constructor):t.apply(e,n))}(this,t,[e,n])).featuresVolumeControl=!0,r.featuresPlaybackRate=!1,r.movingMediaElementInDOM=!1,r.featuresFullscreenResize=!0,r.featuresTimeupdateEvents=!0,r.featuresProgressEvents=!1,r.featuresNativeTextTracks=!1,r.featuresNativeAudioTracks=!1,r.featuresNativeVideoTracks=!1,r.featuresMuteControl=!0,r.featuresSourceset=!1,r.videojsPlayer=(0,ie.Z)(r.options_.playerId),r.bindFunctions(),r.bindEventListeners(),r.ready((function(){r.setSource(r.options_.source)})),r.triggerReady(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zl(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.bindEventListeners=this.bindEventListeners.bind(this),this.onTextTrackChanged=this.onTextTrackChanged.bind(this),this.getSelectedTextTrack=this.getSelectedTextTrack.bind(this),this.setSelectedTextTrack=this.setSelectedTextTrack.bind(this),this.showUI=this.showUI.bind(this),this.hideUI=this.hideUI.bind(this),this.dispose=this.dispose.bind(this),this.setSource=this.setSource.bind(this),this.getCastSession=this.getCastSession.bind(this)}},{key:"bindEventListeners",value:function(){var e=this,t=this.getCastSession();t&&(this.textTracks().on("change",this.onTextTrackChanged),this.videojsPlayer.one("ended",(function(){t.dispose()})),t.on("durationchange",(function(){e.trigger("durationchange")})),t.on("dispose",(function(){e.trigger("ended"),e.hideUI()})),t.on("playingchange",(function(){t.isPlaying()?(e.trigger("play"),e.trigger("playing")):e.trigger("pause")})),t.on("volumechange",(function(){e.trigger("volumechange")})),t.on("sourceloaded",(function(){e.trigger("loadeddata")})),t.on("subtitleschange",(function(){e.setSelectedTextTrack(t.getSubtitles())})))}},{key:"onTextTrackChanged",value:function(){var e,t=this.getSelectedTextTrack();null===(e=this.getCastSession())||void 0===e||e.setSubtitles(null==t?void 0:t.src)}},{key:"getSelectedTextTrack",value:function(){return xe.O.findTrackByPredicate(this.videojsPlayer.player_,(function(e){return"showing"===e.mode&&!!e.src}))}},{key:"setSelectedTextTrack",value:function(e){xe.O.forEachTrack(this.videojsPlayer.player_,(function(t){t.src===e?t.mode="showing":t.mode="hidden"}))}},{key:"showUI",value:function(e){this.ui&&(this.ui.setPoster(this.options_.poster),this.ui.setDevice(e),this.ui.show())}},{key:"hideUI",value:function(){var e;null===(e=this.ui)||void 0===e||e.hide()}},{key:"dispose",value:function(){this.textTracks().off("change",this.onTextTrackChanged);var e=this.getCastSession();e&&e.dispose(),ql(t,"cleanupAutoTextTracks",this,3)([]),ql(t,"dispose",this,3)([])}},{key:"createEl",value:function(){var e=this;return this.ui=this.ui||new Rl({onStopCasting:function(){var t;null===(t=e.getCastSession())||void 0===t||t.dispose()}}),this.ui.el()}},{key:"setSource",value:function(e){var t=this.getCastSession();if(t){this.showUI(t.getDevice()),this.trigger("loadstart");var n=this.getSelectedTextTrack();t.loadSource(e.src,null==n?void 0:n.src)}}},{key:"addRemoteTextTrack",value:function(e){return ql(t,"addRemoteTextTrack",this,3)([e,!0])}},{key:"getCastSession",value:function(){var e;return Qc.getOrCreateInstance(null!==(e=this.options_.instanceId)&&void 0!==e?e:"").getCastSession()}},{key:"play",value:function(){var e;null===(e=this.getCastSession())||void 0===e||e.play()}},{key:"pause",value:function(){var e;null===(e=this.getCastSession())||void 0===e||e.pause()}},{key:"paused",value:function(){var e;return!1===(null===(e=this.getCastSession())||void 0===e?void 0:e.isPlaying())}},{key:"ended",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.isPlaybackFinished())&&void 0!==t&&t}},{key:"setCurrentTime",value:function(e){var t;null===(t=this.getCastSession())||void 0===t||t.seek(null!=e?e:0)}},{key:"currentTime",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getPosition())&&void 0!==t?t:0}},{key:"duration",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getDuration())&&void 0!==t?t:this.videojsPlayer.duration()}},{key:"volume",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getVolume())&&void 0!==t?t:1}},{key:"setVolume",value:function(e){var t;null===(t=this.getCastSession())||void 0===t||t.setVolume(e)}},{key:"muted",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getMuted())&&void 0!==t&&t}},{key:"setMuted",value:function(e){var t;null===(t=this.getCastSession())||void 0===t||t.setMuted(e)}},{key:"buffered",value:function(){}},{key:"seekable",value:function(){return ie.Z.createTimeRanges(0,this.duration())}},{key:"playbackRate",value:function(){return 1}},{key:"readyState",value:function(){return 4}},{key:"controls",value:function(){return!1}},{key:"playsinline",value:function(){return!0}},{key:"supportsFullScreen",value:function(){return!0}},{key:"setAutoplay",value:function(){}},{key:"preload",value:function(){}},{key:"load",value:function(){}},{key:"setPlaybackRate",value:function(){}}],i=[{key:"canPlayType",value:function(){return""}},{key:"canPlaySource",value:function(e,t){var n;return!!Qc.getOrCreateInstance(null!==(n=null==t?void 0:t.instanceId)&&void 0!==n?n:"").getCastSession()}},{key:"isSupported",value:function(){return Qc.isActive()}}],r&&Ul(n.prototype,r),i&&Ul(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(ie.Z.getComponent("Tech"));function Wl(e){return Wl="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},Wl(e)}function Ql(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,Yl(r.key),r)}}function Yl(e){var t=function(e){if("object"!=Wl(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Wl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wl(t)?t:t+""}function Kl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Kl=function(){return!!e})()}function $l(){return $l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Xl(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},$l.apply(null,arguments)}function Xl(e){return Xl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Xl(e)}function Jl(e,t){return Jl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Jl(e,t)}ie.Z.registerTech("devices",Hl);var es=function(e){function t(e,n){var r,i,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=Xl(t),function(e,t){if(t&&("object"==Wl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Kl()?Reflect.construct(t,n||[],Xl(e).constructor):t.apply(e,n))}(this,t,[e,n])).options=n,r.instanceId=null!==(o=null===(i=r.player.options_.devices)||void 0===i?void 0:i.instanceId)&&void 0!==o?o:"",r.bindFunctions(),r.initialize(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Jl(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.onReady=this.onReady.bind(this),this.onDevicesChanged=this.onDevicesChanged.bind(this),this.onCastSessionChanged=this.onCastSessionChanged.bind(this),this.onDevicesError=this.onDevicesError.bind(this),this.addViviClient=this.addViviClient.bind(this),this.addAppleTvClient=this.addAppleTvClient.bind(this),this.reloadTech=this.reloadTech.bind(this),this.getSessionManager=this.getSessionManager.bind(this),this.dispose=this.dispose.bind(this)}},{key:"initialize",value:function(){this.player.ready(this.onReady)}},{key:"onReady",value:function(){var e=this,t=this.player.getChild("collapserator"),n=null==t?void 0:t.children().findIndex((function(e){return"CustomControlSpacer"===e.name()})),r=null==t?void 0:t.children().findIndex((function(e){return"OpenExternallyButton"===e.name()})),i=Math.max(n,r)+1,o=this.getSessionManager();if(t&&n&&-1!==n&&o){o.on("deviceschange",this.onDevicesChanged),o.on("castsessionchange",this.onCastSessionChanged),o.on("error",this.onDevicesError);var a=this.options.ctaOptions,c=this.options.vivi,l=[];this.options.appleTv.enabled||l.push(la.AppleTv),c.enabled&&c.accountConnected||l.push(la.Vivi);var s={onClick:function(){e.addViviClient(o),e.addAppleTvClient(o)},onDeviceMenuItemClick:function(t,n){var r;o.startCastSession({device:n,title:e.options.title}),null===(r=e.options.analyticsService)||void 0===r||r.logUserAction(n,{actionType:f.Vw.Select,workflowPhase:f.eu.Complete,descriptor:f.UX.ChangeDevice,entity:f.py.Device,eventVersion:f.eq.V3})},ctaOptions:Object.assign(Object.assign({},a),{inactiveIntegrations:l})};this.devicesButton=t.addChild("DevicesButton",s,i)}}},{key:"onDevicesChanged",value:function(e){var t;null===(t=this.devicesButton)||void 0===t||t.setDevices(e)}},{key:"onCastSessionChanged",value:function(e){var t;null===(t=this.devicesButton)||void 0===t||t.setCastSession(e),this.reloadTech(),e?(this.player.addClass("cv-device-casting"),this.player.addClass("cv-device-".concat(e.getDevice().type)),this.player.isFullscreen()&&this.player.exitFullscreen()):(this.player.removeClass("cv-device-casting"),this.player.removeClass("cv-device-".concat(la.AppleTv)),this.player.removeClass("cv-device-".concat(la.Vivi)))}},{key:"onDevicesError",value:function(e){this.player.error(e.message),this.player.pause()}},{key:"addViviClient",value:function(e){if(this.options.vivi.enabled&&this.options.vivi.accountConnected&&this.options.vivi.apiUrl&&!e.hasInstanceOfClient(Mc)){var t=new Mc({url:this.options.vivi.apiUrl,fetchAccessToken:this.options.vivi.fetchAccessToken});e.addClient(t)}}},{key:"addAppleTvClient",value:function(e){if(this.options.appleTv.enabled&&this.options.trackingCode&&this.options.userId&&!e.hasInstanceOfClient(ac)){var t=new ac({fetchAccessToken:this.options.appleTv.fetchAccessToken,trackingCode:this.options.trackingCode,userId:this.options.userId});e.addClient(t)}}},{key:"reloadTech",value:function(){var e=this.player,t=e.currentSources(),n=e.volume(),r=e.muted(),i=e.currentTime(),o=e.paused();e.src(t),e.one("playing",(function(){e.volume(n),e.muted(r),e.currentTime(i),o?e.pause():e.play()}))}},{key:"getSessionManager",value:function(){if(this.instanceId)return Qc.getOrCreateInstance(this.instanceId)}},{key:"dispose",value:function(){var e,n,r,i=this.getSessionManager();i&&(i.off("deviceschange",this.onDevicesChanged),i.off("castsessionchange",this.onCastSessionChanged),i.off("error",this.onDevicesError),Qc.disposeAndRemoveInstance(i),(e=t,n=this,"function"==typeof(r=$l(Xl(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([]))}}],r&&Ql(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getPlugin("plugin"));function ts(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ns(e){var t,n,i,o=r.useRef(e.player.duration()-e.player.currentTime()),a=(n=r.useState(o.current),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,i)||function(e,t){if(e){if("string"==typeof e)return ts(e,t);var n={}.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)?ts(e,t):void 0}}(n,i)||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.")}()),c=a[0],l=a[1];function s(){var t=e.player.duration()-e.player.currentTime();l(t),t>o.current&&(o.current=t)}if(r.useEffect((function(){return e.player.on("timeupdate",s),function(){e.player.off("timeupdate",s)}}),[]),!e.nextVideo||!e.onPlayNext)return r.createElement(r.Fragment,null);var u=Math.ceil(c),f=1===u?"second":"seconds";return r.createElement(r.Fragment,null,r.createElement("div",{className:"cv-up-next-container"},r.createElement("div",{className:"cv-cancel-up-next cursor-pointer",role:"button",onClick:e.onCancel},"×"),r.createElement("div",{className:"cv-up-next-heading"},"Up next in ",u," ",f,":"),r.createElement("div",{className:"cv-up-next-image cursor-pointer",onClick:e.onPlayNext,style:{backgroundImage:"url(".concat(null===(t=e.nextVideo)||void 0===t?void 0:t.thumbnailUrl,")")}}),r.createElement("div",{className:"cv-up-next-title"},e.nextVideo.name)))}function rs(e){return rs="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},rs(e)}function is(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,os(r.key),r)}}function os(e){var t=function(e){if("object"!=rs(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=rs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rs(t)?t:t+""}function as(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(as=function(){return!!e})()}function cs(){return cs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ls(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},cs.apply(null,arguments)}function ls(e){return ls=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ls(e)}function ss(e,t){return ss=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ss(e,t)}ie.Z.registerPlugin("devicesPlugin",es),ie.Z.registerComponent("UpNext",lo((function(e,t){return r.createElement(ns,Object.assign({player:e},t))})));var us=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=ls(t),function(e,t){if(t&&("object"==rs(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,as()?Reflect.construct(t,n||[],ls(e).constructor):t.apply(e,n))}(this,t,[e,n])).playNext=e.nextVideoPlugin().getShouldPlayNext(),r.toggle(r.playNext),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ss(e,t)}(t,e),n=t,r=[{key:"handleToggle",value:function(){this.toggle(!this.playNext)}},{key:"toggle",value:function(e){e?this.toggleOn():this.toggleOff()}},{key:"toggleOn",value:function(){this.playNext=!0,ie.Z.dom.addClass(this.toggleEl,"on"),this.player_.nextVideoPlugin().setShouldPlayNext(this.playNext,!0)}},{key:"toggleOff",value:function(){this.playNext=!1,ie.Z.dom.removeClass(this.toggleEl,"on"),this.player_.nextVideoPlugin().setShouldPlayNext(this.playNext,!0)}},{key:"handleClick",value:function(e){e.stopImmediatePropagation()}},{key:"createEl",value:function(e,n,r){this.handlerBound||(this.handleToggle=this.handleToggle.bind(this),this.handlerBound=!0),this.toggleEl&&this.toggleEl.removeEventListener("click",this.handleToggle),this.toggleEl=ie.Z.dom.createEl("div",{className:"custom-toggle custom-toggle-info toggle-option float-end",innerHTML:'<span class="handle"></span></div>'}),this.toggleEl.addEventListener("click",this.handleToggle);var i,o,a,c=(i=t,o=this,"function"==typeof(a=cs(ls(1&3?i.prototype:i),"createEl",o))?function(e){return a.apply(o,e)}:a)([e,{className:"vjs-menu-item cv-cog-menu-item cv-play-next-toggle",innerHTML:'\n <span class="vjs-menu-item-text">Play next video</span>\n <span class="cv-toggle-container"></span>'},r]);return c.children[1].appendChild(this.toggleEl),c}}],r&&is(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("MenuItem"));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},fs(e)}function ds(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ps(r.key),r)}}function ps(e){var t=function(e){if("object"!=fs(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=fs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==fs(t)?t:t+""}function ms(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ms=function(){return!!e})()}function hs(){return hs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=vs(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},hs.apply(null,arguments)}function vs(e){return vs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vs(e)}function ys(e,t){return ys=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ys(e,t)}ie.Z.registerComponent("NextVideoMenuItem",us);var gs="cv-persisttest",bs="cv-play-next-video",ws=ie.Z.getPlugin("plugin"),Es=(ie.Z.getComponent("MenuItem"),ie.Z.getComponent("NextVideoMenuItem")),Ss=function(e){function t(e){var n;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=vs(t),function(e,t){if(t&&("object"==fs(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ms()?Reflect.construct(t,n||[],vs(e).constructor):t.apply(e,n))}(this,t,[e])).setShouldPlayNext=n.setShouldPlayNext.bind(n),n.getShouldPlayNext=n.getShouldPlayNext.bind(n),n.getChapterTrack=n.getChapterTrack.bind(n),n.onTimeUpdate=n.onTimeUpdate.bind(n),n.hasLocalStorage=n.testHasLocalStorage(),n.shouldPlayNextVideo=!1,n.hasLocalStorage){var r=window.localStorage.getItem(bs);n.shouldPlayNextVideo="true"===r}return e.ready((function(){n.initialize()})),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ys(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){this.player.isDisposed()||this.bindListeners()}},{key:"getChapterTrack",value:function(){return xe.O.getTrack(this.player,"chapters",null)}},{key:"setNextVideo",value:function(e,t,n){var r;this.nextVideo=e,this.callback=n,t&&this.setShouldPlayNext(!0),(null===(r=this.player.getChild("collapserator"))||void 0===r?void 0:r.getChild("cogButton")).addItem({index:0,ctor:Es,name:"NextVideoMenuItem"})}},{key:"getShouldPlayNext",value:function(){return this.shouldPlayNextVideo}},{key:"setShouldPlayNext",value:function(e,t){this.shouldPlayNextVideo=e,this.hasLocalStorage&&t&&window.localStorage.setItem(bs,e.toString())}},{key:"bindListeners",value:function(){this.player.on("timeupdate",this.onTimeUpdate)}},{key:"dispose",value:function(){var e,n,r;this.player.off("timeupdate",this.onTimeUpdate),this.hideUpNext(),(e=t,n=this,"function"==typeof(r=hs(vs(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{key:"onTimeUpdate",value:function(){var e,t;if(!this.player.pictureInPicture||!this.player.isInPictureInPicture())if(this.getShouldPlayNext()){if(this.player.ended())return this.callback(),void this.hideUpNext();if(!(this.player.duration()<=0||this.upNextRendered&&this.player.currentTime()>this.upNextTimepoint)){var n=this.getChapterTrack(),r=(null===(e=null==n?void 0:n.activeCues)||void 0===e?void 0:e.length)&&n.activeCues[0];"credits"===(null===(t=null==r?void 0:r.text)||void 0===t?void 0:t.toLowerCase())||this.player.currentTime()>=this.player.duration()-5?this.showUpNext():this.hideUpNext()}}else this.hideUpNext()}},{key:"showUpNext",value:function(){var e=this;this.upNextRendered||(this.upNextRendered=!0,this.upNextTimepoint=this.player.currentTime(),this.player.addChild("UpNext",{nextVideo:this.nextVideo,onPlayNext:this.callback,onCancel:function(){e.hideUpNext(),e.setShouldPlayNext(!1)}}))}},{key:"hideUpNext",value:function(){if(this.upNextRendered){this.upNextRendered=!1,this.upNextTimepoint=null;var e=this.player.getChild("UpNext");e&&(this.player.removeChild(e),e.dispose())}}},{key:"testHasLocalStorage",value:function(){try{return window.localStorage.setItem(gs,"persistPlayNext"),window.localStorage.removeItem(gs),!0}catch(e){return!1}}}],r&&ds(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ws);ie.Z.registerPlugin("nextVideoPlugin",Ss);var ks=n(52765),xs=n(75390),Os=n(86257),Cs=n(87013),Ns=n(38e3),js={width:200,resizeType:Te.Nq.Cover};function Ps(e){var t;return Ns.G.isResource(e)?e.metadata.type===Os.L.Pdf||(null===(t=e.pdf)||void 0===t?void 0:t.url)?Te.__.Pdf:Te.__.Thumbnails:Te.__.Link}function Is(e){var t,n,i,o=null,a=0;Ns.G.isResource(e.resource)&&(o=e.resource.metadata,a=null!==(i=null===(n=null===(t=e.resource.thumbnail)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.rotation)&&void 0!==i?i:0);var c=function(e,t){var n,r,i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:js,a=Ps(t);if("thumbnail"in t&&(null===(n=t.thumbnail)||void 0===n?void 0:n.url))return Cs.j.createUrl(null===(r=t.thumbnail)||void 0===r?void 0:r.url,Object.assign({},o));var c=xs._.safeUrlConcat(e,"/v1/previews");return Ns.G.isResource(t)?a===Te.__.Pdf?t.metadata.type===Os.L.Pdf?Cs.j.createResourceImage(c,t.url,Object.assign({},o)):Cs.j.createResourceImage(c,null===(i=t.pdf)||void 0===i?void 0:i.url,Object.assign({},o)):t.metadata.type!==Os.L.Zip?Cs.j.createUrl(t.url,{size:Te.h2.Medium,resizeType:Te.Nq.Cover}):"/images/zip-resource.png":Cs.j.createResourceImage(c,t.url,Object.assign({},o))}(e.imageCdnUrl,e.resource,e.dynamicRatioImageOptions);return r.createElement(Le.Z,{data:c,imageType:Ps(e.resource),imageStyle:{transform:"rotate(".concat(a,"deg)")},alt:e.resource.name,errorFallbackImageSrc:e.imageErrorFallbackUrl,errorFallbackImageClassName:"Xy4zX",imageClassName:(null==o?void 0:o.type)===Os.L.Image?"".concat("z4O5p"," ").concat("FFgf3"):"",preload:e.preloadImage,preventLoad:!e.preloadImage})}var Ls=n(71012),Ts=n(17977),_s=n(74421),As=n(13799);function Fs(e){var t,n,i,o,a=null;"metadata"in e.data&&(a=e.data.metadata);var c=Ns.G.isType(e.data,_s.E.Resource);return r.createElement(r.Fragment,null,r.createElement("div",{className:"OnJDH"},r.createElement("div",{className:"CIFy7"},r.createElement("div",{className:function(t){var n,r="\n d-flex flex-column align-items-center justify-content-end rounded-3 h-100\n position-relative ".concat(function(e){switch(e){case"atom-guide":return"X39wU";case"student-activity":return"X9pMl";case"teacher-pack":return"_tdVE";case"additional-materials":return"qRVUo";default:return"_18JaV"}}(t)," ").concat("oUZPD");return(null===(n=e.theme)||void 0===n?void 0:n.containerClass)?r+=" ".concat(e.theme.containerClass):r+=" pt-3 px-3",e.applyHoverState&&(r+=" ".concat("xRYhX")),r}(null==a?void 0:a.resourceType)},"above"===e.titlePosition&&r.createElement(_r.u,{title:e.data.name},r.createElement("h3",{className:"text-center text-break h5 mb-3 ".concat("g5NWS")},r.createElement("span",{className:"clamp-1"},e.data.name))),r.createElement("div",{className:"\n ".concat(null!==(n=null===(t=e.theme)||void 0===t?void 0:t.thumbnailContainerClass)&&void 0!==n?n:""," w-75 overflow-hidden \n ").concat("EDiGi"," ").concat("above"===e.titlePosition?"e9ejn":""," \n ").concat("I9E5O","\n ")},r.createElement(Is,{resource:e.data,imageCdnUrl:e.imageCdnUrl,imageErrorFallbackUrl:e.imageErrorFallbackUrl,preloadImage:e.preloadImage})),c&&e.onClickDownload&&"normal"===e.actionBehaviour&&r.createElement("div",{className:"jzGAm"},r.createElement(S.L,{onClick:function(t){return e.onClickDownload(t,e.data)},className:"".concat("fbb_e"," d-flex align-items-center justify-content-center")},r.createElement(k.x,{svgName:O.vn.Download}))),!e.hideTypeBadge&&c&&r.createElement(Ts.y,{typeId:_s.E.Resource})))),"below"===e.titlePosition&&r.createElement("div",{className:"mt-1 ".concat("Cpjs3")},Ns.G.isType(e.data,_s.E.Resource)&&!!(null===(o=null===(i=e.data)||void 0===i?void 0:i.metadata)||void 0===o?void 0:o.resourceType)&&r.createElement(Ls.m,null,function(e){switch(e){case"additional-materials":return"Additional Materials";case"atom-guide":return"ATOM Guide";case"teacher-pack":return"Teacher Pack";case"student-activity":return"Student Activity";default:return"N/A"}}(e.data.metadata.resourceType)),r.createElement("h3",{className:"h6 clamp-2"},e.data.name)))}function Ds(e){return Ds="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},Ds(e)}function Rs(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,Ms(r.key),r)}}function Ms(e){var t=function(e){if("object"!=Ds(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ds(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ds(t)?t:t+""}function Us(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Us=function(){return!!e})()}function Vs(){return Vs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Bs(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Vs.apply(null,arguments)}function Bs(e){return Bs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Bs(e)}function qs(e,t){return qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},qs(e,t)}function Gs(e){return r.createElement("div",{className:"cv-resource-item"},r.createElement(Fs,{data:e.resource,imageCdnUrl:e.imageCdnUrl,titlePosition:"above",hideTypeBadge:!0}))}Fs.defaultProps={preloadImage:!0,actionBehaviour:"normal"},r.memo((function(e){var t,n,i,o,a=(t=e.data,n=e.actionBehaviour,o=r.useContext(As.X),"public"===n||!o.xs&&!o.sm&&"resource"===t.type&&"metadata"in t&&(t.metadata.type===Os.L.Image||(t.metadata.type===Os.L.Pdf?!!t.url:!!(null===(i=t.pdf)||void 0===i?void 0:i.url)))),c=Object.assign(Object.assign({},e.analyticsData),e.data),l=Object.assign(Object.assign({},e.analyticsOptions),{actionType:f.Vw.Click,entity:e.data.typeId===_s.E.Resource?f.py.Resource:f.py.Link});function s(){An.k.logUserAction(c,l)}var u,d=Object.assign(Object.assign({},e),{applyHoverState:a||!!e.data.url});return r.createElement("div",{className:"px-1 flex-shrink-0 ".concat("tqUFn"," ").concat("play-page"===e.location?"V2RwX":"o7j7p"," ").concat("resource-item")},(u="d-block no-decoration","link"===e.data.type?r.createElement("a",{href:e.data.url,target:"_blank",className:u,onClick:s},r.createElement(Fs,Object.assign({},d))):a?"public"===e.actionBehaviour?r.createElement("div",{className:"".concat(u," cursor-pointer d-inline"),onClick:function(){s(),ks.C$.trigger(e.getAppLink(e.data))}},r.createElement(Fs,Object.assign({},d))):r.createElement(C.F,{appLink:e.getAppLink(e.data),className:u,analyticsData:c,analyticsOptions:l},r.createElement(Fs,Object.assign({},d))):e.data.url?r.createElement("a",{href:e.data.url,className:u,onClick:s},r.createElement(Fs,Object.assign({},d))):r.createElement("div",{className:u},r.createElement(Fs,Object.assign({},d)))))}));var Zs=lo((function(e,t){return r.createElement(Gs,Object.assign({},t))})),zs=function(e){function t(e,n){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=function(e,t,n){return t=Bs(t),function(e,t){if(t&&("object"==Ds(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Us()?Reflect.construct(t,n||[],Bs(e).constructor):t.apply(e,n))}(this,t,[e,n]);var i=new Zs(e,{resource:n.resource,imageCdnUrl:n.imageCdnUrl});return r.addChild(i),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&qs(e,t)}(t,e),n=t,r=[{key:"createEl",value:function(e){var n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;return(n=t,r=this,"function"==typeof(i=Vs(Bs(1&3?n.prototype:n),"createEl",r))?function(e){return i.apply(r,e)}:i)([e,Object.assign(Object.assign({},o),{className:"".concat(o.className," cv-resource-menu-item")}),a])}},{key:"handleClick",value:function(e){e.stopImmediatePropagation(),this.options_.downloadResource(this.options_.resource)}}],r&&Rs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("MenuItem"));function Hs(e){return Hs="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},Hs(e)}function Ws(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,Qs(r.key),r)}}function Qs(e){var t=function(e){if("object"!=Hs(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Hs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Hs(t)?t:t+""}function Ys(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ys=function(){return!!e})()}function Ks(e,t,n,r){var i=$s(Xs(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function $s(){return $s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Xs(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},$s.apply(null,arguments)}function Xs(e){return Xs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Xs(e)}function Js(e,t){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Js(e,t)}var eu=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=function(e,t,n){return t=Xs(t),function(e,t){if(t&&("object"==Hs(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Ys()?Reflect.construct(t,n||[],Xs(e).constructor):t.apply(e,n))}(this,t,arguments)).alwaysCollapsed=!1,e.isCollapsed=!1,e.isCollabsible=!0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Js(e,t)}(t,e),n=t,(r=[{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-resources-button-wrapper ".concat(Ks(t,"buildWrapperCSSClass",this,3)([]))}},{key:"buildCSSClass",value:function(){return"cv-resources-button ".concat(Ks(t,"buildCSSClass",this,3)([]))}},{key:"update",value:function(){Ks(t,"update",this,3)([])}},{key:"createItems",value:function(){var e=this,t=[];return t.push(new Yc.Z(this.player_,{label:"Resources"})),this.options_.resources.forEach((function(n){var r=new zs(e.player(),{resource:n,imageCdnUrl:e.options_.imageCdnUrl,downloadResource:function(t){return e.downloadResource(t)},label:n.name});t.push(r)})),t}},{key:"downloadResource",value:function(e){"link"!==e.type?this.getDownloadIframe().src=e.url:ks.Ab.PageLoad(e.url,!0)}},{key:"getDownloadIframe",value:function(){return this.downloadIframe||(this.downloadIframe=ie.Z.dom.createEl("iframe"),this.downloadIframe.style.display="none",ie.Z.dom.appendContent(ie.Z.dom.$("body"),this.downloadIframe)),this.downloadIframe}},{key:"getCollabsibleName",value:function(){return this.controlText_}},{key:"getCollabsibleValue",value:function(){return""}},{key:"showInCollabsibleMenu",value:function(){return!0}},{key:"showCollapsibleMenu",value:function(){Ks(t,"handleClick",this,3)([null])}}])&&Ws(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getComponent("MenuButton"));function tu(e){return tu="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},tu(e)}function nu(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,ru(r.key),r)}}function ru(e){var t=function(e){if("object"!=tu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=tu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==tu(t)?t:t+""}function iu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(iu=function(){return!!e})()}function ou(e){return ou=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ou(e)}function au(e,t){return au=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},au(e,t)}eu.prototype.controlText_="Resources",ie.Z.registerComponent("ResourcesButton",eu);var cu=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=function(e,t,n){return t=ou(t),function(e,t){if(t&&("object"==tu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,iu()?Reflect.construct(t,n||[],ou(e).constructor):t.apply(e,n))}(this,t,[e,n])).options=n,e.ready((function(){return r.onReady()})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&au(e,t)}(t,e),n=t,(r=[{key:"onReady",value:function(){if(this.options.resources.length){var e=this.player.getChild("collapserator");e.addChild("ResourcesButton",{resources:this.options.resources,imageCdnUrl:this.options.imageCdnUrl},e.children_.length-4)}}}])&&nu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.Z.getPlugin("plugin"));ie.Z.registerPlugin("resourcesPlugin",cu);var lu=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 su(e){var t=e.className,n=void 0===t?"":t,i=e.playerApi,o=e.onReady,a=e.onDispose,c=lu(e,["className","playerApi","onReady","onDispose"]),l=r.useRef(null);return r.useEffect((function(){if(l){var e=new ua.J(l.current,Object.assign(Object.assign({},c),{playerApi:i}));return o&&e.ready((function(){o(Bo(e))})),a&&e.one("dispose",a),function(){null==e||e.dispose()}}}),[e.viewKey]),r.createElement("div",{ref:l,className:n})}var uu={placeholder:"JemW5"};function fu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function du(){return r.createElement("div",{className:"".concat(uu.placeholder," partial-loading-background")})}function pu(e){var t,n,i=(t=r.useState(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return fu(e,t);var n={}.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)?fu(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1];return r.useEffect((function(){e.createViewKey(null,(function(e){a(e.get("viewKey"))}))}),[e.video.id]),o?r.createElement("div",{className:"col-12 mb-3 p-0"},r.createElement(su,{playerApi:new URL(e.config.get("playerApiUrl")),viewKey:o})):r.createElement(du,null)}var mu="libraryRequests.info";function hu(e){var t=a.M.isVideo(e.libraryRequest.object),n=a.M.isInteractive(e.libraryRequest.object),c=a.M.isClip(e.libraryRequest.object);return r.createElement("div",{className:"bg-white rounded p-3"},r.createElement(Jo,{comments:e.comments,imageCdnUrl:e.config.get("imageCdnUrl")}),r.createElement("h2",{className:"h5"},r.createElement(i.x,{namespace:mu,phrase:"videoDetails"})),t&&r.createElement(r.Fragment,null,r.createElement(m,{video:e.libraryRequest.object,user:e.user,createViewKey:e.createViewKey,config:e.config}),r.createElement(ca,{libraryRequest:e.libraryRequest,hideBroadcastInfo:e.user.get("instanceRegion")===o.b.US,config:e.config})),n&&r.createElement(r.Fragment,null,r.createElement(Wo,{video:e.libraryRequest.object,currentUser:e.currentUser,createViewKey:e.createViewKey,config:e.config}),r.createElement(V,{libraryRequest:e.libraryRequest})),c&&r.createElement(r.Fragment,null,r.createElement(pu,{video:e.libraryRequest.object,currentUser:e.currentUser,createViewKey:e.createViewKey,config:e.config}),r.createElement(b,{libraryRequest:e.libraryRequest})))}},49824:function(e,t,n){"use strict";n.d(t,{j:function(){return i}});var r=n(32735);function i(){return r.createElement("div",{className:"bg-white rounded p-3"},r.createElement("div",{className:"partial-loading-background mb-2",style:{height:"1.25rem",width:"9rem"}}),r.createElement("div",{className:"col-12 mb-3 p-0"},r.createElement("div",{className:"responsive-img partial-loading-background rounded"})),r.createElement("div",{className:"row"},r.createElement("div",{className:"col-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"3.4rem"}})),r.createElement("div",{className:"col-9 mb-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"9rem"}})),r.createElement("div",{className:"col-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"5rem"}})),r.createElement("div",{className:"col-9 mb-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"2rem"}})),r.createElement("div",{className:"col-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"7rem"}})),r.createElement("div",{className:"col-9 mb-3"},r.createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"16rem"}}))))}},90083:function(e,t,n){"use strict";n.d(t,{q:function(){return wt}});var r=n(32735),i=n(42648),o=n(82602),a=n(70868),c=n(70065),l=n(77105),s=n(80247),u=n(34152),f=n(39396),d=n(85475),p={container:"VwD1b",spinner:"eJ85e"};function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e){var t,n,i=(t=(0,u.YD)(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.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)?m(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1];return r.useEffect((function(){var t;e.fetchOnScroll&&a&&!e.isFetching&&(null===(t=e.fetchNext)||void 0===t||t.call(e,e.nextCursor))}),[a,e.isFetching]),r.createElement("div",{className:"p-3 text-center ".concat(p.container),ref:o},e.isFetching?r.createElement(s.Z,{as:"span",animation:"border",role:"status",className:p.spinner}):r.createElement(f.x,{svgName:d.vn.ChevronDown,className:"svg-container cursor-pointer",size:f.S.Large,onClick:function(){var t;return null===(t=e.fetchNext)||void 0===t?void 0:t.call(e,e.nextCursor)}}))}h.defaultProps={fetchOnScroll:!1};var v=n(66703),y=n(85887),g=n(41087),b=n(44550),w=n(57857),E=n(53808),S=n(58424),k=n(2491),x=n(37360),O=n(40221),C=n(11275),N={isFavouritedByCurrentUser:function(e){var t;return!(1!==(null===(t=null==e?void 0:e.favouritedBy)||void 0===t?void 0:t.data.length))},isFavouritedByUser:function(e,t){var n;return!!O.m.findWhere(null===(n=null==e?void 0:e.favouritedBy)||void 0===n?void 0:n.data,{id:null==t?void 0:t.id})},updateVideoState:function(e,t,n){return{id:e.id,favouritedBy:{data:n?[{id:t.id}]:[],pagination:{limit:25,cursors:{next:"",previous:""}}}}},showFavouriteButton:function(e,t){var n;return!(!(null===(n=C.M.getCanBeConsumed(e))||void 0===n?void 0:n.canConsume)||!t&&!x.V.isTabletOrMobile()&&!N.isFavouritedByCurrentUser(e))}},j={favourited:"t0svX",favouriteButton:"CFRo3",heart:"ZMMQu",heartOutline:"truFo"};function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var I=w.T.encloseNamespace("shared.favouriteButton");function L(e){var t,n,i=(0,k.Z)(),o=N.isFavouritedByCurrentUser(e.video),a=(t=r.useState(o),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var n={}.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)?P(e,t):void 0}}(t,n)||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.")}()),c=a[0],l=a[1];r.useEffect((function(){l(o)}),[o]);var s="".concat("d-flex align-items-center justify-content-center"," cursor-pointer ").concat(j.favouriteButton," ").concat(c?j.favourited:"");return e.className&&(s+=" ".concat(e.className)),E.q.isFunction(e.setFavourite)&&E.q.isFunction(e.canFavourite)&&e.canFavourite(e.video)?r.createElement(S.L,{className:s,onClick:function(){var t=!c;l(t),e.setFavourite(e.video,t,null,(function(){i.error(I(C.M.isClip(e.video)?t?"favouriteClipError":"unfavouriteClipError":C.M.isInteractive(e.video)?t?"favouriteInteractiveError":"unfavouriteInteractiveError":t?"favouriteVideoError":"unfavouriteVideoError")),l(!t)}),e.analyticsData,e.analyticsOptions)},tabIndex:e.preventFocus?-1:void 0},r.createElement(f.x,{svgName:d.vn.Heart,className:"svg-container ".concat(j.heart)}),r.createElement(f.x,{svgName:d.vn.HeartOutline,className:"svg-container ".concat(j.heartOutline)})):r.createElement(r.Fragment,null)}var T,_,A,F=n(90305),D=n(24828),R=n(22231),M={baseFallbackContainer:"ZvbeV",svgFallbackContainer:"atIHN",subjectFallbackContainer:"m20L7",subjectFallbackContainerSmall:"QIbxu",subjectFallbackContainerLarge:"z_sHT",seriesItemFallback:"epoLB",playlistItemFallback:"h1S5T",playlistFallback:"ZbKBN",posterFallback:"I1mTo",subjectFallback:"kNG8Z",fallbackThumbnailImage:"nKsWZ",videoFallback:"LolCW",folderFallback:"mdrT5"};function U(e){var t,n=e.type,i=e.mediaType,o=e.extraClasses,a=e.containerClassSize;if(n===T.Video)return r.createElement("div",{className:"".concat(M.videoFallback," ").concat(e.extraClasses," bg-light-blue")});if(n===T.Folder)return r.createElement("div",{className:"".concat(M.folderFallback," ").concat(e.extraClasses," ").concat((0,R.x)(e.name,D.o))});var c=function(e){return e===T.SeriesThumbnail?M.seriesItemFallback:e===T.PlaylistThumbnail?M.playlistItemFallback:e===T.Playlist?M.playlistFallback:e===T.Series||e===T.TallSubject?M.posterFallback:e===T.Subject?"".concat(M.subjectFallback," svg-container d-inline-block"):""}(n),l=function(e){return e===T.SeriesThumbnail||e===T.PlaylistThumbnail?d.vn.Play:e===T.Playlist?d.vn.Image:e===T.Series?d.vn.Series:e===T.Subject||e===T.TallSubject?d.vn.FileImg:""}(n),s=function(e){return e===T.Subject?f.S.ExtraLarge:f.S.Standard}(n),u="".concat(function(e,t,n){if(t===T.Subject){var r=n===A.Large?M.subjectFallbackContainerLarge:M.subjectFallbackContainerSmall;return"".concat(M.subjectFallbackContainer," ").concat(r)}return e===_.Svg?t===T.SeriesThumbnail||t===T.PlaylistThumbnail?"".concat(M.svgFallbackContainer," rounded-3"):M.svgFallbackContainer:M.baseFallbackContainer}(i,n,a));return o&&(u+=" ".concat(e.extraClasses)),r.createElement("div",{className:u},i===_.Svg?r.createElement(f.x,{svgName:l,className:"".concat(c," ").concat(null!==(t=e.svgContainerClassName)&&void 0!==t?t:""),tagName:"div",size:s}):r.createElement("div",{className:M.fallbackThumbnailImage,style:{backgroundImage:"url('".concat(l,"')")}}))}function V(e){var t=C.M.getVideoProgress(e.video),n=t&&e.video.duration&&t/e.video.duration*1e5;return n?r.createElement("div",{className:"bg-primary h-100",style:{width:"".concat(n,"%")}}):r.createElement(r.Fragment,null)}!function(e){e[e.Playlist=0]="Playlist",e[e.PlaylistThumbnail=1]="PlaylistThumbnail",e[e.Series=2]="Series",e[e.SeriesThumbnail=3]="SeriesThumbnail",e[e.Subject=4]="Subject",e[e.TallSubject=5]="TallSubject",e[e.Video=6]="Video",e[e.Folder=7]="Folder"}(T||(T={})),function(e){e[e.Svg=0]="Svg",e[e.Image=1]="Image"}(_||(_={})),function(e){e[e.Large=0]="Large",e[e.Small=1]="Small"}(A||(A={})),U.defaultProps={mediaType:_.Svg,containerClassSize:A.Large};var B={bottomBar:"YnXtZ"};function q(e){return C.M.isVideo(e.video)?r.createElement("div",{className:B.bottomBar},r.createElement(V,{video:e.video})):r.createElement(r.Fragment,null)}var G=n(77037),Z=n(21326),z="d-inline-block svg-container",H="span";function W(e){var t=e.children,n=e.className,i=void 0===n?z:n,o=e.tagName,a=void 0===o?H:o,c=e.size,l=void 0===c?f.S.Standard:c,s=e.onClick,u=e.title,d=e.tooltipPlacement,p=void 0===d?"right":d,m=a,h={className:"".concat(i," svg-container ").concat(l),onClick:E.q.isFunction(s)?s:null};return u?r.createElement(Z.u,{title:u,placement:p},r.createElement(m,Object.assign({},h),t)):r.createElement(m,Object.assign({},h),t)}function Q(){return r.createElement("svg",{viewBox:"0 0 41 70"},r.createElement("g",null,r.createElement("path",{fill:"#F8981D",d:"M 0 0 41 35 0 70z"})))}var Y=n(76044),K={std:"ct8Ht",sm:"dvCes",stdIcon:"iy0pu",smIcon:"Z_mZf"};function $(e){var t,n,i;return(C.M.isInteractive(e.video)||C.M.isClip(e.video))&&(e.video._liteOwner||(null===(t=e.video._isClickViewCurated)||void 0===t?void 0:t.value))?(null===(n=e.video._isClickViewCurated)||void 0===n?void 0:n.value)?r.createElement("div",{className:"".concat("sm"===e.size?K.sm:K.std," me-1 rounded-circle position-relative bg-white")},r.createElement(W,{className:"me-1 ".concat("sm"===e.size?K.smIcon:K.stdIcon)},r.createElement(Q,null))):r.createElement("div",{className:"".concat("sm"===e.size?K.sm:K.std," me-1")},r.createElement(G.q,{imageCdnUrl:e.imageCdnUrl,initials:Y.l.getInitials(e.video._liteOwner.name,e.video._liteOwner.surname),imageUrl:null===(i=e.video._liteOwner.avatar)||void 0===i?void 0:i.url})):r.createElement(r.Fragment,null)}var X={pluginHover:"h4RQa"},J="shared.pluginHover";function ee(e){return e.isPlugin?r.createElement(l.F,{appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,onClick:e.onClick,className:"\n position-absolute top-0 start-0 end-0 bottom-0 opacity-0 cursor-pointer\n ".concat(X.pluginHover,"\n ").concat(e.className?e.className:"","\n ")},r.createElement("span",{className:"position-absolute top-50 start-50 translate-middle text-nowrap h4 text-white"},r.createElement(v.x,{namespace:J,phrase:"embed"}))):r.createElement(r.Fragment,null)}var te={padlock:"w4cg8",sm:"JpIYd"};function ne(e){var t="sm"===e.size?f.S.Small:f.S.Standard;return r.createElement("div",{className:"".concat(te.padlock," ").concat("sm"===e.size?te.sm:""," bg-white cursor-default d-flex align-items-center justify-content-center")},r.createElement(f.x,{svgName:d.vn.Lock,size:t}))}var re=n(88483),ie=n(87013),oe={logo:"OA9ft",sm:"fyo2J"};function ae(e){var t,n,i,o,a,c;if(!C.M.isVideo(e.video)||!e.companyLogoFallbackUrl)return r.createElement(r.Fragment,null);var l=null===(n=null===(t=e.video.productionCompanies)||void 0===t?void 0:t.data)||void 0===n?void 0:n[0],s=ie.j.createUrl(null!==(o=null===(i=null==l?void 0:l.logo)||void 0===i?void 0:i.url)&&void 0!==o?o:e.companyLogoFallbackUrl,{size:re.h2.Small}),u=(0,R.x)(l.name,D.o);return s?r.createElement("div",null,r.createElement(Z.u,{title:null==l?void 0:l.name,spanHack:!0},r.createElement("div",{className:"".concat(oe.logo," ").concat("sm"===e.size?oe.sm:""," ").concat(!(null===(a=null==l?void 0:l.metadata)||void 0===a?void 0:a.colour)&&u),style:{backgroundImage:"url(".concat(s,")"),backgroundColor:null===(c=null==l?void 0:l.metadata)||void 0===c?void 0:c.colour}}))):r.createElement(r.Fragment,null)}ae.defaultProps={size:"md"};var ce=n(47673),le=n(74421),se=n(17977);function ue(e){return C.M.isClip(e.video)?r.createElement(se.y,{typeId:le.E.Clip,size:e.size,inContainer:!0}):C.M.isInteractive(e.video)?r.createElement(se.y,{typeId:le.E.Interactive,status:e.video.status,size:e.size,inContainer:!0}):r.createElement(r.Fragment,null)}ue.default={size:"md"};var fe=n(17082);n(33755);var de=r.createContext({hasProvider:!1}),pe={hoverContainer:"TzWQw",hovering:"gdTcW"};function me(e){var t,n=r.useContext(de);if(null===(t=n.useInitialize)||void 0===t||t.call(n,e),!n.hasProvider)return r.createElement(r.Fragment,null);if("picture-in-picture"===n.mode)return r.createElement(r.Fragment,null);if("hover"===e.mode&&n.isOnPlayPage)return r.createElement(r.Fragment,null);if("play-page"===e.location)return r.createElement(fe.t0,{node:n.portalNode});var i=n.started,o="rounded-3";"popout-video"===e.location&&(o="rounded-top-3");var a="".concat(pe.hoverContainer," ").concat(i?pe.hovering:""," ").concat(o," overflow-hidden");return r.createElement("div",{className:a},r.createElement(fe.t0,{node:n.portalNode}))}var he=n(32557),ve={overlayContainer:"qu3A3",topLeftContainer:"gjhMe",topRightContainer:"XAfZW",overlay:"NTrtm",downScale:"puKcM",title:"_6FukN",gradient:"rXzR8",playIcon:"dndOA",videoProgress:"yhWf4",badgeContainer:"AtgmC",clipProgress:"E2egN",interactiveProgress:"WycwR"};function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ge(e){var t,n,i,o,a,l,s,u=C.M.getCanBeConsumed(e.video),p=u.canNavigate,m=u.canConsume,h=y.t.isObject(null===(t=e.appLink)||void 0===t?void 0:t.params)?null===(n=e.appLink)||void 0===n?void 0:n.params:{},v=Object.assign(Object.assign({},e.analyticsOptions),{entity:C.M.getAnalyticsEntity(e.video)}),w=N.showFavouriteButton(e.video,e.hovering),E=C.M.isVideo(e.video),S=C.M.getRating(e.video),k=(l=(0,he.L)({delay:100}),s=2,function(e){if(Array.isArray(e))return e}(l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(l,s)||function(e,t){if(e){if("string"==typeof e)return ye(e,t);var n={}.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)?ye(e,t):void 0}}(l,s)||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.")}()),x=k[0],O=k[1]&&m&&e.hoverToPlay,j=Object.assign(Object.assign({},e.analyticsData),{id:e.video.id,name:e.video.name}),P=Object.assign(Object.assign({},v),{actionType:c.Vw.Click,descriptor:c._S.Thumbnail});return r.createElement(Z.u,{title:C.M.getPrivacyReasoning(e.video),spanHack:!0,spanHackClassName:""},r.createElement("div",{className:"position-relative rounded-3 overflow-hidden",ref:x},r.createElement(ee,{isPlugin:e.commonVideoProps.isPlugin,className:"rounded-3",appLink:p?e.appLink:null,analyticsData:j,analyticsOptions:P}),w&&r.createElement("div",{className:ve.topRightContainer},r.createElement(L,{setFavourite:e.commonVideoProps.setFavourite,canFavourite:e.commonVideoProps.canFavourite,video:e.video,analyticsData:e.analyticsData,analyticsOptions:v})),!p&&r.createElement("div",{className:ve.topRightContainer},r.createElement(ne,null)),r.createElement("div",{className:"".concat(ve.topLeftContainer," d-flex flex-no-wrap")},e.showOwner&&r.createElement($,{video:e.video,imageCdnUrl:e.commonVideoProps.imageCdnUrl}),r.createElement(ue,{video:e.video}),r.createElement(ae,{video:e.video,companyLogoFallbackUrl:e.commonVideoProps.companyLogoFallbackUrl})),r.createElement(F.Z,{data:C.M.getThumbnail(e.video),appLink:p?e.appLink:null,imageType:re.__.Thumbnails,imageOptions:e.imageOptions,preload:e.preload,className:ve.gradient,alt:("series"in e.video&&(null===(i=e.video.series)||void 0===i?void 0:i.name)?"".concat(e.video.series.name,": "):"")+e.video.name,analyticsData:j,analyticsOptions:P,preventFocus:!0},!(!e.hovering||!p)&&r.createElement(f.x,{className:ve.playIcon,svgName:d.vn.PlayCircle}),r.createElement(U,{type:T.Video}),r.createElement("div",{className:ve.overlayContainer},r.createElement("div",{className:ve.overlay},r.createElement("div",{className:"".concat((o=e.hovering,a="mb-1",o&&(a+=ve.downScale),a)," ").concat(ve.title)},E&&r.createElement(ce.$,{type:e.commonVideoProps.subTextType,className:"text-shadow clamp-1",video:e.video,appLink:null,analyticsOptions:null}),r.createElement("span",{className:"h6 text-reset text-shadow clamp-1"},C.M.getTitle(e.video))),r.createElement(q,{video:e.video}),e.hovering&&r.createElement(b.c,{className:"mt-1"},C.M.isVideo(e.video)&&r.createElement(r.Fragment,null,r.createElement(g.C,{type:g.g.Rating,data:S}),e.video.hasSubtitle&&r.createElement("span",{className:"badge p-0"},r.createElement(f.x,{svgName:d.vn.CloseCaptionBadge})),r.createElement(g.C,{type:g.g.Interactive,data:e.video.hasInteractives}),r.createElement(g.C,{type:g.g.DurationExact,data:C.M.getDuration(e.video)})))))),O&&r.createElement(me,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:h.context,contextId:h.contextId,moviesAndTv:h.mtv})))}var be,we=n(11306),Ee=n(31647),Se=r.createContext({}),ke=n(52076);function xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}!function(e){e.Left="8px",e.Right="calc(100% - 8px)",e.Center="center"}(be||(be={}));var Oe=function(e,t,n){var r,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.2,o=e.x,a=e.y,c=e.width,l=e.height,s=document.getElementById("content-width-reference");if(!s)return{};var u=t||c*i,f=t?t*(l/c):l*i,d=t?u/c:i;r=o-(u-c)/2,u<n&&(r-=(n-u)/2,f=l*(d=(u=n)/c));var p=a-(f-l)/2+window.scrollY,m=r,h=be.Center;return r-s.offsetLeft<8&&(m=o-4,h=be.Left),s.offsetWidth+s.offsetLeft-(r+u)<8&&(m=t?o+c-t:o-c*(d-1)+8,h=be.Right),{left:m,top:p,height:f,width:u,transformOrigin:h,position:"absolute",originalWidth:c,originalHeight:l}},Ce={positionWrapper:"jO7pW",animationWrapper:"xXfXO",zoom:"BrrtL"};function Ne(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return je(e,t);var n={}.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)?je(e,t):void 0}}(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 je(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Pe(e){var t,n,i=e.hoverableComponent,o=e.componentProps,a=e.minHoverWidth,l=e.fixedHoverWidth,s=e.hoverScale,u=r.useContext(Se).setPreviewContentNode;void 0===u&&Ee.Q.Ry.throw(new we.H("Please use VideoPreviewContext inside a VideoPreviewContextProvider"));var f=r.useMemo((function(){return(0,fe.oD)()}),[]),d=Ne((0,he.L)({delay:100}),2),p=d[0],m=d[1],h=Ne((0,he.X)(),2),v=h[0],y=h[1],g=Ne(r.useState(!1),2),b=g[0],w=(g[1],r.useRef(null)),E=r.useRef(!1),S=m||y;!function(e,t,n){var i,o,a=(i=r.useState(e),o=2,function(e){if(Array.isArray(e))return e}(i)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(i,o)||function(e,t){if(e){if("string"==typeof e)return xe(e,t);var n={}.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}}(i,o)||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.")}()),l=a[0],s=a[1],u=r.useRef(e?new Date:null);r.useEffect((function(){if(t&&n&&n.entity&&t.location)if(e)l||s(!0),u.current=new Date,ke.k.logUserAction(t,Object.assign(Object.assign({},n),{actionType:c.Vw.Hover}));else{if(!l)return;var r=(new Date).getTime()-u.current.getTime();u.current=null,ke.k.logUserAction(Object.assign(Object.assign({},t),{timeHoveredInMilliseconds:r,timeHoveredInSeconds:r/1e3}),Object.assign(Object.assign({},n),{actionType:c.Vw.Unhover}))}}),[e])}(S,e.analyticsData,e.analyticsOptions),r.useEffect((function(){E.current!==S&&(u(S||b?f:null),E.current=S)}),[S]);var k=(null===(n=null===(t=w.current)||void 0===t?void 0:t.getBoundingClientRect)||void 0===n?void 0:n.call(t))||{},x=k.x,O=k.y,C=k.width,N=k.height,j=r.useMemo((function(){return Oe({x:x,y:O,width:C,height:N},l,a,s)}),[x,O,C,N,s]),P=j?j.originalWidth/j.width:1,I=i;return r.createElement("div",{ref:w},r.createElement("div",{ref:p},r.createElement(I,Object.assign({isHovering:!1},o))),(S||b)&&r.createElement(fe.Nq,{node:f},r.createElement("div",{className:"".concat(Ce.positionWrapper," ").concat(Ce.animationWrapper),style:Object.assign({"--scale":P},j),ref:v},r.createElement(I,Object.assign({isHovering:!0,hoverPositionConfig:j,cleanPortalNode:function(){return u(null)}},o)))))}function Ie(e){return e.audience?r.createElement("div",{className:"audience-label border rounded-pill d-inline-block px-2 text-nowrap \n ".concat("border-"+e.border," ").concat(e.className?e.className:"")},e.audience.name):r.createElement(r.Fragment,null)}Pe.ReferenceContainer=function(e){return r.createElement("div",{id:"content-width-reference",className:"flex-grow-1"},e.children)};var Le={badgeContainer:"fy9Un",sm:"Rb0TL"};function Te(e){var t=C.M.getRating(e.video),n=!!e.audience&&"sm"!==e.size,i=!n&&!e.hideRating&&!!t&&"sm"!==e.size;return!e.hideDuration||n||i?r.createElement(b.c,{className:"".concat(Le.badgeContainer," ").concat("sm"===e.size?Le.sm:"")},n&&r.createElement(Ie,{audience:e.audience,className:"bg-white text-dark",border:"dark"}),i&&r.createElement(g.C,{type:g.g.Rating,data:t}),!e.hideDuration&&r.createElement(g.C,{type:e.newDurationStyle?g.g.DurationApproximate:g.g.DurationExact,data:e.duration||C.M.getDuration(e.video)})):r.createElement(r.Fragment,null)}Te.defaultProps={newDurationStyle:!0,size:"md"};var _e=n(10657),Ae=n(45428);function Fe(e){if(!e.yearGroups)return r.createElement(r.Fragment,null);var t=Ae.l.mapRestrictionToText(e.video._restrictions,e.yearGroups);return C.M.getCanBeConsumed(e.video).canConsume&&t?r.createElement(Z.u,{spanHack:!0,spanHackClassName:e.className||"d-inline-block ps-1",title:t,placement:e.tooltipPlacement||"top"},r.createElement(f.x,{svgName:d.vn.Lock,size:"sm"===e.size?f.S.Small:f.S.Standard})):r.createElement(r.Fragment,null)}var De={dot:"VrK4W",smallText:"OScyH",title:"svw3F"},Re=w.T.encloseNamespace("shared.videoTitle"),Me=new Date;function Ue(e){var t,n,i=e.video.dateReleased,o=i&&(n=i,_e.O.isSame(n,Me,"year")&&_e.O.isSame(n,Me,"month")),a=e.showNewVideoIndicator&&o&&(null===(t=e.video._isClickViewCurated)||void 0===t?void 0:t.value);return r.createElement(r.Fragment,null,r.createElement(Z.u,{title:"".concat(a?Re("newVideo"):""),spanHack:!0,spanHackClassName:"d-inline-block"},a&&r.createElement("span",{className:"rounded-circle bg-green d-inline-block me-1 ".concat(De.dot," ").concat("h6"===e.titleSize?De.smallText:"")})),r.createElement("h2",{className:"".concat(e.titleSize," ").concat(De.title," ").concat(e.className," d-inline")},e.title||e.video.name),e.showPadlock&&r.createElement(Fe,{video:e.video,yearGroups:e.yearGroups,size:e.lockSize}))}Ue.defaultProps={titleSize:"h6",className:""};function Ve(e){var t,n,i=e.video,o=e.appLink,a=C.M.getCanBeConsumed(i).canNavigate;return r.createElement("div",{className:"mt-2 ".concat("r70GR")},r.createElement("div",{className:"d-flex flex-column ".concat("rULXI")},C.M.isVideo(i)&&r.createElement(ce.$,{type:e.commonVideoProps.subTextType,className:"text-truncate",video:i,appLink:null===(n=(t=e.commonVideoProps).getSubTextAppLink)||void 0===n?void 0:n.call(t,e.video),analyticsOptions:{location:c.LZ.VideoThumbnail}}),r.createElement(l.F,{className:"text-reset clamp-2 align-middle",appLink:a?o:null},r.createElement(Ue,{video:e.video,yearGroups:e.commonVideoProps.yearGroups,lockSize:"sm",showNewVideoIndicator:e.commonVideoProps.showNewVideoIndicator,showPadlock:!e.commonVideoProps.hasStudentExperience}))))}var Be="OjHQZ";function qe(e){var t,n;return e.appLink?r.createElement(l.F,{appLink:e.appLink,analyticsData:e.appLinkAnalyticsData,analyticsOptions:e.appLinkAnalyticsOptions,className:"\n p-1 pe-2 rounded-pill d-inline-flex align-items-center cursor-pointer\n text-decoration-none ".concat(null===(t=e.theme)||void 0===t?void 0:t.container," ").concat(Be," ").concat(e.active?"kD1xM":"","\n ")},r.createElement(Ge,Object.assign({},e))):r.createElement("div",{className:"p-1 pe-2 rounded-pill d-inline-flex align-items-center ".concat(null===(n=e.theme)||void 0===n?void 0:n.container," ").concat(Be," ").concat("eGiNR")},r.createElement(Ge,Object.assign({},e)))}function Ge(e){var t;return r.createElement(r.Fragment,null,r.createElement(f.x,{className:"".concat("SS2zL"," rounded-circle bg-").concat(e.iconVariant," text-white"),svgName:e.svgName}),r.createElement("span",{className:"ps-1 text-nowrap user-select-none ".concat(null===(t=e.theme)||void 0===t?void 0:t.tabLabel)},e.text))}function Ze(e){var t;return!e.video||C.M.isInteractive(e.video)||C.M.isClip(e.video)?r.createElement(r.Fragment,null):(null===(t=e.video._hasCurriculumLinks)||void 0===t?void 0:t.value)?r.createElement(qe,{theme:{container:"classroom-guide-tag",tabLabel:"classroom-guide-tag-label"},svgName:d.vn.GraduationCap,iconVariant:"navy",text:w.T.getPhrase("shared.classroomGuideTag","curriculum"),appLink:e.appLink,appLinkAnalyticsData:Object.assign(Object.assign({videoGuidanceType:"curriculum"},C.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:c.Vw.Click,entity:C.M.getAnalyticsEntity(e.video)},e.analyticsOptions)}):r.createElement(r.Fragment,null)}function ze(e){var t;if(!C.M.showInteractivesGuidance(e.video))return r.createElement(r.Fragment,null);var n=!C.M.isInteractive(e.video)&&((null===(t=e.video.interactives)||void 0===t?void 0:t.data.length)||0);return r.createElement(qe,{svgName:d.vn.Interactive,iconVariant:"green",text:w.T.getPhrase("shared.interactivesTag","interactives",{smartCount:n}),appLink:e.appLink,appLinkAnalyticsData:Object.assign(Object.assign({videoGuidanceType:"interactive",videoGuidanceTotalItems:n},C.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:c.Vw.Click,entity:C.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}function He(e){if(!C.M.showResourcesGuidance(e.video))return r.createElement(r.Fragment,null);var t,n,i,o=(t=e.video,C.M.isInteractive(t)?0:((null===(n=t.resources)||void 0===n?void 0:n.data.length)||0)+((null===(i=t.links)||void 0===i?void 0:i.data.length)||0));return r.createElement(qe,{svgName:d.vn.Resources,iconVariant:"indigo",text:w.T.getPhrase("shared.resourcesTag","resources",{smartCount:o}),appLink:e.appLink,appLinkAnalyticsData:Object.assign(Object.assign({videoGuidanceType:"resource",videoGuidanceTotalItems:o},C.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:c.Vw.Click,entity:C.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}function We(e){var t,n,i,o,a,c,l=C.M.showInteractivesGuidance(e.video)&&C.M.showResourcesGuidance(e.video);return r.createElement("div",{className:"".concat(e.containerClassName," ").concat(l?e.responsiveClassName:"")},r.createElement(Ze,{appLink:null===(n=(t=e.commonVideoProps).getClassroomGuideAppLink)||void 0===n?void 0:n.call(t,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}),r.createElement(He,{appLink:null===(o=(i=e.commonVideoProps).getResourceGuidanceAppLink)||void 0===o?void 0:o.call(i,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}),r.createElement(ze,{appLink:null===(c=(a=e.commonVideoProps).getInteractiveGuidanceAppLink)||void 0===c?void 0:c.call(a,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}))}var Qe={button:"CXHmZ"};function Ye(e){var t=e.removeButtonTooltip||w.T.getPhrase("shared.removeVideoButton","removeFromRow");return r.createElement("div",{className:"me-2"},r.createElement(Z.u,{title:t,spanHack:!0},r.createElement(S.L,{onClick:e.onClickRemove,className:"d-flex align-items-center justify-content-center ".concat(Qe.button),tabIndex:e.preventFocus?-1:void 0},r.createElement(f.x,{svgName:d.vn.Close,className:"svg-container ".concat(Qe.heart)}))))}var Ke=function(e){var t,n=e.video,i=e.appLink,o=e.imageOptions,a=e.preload,l=e.isHovering,s=e.hoverToPlay,u=y.t.isObject(null==i?void 0:i.params)?null==i?void 0:i.params:{},f=C.M.getCanBeConsumed(n),d=f.canNavigate,p=f.canConsume;r.useEffect((function(){return function(){var t;null===(t=e.cleanPortalNode)||void 0===t||t.call(e)}}),[]);var m="position-relative bg-white";e.extraClasses&&(m+=" ".concat(e.extraClasses)),l&&(m+=" rounded-3 shadow-lg");var h=Object.assign(Object.assign({},e.analyticsOptions),{entity:C.M.getAnalyticsEntity(n)}),v=e.isHovering&&p&&s,g=N.showFavouriteButton(e.video,l),b=Object.assign(Object.assign({},e.analyticsData),{id:n.id,name:n.name}),w=Object.assign(Object.assign({},h),{actionType:c.Vw.Click,descriptor:c._S.Thumbnail});return r.createElement("div",{className:m},r.createElement("div",{className:"FAuzc"},!!E.q.isFunction(e.onClickRemove)&&(!!x.V.isTabletOrMobile()||l)&&r.createElement(Ye,{onClickRemove:function(t){var n;t.preventDefault(),null===(n=e.onClickRemove)||void 0===n||n.call(e)},removeButtonTooltip:e.removeButtonTooltip,preventFocus:!0}),g&&r.createElement(L,{setFavourite:e.commonVideoProps.setFavourite,canFavourite:e.commonVideoProps.canFavourite,video:n,analyticsData:e.analyticsData,analyticsOptions:h,preventFocus:!0}),!d&&r.createElement(Z.u,{title:C.M.getPrivacyReasoning(e.video),spanHack:!0,spanHackClassName:""},r.createElement(ne,null))),r.createElement("div",{className:"position-relative"},r.createElement(ee,{isPlugin:e.commonVideoProps.isPlugin,className:l?"rounded-top-3":"rounded-3",onClick:function(){var t;return null===(t=e.cleanPortalNode)||void 0===t?void 0:t.call(e)},appLink:d?i:null,analyticsData:b,analyticsOptions:w}),r.createElement(F.Z,{onClick:function(){var t;return null===(t=e.cleanPortalNode)||void 0===t?void 0:t.call(e)},data:C.M.getThumbnail(n),appLink:d?i:null,imageType:re.__.Thumbnails,imageOptions:o,preload:a,alt:("series"in n&&(null===(t=n.series)||void 0===t?void 0:t.name)?"".concat(n.series.name,": "):"")+n.name,analyticsData:b,analyticsOptions:w,preventFocus:!e.hideTitle,appLinkClassName:"position-absolute top-0 start-0 h-100 w-100 overflow-hidden ".concat(l?"rounded-top-3":"rounded-3"),imageClassName:l?"rounded-top-3":"rounded-3"},r.createElement(U,{type:T.Video}),r.createElement("div",{className:"p-absolute w-100 h-100 text-white"},r.createElement("div",{className:"".concat("wHY80"," d-flex flex-no-wrap")},e.showOwner&&r.createElement($,{video:n,imageCdnUrl:e.commonVideoProps.imageCdnUrl}),r.createElement(ue,{video:n}),r.createElement(ae,{video:n,companyLogoFallbackUrl:e.commonVideoProps.companyLogoFallbackUrl})),r.createElement(Te,{video:e.video,audience:e.audience,hideRating:e.hideRating,hideDuration:e.hideDuration}),r.createElement(q,{video:n}))),v&&r.createElement(me,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:u.context,contextId:u.contextId,moviesAndTv:u.mtv,location:"popout-video"})),!l&&!e.hideTitle&&r.createElement(Ve,Object.assign({},e)),r.createElement("div",{className:"".concat("vMaXP"," ").concat(l?"".concat("tR1jA"," box-shadow"):"")},l&&r.createElement(r.Fragment,null,r.createElement("div",{className:"".concat(l?"KJrT1":"")},r.createElement(Ve,Object.assign({},e)),e.showVideoGuidance&&l&&r.createElement(We,{commonVideoProps:e.commonVideoProps,video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,responsiveClassName:"OixHb",containerClassName:"d-flex justify-content-start align-items-center pt-2"})))))};function $e(e){return r.createElement(r.Fragment,null,r.createElement(Pe,{hoverableComponent:Ke,componentProps:e,fixedHoverWidth:400,minHoverWidth:400,analyticsData:Object.assign(Object.assign({},e.analyticsData),{id:e.video.id,name:e.video.name}),analyticsOptions:Object.assign(Object.assign({},e.analyticsOptions),{entity:C.M.getAnalyticsEntity(e.video)})}))}var Xe,Je={mask:"qpc7L",small:"L8Oxs",video:"b8kJW",playlist:"eo2p2",maskContainer:"lpwag"};function et(e){var t=e.type,n=e.size,i=function(e){return e===Xe.Video?Je.video:e===Xe.Playlist?Je.playlist:""}(t),o=function(e){return e===Xe.Video?d.vn.PlayCircle:""}(t);return r.createElement("div",{className:"".concat(Je.maskContainer," ").concat("sm"===n?Je.small:"")},r.createElement("div",{className:Je.mask}),r.createElement(f.x,{svgName:o,className:i}))}!function(e){e[e.Video=0]="Video",e[e.Playlist=1]="Playlist",e[e.Series=2]="Series"}(Xe||(Xe={})),et.defaults={size:"md"};var tt,nt={unchecked:"bup9I",outline:"ealw_",checked:"A1Ov0",checkMark:"c14lI"};function rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function it(e){var t,n,i=(t=r.useState(e.status===tt.Complete),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return rt(e,t);var n={}.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)?rt(e,t):void 0}}(t,n)||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.")}()),o=i[0],a=i[1];r.useEffect((function(){a(e.status===tt.Complete)}),[e.status]);var c="cursor-pointer rounded-circle ".concat(o?nt.checked:nt.unchecked);return e.className&&(c+=" ".concat(e.className)),"outline"===e.style&&(c+=" ".concat(nt.outline)),e.status&&e.status!==tt.None&&E.q.isFunction(e.setStatus)?r.createElement(S.L,{className:c,onClick:function(){var t=!o;a(t);var n=t?tt.Complete:tt.Incomplete;e.setStatus(n).catch((function(){a(!t)}))},disabled:e.disabled},r.createElement(f.x,{svgName:d.vn.Tick,className:"svg-container ".concat(nt.checkMark)})):r.createElement(r.Fragment,null)}!function(e){e.None="None",e.Complete="Complete",e.Incomplete="Incomplete"}(tt||(tt={})),it.defaultProps={style:"filled"};var ot,at={container:"efxnE",cvIcon:"OJ_ZQ",action:"vWvGn"};function ct(e){return C.M.getCanBeConsumed(e.video).canNavigate?function(e){var t;return!(null===(t=C.M.getCanBeConsumed(e.video))||void 0===t?void 0:t.canConsume)||!(!E.q.isFunction(e.setFavourite)||!E.q.isFunction(e.canFavourite))||!!E.q.isFunction(e.setCheckMarkStatus)}(e)?r.createElement("div",{className:"".concat(at.container," d-flex align-items-center")},r.createElement(L,{setFavourite:e.setFavourite,canFavourite:e.canFavourite,video:e.video,className:at.action,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,preventFocus:!0}),r.createElement(it,{status:e.checkMarkStatus,setStatus:e.setCheckMarkStatus,className:at.action})):r.createElement(r.Fragment,null):r.createElement("div",{className:at.container},r.createElement(ne,{size:e.size}))}!function(e){e[e.Below=1]="Below",e[e.Overlay=2]="Overlay",e[e.Independent=3]="Independent"}(ot||(ot={}));var lt={titleOverlay:"krg9f",clip:"MPRU6",large:"g5_ww",interactive:"Zzo3e",titleBelow:"tZjPt",overlayContainer:"EElm1",topLeftContainer:"hrw3I",gradient:"LS_EH"};function st(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ut(e,t);var n={}.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)?ut(e,t):void 0}}(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 ut(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ft="shared.staticVideoThumbnail";function dt(e){var t,n,i,o=e.type,a=e.video,s="static"===o,u=e.textPosition===ot.Overlay,f=C.M.getCanBeConsumed(e.video).canNavigate,d="";return u?(d=lt.titleOverlay,f&&(C.M.isClip(a)&&(d+=" "+lt.clip),C.M.isInteractive(a)&&(d+=" "+lt.interactive))):d=lt.titleBelow,r.createElement("div",{className:d},C.M.isVideo(a)&&r.createElement(ce.$,{type:s?e.commonVideoProps.subTextType:"series",className:u?"text-shadow clamp-1":"clamp-2",video:a,appLink:s&&!u?null===(n=(t=e.commonVideoProps).getSubTextAppLink)||void 0===n?void 0:n.call(t,e.video):null,analyticsOptions:{location:c.LZ.VideoThumbnail}}),!u&&f&&s?r.createElement(l.F,{className:"h6 text-reset clamp-2",appLink:e.appLink},r.createElement(Ue,{video:a,showNewVideoIndicator:e.commonVideoProps.showNewVideoIndicator,showPadlock:!e.commonVideoProps.hasStudentExperience})):r.createElement("span",{className:"h6 text-reset clamp-1"},r.createElement(Ue,{video:a,title:null!==(i=a.name)&&void 0!==i?i:w.T.getPhrase(ft,"videoUnavailable"),showNewVideoIndicator:s&&e.commonVideoProps.showNewVideoIndicator,showPadlock:s&&!e.commonVideoProps.hasStudentExperience})))}function pt(e){var t,n,i,o,a=e.type,l=e.video,s=e.textPosition,u=e.imageOptions,f=e.preload,d="static"===a,p=d&&y.t.isObject(null===(t=e.appLink)||void 0===t?void 0:t.params)?null===(n=e.appLink)||void 0===n?void 0:n.params:{},m=st((0,he.X)(),2),h=m[0],v=m[1],g=st((0,he.L)({delay:100}),2),b=g[0],w=g[1],E=C.M.getCanBeConsumed(l),S=E.canNavigate,k=E.canConsume,x=d&&w&&k&&e.hoverToPlay,O=d?Object.assign(Object.assign({},e.analyticsOptions),{entity:C.M.getAnalyticsEntity(l)}):{},j=d&&!!e.appLink&&!e.hideMask&&S,P=d?C.M.getPrivacyReasoning(e.video,e.showSignIn):"",I=d?Object.assign(Object.assign({},e.analyticsData),{id:l.id,name:l.name}):{},L=Object.assign(Object.assign({},O),{actionType:c.Vw.Click,descriptor:c._S.Thumbnail});return r.createElement(Z.u,{title:P,spanHack:!0,spanHackClassName:""},r.createElement("div",{className:(o="position-relative",o+=d&&e.appLink&&S?" cursor-pointer":"",e.extraClasses&&(o+=" ".concat(e.extraClasses)),s===ot.Overlay&&(o+=" rounded overflow-hidden"),o),ref:function(e){h.current=e,b.current=e}},d&&r.createElement(ee,{isPlugin:e.commonVideoProps.isPlugin,className:"sm"===e.size?"rounded":"rounded-3",appLink:S?e.appLink:null,analyticsData:I,analyticsOptions:L}),r.createElement(ct,{video:l,checkMarkStatus:!d&&e.checkMarkStatus,setCheckMarkStatus:!d&&e.setCheckMarkStatus,setFavourite:d&&e.commonVideoProps.setFavourite,canFavourite:function(){var t,n;if(d)return!e.disableFavourite&&(null===(n=(t=e.commonVideoProps).canFavourite)||void 0===n?void 0:n.call(t,e.video))&&N.showFavouriteButton(l,v)},analyticsData:d&&e.analyticsData,analyticsOptions:d&&O,size:e.size}),r.createElement(F.Z,{data:C.M.getThumbnail(l),appLink:d&&S?e.appLink:null,onClick:d&&S?e.onClick:void 0,imageType:re.__.Thumbnails,imageOptions:u,preload:f,className:function(){var t="overflow-hidden ".concat("sm"===e.size?"rounded":"rounded-3");return e.imageClassName&&(t+=" ".concat(e.imageClassName)),s===ot.Overlay&&(t+=" ".concat(lt.gradient)),t}(),alt:("series"in l&&(null===(i=l.series)||void 0===i?void 0:i.name)?"".concat(l.series.name,": "):"")+l.name,analyticsData:I,analyticsOptions:L,preventFocus:!0},j&&r.createElement(et,{type:Xe.Video,size:e.size}),r.createElement(U,{type:T.Video}),r.createElement("div",{className:lt.overlayContainer},s===ot.Overlay&&r.createElement(dt,Object.assign({},e)),r.createElement("div",{className:"".concat(lt.topLeftContainer," d-flex flex-no-wrap")},d&&e.showOwner&&r.createElement($,{video:l,imageCdnUrl:e.commonVideoProps.imageCdnUrl}),!e.hideVideoTypeBadge&&r.createElement(ue,{video:l,size:e.size}),d&&r.createElement(ae,{video:l,companyLogoFallbackUrl:e.commonVideoProps.companyLogoFallbackUrl,size:e.size})),r.createElement(q,{video:l}),r.createElement(Te,{video:e.video,audience:e.audience,hideRating:e.hideRating,hideDuration:e.hideDuration,newDurationStyle:e.newDurationStyle,size:e.size}))),x&&r.createElement(me,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:p.context,contextId:p.contextId,moviesAndTv:p.mtv}),s===ot.Below&&r.createElement(dt,Object.assign({},e))))}function mt(e){switch(e.type){case"static":case"cosmetic":return r.createElement(pt,Object.assign({},e));case"expandable":return r.createElement(ge,Object.assign({},e));case"popout":return r.createElement($e,Object.assign({},e));default:return}}mt.defaultProps={hideRating:!0,size:"md",hoverToPlay:!1};var ht=n(50072),vt=n(5984),yt={navItem:"GyyRT",active:"aVNhj",navContainer:"uQ6as",navItemHeading:"NjJLh"},gt="libraryRequests.leftNav";function bt(e){var t,n,i=e.libraryRequest,s=i.sender&&"".concat(i.sender.name," ").concat(i.sender.surname),u=(null===(t=i.object)||void 0===t?void 0:t.name)||i.name;return r.createElement(l.F,{className:"d-flex py-3 px-3 text-decoration-none ".concat(yt.navItem," ").concat(e.active?yt.active:""),appLink:Object.assign(Object.assign({},e.appLink),{args:[i.id],params:e.queryParams}),onClick:function(){return a.t.preventScrollTop()}},r.createElement("div",{className:"col-5 px-0"},r.createElement(mt,{video:null!==(n=i.object)&&void 0!==n?n:{},type:"cosmetic",imageOptions:{size:re.h2.Small},textPosition:ot.Independent,hideMask:!0})),r.createElement("div",{className:"col-7 ps-2"},r.createElement("div",{className:"d-flex justify-content-between w-100"},r.createElement("div",{className:"overflow-hidden"},r.createElement(ce.$,{type:"series",video:i.object,analyticsOptions:{location:c.LZ.LibraryRequestDetails}}),!!u&&r.createElement("h5",{className:"m-0 mb-0 h6",title:u},r.createElement("span",{className:"text-truncate pb-1 d-block ".concat(yt.navItemHeading)},u))),i.status!==ht.l.Pending&&r.createElement("div",{className:"flex-shrink-0 ms-1"},r.createElement(vt.h,{status:i.status}))),!!s&&r.createElement("div",null,r.createElement(v.x,{namespace:gt,phrase:i.status===ht.l.AutoApproved?"addedBy":"requestedBy",options:{fullName:s}})),r.createElement("div",null,(0,o.WU)(i.dateCreated))))}function wt(e){return r.createElement("div",{className:"".concat(yt.navContainer," bg-white rounded overflow-hidden")},r.createElement(i.$B,{hideTracksWhenNotNeeded:!0},e.libraryRequests.map((function(t,n){return r.createElement(bt,{libraryRequest:t,key:n,active:e.selectedId===t.id,appLink:e.appLink,queryParams:e.queryParams})})),(e.nextCursor||e.isFetching)&&r.createElement(h,{isFetching:e.isFetching,fetchNext:e.fetchNext,nextCursor:e.nextCursor,fetchOnScroll:!0})))}},7044:function(e,t,n){"use strict";n.d(t,{p:function(){return o}});var r=n(32735);function i(){return r.createElement("div",{className:"d-flex p-3"},r.createElement("div",{className:"col-5 px-0"},r.createElement("div",{className:"responsive-img partial-loading-background rounded"})),r.createElement("div",{className:"col-7 ps-2"},r.createElement("div",{className:"partial-loading-background mb-1",style:{height:"1.25rem",width:"9rem"}}),r.createElement("div",{className:"partial-loading-background",style:{height:"1rem",width:"4rem"}})))}function o(){return r.createElement("div",{className:"bg-white rounded"},Array(5).fill(null).map((function(e,t){return r.createElement(i,{key:t})})))}},17950:function(e,t,n){"use strict";n.d(t,{F:function(){return g}});var r=n(32735),i=n(57857),o=n(70065),a=n(53808),c=n(77105),l=n(90335);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function u(e,t,n){return(t=function(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var f="shared.videoSortSelect",d=a.q.memoize((function(){return u(u(u(u(u(u({},l.D.RecentlyAdded,{name:i.T.getPhrase(f,"recentlyAdded")}),l.D.AtoZ,{name:i.T.getPhrase(f,"atoz")}),l.D.ZtoA,{name:i.T.getPhrase(f,"ztoa")}),l.D.Newest,{name:i.T.getPhrase(f,"newest")}),l.D.Oldest,{name:i.T.getPhrase(f,"oldest")}),l.D.Series,{name:i.T.getPhrase(f,"series")})}));function p(e){var t,n,o=e.sortTypes||(t=e.includeProductionYear,n=d(),t&&(n=Object.assign(u({},l.D.ProductionYear,{name:i.T.getPhrase(f,"productionYear")}),n)),n);return r.createElement("div",{className:"dropdown"},r.createElement("button",{className:"btn btn-".concat(e.variant," ms-2 dropdown-toggle"),type:"button",id:"sort-select","data-bs-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},o[e.type].name),r.createElement("ul",{className:"dropdown-menu dropdown-menu-end","aria-labelledby":"sort-select"},Object.keys(o).map((function(t){var n="dropdown-item";return t===e.type&&(n+=" active"),r.createElement("li",{key:t},r.createElement(c.F,{className:n,appLink:e.getSortAppLink(t),analyticsData:{sort:o[t].name},analyticsOptions:e.analyticsOptions},o[t].name))}))))}function m(e){return m="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},m(e)}function h(e,t,n){return(t=function(e){var t=function(e){if("object"!=m(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=m(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}p.defaultProps={variant:"light"};var v=i.T.encloseNamespace("libraryRequests.sort"),y=function(){return h(h({},l.D.Newest,{name:v("newest")}),l.D.Oldest,{name:v("oldest")})};function g(e){var t=y();return r.createElement(p,{variant:"outline-dark",type:e.queryParams.sort||l.D.Newest,getSortAppLink:function(t){return Object.assign(Object.assign({},e.appLink),{params:Object.assign(Object.assign({},e.queryParams),{sort:t})})},sortTypes:t,analyticsOptions:{location:o.LZ.LibraryRequestDetails,entity:o.py.LibraryRequest,actionType:o.Vw.Sort,workflowPhase:o.eu.Complete}})}},5984:function(e,t,n){"use strict";n.d(t,{h:function(){return f},$:function(){return u}});var r=n(32735),i=n(57857),o=n(39396),a=n(85475),c=n(50072),l={svgContainer:"O2Czg"},s=i.T.encloseNamespace("libraryRequests.statusIcon");function u(e){switch(e){case c.l.AutoApproved:return s("autoApproved");case c.l.Approved:return s("approved");case c.l.Closed:return s("closed");case c.l.Rejected:return s("rejected")}return""}function f(e){var t="",n="".concat(l.svgContainer," text-white d-inline-block svg-container rounded-circle ");switch(e.status){case c.l.AutoApproved:t=a.vn.Check,n+="bg-gray-500";break;case c.l.Approved:t=a.vn.Check,n+="bg-success";break;case c.l.Closed:t=a.vn.Minus,n+="bg-gray-500";break;case c.l.Rejected:t=a.vn.Close,n+="bg-danger"}return r.createElement(o.x,{svgName:t,className:n,size:o.S.Small,title:u(e.status),tooltipSpanHack:!0,tooltipPlacement:"top"})}},32178:function(e,t,n){"use strict";n.d(t,{A:function(){return h}});var r=n(32735),i=n(57857),o=n(52076),a=n(77105),c=n(41087),l=n(58424),s=n(39396),u={pillTabSelector:"Hdi6o",tab:"RvNxr",minWidth:"GHSz9",radiusSmall:"VhJJa",tabLink:"WFyvo"};function f(e){return r.createElement(r.Fragment,null,!!e.tab.svgName&&r.createElement("div",{className:e.tab.name?"pe-1":""},r.createElement(s.x,{svgName:e.tab.svgName})),e.tab.name,"number"==typeof e.tab.count&&r.createElement("div",{className:"ps-2"},r.createElement(c.C,{type:c.g.Count,data:e.tab.count})))}function d(e){var t;return r.createElement("nav",{className:null!==(t=e.className)&&void 0!==t?t:"",ref:e.containerRef},r.createElement("ul",{className:"\n list-unstyled d-inline-block m-0 ".concat(u.pillTabSelector,"\n ").concat(e.borderRadius?u.radiusSmall:"","\n ").concat(e.listClassName,"\n ")},e.tabs.map((function(e,t){return r.createElement("li",{className:"\n p-0 ".concat(u.tab," ").concat(e.active?"btn btn-dark":"btn btn-outline-dark","\n ").concat(e.name?u.minWidth:""," ").concat(e.className,"\n "),key:t},e.appLink?r.createElement(a.F,{appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,className:"\n cursor-pointer d-flex align-items-center justify-content-center\n text-decoration-none text-reset px-2 text-nowrap ".concat(u.tabLink,"\n ")},r.createElement(f,{tab:e})):r.createElement(l.L,{className:"\n cursor-pointer d-flex align-items-center justify-content-center\n text-decoration-none text-reset px-2 text-nowrap ".concat(u.tabLink,"\n "),onClick:function(){return function(e){!e.active&&e.onSelect&&(e.onSelect(),e.analyticsData&&e.analyticsOptions&&o.k.logUserAction(e.analyticsData,e.analyticsOptions))}(e)}},r.createElement(f,{tab:e})))}))))}d.defaultProps={borderRadius:"lg"};var p=n(50997),m=i.T.encloseNamespace("libraryRequests.tabs");function h(e){var t=[{name:m("pending"),appLink:{application:p.OV.LIBRARY_REQUESTS,action:p.eX.LibraryRequests.PENDING_REQUESTS,args:[""]},active:"pending"===e.active},{name:m("past"),appLink:{application:p.OV.LIBRARY_REQUESTS,action:p.eX.LibraryRequests.PAST_REQUESTS,args:[""]},active:"past"===e.active}];return r.createElement("div",{className:"mb-3"},r.createElement(d,{tabs:t}))}},50072:function(e,t,n){"use strict";var r;n.d(t,{l:function(){return r}}),function(e){e.Pending="Pending",e.Approved="Approved",e.Rejected="Rejected",e.Closed="Closed",e.AutoApproved="AutoApproved"}(r||(r={}))},41026:function(e,t,n){"use strict";n.d(t,{K:function(){return c}});var r=n(32735),i=n(57857),o=n(89375),a=i.T.encloseNamespace("libraryRequests.libraryRequestTitle");function c(e){var t,n=(null===(t=null==e?void 0:e.object)||void 0===t?void 0:t.name)||(null==e?void 0:e.name),i=a("title")+(n?" - ".concat(n):"");r.useEffect((function(){return o.j.setPageTitle(i)}),[i])}},59198:function(e,t,n){"use strict";n.d(t,{s:function(){return a}});var r=n(86120),i=n(82378),o=n(25796);function a(e){var t=r.a.useGetFetch(),n=function(t){return o.y.comments(e,t)};return(0,i.i)(!!e&&n,(function(e){return t(n(e))}))}},85739:function(e,t,n){"use strict";n.d(t,{p:function(){return c}});var r=n(32735),i=n(86120),o=n(94223),a=n(25796);function c(e,t){var n=i.a.useGetFetch(),c=function(n){return a.y.libraryRequests(e,t,n)},l=function(e){return n(c(e))},s=(0,o.P)(c&&function(e){return c(e).key});return r.useEffect((function(){s&&s.shouldInitialFetch&&l()}),[e,t]),Object.assign(Object.assign({},s),{fetchNext:l})}},30328:function(e,t,n){"use strict";n.d(t,{A:function(){return o}});var r=n(32735),i=n(31647);function o(e){var t=e.id,n=e.appLink,o=e.requests;r.useEffect((function(){!t&&(null==o?void 0:o.length)&&i.Q.C$.trigger(Object.assign(Object.assign({},n),{args:[o[0].id]}),{replace:!0})}),[t,null==o?void 0:o.length])}},64429:function(e,t,n){"use strict";n.d(t,{m:function(){return c}});var r=n(32735),i=n(31647),o=n(50997),a=n(50072);function c(e,t,n){r.useEffect((function(){e&&(e.status===a.l.Pending&&"pending"!==t&&i.Q.C$.trigger({application:o.OV.LIBRARY_REQUESTS,action:o.eX.LibraryRequests.PENDING_REQUESTS,args:[e.id],params:n},{replace:!0}),e.status!==a.l.Pending&&"pending"===t&&i.Q.C$.trigger({application:o.OV.LIBRARY_REQUESTS,action:o.eX.LibraryRequests.PAST_REQUESTS,args:[e.id],params:n},{replace:!0}))}),[e,t])}},39123:function(e,t,n){"use strict";n.d(t,{g:function(){return c}});var r=n(32735),i=n(43823),o=n(54096),a=n(50997);function c(e){var t=(0,o.G)(a.Or.Library);function n(n){t.getLibraries((function(t){return e(t.toJSON(),n.toJSON())}))}r.useEffect((function(){return i.Radio.channel(a.Vk.LIBRARY).on("folder:created",n),function(){i.Radio.channel(a.Vk.LIBRARY).off("folder:created",n)}}),[e])}},61356:function(e,t,n){"use strict";n.d(t,{c:function(){return x}});var r=n(43823),i=n(21161),o=n(31647),a=n(52076),c=n(70065),l=n(88483),s=n(53825),u=n(10101),f=n(10079),d=n(45390),p=n(93569),m=n(264),h=n(57e3),v=n(37339),y=n.n(v);function g(e){return g="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},g(e)}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}function w(e){var t=function(e){if("object"!=g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(t)?t:t+""}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(E=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function k(e,t){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},k(e,t)}var x=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=S(t),function(e,t){if(t&&("object"==g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,E()?Reflect.construct(t,n||[],S(e).constructor):t.apply(e,n))}(this,t,[e]))._viewKeyRequested=!1,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&k(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){this.bindListeners()}},{key:"name",get:function(){return"VideoPreviewComponent"}},{key:"template",get:function(){return y()}},{key:"instanceChannelName",get:function(){return p.N0.generateUniqueChannelName(this)}},{key:"defaults",get:function(){return{captureAnalytics:!0}}},{key:"behaviors",get:function(){var e=this;return[{behaviorClass:u.Im,selector:".lazy-img",callback:function(){r.Radio.channel(e.instanceChannelName).trigger("show:play:icon")},minBrowserSupportVersion:d.v9}]}},{key:"regions",value:function(){return{player:{el:".video-player-region",replaceElement:!1},thumbnail:{el:".thumbnail-region",replaceElement:!0}}}},{key:"events",value:function(){return{click:"onClick"}}},{key:"bindListeners",value:function(){this.options.channelName&&this.listenTo(this.options.channelName,"update:chapter:time",this.onUpdateWebplayer)}},{key:"onUpdateWebplayer",value:function(e){return m.g.hasLite?this.playerViewKey?this.player?void this.seekToChapter(e):(this.listenToOnce(this.options.channelName,"player:loaded",i.bind(this.seekToChapter,this,e)),void this.renderVideoPreview()):(this.listenToOnce(this.options.channelName,"player:loaded",i.bind(this.seekToChapter,this,e)),void this.requestViewKey()):this.webPlayer?void this.seekToChapter(e):(this.listenToOnce(this.options.channelName,"webplayer:loaded",i.bind(this.seekToChapter,this,e)),void this.renderVideoPreview())}},{key:"seekToChapter",value:function(e){this.player?this.player.currentTime(e):this.webPlayer.seekTo(e)}},{key:"requestViewKey",value:function(){var e=this;this.playerViewKey||this._viewKeyRequested||(this._viewKeyRequested=!0,this.options.createViewKey(this.model.get("id"),(function(t){e.playerViewKey=t,e.renderVideoPreview()})))}},{key:"onClick",value:function(){this.model.get("id")&&(m.g.hasLite?this.requestViewKey():this.webPlayer||this.renderVideoPreview())}},{key:"renderThumbnail",value:function(){this.showChildView("thumbnail",new s.Z({model:this.model,thumbnailOptions:{size:l.h2.Medium},playIcon:!0,lazyload:!0,channelName:this.instanceChannelName,thumbnail:p.M2.getThumbnail(this.model),duration:p.M2.getDuration(this.model),durationNewStyle:!0}))}},{key:"renderVideoPreview",value:function(){if(this.playerViewKey)return this.player=new h.l({model:this.playerViewKey,playerApiUrl:this.options.playerApiUrl,channelName:this.options.channelName}),void this.showChildView("player",this.player);this.webPlayer=new f.Q({model:this.model,webPlayerUrl:this.options.webPlayerUrl,parentChannelName:this.options.channelName,autoplay:!0,analyticsOptions:a.k.mergeOptions(this.options.analyticsOptions,{entity:c.py.Video}),captureAnalytics:this.options.captureAnalytics,currentUser:this.options.currentUser}),this.showChildView("player",this.webPlayer)}},{key:"onRender",value:function(){this.playerViewKey?this.renderVideoPreview():this.renderThumbnail()}}])&&b(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o}(o.Q.wA)},37339:function(e,t,n){var r=n(31197);e.exports=(r.default||r).template({1:function(e,t,n,r,i){return"cursor-pointer "},compiler:[8,">= 4.3.0"],main:function(e,t,n,r,i){var o;return e.propertyIsEnumerable,'<div class="video-player-region '+(null!=(o=n.if.call(null!=t?t:e.nullContext||{},null!=t?t.id:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))?o:"")+'">\n <div class="thumbnail-region"></div>\n</div>'},useData:!0})}}]);