@clickview/library-editor 1.48.1 → 1.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/bundles.json +1 -1
  2. package/dist/css/{471-library-editor-ad26fedbae.chunk.css → 7349-library-editor-2a17ce8581.chunk.css} +5 -3
  3. package/dist/languages/en.json +1 -1
  4. package/dist/scripts/152-2a8a32c9e8.chunk.js +2 -0
  5. package/dist/scripts/{3087-7727d0c4e7.chunk.js → 3087-12081a5e15.chunk.js} +1 -1
  6. package/dist/scripts/456-f1d9ed6fe2.chunk.js +1 -0
  7. package/dist/scripts/{5314-af64b5b8fc.chunk.js → 5314-00cf818e7a.chunk.js} +1 -1
  8. package/dist/scripts/{61-31f64a58a6.chunk.js → 61-37274fc46f.chunk.js} +2 -2
  9. package/dist/scripts/6427-a377626451.chunk.js +1 -0
  10. package/dist/scripts/7349-3c33ace88c.chunk.js +2 -0
  11. package/dist/scripts/8542-776c339eeb.chunk.js +1 -0
  12. package/dist/scripts/bundle-e40ad95a43.min.js +2 -0
  13. package/package.json +1 -1
  14. package/dist/scripts/3578-c16c72054d.chunk.js +0 -2
  15. package/dist/scripts/456-ecb55e8869.chunk.js +0 -1
  16. package/dist/scripts/471-dd2f84b396.chunk.js +0 -2
  17. package/dist/scripts/6427-cbace62568.chunk.js +0 -1
  18. package/dist/scripts/8542-7218689c20.chunk.js +0 -1
  19. package/dist/scripts/bundle-84c691cd7e.min.js +0 -2
  20. /package/dist/css/{3578-library-editor-01b4461ff1.chunk.css → 152-library-editor-01b4461ff1.chunk.css} +0 -0
  21. /package/dist/scripts/{3578-c16c72054d.chunk.js.LICENSE.txt → 152-2a8a32c9e8.chunk.js.LICENSE.txt} +0 -0
  22. /package/dist/scripts/{5850-7f326276ae.chunk.js → 5850-a9edf39a77.chunk.js} +0 -0
  23. /package/dist/scripts/{471-dd2f84b396.chunk.js.LICENSE.txt → 61-37274fc46f.chunk.js.LICENSE.txt} +0 -0
  24. /package/dist/scripts/{61-31f64a58a6.chunk.js.LICENSE.txt → 7349-3c33ace88c.chunk.js.LICENSE.txt} +0 -0
  25. /package/dist/scripts/{bundle-84c691cd7e.min.js.LICENSE.txt → bundle-e40ad95a43.min.js.LICENSE.txt} +0 -0
@@ -1,2 +0,0 @@
1
- /*! For license information please see 471-dd2f84b396.chunk.js.LICENSE.txt */
2
- (self.webpackChunk_clickview_library_editor=self.webpackChunk_clickview_library_editor||[]).push([[471],{23689:function(e,t,n){"use strict";n.d(t,{i:function(){return d}});var r=n(1024),i=n(48088),o=n(52765),a=n(11306),c=n(21679),s=n(53808),l={fetch:function(e,t){var n=e.dataServiceName,r=e.eventPrefix,l=e.fetchData,u=e.setData,f=e.onError,d=e.deleteEventPrefix;if(s.q.isFunction(l)){if(s.q.isFunction(u)){var p=f&&s.q.isFunction(f),h=c.u.getInstance(n),m=i.Radio.channel(h.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 m.off(b,k)};m.once(v,E),m.once(y,S),m.once(b,k),p&&m.once(g,f),w&&m.once(w,x);var O=l(h);return O&&(t(!0),e.setData(O)),function(){c.u.releaseInstance(n),m.off(v,E),m.off(y,S),m.off(b,k),p&&m.off(g,f),w&&m.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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)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],s=a[1];r.useEffect((function(){s(!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 l.fetch(e,s)}),[c,o])}},42120:function(e,t,n){"use strict";n.d(t,{e:function(){return l}});var r=n(1024),i=n(53808),o=n(17439),a=n(63946),c=n(31709),s=n(12704);function l(e){var t=r.useMemo((function(){return e.actions.sort((function(e,t){return e.order-t.order}))}),[e.actions]),n=[],l=[];t.forEach((function(e){e.button?n.push(e):l.push(e)}));var u="d-flex";return e.className&&(u+=" ".concat(e.className)),n.length||l.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 s=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},s):s}())})):r.createElement(r.Fragment,null),e.sortComponent&&e.sortComponent,l.length?r.createElement(s.m,{actions:l,dropdownToggleClassName:e.actionsDropdownClassName,dropdownToggleSvgSize:e.dropdownToggleSvgSize,fetchMore:e.fetchMore}):r.createElement(r.Fragment,null)):r.createElement(r.Fragment,null)}},12704:function(e,t,n){"use strict";n.d(t,{m:function(){return v}});var r=n(1024),i=n(53808),o=n(31647),a=n(97874),c=n(52076),s=n(49642),l=n(39396),u=n(63946),f=n(63791),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 h(e){var t="dropdown-item";return e&&(t+=" ".concat(e)),t}function m(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(s.F,{appLink:e.action.appLink,onClick:e.action.onClick,className:h(e.action.className),analyticsData:e.action.analyticsData,analyticsOptions:e.action.analyticsOptions,openInNewTab:e.action.openInNewTab,disabled:e.action.disabled},e.action.svgName&&r.createElement(l.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:h(e.action.className),onClick:n,href:e.action.href},e.action.svgName&&r.createElement(l.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(h(e.action.className)),onClick:n,role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&n(e)}},e.action.svgName&&r.createElement(l.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(l.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(m,{action:e}))):r.createElement("li",{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(m,{action:e}))}))))}v.defaultProps={dropdownToggleClassName:"btn btn-light",dropdownToggleSvgSize:l.S.Small}},41087:function(e,t,n){"use strict";n.d(t,{C:function(){return v},g:function(){return l}});var r,i=n(1024),o=n(57857),a=n(39396),c=n(63946),s=n(50028);!function(e){e.Exchange="exchange",e.Streamable="streamable",e.MoviesAndTv="movies_and_tv",e.Twig="twig"}(r||(r={}));var l,u=n(27866),f=n(45428),d=n(63791),p=n(21974),h=n(7121),m=o.T.encloseNamespace("shared.badges");function v(e){var t=e.type,n=e.data;if(!function(e,t){var n,r;return"boolean"==typeof t?!!t:e===l.Rating?t&&!!t.value:e===l.Interactive?!!(null==t?void 0:t.length)||!!(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.length):e===l.Captions?!!(null==t?void 0:t.length)||!!(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.length):e===l.Status?"number"==typeof t:!!t}(t,n))return i.createElement(i.Fragment,null);var o=function(e,t){var n,i="";if(e===l.DurationApproximate&&(i="duration-badge-new px-2 rounded-pill text-nowrap d-flex align-items-center"),e===l.DurationExact&&(i="duration-badge"),e===l.Interactive&&(i="interactive-badge"),e===l.Rating&&(i="rating-badge text-shadow ".concat(p.u.mapRatingToClass(t.value))),e===l.ProductionYear&&(i="production-year-badge text-shadow"),e===l.Captions)return"p-0";if(e===l.Status)return"badge ".concat(function(e){switch(e){case s.X.Published:return"bg-success";case s.X.Archived:case s.X.Rejected:return"bg-danger";case s.X.Draft:return"draft-badge px-2 rounded-pill text-nowrap d-flex align-items-center";case s.X.Pending:case s.X.Processing:return"bg-warning"}}(t));if(e===l.Trending)return"trending-badge px-2 d-flex align-items-center";if(e===l.Count&&(i="count-badge px-1 rounded"),e===l.Restriction){var o=f.l.mapRestrictionToClass(t.restrictions);return"restriction-badge rounded-pill px-2 d-flex align-items-center ".concat(o)}return e===l.Source&&(i=(n=t).includes(r.Streamable)?"px-1 text-nowrap d-flex align-items-center ".concat(h.Z.streamable):n.includes(r.MoviesAndTv)?"bg-indigo text-white px-1 text-nowrap d-flex align-items-center":n.includes(r.Exchange)?"bg-orange text-white px-1 text-nowrap d-flex align-items-center":n.includes(r.Twig)?"bg-pink text-white px-1 text-nowrap d-flex align-items-center":""),"".concat("badge"," ").concat(i)}(t,n);o="".concat(o," ").concat(e.inline?"d-inline-block":"d-flex justify-content-center"," ").concat(e.className||"");var v=function(e,t){if(e===l.Interactive)return m("interactive");if(e===l.DurationApproximate)return u.T.ToDisplayDurationNewStyle(t);if(e===l.DurationExact)return u.T.ToDisplayDuration(t);if(e===l.Rating)return t.code;if(e===l.ProductionYear)return t;if(e===l.Captions)return i.createElement(a.x,{svgName:d.vn.CloseCaptionBadge});if(e===l.Status)return s.X[t];if(e===l.Trending)return i.createElement(i.Fragment,null,i.createElement(a.x,{svgName:d.vn.Trending}),i.createElement("span",{className:"ps-1"},t));if(e===l.Count)return t;if(e===l.Restriction)return i.createElement(i.Fragment,null,i.createElement(a.x,{svgName:f.l.mapRestrictionToSvg(t.restrictions)}),i.createElement("span",null,f.l.mapRestrictionToText(t.restrictions,t.yearGroups)));if(e===l.Source){var n=t;return n.includes(r.Streamable)?"streamable":n.includes(r.MoviesAndTv)?"movies + tv":n.includes(r.Exchange)?"exchange":n.includes(r.Twig)?"twig":"-"}}(t,n),y=function(e,t){return e===l.Rating?{title:t.name,placement:"top"}:null}(t,n),g=e.inline&&"d-inline-block";return y?i.createElement("div",{className:"badge-wrapper d-inline"},i.createElement(c.u,Object.assign({},y,{spanHack:!0,spanHackClassName:g}),i.createElement("span",{className:o},v))):i.createElement("span",{className:"".concat(o," badge-wrapper")},v)}!function(e){e.DurationExact="duration-exact",e.DurationApproximate="duration-approximate",e.Interactive="interactive",e.Rating="rating",e.ProductionYear="production-year",e.Captions="captions",e.Status="status",e.Trending="trending",e.Count="count",e.Restriction="restriction",e.Source="source"}(l||(l={}))},41777:function(e,t,n){"use strict";n.d(t,{u:function(){return d}});var r=n(1024),i=n.n(r),o=n(53808),a=n(31647),c=n(52076),s=n(49642),l=n(17439);function u(e){var t=e.className||"btn btn-dark";return e.disabled&&(t+=" disabled"),e.icon?i().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||o.q.isFunction(e.onClick)||e.disabled?e.href&&!e.disabled?i().createElement("a",{className:t,href:e.href,target:e.openInNewTab?"_blank":null},e.text):i().createElement("button",{disabled:e.disabled,onClick:function(){e.disabled||(o.q.isFunction(e.onClick)&&e.onClick(),e.appLink&&a.Q.C$.trigger(e.appLink),c.k.logUserAction(e.analyticsData,e.analyticsOptions))},className:t},e.text):i().createElement(s.F,{appLink:e.appLink,className:t,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions},e.text)}function f(e){var t;return i().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 d(e){var t;return i().createElement("div",{className:"text-center d-flex flex-column align-items-center ".concat(null!==(t=e.className)&&void 0!==t?t:"")},e.children)}f.defaultProps={size:"medium"},d.defaultProps={className:"pt-5"},d.Image=function(e){return i().createElement(f,Object.assign({},e))},d.Cta=function(e){return i().createElement(u,Object.assign({},e))},d.Heading=function(e){return i().createElement("h2",{role:"status",className:e.className||"h3"},e.children)},d.Info=function(e){return e.injectHtml?i().createElement("p",{role:"status",className:e.className||"mb-3 w-50",dangerouslySetInnerHTML:{__html:e.children}}):i().createElement("p",{role:"status",className:e.className||"mb-3 w-50"},e.children)}},49619:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var r=n(1024),i=n(85887),o=n(49642),a=n(29267),c="fVSzb";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}var l=r.memo((function(e){var t,n,i=e.forceLoad,o=e.extraClasses,l=void 0===o?"":o,u=e.errorFallbackImageSrc,f=e.preventLoad,d=void 0!==f&&f,p=e.errorFallbackImageClassName,h=e.src,m=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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,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}}(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=h,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(l," ").concat(E&&p||""),alt:m,src:k()},v));var x=Object.assign(Object.assign({alt:m},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(l," ").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 h(e){var t=e.data,n=e.imageOptions,a=e.appLink,c=e.preload,s=e.preventLoad,u=e.analyticsOptions,d=e.analyticsData,h=e.imageClassName,m=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(l,{src:y,alt:m,forceLoad:c,preventLoad:s,extraClasses:h,errorFallbackImageSrc:e.errorFallbackImageSrc,errorFallbackImageClassName:e.errorFallbackImageClassName,onLoad:e.onLoad})))}},96461:function(e,t,n){"use strict";n.d(t,{m:function(){return c}});var r=n(1024),i=n.n(r),o=n(49642),a={subText:"F_1ii",sm:"BxmrB"};function c(e){var t="text-uppercase text-truncate mb-0 ".concat(a.subText," ").concat("sm"===e.size?"".concat(a.sm," fw-normal"):""," ").concat(e.className);return e.appLink?i().createElement(o.F,{className:t,appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,title:e.title,ariaLabel:e.ariaLabel},e.children):i().createElement("div",{className:t,title:e.title,"aria-label":e.ariaLabel},e.children)}},43803:function(e,t,n){"use strict";n.d(t,{y:function(){return h}});var r=n(1024),i=n.n(r),o=n(57857),a=n(39396),c=n(50028),s=n(74421),l=n(63791),u={topLeftContainer:"iwBld",draft:"QBpxh",badge:"KcvGx",svg:"gW733",text:"QiH5Q",sm:"tn2BH"},f=o.T.encloseNamespace("shared.typeBadge");function d(e){switch(e){case s.E.Clip:return l.vn.Clip;case s.E.Interactive:return l.vn.Interactive;case s.E.Resource:return l.vn.Resources;default:return""}}function p(e,t){switch(e){case s.E.Clip:return"bg-dark-blue";case s.E.Interactive:return t===c.X.Draft?u.draft:"bg-green";case s.E.Resource:return"bg-indigo";default:return""}}function h(e){var t="".concat(u.badge," rounded-pill text-white ps-0 ").concat("sm"===e.size?u.sm:"");return i().createElement("div",{className:e.inContainer?"":u.topLeftContainer},i().createElement("div",{className:"".concat(t," ").concat(p(e.typeId,e.status))},i().createElement(a.x,{className:"svg-container d-block ".concat(u.svg),size:"sm"===e.size?a.S.Small:a.S.Standard,svgName:d(e.typeId)}),i().createElement("span",{className:u.text},function(e){switch(e){case s.E.Clip:return f("clip");case s.E.Interactive:return f("interactive");case s.E.Resource:return f("resource");default:return""}}(e.typeId))))}h.default={size:"md"}},98496:function(e,t,n){"use strict";n.d(t,{Q:function(){return h},$:function(){return g}});var r=n(1024),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}},s=n(74421),l={isSeries:function(e){return(null==e?void 0:e.typeId)===s.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(12927),f=n(96461),d={appLink:"yI6tx",hoverUnderline:"ehDUT"},p=i.T.encloseNamespace("shared.videoSubText");function h(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 m(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,s=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=l.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(s),analyticsData:b,analyticsOptions:w,title:E,ariaLabel:"".concat(p("ariaSeries")," ").concat(E)},(null==v?void 0:v.name)&&v.name,r.createElement(h,Object.assign({},e,{withSeriesTitle:!0})),r.createElement(m,Object.assign({},e)))}function y(e){var t,n,i=e.appLink,c=e.video,s=e.className,l=void 0===s?"":s,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 h=(null==u?void 0:u.id)&&i&&Object.assign(Object.assign({},i),{args:[u.id,o.m.slugify(u.name)]}),m=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:h,className:"d-block ".concat(d.appLink," ").concat(l),analyticsData:m,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,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=i(r))return r;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})},86257:function(e,t,n){"use strict";var r;n.d(t,{L:function(){return r}}),function(e){e.Pdf="pdf",e.Image="image",e.PowerPoint="powerpoint",e.Document="document",e.Excel="excel",e.Zip="archive",e.File="text"}(r||(r={}))},82378:function(e,t,n){"use strict";n.d(t,{i:function(){return o}});var r=n(1024),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 v},L:function(){return y}});var r=n(1024),i=n.n(r),o=n(53808),a=n(85887),c=function(){var e=i().useRef(!0);return i().useEffect((function(){return function(){e.current=!1}}),[]),e};function s(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)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 u=275,f=5,d={className:"",delay:0,style:null},p={screenX:0,screenY:0};function h(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 v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=c(),n=s(r.useState(e),2),i=n[0],l=n[1],u=s(r.useState(!1),2),f=u[0],p=u[1],v=r.useRef(null);r.useEffect((function(){a.t.isEqual(e,i)||l(e)}),[e]);var y=o.q.throttle((function(){h(v,i),t.current&&p(!0)}),i.delay,{leading:!1}),g=function(){o.q.isFunction(y.cancel)&&y.cancel(),m(v,i),t.current&&p(!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,i]),[v,f]}function y(e){var t=s(r.useState(e),2),n=t[0],i=t[1],c=r.useRef(Object.assign({},p)),l=r.useRef(!1),d=r.useRef(0),v=r.useRef(null),y=s(r.useState(!1),2),g=y[0],b=y[1];function w(){d.current&&(window.clearTimeout(d.current),d.current=0)}function E(){l.current=!0}function S(e){if(l.current){var t,r,i=Object.assign({},c.current);c.current.screenX=e.screenX,c.current.screenY=e.screenY,function(e,t){return Math.abs(e.screenX-t.screenX)>f||Math.abs(e.screenY-t.screenY)>f}(i,e)&&w(),t=function(){h(v,n),b(!0)},r=n.delay||u,d.current||(d.current=window.setTimeout(t,r))}}function k(){w(),m(v,n),l.current=!1,b(!1)}return r.useEffect((function(){a.t.isEqual(e,n)||i(e)}),[e]),r.useLayoutEffect((function(){if(v.current){var e=o.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(64038);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,s=void 0===c||c,l=(e=(0,r.useInView)({triggerOnce:s,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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)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=l[0],f=l[1],d=l[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(1024),i=n(58566),o=n(35656),a=n(53808),c=n(86120);function s(e){return function(e){if(Array.isArray(e))return l(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 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)||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 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}function u(e,t,n){function o(e){if(e)return a.q.isFunction(t)?s(t(e)):s(e.data)}function l(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.useSelector)((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,h=i&&i.shouldFetch,m=o(i&&i.data),v=l(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&&m.push.apply(m,s(g));var b=l(i.data);v=b===v?null:b}var w={shouldInitialFetch:h,items:m,nextCursor:v,isFetching:u,statusCode:f,hasCompleted:d,hasFirstPageCompleted:p};return"number"==typeof y&&(w.totalItems=y),w}}}),[e]))}o.o.Ok},24365:function(e,t,n){"use strict";n.r(t),n.d(t,{CropperHelper:function(){return y}});var r=n(1024),i=n.n(r),o=n(44645),a=n(51934),c=n.n(a),s=n(57857),l=n(71575),u=n(83996),f=n(99828);function d(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||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}}(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 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 h=s.T.encloseNamespace("shared.imageCropper"),m=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function v(e){var t=d(i().useState(!1),2),n=t[0],r=t[1],o=d(i().useState(!1),2),a=o[0],s=o[1],p=i().useRef(),v=i().useRef();return i().useEffect((function(){var t=new Image;t.src=e.src;var n=p.current.offsetWidth/t.width,i=f.y[e.imageType],o={viewMode:2,autoCropArea:1,ready:function(){return r(!0)}};return i&&(o.minCropBoxWidth=i.width*n,o.minCropBoxHeight=i.height*n,o.aspectRatio=i.width/i.height),v.current=new(c())(p.current,o),function(){v.current.destroy()}}),[]),i().createElement(l.G,{title:h("title"),closePopup:e.closePopup,size:e.popupSize},i().createElement("div",null,i().createElement("img",{src:e.src,alt:e.alt,ref:p,className:"img img-fluid"})),i().createElement(u.u,null,i().createElement(u.u.Cancel,{onClick:e.closePopup}),i().createElement(u.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));s(!0),e.onClickCrop(t,e.closePopup)}},text:h("crop"),variant:"dark",showSpinner:a})))}v.defaultProps={popupSize:"lg"};var y={renderCropper:function(e){var t=(0,o.s)(document.getElementById("dialog-region"));t.render(i().createElement(v,Object.assign({},e,{closePopup:function(){return t.unmount()}})))}}},21974:function(e,t,n){"use strict";n.d(t,{u:function(){return u}});var r=n(57857),i=n(75459),o=n(86257),a=n(63791);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 s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=c(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l="shared.shared-utils",u={mapRatingToClass:function(e){return e?function(e){switch(!0){case e<32:return"bg-purple";case e<48:return"bg-green";case e<80:return"bg-blue";case e<96:return"bg-red";case e<128:return"bg-pink";case e>=128:return"bg-yellow";default:return""}}(e):""},mapSourceToDisplayName:function(e,t){switch(e.type){case i.r.HostedLibrary:case i.r.CustomLibrary:return e.name;case i.r.Exchange:return r.T.getPhrase(l,"exchange");case i.r.Workspace:return r.T.getPhrase(l,t?"myVideos":"workspace");default:return""}},mapSourceToClass:function(e){switch(e){case i.r.HostedLibrary:case i.r.CustomLibrary:return"bg-blue";case i.r.Exchange:return"bg-green";case i.r.Workspace:default:return"bg-red"}},isInteractive:function(e){var t,n;return!!(null===(n=null===(t=null==e?void 0:e.interactives)||void 0===t?void 0:t.data)||void 0===n?void 0:n.length)},mapTypeToSvg:function(e){var t=s(s(s(s(s(s(s({},o.L.Pdf,a.vn.FilePDF),o.L.Image,a.vn.FileImg),o.L.PowerPoint,a.vn.FilePowerpoint),o.L.Document,a.vn.FileWord),o.L.Excel,a.vn.FileExcel),o.L.Zip,a.vn.FileZip),o.L.File,a.vn.File)[e];return t||(t=a.vn.Folder),t},mapTypeToClass:function(e){switch(e){case o.L.Pdf:return"icon-red";case o.L.Image:return"icon-purple";case o.L.Document:return"icon-blue";case o.L.Excel:return"icon-green";case o.L.PowerPoint:return"icon-orange";case o.L.Zip:return"icon-teal";case o.L.File:return"icon-gray";default:return""}},mapTypeToExtension:function(e){return e?{pdf:"pdf",image:"png",powerpoint:"pptx"}[e.toLowerCase()]:""},mapTypeToName:function(e){if(!e)return"";switch(e){case o.L.Pdf:return r.T.getPhrase(l,"pdf");case o.L.Image:return r.T.getPhrase(l,"image");case o.L.Document:return r.T.getPhrase(l,"document");case o.L.Excel:return r.T.getPhrase(l,"spreadsheet");case o.L.PowerPoint:return r.T.getPhrase(l,"presentation");case o.L.Zip:return r.T.getPhrase(l,"zipArchive");case o.L.File:return r.T.getPhrase(l,"file");default:return""}}}},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}})},41691:function(e,t,n){"use strict";n.d(t,{x:function(){return Wu}});var r=n(1024),i=n.n(r),o=n(66703),a=n(8371),c=n(12927);n(30582),n(85887);var s=i().createContext({setPageMetadata:function(e){return e},revertPageMetadata:function(){},hasPageMetadataChanged:function(){return!1},hasProvider:!1}),l=n(53808);function u(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 f(e){var t,n,o=e.view,a=e.options,c=void 0===a?{}:a,f=e.className,d=void 0===f?"":f,p=e.dependencies,h=void 0===p?[]:p,m=r.useMemo((function(){return new o(c)}),h);t=m.title,n=i().useContext(s),r.useEffect((function(){"boolean"!=typeof t&&n.setPageMetadata({title:t})}),[t]);var v=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 u(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 u(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)?u(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 o?r.createElement("div",{ref:v,className:d}):r.createElement(r.Fragment,null)}var d=n(70065),p=n(61356),h=n(64404);function m(e){var t,n=e.config.get("webPlayerUrl"),r=e.config.get("playerApiUrl");return i().createElement("div",{className:"col-12 mb-3 p-0"},i().createElement(f,{view:p.c,options:{model:new h.n(e.video,{parse:!0}),analyticsOptions:{location:d.LZ.VideoRequest},currentUser:e.user,createViewKey:e.createViewKey,webPlayerUrl:n,playerApiUrl:r},dependencies:[null===(t=e.video)||void 0===t?void 0:t.id]}))}var v=n(27866),y="libraryRequests.videoDetail";function g(e){return i().createElement(i().Fragment,null,i().createElement("div",{className:"col-3"},i().createElement("label",null,i().createElement(o.x,{namespace:y,phrase:e.phrase}))),i().createElement("div",{className:"col-9 mb-3"},e.children))}function b(e){var t,n=e.clip,r=n.endTime-n.startTime;function o(e){return v.T.ToDisplayDuration(Math.floor(e))}function a(){var e;return r/((null===(e=n._parentVideo)||void 0===e?void 0:e.duration)/1e3)*100+"%"}return i().createElement(i().Fragment,null,i().createElement("p",null,v.T.ToDisplayDurationNewStyle(1e3*Math.floor(r))),i().createElement("div",{className:"overflow-hidden rounded-3 border border-light p-3"},i().createElement("div",{className:"position-relative z-1"},i().createElement("div",{className:"position-absolute w-100"},i().createElement("span",null," "),i().createElement("div",{className:"bg-light rounded-3",style:{height:10}}))),i().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+"%"}()}},i().createElement("div",{className:"d-flex justify-content-between",style:{width:a()}},i().createElement("span",null,o(1e3*n.startTime)),i().createElement("span",{className:"text-secondary"}," - "),i().createElement("span",null,o(1e3*n.endTime))),i().createElement("div",{className:"bg-blue rounded-3 px-1",style:{width:a(),height:10}})),i().createElement("div",{className:"d-flex justify-content-between text-secondary"},i().createElement("span",null,"0:00"),i().createElement("span",null,o(null===(t=n._parentVideo)||void 0===t?void 0:t.duration)))))}function w(e){var t=e.libraryRequest.object;return i().createElement("div",{className:"row"},((null==t?void 0:t.name)||e.libraryRequest.name)&&i().createElement(g,{phrase:"title"},(null==t?void 0:t.name)||e.libraryRequest.name),t.description&&i().createElement(g,{phrase:"description"},i().createElement("span",{className:"pre-wrap"},t.description)),i().createElement(g,{phrase:"duration"},i().createElement(b,{clip:t})))}var E,S=n(42648),k=n(58424),x=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"}(E||(E={}));var O=n(63791),C=n(49642),N=n(71551),j=n(58542);function P(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 I(e){var t;if(e)return e=P(e,["ul","ol","b","i","u","old","em","strong","sup","sub","a","span"]),(null===(t=(e=P(e,["li","p"],!0)).split("<br>"))||void 0===t?void 0:t.filter((function(e){return!!e}))[0])||"Annotation"}function T(e){var t=j.w.getTypeInfo(e.interaction.typeId),n=t.name,r=t.bgClassName,o=t.Svg,a=e.questionNumber?"".concat(e.questionNumber,". "):"",c="interaction-type-icon ".concat(r);return e.smallIcon&&(c+=" sm"),(e.showQuestion||e.showTypeName)&&(c+=e.smallIcon?" me-1":" me-2"),e.iconClassName&&(c+=" ".concat(e.iconClassName)),i().createElement(i().Fragment,null,!!e.showIcon&&i().createElement("span",{className:c},i().createElement(o,null)),i().createElement(C.F,{appLink:e.appLink,onClick:e.onClick},!!e.showTypeName&&i().createElement("span",{className:e.typeNameClassName},i().createElement("strong",null,a,n)),!!e.showQuestion&&i().createElement("span",{className:e.questionClassName},e.interaction.typeId===N.Z9.Annotation?i().createElement("span",{dangerouslySetInnerHTML:{__html:I(e.interaction.data.annotation)}}):e.interaction.name)))}T.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"},A="shared.interactiveQuestions";function _(e){var t=e.interaction;switch((0,e.getCorrectness)(t)){case E.Correct:return i().createElement("span",{className:"text-success"},i().createElement(x.x,{size:x.S.Medium,svgName:O.vn.Check}));case E.Incorrect:return i().createElement("span",{className:"text-danger"},i().createElement(x.x,{size:x.S.Medium,svgName:O.vn.Close}));case E.AwaitingMarking:return i().createElement("span",{className:"text-secondary italic"},i().createElement("i",null,i().createElement(o.x,{namespace:A,phrase:"pending"})));case E.UnAnswered:return i().createElement("button",{className:"btn btn-outline-dark"},i().createElement(o.x,{namespace:A,phrase:"answer"}));case E.Answered:return i().createElement("span",{className:"text-secondary italic"},i().createElement("i",null,i().createElement(o.x,{namespace:A,phrase:"answered"})));case E.NotApplicable:return i().createElement(i().Fragment,null)}}function F(e){var t=e.interaction,n=e.visibleAt,r=e.selectedInteractionId,o=e.goToTimepoint,a=e.scrollTo,c=e.isFirstInteraction,s=e.hasPlayPageV2,l=t.id.toString()===(null==r?void 0:r.toString()),u=i().useRef();i().useEffect((function(){if(l&&u.current){var e=u.current,t=e.getBoundingClientRect(),n=t.top-e.offsetParent.getBoundingClientRect().top;a(n,t.height)}}),[l]);var f=o?"cursor-pointer":"cursor-default";return i().createElement("div",{ref:u},i().createElement(k.L,{className:"py-2 ".concat(f," ").concat(L.row," ").concat(l?L.selected:""),onClick:l?function(){}:function(){o&&o(t.id)}},s?i().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?v.T.ToDisplayDuration(n):""):i().createElement("span",{className:"".concat(L.time," me-2 ").concat(l?"fw-bold":"")},c?v.T.ToDisplayDuration(n):""),i().createElement(T,{interaction:t,showTypeName:!0,typeNameClassName:L.type,questionClassName:L.question}),e.onClickDelete&&i().createElement(k.L,{onClick:function(n){n.stopPropagation(),e.onClickDelete(t.id)},className:"".concat(L.deleteContainer)},i().createElement("span",{className:"text-end ".concat(L.delete)},i().createElement(x.x,{size:x.S.Medium,svgName:O.vn.Delete}))),e.getCorrectness&&i().createElement("span",{className:"text-end ".concat(L.correctness)},i().createElement(_,{interaction:t,getCorrectness:e.getCorrectness}))))}function D(e){var t=e.timepoint,n=e.scrollTo,r=e.onClickDelete,o=e.selectedInteractionId,a=e.getCorrectness,c=e.hasPlayPageV2;function s(n){e.goToTimepoint(t.id,n)}return t.interactions?i().createElement("div",null,t.interactions.map((function(l,u){return i().createElement(F,{interaction:l,visibleAt:t.visibleAt,goToTimepoint:e.goToTimepoint&&s,onClickDelete:r,scrollTo:n,selectedInteractionId:o,isFirstInteraction:0===u,getCorrectness:a,key:u,hasPlayPageV2:c})}))):i().createElement(i().Fragment,null)}function R(e){var t=e.interactive,n=e.goToTimepoint,r=e.selectedInteractionId,o=e.maxHeight,a=e.onClickDelete,c=e.getCorrectness,s=e.hasPlayPageV2,l=i().useRef();function u(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 f=n?"border rounded":"";return i().createElement(S.$B,{autoHeight:!0,autoHeightMax:o,className:f,hideTracksWhenNotNeeded:!0,ref:l},i().createElement("div",{className:"px-3 py-1"},t.timepoints.map((function(e,t){return i().createElement(D,{key:t,timepoint:e,goToTimepoint:n,selectedInteractionId:r,scrollTo:u,onClickDelete:a,getCorrectness:c,hasPlayPageV2:s})}))))}var M,U="libraryRequests.interactiveDetails";function V(e){var t=e.interactive;return i().createElement(i().Fragment,null,i().createElement("p",{className:"fw-semibold mb-2"},i().createElement(o.x,{namespace:U,phrase:"questionList",options:{length:t._timepoints.value.length}})),t._timepoints.value.map((function(e,t){return i().createElement(D,{key:t,timepoint:e})})))}function B(e){var t=e.libraryRequest.object;return i().createElement("div",{className:"row"},((null==t?void 0:t.name)||e.libraryRequest.name)&&i().createElement(g,{phrase:"title"},(null==t?void 0:t.name)||e.libraryRequest.name),!!t.description&&i().createElement(g,{phrase:"description"},i().createElement("span",{className:"pre-wrap"},t.description)),i().createElement(V,{interactive:t}))}!function(e){e[e.View=0]="View",e[e.Create=1]="Create"}(M||(M={}));var q=n(31647);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 Z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,z(r.key),r)}}function z(e){var t=function(e,t){if("object"!=G(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=G(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==G(t)?t:t+""}function H(e,t,n){return t=K(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,W()?Reflect.construct(t,n||[],K(e).constructor):t.apply(e,n))}function W(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(W=function(){return!!e})()}function K(e){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},K(e)}function Y(e,t){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Y(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),H(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&&Y(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()}}])&&Z(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(n(85835).S),$=n(61380);function X(e){return X="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},X(e)}function J(){J=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==X(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(X(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ee(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,te(r.key),r)}}function te(e){var t=function(e,t){if("object"!=X(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=X(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==X(t)?t:t+""}var ne=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},re=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 ne(this,void 0,void 0,J().mark((function e(){var t,n,r,i,o,a,c,s,l;return J().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,s={interactiveId:n,metadataId:r,userId:i,customerId:o,shareId:a},e.prev=4,e.next=7,$.e.post(c+"interactive/start-session",JSON.stringify(s));case 7:l=e.sent,this.resultId=l.resultId,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),q.Q.Ry.throw(new Q);case 14:case"end":return e.stop()}}),e,this,[[4,11]])})))}},{key:"save",value:function(e,t){return ne(this,void 0,void 0,J().mark((function n(){var r;return J().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,$.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),q.Q.Ry.throw(new Q);case 13:case"end":return n.stop()}}),n,this,[[4,9]])})))}}])&&ee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),ie=n(11306),oe=n(6950),ae=(n(96263),n(24910),n(94445));function ce(e){return ce="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},ce(e)}function se(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,le(r.key),r)}}function le(e){var t=function(e,t){if("object"!=ce(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ce(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ce(t)?t:t+""}function ue(e,t,n){return t=he(t),function(e,t){if(t&&("object"==ce(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,fe()?Reflect.construct(t,n||[],he(e).constructor):t.apply(e,n))}function fe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(fe=function(){return!!e})()}function de(e,t,n,r){var i=pe(he(1&r?e.prototype:e),t,n);return 2&r?function(e){return i.apply(n,e)}:i}function pe(){return pe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=he(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}},pe.apply(null,arguments)}function he(e){return he=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},he(e)}function me(e,t){return me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},me(e,t)}var ve=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=ue(this,t,[e,n])).timepoint_=n.timepoint,r.time_=n.timepoint.visibleAt/1e3;var i=n.timepoint.interactions[0];i||r.hide();var o=j.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&&me(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-item ".concat(de(t,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(e,n,r){return de(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&&se(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("Button"));function ye(e){return ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ye(e)}function ge(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 be(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,we(r.key),r)}}function we(e){var t=function(e,t){if("object"!=ye(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ye(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ye(t)?t:t+""}function Ee(e,t,n){return t=Oe(t),function(e,t){if(t&&("object"==ye(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,Se()?Reflect.construct(t,n||[],Oe(e).constructor):t.apply(e,n))}function Se(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Se=function(){return!!e})()}function ke(e,t,n,r){var i=xe(Oe(1&r?e.prototype:e),t,n);return 2&r?function(e){return i.apply(n,e)}:i}function xe(){return xe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Oe(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}},xe.apply(null,arguments)}function Oe(e){return Oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Oe(e)}function Ce(e,t){return Ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ce(e,t)}var Ne=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=Ee(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&&Ce(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-items ".concat(ke(t,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(e,n,r){return ke(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 ge(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 ge(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)?ge(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 ve(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&&be(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("Component")),je=n(94878),Pe={svg:"cDUaE",iconButton:"Mr0S0",iconWithText:"vHTVo",iconOnly:"vIGn0"};function Ie(e){var t="".concat(e.className," ").concat(Pe.iconButton);e.children?t+=" ".concat(Pe.iconWithText):t+=" ".concat(Pe.iconOnly);var n=i().createElement(x.x,{svgName:e.svgName,className:Pe.svg});return i().createElement(k.L,{className:t,onClick:e.onClick},n,e.children)}function Te(e){var t=e.isCreate,n=e.open,r=e.showTypeSelector;return!t||n?i().createElement(i().Fragment,null):i().createElement(Ie,{className:"btn btn-outline-dark cv-add-question",onClick:r,svgName:O.vn.Plus},"Add question")}var Le,Ae=n(99910),_e=n(17082),Fe=n(17439),De=n(49619),Re=n(88483),Me=n(38182);function Ue(e){return Ue="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},Ue(e)}function Ve(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ue(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ue(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ue(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Be(){return E.NotApplicable}function qe(e,t){var n=e.actionableItems.filter((function(e){return e.isCorrect}));return n.every((function(e){return!t(e.id)}))?E.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())}))?E.Correct:E.Incorrect}function Ge(e,t){return e.actionableItems.every((function(e){return!t(e.id)}))?E.UnAnswered:e.actionableItems.filter((function(e){return e.isCorrect})).every((function(e){return t(e.id)===e.name}))?E.Correct:E.Incorrect}function Ze(e,t){var n;return e.actionableItems.forEach((function(e){var r=t(e.id);n=r?r.status!==Le.Correct?r.status!==Le.Incorrect?E.AwaitingMarking:E.Incorrect:E.Correct:E.UnAnswered})),n}function ze(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 He(e,t){var n=ze(e,t);return Ge(e,(function(e){var t=n(e);return null==t?void 0:t.text}))}!function(e){e[e.Incorrect=0]="Incorrect",e[e.Correct=1]="Correct",e[e.PendingReview=2]="PendingReview"}(Le||(Le={}));var We=Ve(Ve(Ve(Ve(Ve(Ve({},N.Z9.Annotation,Be),N.Z9.Image,Be),N.Z9.MissingWord,(function(e,t){var n=ze(e,t);return qe(e,(function(e){var t=n(e);return null==t?void 0:t.text}))})),N.Z9.MultipleChoice,He),N.Z9.ShortAnswer,(function(e,t){return Ze(e,ze(e,t))})),N.Z9.TrueOrFalse,He),Ke={notApplicable:Be,awaitingMarking:function(){return E.AwaitingMarking},isMissingWordCorrect:qe,isMultipleChoiceCorrect:Ge,isShortAnswerMarkedCorrect:Ze,isInteractionCorrect:function(e,t){return(0,We[e.typeId])(e,t)}},Ye=n(40221);function Qe(e){return Ye.m.last(e.results)}function $e(e,t){return Ye.m.findWhere(null==t?void 0:t.attempts,{id:e})}var Xe=n(76044),Je=n(57857),et=Je.T.encloseNamespace("interactives.responseTypes");function tt(){return i().createElement("p",{className:"p-2"},i().createElement("em",null,et("noResponse")))}var nt="cv-missing-word-",rt=n(4234),it="yodaE",ot="KpbWq",at="uKRg2",ct="_LpCq",st="zWcu2",lt="TeByp";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=["A","B","C","D"];function dt(e){var t,n,r=(t=i().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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||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}}(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=r[0],a=r[1],c=!!e.interaction.actionableItems.find((function(e){var t;return!!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)})),s=i().useRef(),l="sm"===e.size||c&&e.interaction.actionableItems.length>2;return i().createElement("ul",{className:"".concat(c?"row ".concat(l&&!e.isDisplayOnly?"px-lg-5 p-0":""):""," list-unstyled")},e.interaction.actionableItems.map((function(t,n){var r,u=e.getSelectedAnswer(t.id),f=null===(r=t.data)||void 0===r?void 0:r.imageUrl,d=!!t.name;function p(){e.submitted||(e.onSelectAnswer&&e.onSelectAnswer(t,!u),a(u?null:t.id))}if(e.onlyShowSelectedAnswer&&!u)return i().createElement(i().Fragment,{key:n});var h=u?"bg-blue text-white":e.unCheckedBackground,m=function(){return i().createElement(i().Fragment,null,ft[n])};e.showFeedback&&(h=t.isCorrect?"bg-success text-white":"bg-danger text-white ".concat(it),e.hideFeedbackIcons||(m=function(){return i().createElement(i().Fragment,null,t.isCorrect?i().createElement(x.x,{size:x.S.Small,svgName:O.vn.Check}):i().createElement(x.x,{size:x.S.Small,svgName:O.vn.Close}))}));var v=e.showFeedback?{}:{role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&p()}},y="";c&&(y="col-6");var g=t.id.toString()===(null==o?void 0:o.toString())&&e.leftHandSidePortalNode&&f&&!e.submitted;return i().createElement(i().Fragment,{key:n},g&&i().createElement(_e.Nq,{node:e.leftHandSidePortalNode},i().createElement(rt.Z,{className:"h-100",ref:s},i().createElement("div",{className:"p-3 d-flex flex-column h-100"},i().createElement("div",{className:"flex-grow-1"},i().createElement("div",{className:"cv-image-container text-center"},i().createElement("img",{className:"img-fluid rounded",src:f,alt:t.name||ft[n]})),i().createElement("div",{className:"".concat(ot," h6 text-center text-dark p-3")},i().createElement("span",{className:"d-inline-block ".concat(d?"me-3":""," cv-multiple-choice-bullet")},i().createElement(m,null)),d&&i().createElement("span",{className:"flex-grow-1 pe-4"},t.name))),i().createElement("div",{className:"text-end"},i().createElement(k.L,{className:"btn btn-link",onClick:function(){return a(null)}},"Close"))))),i().createElement("li",{className:"".concat(y," mb-3")},i().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(ot,"\n ").concat(h,"\n ").concat(c?"mb-0 h-100":"","\n "),key:n,onClick:p},v),c&&i().createElement("span",{className:"d-block position-relative ".concat(lt)},i().createElement("span",{className:"\n ".concat(st,"\n position-absolute\n start-0\n end-0\n top-0\n bottom-0\n rounded-top\n bg-gray-400\n "),style:{backgroundImage:f?"url(".concat(f,")"):void 0},title:t.name||ft[n]})),i().createElement("span",{className:"d-flex ".concat(d||e.isDisplayOnly?"justify-content-between":"justify-content-center"," ").concat(l?"p-2":"p-3")},i().createElement("span",{className:"d-inline-block ".concat(d?"me-3":""," cv-multiple-choice-bullet")},i().createElement(m,null)),d&&i().createElement("span",{className:"flex-grow-1 pe-4"},t.name),!e.onlyShowSelectedAnswer&&i().createElement("span",{className:"".concat(at," ").concat(c?ct:"")},u&&i().createElement(Me.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white"}))))))})))}dt.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var pt="Y7ls8",ht="CBgCv",mt="CVTEm",vt="tbPTs",yt="GUAUz",gt="ZCkyL",bt="TKjXy",wt="_2qC40";function Et(e){function t(t){e.onSelectAnswer&&e.onSelectAnswer(t)}return i().createElement("div",{className:"d-flex ".concat(e.className?e.className:""," ").concat("sm"===e.size?"mx-n1":"mx-n2")},e.interaction.actionableItems.map((function(n,r){var o=e.getSelectedAnswer(n.id),a=o?"bg-blue text-white":e.unCheckedBackground,c=function(){return i().createElement(i().Fragment,null)};e.showFeedback&&(a=n.isCorrect?"bg-success text-white":"bg-danger text-white ".concat(gt),e.hideFeedbackIcons||(c=function(){return i().createElement(i().Fragment,null,n.isCorrect?i().createElement(x.x,{size:x.S.Small,svgName:O.vn.Check}):i().createElement(x.x,{size:x.S.Small,svgName:O.vn.Close}))}));var s=e.showFeedback?{}:{role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&t(n)}};return i().createElement("label",Object.assign({key:r,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(wt," mx-1 h5"):"".concat(bt," mx-2 h4"),"\n ").concat(e.showFeedback?"":"cursor-pointer","\n ").concat(a)},s),i().createElement("input",{id:n.id,type:"radio",name:"multiple-choice",checked:!!o,onChange:function(){return t(n)},disabled:e.showFeedback,hidden:!0}),n.name,i().createElement("span",{className:"position-absolute p-2 ".concat(ht)},i().createElement(c,null)),i().createElement("span",{className:"".concat(mt).concat("sm"===e.size?" ".concat(vt):"")},o&&i().createElement(Me.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white ".concat("sm"===e.size?yt:"")})))})))}function St(e){return St="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},St(e)}function kt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=St(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=St(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==St(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Et.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var xt=function(){return i().createElement(i().Fragment,null)},Ot=kt(kt(kt(kt(kt(kt({},N.Z9.Annotation,xt),N.Z9.Image,xt),N.Z9.MissingWord,(function(e){var t=e.interaction.data.sentence.replace(/{([^{}]*)}/g,(function(e,t){return"{".concat(nt).concat(t,"}")})).split(/{([^{}]*)}/g),n="p-2";return e.reportsStyling||(n+=" border rounded"),i().createElement("div",{className:n},t.map((function(t,n){if(!t.startsWith(nt))return t;var r=t.replace(nt,""),o=e.interaction.actionableItems.find((function(e){return e.order.toString()===r}));if(o){var a=e.answers.find((function(e){return e.id==o.id}));if(a){if(!e.showFeedback)return i().createElement("strong",{key:n,className:"text-info"},a.text);var c=a.status===Le.Correct;return i().createElement(i().Fragment,{key:n},!c&&i().createElement(i().Fragment,null,i().createElement("del",{className:"text-danger"},i().createElement("strong",null,a.text))," "),i().createElement("strong",{className:"text-success"},o.name))}}})))})),N.Z9.MultipleChoice,(function(e){var t,n,r,o,a="my-2";return e.reportsStyling&&(a+=" mx-2"),i().createElement("div",{className:a},i().createElement(dt,{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?Xe.l.getInitialsFromFullName(e.anonymisedUserName):Xe.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===(r=e.user)||void 0===r?void 0:r.avatar)||void 0===o?void 0:o.url,onlyShowSelectedAnswer:!e.showAvatar,size:"sm",unCheckedBackground:e.showFeedback?"":"".concat(pt," text-white"),isDisplayOnly:!0}))})),N.Z9.TrueOrFalse,(function(e){var t,n,r,o,a="justify-content-start";return e.reportsStyling&&(a="justify-content-center"),i().createElement("div",{className:"my-2"},i().createElement(Et,{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?Xe.l.getInitialsFromFullName(e.anonymisedUserName):Xe.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===(r=e.user)||void 0===r?void 0:r.avatar)||void 0===o?void 0:o.url,size:"sm",unCheckedBackground:e.showFeedback?"":"".concat(pt," text-white")}))})),N.Z9.ShortAnswer,(function(e){var t=Ye.m.first(e.answers);if(!t)return i().createElement(i().Fragment,null);var n="rounded p-2 mb-2";return e.reportsStyling||(n+=" bg-blue text-white"),i().createElement("div",{className:n},t.text)}));function Ct(e){return i().createElement(i().Fragment,null,e.correctness===E.Correct&&i().createElement("div",{className:"ms-2 text-success"},i().createElement(x.x,{svgName:O.vn.Check})),e.correctness===E.Incorrect&&i().createElement("div",{className:"ms-2 text-danger"},i().createElement(x.x,{svgName:O.vn.Close})))}function Nt(e){return i().createElement("div",{className:"d-flex align-items-center justify-content-between"},i().createElement("strong",null,e.anonymisedUserName||Xe.l.getFullName(e.studentResults.user)),i().createElement(Ct,{correctness:e.correctness}))}function jt(e){return e.correctness!==E.AwaitingMarking?i().createElement(i().Fragment,null):i().createElement("div",{className:"d-flex justify-content-end mt-1"},i().createElement("div",{className:"d-flex flex-column justify-content-end cursor-pointer\n ".concat(e.markedStatus===Le.Correct?"text-success":"")},i().createElement(x.x,{svgName:e.markedStatus===Le.Correct?O.vn.CheckCircle:O.vn.CheckCircleOutline,onClick:function(){return e.markInteraction(e.studentAttempt.answers,Le.Correct)}})),i().createElement("div",{className:"d-flex flex-column justify-content-end cursor-pointer\n ".concat(e.markedStatus===Le.Incorrect?" text-danger":"")},i().createElement(x.x,{svgName:e.markedStatus===Le.Incorrect?O.vn.CrossCircleFilled:O.vn.CrossCircle,onClick:function(){return e.markInteraction(e.studentAttempt.answers,Le.Incorrect)}})))}var Pt={avatarContainer:"FEdgT"};function It(e){var t,n,r,o,a,c=Ot[e.interaction.typeId];if(!c)return i().createElement(i().Fragment,null);var s=Qe(e.studentResults),l=$e(e.interaction.id,s),u=Ke.isInteractionCorrect(e.interaction,s);return i().createElement("div",{className:"rounded ".concat(null!==(t=e.className)&&void 0!==t?t:"")},i().createElement("div",{className:"d-flex"},!!e.showStudentDetails&&i().createElement("div",{className:"me-2"},i().createElement("div",{className:Pt.avatarContainer},i().createElement(Me.q,{imageCdnUrl:e.imageCdnUrl,initials:e.anonymisedUserName?Xe.l.getInitialsFromFullName(e.anonymisedUserName):Xe.l.getInitials(null===(n=e.studentResults.user)||void 0===n?void 0:n.name,null===(r=e.studentResults.user)||void 0===r?void 0:r.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}))),i().createElement("div",{className:"flex-grow-1"},!!e.showStudentDetails&&i().createElement(Nt,{studentResults:e.studentResults,correctness:u,anonymisedUserName:e.anonymisedUserName}),i().createElement("div",{className:"d-flex justify-content-between"},i().createElement("div",{className:"flex-grow-1 ".concat(e.responseComponentClass?e.responseComponentClass:"")},l?i().createElement(c,{interaction:e.interaction,answers:l.answers,imageCdnUrl:e.imageCdnUrl,user:e.studentResults.user,showFeedback:e.showFeedback,showAvatar:e.showAvatar,reportsStyling:e.reportsStyling}):i().createElement(tt,null)),!e.showStudentDetails&&i().createElement(Ct,{correctness:u})))),i().createElement(jt,{studentAttempt:l,correctness:u,markInteraction:e.markInteraction,markedStatus:e.markedStatus}))}function Tt(e){var t=e.error;return e.error?i().createElement("p",{className:"mt-2 small text-danger"},t):i().createElement(i().Fragment,null)}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 At="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 Ft(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=_t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=_t(r))return r;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 Dt=n(41347);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){return Ut="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},Ut(e)}function Vt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ut(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ut(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ut(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Bt=function(){return!0},qt=function(){return!1},Gt=Vt(Vt(Vt(Vt(Vt(Vt({},N.Z9.Annotation,qt),N.Z9.Image,qt),N.Z9.MissingWord,Bt),N.Z9.MultipleChoice,Bt),N.Z9.ShortAnswer,(function(e){return!!e.data.suggestedResponse})),N.Z9.TrueOrFalse,Bt);function Zt(e){return Gt[e]}var zt=Vt(Vt(Vt(Vt(Vt(Vt({},N.Z9.Annotation,(function(e){var t=e.interaction.data.annotation.replace(/<(a)(.*?)>/g,'<$1 target="_blank" $2>');return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"mb-2 h4",dangerouslySetInnerHTML:{__html:t}}))})),N.Z9.Image,(function(e){var t=e.interaction,n=e.recalculateScroll,r=i().useCallback((function(e){e&&(e.onload=function(){n()})}),[]);return i().createElement("div",{className:"cv-interactive-question cv-image-interactive"},i().createElement("div",{className:"cv-image-container text-center"},i().createElement("img",{className:"img-fluid rounded",src:t.data.url,ref:r}),t.data.caption&&i().createElement(i().Fragment,null,i().createElement("p",{className:"mt-3 h4"},t.data.caption))))})),N.Z9.MissingWord,(function(e){var t=e.state,n=e.setState,r=e.interaction,o=e.showFeedback,a=r.data.sentence.replace(/{([^{}]*)}/g,(function(e,t){return"{".concat(At).concat(t,"}")})).split(/{([^{}]*)}/g);return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"mb-2 h4"},a.map((function(e,a){var c;if(!e.startsWith(At))return e;var s=e.replace(At,""),l=r.actionableItems.find((function(e){return e.order.toString()===s}));if(l){var u,f,d=t[l.id]||"",p=(u=l.name,(f=document.createElement("canvas").getContext("2d")).font="20pt arial",f.measureText(u).width);if(o){var h=l.name.toLowerCase().toString()===(null===(c=t[l.id])||void 0===c?void 0:c.toLowerCase().toString());return i().createElement(i().Fragment,{key:a},!h&&i().createElement(i().Fragment,null,i().createElement("del",{className:"text-danger"},d)," "),i().createElement("span",{className:"text-success"},l.name))}return i().createElement("span",{className:"cv-missing-word-input-container",key:a},i().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,t){if("object"!=Lt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Lt(r))return r;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)}}(l,e)},value:d,disabled:!!t.submitted,className:"cv-missing-word-input",autoComplete:"off"}))}}))),i().createElement(Tt,{error:t.error}))})),N.Z9.MultipleChoice,(function(e){var t=e.state,n=e.setState,r=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,s=1===r.actionableItems.filter((function(e){return e.isCorrect})).length;return i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",{className:"h4"},r.name),!s&&i().createElement("div",{className:"rounded bg-light-blue p-2 mb-2 text-small"},i().createElement(x.x,{svgName:O.vn.Resources,className:"d-inline-block svg-container sm align-text-bottom me-1"}),i().createElement("small",null,i().createElement("strong",null,"Multi-select: "),"This question has multiple correct answers")),i().createElement(dt,{interaction:r,showFeedback:o,onSelectAnswer:function(e,r){if(!t.submitted)if(s)n(r?Ft({},e.id,e.id):{},!0);else if(r)n(Ft({},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:Xe.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar,leftHandSidePortalNode:e.leftHandSidePortalNode,submitted:!!t.submitted}),i().createElement(Tt,{error:t.error}))})),N.Z9.ShortAnswer,(function(e){var t=e.interaction,n=e.state,r=e.setState;return e.showFeedback?i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",{className:"h4"},t.name),i().createElement("label",{className:"h4 fw-bold"},"My answer"),i().createElement("p",{className:"h4"},n[t.actionableItems[0].id]),t.data.suggestedResponse&&i().createElement(i().Fragment,null,i().createElement("label",{className:"h4 fw-bold"},"Teacher's suggested answer"),i().createElement("p",{className:"h4"},t.data.suggestedResponse))):i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",{className:"h4"},t.name),i().createElement(Dt.Z,{id:"short-answer-answer",className:"form-control mt-2",minRows:3,value:n[t.actionableItems[0].id]||"",onChange:function(e){var i,o,a;r(Object.assign(Object.assign({},n),(i={},o=t.actionableItems[0].id,a=e.target.value,(o=function(e){var t=function(e,t){if("object"!=Rt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Rt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Rt(t)?t:t+""}(o))in i?Object.defineProperty(i,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[o]=a,i)))},disabled:!!n.submitted}),i().createElement(Tt,{error:n.error}))})),N.Z9.TrueOrFalse,(function(e){var t=e.state,n=e.setState,r=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,s=r.actionableItems.find((function(e){return e.isCorrect}));return i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",{className:"h4"},r.name),i().createElement(Et,{className:"justify-content-center",interaction:r,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,t){if("object"!=Mt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Mt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Mt(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:Xe.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar}),o&&i().createElement("div",{className:"text-center px-5 mt-3"},i().createElement("p",{className:"h4"},"The answer is ",i().createElement("strong",null,s.name)),r.data.feedback&&i().createElement("p",{className:"h4"},r.data.feedback)),i().createElement(Tt,{error:t.error}))}));function Ht(){return""}var Wt=Vt(Vt(Vt(Vt(Vt(Vt({},N.Z9.Annotation,Ht),N.Z9.Image,Ht),N.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"})),N.Z9.MultipleChoice,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),N.Z9.ShortAnswer,(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 provide an answer to the question"})),N.Z9.TrueOrFalse,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),Kt=Vt(Vt(Vt(Vt(Vt(Vt({},N.Z9.Annotation,null),N.Z9.Image,null),N.Z9.MissingWord,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),N.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}})))})),N.Z9.ShortAnswer,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),N.Z9.TrueOrFalse,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t]}})))}));function Yt(e){return Kt[e]}var Qt=Vt(Vt(Vt(Vt(Vt(Vt({},N.Z9.Annotation,Ke.notApplicable),N.Z9.Image,Ke.notApplicable),N.Z9.MissingWord,(function(e,t){return Ke.isMissingWordCorrect(t,(function(t){return e[t]}))})),N.Z9.MultipleChoice,(function(e,t){return Ke.isMultipleChoiceCorrect(t,(function(t){return e[t]}))})),N.Z9.ShortAnswer,Ke.awaitingMarking),N.Z9.TrueOrFalse,(function(e,t){return t.actionableItems.filter((function(e){return e.isCorrect})).every((function(t){return e[t.id]===t.name}))?E.Correct:E.Incorrect}));function $t(e){return Qt[e]}var Xt={feedback:"O6oD6"};function Jt(e){var t=e.studentResults,n=e.interaction,r=e.timepoint,o=e.interactive,a=e.state,c=e.goToTimepoint,s=e.interactionNumber,l=e.imageCdnUrl,u=Qe(t),f=$e(n.id,u),d=a.interactions[n.id],p=$t(n.typeId)(d||{},n),h=n.typeId!==N.Z9.Annotation&&n.typeId!==N.Z9.Image,m=h;n.typeId===N.Z9.MissingWord&&f&&(m=!1);var v=n.data.suggestedResponse||n.data.feedback;return i().createElement("li",{className:"mb-3 position-relative"},i().createElement("div",{className:"d-flex flex-wrap mb-2 cursor-pointer",onClick:function(){return c(r.id,n.id)}},o.immediateFeedback&&i().createElement("div",{className:Xt.feedback},!!f&&(p===E.AwaitingMarking?i().createElement("span",{className:"text-secondary fst-italic"},"Waiting to be marked"):p===E.Correct?i().createElement("span",{className:"text-success"},"Correct ",i().createElement(x.x,{className:"svg-container align-middle",svgName:O.vn.Check})):p===E.Incorrect&&i().createElement("span",{className:"text-danger"},"Incorrect ",i().createElement(x.x,{className:"svg-container align-middle",svgName:O.vn.Close})))),i().createElement(T,{interaction:n,iconClassName:"flex-shrink-0",showQuestion:m,showTypeName:!0,questionClassName:"d-block w-100 mt-2",questionNumber:s})),h&&!f&&i().createElement("button",{className:"btn btn-dark",onClick:function(){return c(r.id,n.id)}},"Answer question"),f&&h&&i().createElement(It,{interaction:n,studentResults:t,markedStatus:Le.PendingReview,markInteraction:function(){},imageCdnUrl:l,showFeedback:o.immediateFeedback,showAvatar:!0}),o.immediateFeedback&&f&&v&&i().createElement("div",{className:"bg-light rounded p-2"},i().createElement("div",null,i().createElement("strong",null,n.typeId===N.Z9.TrueOrFalse?"Teacher's feedback":"Teacher's suggested response")),v))}var en={interaction:"pUo8u"};function tn(e){var t=e.interactive,n=e.duration;return n?i().createElement(i().Fragment,null,t.timepoints.map((function(t,r){if(!t.interactions.length)return i().createElement(i().Fragment,null);var o=j.w.getTypeInfo(t.interactions[0].typeId).bgClassName,a=t.visibleAt/1e3/n*100;return i().createElement("span",{key:r,className:"".concat(en.interaction," ").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}})}))):i().createElement(i().Fragment,null)}var nn={progress:"BnKli"};function rn(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 on(e){var t,n,r=e.duration,o=e.progress,a=e.player,c=(t=i().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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return rn(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)?rn(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],s=[];if(o.length){var l=o[0];s.push(l),o.forEach((function(e,t){0!==t&&(l.end.time+1>e.start.time&&l.start.time<e.start.time?l.end=e.end:(l=e,s.push(l)))}))}return i().useEffect((function(){var e=function(){c(o.length)};return a.on("progressflush",e),function(){return a.off("progressflush",e)}}),[]),i().createElement(i().Fragment,null,s.map((function(e,t){var n=e.start.time/r*100,o=100*(1-e.end.time/r);return i().createElement("span",{key:t,className:nn.progress,style:{left:"".concat(n,"%"),right:"".concat(o,"%")}})})))}var an=400;function cn(e){return!!(null==e?void 0:e.toString().startsWith("new_"))}function sn(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"])}var ln=function(e){var t=e.interactive,n=e.state,r=0,i=0,o=0,a=!1,c=[];return t.timepoints.forEach((function(e){e.interactions.forEach((function(e){var t=n.interactions[e.id],s=$t(e.typeId)(t||{},e);s===E.Correct&&r++,s!==E.NotApplicable&&i++,s!==E.NotApplicable&&(null==t?void 0:t.submitted)&&o++,s===E.AwaitingMarking&&(a=!0);var l=sn(t||{}),u=Object.keys(l).map((function(e){var t;return{id:e,text:null===(t=l[e])||void 0===t?void 0:t.toString()}}));u.length&&c.push({id:e.id,answeredAt:1,answers:u})}))})),{correctCount:r,total:i,answered:o,studentAttempts:c,awaitingMarking:a}},un={bar:"gxTA_"};function fn(e){return function(e){if(Array.isArray(e))return pn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||dn(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 dn(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}}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 hn(e){var t,n,r=e.showSummary,o=e.setShowSummary,a=e.state,c=e.interactive,s=e.player,l=e.progress,u=e.portalNode,f=i().useRef(),d=(t=i().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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||dn(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],h=d[1];function m(){o(!1),s.show(),s.play()}function v(t,n){m(),e.goToTimepoint(t,n)}if(!u||!r)return i().createElement(i().Fragment,null);var y=ln({interactive:c,state:a}),g=y.correctCount,b=y.total,w=y.answered,E=y.studentAttempts,S=y.awaitingMarking,x={name:e.currentUser.givenName,username:e.currentUser.username,user:{name:e.currentUser.givenName,surname:e.currentUser.familyName,avatar:{url:e.currentUser.avatar}},results:[{id:c.id,attempts:E}]},C=0,N=s.ended(),j=s.duration();return i().createElement(_e.Nq,{node:u},i().createElement("div",{className:"row pb-3"},i().createElement("div",{className:"col-4 col-xs-12"},i().createElement(De.Z,{data:s.poster(),imageType:Re.__.Thumbnails,imageOptions:{size:Re.h2.Medium}})),i().createElement("div",{className:"col-8 col-xs-12"},i().createElement("span",{className:"float-end"},i().createElement(Fe.h,{svgName:O.vn.Play,className:"btn btn-outline-dark",onClick:function(){m(),s.ended()&&s.currentTime(0)}},N?"Play again":"Continue watching"),s.gradePassbackPlugin().enabled&&(p?i().createElement(k.L,{className:"btn btn-dark ms-2",onClick:function(){}},i().createElement(Ae.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(Fe.h,{svgName:O.vn.Check,className:"btn btn-dark ms-2",onClick:function(){h(!0),s.gradePassbackPlugin().submit(g/b,!S)}},"Submit"))),i().createElement("h1",{className:"h3"},e.title),i().createElement("p",null))),i().createElement("div",{className:"border rounder px-2 mb-3"},i().createElement("div",{className:"cursor-pointer my-4 ".concat(un.bar),onClick:function(e){if(f.current){var t=f.current.getBoundingClientRect(),n=(e.pageX-t.left)/t.width*j;m(),s.currentTime(n)}},ref:f},i().createElement(on,{duration:j,progress:l,interactive:c,player:s}),i().createElement(tn,{duration:j,interactive:c,goToTimepoint:v}))),i().createElement("h2",{className:"h4"},"My Answers"),i().createElement("div",{className:"d-flex justify-content-between"},i().createElement("span",null,c.immediateFeedback&&i().createElement("div",null,"Score: ",g,"/",b),i().createElement("div",{className:"mb-3"},"You have answered ",i().createElement("strong",{className:w!==b?"text-danger":""},w)," of ",i().createElement("strong",null,b)," questions"))),i().createElement("div",{className:"row"},i().createElement("div",{className:"col-lg-7 col-12"},i().createElement("ul",{className:"list-unstyled"},c.timepoints.reduce((function(t,n){return[].concat(fn(t),fn(n.interactions.map((function(t){return C++,i().createElement(Jt,{key:t.id,studentResults:x,interaction:t,timepoint:n,interactive:c,state:a,goToTimepoint:v,interactionNumber:C,imageCdnUrl:e.imageCdnUrl})}))))}),[])))))}function mn(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vn(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)?vn(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 vn(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 yn(e){var t=e.player,n=e.resultsService,r=e.interactive,o=e.setShowSummary,a=e.mobile,c=mn(i().useState(!1),2),s=c[0],l=c[1],u=mn(i().useState(!1),2),f=u[0],d=u[1],p=e.player.activePlugins_.activityStatusPlugin,h=e.player.activePlugins_.favouritePlugin;function m(){var e=t.currentTime(),n=r.timepoints[r.timepoints.length-1];f||e>n.visibleAt/1e3+1?l(!0):l(!1)}function v(){d(!0)}if(i().useEffect((function(){return t.on("ended",v),function(){return t.off("ended",v)}}),[]),i().useEffect((function(){if(n&&!a)return t.on("timeupdate",m),function(){return t.off("timeupdate",m)}}),[f]),!s)return null;var y="btn btn-outline-dark cv-show-summary";return h&&(y+=" cv-has-favourite-plugin"),p&&(y+=" cv-has-activity-status-plugin"),i().createElement(k.L,{className:y,onClick:function(){o(!0),t.pause(),t.hide()}},t.gradePassbackPlugin().enabled?"Submit answers":"View summary")}function gn(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 bn(e){var t,n,r=e.resultsService,o=e.player,a=e.onShowSummary,c=e.mobile,s=(t=i().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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return gn(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)?gn(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.")}()),l=s[0],u=s[1];function f(e){u(e),a&&a(e)}function d(){f(!0),o.hide()}return i().useEffect((function(){if(r&&!c)return o.on("ended",d),function(){return o.off("ended",d)}}),[]),i().useEffect((function(){l&&o.isFullscreen()&&o.exitFullscreen()}),[l]),i().createElement(i().Fragment,null,i().createElement(yn,Object.assign({setShowSummary:f},e)),i().createElement(hn,Object.assign({showSummary:l,setShowSummary:f},e)))}var wn=n(25692),En=n(98985);function Sn(){var e=En.o.getLiteArticle(wn.b.MakeInteractive);return i().createElement("div",{className:"my-5 text-center"},i().createElement("h2",{className:"h3"},"Select an interaction to get started"),i().createElement("p",{className:"mb-0"},"Choose a point in the video and add a question to interact and engage your students."),!!e&&i().createElement("a",{href:e,target:"_blank",className:"btn btn-link text-info"},"How do I make interactives?"))}function kn(e){var t=e.isCreate,n=e.interactive,r=e.interaction,o=e.portalNode,a=e.goToTimepoint,c=e.promptDelete,s=e.hasPlayPageV2;if(!o)return i().createElement(i().Fragment,null);var l=n.timepoints.reduce((function(e,t){return e+t.interactions.length}),0);return i().createElement(_e.Nq,{node:o},l?i().createElement(i().Fragment,null,i().createElement("h2",{className:"h4 mt-3"},"Question List (",l,")"),i().createElement(R,{interactive:n,maxHeight:300,goToTimepoint:a,selectedInteractionId:null==r?void 0:r.id,onClickDelete:t?c:void 0,hasPlayPageV2:s})):t?i().createElement(Sn,null):i().createElement(i().Fragment,null))}var xn=n(90547),On=n(5256),Cn=n(30708);function Nn(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 jn=[N.Z9.MissingWord,N.Z9.MultipleChoice,N.Z9.TrueOrFalse,N.Z9.ShortAnswer,N.Z9.Image,N.Z9.Annotation];function Pn(e){var t,n,r=e.addInteraction,o=e.cancelTypeSelector,a=e.player,c=e.timepoint,s=e.open,l=e.isCreate,u=e.interaction,f=(t=i().useState((0,Cn.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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Nn(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)?Nn(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.")}()),d=f[0],p=f[1];return i().useEffect((function(){var e=function(){p((0,Cn.m)(a.currentTime()))};return a.on("timeupdate",e),function(){return a.off("timeupdate",e)}}),[]),u||!l?i().createElement(i().Fragment,null):i().createElement("div",{className:"d-flex align-items-center justify-content-center h-100"},i().createElement("div",{className:"cv-interactive-type-selector justify-content-center align-items-center"},i().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:"," ",d),i().createElement("ul",{className:"list-unstyled row row-cols-3 g-2"},jn.map((function(e,t){var n=j.w.getTypeInfo(e),o=n.name,a=n.bgClassName,c=n.Svg;return i().createElement("li",{className:"col",key:t},i().createElement(k.L,{className:"cv-type-selector rounded py-2 w-100 ".concat(a),onClick:function(){return r(e)}},i().createElement("span",{className:"cv-create-type-icon mb-1"},i().createElement(c,null)),i().createElement("div",{className:"d-flex align-items-center justify-content-center cv-interaction-type-name text-shadow px-1"},o)))}))),(c||s)&&i().createElement("div",{className:"text-center w-100 mt-2 ".concat(c?"":"cv-adding-first-cancel")},i().createElement(k.L,{className:"btn btn-link",onClick:o},"Cancel"))))}var In=n(12704);function Tn(e){var t=e.timepoint,n=e.interaction,r=e.promptDelete,o=e.optionsPortalNode,a=e.setView;if(!n)return i().createElement(i().Fragment,null);var c=[];if(c.push({label:"Move time point",onClick:function(){return a("move")}}),t.interactions.length>1){var s=cn(n.id);c.push({label:"Re-order questions",onClick:function(){return a("reorder")},className:s?"disabled":""})}return c.push({label:"Delete",onClick:function(){return r(n.id)},className:"text-danger"}),i().createElement(_e.Nq,{node:o},!!n&&i().createElement(In.m,{actions:c,className:"p-0 mt-n2",dropdownToggleClassName:"p-0"}))}function Ln(e){var t=e.interaction,n=e.interactionState,i=e.onClickContinue,o=e.onClickSave,a=e.onClickCancel,c=e.onClickAddAnother,s=e.onClickDiscard,l=cn(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"},l?r.createElement(k.L,{className:"btn btn-link",onClick:a},"Cancel"):u?r.createElement(k.L,{className:"btn btn-link",onClick:s},"Discard"):r.createElement(k.L,{className:"btn btn-link",onClick:c},"Add another question"),f?r.createElement(k.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(Ae.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):l?u?r.createElement(k.L,{className:"btn btn-dark ms-2",onClick:o},"Save"):r.createElement(k.L,{className:"btn btn-dark ms-2 disabled",onClick:function(){}},"Save"):u?r.createElement(k.L,{className:"btn btn-dark ms-2",onClick:o},"Save"):r.createElement(Ie,{className:"btn btn-dark ms-2",onClick:i,svgName:O.vn.Play},"Continue"))}function An(e){var t=e.typeId,n=e.interactionState,i=e.onClickSkip,o=e.numberOfInteractions,a=e.currentIndex,c=e.changeIndex,s=!!(null==n?void 0:n.submitted),l=!!(null==n?void 0:n.hasChanges),u=!!(null==n?void 0:n.spinner),f=!!Yt(t),d=a<o-1;var p=a>0;return r.createElement("div",{className:"cv-timpoint-button-container flex-wrap"},!s&&f&&r.createElement(k.L,{className:"btn btn-link",onClick:i},"Come back later"),o>1&&a>0&&r.createElement(Ie,{className:"btn btn-dark ms-2 ".concat(p?"":"disabled"),onClick:function(){p&&c(a-1)},svgName:O.vn.ChevronUp}),u?r.createElement(k.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(Ae.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):s||!f?1===o||a===o-1?r.createElement(Ie,{className:"btn btn-dark ms-2",onClick:i,svgName:O.vn.Play},"Continue"):r.createElement(k.L,{className:"btn btn-dark ms-2 ".concat(d?"":"disabled"),onClick:function(){d&&c(a+1)}},"Next"):r.createElement(k.L,{className:"btn btn-dark ms-2 ".concat(l?"":"disabled"),onClick:function(){l&&e.onClickSubmit()}},"Save"))}function _n(e){var t=e.isCreate,n=e.interaction,r=e.interactionState,o=e.continueInteractive,a=e.saveInteraction,c=e.cancel,s=e.addAnotherQuestion,l=e.discardChanges,u=e.submitInteractionAnswer,f=e.onClickSkip,d=e.changeIndex,p=e.timepoint,h=e.currentIndex;return i().createElement(i().Fragment,null,t?i().createElement(Ln,{interaction:n,interactionState:r,onClickContinue:o,onClickSave:a,onClickCancel:c,onClickAddAnother:s,onClickDiscard:function(){return l()}}):i().createElement(An,{typeId:n.typeId,interactionState:r,onClickSubmit:u,onClickSkip:f,changeIndex:d,currentIndex:h,numberOfInteractions:p.interactions.length}))}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,r=e.typeId,o=e.currentIndex,a=e.numberOfInteractions,c=e.changeIndex,s=e.player,l=(t=i().useState((0,Cn.m)(s.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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)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.")}()),u=l[0],f=l[1];i().useEffect((function(){var e=function(){f((0,Cn.m)(s.currentTime()))};return s.on("timeupdate",e),function(){return s.off("timeupdate",e)}}),[]);var d=j.w.getTypeInfo(r),p=d.name,h=d.bgClassName,m=o<a-1,v=o>0;return i().createElement("div",{className:"text-center d-flex justify-content-between align-items-center p-1 ".concat(h)},i().createElement(k.L,{onClick:function(){v&&c(o-1)},className:v?"":"invisible"},i().createElement(x.x,{size:x.S.Medium,svgName:O.vn.ChevronLeft})),i().createElement("div",null,i().createElement("h2",{className:"h6 mb-0"},p),a>1&&i().createElement("div",null,o+1," of ",a," at ",u)),i().createElement(k.L,{onClick:function(){m&&c(o+1)},className:m?"":"invisible"},i().createElement(x.x,{size:x.S.Medium,svgName:O.vn.ChevronRight})))}var Rn=n(29014),Mn=n(2248),Un=n(3026),Vn=n(52076),Bn={button:"nckQw"};function qn(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 Gn=null,Zn=!1,zn="shared.immersiveReader";function Hn(e){var t,n,i=(t=r.useState(Gn),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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return qn(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)?qn(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 Gn||Zn||(Zn=!0,(0,Un.ajaxRequest)({resource:"/api/integrations/token/immersive-reader",type:Mn.k.GET,success:function(e){Gn=e,a(e),window.setTimeout((function(){Gn=null,Zn=!1}),9e5)},error:function(){}})),o?(e.title||(e.title=Je.T.getPhrase(zn,"titleFallback")),r.createElement("span",{className:"".concat(Bn.button," ").concat(e.className||""),onClick:function(){l.q.isFunction(e.onLaunch)&&e.onLaunch(),Vn.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()}};Rn.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 Wn={reader:"Erirh"},Kn=["A","B","C","D"];function Yn(e){if(!e.enableImmersiveReader)return i().createElement(i().Fragment,null);var t=e.interaction,n=e.className,r=j.w.getTypeInfo(t.typeId),o=r.name,a=r.typeName,c="";switch(t.typeId){case N.Z9.Annotation:c=t.data.annotation;break;case N.Z9.Image:c=t.data.caption;break;case N.Z9.MissingWord:c=t.data.sentence.replace(/{([^{}]*)}/g,(function(){return"<u>&nbsp;&nbsp;&nbsp;&nbsp;</u>"}));break;case N.Z9.MultipleChoice:c=t.name,t.actionableItems.map((function(e,t){return c+="<br />".concat(Kn[t],": ").concat(e.name)}));break;case N.Z9.ShortAnswer:c=t.name;break;case N.Z9.TrueOrFalse:c="True or false: ".concat(t.name)}var s=t.typeId===N.Z9.Annotation||t.typeId===N.Z9.MissingWord||t.typeId===N.Z9.MultipleChoice;return i().createElement(Hn,{title:o,text:c,html:s,className:"".concat(Wn.reader," ").concat(n||""),analyticsData:{id:t.interactiveId,type:a},analyticsOptions:{location:d.LZ.InteractivePlayer,entity:d.py.Interactive,actionType:d.Vw.Click,descriptor:d._S.LaunchImmersiveReader}})}function Qn(e){var t=j.w.getTypeInfo(e.interaction.typeId),n=t.name,r=t.prompt,o=t.bgClassName,a=t.Svg;return i().createElement("div",{className:"text-center text-body d-flex justify-content-between align-items-center px-3 pt-3"},i().createElement("div",{className:"d-flex align-items-center"},i().createElement("span",{className:"cv-interaction-icon rounded my-1 text-white ".concat(o)},i().createElement(a,null)),i().createElement("span",{className:"text-start flex-grow-1"},i().createElement("div",{className:"h5 ".concat(r?"":"mb-0")},i().createElement("strong",null,n)),r&&i().createElement("div",{className:"h6 mb-0"},r))),i().createElement(Yn,{interaction:e.interaction,className:"ms-2",enableImmersiveReader:e.enableImmersiveReader}))}function $n(e){var t=e.isCreate,n=e.interaction,r=e.player,o=e.changeIndex,a=e.timepointState,c=e.timepoint;return t?i().createElement(Dn,{typeId:n.typeId,changeIndex:o,player:r,currentIndex:a.interactionIndex,numberOfInteractions:c.interactions.length}):i().createElement(Qn,{interaction:n,enableImmersiveReader:e.enableImmersiveReader})}var Xn=n(10671),Jn=n(98886),er=n(6880);function tr(e){var t=e.error;return e.error?i().createElement("p",{className:"mt-2 small text-danger"},t):i().createElement(i().Fragment,null)}function nr(e){return nr="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},nr(e)}function rr(){rr=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==nr(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(nr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ir(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,or(r.key),r)}}function or(e){var t=function(e,t){if("object"!=nr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=nr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==nr(t)?t:t+""}var ar=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},cr=function(e){return"/api/domain/v1/interactions/".concat(e)},sr=function(e){return"/api/domain/v1/timepoints/".concat(e)},lr={},ur=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 ar(this,void 0,void 0,rr().mark((function t(){var n,r,i,o,a;return rr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=cn(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?$.e.post(r,JSON.stringify(i),lr):$.e.put(r,JSON.stringify(i),lr),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 ar(this,void 0,void 0,rr().mark((function t(){return rr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,$.e.delete(cr(e),lr);case 2:case"end":return t.stop()}}),t)})))}},{key:"saveTimepoint",value:function(e){return ar(this,void 0,void 0,rr().mark((function t(){var n,r;return rr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={interactiveId:e.interactiveId,shouldPause:1,visibleAt:e.visibleAt},t.next=3,$.e.post("/api/domain/v1/timepoints",JSON.stringify(n),lr);case 3:r=t.sent,e.id=r.id;case 5:case"end":return t.stop()}}),t)})))}},{key:"updateTimepoint",value:function(e){return ar(this,void 0,void 0,rr().mark((function t(){return rr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,$.e.put((n=e.id,"/api/domain/v1/timepoints/".concat(n)),JSON.stringify(e),lr);case 2:case"end":return t.stop()}var n}),t)})))}},{key:"deleteTimepoint",value:function(e){return ar(this,void 0,void 0,rr().mark((function t(){return rr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,$.e.delete(sr(e),lr);case 2:case"end":return t.stop()}}),t)})))}}])&&ir(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()),fr={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?i().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 dr(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pr(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)?pr(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 pr(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 hr(e){var t=dr(i().useState(""),2),n=t[0],r=t[1],o=dr(i().useState(""),2),a=o[0],c=o[1];return i().createElement("div",{"aria-haspopup":"true","aria-expanded":e.expanded,"aria-label":"rdw-color-picker"},i().createElement("div",{className:"rdw-option-wrapper cv-annotation-toolbar-option cv-annotation-link",onClick:e.onExpandEvent}," "),e.expanded&&i().createElement("div",{className:"rdw-link-modal",onClick:function(e){return e.stopPropagation()}},i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"cv-annotation-url"},"URL"),i().createElement("input",{id:"cv-annotation-url",className:"form-control",onChange:function(e){return r(e.target.value)},value:n,placeholder:"Enter URL",autoComplete:"off"})),i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"cv-annotation-text"},"Text"),i().createElement("input",{id:"cv-annotation-text",className:"form-control",onChange:function(e){return c(e.target.value)},value:a,placeholder:"Enter Text",autoComplete:"off"})),i().createElement(k.L,{onClick:function(){return e.onChange("link",a||n,n,"_blank")},className:"btn btn-dark"},"Add")))}function mr(e){return mr="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},mr(e)}function vr(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return yr(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)?yr(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 yr(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 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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==mr(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(mr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var br=n(48088);function wr(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 Er=!0,Sr=function(e){"boolean"==typeof e&&(Er=e);var t,n,r=(t=i().useState(Er),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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return wr(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)?wr(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=r[0],a=r[1],c=br.Radio.channel("video:drag:drop:lock");function s(){a(Er)}return i().useEffect((function(){if(Er)return c.on("update",s),function(){c.off("update",s)}}),[]),{enabled:o,disable:function(){Er=!1,c.trigger("update")},enable:function(){Er=!0,c.trigger("update")}}};function kr(){var e=Sr(),t=e.enable,n=e.disable;i().useEffect((function(){return n(),function(){return t()}}),[])}var xr=n(24365),Or=n(99828),Cr={onFileSelect:function(e,t,n,r){if(t&&t.length){var i=new FileReader;i.addEventListener("load",(function(){return Cr.onReaderLoad(i,e,n,r)})),i.readAsDataURL(t[0])}},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:Or.y[t].width,s=null!==(o=null==r?void 0:r.height)&&void 0!==o?o:Or.y[t].height;a.addEventListener("load",(function(){Cr.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:Or.y[e].width,a=null!==(i=null==n?void 0:n.height)&&void 0!==i?i:Or.y[e].height;return!(o&&t.width<o||a&&t.height<a)},mapImageTypeToString:function(e){switch(e){case Re.__.Avatars:return"avatars";case Re.__.Thumbnails:return"thumbnails";case Re.__.Logos:return"logos";case Re.__.Covers:return"covers";case Re.__.Posters:return"posters";case Re.__.TallPosters:return"tallposters";case Re.__.HeroBanners:return"herobanners";case Re.__.None:default:return""}}};function Nr(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return jr(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)?jr(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 jr(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(e){var t=Nr(i().useState(!1),2),n=t[0],r=t[1],o=Nr(i().useState(0),2),a=o[0],c=o[1];return i().useEffect((function(){0===a&&n&&r(!1)}),[a,n,r]),i().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&&r(!0)},onDragLeave:function(e){e.preventDefault(),e.stopPropagation(),c((function(e){return e-1}))},onDrop:function(t){t.preventDefault(),t.stopPropagation(),r(!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 Ir(e){return Ir="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},Ir(e)}function Tr(){Tr=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Ir(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(Ir(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Lr(e){return Lr="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},Lr(e)}function Ar(){Ar=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Lr(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(Lr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var _r=/[.\?!,;:\-''\(\)]/g;function Fr(e){for(var t=e.split("");t.length&&t[0].match(_r);)t.shift();for(;t.length&&t[t.length-1].match(_r);)t.pop();return t.join("")}function Dr(e,t){for(var n=e.split(""),r=[],i=[];n.length&&n[0].match(_r);)r.push(n.shift());for(;n.length&&n[n.length-1].match(_r);)i.unshift(n.pop());return r.join("")+t+i.join("")}function Rr(e){return e.map((function(e){if(!e.selected)return e.text;var t=Fr(e.text).length,n=new Array(t).fill("_").join("");return Dr(e.text,n)})).join(" ")}function Mr(e){return e.map((function(e){var t;return e.selected?null===(t=Dr(e.text,"{".concat(e.order,"}")))||void 0===t?void 0:t.trim():e.text})).join(" ")}var Ur=n(63946);function Vr(e){return i().createElement(Ur.u,{title:e.tooltipText,spanHack:!0,spanHackClassName:"d-inline-block"},i().createElement(x.x,{svgName:O.vn.Info}))}function Br(){return i().createElement("svg",{viewBox:"0 0 43 38",className:"cv-upload-image-icon"},i().createElement("g",{transform:"translate(-1193.000000, -185.000000)"},i().createElement("g",{transform:"translate(1183.000000, 173.000000)"},i().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 qr(e){var t,n,r=i().useRef(null),o=i().useRef(null);function a(){e.onChange(Object.assign(Object.assign({},e.answer),{isCorrect:!e.answer.isCorrect}))}function c(t){e.isTrueOrFalse||t&&t[0]&&Cr.onFileSelect(Re.__.None,t,(function(e){xr.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:s})}))}function s(t,n){var r=t.split(",")[1];$.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 i().createElement(Pr,{onDropImage:c,dragClassName:"cv-multiple-choice-upload-mask"},i().createElement("div",{className:"p-2 my-1 w-100 bg-white d-flex align-items-center rounded cv-multiple-choice-answer"},i().createElement("div",{className:"form-check",onKeyDown:function(e){return"Enter"===e.key&&a()}},i().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)}),i().createElement("label",{ref:r,htmlFor:"multiple-choice--".concat(e.answer.order),className:"cursor-pointer form-check-label"})),e.isTrueOrFalse?i().createElement("label",{className:"mb-0",htmlFor:"multiple-choice--".concat(e.answer.order)},e.answer.name):i().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&&i().createElement(i().Fragment,null,i().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)?i().createElement(Ur.u,{key:"1",title:"Remove image",spanHack:!0,spanHackClassName:"mt-n2 mb-n2 me-n2"},i().createElement(k.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}))}},i().createElement("span",{className:"cv-multiple-choice-remove-image"},i().createElement(x.x,{svgName:O.vn.Delete})))):i().createElement(Ur.u,{key:"2",title:"Upload an image",spanHack:!0},i().createElement(k.L,{type:"button",className:"svg-container",onClick:function(){o.current.value=null,o.current.click(null)}},i().createElement(Br,null))))))}function Gr(e){return Gr="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},Gr(e)}function Zr(){Zr=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Gr(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(Gr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function zr(e){var t;if(!(null===(t=e.question)||void 0===t?void 0:t.trim()))return"Please provide a question";if(!e.answers.find((function(e){return e.isCorrect})))return"Please select the correct answer";var n=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(n.length<2)return"Please provide at least two answers";var r=e.answers.filter((function(e){var t;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())}));if(r.length&&r.length!==n.length)return"Please add text to every question or none of the questions.";var i=!1,o={};if(r.forEach((function(e){i||(o[e.name]?i=!0:o[e.name]=!0)})),i)return"There are duplicates in your answers";var a=n.filter((function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.imageUrl})).length;return a&&a<n.length?"Please add an image to all answers":null}function Hr(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=Zr().mark((function r(){return Zr().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,ur.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{s(a.next(e))}catch(e){t(e)}}function c(e){try{s(a.throw(e))}catch(e){t(e)}}function s(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}s((a=a.apply(r,i||[])).next())}))}function Wr(e){var t=e.state,n=void 0===t?function(e){var t,n=e.typeId===N.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,r=e.setState,o=e.interaction,a=e.optionsPortalNode,c=e.showFeedback,s=o.typeId===N.Z9.TrueOrFalse;function l(e){var t,i,o=n.answers.map((function(t){return t.order!==e.order?Object.assign(Object.assign({},t),{isCorrect:!s&&t.isCorrect}):e}));if(o.find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)}))&&(i=(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!==i.order})).map((function(e,t){return Object.assign(Object.assign({},e),{order:t})})):t.map((function(e){return e.order!==i.order?e:Object.assign(Object.assign({},e),{isCorrect:!1})}))),!s&&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=Ye.m.last(o);o.push({name:"",order:a.order+1,isCorrect:!1,data:void 0})}r(Object.assign(Object.assign({},n),{answers:o}))}return kr(),i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"multiple-choice-question"},"Question"),i().createElement(_e.t0,{node:a})),i().createElement("input",{id:"multiple-choice-question",className:"form-control",placeholder:"Enter your question here",value:n.question,onChange:function(e){r(Object.assign(Object.assign({},n),{question:e.target.value}))},autoComplete:"off"}),!n.question&&i().createElement(tr,{error:n.error})),i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"multiple-choice-answer"},s?i().createElement(i().Fragment,null,"Answer"):i().createElement(i().Fragment,null,"Answers")),i().createElement("ul",{className:"list-unstyled"},n.answers.map((function(t){return i().createElement("li",{key:t.order},i().createElement(qr,{answer:t,onChange:l,isTrueOrFalse:s,imageApi:e.imageApi}))}))),n.question&&i().createElement(tr,{error:n.error})),c&&s&&i().createElement("div",{className:"form-group mb-0"},i().createElement("label",{className:"cv-interaction-field-label d-flex justify-content-between align-items-end",htmlFor:"true-or-false-feedback"},i().createElement("span",null,"Feedback  ",i().createElement("small",{className:"text-secondary"},"(optional)")),i().createElement(Vr,{tooltipText:"Provide answer feedback for your students"})),i().createElement(Dt.Z,{id:"true-or-false-feedback",className:"form-control",minRows:2,value:n.feedback||"",onChange:function(e){r(Object.assign(Object.assign({},n),{feedback:e.target.value}))},placeholder:"Give feedback for this question"})))}function Kr(e){return Kr="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},Kr(e)}function Yr(){Yr=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Kr(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(Kr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}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 $r(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Qr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Qr(r))return r;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}var Xr=$r($r($r($r($r($r({},N.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,r=e.setState,o=e.interaction,a=e.optionsPortalNode,c=vr(i().useState(function(){var e=o.data.annotation;if(e){var t=(0,Jn.h4)(fr)(e);return er.EditorState.createWithContent(t)}return er.EditorState.createEmpty()}()),2),s=c[0],l=c[1],u=vr(i().useState(null),2),f=u[0],d=u[1];return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center"},i().createElement("label",{className:"cv-interaction-field-label",onClick:function(){return null==f?void 0:f.focusEditor()}},"Annotation"),i().createElement(_e.t0,{node:a})),i().createElement("div",{className:"cv-annotation ".concat(function(){if(!s)return!1;var e=s.getCurrentContent();return e.hasText()||"unstyled"!==e.getBlockMap().first().getType()}()?"Editor--hide-placeholder":"")},s&&i().createElement(Xn.Editor,{editorState:s,onEditorStateChange:function(e){l(e);var t=e.getCurrentContent();if(t.hasText()){var i=(0,Jn.cn)(fr)(t);r(Object.assign(Object.assign({},n),{annotation:i}))}else r(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:hr,options:["link"]}}}),i().createElement(tr,{error:n.error}))))})),N.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,r=e.setState,o=e.interaction,a=e.optionsPortalNode;kr();var c=i().useRef(null);function s(e){e&&e[0]&&Cr.onFileSelect(Re.__.None,e,(function(e){xr.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:l})}))}function l(t,i){var o=t.split(",")[1];$.e.post("".concat(e.imageApi,"v2/thumbnails/base64"),'"'.concat(o,'"'),{tokenName:"gateway"}).then((function(e){r(Object.assign(Object.assign({},n),{url:e.location})),i()})).catch((function(){return alert("Something went wrong while trying to upload image. Please try again.")}))}return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center mb-2"},i().createElement("label",{className:"cv-interaction-field-label"},"Image"),i().createElement(_e.t0,{node:a})),n.url?i().createElement("div",{className:"text-center"},i().createElement("div",{className:"cv-uploaded-image-container"},i().createElement("img",{className:"img img-fluid rounded",src:n.url,alt:n.caption}),i().createElement(k.L,{className:"cv-remove-uploaded-image d-flex justify-content-center align-items-center",onClick:function(){r(Object.assign(Object.assign({},n),{url:""}))}},i().createElement("div",{className:"btn btn-link text-light"},"Remove")))):i().createElement(Pr,{onDropImage:s,dragClassName:"cv-image-upload-mask"},i().createElement("div",{className:"cv-image-interaction-upload-container bg-white rounded py-3 text-center"},i().createElement("div",{className:"cv-upload-scenery-image mx-auto"}),i().createElement("p",{className:"mb-0"},"Drag and drop an image file or"),i().createElement(k.L,{type:"button",className:"text-underline d-inline-block",onClick:function(){c.current.value=null,c.current.click(null)}},"upload from your device"),i().createElement("input",{type:"file",className:"file-select d-none",multiple:!1,accept:"image/jpg,image/jpeg,image/png",ref:c,onChange:function(e){return s(e.target.files)}}))),i().createElement(tr,{error:n.error})),i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"image-caption"},"Caption  ",i().createElement("small",{className:"text-secondary"},"(optional)")),i().createElement("textarea",{id:"image-caption",className:"form-control",placeholder:"Caption your image",value:n.caption||o.data.caption||"",onChange:function(e){r(Object.assign(Object.assign({},n),{caption:e.target.value}))},rows:2})))})),N.Z9.MissingWord,(function(e){var t,n,r,o,a,c,s=e.state,l=void 0===s?(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===(r=t.actionableItems)||void 0===r||r.forEach((function(e){var t=e.order,n=Dr(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}):s,u=e.setState,f=e.optionsPortalNode,d=!!l.sentence;return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"missing-word-sentence"},"Sentence"),i().createElement(_e.t0,{node:f})),i().createElement("input",{id:"missing-word-sentence",className:"form-control",placeholder:"Enter your sentence here",value:l.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({},l),{fullSentence:t,sentence:Mr(n),preview:Rr(n),words:n}))},autoComplete:"off"})),d&&i().createElement(i().Fragment,null,i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label"},"Select the missing word(s)"),i().createElement("ul",{className:"list-unstyled d-flex flex-wrap mx-n1 mb-n1"},l.words.map((function(e,t){var n;return(null===(n=Fr(e.text))||void 0===n?void 0:n.trim())?i().createElement("li",{key:"".concat(t,"-").concat(e.text)},i().createElement(k.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=l.words.map((function(t){return t.order!==e?t:Object.assign(Object.assign({},t),{selected:!t.selected})})),void u(Object.assign(Object.assign({},l),{words:n,preview:Rr(n),sentence:Mr(n)}));var e,n}},Fr(e.text))):i().createElement(i().Fragment,{key:"".concat(t,"-").concat(e.text)})})))),i().createElement("div",null,i().createElement("label",{className:"cv-interaction-field-label"},"Preview"),i().createElement("p",null,l.preview))),i().createElement(tr,{error:l.error}))})),N.Z9.MultipleChoice,Wr),N.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,r=e.setState,o=e.interaction,a=e.optionsPortalNode,c=e.showFeedback;return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"short-answer-question"},"Question"),i().createElement(_e.t0,{node:a})),i().createElement("input",{id:"short-answer-question",className:"form-control",onChange:function(e){r(Object.assign(Object.assign({},n),{question:e.target.value}))},value:n.question||o.data.text||"",placeholder:"Enter your question here",autoComplete:"off"}),i().createElement(tr,{error:n.error})),c&&i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label d-flex justify-content-between align-items-end",htmlFor:"short-answer-suggested-response"},i().createElement("span",null,"Suggested Response  ",i().createElement("small",{className:"text-secondary"},"(optional)")),i().createElement(Vr,{tooltipText:"Provide a suggested response for your students"})),i().createElement(Dt.Z,{id:"short-answer-suggested-response",className:"form-control",minRows:2,value:n.suggestedResponse||"",onChange:function(e){r(Object.assign(Object.assign({},n),{suggestedResponse:e.target.value}))},placeholder:"Give a suggested response for this question"})))})),N.Z9.TrueOrFalse,Wr),Jr=$r($r($r($r($r($r({},N.Z9.Annotation,(function(e){var t;return(null===(t=e.annotation)||void 0===t?void 0:t.trim())?null:"Please provide an annotation"})),N.Z9.Image,(function(e){return e.url?null:"Please upload an image"})),N.Z9.MissingWord,(function(e){var t;return(null===(t=e.sentence)||void 0===t?void 0:t.trim())?e.words.find((function(e){return e.selected}))?null:"Please select a missing word":"Please provide a sentence"})),N.Z9.MultipleChoice,zr),N.Z9.ShortAnswer,(function(e){var t;return(null===(t=e.question)||void 0===t?void 0:t.trim())?null:"Please provide a question"})),N.Z9.TrueOrFalse,zr),ei=$r($r($r($r($r($r({},N.Z9.Annotation,(function(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=gr().mark((function r(){return gr().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,ur.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{s(a.next(e))}catch(e){t(e)}}function c(e){try{s(a.throw(e))}catch(e){t(e)}}function s(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}s((a=a.apply(r,i||[])).next())}))})),N.Z9.Image,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=Tr().mark((function i(){return Tr().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,ur.saveInteraction(t);case 6:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{s(c.next(e))}catch(e){t(e)}}function r(e){try{s(c.throw(e))}catch(e){t(e)}}function s(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}s((c=c.apply(i,o||[])).next())}))})),N.Z9.MissingWord,(function(e,t){return n=this,r=void 0,i=void 0,o=Ar().mark((function n(){var r;return Ar().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.data.sentence=Mr(e.words),t.name=e.preview,r=e.words.filter((function(e){return e.selected})),t.actionableItems=r.map((function(e){return{name:Fr(e.text),order:e.order,isCorrect:!0}})),n.next=6,ur.saveInteraction(t);case 6:case"end":return n.stop()}}),n)})),new(i||(i=Promise))((function(e,t){function a(e){try{s(o.next(e))}catch(e){t(e)}}function c(e){try{s(o.throw(e))}catch(e){t(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}s((o=o.apply(n,r||[])).next())}));var n,r,i,o})),N.Z9.MultipleChoice,Hr),N.Z9.ShortAnswer,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=Yr().mark((function i(){return Yr().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,ur.saveInteraction(t);case 5:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{s(c.next(e))}catch(e){t(e)}}function r(e){try{s(c.throw(e))}catch(e){t(e)}}function s(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}s((c=c.apply(i,o||[])).next())}))})),N.Z9.TrueOrFalse,Hr);function ti(e){return ei[e]}function ni(e){return ni="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},ni(e)}function ri(){ri=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==ni(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(ni(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ii(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)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}var ai=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},ci=13,si=37,li=39,ui=null,fi=0,di=1;function pi(e){var t=e.timepoint,n=e.updateTimepointTime,r=e.saveTimepoint,o=e.back,a=e.clearTimepointTimeState,c=ii(i().useState((0,Cn.m)(t.visibleAt/1e3)),2),s=c[0],l=c[1],u=ii(i().useState(!1),2),f=u[0],d=u[1];function p(e){n(e*di),l((0,Cn.m)(t.visibleAt/1e3)),2==++fi?di=5:4===fi?di=20:6===fi?di=60:8===fi&&(di=120),ui||(ui=window.setInterval((function(){return p(e)}),200),window.addEventListener("mouseup",h))}function h(){window.removeEventListener("mouseup",h),window.clearInterval(ui),ui=null,fi=0,di=1}return i().useEffect((function(){return h}),[]),i().createElement(i().Fragment,null,i().createElement("div",{className:"cv-timepoint flex-grow-1"},i().createElement("div",{className:"cv-timepoint-padding"},i().createElement("div",{className:"cv-interactive-question"},i().createElement("label",{htmlFor:"move-time-point",className:"cv-interaction-field-label mb-0"},"Move time point"),i().createElement("div",{className:"text-center mt-3"},i().createElement(k.L,{className:"cv-left-arrow d-inline-block cursor-pointer",onClick:function(){},onMouseDown:function(){return p(-1)},onKeyDown:function(e){e.stopPropagation(),e.keyCode===ci&&0===fi&&p(-1)},onKeyUp:h}),i().createElement("input",{id:"move-time-point",className:"form-control text-center d-inline-block cv-move-timepoint-input",value:s,onChange:function(){},onKeyDown:function(e){e.stopPropagation(),e.keyCode===si&&0===fi&&p(-1),e.keyCode===li&&0===fi&&p(1)},onKeyUp:h}),i().createElement(k.L,{className:"cv-right-arrow d-inline-block cursor-pointer",onClick:function(){},onMouseDown:function(){return p(1)},onKeyDown:function(e){e.stopPropagation(),e.keyCode===ci&&0===fi&&p(1)},onKeyUp:h}))))),i().createElement("div",{className:"cv-timpoint-button-container"},i().createElement(k.L,{className:"btn btn-link",onClick:function(){a(!0),o()}},"Cancel"),f?i().createElement(k.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},i().createElement(Ae.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(k.L,{className:"btn btn-dark",onClick:function(){return ai(this,void 0,void 0,ri().mark((function e(){return ri().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d(!0),e.next=3,r();case 3:o();case 4:case"end":return e.stop()}}),e)})))}},"Save")))}var hi=n(20455),mi=n(95339),vi=n(67445);function yi(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 gi(e){var t,n,r=(t=i().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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return yi(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)?yi(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=r[0],a=r[1],c=(0,hi.Dy)((0,hi.VT)(hi.we,{activationConstraint:{distance:10}}),(0,hi.VT)(hi.Lg,{coordinateGetter:vi.is}));return e.disabled?i().createElement(i().Fragment,null,e.children):i().createElement(hi.LB,{sensors:c,collisionDetection:hi.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?[mi.DL]:[]},i().createElement(vi.Fo,{items:e.ids,strategy:e.vertical?vi.qw:vi.U2},e.children),i().createElement(hi.y9,{dropAnimation:e.dropAnimation},o?e.getDragOverlay(o):null))}gi.defaultProps={dropAnimation:{duration:250,easing:"ease"},vertical:!0};var bi=n(17592);function wi(e){var t=(0,vi.nB)({id:e.id}),n=t.setNodeRef,r=t.transform,o=t.transition,a=t.isSorting,c=t.listeners,s=t.attributes,l=t.activeIndex,u=t.overIndex,f=t.index,d={transform:bi.ux.Transform.toString(r),transition:o,touchAction:"none",position:"relative"};a&&f===l&&(d.visibility="hidden");var p=e.childComponent,h=function(e,t,n){return t!==e?null:n>t?"down":n<t?"up":null}(f,l,u);return i().createElement(p,Object.assign({},e.childProps,{ref:n,style:d,dragListeners:c,dragAttributes:s,dragDirection:h}))}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 Si(){Si=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ki(e){return function(e){if(Array.isArray(e))return Ci(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Oi(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 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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||Oi(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){if(e){if("string"==typeof e)return Ci(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)?Ci(e,t):void 0}}function Ci(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 Ni=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},ji=function(e){var t=e.interaction,n=j.w.getTypeInfo(t.typeId).bgClassName,r=i().forwardRef((function(e,r){return i().createElement("div",Object.assign({className:"py-2 text-start"},e.dragAttributes,e.dragListeners,{ref:r,style:e.style}),i().createElement("span",{className:"fB8W8"},i().createElement(x.x,{size:x.S.Small,svgName:O.vn.Handle})),i().createElement(T,{interaction:t,iconClassName:"".concat("GSE1a"," ").concat(n),questionClassName:"".concat("qKMzc"," clamp-1")}))}));return i().createElement(wi,{id:t.id,childComponent:r,childProps:{}})},Pi=function(e){var t=e.interactions,n=function(){var e=i().useRef();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 i().createElement(gi,{ids:t.map((function(e){return e.id})),getDragOverlay:function(e){return i().createElement(ji,{key:e,interaction:t.find((function(t){return t.id===e}))})},onSortEnd:e.onSortEnd},i().createElement("div",Object.assign({tabIndex:0},n),t.map((function(e){return i().createElement(ji,{key:e.id,interaction:e})}))))};function Ii(e){var t=xi(i().useState(!1),2),n=t[0],r=t[1],o=xi(i().useState(ki(e.interactions)),2),a=o[0],c=o[1],s=xi(i().useState(!1),2),l=s[0],u=s[1];return i().createElement(i().Fragment,null,i().createElement("div",{className:"cv-timepoint flex-grow-1"},i().createElement("div",{className:"cv-timepoint-padding"},i().createElement("div",{className:"cv-interactive-question"},i().createElement("label",{className:"cv-interaction-field-label mb-0"},"Re-order questions"),i().createElement("div",{className:"text-center mt-3"},i().createElement(Pi,{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(ki(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}))))),i().createElement("div",{className:"cv-timpoint-button-container"},i().createElement(k.L,{className:"btn btn-link",onClick:function(){c(ki(e.interactions)),u(!1),e.back()}},"Cancel"),n?i().createElement(k.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},i().createElement(Ae.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(k.L,{className:"btn btn-dark ".concat(l?"":"disabled"),onClick:function(){return Ni(this,void 0,void 0,Si().mark((function t(){return Si().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l){t.next=2;break}return t.abrupt("return");case 2:return r(!0),t.next=5,e.reOrderQuestions(a);case 5:r(!1),e.back();case 7:case"end":return t.stop()}}),t)})))}},"Save")))}function Ti(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Li(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)?Li(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 Li(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 Ai(e){var t=e.isCreate,n=e.interaction,r=e.mode,o=e.immediateFeedback,a=e.interactionState,c=e.shouldFocus,s=e.delayFocus,l=e.open,u=e.timepoint,f=e.userUpdateInteractionState,d=e.submitInteractionAnswer,p=e.saveInteraction,h=e.skip,m=i().useRef(),v=i().useRef(),y=i().useRef(0),g=(0,On.a)(xn.r.XLDown),b=!t||g;function w(){return!!m.current&&!!c&&!!l}function E(){m.current&&(m.current.focus(),x(!0))}var S=Ti(i().useState(!1),2),k=S[0],x=S[1];i().useEffect((function(){w()&&(k||(s&&b?y.current=window.setTimeout((function(){y.current=0,w()&&E()}),an):E()))}),[m.current,k]);var O=Ti(i().useState("question"),2),C=O[0],N=O[1],j=i().useMemo((function(){return(0,_e.oD)()}),[]),P=n?function(e,t){if(t===M.Create)return function(e){return Xr[e]}(e);if(t===M.View)return function(e){return zt[e]}(e);throw new Error("Cannot find components for the mode ".concat(t))}(n.typeId,r):null,I=o;return t||(I=I&&(null==a?void 0:a.submitted)),i().createElement(i().Fragment,null,i().createElement(Tn,Object.assign({optionsPortalNode:j,setView:N},e)),i().createElement(rt.Z,{className:"h-100",ref:v},i().createElement(Pn,Object.assign({},e)),!!n&&i().createElement("div",{className:"d-flex flex-column h-100"},i().createElement($n,Object.assign({},e)),"question"===C&&i().createElement(i().Fragment,null,i().createElement("form",{className:"cv-timepoint flex-grow-1",tabIndex:-1,onSubmit:function(e){e.preventDefault(),t?p():d()}},i().createElement("div",{className:"cv-timepoint-padding h-100"},i().createElement("div",{ref:m,tabIndex:0}),i().createElement(P,Object.assign({state:a,setState:f,recalculateScroll:function(){v.current.recalculate()},showFeedback:I,optionsPortalNode:j},e)))),i().createElement(_n,Object.assign({onClickSkip:function(){y.current&&window.clearTimeout(y.current),h()}},e))),"move"===C&&i().createElement(pi,Object.assign({back:function(){return N("question")}},e)),"reorder"===C&&i().createElement(Ii,Object.assign({back:function(){return N("question")},interactions:u.interactions},e)))))}function _i(e){var t=e.open,n=e.nextInteraction,r=e.nextInteractionState,o=e.timepointState,a=e.interaction,c=e.delayFocus,s=i().useMemo((function(){return(0,_e.oD)({attributes:{class:"cv-interactive-lhs"}})}),[]),l=n&&o.nextInteractionIndex<o.interactionIndex,u=n&&o.nextInteractionIndex>o.interactionIndex,f=u&&o.slideIn,d=l&&o.slideIn,p=t&&!l&&!u;return i().createElement(i().Fragment,null,i().createElement("div",{className:"cv-interactive-lhs-container ".concat(p?"":"cv-closed-lhs")},i().createElement(_e.t0,{node:s})),i().createElement("div",{className:"cv-interactive ".concat(t?"cv-open":"")},l&&i().createElement("div",{className:"cv-prev-interaction ".concat(o.slideIn?"cv-slide-in":"")},i().createElement(Ai,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:r}))),i().createElement("div",{className:"\n cv-main-slide\n ".concat(f?"cv-slide-out-up":"","\n ").concat(d?"cv-slide-out-down":"","\n ").concat(n?"cv-transitioning":"","\n ")},i().createElement(Ai,Object.assign({key:null==a?void 0:a.id},e,{currentIndex:o.interactionIndex,shouldFocus:a&&!l&&!u,delayFocus:c,leftHandSidePortalNode:s}))),u&&i().createElement("div",{className:"cv-next-interaction ".concat(o.slideIn?"cv-slide-in":"")},i().createElement(Ai,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:r})))))}var Fi=n(44645),Di=n(71575),Ri=n(83996),Mi=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,Fi.s)(document.getElementById("dialog-region"));function r(){var e;l.q.isFunction(null===(e=t.cancelButtonProps)||void 0===e?void 0:e.onClick)&&t.cancelButtonProps.onClick(),n.unmount()}var o=Object.assign(Object.assign({},t.submitButtonProps?t.submitButtonProps:{}),{onClick:function(){var e;l.q.isFunction(null===(e=t.submitButtonProps)||void 0===e?void 0:e.onClick)&&t.submitButtonProps.onClick(),n.unmount()}}),a=Object.assign(Object.assign({},t.cancelButtonProps?t.cancelButtonProps:{}),{onClick:function(){r()}});n.render(i().createElement(Di.G,{title:t.title,closePopup:r,size:t.size,centered:t.centered,bodyClassName:"overflow-hidden",dialogClassName:t.dialogClassName},e,!t.hideButtons&&i().createElement(Ri.u,{className:t.buttonContainerClassName},t.cancelButtonProps&&i().createElement(Ri.u.Cancel,Object.assign({},a)),t.submitButtonProps&&i().createElement(Ri.u.Submit,Object.assign({},o)))))};function Ui(e){return Ui="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},Ui(e)}function Vi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ui(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ui(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ui(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Bi={interactions:{},timepoints:{}};function qi(e,t){return"interaction"===t.type?{timepoints:e.timepoints,interactions:Object.assign(Object.assign({},e.interactions),Vi({},t.id,t.value))}:"timepoint"===t.type?{interactions:e.interactions,timepoints:Object.assign(Object.assign({},e.timepoints),Vi({},t.id,t.value))}:void 0}function Gi(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 Zi={interactionIndex:0},zi=function(e){var t,n,r=e.mode,o=e.timepoint,a=e.latestSession,c=r===M.Create,s=i().useReducer(qi,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]),Vi(Vi({},t.actionableItemId,t.data),"submitted",!0)),e}),{})}:Bi}(a)})),l=(n=2,function(e){if(Array.isArray(e))return e}(t=s)||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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Gi(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)?Gi(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=l[0],f=l[1],d=y(null==o?void 0:o.id),p=null==o?void 0:o.interactions[d.interactionIndex],h="number"==typeof d.nextInteractionIndex?null==o?void 0:o.interactions[d.nextInteractionIndex]:null,m=g(null==p?void 0:p.id),v=g(null==h?void 0:h.id);function y(e){return e&&u.timepoints[e]||Zi}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:m,timepointState:d,nextInteraction:h,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 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 Wi(){Wi=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var Ki=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},Yi=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},Qi=!1;function $i(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xi(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)?Xi(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 Xi(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 Ji=n(25417),eo=n(81937),to=n(69184);function no(e,t){if(e){if("string"==typeof e)return ro(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)?ro(e,t):void 0}}function ro(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 io=Je.T.encloseNamespace("shared.hooks"),oo=function(){var e,t,n=(e=i().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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||no(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.")}()),r=n[0],o=n[1],a=br.Radio.channel(Ji.G.SHELL);function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.find((function(t){return t.id===e.id}))||(e.allowAppLinks||a.trigger(q.Q.Vy.LOCK_NAV),o([].concat(function(e){return function(e){if(Array.isArray(e))return ro(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||no(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.")}()}(r),[e])))}function s(e){var t=r.filter((function(t){return t.id!==e}));0!==t.length&&t.find((function(e){return!e.allowAppLinks}))||a.trigger(q.Q.Vy.UNLOCK_NAV),o(t)}function u(e){var t;if(r.length){var n=r.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(q.Q.Vy.UNLOCK_NAV),void window.setTimeout((function(){q.Q.C$.trigger(e),a.trigger(q.Q.Vy.LOCK_NAV)}),0);l.q.isFunction(n.renderCustomDialog)?n.renderCustomDialog():Mi(i().createElement("p",null,n.text),{title:n.title,submitButtonProps:{onClick:function(){n.onConfirmUnlock&&n.onConfirmUnlock(),function(e){a.trigger(q.Q.Vy.NAV_UNLOCKED_BY_USER),r.forEach((function(e){e.allowAppLinks||s(e.id)})),window.removeEventListener("beforeunload",f),q.Q.C$.trigger(e)}(e)},variant:"danger",text:io("discard")},cancelButtonProps:{text:io("cancel"),variant:"outline-dark"}})}}function f(e){var t=r.find((function(e){return e.allowAppLinks}));return t||(t=Ye.m.first(r)),e.returnValue=t.text,t.text}return i().useEffect((function(){return r.find((function(e){return!e.allowAppLinks}))&&a.on(q.Q.Vy.NAV_IS_LOCKED,u),r.length&&window.addEventListener("beforeunload",f),function(){a.off(q.Q.Vy.NAV_IS_LOCKED,u),window.removeEventListener("beforeunload",f)}}),[r]),i().useEffect((function(){function e(){c({id:"upload",title:io("navLockTitle"),text:io("navLockBody"),allowAppLinks:!0})}var t=br.Radio.channel(to.Q4.VIDEO_UPLOAD);return t.on(eo.S.FILES_ADDED,e),t.on(eo.S.UNLOCK_NAV,s),function(){t.off(eo.S.FILES_ADDED,e),t.off(eo.S.UNLOCK_NAV,s)}}),[]),{lock:c,unlock:s}};function ao(e){return ao="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},ao(e)}function co(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function so(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,uo(r.key),r)}}function lo(e,t,n){return t&&so(e.prototype,t),n&&so(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function uo(e){var t=function(e,t){if("object"!=ao(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ao(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ao(t)?t:t+""}function fo(e,t,n){return t=mo(t),function(e,t){if(t&&("object"==ao(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,po()?Reflect.construct(t,n||[],mo(e).constructor):t.apply(e,n))}function po(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(po=function(){return!!e})()}function ho(){return ho="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}},ho.apply(null,arguments)}function mo(e){return mo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},mo(e)}function vo(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&&yo(e,t)}function yo(e,t){return yo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},yo(e,t)}var go=function(e){function t(e,n){return co(this,t),fo(this,t,[e,n])}return vo(t,e),lo(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,"dispose",n=this,r=ho(mo(1&3?e.prototype:e),"dispose",n),function(e){return r.apply(n,e)})([])}}])}(ae.Z.getComponent("Component")),bo={tagName:"div"};function wo(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bo;if(!e)throw new Error("componentCtor is required");var n=function(n){function r(){return co(this,r),fo(this,r,arguments)}return vo(r,n),lo(r,[{key:"createEl",value:function(){var n=ae.Z.dom.createEl(t.tagName,t.properties,t.attributes),r=(0,Fi.s)(n);return r.render(e(this.player_,this.options_)),this.root=r,n}}])}(go);return n}var Eo=n(42120),So=n(50028);function ko(e){var t,n=!e.parentVideo||(null===(t=e.parentVideo)||void 0===t?void 0:t.status)===So.X.Published,r=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(r?"":" disabled"),disabled:!r,tooltip:r?"":n?"Interactives cannot be published without questions":"Parent video must be published before interactives can be published",onClick:function(){r&&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?i().createElement(_e.Nq,{node:e.portalNode},i().createElement(Eo.e,{actions:o,actionsDropdownClassName:"btn btn-outline-dark ms-2"})):i().createElement(i().Fragment,null)}var xo=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 Oo(e){var t=e.title,n=e.player,r=e.track,o=e.mode,a=e.interactive,c=e.imageApi,s=e.actionsPortalNode,l=e.questionListPortalNode,u=e.summaryPortalNode,f=e.resultsService,p=e.currentUser,h=e.progress,m=e.latestSession,v=e.clipOffset,y=e.analyticsService,g=e.enableImmersiveReader,b=e.mobile,w=e.parentVideo,E=e.hasPlayPageV2,S=function(e){var t=e.player,n=e.track,r=e.interactive,o=e.clipOffset,a=$i(i().useState(!1),2),c=a[0],s=a[1],l=$i(i().useState(!1),2),u=l[0],f=l[1],d=$i(i().useState(null),2),p=d[0],h=d[1];function m(e){return o?e+o:e}function v(e){f(!!e&&c),s(e)}function y(){var e=n.activeCues;if(!e.length)return v(!1),void h(null);var i=r.timepoints.find((function(t){return t.id.toString()===e[0].text.toString()}));if(!i)return v(!1),void h(null);i.shouldPause&&(t.seeking()?t.one("play",(function(){return t.pause()})):t.pause()),v(!0),h(i)}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 i().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:m(r)-.001,endTime:m(r+1),text:e}),n.trigger("cv:cuechange"),t.paused()&&n.trigger("cuechange")},removeCue:function(e){e=m(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=m(i),r.endTime=m(i+1),t.currentTime(i+.5,!0),p.visibleAt=e,n.trigger("cv:cuechange")}},getClipOffset:m}}({player:n,track:r,interactive:a,mode:o,clipOffset:v}),k=S.open,x=S.timepoint,O=S.wasOpen,C=xo(S,["open","timepoint","wasOpen"]),N=function(e){var t=e.interactive,n=e.timepoint,r=e.player,o=e.mode,a=e.resultsService,c=e.latestSession,s=e.analyticsService,l=Yi(e,["interactive","timepoint","player","mode","resultsService","latestSession","analyticsService"]),u=zi({mode:o,timepoint:n,latestSession:c}),f=u.state,p=u.interaction,h=u.interactionState,m=u.timepointState,v=u.nextInteraction,y=u.nextInteractionState,g=Yi(u,["state","interaction","interactionState","timepointState","nextInteraction","nextInteractionState"]),b=o===M.Create;function w(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 E(e){var n=j.w.getTypeInfo(e.typeId);return{id:cn(e.id)?void 0:e.id,typeId:e.typeId,type:n.typeName,interactiveId:t.id,timepointId:cn(e.timepointId)?void 0:e.timepointId,order:e.order}}function S(e){return Ki(this,void 0,void 0,Wi().mark((function n(){var r,i,o,a,c,u,f;return Wi().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=w(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=E(i),cn(i.id)){n.next=10;break}return n.next=7,ur.deleteInteraction(i.id);case 7:null==s||s.logUserAction(a,{actionType:d.Vw.Delete,entity:d.py.Interaction,workflowPhase:d.eu.Complete}),n.next=11;break;case 10:null==s||s.logUserAction(a,{actionType:d.Vw.Create,entity:d.py.Interaction,workflowPhase:d.eu.Discard});case 11:if(c=o.interactions.findIndex((function(e){return e.id===i.id})),o.interactions.splice(c,1),g.clearInteractionState(i.id),u=g.getTimepointState(o.id),c<u.interactionIndex&&g.updateTimepointState(o.id,{interactionIndex:u.interactionIndex-1}),!(o.interactions.length>0)){n.next=18;break}return n.abrupt("return");case 18:if(cn(o.id)){n.next=21;break}return n.next=21,ur.deleteTimepoint(o.id);case 21:f=t.timepoints.findIndex((function(e){return e.id===o.id})),t.timepoints.splice(f,1),l.removeCue(o.visibleAt/1e3),g.clearTimepointState(o.id);case 25:case"end":return n.stop()}}),n)})))}function k(e){if(p){var t=cn(p.id);t||(null==h?void 0:h.hasChanges)||(null==m?void 0:m.hasChanges)?Mi(i().createElement("p",null,"Do you want to discard your changes?"),{title:"Unsaved changes",submitButtonProps:{onClick:function(){(null==m?void 0:m.hasChanges)&&P(!0),t?S(p.id):g.clearInteractionState(p.id),e&&e()},variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}}):e&&e()}else e&&e()}function x(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(b)k((function(){g.updateTimepointState(n.id,{interactionIndex:e})}));else{var r=function(){g.updateTimepointState(n.id,{nextInteractionIndex:e}),window.requestAnimationFrame((function(){g.updateTimepointState(n.id,{nextInteractionIndex:e,slideIn:!0}),window.setTimeout((function(){g.updateTimepointState(n.id,{interactionIndex:e,nextInteractionIndex:null,slideIn:null})}),an)}))};t?k(r):r()}}function O(){m.interactionIndex+1>=n.interactions.length?l.continueInteractive():x(m.interactionIndex+1,!1)}function C(){t.timepoints.sort((function(e,t){return e.visibleAt>t.visibleAt?1:t.visibleAt>e.visibleAt?-1:0}))}function N(){x(n.interactions.length)}function P(e){(null==m?void 0:m.hasChanges)&&(e&&l.moveTimepoint(m.originalVisibleAt),g.updateTimepointState(n.id,{hasChanges:void 0,originalVisibleAt:void 0}),Qi=!1)}return{state:f,interaction:p,interactionState:h,timepointState:m,nextInteraction:v,nextInteractionState:y,skip:O,cancel:function(){return Ki(this,void 0,void 0,Wi().mark((function e(){return Wi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==h?void 0:h.hasChanges)){e.next=3;break}return k(),e.abrupt("return");case 3:return e.next=5,S(p.id);case 5:l.setOpen(!0);case 6:case"end":return e.stop()}}),e)})))},addAnotherQuestion:N,goToTimepoint:function(e,n){var i=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=i.interactions.find((function(e){return e.id.toString()===n.toString()}));r.currentTime(i.visibleAt/1e3),g.updateTimepointState(i.id,{interactionIndex:i.interactions.indexOf(o)})},discardChanges:k,changeIndex:x,promptDelete:function(e){var t=E(w(e).localInteraction);null==s||s.logUserAction(t,{actionType:d.Vw.Delete,entity:d.py.Interaction,workflowPhase:d.eu.Start}),Mi(i().createElement("p",null,"Are you sure you want to delete this question?"),{title:"Delete question",submitButtonProps:{onClick:function(){return S(e)},variant:"danger",text:"Delete question"},cancelButtonProps:{variant:"link",text:"Cancel"}})},showTypeSelector:function(){r.pause(),l.setOpen(!0),n&&N()},cancelTypeSelector:function(){n?x(m.interactionIndex-1):(l.setOpen(!1),r.play())},deleteInteraction:S,saveInteraction:function(){return Ki(this,void 0,void 0,Wi().mark((function e(){var t,r,i,o,a,c,u;return Wi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b){e.next=2;break}throw new Error("Should not be calling onClickSave while viewing an interactive");case 2:if(f=p.typeId,t=Jr[f],!(r=t(g.getInteractionState(p.id),p))){e.next=7;break}return g.updateInteractionState(p.id,{error:r}),e.abrupt("return");case 7:if(g.updateInteractionState(p.id,{spinner:!0}),!cn(n.id)){e.next=15;break}return i=n.id,e.next=12,ur.saveTimepoint(n);case 12:l.updateCue(i,n.id),g.clearTimepointState(i),(null==m?void 0:m.hasChanges)&&(C(),P());case 15:return p.timepointId=n.id,o=p.id,a=ti(p.typeId),e.next=20,a(g.getInteractionState(p.id),p);case 20:g.clearInteractionState(o),c=cn(o),u=E(p),null==s||s.logUserAction(u,{actionType:c?d.Vw.Create:d.Vw.Edit,entity:d.py.Interaction,workflowPhase:c?d.eu.Complete:d.eu.Save});case 24:case"end":return e.stop()}var f}),e)})))},addInteraction:function(e){var i;r.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===(i=null==n?void 0:n.interactions)||void 0===i?void 0:i.length)||0,interactiveId:t.id,data:{}},c=E(a);if(null==s||s.logUserAction(c,{actionType:d.Vw.Create,entity:d.py.Interaction,workflowPhase:d.eu.Start}),n)return n.interactions.push(a),void x(m.interactionIndex);var u=r.currentTime();t.timepoints||(t.timepoints=[]),t.timepoints.push({id:o,visibleAt:1e3*u,interactiveId:t.id,shouldPause:1,interactions:[a]}),C(),l.addCue(o)},submitInteractionAnswer:function(){return Ki(this,void 0,void 0,Wi().mark((function e(){var r,i,c,u,f;return Wi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o===M.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(!(m.interactionIndex>=n.interactions.length)){e.next=6;break}return l.continueInteractive(),e.abrupt("return");case 6:return x(m.interactionIndex+1),e.abrupt("return");case 8:if(r=sn(h),v=p.typeId,i=Wt[v],!(c=i(r,p))){e.next=14;break}return g.updateInteractionState(p.id,{error:c}),e.abrupt("return");case 14:if(!a||!h.hasChanges){e.next=22;break}if(u=Yt(p.typeId),g.updateInteractionState(p.id,{spinner:!0}),!u){e.next=22;break}return e.next=20,u(r,p,a.save);case 20:f=E(p),null==s||s.logUserAction(f,{actionType:d.Vw.Submit,entity:d.py.Interaction});case 22:if(g.updateInteractionState(p.id,{submitted:!0,error:null,hasChanges:!1,spinner:!1}),t.immediateFeedback){e.next=26;break}return O(),e.abrupt("return");case 26:Zt(p.typeId)(p)||O();case 29:case"end":return e.stop()}var v}),e)})))},userUpdateInteractionState:g.userUpdateInteractionState,updateTimepointTime:function(e){var i=r.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>i||o<0)){var a=n.visibleAt;Qi||(Qi=!0,g.updateTimepointState(n.id,{originalVisibleAt:a,hasChanges:!0})),l.moveTimepoint(o)}},saveTimepoint:function(){return Ki(this,void 0,void 0,Wi().mark((function e(){return Wi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!cn(n.id)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,ur.updateTimepoint(n);case 4:C(),P();case 6:case"end":return e.stop()}}),e)})))},clearTimepointTimeState:P,reOrderQuestions:function(e){return Ki(this,void 0,void 0,Wi().mark((function t(){var r,i;return Wi().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,ur.saveInteraction(Object.assign(Object.assign({},e[r]),{order:r}));case 4:r++,t.next=1;break;case 7:i=n.interactions[m.interactionIndex],n.interactions=e,g.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:f,latestSession:m,analyticsService:y},C)),P=N.interaction,I=N.interactionState,T=N.nextInteraction,L=N.nextInteractionState,A=N.timepointState,_=N.state,F=xo(N,["interaction","interactionState","nextInteraction","nextInteractionState","timepointState","state"]);!function(e){var t,n=e.mode,r=e.player,o=e.timepoint,a=e.interaction,c=e.discardChanges,s=e.interactionState,l=e.timepointState,u=oo(),f=n===M.Create;i().useEffect((function(){if(f){if(cn(null==a?void 0:a.id)||(null==s?void 0:s.hasChanges)||(null==l?void 0:l.hasChanges))return u.lock({id:"interactive",title:"Are you sure you want to leave?",text:"Your interactive still has unsaved changes"}),void r.lock((function(e){c(e)}));r.unlock(),u.unlock("interactive")}}),[a,null==s?void 0:s.hasChanges,null===(t=null==o?void 0:o.interactions)||void 0===t?void 0:t.length,null==l?void 0:l.hasChanges])}({mode:o,player:n,timepoint:x,interaction:P,discardChanges:F.discardChanges,interactionState:I,timepointState:A});var D={mode:o,open:k,isCreate:o===M.Create,interaction:P,nextInteraction:T,timepoint:x,interactive:a,interactionState:I,nextInteractionState:L,timepointState:A,player:n};return i().createElement(i().Fragment,null,!!s&&i().createElement(ko,{interactive:a,onClickEditDetails:e.onClickEditDetails,onClickPublish:e.onClickPublish,onClickDelete:e.onClickDelete,onClickCopy:e.onClickCopy,portalNode:s,parentVideo:w}),i().createElement(Te,Object.assign({},D,F)),i().createElement(_i,Object.assign({imageApi:c,currentUser:p,immediateFeedback:a.immediateFeedback,delayFocus:!O,enableImmersiveReader:g},D,F,C)),i().createElement(bn,Object.assign({title:t,currentUser:p,state:_,portalNode:u,progress:h,resultsService:f,imageCdnUrl:c.toString(),onShowSummary:e.onShowSummary,mobile:b},D,F)),i().createElement(kn,Object.assign({portalNode:l,hasPlayPageV2:E},D,F)))}ae.Z.registerComponent("Interactive",wo((function(e,t){return i().createElement(Oo,Object.assign({player:e},t))})));function Co(e){var t=e.player;function n(){var e=t.getChild("ContinueSession");t.removeChild(e),e.dispose()}function r(){e.continue(!0),n()}return i().createElement(Di.G,{title:"Continue interactive?",closePopup:r,dialogClassName:"VVqKz"},i().createElement("p",null,"It looks like you've already started this interactive. Would you like to continue your attempt or start a new one?"),i().createElement(Ri.u,{className:"kw8gW"},i().createElement(Ri.u.Cancel,{text:"Start again",onClick:function(){e.continue(!1),n()}}),i().createElement(Ri.u.Submit,{variant:"dark",text:"Continue",onClick:r})))}function No(e){return No="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},No(e)}function jo(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,Po(r.key),r)}}function Po(e){var t=function(e,t){if("object"!=No(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=No(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==No(t)?t:t+""}function Io(e,t,n){return t=Lo(t),function(e,t){if(t&&("object"==No(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||[],Lo(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 Lo(e){return Lo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Lo(e)}function Ao(e,t){return Ao=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ao(e,t)}ae.Z.registerComponent("ContinueSession",wo((function(e,t){return i().createElement(Co,Object.assign({player:e},t))})));var _o=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Io(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&&Ao(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),"*")}}])&&jo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getPlugin("plugin"));function Fo(e){return Fo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fo(e)}function Do(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,Ro(r.key),r)}}function Ro(e){var t=function(e,t){if("object"!=Fo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Fo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fo(t)?t:t+""}function Mo(e,t,n){return t=Vo(t),function(e,t){if(t&&("object"==Fo(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,Uo()?Reflect.construct(t,n||[],Vo(e).constructor):t.apply(e,n))}function Uo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Uo=function(){return!!e})()}function Vo(e){return Vo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Vo(e)}function Bo(e,t){return Bo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Bo(e,t)}ae.Z.registerPlugin("gradePassbackPlugin",_o);var qo=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=Mo(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&&Bo(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this;this.player.gradePassbackPlugin(),je.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:d.Vw.Click,entity:d.py.Interactive,descriptor:n?d.r.ContinueSession:d.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||M.View,latestSession:this.continueSession&&this.options.latestSession})),this.player.controlBar.getChild("progressControl").getChild("SeekBar").addChild(new Ne(this.player,{interactive:this.options.interactive,track:e}))}}])&&Do(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getPlugin("plugin"));function Go(e){return Go="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},Go(e)}function Zo(){Zo=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Go(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(Go(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}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(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,Wo(r.key),r)}}function Wo(e){var t=function(e,t){if("object"!=Go(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Go(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Go(t)?t:t+""}function Ko(e,t,n){return t=Xo(t),function(e,t){if(t&&("object"==Go(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,Yo()?Reflect.construct(t,n||[],Xo(e).constructor):t.apply(e,n))}function Yo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Yo=function(){return!!e})()}function Qo(e,t,n,r){var i=$o(Xo(1&r?e.prototype:e),t,n);return 2&r?function(e){return i.apply(n,e)}:i}function $o(){return $o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Xo(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}},$o.apply(null,arguments)}function Xo(e){return Xo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Xo(e)}function Jo(e,t){return Jo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Jo(e,t)}ae.Z.registerPlugin("viewInteractivePlugin",qo),n(51976);var ea=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=Ko(this,t,[e,n])).totalProgress=[],$.e.setToken("gateway",r.options.authToken),r.options.mode===M.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&&Jo(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=Qo(t,"getPlayerOptions",this,3)([]);return e.setMaxHeight=!1,this.options.embed||(e.aspectRatio="16:9"),e}},{key:"onFlushProgress",value:function(e){var n;Qo(t,"onFlushProgress",this,3)([e]),this.options.mode!==M.Create&&(n=this.totalProgress).push.apply(n,function(e){return function(e){if(Array.isArray(e))return zo(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 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}}(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 Qo(t,"additionalSetup",a,1)}}});return n=this,r=void 0,i=void 0,o=Zo().mark((function t(){return Zo().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{s(o.next(e))}catch(e){t(e)}}function c(e){try{s(o.throw(e))}catch(e){t(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}s((o=o.apply(n,r||[])).next())}))}},{key:"setupAnalyticsDependentPlugins",value:function(e){Qo(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():Qo(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===M.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:"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,r=null===(t=e.additionalData.clipData)||void 0===t?void 0:t.startTime;this.options.collectResults&&(this.options.currentUser||q.Q.Ry.throw(new ie.H("Must provide a currentUser in order to collect interactive results")),this.options.shareId||q.Q.Ry.throw(new ie.H("Must provide a shareId in order to collect interactive results")),this.resultsService=new re({interactiveId:n.id,metadataId:e.mediaId,userId:this.options.currentUser.id,customerId:this.options.currentUser.customerId,playerApi:this.options.playerApi,shareId:this.options.shareId})),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,hasPlayPageV2:this.options.hasPlayPageV2})}},{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&&Ho(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.r);function ta(e){return new Proxy(e,{get:function(e,t,n){if("off"===t||!e.isDisposed())return Reflect.get(e,t,n)}})}var na=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 ra(e){var t=e.onReady,n=e.className,r=na(e,["onReady","className"]),o=i().useRef();return i().useEffect((function(){var e=new ea(o.current,r);return t&&e.ready((function(){t(ta(e))})),function(){window.requestAnimationFrame((function(){return e.dispose()}))}}),[]),i().createElement(i().Fragment,null,i().createElement("div",{ref:o,className:n}),i().createElement("div",{id:"popup-region"}))}var ia={placeholder:"YUoDl"};function oa(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 aa(){return i().createElement("div",{className:"".concat(ia.placeholder," partial-loading-background")})}function ca(e){var t,n,r,o=(n=i().useState(),r=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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(n,r)||function(e,t){if(e){if("string"==typeof e)return oa(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)?oa(e,t):void 0}}(n,r)||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 i().useEffect((function(){e.createViewKey(null,(function(e){c(e.get("viewKey"))}))}),[e.video.id]),a?i().createElement("div",{className:"col-12 mb-3 p-0"},i().createElement(ra,{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})):i().createElement(aa,null)}var sa=n(82602),la={avatarContainer:"hwnEk",comment:"LyFKD"},ua="libraryRequests.comments",fa=Je.T.encloseNamespace(ua);function da(e){var t,n,r,o,a,c,s=e.comment,l="".concat(null===(t=s.user)||void 0===t?void 0:t.name," ").concat(null===(n=s.user)||void 0===n?void 0:n.surname);return s.user||(l=fa("deletedUser")),i().createElement("div",{className:"d-flex ".concat(la.comment)},i().createElement("div",{className:"".concat(la.avatarContainer," me-2 flex-shrink-0")},i().createElement(Me.q,{imageUrl:null===(o=null===(r=s.user)||void 0===r?void 0:r.avatar)||void 0===o?void 0:o.url,imageCdnUrl:e.imageCdnUrl,initials:Xe.l.getInitials(null===(a=s.user)||void 0===a?void 0:a.name,null===(c=s.user)||void 0===c?void 0:c.surname)})),i().createElement("div",null,i().createElement("span",{className:"fw-bold pe-2"},l),i().createElement("span",{className:"text-secondary"},(0,sa.WU)(s.dateCreated)),i().createElement("p",{className:"mb-0"},s.message)))}function pa(e){var t;return(null===(t=e.comments)||void 0===t?void 0:t.length)?i().createElement("div",{className:"pb-3 border-bottom mb-3"},i().createElement("h2",{className:"h5"},i().createElement(o.x,{namespace:ua,phrase:"comments"})),i().createElement("div",{className:"border rounded p-2"},e.comments.map((function(t,n){return i().createElement(da,{key:n,comment:t,imageCdnUrl:e.imageCdnUrl})})))):i().createElement(i().Fragment,null)}var ha=n(56285),ma=n(41087),va=n(98496),ya=n(50997),ga=n(89707),ba={seriesLink:"Z5BW7"};function wa(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)?i().createElement("p",{className:"mb-0"},e.items.data.map((function(e,t){return i().createElement("span",{key:t},e.name)}))):null}function Ea(e){var t,n,r,o,a,c,s,l,u,f,d,p,h,m,v=e.libraryRequest.object;return i().createElement("div",{className:"row"},((null==v?void 0:v.name)||e.libraryRequest.name)&&i().createElement(g,{phrase:"title"},(null==v?void 0:v.name)||e.libraryRequest.name),!!v&&i().createElement(i().Fragment,null,!!v.series&&i().createElement(g,{phrase:"series"},i().createElement("a",{target:"_blank",href:(p=v.series,h=e.config,m="series/".concat(p.id),ga.k.getMainProductUrl(h,m,m)),className:"".concat(ba.seriesLink," text-reset")},v.series.name,i().createElement(va.Q,{video:v,withSeriesTitle:!0}))),!!(null===(t=v.rating)||void 0===t?void 0:t.code)&&i().createElement(g,{phrase:"rating"},i().createElement("div",{className:"d-flex"},i().createElement(ma.C,{type:ma.g.Rating,data:v.rating}))),!!v.description&&i().createElement(g,{phrase:"description"},i().createElement("span",{className:"pre-wrap"},v.description)),!!v.productionYear&&i().createElement(g,{phrase:"productionYear"},v.productionYear),!!(null===(r=null===(n=v.producers)||void 0===n?void 0:n.data)||void 0===r?void 0:r.length)&&i().createElement(g,{phrase:"producers"},i().createElement(wa,{items:v.producers})),!!(null===(a=null===(o=v.directors)||void 0===o?void 0:o.data)||void 0===a?void 0:a.length)&&i().createElement(g,{phrase:"directors"},i().createElement(wa,{items:v.directors})),!!(null===(s=null===(c=v.productionCompanies)||void 0===c?void 0:c.data)||void 0===s?void 0:s.length)&&i().createElement(g,{phrase:"productionCompanies"},i().createElement(wa,{items:v.productionCompanies})),!!(null===(u=null===(l=v.distributors)||void 0===l?void 0:l.data)||void 0===u?void 0:u.length)&&i().createElement(g,{phrase:"distributors"},i().createElement(wa,{items:v.distributors})),!e.hideBroadcastInfo&&!!(null===(f=v.channel)||void 0===f?void 0:f.name)&&i().createElement(g,{phrase:"channel"},null===(d=v.channel)||void 0===d?void 0:d.name),!e.hideBroadcastInfo&&!!v.dateBroadcast&&i().createElement(g,{phrase:"broadcastDate"},ha.O.format(v.dateBroadcast,ya.K4.FULL_YEAR))))}var Sa,ka,xa=n(17111),Oa=n(33937);function Ca(e){return Ca="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ca(e)}function Na(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,ja(r.key),r)}}function ja(e){var t=function(e,t){if("object"!=Ca(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ca(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ca(t)?t:t+""}!function(e){e.AppleTv="apple-tv",e.Vivi="vivi"}(Sa||(Sa={})),function(e){e.Available="available",e.Offline="offline",e.Busy="busy"}(ka||(ka={}));var Pa=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)}}])&&Na(t.prototype,n),r&&Na(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function Ia(e){return Ia="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},Ia(e)}function Ta(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function La(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_a(r.key),r)}}function Aa(e,t,n){return t&&La(e.prototype,t),n&&La(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _a(e){var t=function(e,t){if("object"!=Ia(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ia(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ia(t)?t:t+""}Symbol.toStringTag;var Fa=function(){return Aa((function e(){Ta(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()?Pa.reject(new Error("This EventChannel instance has been disposed")):new Pa(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}}])}(),Da=function(){return Aa((function e(){Ta(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",Ra.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 Fa),this.channels[e]}}])}(),Ra={void:void 0};function Ma(e){return Ma="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},Ma(e)}function Ua(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,Va(r.key),r)}}function Va(e){var t=function(e,t){if("object"!=Ma(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ma(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ma(t)?t:t+""}var Ba,qa,Ga,Za=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}}])&&Ua(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),za=n(90244),Ha=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)}})},Wa=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 Ka(e){return Ka="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},Ka(e)}function Ya(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 Qa(e,t,n){return t&&Ya(e.prototype,t),n&&Ya(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function $a(e){var t=function(e,t){if("object"!=Ka(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ka(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ka(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"}(Ba||(Ba={})),function(e){e[e.PlaybackStatusChange=0]="PlaybackStatusChange",e[e.PositionChange=1]="PositionChange"}(qa||(qa={})),function(e){e.Begin="BEGIN",e.Play="PLAY",e.Pause="PAUSE",e.Load="LOAD",e.Scan="SCAN",e.Stop="STOP"}(Ga||(Ga={}));var Xa=Qa((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=Ga.Load,this.debounced=Ha(this,2e3),Wa(this)}));function Ja(e){return Ja="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},Ja(e)}function ec(){ec=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Ja(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(Ja(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function tc(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,nc(r.key),r)}}function nc(e){var t=function(e,t){if("object"!=Ja(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ja(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ja(t)?t:t+""}function rc(e,t,n){return t=ac(t),function(e,t){if(t&&("object"==Ja(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,ic()?Reflect.construct(t,n||[],ac(e).constructor):t.apply(e,n))}function ic(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ic=function(){return!!e})()}function oc(){return oc="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}},oc.apply(null,arguments)}function ac(e){return ac=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ac(e)}function cc(e,t){return cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},cc(e,t)}var sc=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=rc(this,t)).client=e,r.localState=new Xa(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&&cc(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,"dispose",n=this,r=oc(ac(1&3?e.prototype:e),"dispose",n),function(e){return r.apply(n,e)})([])}},{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 qa.PlaybackStatusChange:this.handlePlaybackChange(t,e);break;case qa.PositionChange:this.handlePositionChange(t,e)}}}},{key:"handlePlaybackChange",value:function(e,t){e.playbackStatus!==t.params.playbackStatus&&(e.playbackStatus=t.params.playbackStatus,this.trigger("playingchange",Ra.void),e.playbackStatus===Ga.Stop&&this.dispose())}},{key:"handlePositionChange",value:function(e,t){e.position!==t.params.position&&(e.position=t.params.position,this.trigger("positionchange",Ra.void))}},{key:"loadSource",value:function(){return e=this,t=void 0,n=void 0,r=ec().mark((function e(){return ec().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",Ra.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{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}));var e,t,n,r}},{key:"play",value:function(){this.localState.locked&&this.localState.playbackStatus!==Ga.Play&&(this.localState.playbackStatus=Ga.Play,this.client.play(this.getDevice().id),this.trigger("playingchange",Ra.void))}},{key:"pause",value:function(){this.localState.locked&&this.localState.playbackStatus!==Ga.Pause&&(this.localState.playbackStatus=Ga.Pause,this.client.pause(this.getDevice().id),this.trigger("playingchange",Ra.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",Ra.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===Ga.Play||this.localState.playbackStatus===Ga.Begin||this.localState.playbackStatus===Ga.Load}},{key:"isPlaybackFinished",value:function(){return this.localState.playbackStatus===Ga.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&&tc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Da);function lc(e){return lc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lc(e)}function uc(){uc=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==lc(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(lc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function fc(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,dc(r.key),r)}}function dc(e){var t=function(e,t){if("object"!=lc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=lc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==lc(t)?t:t+""}function pc(e,t,n){return t=vc(t),function(e,t){if(t&&("object"==lc(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,hc()?Reflect.construct(t,n||[],vc(e).constructor):t.apply(e,n))}function hc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(hc=function(){return!!e})()}function mc(){return mc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=vc(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}},mc.apply(null,arguments)}function vc(e){return vc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vc(e)}function yc(e,t){return yc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},yc(e,t)}var gc,bc,wc,Ec=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((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"}(gc||(gc={})),function(e){e.Command="Command",e.Pair="Pair",e.Unpair="Unpair",e.RenameDevice="Renamedevice",e.Subscribe="Subscribe",e.Lock="Lock"}(bc||(bc={})),function(e){e[e.Connecting=0]="Connecting",e[e.Connected=1]="Connected",e[e.Reconnecting=2]="Reconnecting",e[e.Disconnected=4]="Disconnected"}(wc||(wc={}));var Sc=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=pc(this,t)).options=e,n.accessToken=void 0,n.devices=[],n.heartbeat=new Za,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&&yc(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,za.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 Ec(this,void 0,void 0,uc().mark((function e(){return uc().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,Oa.OB)(this.accessToken.host,{logging:!1}),this.hubProxy=this.connection.createHubProxy("DeviceUserHub"),this.hubProxy.on(gc.DeviceList,this.handleDeviceList),this.hubProxy.on(gc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.on(gc.Paired,this.handleDevicePaired),this.hubProxy.on(gc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.on(gc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.on(gc.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 Ec(this,void 0,void 0,uc().mark((function e(){var t=this;return uc().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 Ec(this,void 0,void 0,uc().mark((function t(){return uc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(bc.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 Ec(this,void 0,void 0,uc().mark((function e(){return uc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection.state===wc.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 Ec(this,void 0,void 0,uc().mark((function t(){var r,i=this;return uc().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",Pa.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",Ra.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",Ra.void))}},{key:"handleDevicePaired",value:function(e){"vivi"!==e.type&&(this.devices.push(t.convertToGenericDevice(e)),this.trigger("deviceschange",Ra.void))}},{key:"handleDeviceUnpaired",value:function(e){this.devices=this.devices.filter((function(t){return t.id!==e})),this.trigger("deviceschange",Ra.void)}},{key:"handlePlayStatusChange",value:function(e,t){this.trigger("message",{event:qa.PlaybackStatusChange,deviceId:e,params:{playbackStatus:t.commandType}})}},{key:"handleTimeSync",value:function(e,t){this.trigger("message",{event:qa.PositionChange,deviceId:e,params:{position:t}})}},{key:"dispose",value:function(){var e,n,r;this.hubProxy.off(gc.DeviceList,this.handleDeviceList),this.hubProxy.off(gc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.off(gc.Paired,this.handleDevicePaired),this.hubProxy.off(gc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.off(gc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.off(gc.TimeSync,this.handleTimeSync),this.hubProxy.connection.stop(!1,!0),this.heartbeat.stop(),(e=t,"dispose",n=this,r=mc(vc(1&3?e.prototype:e),"dispose",n),function(e){return r.apply(n,e)})([])}},{key:"canCastToDevice",value:function(e){return e===Sa.AppleTv}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new sc(this,e)}},{key:"lock",value:function(e){var t;return Ec(this,void 0,void 0,uc().mark((function n(){return uc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.invoke(bc.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 Ec(this,void 0,void 0,uc().mark((function t(){return uc().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(bc.Command,{DeviceId:e,CommandType:Ga.Play,Data:this.options.trackingCode});case 4:case"end":return t.stop()}}),t,this)})))}},{key:"play",value:function(e){return Ec(this,void 0,void 0,uc().mark((function t(){return uc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(bc.Command,{DeviceId:e,CommandType:Ga.Play});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return Ec(this,void 0,void 0,uc().mark((function t(){return uc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(bc.Command,{DeviceId:e,CommandType:Ga.Pause});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"seek",value:function(e,t){this.invokeDebounced(bc.Command,{DeviceId:e,CommandType:Ga.Play,Params:"1,".concat(Math.trunc(t))})}},{key:"stop",value:function(e){return Ec(this,void 0,void 0,uc().mark((function t(){return uc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(bc.Command,{DeviceId:e,CommandType:Ga.Stop});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pair",value:function(e){return Ec(this,void 0,void 0,uc().mark((function t(){var n;return uc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(bc.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 Ec(this,void 0,void 0,uc().mark((function t(){return uc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(bc.Unpair,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"renameDevice",value:function(e){var t=e.deviceId,n=e.deviceName;return Ec(this,void 0,void 0,uc().mark((function e(){return uc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke(bc.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 Ba.Online:return ka.Available;case Ba.Locked:return ka.Busy;case Ba.Suspended:case Ba.Offline:return ka.Offline}}},{key:"convertToGenericDevice",value:function(e){return{id:e.deviceId,name:e.name,type:Sa.AppleTv,status:t.convertToGenericDeviceStatus(e.status)}}}],r&&fc(n.prototype,r),i&&fc(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Da);function kc(e){return kc="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},kc(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,Oc(r.key),r)}}function Oc(e){var t=function(e,t){if("object"!=kc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=kc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==kc(t)?t:t+""}var Cc={reconnectIntervalInMilliseconds:3e3,heartbeatEnabled:!1,heartbeatIntervalInMillseconds:1e4,heartbeatMessage:""},Nc=function(){return e=function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Cc;!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({},Cc),r),this.webSocket=this.connect(),this.heartbeat=(new Za).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()}}])&&xc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),jc=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 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,Tc(r.key),r)}}function Tc(e){var t=function(e,t){if("object"!=Pc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Pc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pc(t)?t:t+""}var Lc,Ac=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=Ha(this,2e3),Wa(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}}])&&Ic(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();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 Fc(){Fc=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==_c(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(_c(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Dc(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,Rc(r.key),r)}}function Rc(e){var t=function(e,t){if("object"!=_c(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=_c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_c(t)?t:t+""}function Mc(e,t,n){return t=Bc(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,Uc()?Reflect.construct(t,n||[],Bc(e).constructor):t.apply(e,n))}function Uc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Uc=function(){return!!e})()}function Vc(){return Vc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Bc(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}},Vc.apply(null,arguments)}function Bc(e){return Bc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Bc(e)}function qc(e,t){return qc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},qc(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"}(Lc||(Lc={}));var Gc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},Zc=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=Mc(this,t)).client=e,r.localState=new Ac(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&&qc(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,"dispose",n=this,r=Vc(Bc(1&3?e.prototype:e),"dispose",n),function(e){return r.apply(n,e)})([])}},{key:"handleClientConnected",value:function(){return Gc(this,void 0,void 0,Fc().mark((function e(){return Fc().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 Lc.Update:this.handleUpdateMessage(t,n);break;case Lc.NewChapter:this.handleNewChapterMessage(t,n);break;case Lc.Volume:this.handleVolumeMessage(t,n);break;case Lc.Playing:this.handlePlayingMessage(t);break;case Lc.Paused:this.handlePausedMessage(t);break;case Lc.Finished:this.handleFinishedMessage(t);break;case Lc.Stopped:this.handleStoppedMessage()}}},{key:"handleUpdateMessage",value:function(e,t){e.duration!==t.duration&&(e.duration=t.duration,this.trigger("durationchange",Ra.void)),e.position!==t.position&&(e.position=t.position,this.trigger("positionchange",Ra.void)),e.subtitles!==t.subtitles&&(e.subtitles=t.subtitles,this.trigger("subtitleschange",Ra.void))}},{key:"handleVolumeMessage",value:function(e,t){e.volume!==t.level&&(e.volume=t.level,e.mute=0===t.level,this.trigger("volumechange",Ra.void))}},{key:"handlePlayingMessage",value:function(e){!0!==e.playing&&(e.playing=!0,e.playbackFinished=!1,this.trigger("playingchange",Ra.void))}},{key:"handlePausedMessage",value:function(e){!1!==e.playing&&(e.playing=!1,this.trigger("playingchange",Ra.void))}},{key:"handleFinishedMessage",value:function(e){!0!==e.playbackFinished&&(e.playing=!1,e.playbackFinished=!0,this.trigger("playingchange",Ra.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",Ra.void))}},{key:"handleStoppedMessage",value:function(){this.dispose()}},{key:"loadSource",value:function(e,t){return Gc(this,void 0,void 0,Fc().mark((function n(){var r,i;return Fc().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",Ra.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",Ra.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",Ra.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",Ra.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",Ra.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",Ra.void))}},{key:"setSubtitles",value:function(e){return Gc(this,void 0,void 0,Fc().mark((function t(){var n;return Fc().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",Ra.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&&Dc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Da);function zc(e){return zc="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},zc(e)}function Hc(){Hc=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",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=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",h="executing",m="completed",v={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));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){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==zc(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){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.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===h)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=N(c,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:p,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.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 T(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(zc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"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,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(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),l(k,s,"Generator"),l(k,a,(function(){return this})),l(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=T,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 s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)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:T(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,Kc(r.key),r)}}function Kc(e){var t=function(e,t){if("object"!=zc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=zc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==zc(t)?t:t+""}function Yc(e,t,n){return t=Xc(t),function(e,t){if(t&&("object"==zc(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,Qc()?Reflect.construct(t,n||[],Xc(e).constructor):t.apply(e,n))}function Qc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Qc=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=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}},$c.apply(null,arguments)}function Xc(e){return Xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Xc(e)}function Jc(e,t){return Jc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Jc(e,t)}var es=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},ts=1e4,ns=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=Yc(this,t)).options=e,n.accessToken="",n.devices=[],n.devicesFingerprint="",n.deviceDiscovery=new Za,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&&Jc(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,za.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 Nc(this.options.url),this.webSocket.onMessage=function(t){return e.trigger("message",JSON.parse(t.data))},this.webSocket.onOpen=function(){return es(e,void 0,void 0,Hc().mark((function e(){return Hc().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",Ra.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 es(e,void 0,void 0,Hc().mark((function e(){var n,r;return Hc().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:this.devices=n.map((function(e){return{id:e.id,name:e.name,type:Sa.Vivi,status:ka.Available}})),this.devicesFingerprint=r,this.trigger("deviceschange",Ra.void),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),console.warn(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})))})).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,"dispose",r=this,i=$c(Xc(1&3?n.prototype:n),"dispose",r),function(e){return i.apply(r,e)})([])}},{key:"canCastToDevice",value:function(e){return e===Sa.Vivi}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new Zc(this,e)}},{key:"authenticateWithVivi",value:function(){return es(this,void 0,void 0,Hc().mark((function e(){return Hc().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(ts).catch((function(){throw new Error("Failed to authenticate with Vivi")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getRoomList",value:function(){return es(this,void 0,void 0,Hc().mark((function e(){var t;return Hc().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(ts).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 es(this,void 0,void 0,Hc().mark((function t(){return Hc().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(ts).catch((function(){throw new Error("Failed to join room")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"query",value:function(e){return es(this,void 0,void 0,Hc().mark((function n(){var r;return Hc().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(ts).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 es(this,void 0,void 0,Hc().mark((function e(){return Hc().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(ts).catch((function(){throw new Error("Failed to load media")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"play",value:function(e){return es(this,void 0,void 0,Hc().mark((function t(){return Hc().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(ts).catch((function(){throw new Error("Failed to play video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return es(this,void 0,void 0,Hc().mark((function t(){return Hc().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(ts).catch((function(){throw new Error("Failed to pause video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"stop",value:function(e){return es(this,void 0,void 0,Hc().mark((function t(){return Hc().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(ts).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 es(this,void 0,void 0,Hc().mark((function n(){return Hc().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(ts).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 es(this,void 0,void 0,Hc().mark((function n(){return Hc().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(ts).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 es(this,void 0,void 0,Hc().mark((function n(){return Hc().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(ts).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 es(this,void 0,void 0,Hc().mark((function r(){var i;return Hc().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(ts).catch((function(){throw new Error("Failed to set subtitles")}));case 4:case"end":return r.stop()}}),r,this)})))}}],i=[{key:"createAckId",value:function(){return jc.x.generateRandomId()}},{key:"calculateFingerprint",value:function(e){return e.map((function(e){return e.id})).sort().join(",")}}],r&&Wc(n.prototype,r),i&&Wc(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Da);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){return function(e){if(Array.isArray(e))return os(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 os(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)?os(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 os(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 as(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,cs(r.key),r)}}function cs(e){var t=function(e,t){if("object"!=rs(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=rs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rs(t)?t:t+""}function ss(e,t,n){return t=fs(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,ls()?Reflect.construct(t,n||[],fs(e).constructor):t.apply(e,n))}function ls(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ls=function(){return!!e})()}function us(){return us="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=fs(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}},us.apply(null,arguments)}function fs(e){return fs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},fs(e)}function ds(e,t){return ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ds(e,t)}var ps=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=ss(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&&ds(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(is(e),is(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,"dispose",r=this,i=us(fs(1&3?n.prototype:n),"dispose",r),function(e){return i.apply(r,e)})([])}}],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&&as(n.prototype,r),i&&as(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Da);ps.instances={};var hs=n(12424),ms=n(4579);function vs(e){return vs="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},vs(e)}function ys(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,gs(r.key),r)}}function gs(e){var t=function(e,t){if("object"!=vs(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=vs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vs(t)?t:t+""}function bs(e,t,n){return t=ks(t),function(e,t){if(t&&("object"==vs(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,ws()?Reflect.construct(t,n||[],ks(e).constructor):t.apply(e,n))}function ws(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ws=function(){return!!e})()}function Es(e,t,n,r){var i=Ss(ks(1&r?e.prototype:e),t,n);return 2&r?function(e){return i.apply(n,e)}:i}function Ss(){return Ss="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ks(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}},Ss.apply(null,arguments)}function ks(e){return ks=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ks(e)}function xs(e,t){return xs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xs(e,t)}var Os=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=bs(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&&xs(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){return Es(t,"createEl",this,3)(["li",{className:"vjs-menu-item cv-device-menu-item",innerHTML:'\n <span class="cv-device-icon '.concat({vivi:"cv-vivi-icon","apple-tv":"cv-apple-icon"}[this.options_.type],'"></span>\n <span class="vjs-menu-item-text">').concat(this.options_.label,"</span>\n ")}])}},{key:"handleClick",value:function(){this.options_.onClick()}},{key:"show",value:function(){Es(t,"show",this,3)([])}},{key:"hide",value:function(){Es(t,"hide",this,3)([])}},{key:"isVisible",value:function(){return!Es(t,"hasClass",this,3)(["vjs-hidden"])}}])&&ys(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("MenuItem")),Cs=n(86777);function Ns(e){return Ns="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},Ns(e)}function js(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ps(r.key),r)}}function Ps(e){var t=function(e,t){if("object"!=Ns(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ns(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ns(t)?t:t+""}function Is(e,t,n){return t=Ls(t),function(e,t){if(t&&("object"==Ns(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,Ts()?Reflect.construct(t,n||[],Ls(e).constructor):t.apply(e,n))}function Ts(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ts=function(){return!!e})()}function Ls(e){return Ls=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ls(e)}function As(e,t){return As=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},As(e,t)}var _s=ae.Z.getComponent("Menu"),Fs=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Is(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&&As(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){var e=_s.originalProto.createEl.apply(this),t=this.contentEl_;return this.contentWrapper=ae.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 Cs.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"))}}])&&js(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_s);function Ds(e){var t=e.inactiveIntegrations,n=e.canUserManageIntegrations,i=e.player,o=e.onDismiss,a=e.onInstall,c=e.onLearnMore,s=e.onContactSupport;if(0===t.length)return r.createElement(r.Fragment,null);var l,u=function(e){return i.localize(e)},f=function(e){return-1!==t.indexOf(e)};return l=f(Sa.AppleTv)&&f(Sa.Vivi)?"vivi_and_apple_tv":f(Sa.Vivi)?"vivi":"apple_tv",r.createElement("div",{className:"cv-devices-cta",tabIndex:-1},r.createElement(Rs,{context:l,localize:u,onDismiss:function(){return o(l)}}),r.createElement(Ms,{context:l}),r.createElement(Us,{context:l,canUserManageIntegrations:n,localize:u,onContactSupport:function(){return s(l)},onInstall:function(){return a(l)},onLearnMore:function(){return c(l)}}))}function Rs(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 Ms(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 Us(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 Vs(e){return Vs="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},Vs(e)}function Bs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,qs(r.key),r)}}function qs(e){var t=function(e,t){if("object"!=Vs(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Vs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Vs(t)?t:t+""}function Gs(e,t,n){return t=Ws(t),function(e,t){if(t&&("object"==Vs(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,Zs()?Reflect.construct(t,n||[],Ws(e).constructor):t.apply(e,n))}function Zs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Zs=function(){return!!e})()}function zs(e,t,n,r){var i=Hs(Ws(1&r?e.prototype:e),t,n);return 2&r?function(e){return i.apply(n,e)}:i}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=Ws(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 Ws(e){return Ws=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ws(e)}function Ks(e,t){return Ks=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ks(e,t)}ae.Z.registerComponent("DevicesMenu",Fs),ae.Z.registerComponent("DevicesCta",wo((function(e,t){return r.createElement(Ds,Object.assign({player:e},t))}),{properties:{className:"cv-devices-cta-wrapper"}}));var Ys=ae.Z.getComponent("DevicesCta"),Qs=ae.Z.getComponent("MenuButton"),$s=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=Gs(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&&Ks(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=Qs.prototype.createEl).apply.apply(e,[this].concat(n))}},{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-devices-button ".concat(zs(t,"buildWrapperCSSClass",this,3)([]))}},{key:"createMenu",value:function(){var e=this,t=new Fs(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 Ys(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 hs.Z(this.player_,{label:this.localize("Select a device"),selectable:!1}),this.searchInputItem=new ms.Z(this.player_,{menuButton:this,search:function(t){return e.setSearchText(t)},className:"cv-devices-search-input"}),this.emptyPlaceholder=new ms.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;zs(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 Os}))}},{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){return"".concat(e.type,"-").concat(e.name).localeCompare("".concat(t.type,"-").concat(t.name))})).forEach((function(e){var n=new Os(t.player(),{id:e.id,label:e.name,selected:!1,multiSelectable:!1,selectable:!0,available:e.status===ka.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=e.devices.find((function(e){return e.id===t.options_.id}));if(o){var a=o.status===ka.Available,c=!n||-1!==o.name.toLowerCase().indexOf(r),s=o.id===(null===(i=e.castSession)||void 0===i?void 0:i.getDevice().id);a?t.enable():t.disable(),c?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(){zs(t,"handleClick",this,3)([null]),this.options_.onClick()}}],r&&Bs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Qs);function Xs(e){return Xs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xs(e)}function Js(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,el(r.key),r)}}function el(e){var t=function(e,t){if("object"!=Xs(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Xs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xs(t)?t:t+""}function tl(e,t,n){return t=il(t),function(e,t){if(t&&("object"==Xs(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,nl()?Reflect.construct(t,n||[],il(e).constructor):t.apply(e,n))}function nl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(nl=function(){return!!e})()}function rl(){return rl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=il(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}},rl.apply(null,arguments)}function il(e){return il=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},il(e)}function ol(e,t){return ol=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ol(e,t)}$s.prototype.controlText_="Devices",ae.Z.registerComponent("DevicesButton",$s);var al=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),tl(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&&ol(e,t)}(t,e),n=t,r=[{key:"createEl",value:function(){return(e=t,"createEl",n=this,r=rl(il(1&3?e.prototype:e),"createEl",n),function(e){return r.apply(n,e)})(["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:Sa.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&&Js(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("Component"));function cl(e){return cl="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},cl(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,ll(r.key),r)}}function ll(e){var t=function(e,t){if("object"!=cl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=cl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==cl(t)?t:t+""}function ul(e,t,n){return t=hl(t),function(e,t){if(t&&("object"==cl(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||[],hl(e).constructor):t.apply(e,n))}function fl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(fl=function(){return!!e})()}function dl(e,t,n,r){var i=pl(hl(1&r?e.prototype:e),t,n);return 2&r?function(e){return i.apply(n,e)}:i}function pl(){return pl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=hl(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}},pl.apply(null,arguments)}function hl(e){return hl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},hl(e)}function ml(e,t){return ml=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ml(e,t)}var vl=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=ul(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,ae.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&&ml(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 je.O.findTrackByPredicate(this.videojsPlayer.player_,(function(e){return"showing"===e.mode&&!!e.src}))}},{key:"setSelectedTextTrack",value:function(e){je.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(),dl(t,"cleanupAutoTextTracks",this,3)([]),dl(t,"dispose",this,3)([])}},{key:"createEl",value:function(){var e=this;return this.ui=this.ui||new al({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 dl(t,"addRemoteTextTrack",this,3)([e,!0])}},{key:"getCastSession",value:function(){var e;return ps.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 ae.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!!ps.getOrCreateInstance(null!==(n=null==t?void 0:t.instanceId)&&void 0!==n?n:"").getCastSession()}},{key:"isSupported",value:function(){return ps.isActive()}}],r&&sl(n.prototype,r),i&&sl(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(ae.Z.getComponent("Tech"));function yl(e){return yl="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},yl(e)}function gl(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,bl(r.key),r)}}function bl(e){var t=function(e,t){if("object"!=yl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=yl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yl(t)?t:t+""}function wl(e,t,n){return t=kl(t),function(e,t){if(t&&("object"==yl(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||[],kl(e).constructor):t.apply(e,n))}function El(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(El=function(){return!!e})()}function Sl(){return Sl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=kl(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}},Sl.apply(null,arguments)}function kl(e){return kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},kl(e)}function xl(e,t){return xl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xl(e,t)}ae.Z.registerTech("devices",vl);var Ol=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=wl(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&&xl(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,s=[];this.options.appleTv.enabled||s.push(Sa.AppleTv),c.enabled&&c.accountConnected||s.push(Sa.Vivi);var l={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:d.Vw.Select,workflowPhase:d.eu.Complete,descriptor:d.UX.ChangeDevice,entity:d.py.Device,eventVersion:d.eq.V3})},ctaOptions:Object.assign(Object.assign({},a),{inactiveIntegrations:s})};this.devicesButton=t.addChild("DevicesButton",l,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(Sa.AppleTv)),this.player.removeClass("cv-device-".concat(Sa.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(ns)){var t=new ns({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(Sc)){var t=new Sc({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 ps.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),ps.disposeAndRemoveInstance(i),(e=t,"dispose",n=this,r=Sl(kl(1&3?e.prototype:e),"dispose",n),function(e){return r.apply(n,e)})([]))}}],r&&gl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getPlugin("plugin"));function Cl(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 Nl(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(n,i)||function(e,t){if(e){if("string"==typeof e)return Cl(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)?Cl(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],s=a[1];function l(){var t=e.player.duration()-e.player.currentTime();s(t),t>o.current&&(o.current=t)}if(r.useEffect((function(){return e.player.on("timeupdate",l),function(){e.player.off("timeupdate",l)}}),[]),!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 jl(e){return jl="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},jl(e)}function Pl(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,Il(r.key),r)}}function Il(e){var t=function(e,t){if("object"!=jl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=jl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jl(t)?t:t+""}function Tl(e,t,n){return t=_l(t),function(e,t){if(t&&("object"==jl(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,Ll()?Reflect.construct(t,n||[],_l(e).constructor):t.apply(e,n))}function Ll(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ll=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=_l(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 _l(e){return _l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_l(e)}function Fl(e,t){return Fl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fl(e,t)}ae.Z.registerPlugin("devicesPlugin",Ol),ae.Z.registerComponent("UpNext",wo((function(e,t){return r.createElement(Nl,Object.assign({player:e},t))})));var Dl=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=Tl(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&&Fl(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,ae.Z.dom.addClass(this.toggleEl,"on"),this.player_.nextVideoPlugin().setShouldPlayNext(this.playNext,!0)}},{key:"toggleOff",value:function(){this.playNext=!1,ae.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=ae.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,"createEl",o=this,a=Al(_l(1&3?i.prototype:i),"createEl",o),function(e){return a.apply(o,e)})([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&&Pl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("MenuItem"));function Rl(e){return Rl="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},Rl(e)}function Ml(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,t){if("object"!=Rl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Rl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Rl(t)?t:t+""}function Vl(e,t,n){return t=Gl(t),function(e,t){if(t&&("object"==Rl(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||[],Gl(e).constructor):t.apply(e,n))}function Bl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Bl=function(){return!!e})()}function ql(){return ql="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Gl(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}},ql.apply(null,arguments)}function Gl(e){return Gl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Gl(e)}function Zl(e,t){return Zl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Zl(e,t)}ae.Z.registerComponent("NextVideoMenuItem",Dl);var zl="cv-persisttest",Hl="cv-play-next-video",Wl=ae.Z.getPlugin("plugin"),Kl=(ae.Z.getComponent("MenuItem"),ae.Z.getComponent("NextVideoMenuItem")),Yl=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=Vl(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(Hl);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&&Zl(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){this.player.isDisposed()||this.bindListeners()}},{key:"getChapterTrack",value:function(){return je.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:Kl,name:"NextVideoMenuItem"})}},{key:"getShouldPlayNext",value:function(){return this.shouldPlayNextVideo}},{key:"setShouldPlayNext",value:function(e,t){this.shouldPlayNextVideo=e,this.hasLocalStorage&&t&&window.localStorage.setItem(Hl,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,"dispose",n=this,r=ql(Gl(1&3?e.prototype:e),"dispose",n),function(e){return r.apply(n,e)})([])}},{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(zl,"persistPlayNext"),window.localStorage.removeItem(zl),!0}catch(e){return!1}}}],r&&Ml(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Wl);ae.Z.registerPlugin("nextVideoPlugin",Yl);var Ql=n(52765),$l=n(75390),Xl=n(86257),Jl=n(87013),eu=n(38e3),tu={imageStyle:"FFgf3",imageTypeResource:"z4O5p",fallBackImage:"Xy4zX"},nu={width:200,resizeType:Re.Nq.Cover};function ru(e){var t;return eu.G.isResource(e)?e.metadata.type===Xl.L.Pdf||(null===(t=e.pdf)||void 0===t?void 0:t.url)?Re.__.Pdf:Re.__.Thumbnails:Re.__.Link}function iu(e){var t,n,r,o=null,a=0;eu.G.isResource(e.resource)&&(o=e.resource.metadata,a=null!==(r=null===(n=null===(t=e.resource.thumbnail)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.rotation)&&void 0!==r?r:0);var c=function(e,t){var n,r,i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nu,a=ru(t);if("thumbnail"in t&&(null===(n=t.thumbnail)||void 0===n?void 0:n.url))return Jl.j.createUrl(null===(r=t.thumbnail)||void 0===r?void 0:r.url,Object.assign({},o));var c=$l._.safeUrlConcat(e,"/v1/previews");return eu.G.isResource(t)?a===Re.__.Pdf?t.metadata.type===Xl.L.Pdf?Jl.j.createResourceImage(c,t.url,Object.assign({},o)):Jl.j.createResourceImage(c,null===(i=t.pdf)||void 0===i?void 0:i.url,Object.assign({},o)):t.metadata.type!==Xl.L.Zip?Jl.j.createUrl(t.url,{size:Re.h2.Medium,resizeType:Re.Nq.Cover}):"/images/zip-resource.png":Jl.j.createResourceImage(c,t.url,Object.assign({},o))}(e.imageCdnUrl,e.resource,e.dynamicRatioImageOptions);return i().createElement(De.Z,{data:c,imageType:ru(e.resource),imageStyle:{transform:"rotate(".concat(a,"deg)")},alt:e.resource.name,errorFallbackImageSrc:e.imageErrorFallbackUrl,errorFallbackImageClassName:tu.fallBackImage,imageClassName:(null==o?void 0:o.type)===Xl.L.Image?"".concat(tu.imageTypeResource," ").concat(tu.imageStyle):"",preload:e.preloadImage,preventLoad:!e.preloadImage})}var ou=n(96461),au=n(43803),cu=n(74421),su=n(13799),lu={getResourceTypeName: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"}}},uu={imageStyle:"I9E5O",item:"tqUFn",dashboard:"o7j7p",playPage:"V2RwX",aspectRatio:"OnJDH",outerContainer:"CIFy7",innerContainer:"oUZPD",actions:"jzGAm",titleBelow:"Cpjs3",thumbnailContainer:"EDiGi",titleAbove:"e9ejn",teacherPack:"_tdVE",text:"g5NWS",hoverState:"xRYhX",atomGuide:"X39wU",studentActivity:"X9pMl",additionalMaterials:"qRVUo",userUploaded:"_18JaV",imageTypeResource:"KYtZL",download:"fbb_e"};function fu(e){var t,n,r,o,a=null;"metadata"in e.data&&(a=e.data.metadata);var c=eu.G.isType(e.data,cu.E.Resource);return i().createElement(i().Fragment,null,i().createElement("div",{className:uu.aspectRatio},i().createElement("div",{className:uu.outerContainer},i().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 uu.atomGuide;case"student-activity":return uu.studentActivity;case"teacher-pack":return uu.teacherPack;case"additional-materials":return uu.additionalMaterials;default:return uu.userUploaded}}(t)," ").concat(uu.innerContainer);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(uu.hoverState)),r}(null==a?void 0:a.resourceType)},"above"===e.titlePosition&&i().createElement(Ur.u,{title:e.data.name},i().createElement("h3",{className:"text-center text-break h5 mb-3 ".concat(uu.text)},i().createElement("span",{className:"clamp-1"},e.data.name))),i().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(uu.thumbnailContainer," ").concat("above"===e.titlePosition?uu.titleAbove:""," \n ").concat(uu.imageStyle,"\n ")},i().createElement(iu,{resource:e.data,imageCdnUrl:e.imageCdnUrl,imageErrorFallbackUrl:e.imageErrorFallbackUrl,preloadImage:e.preloadImage})),c&&e.onClickDownload&&"normal"===e.actionBehaviour&&i().createElement("div",{className:uu.actions},i().createElement(k.L,{onClick:function(t){return e.onClickDownload(t,e.data)},className:"".concat(uu.download," d-flex align-items-center justify-content-center")},i().createElement(x.x,{svgName:O.vn.Download}))),!e.hideTypeBadge&&c&&i().createElement(au.y,{typeId:cu.E.Resource})))),"below"===e.titlePosition&&i().createElement("div",{className:"mt-1 ".concat(uu.titleBelow)},eu.G.isType(e.data,cu.E.Resource)&&!!(null===(o=null===(r=e.data)||void 0===r?void 0:r.metadata)||void 0===o?void 0:o.resourceType)&&i().createElement(ou.m,null,lu.getResourceTypeName(e.data.metadata.resourceType)),i().createElement("h3",{className:"h6 clamp-2"},e.data.name)))}function du(e){return du="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},du(e)}function pu(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,hu(r.key),r)}}function hu(e){var t=function(e,t){if("object"!=du(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=du(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==du(t)?t:t+""}function mu(e,t,n){return t=yu(t),function(e,t){if(t&&("object"==du(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,vu()?Reflect.construct(t,n||[],yu(e).constructor):t.apply(e,n))}function vu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(vu=function(){return!!e})()}function yu(e){return yu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},yu(e)}function gu(e,t){return gu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},gu(e,t)}function bu(e){return i().createElement("div",{className:"cv-resource-item"},i().createElement(fu,{data:e.resource,imageCdnUrl:e.imageCdnUrl,titlePosition:"above",hideTypeBadge:!0}))}fu.defaultProps={preloadImage:!0,actionBehaviour:"normal"},i().memo((function(e){var t,n,r,o,a=(t=e.data,n=e.actionBehaviour,o=i().useContext(su.X),"public"===n||!o.xs&&!o.sm&&"resource"===t.type&&"metadata"in t&&(t.metadata.type===Xl.L.Image||(t.metadata.type===Xl.L.Pdf?!!t.url:!!(null===(r=t.pdf)||void 0===r?void 0:r.url)))),c=Object.assign(Object.assign({},e.analyticsData),e.data),s=Object.assign(Object.assign({},e.analyticsOptions),{actionType:d.Vw.Click,entity:e.data.typeId===cu.E.Resource?d.py.Resource:d.py.Link});function l(){Vn.k.logUserAction(c,s)}var u,f=Object.assign(Object.assign({},e),{applyHoverState:a||!!e.data.url});return i().createElement("div",{className:"px-1 flex-shrink-0 ".concat(uu.item," ").concat("play-page"===e.location?uu.playPage:uu.dashboard," ").concat("resource-item")},(u="d-block no-decoration","link"===e.data.type?i().createElement("a",{href:e.data.url,target:"_blank",className:u,onClick:l},i().createElement(fu,Object.assign({},f))):a?"public"===e.actionBehaviour?i().createElement("div",{className:"".concat(u," cursor-pointer d-inline"),onClick:function(){l(),Ql.C$.trigger(e.getAppLink(e.data))}},i().createElement(fu,Object.assign({},f))):i().createElement(C.F,{appLink:e.getAppLink(e.data),className:u,analyticsData:c,analyticsOptions:s},i().createElement(fu,Object.assign({},f))):e.data.url?i().createElement("a",{href:e.data.url,className:u,onClick:l},i().createElement(fu,Object.assign({},f))):i().createElement("div",{className:u},i().createElement(fu,Object.assign({},f)))))}));var wu=wo((function(e,t){return i().createElement(bu,Object.assign({},t))})),Eu=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=mu(this,t,[e,n]);var i=new wu(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&&gu(e,t)}(t,e),n=t,(r=[{key:"handleClick",value:function(e){e.stopImmediatePropagation(),this.options_.downloadResource(this.options_.resource)}}])&&pu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("MenuItem"));function Su(e){return Su="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},Su(e)}function ku(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,xu(r.key),r)}}function xu(e){var t=function(e,t){if("object"!=Su(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Su(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Su(t)?t:t+""}function Ou(e,t,n){return t=Pu(t),function(e,t){if(t&&("object"==Su(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,Cu()?Reflect.construct(t,n||[],Pu(e).constructor):t.apply(e,n))}function Cu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Cu=function(){return!!e})()}function Nu(e,t,n,r){var i=ju(Pu(1&r?e.prototype:e),t,n);return 2&r?function(e){return i.apply(n,e)}:i}function ju(){return ju="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Pu(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}},ju.apply(null,arguments)}function Pu(e){return Pu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pu(e)}function Iu(e,t){return Iu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Iu(e,t)}var Tu=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=Ou(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&&Iu(e,t)}(t,e),n=t,(r=[{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-resources-button-wrapper ".concat(Nu(t,"buildWrapperCSSClass",this,3)([]))}},{key:"buildCSSClass",value:function(){return"cv-resources-button ".concat(Nu(t,"buildCSSClass",this,3)([]))}},{key:"update",value:function(){Nu(t,"update",this,3)([])}},{key:"createItems",value:function(){var e=this,t=[];return t.push(new hs.Z(this.player_,{label:"Resources"})),this.options_.resources.forEach((function(n){var r=new Eu(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:Ql.Ab.PageLoad(e.url,!0)}},{key:"getDownloadIframe",value:function(){return this.downloadIframe||(this.downloadIframe=ae.Z.dom.createEl("iframe"),this.downloadIframe.style.display="none",ae.Z.dom.appendContent(ae.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(){Nu(t,"handleClick",this,3)([null])}}])&&ku(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("MenuButton"));function Lu(e){return Lu="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},Lu(e)}function Au(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,_u(r.key),r)}}function _u(e){var t=function(e,t){if("object"!=Lu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Lu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Lu(t)?t:t+""}function Fu(e,t,n){return t=Ru(t),function(e,t){if(t&&("object"==Lu(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,Du()?Reflect.construct(t,n||[],Ru(e).constructor):t.apply(e,n))}function Du(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Du=function(){return!!e})()}function Ru(e){return Ru=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ru(e)}function Mu(e,t){return Mu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Mu(e,t)}Tu.prototype.controlText_="Resources",ae.Z.registerComponent("ResourcesButton",Tu);var Uu=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=Fu(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&&Mu(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)}}}])&&Au(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getPlugin("plugin"));ae.Z.registerPlugin("resourcesPlugin",Uu);var Vu=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 Bu(e){var t=e.className,n=void 0===t?"":t,r=e.playerApi,o=e.onReady,a=e.onDispose,c=Vu(e,["className","playerApi","onReady","onDispose"]),s=i().useRef();return i().useEffect((function(){if(s){var e=new xa.J(s.current,Object.assign(Object.assign({},c),{playerApi:r}));return o&&e.ready((function(){o(ta(e))})),a&&e.one("dispose",a),function(){null==e||e.dispose()}}}),[e.viewKey]),i().createElement("div",{ref:s,className:n})}var qu={placeholder:"JemW5"};function Gu(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 Zu(){return i().createElement("div",{className:"".concat(qu.placeholder," partial-loading-background")})}function zu(e){var t,n,r=(t=i().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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Gu(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)?Gu(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=r[0],a=r[1];return i().useEffect((function(){e.createViewKey(null,(function(e){a(e.get("viewKey"))}))}),[e.video.id]),o?i().createElement("div",{className:"col-12 mb-3 p-0"},i().createElement(Bu,{playerApi:new URL(e.config.get("playerApiUrl")),viewKey:o})):i().createElement(Zu,null)}var Hu="libraryRequests.info";function Wu(e){var t=c.M.isVideo(e.libraryRequest.object),n=c.M.isInteractive(e.libraryRequest.object),r=c.M.isClip(e.libraryRequest.object);return i().createElement("div",{className:"bg-white rounded p-3"},i().createElement(pa,{comments:e.comments,imageCdnUrl:e.config.get("imageCdnUrl")}),i().createElement("h2",{className:"h5"},i().createElement(o.x,{namespace:Hu,phrase:"videoDetails"})),t&&i().createElement(i().Fragment,null,i().createElement(m,{video:e.libraryRequest.object,user:e.user,createViewKey:e.createViewKey,config:e.config}),i().createElement(Ea,{libraryRequest:e.libraryRequest,hideBroadcastInfo:e.user.get("instanceRegion")===a.b.US,config:e.config})),n&&i().createElement(i().Fragment,null,i().createElement(ca,{video:e.libraryRequest.object,currentUser:e.currentUser,createViewKey:e.createViewKey,config:e.config}),i().createElement(B,{libraryRequest:e.libraryRequest})),r&&i().createElement(i().Fragment,null,i().createElement(zu,{video:e.libraryRequest.object,currentUser:e.currentUser,createViewKey:e.createViewKey,config:e.config}),i().createElement(w,{libraryRequest:e.libraryRequest})))}},49824:function(e,t,n){"use strict";n.d(t,{j:function(){return o}});var r=n(1024),i=n.n(r);function o(){return i().createElement("div",{className:"bg-white rounded p-3"},i().createElement("div",{className:"partial-loading-background mb-2",style:{height:"1.25rem",width:"9rem"}}),i().createElement("div",{className:"col-12 mb-3 p-0"},i().createElement("div",{className:"responsive-img partial-loading-background rounded"})),i().createElement("div",{className:"row"},i().createElement("div",{className:"col-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"3.4rem"}})),i().createElement("div",{className:"col-9 mb-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"9rem"}})),i().createElement("div",{className:"col-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"5rem"}})),i().createElement("div",{className:"col-9 mb-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"2rem"}})),i().createElement("div",{className:"col-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"7rem"}})),i().createElement("div",{className:"col-9 mb-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"16rem"}}))))}},92966:function(e,t,n){"use strict";n.d(t,{q:function(){return wt}});var r=n(1024),i=n.n(r),o=n(42648),a=n(82602),c=n(70868),s=n(70065),l=n(49642),u=n(99910),f=n(64038),d=n(39396),p=n(63791),h={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 v(e){var t,n,i=(t=(0,f.useInView)(),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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)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(h.container),ref:o},e.isFetching?r.createElement(u.Spinner,{as:"span",animation:"border",role:"status",className:h.spinner}):r.createElement(d.x,{svgName:p.vn.ChevronDown,className:"svg-container cursor-pointer",size:d.S.Large,onClick:function(){var t;return null===(t=e.fetchNext)||void 0===t?void 0:t.call(e,e.nextCursor)}}))}v.defaultProps={fetchOnScroll:!1};var y=n(66703),g=n(85887),b=n(41087),w=n(7121);function E(e){var t="d-flex align-items-center badge-list ".concat(w.Z.minHeight);return e.className&&(t+=" ".concat(e.className)),r.createElement("div",{className:t},e.children)}var S=n(57857),k=n(53808),x=n(58424),O=n(2491),C=n(37360),N=n(40221),j=n(12927),P={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!!N.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=j.M.getCanBeConsumed(e))||void 0===n?void 0:n.canConsume)||!t&&!C.V.isTabletOrMobile()&&!P.isFavouritedByCurrentUser(e))}},I={favourited:"t0svX",favouriteButton:"CFRo3",heart:"ZMMQu",heartOutline:"truFo"};function T(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 L=S.T.encloseNamespace("shared.favouriteButton");function A(e){var t,n,i=(0,O.Z)(),o=P.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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return T(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)?T(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],s=a[1];r.useEffect((function(){s(o)}),[o]);var l="".concat("d-flex align-items-center justify-content-center"," cursor-pointer ").concat(I.favouriteButton," ").concat(c?I.favourited:"");return e.className&&(l+=" ".concat(e.className)),k.q.isFunction(e.setFavourite)&&k.q.isFunction(e.canFavourite)&&e.canFavourite(e.video)?r.createElement(x.L,{className:l,onClick:function(){var t=!c;s(t),e.setFavourite(e.video,t,null,(function(){i.error(L(j.M.isClip(e.video)?t?"favouriteClipError":"unfavouriteClipError":j.M.isInteractive(e.video)?t?"favouriteInteractiveError":"unfavouriteInteractiveError":t?"favouriteVideoError":"unfavouriteVideoError")),s(!t)}),e.analyticsData,e.analyticsOptions)},tabIndex:e.preventFocus?-1:void 0},r.createElement(d.x,{svgName:p.vn.Heart,className:"svg-container ".concat(I.heart)}),r.createElement(d.x,{svgName:p.vn.HeartOutline,className:"svg-container ".concat(I.heartOutline)})):r.createElement(r.Fragment,null)}var _,F,D,R=n(49619),M=n(24828),U=n(22231),V={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 B(e){var t,n=e.type,i=e.mediaType,o=e.extraClasses,a=e.containerClassSize;if(n===_.Video)return r.createElement("div",{className:"".concat(V.videoFallback," ").concat(e.extraClasses," bg-light-blue")});if(n===_.Folder)return r.createElement("div",{className:"".concat(V.folderFallback," ").concat(e.extraClasses," ").concat((0,U.x)(e.name,M.o))});var c=function(e){return e===_.SeriesThumbnail?V.seriesItemFallback:e===_.PlaylistThumbnail?V.playlistItemFallback:e===_.Playlist?V.playlistFallback:e===_.Series||e===_.TallSubject?V.posterFallback:e===_.Subject?"".concat(V.subjectFallback," svg-container d-inline-block"):""}(n),s=function(e){return e===_.SeriesThumbnail||e===_.PlaylistThumbnail?p.vn.Play:e===_.Playlist?p.vn.Image:e===_.Series?p.vn.Series:e===_.Subject||e===_.TallSubject?p.vn.Subject:""}(n),l=function(e){return e===_.Subject?d.S.ExtraLarge:d.S.Standard}(n),u="".concat(function(e,t,n){if(t===_.Subject){var r=n===D.Large?V.subjectFallbackContainerLarge:V.subjectFallbackContainerSmall;return"".concat(V.subjectFallbackContainer," ").concat(r)}return e===F.Svg?t===_.SeriesThumbnail||t===_.PlaylistThumbnail?"".concat(V.svgFallbackContainer," rounded-3"):V.svgFallbackContainer:V.baseFallbackContainer}(i,n,a));return o&&(u+=" ".concat(e.extraClasses)),r.createElement("div",{className:u},i===F.Svg?r.createElement(d.x,{svgName:s,className:"".concat(c," ").concat(null!==(t=e.svgContainerClassName)&&void 0!==t?t:""),tagName:"div",size:l}):r.createElement("div",{className:V.fallbackThumbnailImage,style:{backgroundImage:"url('".concat(s,"')")}}))}function q(e){var t=j.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"}(_||(_={})),function(e){e[e.Svg=0]="Svg",e[e.Image=1]="Image"}(F||(F={})),function(e){e[e.Large=0]="Large",e[e.Small=1]="Small"}(D||(D={})),B.defaultProps={mediaType:F.Svg,containerClassSize:D.Large};var G={bottomBar:"YnXtZ"};function Z(e){return j.M.isVideo(e.video)?i().createElement("div",{className:G.bottomBar},i().createElement(q,{video:e.video})):i().createElement(i().Fragment,null)}var z=n(38182),H=n(63946),W="d-inline-block svg-container",K="span";function Y(e){var t=e.children,n=e.className,i=void 0===n?W:n,o=e.tagName,a=void 0===o?K:o,c=e.size,s=void 0===c?d.S.Standard:c,l=e.onClick,u=e.title,f=e.tooltipPlacement,p=void 0===f?"right":f,h=a,m={className:"".concat(i," svg-container ").concat(s),onClick:k.q.isFunction(l)?l:null};return u?r.createElement(H.u,{title:u,placement:p},r.createElement(h,Object.assign({},m),t)):r.createElement(h,Object.assign({},m),t)}function Q(){return i().createElement("svg",{viewBox:"0 0 41 70"},i().createElement("g",null,i().createElement("path",{fill:"#F8981D",d:"M 0 0 41 35 0 70z"})))}var $=n(76044),X={std:"ct8Ht",sm:"dvCes",stdIcon:"iy0pu",smIcon:"Z_mZf"};function J(e){var t,n,r;return(j.M.isInteractive(e.video)||j.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)?i().createElement("div",{className:"".concat("sm"===e.size?X.sm:X.std," me-1 rounded-circle position-relative bg-white")},i().createElement(Y,{className:"me-1 ".concat("sm"===e.size?X.smIcon:X.stdIcon)},i().createElement(Q,null))):i().createElement("div",{className:"".concat("sm"===e.size?X.sm:X.std," me-1")},i().createElement(z.q,{imageCdnUrl:e.imageCdnUrl,initials:$.l.getInitials(e.video._liteOwner.name,e.video._liteOwner.surname),imageUrl:null===(r=e.video._liteOwner.avatar)||void 0===r?void 0:r.url})):i().createElement(i().Fragment,null)}var ee={pluginHover:"h4RQa"},te="shared.pluginHover";function ne(e){return e.isPlugin?i().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(ee.pluginHover,"\n ").concat(e.className?e.className:"","\n ")},i().createElement("span",{className:"position-absolute top-50 start-50 translate-middle text-nowrap h4 text-white"},i().createElement(y.x,{namespace:te,phrase:"embed"}))):i().createElement(i().Fragment,null)}var re={padlock:"w4cg8",sm:"JpIYd"};function ie(e){var t="sm"===e.size?d.S.Small:d.S.Standard;return i().createElement("div",{className:"".concat(re.padlock," ").concat("sm"===e.size?re.sm:""," bg-white cursor-default d-flex align-items-center justify-content-center")},i().createElement(d.x,{svgName:p.vn.Lock,size:t}))}var oe=n(88483),ae=n(87013),ce={logo:"OA9ft",sm:"fyo2J"};function se(e){var t,n,r,o;if(!j.M.isVideo(e.video)||!e.companyLogoFallbackUrl)return i().createElement(i().Fragment,null);var a=null===(n=null===(t=e.video.productionCompanies)||void 0===t?void 0:t.data)||void 0===n?void 0:n[0],c=ae.j.createUrl(null!==(o=null===(r=null==a?void 0:a.logo)||void 0===r?void 0:r.url)&&void 0!==o?o:e.companyLogoFallbackUrl,{size:oe.h2.Small});return c?i().createElement("div",null,i().createElement(H.u,{title:null==a?void 0:a.name,spanHack:!0},i().createElement("div",{className:"".concat(ce.logo," ").concat("sm"===e.size?ce.sm:""),style:{backgroundImage:"url(".concat(c,")")}}))):i().createElement(i().Fragment,null)}se.defaultProps={size:"md"};var le=n(98496),ue=n(74421),fe=n(43803);function de(e){return j.M.isClip(e.video)?i().createElement(fe.y,{typeId:ue.E.Clip,size:e.size,inContainer:!0}):j.M.isInteractive(e.video)?i().createElement(fe.y,{typeId:ue.E.Interactive,status:e.video.status,size:e.size,inContainer:!0}):i().createElement(i().Fragment,null)}de.default={size:"md"};var pe=n(17082);n(91656);var he=i().createContext({hasProvider:!1}),me={hoverContainer:"TzWQw",hovering:"gdTcW"};function ve(e){var t,n=i().useContext(he);if(null===(t=n.useInitialize)||void 0===t||t.call(n,e),!n.hasProvider)return i().createElement(i().Fragment,null);if("picture-in-picture"===n.mode)return i().createElement(i().Fragment,null);if("hover"===e.mode&&n.isOnPlayPage)return i().createElement(i().Fragment,null);if("default"===n.mode||"play-page"===e.location)return i().createElement(pe.t0,{node:n.portalNode});var r=n.started,o="rounded-3";"popout-video"===e.location&&(o="rounded-top-3");var a="".concat(me.hoverContainer," ").concat(r?me.hovering:""," ").concat(o," overflow-hidden");return i().createElement("div",{className:a},i().createElement(pe.t0,{node:n.portalNode}))}var ye=n(32557),ge={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 be(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 we(e){var t="mb-1";return e&&(t+=ge.downScale),t}function Ee(e){var t,n,r,o=e.video,a=e.appLink,c=e.imageOptions,l=e.setFavourite,u=e.canFavourite,f=e.preload,h=e.hovering,m=e.hoverToPlay,v=e.companyLogoFallbackUrl,y=j.M.getCanBeConsumed(e.video),w=y.canNavigate,S=y.canConsume,k=g.t.isObject(null==a?void 0:a.params)?null==a?void 0:a.params:{},x=Object.assign(Object.assign({},e.analyticsOptions),{entity:j.M.getAnalyticsEntity(o)}),O=P.showFavouriteButton(e.video,h),C=j.M.isVideo(o),N=j.M.getRating(e.video),I=(n=(0,ye.L)({delay:100}),r=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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(n,r)||function(e,t){if(e){if("string"==typeof e)return be(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)?be(e,t):void 0}}(n,r)||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.")}()),T=I[0],L=I[1]&&S&&m,F=Object.assign(Object.assign({},e.analyticsData),{id:o.id,name:o.name}),D=Object.assign(Object.assign({},x),{actionType:s.Vw.Click,descriptor:s._S.Thumbnail});return i().createElement(H.u,{title:j.M.getPrivacyReasoning(e.video),spanHack:!0,spanHackClassName:""},i().createElement("div",{className:"position-relative rounded-3 overflow-hidden",ref:T},i().createElement(ne,{isPlugin:e.isPlugin,className:"rounded-3",appLink:w?a:null,analyticsData:F,analyticsOptions:D}),O&&i().createElement("div",{className:ge.topRightContainer},i().createElement(A,{setFavourite:l,canFavourite:u,video:o,analyticsData:e.analyticsData,analyticsOptions:x})),!w&&i().createElement("div",{className:ge.topRightContainer},i().createElement(ie,null)),i().createElement("div",{className:"".concat(ge.topLeftContainer," d-flex flex-no-wrap")},e.showOwner&&i().createElement(J,{video:o,imageCdnUrl:e.imageCdnUrl}),i().createElement(de,{video:o}),i().createElement(se,{video:o,companyLogoFallbackUrl:v})),i().createElement(R.Z,{data:j.M.getThumbnail(o),appLink:w?a:null,imageType:oe.__.Thumbnails,imageOptions:c,preload:f,className:ge.gradient,alt:("series"in o&&(null===(t=o.series)||void 0===t?void 0:t.name)?"".concat(o.series.name,": "):"")+o.name,analyticsData:F,analyticsOptions:D,preventFocus:!0},!(!h||!w)&&i().createElement(d.x,{className:ge.playIcon,svgName:p.vn.PlayCircle}),i().createElement(B,{type:_.Video}),i().createElement("div",{className:ge.overlayContainer},i().createElement("div",{className:ge.overlay},i().createElement("div",{className:"".concat(we(h)," ").concat(ge.title)},C&&i().createElement(le.$,{type:e.subTextType,className:"text-shadow clamp-1",video:o,appLink:null,analyticsOptions:null}),i().createElement("span",{className:"h6 text-reset text-shadow clamp-1"},j.M.getTitle(o))),i().createElement(Z,{video:o}),h&&i().createElement(E,{className:"mt-1"},j.M.isVideo(o)&&i().createElement(i().Fragment,null,i().createElement(b.C,{type:b.g.Rating,data:N}),o.hasSubtitle&&i().createElement("span",{className:"badge p-0"},i().createElement(d.x,{svgName:p.vn.CloseCaptionBadge})),i().createElement(b.C,{type:b.g.Interactive,data:o.hasInteractives}),i().createElement(b.C,{type:b.g.DurationExact,data:j.M.getDuration(e.video)})))))),L&&i().createElement(ve,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:k.context,contextId:k.contextId,moviesAndTv:k.mtv})))}var Se,ke=n(11306),xe=n(31647),Oe=i().createContext({}),Ce=n(52076);function Ne(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"}(Se||(Se={}));var je=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,s=e.height,l=document.getElementById("content-width-reference");if(!l)return{};var u=t||c*i,f=t?t*(s/c):s*i,d=t?u/c:i;r=o-(u-c)/2,u<n&&(r-=(n-u)/2,f=s*(d=(u=n)/c));var p=a-(f-s)/2+window.scrollY,h=r,m=Se.Center;return r-l.offsetLeft<8&&(h=o-4,m=Se.Left),l.offsetWidth+l.offsetLeft-(r+u)<8&&(h=t?o+c-t:o-c*(d-1)+8,m=Se.Right),{left:h,top:p,height:f,width:u,transformOrigin:m,position:"absolute",originalWidth:c,originalHeight:s}},Pe={positionWrapper:"jO7pW",animationWrapper:"xXfXO",zoom:"BrrtL"};function Ie(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Te(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)?Te(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 Te(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 Le(e){var t,n,r=e.hoverableComponent,o=e.componentProps,a=e.minHoverWidth,c=e.fixedHoverWidth,l=e.hoverScale,u=i().useContext(Oe).setPreviewContentNode;void 0===u&&xe.Q.Ry.throw(new ke.H("Please use VideoPreviewContext inside a VideoPreviewContextProvider"));var f=i().useMemo((function(){return(0,pe.oD)()}),[]),d=Ie((0,ye.L)({delay:100}),2),p=d[0],h=d[1],m=Ie((0,ye.X)(),2),v=m[0],y=m[1],g=Ie(i().useState(!1),2),b=g[0],w=(g[1],i().useRef(null)),E=i().useRef(!1),S=h||y;!function(e,t,n){var r,o,a=(r=i().useState(e),o=2,function(e){if(Array.isArray(e))return e}(r)||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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(r,o)||function(e,t){if(e){if("string"==typeof e)return Ne(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)?Ne(e,t):void 0}}(r,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.")}()),c=a[0],l=a[1],u=i().useRef(e?new Date:null);i().useEffect((function(){if(t&&n&&n.entity&&t.location)if(e)c||l(!0),u.current=new Date,Ce.k.logUserAction(t,Object.assign(Object.assign({},n),{actionType:s.Vw.Hover}));else{if(!c)return;var r=(new Date).getTime()-u.current.getTime();u.current=null,Ce.k.logUserAction(Object.assign(Object.assign({},t),{timeHoveredInMilliseconds:r,timeHoveredInSeconds:r/1e3}),Object.assign(Object.assign({},n),{actionType:s.Vw.Unhover}))}}),[e])}(S,e.analyticsData,e.analyticsOptions),i().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=i().useMemo((function(){return je({x:x,y:O,width:C,height:N},c,a,l)}),[x,O,C,N,l]),P=j?j.originalWidth/j.width:1,I=r;return i().createElement("div",{ref:w},i().createElement("div",{ref:p},i().createElement(I,Object.assign({isHovering:!1},o))),(S||b)&&i().createElement(pe.Nq,{node:f},i().createElement("div",{className:"".concat(Pe.positionWrapper," ").concat(Pe.animationWrapper),style:Object.assign({"--scale":P},j),ref:v},i().createElement(I,Object.assign({isHovering:!0,hoverPositionConfig:j,cleanPortalNode:function(){return u(null)}},o)))))}function Ae(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)}Le.ReferenceContainer=function(e){return i().createElement("div",{id:"content-width-reference",className:"flex-grow-1"},e.children)};var _e={badgeContainer:"fy9Un",sm:"Rb0TL"};function Fe(e){var t=j.M.getRating(e.video),n=!!e.audience&&"sm"!==e.size,r=!n&&!e.hideRating&&!!t&&"sm"!==e.size;return!e.hideDuration||n||r?i().createElement(E,{className:"".concat(_e.badgeContainer," ").concat("sm"===e.size?_e.sm:"")},n&&i().createElement(Ae,{audience:e.audience,className:"bg-white text-dark",border:"dark"}),r&&i().createElement(b.C,{type:b.g.Rating,data:t}),!e.hideDuration&&i().createElement(b.C,{type:e.newDurationStyle?b.g.DurationApproximate:b.g.DurationExact,data:e.duration||j.M.getDuration(e.video)})):i().createElement(i().Fragment,null)}Fe.defaultProps={newDurationStyle:!0,size:"md"};var De=n(45428);function Re(e){if(!e.yearGroups)return i().createElement(i().Fragment,null);var t=De.l.mapRestrictionToText(e.video._restrictions,e.yearGroups);return j.M.getCanBeConsumed(e.video).canConsume&&t?i().createElement(H.u,{spanHack:!0,spanHackClassName:e.className||"d-inline-block ps-1",title:t,placement:e.tooltipPlacement||"top"},i().createElement(d.x,{svgName:p.vn.Lock,size:"sm"===e.size?d.S.Small:d.S.Standard})):i().createElement(i().Fragment,null)}function Me(e){var t=e.video,n=e.appLink,r=e.subTextAppLink,o=j.M.getCanBeConsumed(t).canNavigate;return i().createElement("div",{className:"mt-2 ".concat("r70GR")},i().createElement("div",{className:"d-flex flex-column ".concat("rULXI")},j.M.isVideo(t)&&i().createElement(le.$,{type:e.subTextType,className:"text-truncate ".concat("h9k1p"),video:t,appLink:r,analyticsOptions:{location:s.LZ.VideoThumbnail}}),i().createElement("h2",{className:"h6"},i().createElement(l.F,{className:"text-reset clamp-2 align-middle",appLink:o?n:null},t.name,i().createElement(Re,{video:e.video,yearGroups:e.yearGroups,size:"sm"})))))}var Ue={tag:"OjHQZ",icon:"SS2zL",disabled:"eGiNR",active:"kD1xM"};function Ve(e){var t,n;return e.appLink?i().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(Ue.tag," ").concat(e.active?Ue.active:"","\n ")},i().createElement(Be,Object.assign({},e))):i().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(Ue.tag," ").concat(Ue.disabled)},i().createElement(Be,Object.assign({},e)))}function Be(e){var t;return i().createElement(i().Fragment,null,i().createElement(d.x,{className:"".concat(Ue.icon," rounded-circle bg-").concat(e.iconVariant," text-white"),svgName:e.svgName}),i().createElement("span",{className:"ps-1 text-nowrap user-select-none ".concat(null===(t=e.theme)||void 0===t?void 0:t.tabLabel)},e.text))}var qe="shared.classroomGuideTag";function Ge(e){var t,n,r;return!e.video||j.M.isInteractive(e.video)?i().createElement(i().Fragment,null):e.video.glance?i().createElement(Ve,{theme:{container:"classroom-guide-tag",tabLabel:"classroom-guide-tag-label"},svgName:p.vn.GraduationCap,iconVariant:"navy",text:S.T.getPhrase(qe,"classroomGuide"),appLink:e.appLink,appLinkAnalyticsData:Object.assign({glanceId:null===(t=e.video.glance)||void 0===t?void 0:t.id,totalPointsOfInterest:null===(r=null===(n=e.video.pointsOfInterest)||void 0===n?void 0:n.data)||void 0===r?void 0:r.length,videoGuidanceType:"classroom-guide"},e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:s.Vw.Click,entity:j.M.getAnalyticsEntity(e.video)},e.analyticsOptions)}):i().createElement(i().Fragment,null)}var Ze="shared.interactivesTag";function ze(e){var t;if(!j.M.showInteractivesGuidance(e.video))return i().createElement(i().Fragment,null);var n=!j.M.isInteractive(e.video)&&((null===(t=e.video.interactives)||void 0===t?void 0:t.data.length)||0);return i().createElement(Ve,{svgName:p.vn.Interactive,iconVariant:"green",text:S.T.getPhrase(Ze,"interactives",{smartCount:n}),appLink:e.appLink,appLinkAnalyticsData:Object.assign({videoGuidanceType:"interactive",videoGuidanceTotalItems:n},e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:s.Vw.Click,entity:j.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}var He="shared.resourcesTag";function We(e){if(!j.M.showResourcesGuidance(e.video))return i().createElement(i().Fragment,null);var t,n,r,o=(t=e.video,j.M.isInteractive(t)?0:((null===(n=t.resources)||void 0===n?void 0:n.data.length)||0)+((null===(r=t.links)||void 0===r?void 0:r.data.length)||0));return i().createElement(Ve,{svgName:p.vn.Resources,iconVariant:"indigo",text:S.T.getPhrase(He,"resources",{smartCount:o}),appLink:e.appLink,appLinkAnalyticsData:Object.assign({videoGuidanceType:"resource",videoGuidanceTotalItems:o},e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:s.Vw.Click,entity:j.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}function Ke(e){var t,n,r,o=j.M.showInteractivesGuidance(e.video)&&j.M.showResourcesGuidance(e.video);return i().createElement("div",{className:"".concat(e.containerClassName," ").concat(o?e.responsiveClassName:"")},i().createElement(Ge,{appLink:null===(t=e.getClassroomGuideAppLink)||void 0===t?void 0:t.call(e,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}),i().createElement(We,{appLink:null===(n=e.getResourceGuidanceAppLink)||void 0===n?void 0:n.call(e,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}),i().createElement(ze,{appLink:null===(r=e.getInteractiveGuidanceAppLink)||void 0===r?void 0:r.call(e,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}))}var Ye="FAuzc",Qe=function(e){var t,n=e.video,r=e.appLink,o=e.imageOptions,a=e.preload,c=e.setFavourite,l=e.canFavourite,u=e.isHovering,f=e.hoverToPlay,d=e.companyLogoFallbackUrl,p=g.t.isObject(null==r?void 0:r.params)?null==r?void 0:r.params:{},h=j.M.getCanBeConsumed(n),m=h.canNavigate,v=h.canConsume;i().useEffect((function(){return function(){var t;null===(t=e.cleanPortalNode)||void 0===t||t.call(e)}}),[]);var y="position-relative bg-white";e.extraClasses&&(y+=" ".concat(e.extraClasses)),u&&(y+=" rounded-3 shadow-lg");var b=Object.assign(Object.assign({},e.analyticsOptions),{entity:j.M.getAnalyticsEntity(n)}),w=e.isHovering&&v&&f,E=P.showFavouriteButton(e.video,u),S=Object.assign(Object.assign({},e.analyticsData),{id:n.id,name:n.name}),k=Object.assign(Object.assign({},b),{actionType:s.Vw.Click,descriptor:s._S.Thumbnail});return i().createElement("div",{className:y},E&&i().createElement("div",{className:Ye},i().createElement(A,{setFavourite:c,canFavourite:l,video:n,analyticsData:e.analyticsData,analyticsOptions:b,preventFocus:!0})),!m&&i().createElement("div",{className:Ye},i().createElement(H.u,{title:j.M.getPrivacyReasoning(e.video),spanHack:!0,spanHackClassName:""},i().createElement(ie,null))),i().createElement("div",{className:"position-relative"},i().createElement(ne,{isPlugin:e.isPlugin,className:u?"rounded-top-3":"rounded-3",onClick:function(){var t;return null===(t=e.cleanPortalNode)||void 0===t?void 0:t.call(e)},appLink:m?r:null,analyticsData:S,analyticsOptions:k}),i().createElement(R.Z,{onClick:function(){var t;return null===(t=e.cleanPortalNode)||void 0===t?void 0:t.call(e)},data:j.M.getThumbnail(n),appLink:m?r:null,imageType:oe.__.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:S,analyticsOptions:k,preventFocus:!e.hideTitle,appLinkClassName:"position-absolute top-0 start-0 h-100 w-100",imageClassName:u?"rounded-top-3":"rounded-3"},i().createElement(B,{type:_.Video}),i().createElement("div",{className:"p-absolute w-100 h-100 text-white"},i().createElement("div",{className:"".concat("wHY80"," d-flex flex-no-wrap")},e.showOwner&&i().createElement(J,{video:n,imageCdnUrl:e.imageCdnUrl}),i().createElement(de,{video:n}),i().createElement(se,{video:n,companyLogoFallbackUrl:d})),i().createElement(Fe,{video:e.video,audience:e.audience,hideRating:e.hideRating,hideDuration:e.hideDuration}),i().createElement(Z,{video:n}))),w&&i().createElement(ve,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:p.context,contextId:p.contextId,moviesAndTv:p.mtv,location:"popout-video"})),!u&&!e.hideTitle&&i().createElement(Me,Object.assign({},e)),i().createElement("div",{className:"".concat("vMaXP"," ").concat(u?"".concat("tR1jA"," box-shadow"):"")},u&&i().createElement(i().Fragment,null,i().createElement("div",{className:"".concat(u?"KJrT1":"")},i().createElement(Me,Object.assign({},e)),e.showVideoGuidance&&u&&i().createElement(Ke,{getClassroomGuideAppLink:e.getClassroomGuideAppLink,getResourceGuidanceAppLink:e.getResourceGuidanceAppLink,getInteractiveGuidanceAppLink:e.getInteractiveGuidanceAppLink,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 i().createElement(i().Fragment,null,i().createElement(Le,{hoverableComponent:Qe,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:j.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?p.vn.PlayCircle:""}(t);return r.createElement("div",{className:"".concat(Je.maskContainer," ").concat("sm"===n?Je.small:"")},r.createElement("div",{className:Je.mask}),r.createElement(d.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,r=(t=i().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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)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=r[0],a=r[1];i().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&&k.q.isFunction(e.setStatus)?i().createElement(x.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},i().createElement(d.x,{svgName:p.vn.Tick,className:"svg-container ".concat(nt.checkMark)})):i().createElement(i().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 j.M.getCanBeConsumed(e.video).canNavigate?function(e){var t;return!(null===(t=j.M.getCanBeConsumed(e.video))||void 0===t?void 0:t.canConsume)||!(!k.q.isFunction(e.setFavourite)||!k.q.isFunction(e.canFavourite))||!!k.q.isFunction(e.setCheckMarkStatus)}(e)?i().createElement("div",{className:"".concat(at.container," d-flex align-items-center")},i().createElement(A,{setFavourite:e.setFavourite,canFavourite:e.canFavourite,video:e.video,className:at.action,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,preventFocus:!0}),i().createElement(it,{status:e.checkMarkStatus,setStatus:e.setCheckMarkStatus,className:at.action})):i().createElement(i().Fragment,null):i().createElement("div",{className:at.container},i().createElement(ie,{size:e.size}))}!function(e){e[e.Below=1]="Below",e[e.Overlay=2]="Overlay",e[e.Independent=3]="Independent"}(ot||(ot={}));var st={titleOverlay:"krg9f",clip:"MPRU6",large:"g5_ww",interactive:"Zzo3e",titleBelow:"tZjPt",overlayContainer:"EElm1",topLeftContainer:"hrw3I",gradient:"LS_EH"};function lt(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=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)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=e.video,r=e.subTextAppLink,o=e.textPosition,a=e.appLink,c=o===ot.Overlay,u=j.M.getCanBeConsumed(e.video).canNavigate,f="";return c?(f=st.titleOverlay,u&&(j.M.isClip(n)&&(f+=" "+st.clip),j.M.isInteractive(n)&&(f+=" "+st.interactive))):f=st.titleBelow,i().createElement("div",{className:f},j.M.isVideo(n)&&i().createElement(le.$,{type:e.subTextType,className:c?"text-shadow clamp-1":"clamp-2",video:n,appLink:c?null:r,analyticsOptions:{location:s.LZ.VideoThumbnail}}),c||!u?i().createElement("span",{className:"h6 text-reset clamp-1"},null!==(t=n.name)&&void 0!==t?t:S.T.getPhrase(ft,"videoUnavailable")):i().createElement(l.F,{className:"h6 text-reset clamp-2",appLink:a},n.name))}function pt(e){var t,n,r=e.video,o=e.appLink,a=e.textPosition,c=e.imageOptions,l=e.setFavourite,u=e.preload,f=e.hoverToPlay,d=g.t.isObject(null==o?void 0:o.params)?null==o?void 0:o.params:{},p=lt((0,ye.X)(),2),h=p[0],m=p[1],v=lt((0,ye.L)({delay:100}),2),y=v[0],b=v[1],w=j.M.getCanBeConsumed(r),E=w.canNavigate,S=w.canConsume,k=b&&S&&f,x=Object.assign(Object.assign({},e.analyticsOptions),{entity:j.M.getAnalyticsEntity(r)}),O=!!o&&!e.hideMask&&E,C=j.M.getPrivacyReasoning(e.video,e.showSignIn),N=Object.assign(Object.assign({},e.analyticsData),{id:r.id,name:r.name}),I=Object.assign(Object.assign({},x),{actionType:s.Vw.Click,descriptor:s._S.Thumbnail});return i().createElement(H.u,{title:C,spanHack:!0,spanHackClassName:""},i().createElement("div",{className:(n="position-relative",n+=o&&E?" cursor-pointer":"",e.extraClasses&&(n+=" ".concat(e.extraClasses)),a===ot.Overlay&&(n+=" rounded overflow-hidden"),n),ref:function(e){h.current=e,y.current=e}},i().createElement(ne,{isPlugin:e.isPlugin,className:"sm"===e.size?"rounded":"rounded-3",appLink:E?o:null,analyticsData:N,analyticsOptions:I}),i().createElement(ct,{video:r,checkMarkStatus:e.checkMarkStatus,setCheckMarkStatus:e.setCheckMarkStatus,setFavourite:l,canFavourite:function(){var t;return(null===(t=e.canFavourite)||void 0===t?void 0:t.call(e,e.video))&&P.showFavouriteButton(r,m)},analyticsData:e.analyticsData,analyticsOptions:x,size:e.size}),i().createElement(R.Z,{data:j.M.getThumbnail(r),appLink:E?o:null,onClick:E?e.onClick:void 0,imageType:oe.__.Thumbnails,imageOptions:c,preload:u,className:function(){var t="overflow-hidden ".concat("sm"===e.size?"rounded":"rounded-3");return e.imageClassName&&(t+=" ".concat(e.imageClassName)),a===ot.Overlay&&(t+=" ".concat(st.gradient)),t}(),alt:("series"in r&&(null===(t=r.series)||void 0===t?void 0:t.name)?"".concat(r.series.name,": "):"")+r.name,analyticsData:N,analyticsOptions:I,preventFocus:!0},O&&i().createElement(et,{type:Xe.Video,size:e.size}),i().createElement(B,{type:_.Video}),i().createElement("div",{className:st.overlayContainer},a===ot.Overlay&&i().createElement(dt,Object.assign({},e)),i().createElement("div",{className:"".concat(st.topLeftContainer," d-flex flex-no-wrap")},e.showOwner&&i().createElement(J,{video:r,imageCdnUrl:e.imageCdnUrl}),i().createElement(de,{video:r,size:e.size}),i().createElement(se,{video:r,companyLogoFallbackUrl:e.companyLogoFallbackUrl,size:e.size})),i().createElement(Z,{video:r}),i().createElement(Fe,{video:e.video,audience:e.audience,hideRating:e.hideRating,hideDuration:e.hideDuration,newDurationStyle:e.newDurationStyle,size:e.size}))),k&&i().createElement(ve,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:d.context,contextId:d.contextId,moviesAndTv:d.mtv}),a===ot.Below&&i().createElement(dt,Object.assign({},e))))}function ht(e){switch(e.type){case"static":return r.createElement(pt,Object.assign({},e));case"cosmetic":return r.createElement(pt,Object.assign({},e,{hoverToPlay:!1}));case"expandable":return r.createElement(Ee,Object.assign({},e));case"popout":return r.createElement($e,Object.assign({},e));default:return}}ht.defaultProps={hideRating:!0,size:"md",hoverToPlay:!0};var mt=n(50072),vt=n(65402),yt={navItem:"GyyRT",active:"aVNhj",navContainer:"uQ6as",navItemHeading:"NjJLh"},gt="libraryRequests.leftNav";function bt(e){var t,n,r=e.libraryRequest,o=r.sender&&"".concat(r.sender.name," ").concat(r.sender.surname),u=(null===(t=r.object)||void 0===t?void 0:t.name)||r.name;return i().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:[r.id],params:e.queryParams}),onClick:function(){return c.t.preventScrollTop()}},i().createElement("div",{className:"col-5 px-0"},i().createElement(ht,{video:null!==(n=r.object)&&void 0!==n?n:{},type:"cosmetic",imageOptions:{size:oe.h2.Small},textPosition:ot.Independent,hideMask:!0})),i().createElement("div",{className:"col-7 ps-2"},i().createElement("div",{className:"d-flex justify-content-between w-100"},i().createElement("div",{className:"overflow-hidden"},i().createElement(le.$,{type:"series",video:r.object,analyticsOptions:{location:s.LZ.LibraryRequestDetails}}),!!u&&i().createElement("h5",{className:"m-0 mb-0 h6",title:u},i().createElement("span",{className:"text-truncate pb-1 d-block ".concat(yt.navItemHeading)},u))),r.status!==mt.l.Pending&&i().createElement("div",{className:"flex-shrink-0 ms-1"},i().createElement(vt.h,{status:r.status}))),!!o&&i().createElement("div",null,i().createElement(y.x,{namespace:gt,phrase:r.status===mt.l.AutoApproved?"addedBy":"requestedBy",options:{fullName:o}})),i().createElement("div",null,(0,a.WU)(r.dateCreated))))}function wt(e){return i().createElement("div",{className:"".concat(yt.navContainer," bg-white rounded overflow-hidden")},i().createElement(o.$B,{hideTracksWhenNotNeeded:!0},e.libraryRequests.map((function(t,n){return i().createElement(bt,{libraryRequest:t,key:n,active:e.selectedId===t.id,appLink:e.appLink,queryParams:e.queryParams})})),(e.nextCursor||e.isFetching)&&i().createElement(v,{isFetching:e.isFetching,fetchNext:e.fetchNext,nextCursor:e.nextCursor,fetchOnScroll:!0})))}},7044:function(e,t,n){"use strict";n.d(t,{p:function(){return a}});var r=n(1024),i=n.n(r);function o(){return i().createElement("div",{className:"d-flex p-3"},i().createElement("div",{className:"col-5 px-0"},i().createElement("div",{className:"responsive-img partial-loading-background rounded"})),i().createElement("div",{className:"col-7 ps-2"},i().createElement("div",{className:"partial-loading-background mb-1",style:{height:"1.25rem",width:"9rem"}}),i().createElement("div",{className:"partial-loading-background",style:{height:"1rem",width:"4rem"}})))}function a(){return i().createElement("div",{className:"bg-white rounded"},Array(5).fill(null).map((function(e,t){return i().createElement(o,{key:t})})))}},17950:function(e,t,n){"use strict";n.d(t,{F:function(){return b}});var r=n(1024),i=n.n(r),o=n(57857),a=n(70065),c=n(53808),s=n(49642),l=n(90335);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==u(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d="shared.videoSortSelect",p=c.q.memoize((function(){return f(f(f(f(f(f({},l.D.RecentlyAdded,{name:o.T.getPhrase(d,"recentlyAdded")}),l.D.AtoZ,{name:o.T.getPhrase(d,"atoz")}),l.D.ZtoA,{name:o.T.getPhrase(d,"ztoa")}),l.D.Newest,{name:o.T.getPhrase(d,"newest")}),l.D.Oldest,{name:o.T.getPhrase(d,"oldest")}),l.D.Series,{name:o.T.getPhrase(d,"series")})}));function h(e){var t=e.sortTypes||p();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"},t[e.type].name),r.createElement("ul",{className:"dropdown-menu dropdown-menu-end","aria-labelledby":"sort-select"},Object.keys(t).map((function(n){var i="dropdown-item";return n===e.type&&(i+=" active"),r.createElement("li",{key:n},r.createElement(s.F,{className:i,appLink:e.getSortAppLink(n),analyticsData:{sort:t[n].name},analyticsOptions:e.analyticsOptions},t[n].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 v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=m(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=m(r))return r;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}h.defaultProps={variant:"light"};var y=o.T.encloseNamespace("libraryRequests.sort"),g=function(){return v(v({},l.D.Newest,{name:y("newest")}),l.D.Oldest,{name:y("oldest")})};function b(e){var t=g();return i().createElement(h,{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:a.LZ.LibraryRequestDetails,entity:a.py.LibraryRequest,actionType:a.Vw.Sort,workflowPhase:a.eu.Complete}})}},65402:function(e,t,n){"use strict";n.d(t,{h:function(){return d},$:function(){return f}});var r=n(1024),i=n.n(r),o=n(57857),a=n(39396),c=n(63791),s=n(50072),l={svgContainer:"O2Czg"},u=o.T.encloseNamespace("libraryRequests.statusIcon");function f(e){switch(e){case s.l.AutoApproved:return u("autoApproved");case s.l.Approved:return u("approved");case s.l.Closed:return u("closed");case s.l.Rejected:return u("rejected")}return""}function d(e){var t="",n="".concat(l.svgContainer," text-white d-inline-block svg-container rounded-circle ");switch(e.status){case s.l.AutoApproved:t=c.vn.Check,n+="bg-gray-500";break;case s.l.Approved:t=c.vn.Check,n+="bg-success";break;case s.l.Closed:t=c.vn.Minus,n+="bg-gray-500";break;case s.l.Rejected:t=c.vn.Close,n+="bg-danger"}return i().createElement(a.x,{svgName:t,className:n,size:a.S.Small,title:f(e.status),tooltipSpanHack:!0,tooltipPlacement:"top"})}},9416:function(e,t,n){"use strict";n.d(t,{A:function(){return v}});var r=n(1024),i=n.n(r),o=n(57857),a=n(52076),c=n(49642),s=n(41087),l=n(58424),u=n(39396),f={pillTabSelector:"Hdi6o",tab:"RvNxr",minWidth:"GHSz9",radiusSmall:"VhJJa",tabLink:"WFyvo"};function d(e){return i().createElement(i().Fragment,null,!!e.tab.svgName&&i().createElement("div",{className:e.tab.name?"pe-1":""},i().createElement(u.x,{svgName:e.tab.svgName})),e.tab.name,"number"==typeof e.tab.count&&i().createElement("div",{className:"ps-2"},i().createElement(s.C,{type:s.g.Count,data:e.tab.count})))}function p(e){var t;return i().createElement("nav",{className:null!==(t=e.className)&&void 0!==t?t:"",ref:e.containerRef},i().createElement("ul",{className:"\n list-unstyled d-inline-block m-0 ".concat(f.pillTabSelector,"\n ").concat(e.borderRadius?f.radiusSmall:"","\n ").concat(e.listClassName,"\n ")},e.tabs.map((function(e,t){return i().createElement("li",{className:"\n p-0 ".concat(f.tab," ").concat(e.active?"btn btn-dark":"btn btn-outline-dark","\n ").concat(e.name?f.minWidth:""," ").concat(e.className,"\n "),key:t},e.appLink?i().createElement(c.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(f.tabLink,"\n ")},i().createElement(d,{tab:e})):i().createElement(l.L,{className:"\n cursor-pointer d-flex align-items-center justify-content-center\n text-decoration-none text-reset p-2 text-nowrap ".concat(f.tabLink,"\n "),onClick:function(){return function(e){!e.active&&e.onSelect&&(e.onSelect(),e.analyticsData&&e.analyticsOptions&&a.k.logUserAction(e.analyticsData,e.analyticsOptions))}(e)}},i().createElement(d,{tab:e})))}))))}p.defaultProps={borderRadius:"lg"};var h=n(50997),m=o.T.encloseNamespace("libraryRequests.tabs");function v(e){var t=[{name:m("pending"),appLink:{application:h.OV.LIBRARY_REQUESTS,action:h.eX.LibraryRequests.PENDING_REQUESTS,args:[""]},active:"pending"===e.active},{name:m("past"),appLink:{application:h.OV.LIBRARY_REQUESTS,action:h.eX.LibraryRequests.PAST_REQUESTS,args:[""]},active:"past"===e.active}];return i().createElement("div",{className:"mb-3"},i().createElement(p,{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 s}});var r=n(1024),i=n.n(r),o=n(57857),a=n(89375),c=o.T.encloseNamespace("libraryRequests.libraryRequestTitle");function s(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),r=c("title")+(n?" - ".concat(n):"");i().useEffect((function(){return a.j.setPageTitle(r)}),[r])}},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 s}});var r=n(1024),i=n.n(r),o=n(86120),a=n(94223),c=n(25796);function s(e,t){var n=o.a.useGetFetch(),r=function(n){return c.y.libraryRequests(e,t,n)},s=function(e){return n(r(e))},l=(0,a.P)(r&&function(e){return r(e).key});return i().useEffect((function(){l&&l.shouldInitialFetch&&s()}),[e,t]),Object.assign(Object.assign({},l),{fetchNext:s})}},30328:function(e,t,n){"use strict";n.d(t,{A:function(){return a}});var r=n(1024),i=n.n(r),o=n(31647);function a(e){var t=e.id,n=e.appLink,r=e.requests;i().useEffect((function(){!t&&(null==r?void 0:r.length)&&o.Q.C$.trigger(Object.assign(Object.assign({},n),{args:[r[0].id]}),{replace:!0})}),[t,null==r?void 0:r.length])}},64429:function(e,t,n){"use strict";n.d(t,{m:function(){return s}});var r=n(1024),i=n.n(r),o=n(31647),a=n(50997),c=n(50072);function s(e,t,n){i().useEffect((function(){e&&(e.status===c.l.Pending&&"pending"!==t&&o.Q.C$.trigger({application:a.OV.LIBRARY_REQUESTS,action:a.eX.LibraryRequests.PENDING_REQUESTS,args:[e.id],params:n},{replace:!0}),e.status!==c.l.Pending&&"pending"===t&&o.Q.C$.trigger({application:a.OV.LIBRARY_REQUESTS,action:a.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 s}});var r=n(1024),i=n.n(r),o=n(48088),a=n(54096),c=n(50997);function s(e){var t=(0,a.G)(c.Or.Library);function n(n){t.getLibraries((function(t){return e(t.toJSON(),n.toJSON())}))}i().useEffect((function(){return o.Radio.channel(c.Vk.LIBRARY).on("folder:created",n),function(){o.Radio.channel(c.Vk.LIBRARY).off("folder:created",n)}}),[e])}},61356:function(e,t,n){"use strict";n.d(t,{c:function(){return O}});var r=n(48088),i=n(39479),o=n(31647),a=n(52076),c=n(70065),s=n(88483),l=n(2772),u=n(10101),f=n(89167),d=n(57098),p=n(93569),h=n(264),m=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,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(t)?t:t+""}function E(e,t,n){return t=k(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,S()?Reflect.construct(t,n||[],k(e).constructor):t.apply(e,n))}function S(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(S=function(){return!!e})()}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}var O=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=E(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&&x(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 h.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")&&(h.g.hasLite?this.requestViewKey():this.webPlayer||this.renderVideoPreview())}},{key:"renderThumbnail",value:function(){this.showChildView("thumbnail",new l.Z({model:this.model,thumbnailOptions:{size:s.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 m.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(32227);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})}}]);