@clickview/library-editor 1.48.1-rc.0 → 1.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/bundles.json +1 -1
  2. package/dist/css/{7349-library-editor-2a17ce8581.chunk.css → 471-library-editor-ad26fedbae.chunk.css} +3 -5
  3. package/dist/languages/en.json +1 -1
  4. package/dist/scripts/1224-3ad7211630.chunk.js +1 -0
  5. package/dist/scripts/2644-4188284c06.chunk.js +1 -0
  6. package/dist/scripts/{3087-12081a5e15.chunk.js → 3087-7727d0c4e7.chunk.js} +1 -1
  7. package/dist/scripts/343-4e17813e7a.chunk.js +1 -0
  8. package/dist/scripts/3578-c16c72054d.chunk.js +2 -0
  9. package/dist/scripts/3969-1e9aeee454.chunk.js +1 -0
  10. package/dist/scripts/456-ecb55e8869.chunk.js +1 -0
  11. package/dist/scripts/471-dd2f84b396.chunk.js +2 -0
  12. package/dist/scripts/5314-af64b5b8fc.chunk.js +1 -0
  13. package/dist/scripts/61-31f64a58a6.chunk.js +2 -0
  14. package/dist/scripts/6427-cbace62568.chunk.js +1 -0
  15. package/dist/scripts/7408-209544dca5.chunk.js +1 -0
  16. package/dist/scripts/7789-405f3fcfb7.chunk.js +2 -0
  17. package/dist/scripts/8113-9f8763f2be.chunk.js +1 -0
  18. package/dist/scripts/8542-7218689c20.chunk.js +1 -0
  19. package/dist/scripts/bundle-84c691cd7e.min.js +2 -0
  20. package/package.json +1 -1
  21. package/dist/scripts/152-2a8a32c9e8.chunk.js +0 -2
  22. package/dist/scripts/2644-4ce78c8ca5.chunk.js +0 -1
  23. package/dist/scripts/343-12058c1904.chunk.js +0 -1
  24. package/dist/scripts/3969-eb4c63a73c.chunk.js +0 -1
  25. package/dist/scripts/456-f1d9ed6fe2.chunk.js +0 -1
  26. package/dist/scripts/5314-0400dfc4cf.chunk.js +0 -1
  27. package/dist/scripts/61-4ef140a26f.chunk.js +0 -2
  28. package/dist/scripts/6427-8ee5851a7f.chunk.js +0 -1
  29. package/dist/scripts/7349-5af9197c13.chunk.js +0 -2
  30. package/dist/scripts/7408-d742ffa35e.chunk.js +0 -1
  31. package/dist/scripts/7789-fa408e03f9.chunk.js +0 -2
  32. package/dist/scripts/8113-ecf6ac61ac.chunk.js +0 -1
  33. package/dist/scripts/8213-ef3077d565.chunk.js +0 -1
  34. package/dist/scripts/8542-776c339eeb.chunk.js +0 -1
  35. package/dist/scripts/bundle-00e7a0de49.min.js +0 -2
  36. /package/dist/css/{152-library-editor-01b4461ff1.chunk.css → 3578-library-editor-01b4461ff1.chunk.css} +0 -0
  37. /package/dist/scripts/{152-2a8a32c9e8.chunk.js.LICENSE.txt → 3578-c16c72054d.chunk.js.LICENSE.txt} +0 -0
  38. /package/dist/scripts/{61-4ef140a26f.chunk.js.LICENSE.txt → 471-dd2f84b396.chunk.js.LICENSE.txt} +0 -0
  39. /package/dist/scripts/{5707-41f283fd98.chunk.js → 5707-6ef0aaefcf.chunk.js} +0 -0
  40. /package/dist/scripts/{5850-a9edf39a77.chunk.js → 5850-7f326276ae.chunk.js} +0 -0
  41. /package/dist/scripts/{7349-5af9197c13.chunk.js.LICENSE.txt → 61-31f64a58a6.chunk.js.LICENSE.txt} +0 -0
  42. /package/dist/scripts/{7789-fa408e03f9.chunk.js.LICENSE.txt → 7789-405f3fcfb7.chunk.js.LICENSE.txt} +0 -0
  43. /package/dist/scripts/{bundle-00e7a0de49.min.js.LICENSE.txt → bundle-84c691cd7e.min.js.LICENSE.txt} +0 -0
@@ -1,2 +0,0 @@
1
- /*! For license information please see 7349-5af9197c13.chunk.js.LICENSE.txt */
2
- (self.webpackChunk_clickview_library_editor=self.webpackChunk_clickview_library_editor||[]).push([[7349],{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),l=n(53808),s={fetch:function(e,t){var n=e.dataServiceName,r=e.eventPrefix,s=e.fetchData,u=e.setData,f=e.onError,d=e.deleteEventPrefix;if(l.q.isFunction(s)){if(l.q.isFunction(u)){var p=f&&l.q.isFunction(f),m=c.u.getInstance(n),h=i.Radio.channel(m.channelName),v="".concat(r,":request"),y="".concat(r,":sync"),g="".concat(r,":error"),b="".concat(r,":invalidate"),w=d&&"".concat(d,":sync"),E=function(){return t(!1)},S=function(){return t(!0)},k=function(){return t(!1)},x=function(){return h.off(b,k)};h.once(v,E),h.once(y,S),h.once(b,k),p&&h.once(g,f),w&&h.once(w,x);var O=s(m);return O&&(t(!0),e.setData(O)),function(){c.u.releaseInstance(n),h.off(v,E),h.off(y,S),h.off(b,k),p&&h.off(g,f),w&&h.off(w,x)}}o.Ry.throw(new a.H("A setData function must be passed to fetch"))}else o.Ry.throw(new a.H("A fetchData function must be passed to fetch"))}};function u(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t){var n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=(n=r.useState(!1),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,i)||u(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=a[0],l=a[1];r.useEffect((function(){l(!1)}),function(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t)),r.useEffect((function(){if(o)return s.fetch(e,l)}),[c,o])}},42120:function(e,t,n){"use strict";n.d(t,{e:function(){return s}});var r=n(1024),i=n(53808),o=n(17439),a=n(63946),c=n(31709),l=n(12704);function s(e){var t=r.useMemo((function(){return e.actions.sort((function(e,t){return e.order-t.order}))}),[e.actions]),n=[],s=[];t.forEach((function(e){e.button?n.push(e):s.push(e)}));var u="d-flex";return e.className&&(u+=" ".concat(e.className)),n.length||s.length?r.createElement("div",{className:u},n.length?n.map((function(t,n){return r.createElement(r.Fragment,{key:n},function(){if(t.label){var n=i.q.isFunction(t.label)?t.label:function(){return r.createElement(r.Fragment,null,t.label)};return r.createElement(c.K,{appLink:t.appLink,href:t.href,onClick:t.onClick,svgName:t.svgName,svgSize:e.dropdownToggleSvgSize,className:t.className,tooltip:t.tooltip,showSpinner:t.showSpinner,analyticsData:t.analyticsData,analyticsOptions:t.analyticsOptions,openInNewTab:t.openInNewTab,disabled:t.disabled},n())}var l=r.createElement(o.h,{appLink:t.appLink,href:t.href,onClick:t.onClick,svgName:t.svgName,className:t.className,analyticsData:t.analyticsData,analyticsOptions:t.analyticsOptions,openInNewTab:t.openInNewTab,disabled:t.disabled,showBorder:t.showBorder,customSize:e.customSize,ariaLabel:t.tooltip});return t.tooltip?r.createElement(a.u,{title:t.tooltip,spanHack:!0},l):l}())})):r.createElement(r.Fragment,null),e.sortComponent&&e.sortComponent,s.length?r.createElement(l.m,{actions:s,dropdownToggleClassName:e.actionsDropdownClassName,dropdownToggleSvgSize:e.dropdownToggleSvgSize,fetchMore:e.fetchMore}):r.createElement(r.Fragment,null)):r.createElement(r.Fragment,null)}},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),l=n(49642),s=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 m(e){var t="dropdown-item";return e&&(t+=" ".concat(e)),t}function h(e){var t=i.q.isFunction(e.action.label)?e.action.label:function(){return r.createElement(r.Fragment,null,e.action.label)};if(e.action.appLink)return r.createElement(l.F,{appLink:e.action.appLink,onClick:e.action.onClick,className:m(e.action.className),analyticsData:e.action.analyticsData,analyticsOptions:e.action.analyticsOptions,openInNewTab:e.action.openInNewTab,disabled:e.action.disabled},e.action.svgName&&r.createElement(s.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2 align-middle"}),r.createElement("span",{className:"align-middle"},t()));function n(t){t.preventDefault(),e.action.analyticsData&&e.action.analyticsOptions&&c.k.logUserAction(e.action.analyticsData,e.action.analyticsOptions),i.q.isFunction(e.action.onClick)&&e.action.onClick(),e.action.href&&o.Q.Ab.PageLoad(e.action.href,e.action.openInNewTab)}return e.action.href?r.createElement("a",{className:m(e.action.className),onClick:n,href:e.action.href},e.action.svgName&&r.createElement(s.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2 align-middle"}),r.createElement("span",{className:"align-middle"},t())):r.createElement("span",{className:"cursor-pointer ".concat(m(e.action.className)),onClick:n,role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&n(e)}},e.action.svgName&&r.createElement(s.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2"}),t())}function v(e){if(!e.actions||!e.actions.length)return r.createElement(r.Fragment,null);var t=e.actions.some((function(e){return e.lazyPlaceholder})),n="dropdown";e.className&&(n+=" ".concat(e.className));var i,o="actions-dropdown-".concat(a.Y.getRandomInt()),c="dropdown-toggle px-0 ".concat(d.dropdownToggle);return e.dropdownToggleClassName&&(c+=" ".concat(e.dropdownToggleClassName)),r.createElement("div",{className:n},r.createElement("button",{className:c,type:"button",id:o,"data-bs-toggle":"dropdown","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false","aria-label":"More actions dropdown",onClick:t?e.fetchMore:null},r.createElement(s.x,{svgName:f.vn.More,size:e.dropdownToggleSvgSize})),r.createElement("ul",{className:"dropdown-menu dropdown-menu-end dropdown-menu-right font-size-normal","aria-labelledby":o},t?r.createElement(p,null):e.actions.map((function(e,t){var n=void 0!==i&&i!==e.group;return i=e.group,e.tooltip?r.createElement("li",{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(u.u,{title:e.tooltip,spanHack:!0},r.createElement(h,{action:e}))):r.createElement("li",{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(h,{action:e}))}))))}v.defaultProps={dropdownToggleClassName:"btn btn-light",dropdownToggleSvgSize:s.S.Small}},41087:function(e,t,n){"use strict";n.d(t,{C:function(){return v},g:function(){return s}});var r,i=n(1024),o=n(57857),a=n(39396),c=n(63946),l=n(50028);!function(e){e.Exchange="exchange",e.Streamable="streamable",e.MoviesAndTv="movies_and_tv",e.Twig="twig"}(r||(r={}));var s,u=n(27866),f=n(45428),d=n(63791),p=n(21974),m=n(7121),h=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===s.Rating?t&&!!t.value:e===s.Interactive?!!(null==t?void 0:t.length)||!!(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.length):e===s.Captions?!!(null==t?void 0:t.length)||!!(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.length):e===s.Status?"number"==typeof t:!!t}(t,n))return i.createElement(i.Fragment,null);var o=function(e,t){var n,i="";if(e===s.DurationApproximate&&(i="duration-badge-new px-2 rounded-pill text-nowrap d-flex align-items-center"),e===s.DurationExact&&(i="duration-badge"),e===s.Interactive&&(i="interactive-badge"),e===s.Rating&&(i="rating-badge text-shadow ".concat(p.u.mapRatingToClass(t.value))),e===s.ProductionYear&&(i="production-year-badge text-shadow"),e===s.Captions)return"p-0";if(e===s.Status)return"badge ".concat(function(e){switch(e){case l.X.Published:return"bg-success";case l.X.Archived:case l.X.Rejected:return"bg-danger";case l.X.Draft:return"draft-badge px-2 rounded-pill text-nowrap d-flex align-items-center";case l.X.Pending:case l.X.Processing:return"bg-warning"}}(t));if(e===s.Trending)return"trending-badge px-2 d-flex align-items-center";if(e===s.Count&&(i="count-badge px-1 rounded"),e===s.Restriction){var o=f.l.mapRestrictionToClass(t.restrictions);return"restriction-badge rounded-pill px-2 d-flex align-items-center ".concat(o)}return e===s.Source&&(i=(n=t).includes(r.Streamable)?"px-1 text-nowrap d-flex align-items-center ".concat(m.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===s.Interactive)return h("interactive");if(e===s.DurationApproximate)return u.T.ToDisplayDurationNewStyle(t);if(e===s.DurationExact)return u.T.ToDisplayDuration(t);if(e===s.Rating)return t.code;if(e===s.ProductionYear)return t;if(e===s.Captions)return i.createElement(a.x,{svgName:d.vn.CloseCaptionBadge});if(e===s.Status)return l.X[t];if(e===s.Trending)return i.createElement(i.Fragment,null,i.createElement(a.x,{svgName:d.vn.Trending}),i.createElement("span",{className:"ps-1"},t));if(e===s.Count)return t;if(e===s.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===s.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===s.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"}(s||(s={}))},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),l=n(49642),s=n(17439);function u(e){var t=e.className||"btn btn-dark";return e.disabled&&(t+=" disabled"),e.icon?i().createElement(s.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(l.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 m}});var r=n(1024),i=n(85887),o=n(49642),a=n(29267),c="fVSzb";function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var s=r.memo((function(e){var t,n,i=e.forceLoad,o=e.extraClasses,s=void 0===o?"":o,u=e.errorFallbackImageSrc,f=e.preventLoad,d=void 0!==f&&f,p=e.errorFallbackImageClassName,m=e.src,h=e.alt,v=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["forceLoad","extraClasses","errorFallbackImageSrc","preventLoad","errorFallbackImageClassName","src","alt"]),y=(0,a.Y)({rootMargin:"500px"}),g=y.ref,b=y.inView,w=(t=r.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),E=w[0],S=w[1];function k(){return E&&u?u:e.src}if(r.useEffect((function(){if((i||b)&&!d){var e=new Image;return e.onerror=function(){S(!0),u&&(e.src=u)},e.src=m,function(){return e.onerror=null}}}),[b,d]),E&&!u)return r.createElement(r.Fragment,null);if(!g)return r.createElement("img",Object.assign({className:"".concat(c," ").concat(s," ").concat(E&&p||""),alt:h,src:k()},v));var x=Object.assign(Object.assign({alt:h},v),!b&&!i||d?{src:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="}:{src:k()});return i||(x.ref=g),r.createElement("img",Object.assign({className:"".concat(c," ").concat(s," ").concat(E&&p||"")},x))})),u=n(88483),f=n(87013),d={image:"vdd4V",thumbnail:"Ez0E7",tallPoster:"H9bQA",cover:"Nudts",banner:"IOvDH",poster:"iiY56",pdf:"aDJiJ",link:"wDpui"};function p(e){var t=d.image,n="";return e.imageType===u.__.Thumbnails&&(n="thumbnail ".concat(d.thumbnail)),e.imageType===u.__.TallPosters&&(n=d.tallPoster),e.imageType===u.__.Covers&&(n=d.cover),e.imageType===u.__.Banners&&(n=d.banner),e.imageType===u.__.Posters&&(n=d.poster),e.imageType===u.__.Pdf&&(n=d.pdf),e.imageType===u.__.Link&&(n=d.link),n&&(t+=" ".concat(n)),e.className&&(t+=" ".concat(e.className)),t}function m(e){var t=e.data,n=e.imageOptions,a=e.appLink,c=e.preload,l=e.preventLoad,u=e.analyticsOptions,d=e.analyticsData,m=e.imageClassName,h=e.alt,v="";"string"==typeof t?v=t:i.t.isObject(t)&&(v=t.url);var y=v&&n?f.j.createUrl(v,n):v;return r.createElement("div",{className:p(e),style:e.imageStyle},r.createElement(o.F,{appLink:a,analyticsData:d,analyticsOptions:u,onClick:e.onClick,preventFocus:e.preventFocus,className:e.appLinkClassName},e.children,y&&r.createElement(s,{src:y,alt:h,forceLoad:c,preventLoad:l,extraClasses:m,errorFallbackImageSrc:e.errorFallbackImageSrc,errorFallbackImageClassName:e.errorFallbackImageClassName,onLoad:e.onLoad})))}},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 m}});var r=n(1024),i=n.n(r),o=n(57857),a=n(39396),c=n(50028),l=n(74421),s=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 l.E.Clip:return s.vn.Clip;case l.E.Interactive:return s.vn.Interactive;case l.E.Resource:return s.vn.Resources;default:return""}}function p(e,t){switch(e){case l.E.Clip:return"bg-dark-blue";case l.E.Interactive:return t===c.X.Draft?u.draft:"bg-green";case l.E.Resource:return"bg-indigo";default:return""}}function m(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 l.E.Clip:return f("clip");case l.E.Interactive:return f("interactive");case l.E.Resource:return f("resource");default:return""}}(e.typeId))))}m.default={size:"md"}},98496:function(e,t,n){"use strict";n.d(t,{Q:function(){return m},$: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}},l=n(74421),s={isSeries:function(e){return(null==e?void 0:e.typeId)===l.E.Series},buildSeriesSeasonEpisodeText:function(e,t,n){if(!e)return"";if(!t||!n)return e.toUpperCase();var r=c.padNumber(t,2),i=c.padNumber(n,2);return"".concat(e.toUpperCase()," S").concat(r," • E").concat(i)}},u=n(12927),f=n(96461),d={appLink:"yI6tx",hoverUnderline:"ehDUT"},p=i.T.encloseNamespace("shared.videoSubText");function m(e){var t=e.video,n=t.season;if(!t.episodeNumber||!n)return r.createElement(r.Fragment,null);var i=c.padNumber(n.number,2),o=c.padNumber(t.episodeNumber,2);return r.createElement("span",{className:"d-inline-block ".concat(e.appLink?d.hoverUnderline:"")},e.withSeriesTitle&&r.createElement(r.Fragment,null," "),!!i&&"S".concat(i," • "),"E",o)}function h(e){var t=u.M.getReleaseDate(e.video);return t?u.M.hasSeries(e.video)?r.createElement(r.Fragment,null," • ".concat(t)):r.createElement(r.Fragment,null,t):r.createElement(r.Fragment,null)}function v(e){var t,n=e.appLink,i=e.video,c=e.className,l=void 0===c?"":c,v=null==i?void 0:i.series,y=u.M.getReleaseDate(e.video);if(!(null==v?void 0:v.id)&&!y)return r.createElement(r.Fragment,null);var g=(null==v?void 0:v.id)&&n&&Object.assign(Object.assign({},n),{args:[v.id,o.m.slugify(v.name)]}),b=Object.assign(Object.assign({},e.analyticsData),{id:null==v?void 0:v.id,name:null==v?void 0:v.name,videoId:null==i?void 0:i.id,videoName:null==i?void 0:i.name}),w=Object.assign(Object.assign({},e.analyticsOptions),{entity:a.py.Series,actionType:a.Vw.Click,descriptor:a._S.Title}),E=s.buildSeriesSeasonEpisodeText(null==v?void 0:v.name,null===(t=i.season)||void 0===t?void 0:t.number,i.episodeNumber);return r.createElement(f.m,{appLink:g,className:"d-block ".concat(d.appLink," ").concat(l),analyticsData:b,analyticsOptions:w,title:E,ariaLabel:"".concat(p("ariaSeries")," ").concat(E)},(null==v?void 0:v.name)&&v.name,r.createElement(m,Object.assign({},e,{withSeriesTitle:!0})),r.createElement(h,Object.assign({},e)))}function y(e){var t,n,i=e.appLink,c=e.video,l=e.className,s=void 0===l?"":l,u=null===(n=null===(t=null==c?void 0:c.productionCompanies)||void 0===t?void 0:t.data)||void 0===n?void 0:n[0];if(!(null==u?void 0:u.id))return r.createElement(r.Fragment,null);var m=(null==u?void 0:u.id)&&i&&Object.assign(Object.assign({},i),{args:[u.id,o.m.slugify(u.name)]}),h=Object.assign(Object.assign({},e.analyticsData),{id:null==u?void 0:u.id,name:null==u?void 0:u.name,videoId:null==c?void 0:c.id,videoName:null==c?void 0:c.name}),v=Object.assign(Object.assign({},e.analyticsOptions),{entity:a.py.Company,actionType:a.Vw.Click,descriptor:a._S.Title});return r.createElement(f.m,{appLink:m,className:"d-block ".concat(d.appLink," ").concat(s),analyticsData:h,analyticsOptions:v,title:u.name,ariaLabel:"".concat(p("ariaCompany")," ").concat(u.name)},u.name)}function g(e){var t=e.type,n=void 0===t?"series":t;return"none"===n?r.createElement(r.Fragment,null):"series"===n?r.createElement(v,Object.assign({},e)):r.createElement(y,Object.assign({},e))}},24828:function(e,t,n){"use strict";n.d(t,{o:function(){return r}});var r=["bg-pink","bg-orange"].concat(["bg-green","bg-cyan","bg-teal","bg-blue","bg-indigo","bg-purple"])},99828:function(e,t,n){"use strict";n.d(t,{y:function(){return a}});var r=n(88483);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t,n){return(t=function(e){var t=function(e,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})},8371:function(e,t,n){"use strict";var r;n.d(t,{b:function(){return r}}),function(e){e.AU="cv-ap-southeast-1",e.NZ="cv-ap-southeast-2",e.UK="cv-eu-west-1",e.US="cv-na-west-1"}(r||(r={}))},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 l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,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 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 u=275,f=5,d={className:"",delay:0,style:null},p={screenX:0,screenY:0};function m(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 h(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=l(r.useState(e),2),i=n[0],s=n[1],u=l(r.useState(!1),2),f=u[0],p=u[1],v=r.useRef(null);r.useEffect((function(){a.t.isEqual(e,i)||s(e)}),[e]);var y=o.q.throttle((function(){m(v,i),t.current&&p(!0)}),i.delay,{leading:!1}),g=function(){o.q.isFunction(y.cancel)&&y.cancel(),h(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=l(r.useState(e),2),n=t[0],i=t[1],c=r.useRef(Object.assign({},p)),s=r.useRef(!1),d=r.useRef(0),v=r.useRef(null),y=l(r.useState(!1),2),g=y[0],b=y[1];function w(){d.current&&(window.clearTimeout(d.current),d.current=0)}function E(){s.current=!0}function S(e){if(s.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(){m(v,n),b(!0)},r=n.delay||u,d.current||(d.current=window.setTimeout(t,r))}}function k(){w(),h(v,n),s.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,l=void 0===c||c,s=(e=(0,r.useInView)({triggerOnce:l,rootMargin:a}),t=3,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],f=s[1],d=s[2];return!0!==o&&void 0!==window.IntersectionObserver||(f=!0,u=null),{ref:u,inView:f,initialized:!!d}}},94223:function(e,t,n){"use strict";n.d(t,{P:function(){return u}});var r=n(1024),i=n(58566),o=n(35656),a=n(53808),c=n(86120);function l(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n){function o(e){if(e)return a.q.isFunction(t)?l(t(e)):l(e.data)}function s(e){var t,r;if(e)return n?n(e):null===(r=null===(t=e.pagination)||void 0===t?void 0:t.cursors)||void 0===r?void 0:r.next}return(0,i.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,m=i&&i.shouldFetch,h=o(i&&i.data),v=s(i&&i.data),y=function(e){if(e)return null==e?void 0:e.count}(i&&i.data);v&&(i=c.a.getResponse(t,n(v)),u=u||i.isFetching,f=i.statusCode,d=i.hasCompleted,!i.shouldFetch);){var g=o(i.data);g&&h.push.apply(h,l(g));var b=s(i.data);v=b===v?null:b}var w={shouldInitialFetch:m,items:h,nextCursor:v,isFetching:u,statusCode:f,hasCompleted:d,hasFirstPageCompleted:p};return"number"==typeof y&&(w.totalItems=y),w}}}),[e]))}o.o.Ok},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),l=n(57857),s=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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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 m=l.T.encloseNamespace("shared.imageCropper"),h=/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],l=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(s.G,{title:m("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(h);if(t)return t[1]}(e.src));l(!0),e.onClickCrop(t,e.closePopup)}},text:m("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 l(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 s="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(s,"exchange");case i.r.Workspace:return r.T.getPhrase(s,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=l(l(l(l(l(l(l({},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(s,"pdf");case o.L.Image:return r.T.getPhrase(s,"image");case o.L.Document:return r.T.getPhrase(s,"document");case o.L.Excel:return r.T.getPhrase(s,"spreadsheet");case o.L.PowerPoint:return r.T.getPhrase(s,"presentation");case o.L.Zip:return r.T.getPhrase(s,"zipArchive");case o.L.File:return r.T.getPhrase(s,"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}})},45855:function(e,t,n){"use strict";n.d(t,{x:function(){return lf}});var r=n(1024),i=n.n(r),o=n(66703),a=n(8371),c=n(12927);n(30582),n(85887);var l=i().createContext({setPageMetadata:function(e){return e},revertPageMetadata:function(){},hasPageMetadataChanged:function(){return!1},hasProvider:!1}),s=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,m=void 0===p?[]:p,h=r.useMemo((function(){return new o(c)}),m);t=h.title,n=i().useContext(l),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(){s.q.isFunction(e.close)?e.close():s.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}(h,[h]);return o?r.createElement("div",{ref:v,className:d}):r.createElement(r.Fragment,null)}var d=n(70065),p=n(61356),m=n(64404);function h(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 m.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(71551),C=n(63791),N=n(49642),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 L(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(N.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===O.Z9.Annotation?i().createElement("span",{dangerouslySetInnerHTML:{__html:I(e.interaction.data.annotation)}}):e.interaction.name)))}L.defaultProps={showIcon:!0,showQuestion:!0};var T={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:C.vn.Check}));case E.Incorrect:return i().createElement("span",{className:"text-danger"},i().createElement(x.x,{size:x.S.Medium,svgName:C.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,l=e.hasPlayPageV2,s=t.id.toString()===(null==r?void 0:r.toString()),u=i().useRef();i().useEffect((function(){if(s&&u.current){var e=u.current,t=e.getBoundingClientRect(),n=t.top-e.offsetParent.getBoundingClientRect().top;a(n,t.height)}}),[s]);var f=o?"cursor-pointer":"cursor-default";return i().createElement("div",{ref:u},i().createElement(k.L,{className:"py-2 ".concat(f," ").concat(T.row," ").concat(s?T.selected:""),onClick:s?function(){}:function(){o&&o(t.id)}},l?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(T.timeTag," ").concat(c?"":T.hide)},c?v.T.ToDisplayDuration(n):""):i().createElement("span",{className:"".concat(T.time," me-2 ").concat(s?"fw-bold":"")},c?v.T.ToDisplayDuration(n):""),i().createElement(L,{interaction:t,showTypeName:!0,typeNameClassName:T.type,questionClassName:T.question}),e.onClickDelete&&i().createElement(k.L,{onClick:function(n){n.stopPropagation(),e.onClickDelete(t.id)},className:"".concat(T.deleteContainer)},i().createElement("span",{className:"text-end ".concat(T.delete)},i().createElement(x.x,{size:x.S.Medium,svgName:C.vn.Delete}))),e.getCorrectness&&i().createElement("span",{className:"text-end ".concat(T.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 l(n){e.goToTimepoint(t.id,n,t.visibleAt)}return t.interactions?i().createElement(i().Fragment,null,t.interactions.map((function(s,u){return!e.experimentalInteractiveQuestions&&O.IL[s.typeId]?i().createElement(i().Fragment,{key:u}):i().createElement(F,{interaction:s,visibleAt:t.visibleAt,goToTimepoint:e.goToTimepoint&&l,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,l=e.hasPlayPageV2,s=i().useRef();function u(e,t){if(s.current){var n=s.current.getClientHeight(),r=s.current.getScrollTop(),i=e+r;(i<r||i+t>r+n)&&s.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:s},i().createElement("div",{className:"px-3 py-1"},t.timepoints.map((function(t,o){return i().createElement(D,{key:o,timepoint:t,goToTimepoint:n,selectedInteractionId:r,scrollTo:u,onClickDelete:a,getCorrectness:c,hasPlayPageV2:l,experimentalInteractiveQuestions:e.experimentalInteractiveQuestions})}))))}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=Q(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||[],Q(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 Q(e){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Q(e)}function Y(e,t){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Y(e,t)}var K=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(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=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function 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{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},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,l,s;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,l={interactiveId:n,metadataId:r,userId:i,customerId:o,shareId:a},e.prev=4,e.next=7,$.e.post(c+"interactive/start-session",JSON.stringify(l));case 7:s=e.sent,this.resultId=s.resultId,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),q.Q.Ry.throw(new K);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 K);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 le(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,se(r.key),r)}}function se(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=pe(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||[],pe(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(){return de="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=pe(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}},de.apply(null,arguments)}function pe(e){return pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},pe(e)}function me(e,t){return me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},me(e,t)}var he=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(pe(t.prototype),"buildCSSClass",this).call(this))}},{key:"createEl",value:function(e,n,r){return de(pe(t.prototype),"createEl",this).call(this,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&&le(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("Button"));function ve(e){return ve="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},ve(e)}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ge(e,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,be(r.key),r)}}function be(e){var t=function(e,t){if("object"!=ve(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ve(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ve(t)?t:t+""}function we(e,t,n){return t=ke(t),function(e,t){if(t&&("object"==ve(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,Ee()?Reflect.construct(t,n||[],ke(e).constructor):t.apply(e,n))}function Ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ee=function(){return!!e})()}function Se(){return Se="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ke(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}},Se.apply(null,arguments)}function ke(e){return ke=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ke(e)}function xe(e,t){return xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xe(e,t)}var Oe=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=we(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&&xe(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-items ".concat(Se(ke(t.prototype),"buildCSSClass",this).call(this))}},{key:"createEl",value:function(e,n,r){return Se(ke(t.prototype),"createEl",this).call(this,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 ye(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 ye(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ye(e,t):void 0}}(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 he(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&&ge(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("Component")),Ce=n(94878),Ne={svg:"cDUaE",iconButton:"Mr0S0",iconWithText:"vHTVo",iconOnly:"vIGn0"},je=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 Pe(e){var t=e.className,n=e.svgName,r=e.children,o=je(e,["className","svgName","children"]),a="".concat(t," ").concat(Ne.iconButton);a+=" ".concat(r?Ne.iconWithText:Ne.iconOnly);var c=i().createElement(x.x,{svgName:n,className:Ne.svg});return i().createElement(k.L,Object.assign({className:a},o),c,r)}function Ie(e){var t=e.isCreate,n=e.open,r=e.showTypeSelector;return!t||n?i().createElement(i().Fragment,null):i().createElement(Pe,{className:"btn btn-outline-dark cv-add-question",onClick:r,svgName:C.vn.Plus},"Add question")}var Le,Te=n(99910),Ae=n(17082),_e=n(17439),Fe=n(49619),De=n(88483),Re=n(38182);function Me(e){return Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Me(e)}function Ue(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Me(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Me(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Me(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ve(){return E.NotApplicable}function Be(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 qe(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 Ge(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 Ze(e,t){var n=Ge(e,t);return qe(e,(function(e){var t=n(e);return null==t?void 0:t.text}))}function ze(e,t){return function(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}(e,Ge(e,t))}!function(e){e[e.Incorrect=0]="Incorrect",e[e.Correct=1]="Correct",e[e.PendingReview=2]="PendingReview"}(Le||(Le={}));var He=Ue(Ue(Ue(Ue(Ue(Ue(Ue({},O.Z9.Annotation,Ve),O.Z9.Image,Ve),O.Z9.MissingWord,(function(e,t){var n=Ge(e,t);return Be(e,(function(e){var t=n(e);return null==t?void 0:t.text}))})),O.Z9.MultipleChoice,Ze),O.Z9.ShortAnswer,ze),O.Z9.TrueOrFalse,Ze),O.Z9.Illustration,ze),We={notApplicable:Ve,awaitingMarking:function(){return E.AwaitingMarking},isMissingWordCorrect:Be,isMultipleChoiceCorrect:qe,isInteractionCorrect:function(e,t){return(0,He[e.typeId])(e,t)}},Qe=n(40221);function Ye(e){return Qe.m.last(e.results)}function Ke(e,t){return Qe.m.findWhere(null==t?void 0:t.attempts,{id:e})}var $e=n(76044),Xe=n(57857),Je=Xe.T.encloseNamespace("interactives.responseTypes");function et(){return i().createElement("p",{className:"p-2"},i().createElement("em",null,Je("noResponse")))}var tt="cv-missing-word-",nt=n(4234),rt="yodaE",it="KpbWq",ot="uKRg2",at="_LpCq",ct="zWcu2",lt="TeByp";function st(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ut=["A","B","C","D"];function ft(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return st(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?st(e,t):void 0}}(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)})),l=i().useRef(),s="sm"===e.size||c&&e.interaction.actionableItems.length>2;return i().createElement("ul",{className:"".concat(c?"row ".concat(s&&!e.isDisplayOnly?"px-lg-5 p-0":""):""," list-unstyled")},e.interaction.actionableItems.map((function(t,n){var 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 m=u?"bg-blue text-white":e.unCheckedBackground,h=function(){return i().createElement(i().Fragment,null,ut[n])};e.showFeedback&&(m=t.isCorrect?"bg-success text-white":"bg-danger text-white ".concat(rt),e.hideFeedbackIcons||(h=function(){return i().createElement(i().Fragment,null,t.isCorrect?i().createElement(x.x,{size:x.S.Small,svgName:C.vn.Check}):i().createElement(x.x,{size:x.S.Small,svgName:C.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(Ae.Nq,{node:e.leftHandSidePortalNode},i().createElement(nt.Z,{className:"h-100",ref:l},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||ut[n]})),i().createElement("div",{className:"".concat(it," h6 text-center text-dark p-3")},i().createElement("span",{className:"d-inline-block ".concat(d?"me-3":""," cv-multiple-choice-bullet")},i().createElement(h,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(it,"\n ").concat(m,"\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(ct,"\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||ut[n]})),i().createElement("span",{className:"d-flex ".concat(d||e.isDisplayOnly?"justify-content-between":"justify-content-center"," ").concat(s?"p-2":"p-3")},i().createElement("span",{className:"d-inline-block ".concat(d?"me-3":""," cv-multiple-choice-bullet")},i().createElement(h,null)),d&&i().createElement("span",{className:"flex-grow-1 pe-4"},t.name),!e.onlyShowSelectedAnswer&&i().createElement("span",{className:"".concat(ot," ").concat(c?at:"")},u&&i().createElement(Re.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white"}))))))})))}ft.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var dt="Y7ls8",pt="CBgCv",mt="CVTEm",ht="tbPTs",vt="GUAUz",yt="ZCkyL",gt="TKjXy",bt="_2qC40";function wt(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(yt),e.hideFeedbackIcons||(c=function(){return i().createElement(i().Fragment,null,n.isCorrect?i().createElement(x.x,{size:x.S.Small,svgName:C.vn.Check}):i().createElement(x.x,{size:x.S.Small,svgName:C.vn.Close}))}));var l=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(bt," mx-1 h5"):"".concat(gt," mx-2 h4"),"\n ").concat(e.showFeedback?"":"cursor-pointer","\n ").concat(a)},l),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(pt)},i().createElement(c,null)),i().createElement("span",{className:"".concat(mt).concat("sm"===e.size?" ".concat(ht):"")},o&&i().createElement(Re.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white ".concat("sm"===e.size?vt:"")})))})))}function Et(e){return Et="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},Et(e)}function St(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Et(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Et(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Et(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}wt.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var kt=function(){return i().createElement(i().Fragment,null)},xt=St(St(St(St(St(St(St({},O.Z9.Annotation,kt),O.Z9.Image,kt),O.Z9.MissingWord,(function(e){var t=e.interaction.data.sentence.replace(/{([^{}]*)}/g,(function(e,t){return"{".concat(tt).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(tt))return t;var r=t.replace(tt,""),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))}}})))})),O.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(ft,{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?$e.l.getInitialsFromFullName(e.anonymisedUserName):$e.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(dt," text-white"),isDisplayOnly:!0}))})),O.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(wt,{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?$e.l.getInitialsFromFullName(e.anonymisedUserName):$e.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(dt," text-white")}))})),O.Z9.ShortAnswer,(function(e){var t=Qe.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)})),O.Z9.Illustration,(function(e){var t=Qe.m.first(e.answers);if(!t)return i().createElement(i().Fragment,null);var n="rounded p-2 mb-2 w-50";return e.reportsStyling||(n+=" text-white"),i().createElement("div",{className:n},i().createElement("img",{className:"img-fluid border rounded",src:t.text,alt:"Illustrated answer to the question: ".concat(e.interaction.name)}))}));function Ot(e){return i().createElement(i().Fragment,null,e.correctness===E.Correct&&i().createElement("div",{className:"ms-2 text-success"},i().createElement(x.x,{svgName:C.vn.Check})),e.correctness===E.Incorrect&&i().createElement("div",{className:"ms-2 text-danger"},i().createElement(x.x,{svgName:C.vn.Close})))}function Ct(e){return i().createElement("div",{className:"d-flex align-items-center justify-content-between"},i().createElement("strong",null,e.anonymisedUserName||$e.l.getFullName(e.studentResults.user)),i().createElement(Ot,{correctness:e.correctness}))}function Nt(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?C.vn.CheckCircle:C.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?C.vn.CrossCircleFilled:C.vn.CrossCircle,onClick:function(){return e.markInteraction(e.studentAttempt.answers,Le.Incorrect)}})))}var jt={avatarContainer:"FEdgT"};function Pt(e){var t,n,r,o,a,c=xt[e.interaction.typeId];if(!c)return i().createElement(i().Fragment,null);var l=Ye(e.studentResults),s=Ke(e.interaction.id,l),u=We.isInteractionCorrect(e.interaction,l);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:jt.avatarContainer},i().createElement(Re.q,{imageCdnUrl:e.imageCdnUrl,initials:e.anonymisedUserName?$e.l.getInitialsFromFullName(e.anonymisedUserName):$e.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(Ct,{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:"")},s?i().createElement(c,{interaction:e.interaction,answers:s.answers,imageCdnUrl:e.imageCdnUrl,user:e.studentResults.user,showFeedback:e.showFeedback,showAvatar:e.showAvatar,reportsStyling:e.reportsStyling}):i().createElement(et,null)),!e.showStudentDetails&&i().createElement(Ot,{correctness:u})))),i().createElement(Nt,{studentAttempt:s,correctness:u,markInteraction:e.markInteraction,markedStatus:e.markedStatus}))}var It,Lt,Tt=n(44645),At=n(71575),_t=n(83996),Ft=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.getElementById("dialog-region");n||((n=document.createElement("div")).id="dialog-region",document.appendChild(n));var r=(0,Tt.s)(n);function o(){var e;s.q.isFunction(null===(e=t.cancelButtonProps)||void 0===e?void 0:e.onClick)&&t.cancelButtonProps.onClick(),r.unmount()}var a=Object.assign(Object.assign({},t.submitButtonProps?t.submitButtonProps:{}),{onClick:function(){var e;s.q.isFunction(null===(e=t.submitButtonProps)||void 0===e?void 0:e.onClick)&&t.submitButtonProps.onClick(),r.unmount()}}),c=Object.assign(Object.assign({},t.cancelButtonProps?t.cancelButtonProps:{}),{onClick:function(){o()}});r.render(i().createElement(At.G,{title:t.title,closePopup:o,size:t.size,centered:t.centered,bodyClassName:"overflow-hidden",dialogClassName:t.dialogClassName},e,!t.hideButtons&&i().createElement(_t.u,{className:t.buttonContainerClassName},t.cancelButtonProps&&i().createElement(_t.u.Cancel,Object.assign({},c)),t.submitButtonProps&&i().createElement(_t.u.Submit,Object.assign({},a)))))},Dt=n(99785),Rt={colourButton:"y6pnq",colourButtonSelected:"PAPVX",canvasDrawContainer:"__tFu",strokeButtonContainer:"D1zMW",strokeButton:"J7C_3",selectedButton:"aJKor"};function Mt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ut(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ut(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ut(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}!function(e){e[e.Small=2]="Small",e[e.Medium=4]="Medium",e[e.Large=8]="Large"}(It||(It={})),function(e){e.Black="#000000",e.Red="#D9584F",e.Orange="#F8981D",e.Yellow="#FFCD52",e.Green="#5DC786",e.Blue="#38A2E8",e.Purple="#7A76E8",e.Grey="#979797",e.White="#FFFFFF"}(Lt||(Lt={}));var Vt=i().forwardRef((function(e,t){var n=i().useRef(null);i().useImperativeHandle(t,(function(){return n.current}),[n.current]);var r=i().useRef(null),o=Mt(i().useState([0,0]),2),a=Mt(o[0],2),c=a[0],l=a[1],s=o[1],u=Mt(i().useState(Lt.Black),2),f=u[0],d=u[1],p=Mt(i().useState(It.Small),2),m=p[0],h=p[1],v=Mt(i().useState(!1),2),y=v[0],g=v[1],b=Mt(i().useState(Lt.Black),2),w=b[0],E=b[1];function S(){if(r.current){var e=r.current.getBoundingClientRect();s([e.width,.5625*e.width])}}function x(e){d(e),E(f),g(!1)}return i().useLayoutEffect((function(){if(r.current){var e=new ResizeObserver(S);return e.observe(r.current),function(){return e.disconnect()}}}),[r.current]),i().createElement("section",null,i().createElement("div",{className:"d-flex align-items-start"},i().createElement("div",{className:"d-flex flex-lg-column"},i().createElement("ul",{className:"me-3-lg me-2 list-unstyled"},Object.entries(Lt).slice(0,4).map((function(e,t){var n=Mt(e,2),r=n[0],o=n[1];return i().createElement("li",{key:t},i().createElement(k.L,{className:"".concat(Rt.colourButton," ").concat(f===o?Rt.colourButtonSelected:""," rounded-circle"),style:{backgroundColor:o},onClick:function(){return x(o)},"aria-label":"Select the colour: ".concat(r)}," "))}))),i().createElement("ul",{className:"me-3-lg me-2 list-unstyled"},Object.entries(Lt).slice(4).map((function(e,t){var n=Mt(e,2),r=n[0],o=n[1];return i().createElement("li",{key:t},i().createElement(k.L,{className:"".concat(Rt.colourButton," ").concat(f===o?Rt.colourButtonSelected:""," rounded-circle"),style:{backgroundColor:o},onClick:function(){return x(o)},"aria-label":"Select the colour: ".concat(r)}," "))})))),i().createElement("div",{className:"flex-grow-1 position-relative",ref:r},i().createElement("div",{className:Rt.canvasDrawContainer},c&&i().createElement(Dt.Z,{canvasHeight:l,canvasWidth:c,brushRadius:m,lazyRadius:10,hideGrid:!0,brushColor:f,className:"position-absolute top-0 left-0 border",ref:n}))),i().createElement("div",{className:"d-flex flex-column align-self-stretch ms-2"},i().createElement("div",{className:"d-flex flex-column gap-2 flex-grow-1"},i().createElement("ul",{className:"d-lg-flex flex-column gap-2 list-unstyled d-none"},i().createElement(Pe,{svgName:C.vn.Edit,className:"btn btn-outline-dark ".concat(y?"":Rt.selectedButton),onClick:function(){y&&(d(w),g(!1))},"aria-label":"Pen"}),i().createElement(Pe,{svgName:C.vn.Erase,className:"btn btn-outline-dark mb-2 ".concat(y?Rt.selectedButton:""),onClick:function(){if(y)return d(w),void g(!1);E(f),d(Lt.White),g(!0)},"aria-label":"Eraser"})),i().createElement("ul",{className:"d-flex flex-column mb-2 list-unstyled"},i().createElement("li",{className:Rt.strokeButtonContainer},i().createElement(Pe,{svgName:C.vn.SmallStroke,className:"btn btn-outline-dark ".concat(m===It.Small?Rt.selectedButton:""," ").concat(Rt.strokeButton),onClick:function(){return h(It.Small)},style:{color:f!==Lt.White?f:Lt.Black},"aria-label":"Small stroke"})),i().createElement("li",{className:Rt.strokeButtonContainer},i().createElement(Pe,{svgName:C.vn.MediumStroke,className:"btn btn-outline-dark ".concat(m===It.Medium?Rt.selectedButton:""," ").concat(Rt.strokeButton),onClick:function(){return h(It.Medium)},style:{color:f!==Lt.White?f:Lt.Black},"aria-label":"Medium stroke"})),i().createElement("li",{className:Rt.strokeButtonContainer},i().createElement(Pe,{svgName:C.vn.LargeStroke,className:"btn btn-outline-dark ".concat(m===It.Large?Rt.selectedButton:""," ").concat(Rt.strokeButton),onClick:function(){return h(It.Large)},style:{color:f!==Lt.White?f:Lt.Black},"aria-label":"Large stroke"})))),i().createElement("ul",{className:"d-flex flex-column gap-lg-2 list-unstyled"},i().createElement("li",null,i().createElement(Pe,{svgName:C.vn.Undo,className:"btn btn-outline-dark",onClick:function(){return n.current.undo()},"aria-label":"Undo"})),i().createElement("li",null,i().createElement(Pe,{svgName:C.vn.Delete,onClick:function(){Ft(i().createElement("p",null,"Are you sure you want to discard your drawing?"),{title:"Discard your drawing?",submitButtonProps:{onClick:function(){return n.current.clear()},variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}})},className:"btn btn-outline-danger d-lg-block d-none ".concat(Rt.myRight),"aria-label":"Clear canvas"}))))))})),Bt="sTvDl",qt="kFxi6";function Gt(e){var t=i().useRef(null),n=j.w.getTypeInfo(e.interaction.typeId),r=n.bgClassName,o=n.Svg;return i().createElement(nt.Z,{className:"h-100"},i().createElement("section",{className:"d-flex flex-column h-100"},i().createElement("div",{className:"text-center text-body d-flex justify-content-between align-items-center p-2"},i().createElement("div",{className:"d-flex align-items-center"},i().createElement("span",{className:"".concat(Bt," me-3 rounded my-1 text-white align-middle d-inline-block ").concat(r)},i().createElement(o,null)),i().createElement("span",{className:"text-start flex-grow-1"},i().createElement("h2",{className:"h6 mb-0"},i().createElement("strong",null,e.interaction.name)))),i().createElement("div",null,i().createElement(k.L,{className:"btn btn-link",onClick:function(){Ft(i().createElement("p",null,"Are you sure you want to discard your drawing?"),{title:"Discard your drawing?",submitButtonProps:{onClick:e.onCancel,variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}})}},"Cancel"),i().createElement(k.L,{className:"btn btn-dark ms-2",onClick:function(){t.current&&e.onSave(t.current.getDataURL("image/png"))}},"Save"))),i().createElement("div",{className:"cv-timepoint bg-gray-100 flex-grow-1 rounded-bottom"},i().createElement("div",{className:"cv-timepoint-padding h-100"},i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"mx-auto ".concat(qt)},i().createElement(Vt,{ref:t})))))))}function Zt(e){var t=e.error;return e.error?i().createElement("p",{className:"mt-2 small text-danger"},t):i().createElement(i().Fragment,null)}function zt(e){return zt="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},zt(e)}function Ht(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 Wt(){Wt=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==zt(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(zt(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Qt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=zt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=zt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==zt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Yt="data:image/png;base64,";function Kt(e){return Kt="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},Kt(e)}var $t="cv-missing-word-";function Xt(e){return Xt="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},Xt(e)}function Jt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Xt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Xt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var en=n(41347);function tn(e){return tn="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},tn(e)}function nn(e){return nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nn(e)}function rn(e){return rn="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},rn(e)}function on(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=rn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=rn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var an=function(){return!0},cn=function(){return!1},ln=on(on(on(on(on(on(on({},O.Z9.Annotation,cn),O.Z9.Image,cn),O.Z9.MissingWord,an),O.Z9.MultipleChoice,an),O.Z9.ShortAnswer,(function(e){return!!e.data.suggestedResponse})),O.Z9.TrueOrFalse,an),O.Z9.Illustration,cn);function sn(e){return ln[e]}var un=on(on(on(on(on(on(on({},O.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}}))})),O.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))))})),O.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($t).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($t))return e;var l=e.replace($t,""),s=r.actionableItems.find((function(e){return e.order.toString()===l}));if(s){var u,f,d=t[s.id]||"",p=(u=s.name,(f=document.createElement("canvas").getContext("2d")).font="20pt arial",f.measureText(u).width);if(o){var m=s.name.toLowerCase().toString()===(null===(c=t[s.id])||void 0===c?void 0:c.toLowerCase().toString());return i().createElement(i().Fragment,{key:a},!m&&i().createElement(i().Fragment,null,i().createElement("del",{className:"text-danger"},d)," "),i().createElement("span",{className:"text-success"},s.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"!=Kt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Kt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Kt(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"===Kt(o)?o:o+""]));n(a,!0)}}(s,e)},value:d,disabled:!!t.submitted,className:"cv-missing-word-input",autoComplete:"off"}))}}))),i().createElement(Zt,{error:t.error}))})),O.Z9.MultipleChoice,(function(e){var t=e.state,n=e.setState,r=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,l=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),!l&&i().createElement("div",{className:"rounded bg-light-blue p-2 mb-2 text-small"},i().createElement(x.x,{svgName:C.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(ft,{interaction:r,showFeedback:o,onSelectAnswer:function(e,r){if(!t.submitted)if(l)n(r?Jt({},e.id,e.id):{},!0);else if(r)n(Jt({},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"===Xt(o)?o:o+""]));n(a,!0)}},getSelectedAnswer:function(e){return t[e]},imageApi:a.toString(),userInitials:$e.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar,leftHandSidePortalNode:e.leftHandSidePortalNode,submitted:!!t.submitted}),i().createElement(Zt,{error:t.error}))})),O.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(en.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"!=tn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=tn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==tn(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(Zt,{error:n.error}))})),O.Z9.TrueOrFalse,(function(e){var t=e.state,n=e.setState,r=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,l=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(wt,{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"!=nn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=nn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==nn(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:$e.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,l.name)),r.data.feedback&&i().createElement("p",{className:"h4"},r.data.feedback)),i().createElement(Zt,{error:t.error}))})),O.Z9.Illustration,(function(e){var t,n,r=e.interaction,o=e.state,a=e.fullWidthPortalNode,c=e.setState,l=(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ht(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)?Ht(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=l[0],u=l[1],f=o[r.actionableItems[0].id];return i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",{className:"h4 mb-3"},r.name),f?i().createElement(i().Fragment,null,i().createElement("img",{className:"img-fluid border rounded mb-2 w-75",src:f,alt:"Illustration"}),!o.submitted&&i().createElement(k.L,{className:"btn btn-outline-dark",onClick:function(){return u(!0)}},"Re-draw my answer")):i().createElement(k.L,{className:"btn btn-outline-dark",onClick:function(){return u(!0)}},"Draw my answer"),i().createElement(Zt,{error:o.error}),s&&i().createElement(Ae.Nq,{node:a},i().createElement(Gt,{interaction:r,onSave:function(t){c(Object.assign(Object.assign({},o),Qt({},r.actionableItems[0].id,t))),u(!1),e.recalculateScroll()},onCancel:function(){return u(!1)}})))}));function fn(){return""}var dn=on(on(on(on(on(on(on({},O.Z9.Annotation,fn),O.Z9.Image,fn),O.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"})),O.Z9.MultipleChoice,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),O.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"})),O.Z9.TrueOrFalse,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),O.Z9.Illustration,(function(e){return Object.keys(e).filter((function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.trim())})).length?null:"Please submit an illustration"})),pn=on(on(on(on(on(on(on({},O.Z9.Annotation,null),O.Z9.Image,null),O.Z9.MissingWord,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),O.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}})))})),O.Z9.ShortAnswer,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),O.Z9.TrueOrFalse,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t]}})))})),O.Z9.Illustration,(function(e,t,n,r){return i=this,o=void 0,a=void 0,c=Wt().mark((function i(){var o,a,c,l;return Wt().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!(o=e[t.actionableItems[0].id]||"").startsWith(Yt)){i.next=7;break}return a=o.replace(Yt,""),i.next=5,$.e.post("".concat(r.imageApi,"v2/thumbnails/base64"),'"'.concat(a,'"'),{tokenName:"gateway"});case 5:c=i.sent,o=c.location;case 7:return l=Object.keys(e).map((function(e){return{actionableItemId:e,value:o}})),i.next=10,n(t.id,l);case 10:return i.abrupt("return",Qt({},t.actionableItems[0].id,o));case 11:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}));var i,o,a,c}));function mn(e){return pn[e]}var hn=on(on(on(on(on(on(on({},O.Z9.Annotation,We.notApplicable),O.Z9.Image,We.notApplicable),O.Z9.MissingWord,(function(e,t){return We.isMissingWordCorrect(t,(function(t){return e[t]}))})),O.Z9.MultipleChoice,(function(e,t){return We.isMultipleChoiceCorrect(t,(function(t){return e[t]}))})),O.Z9.ShortAnswer,We.awaitingMarking),O.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})),O.Z9.Illustration,We.awaitingMarking);function vn(e){return hn[e]}var yn={feedback:"O6oD6"};function gn(e){var t=e.studentResults,n=e.interaction,r=e.timepoint,o=e.interactive,a=e.state,c=e.goToTimepoint,l=e.interactionNumber,s=e.imageCdnUrl,u=Ye(t),f=Ke(n.id,u),d=a.interactions[n.id],p=vn(n.typeId)(d||{},n),m=n.typeId!==O.Z9.Annotation&&n.typeId!==O.Z9.Image,h=m;n.typeId===O.Z9.MissingWord&&f&&(h=!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:yn.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:C.vn.Check})):p===E.Incorrect&&i().createElement("span",{className:"text-danger"},"Incorrect ",i().createElement(x.x,{className:"svg-container align-middle",svgName:C.vn.Close})))),i().createElement(L,{interaction:n,iconClassName:"flex-shrink-0",showQuestion:h,showTypeName:!0,questionClassName:"d-block w-100 mt-2",questionNumber:l})),m&&!f&&i().createElement("button",{className:"btn btn-dark",onClick:function(){return c(r.id,n.id)}},"Answer question"),f&&m&&i().createElement(Pt,{interaction:n,studentResults:t,markedStatus:Le.PendingReview,markInteraction:function(){},imageCdnUrl:s,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===O.Z9.TrueOrFalse?"Teacher's feedback":"Teacher's suggested response")),v))}var bn={interaction:"pUo8u"};function wn(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(bn.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 En={progress:"BnKli"};function Sn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function kn(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Sn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sn(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1],l=[];if(o.length){var s=o[0];l.push(s),o.forEach((function(e,t){0!==t&&(s.end.time+1>e.start.time&&s.start.time<e.start.time?s.end=e.end:(s=e,l.push(s)))}))}return 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,l.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:En.progress,style:{left:"".concat(n,"%"),right:"".concat(o,"%")}})})))}var xn=400;function On(e){return!!(null==e?void 0:e.toString().startsWith("new_"))}function Cn(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 Nn=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],l=vn(e.typeId)(t||{},e);l===E.Correct&&r++,l!==E.NotApplicable&&i++,l!==E.NotApplicable&&(null==t?void 0:t.submitted)&&o++,l===E.AwaitingMarking&&(a=!0);var s=Cn(t||{}),u=Object.keys(s).map((function(e){var t;return{id:e,text:null===(t=s[e])||void 0===t?void 0:t.toString()}}));u.length&&c.push({id:e.id,answeredAt:1,answers:u})}))})),{correctCount:r,total:i,answered:o,studentAttempts:c,awaitingMarking:a}},jn={bar:"gxTA_"};function Pn(e){return function(e){if(Array.isArray(e))return Ln(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||In(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 In(e,t){if(e){if("string"==typeof e)return Ln(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)?Ln(e,t):void 0}}function Ln(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 Tn(e){var t,n,r=e.showSummary,o=e.setShowSummary,a=e.state,c=e.interactive,l=e.player,s=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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||In(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=d[0],m=d[1];function h(){o(!1),l.show(),l.play()}function v(t,n){h(),e.goToTimepoint(t,n)}if(!u||!r)return i().createElement(i().Fragment,null);var y=Nn({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}]},O=0,N=l.ended(),j=l.duration();return i().createElement(Ae.Nq,{node:u},i().createElement("div",{className:"row pb-3"},i().createElement("div",{className:"col-4 col-xs-12"},i().createElement(Fe.Z,{data:l.poster(),imageType:De.__.Thumbnails,imageOptions:{size:De.h2.Medium}})),i().createElement("div",{className:"col-8 col-xs-12"},i().createElement("span",{className:"float-end"},i().createElement(_e.h,{svgName:C.vn.Play,className:"btn btn-outline-dark",onClick:function(){h(),l.ended()&&l.currentTime(0)}},N?"Play again":"Continue watching"),l.gradePassbackPlugin().enabled&&(p?i().createElement(k.L,{className:"btn btn-dark ms-2",onClick:function(){}},i().createElement(Te.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(_e.h,{svgName:C.vn.Check,className:"btn btn-dark ms-2",onClick:function(){m(!0),l.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(jn.bar),onClick:function(e){if(f.current){var t=f.current.getBoundingClientRect(),n=(e.pageX-t.left)/t.width*j;h(),l.currentTime(n)}},ref:f},i().createElement(kn,{duration:j,progress:s,interactive:c,player:l}),i().createElement(wn,{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(Pn(t),Pn(n.interactions.map((function(t){return O++,i().createElement(gn,{key:t.id,studentResults:x,interaction:t,timepoint:n,interactive:c,state:a,goToTimepoint:v,interactionNumber:O,imageCdnUrl:e.imageCdnUrl})}))))}),[])))))}function An(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _n(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)?_n(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 _n(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 Fn(e){var t=e.player,n=e.resultsService,r=e.interactive,o=e.setShowSummary,a=e.mobile,c=An(i().useState(!1),2),l=c[0],s=c[1],u=An(i().useState(!1),2),f=u[0],d=u[1],p=e.player.activePlugins_.activityStatusPlugin,m=e.player.activePlugins_.favouritePlugin;function h(){var e=t.currentTime(),n=r.timepoints[r.timepoints.length-1];f||e>n.visibleAt/1e3+1?s(!0):s(!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",h),function(){return t.off("timeupdate",h)}}),[f]),!l)return null;var y="btn btn-outline-dark cv-show-summary";return m&&(y+=" cv-has-favourite-plugin"),p&&(y+=" cv-has-activity-status-plugin"),i().createElement(k.L,{className:y,onClick:function(){o(!0),t.pause(),t.hide()}},t.gradePassbackPlugin().enabled?"Submit answers":"View summary")}function Dn(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 Rn(e){var t,n,r=e.resultsService,o=e.player,a=e.onShowSummary,c=e.mobile,l=(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Dn(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)?Dn(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=l[0],u=l[1];function f(e){u(e),a&&a(e)}function d(){f(!0),o.hide()}return i().useEffect((function(){if(r&&!c)return o.on("ended",d),function(){return o.off("ended",d)}}),[]),i().useEffect((function(){s&&o.isFullscreen()&&o.exitFullscreen()}),[s]),i().createElement(i().Fragment,null,i().createElement(Fn,Object.assign({setShowSummary:f},e)),i().createElement(Tn,Object.assign({showSummary:s,setShowSummary:f},e)))}var Mn=n(25692),Un=n(98985);function Vn(){var e=Un.o.getLiteArticle(Mn.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 Bn(e){var t=e.isCreate,n=e.interactive,r=e.interaction,o=e.portalNode,a=e.goToTimepoint,c=e.promptDelete,l=e.hasPlayPageV2;if(!o)return i().createElement(i().Fragment,null);var s=n.timepoints.reduce((function(e,t){return e+t.interactions.length}),0);return i().createElement(Ae.Nq,{node:o},s?i().createElement(i().Fragment,null,i().createElement("h2",{className:"h4 mt-3"},"Question List (",s,")"),i().createElement(R,{interactive:n,maxHeight:300,goToTimepoint:a,selectedInteractionId:null==r?void 0:r.id,onClickDelete:t?c:void 0,hasPlayPageV2:l,experimentalInteractiveQuestions:e.experimentalInteractiveQuestions})):t?i().createElement(Vn,null):i().createElement(i().Fragment,null))}var qn=n(90547),Gn=n(5256),Zn=n(30708);function zn(e,t){if(e){if("string"==typeof e)return Hn(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)?Hn(e,t):void 0}}function Hn(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 Wn=[O.Z9.MissingWord,O.Z9.MultipleChoice,O.Z9.TrueOrFalse,O.Z9.ShortAnswer,O.Z9.Image,O.Z9.Annotation];function Qn(e){var t,n,r=e.addInteraction,o=e.cancelTypeSelector,a=e.player,c=e.timepoint,l=e.open,s=e.isCreate,u=e.interaction,f=e.experimentalInteractiveQuestions,d=(t=i().useState((0,Zn.m)(a.currentTime()||0)),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||zn(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=d[0],m=d[1],h=[].concat(Wn);return f&&h.push.apply(h,function(e){return function(e){if(Array.isArray(e))return Hn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||zn(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Object.keys(O.IL))),i().useEffect((function(){var e=function(){m((0,Zn.m)(a.currentTime()))};return a.on("timeupdate",e),function(){return a.off("timeupdate",e)}}),[]),u||!s?i().createElement(i().Fragment,null):i().createElement("div",{className:"d-flex align-items-center justify-content-center h-100\n ".concat(f?"cv-experimental-types":"","\n ")},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:"," ",p),i().createElement("ul",{className:"list-unstyled row g-2\n ".concat(f?"row-cols-2":"row-cols-3")},h.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\n ".concat(f?" p-2 w-100 d-flex border justify-content-start align-items-center":"py-2 w-100 ".concat(a),"\n "),onClick:function(){return r(e)}},i().createElement("span",{className:"cv-create-type-icon\n ".concat(f?"text-shadow rounded ".concat(a," me-2"):"mb-1","\n ")},i().createElement(c,null)),i().createElement("div",{className:"d-flex align-items-center justify-content-center cv-interaction-type-name\n ".concat(f?"text-dark":"px-1 text-shadow","\n ")},o)))}))),(c||l)&&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 Yn=n(12704);function Kn(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 l=On(n.id);c.push({label:"Re-order questions",onClick:function(){return a("reorder")},className:l?"disabled":""})}return c.push({label:"Delete",onClick:function(){return r(n.id)},className:"text-danger"}),i().createElement(Ae.Nq,{node:o},!!n&&i().createElement(Yn.m,{actions:c,className:"p-0 mt-n2",dropdownToggleClassName:"p-0"}))}function $n(e){var t=e.interaction,n=e.interactionState,i=e.onClickContinue,o=e.onClickSave,a=e.onClickCancel,c=e.onClickAddAnother,l=e.onClickDiscard,s=On(t.id),u=!!(null==n?void 0:n.hasChanges),f=!!(null==n?void 0:n.spinner);return r.createElement("div",{className:"cv-timpoint-button-container"},s?r.createElement(k.L,{className:"btn btn-link",onClick:a},"Cancel"):u?r.createElement(k.L,{className:"btn btn-link",onClick:l},"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(Te.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):s?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(Pe,{className:"btn btn-dark ms-2",onClick:i,svgName:C.vn.Play},"Continue"))}function Xn(e){var t=e.typeId,n=e.interactionState,i=e.onClickSkip,o=e.numberOfInteractions,a=e.currentIndex,c=e.changeIndex,l=!!(null==n?void 0:n.submitted),s=!!(null==n?void 0:n.hasChanges),u=!!(null==n?void 0:n.spinner),f=!!mn(t),d=a<o-1;var p=a>0;return r.createElement("div",{className:"cv-timpoint-button-container flex-wrap"},!l&&f&&r.createElement(k.L,{className:"btn btn-link",onClick:i},"Come back later"),o>1&&a>0&&r.createElement(Pe,{className:"btn btn-dark ms-2 ".concat(p?"":"disabled"),onClick:function(){p&&c(a-1)},svgName:C.vn.ChevronUp}),u?r.createElement(k.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(Te.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):l||!f?1===o||a===o-1?r.createElement(Pe,{className:"btn btn-dark ms-2",onClick:i,svgName:C.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(s?"":"disabled"),onClick:function(){s&&e.onClickSubmit()}},"Save"))}function Jn(e){var t=e.isCreate,n=e.interaction,r=e.interactionState,o=e.continueInteractive,a=e.saveInteraction,c=e.cancel,l=e.addAnotherQuestion,s=e.discardChanges,u=e.submitInteractionAnswer,f=e.onClickSkip,d=e.changeIndex,p=e.timepoint,m=e.currentIndex;return i().createElement(i().Fragment,null,t?i().createElement($n,{interaction:n,interactionState:r,onClickContinue:o,onClickSave:a,onClickCancel:c,onClickAddAnother:l,onClickDiscard:function(){return s()}}):i().createElement(Xn,{typeId:n.typeId,interactionState:r,onClickSubmit:u,onClickSkip:f,changeIndex:d,currentIndex:m,numberOfInteractions:p.interactions.length}))}function er(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 tr(e){var t,n,r=e.typeId,o=e.currentIndex,a=e.numberOfInteractions,c=e.changeIndex,l=e.player,s=(t=i().useState((0,Zn.m)(l.currentTime()||0)),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return er(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)?er(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],f=s[1];i().useEffect((function(){var e=function(){f((0,Zn.m)(l.currentTime()))};return l.on("timeupdate",e),function(){return l.off("timeupdate",e)}}),[]);var d=j.w.getTypeInfo(r),p=d.name,m=d.bgClassName,h=o<a-1,v=o>0;return i().createElement("div",{className:"text-center d-flex justify-content-between align-items-center p-1 ".concat(m)},i().createElement(k.L,{onClick:function(){v&&c(o-1)},className:v?"":"invisible"},i().createElement(x.x,{size:x.S.Medium,svgName:C.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(){h&&c(o+1)},className:h?"":"invisible"},i().createElement(x.x,{size:x.S.Medium,svgName:C.vn.ChevronRight})))}var nr=n(29014),rr=n(2248),ir=n(3026),or=n(52076),ar={button:"nckQw"};function cr(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 lr=null,sr=!1,ur="shared.immersiveReader";function fr(e){var t,n,i=(t=r.useState(lr),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return cr(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)?cr(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 lr||sr||(sr=!0,(0,ir.ajaxRequest)({resource:"/api/integrations/token/immersive-reader",type:rr.k.GET,success:function(e){lr=e,a(e),window.setTimeout((function(){lr=null,sr=!1}),9e5)},error:function(){}})),o?(e.title||(e.title=Xe.T.getPhrase(ur,"titleFallback")),r.createElement("span",{className:"".concat(ar.button," ").concat(e.className||""),onClick:function(){s.q.isFunction(e.onLaunch)&&e.onLaunch(),or.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(){s.q.isFunction(e.onExit)&&e.onExit()}};nr.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 dr={reader:"Erirh"},pr=["A","B","C","D"];function mr(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 O.Z9.Annotation:c=t.data.annotation;break;case O.Z9.Image:c=t.data.caption;break;case O.Z9.MissingWord:c=t.data.sentence.replace(/{([^{}]*)}/g,(function(){return"<u>&nbsp;&nbsp;&nbsp;&nbsp;</u>"}));break;case O.Z9.MultipleChoice:c=t.name,t.actionableItems.map((function(e,t){return c+="<br />".concat(pr[t],": ").concat(e.name)}));break;case O.Z9.ShortAnswer:c=t.name;break;case O.Z9.TrueOrFalse:c="True or false: ".concat(t.name)}var l=t.typeId===O.Z9.Annotation||t.typeId===O.Z9.MissingWord||t.typeId===O.Z9.MultipleChoice;return i().createElement(fr,{title:o,text:c,html:l,className:"".concat(dr.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 hr(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(mr,{interaction:e.interaction,className:"ms-2",enableImmersiveReader:e.enableImmersiveReader}))}function vr(e){var t=e.isCreate,n=e.interaction,r=e.player,o=e.changeIndex,a=e.timepointState,c=e.timepoint;return t?i().createElement(tr,{typeId:n.typeId,changeIndex:o,player:r,currentIndex:a.interactionIndex,numberOfInteractions:c.interactions.length}):i().createElement(hr,{interaction:n,enableImmersiveReader:e.enableImmersiveReader})}var yr=n(10671),gr=n(98886),br=n(6880);function wr(e){var t=e.error;return e.error?i().createElement("p",{id:e.id,className:"mt-2 small text-danger",role:"status"},t):i().createElement(i().Fragment,null)}function Er(e){return Er="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},Er(e)}function Sr(){Sr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Er(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Er(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function kr(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,xr(r.key),r)}}function xr(e){var t=function(e,t){if("object"!=Er(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Er(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Er(t)?t:t+""}var Or=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Cr=function(e){return"/api/domain/v1/interactions/".concat(e)},Nr=function(e){return"/api/domain/v1/timepoints/".concat(e)},jr={},Pr=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 Or(this,void 0,void 0,Sr().mark((function t(){var n,r,i,o,a;return Sr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=On(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),jr):$.e.put(r,JSON.stringify(i),jr),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 Or(this,void 0,void 0,Sr().mark((function t(){return Sr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,$.e.delete(Cr(e),jr);case 2:case"end":return t.stop()}}),t)})))}},{key:"saveTimepoint",value:function(e){return Or(this,void 0,void 0,Sr().mark((function t(){var n,r;return Sr().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),jr);case 3:r=t.sent,e.id=r.id;case 5:case"end":return t.stop()}}),t)})))}},{key:"updateTimepoint",value:function(e){return Or(this,void 0,void 0,Sr().mark((function t(){return Sr().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),jr);case 2:case"end":return t.stop()}var n}),t)})))}},{key:"deleteTimepoint",value:function(e){return Or(this,void 0,void 0,Sr().mark((function t(){return Sr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,$.e.delete(Nr(e),jr);case 2:case"end":return t.stop()}}),t)})))}}])&&kr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()),Ir={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 Lr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Tr(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)?Tr(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 Tr(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 Ar(e){var t=Lr(i().useState(""),2),n=t[0],r=t[1],o=Lr(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 _r(e){return _r="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},_r(e)}function Fr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Dr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function 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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==_r(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(_r(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function 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 Ur(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vr(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)?Vr(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 Vr(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 Br(){Br=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(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=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var qr=n(48088);function Gr(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 Zr=!0,zr=function(e){"boolean"==typeof e&&(Zr=e);var t,n,r=(t=i().useState(Zr),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Gr(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)?Gr(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=qr.Radio.channel("video:drag:drop:lock");function l(){a(Zr)}return i().useEffect((function(){if(Zr)return c.on("update",l),function(){c.off("update",l)}}),[]),{enabled:o,disable:function(){Zr=!1,c.trigger("update")},enable:function(){Zr=!0,c.trigger("update")}}};function Hr(){var e=zr(),t=e.enable,n=e.disable;i().useEffect((function(){return n(),function(){return t()}}),[])}var Wr=n(24365),Qr=n(99828),Yr={onFileSelect:function(e,t,n,r){if(t&&t.length){var i=new FileReader;i.addEventListener("load",(function(){return Yr.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:Qr.y[t].width,l=null!==(o=null==r?void 0:r.height)&&void 0!==o?o:Qr.y[t].height;a.addEventListener("load",(function(){Yr.isImageValid(t,a,r)&&s.q.isFunction(n)?n(a):alert("Image too small: minimum dimensions are ".concat(c," x ").concat(l))}))},isImageValid:function(e,t,n){var r,i,o=null!==(r=null==n?void 0:n.width)&&void 0!==r?r:Qr.y[e].width,a=null!==(i=null==n?void 0:n.height)&&void 0!==i?i:Qr.y[e].height;return!(o&&t.width<o||a&&t.height<a)},mapImageTypeToString:function(e){switch(e){case De.__.Avatars:return"avatars";case De.__.Thumbnails:return"thumbnails";case De.__.Logos:return"logos";case De.__.Covers:return"covers";case De.__.Posters:return"posters";case De.__.TallPosters:return"tallposters";case De.__.HeroBanners:return"herobanners";case De.__.None:default:return""}}};function Kr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $r(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)?$r(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 $r(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 Xr(e){var t=Kr(i().useState(!1),2),n=t[0],r=t[1],o=Kr(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 Jr(e){return Jr="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},Jr(e)}function ei(){ei=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Jr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Jr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ti(e){return ti="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},ti(e)}function ni(){ni=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ti(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ti(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var ri=/[.\?!,;:\-''\(\)]/g;function ii(e){for(var t=e.split("");t.length&&t[0].match(ri);)t.shift();for(;t.length&&t[t.length-1].match(ri);)t.pop();return t.join("")}function oi(e,t){for(var n=e.split(""),r=[],i=[];n.length&&n[0].match(ri);)r.push(n.shift());for(;n.length&&n[n.length-1].match(ri);)i.unshift(n.pop());return r.join("")+t+i.join("")}function ai(e){return e.map((function(e){if(!e.selected)return e.text;var t=ii(e.text).length,n=new Array(t).fill("_").join("");return oi(e.text,n)})).join(" ")}function ci(e){return e.map((function(e){var t;return e.selected?null===(t=oi(e.text,"{".concat(e.order,"}")))||void 0===t?void 0:t.trim():e.text})).join(" ")}var li=n(63946);function si(e){return i().createElement(li.u,{title:e.tooltipText,spanHack:!0,spanHackClassName:"d-inline-block"},i().createElement(x.x,{svgName:C.vn.Info}))}function ui(){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 fi(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]&&Yr.onFileSelect(De.__.None,t,(function(e){Wr.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:l})}))}function l(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(Xr,{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(li.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:C.vn.Delete})))):i().createElement(li.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(ui,null))))))}function di(e){return di="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},di(e)}function pi(){pi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==di(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(di(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function mi(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 hi(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=pi().mark((function r(){return pi().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,Pr.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))}function vi(e){var t=e.state,n=void 0===t?function(e){var t,n=e.typeId===O.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,l=o.typeId===O.Z9.TrueOrFalse;function s(e){var t,i,o=n.answers.map((function(t){return t.order!==e.order?Object.assign(Object.assign({},t),{isCorrect:!l&&t.isCorrect}):e}));if(o.find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)}))&&(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})}))),!l&&o.length<4&&!o.find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)}))){var a=Qe.m.last(o);o.push({name:"",order:a.order+1,isCorrect:!1,data:void 0})}r(Object.assign(Object.assign({},n),{answers:o}))}return Hr(),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(Ae.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(wr,{error:n.error})),i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"multiple-choice-answer"},l?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(fi,{answer:t,onChange:s,isTrueOrFalse:l,imageApi:e.imageApi}))}))),n.question&&i().createElement(wr,{error:n.error})),c&&l&&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(si,{tooltipText:"Provide answer feedback for your students"})),i().createElement(en.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 yi(e){return yi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yi(e)}function gi(){gi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==yi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(yi(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function bi(e){return bi="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},bi(e)}function wi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=bi(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=bi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bi(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ei=wi(wi(wi(wi(wi(wi(wi({},O.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=Fr(i().useState(function(){var e=o.data.annotation;if(e){var t=(0,gr.h4)(Ir)(e);return br.EditorState.createWithContent(t)}return br.EditorState.createEmpty()}()),2),l=c[0],s=c[1],u=Fr(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(Ae.t0,{node:a})),i().createElement("div",{className:"cv-annotation ".concat(function(){if(!l)return!1;var e=l.getCurrentContent();return e.hasText()||"unstyled"!==e.getBlockMap().first().getType()}()?"Editor--hide-placeholder":"")},l&&i().createElement(yr.Editor,{editorState:l,onEditorStateChange:function(e){s(e);var t=e.getCurrentContent();if(t.hasText()){var i=(0,gr.cn)(Ir)(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:Ar,options:["link"]}}}),i().createElement(wr,{error:n.error}))))})),O.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;Hr();var c=i().useRef(null);function l(e){e&&e[0]&&Yr.onFileSelect(De.__.None,e,(function(e){Wr.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:s})}))}function s(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(Ae.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(Xr,{onDropImage:l,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 l(e.target.files)}}))),i().createElement(wr,{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})))})),O.Z9.MissingWord,(function(e){var t,n,r,o,a,c,l=e.state,s=void 0===l?(o=(null===(n=(t=e.interaction).data)||void 0===n?void 0:n.sentence)||"",a=o.split(" ").filter(Boolean),c=a.map((function(e,t){return{text:e,order:t,selected:!1}})),null===(r=t.actionableItems)||void 0===r||r.forEach((function(e){var t=e.order,n=oi(a[t],e.name);a[t]=n,c[t].text=n,c[t].selected=!0})),{fullSentence:a.join(" "),sentence:o,preview:t.name,words:c}):l,u=e.setState,f=e.optionsPortalNode,d=!!s.sentence;return 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(Ae.t0,{node:f})),i().createElement("input",{id:"missing-word-sentence",className:"form-control",placeholder:"Enter your sentence here",value:s.fullSentence||"",onChange:function(e){var t=e.target.value,n=t.split(" ").filter(Boolean).map((function(e,t){return{text:e,order:t,selected:!1}}));u(Object.assign(Object.assign({},s),{fullSentence:t,sentence:ci(n),preview:ai(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"},s.words.map((function(e,t){var n;return(null===(n=ii(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=s.words.map((function(t){return t.order!==e?t:Object.assign(Object.assign({},t),{selected:!t.selected})})),void u(Object.assign(Object.assign({},s),{words:n,preview:ai(n),sentence:ci(n)}));var e,n}},ii(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,s.preview))),i().createElement(wr,{error:s.error}))})),O.Z9.MultipleChoice,vi),O.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(Ae.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(wr,{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(si,{tooltipText:"Provide a suggested response for your students"})),i().createElement(en.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"})))})),O.Z9.TrueOrFalse,vi),O.Z9.Illustration,(function(e){var t=Ur(i().useState(),2),n=t[0],r=t[1],o=Ur(i().useState(!1),2),a=o[0],c=o[1],l=e.state,s=void 0===l?{question:e.interaction.name}:l,u=e.setState,f=e.optionsPortalNode;return i().createElement("div",{className:"cv-interactive-question"},i().createElement("fieldset",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"illustration-question"},"Prompt"),i().createElement(Ae.t0,{node:f})),i().createElement("input",{id:"illustration-question",className:"form-control",onChange:function(e){u(Object.assign(Object.assign({},s),{question:e.target.value}))},value:s.question||"",placeholder:"Enter your prompt here",autoComplete:"off","aria-invalid":!!s.error,"aria-errormessage":"illustrationQuestionError"}),i().createElement(wr,{id:"illustrationQuestionError",error:s.error})),i().createElement("div",{className:"alert text-dark bg-light-blue px-2 rounded-3"},"Students attempting this question will be prompted to draw their answer. ",i().createElement(k.L,{onClick:function(){return c(!0)},className:"btn-link text-underline d-inline"},"Preview how students will answer.")),a&&i().createElement(Ae.Nq,{node:e.fullWidthPortalNode},i().createElement(Gt,{interaction:Object.assign(Object.assign({},e.interaction),{name:s.question}),onSave:function(e){r(e),c(!1)},onCancel:function(){return c(!1)}})),n&&i().createElement("img",{className:"img-fluid border rounded mt-2 w-50 d-block",src:n,alt:"Illustration you just created."}))})),Si=wi(wi(wi(wi(wi(wi(wi({},O.Z9.Annotation,(function(e){var t;return(null===(t=e.annotation)||void 0===t?void 0:t.trim())?null:"Please provide an annotation"})),O.Z9.Image,(function(e){return e.url?null:"Please upload an image"})),O.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"})),O.Z9.MultipleChoice,mi),O.Z9.ShortAnswer,(function(e){var t;return(null===(t=e.question)||void 0===t?void 0:t.trim())?null:"Please provide a question"})),O.Z9.TrueOrFalse,mi),O.Z9.Illustration,(function(e){var t;return(null===(t=e.question)||void 0===t?void 0:t.trim())?null:"Please provide a question"})),ki=wi(wi(wi(wi(wi(wi(wi({},O.Z9.Annotation,(function(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=Rr().mark((function r(){return Rr().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,Pr.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))})),O.Z9.Image,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=ei().mark((function i(){return ei().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,Pr.saveInteraction(t);case 6:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}))})),O.Z9.MissingWord,(function(e,t){return n=this,r=void 0,i=void 0,o=ni().mark((function n(){var r;return ni().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.data.sentence=ci(e.words),t.name=e.preview,r=e.words.filter((function(e){return e.selected})),t.actionableItems=r.map((function(e){return{name:ii(e.text),order:e.order,isCorrect:!0}})),n.next=6,Pr.saveInteraction(t);case 6:case"end":return n.stop()}}),n)})),new(i||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function c(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}l((o=o.apply(n,r||[])).next())}));var n,r,i,o})),O.Z9.MultipleChoice,hi),O.Z9.ShortAnswer,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=gi().mark((function i(){return gi().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,Pr.saveInteraction(t);case 5:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}))})),O.Z9.TrueOrFalse,hi),O.Z9.Illustration,(function(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=Br().mark((function r(){return Br().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t.name=null===(n=e.question)||void 0===n?void 0:n.trim(),t.actionableItems=[{name:"Answer"}],r.next=4,Pr.saveInteraction(t);case 4:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))}));function xi(e){return ki[e]}function Oi(e){return Oi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oi(e)}function Ci(){Ci=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Oi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Oi(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ni(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ji(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)?ji(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 ji(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 Pi=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Ii=13,Li=37,Ti=39,Ai=null,_i=0,Fi=1;function Di(e){var t=e.timepoint,n=e.updateTimepointTime,r=e.saveTimepoint,o=e.back,a=e.clearTimepointTimeState,c=Ni(i().useState((0,Zn.m)(t.visibleAt/1e3)),2),l=c[0],s=c[1],u=Ni(i().useState(!1),2),f=u[0],d=u[1];function p(e){n(e*Fi),s((0,Zn.m)(t.visibleAt/1e3)),2==++_i?Fi=5:4===_i?Fi=20:6===_i?Fi=60:8===_i&&(Fi=120),Ai||(Ai=window.setInterval((function(){return p(e)}),200),window.addEventListener("mouseup",m))}function m(){window.removeEventListener("mouseup",m),window.clearInterval(Ai),Ai=null,_i=0,Fi=1}return i().useEffect((function(){return m}),[]),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===Ii&&0===_i&&p(-1)},onKeyUp:m}),i().createElement("input",{id:"move-time-point",className:"form-control text-center d-inline-block cv-move-timepoint-input",value:l,onChange:function(){},onKeyDown:function(e){e.stopPropagation(),e.keyCode===Li&&0===_i&&p(-1),e.keyCode===Ti&&0===_i&&p(1)},onKeyUp:m}),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===Ii&&0===_i&&p(1)},onKeyUp:m}))))),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(Te.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(k.L,{className:"btn btn-dark",onClick:function(){return Pi(this,void 0,void 0,Ci().mark((function e(){return Ci().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 Ri=n(20455),Mi=n(95339),Ui=n(67445);function Vi(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 Bi(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Vi(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)?Vi(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,Ri.Dy)((0,Ri.VT)(Ri.we,{activationConstraint:{distance:10}}),(0,Ri.VT)(Ri.Lg,{coordinateGetter:Ui.is}));return e.disabled?i().createElement(i().Fragment,null,e.children):i().createElement(Ri.LB,{sensors:c,collisionDetection:Ri.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(Ui.Fo,{items:e.ids,strategy:e.vertical?Ui.qw:Ui.U2},e.children),i().createElement(Ri.y9,{dropAnimation:e.dropAnimation},o?e.getDragOverlay(o):null))}Bi.defaultProps={dropAnimation:{duration:250,easing:"ease"},vertical:!0};var qi=n(17592);function Gi(e){var t=(0,Ui.nB)({id:e.id}),n=t.setNodeRef,r=t.transform,o=t.transition,a=t.isSorting,c=t.listeners,l=t.attributes,s=t.activeIndex,u=t.overIndex,f=t.index,d={transform:qi.ux.Transform.toString(r),transition:o,touchAction:"none",position:"relative"};a&&f===s&&(d.visibility="hidden");var p=e.childComponent,m=function(e,t,n){return t!==e?null:n>t?"down":n<t?"up":null}(f,s,u);return i().createElement(p,Object.assign({},e.childProps,{ref:n,style:d,dragListeners:c,dragAttributes:l,dragDirection:m}))}function Zi(e){return Zi="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},Zi(e)}function zi(){zi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Zi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Zi(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Hi(e){return function(e){if(Array.isArray(e))return Yi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Qi(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 Wi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||Qi(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 Qi(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}}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}var Ki=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},$i=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:C.vn.Handle})),i().createElement(L,{interaction:t,iconClassName:"".concat("GSE1a"," ").concat(n),questionClassName:"".concat("qKMzc"," clamp-1")}))}));return i().createElement(Gi,{id:t.id,childComponent:r,childProps:{}})},Xi=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(Bi,{ids:t.map((function(e){return e.id})),getDragOverlay:function(e){return i().createElement($i,{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($i,{key:e.id,interaction:e})}))))};function Ji(e){var t=Wi(i().useState(!1),2),n=t[0],r=t[1],o=Wi(i().useState(Hi(e.interactions)),2),a=o[0],c=o[1],l=Wi(i().useState(!1),2),s=l[0],u=l[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(Xi,{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(Hi(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(Hi(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(Te.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(k.L,{className:"btn btn-dark ".concat(s?"":"disabled"),onClick:function(){return Ki(this,void 0,void 0,zi().mark((function t(){return zi().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s){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 eo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return to(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?to(e,t):void 0}}(e,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 to(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function no(e){var t=e.isCreate,n=e.interaction,r=e.mode,o=e.immediateFeedback,a=e.interactionState,c=e.shouldFocus,l=e.delayFocus,s=e.open,u=e.timepoint,f=e.userUpdateInteractionState,d=e.submitInteractionAnswer,p=e.saveInteraction,m=e.skip,h=i().useRef(),v=i().useRef(),y=i().useRef(0),g=(0,Gn.a)(qn.r.XLDown),b=!t||g;function w(){return!!h.current&&!!c&&!!s}function E(){h.current&&(h.current.focus(),x(!0))}var S=eo(i().useState(!1),2),k=S[0],x=S[1];i().useEffect((function(){w()&&(k||(l&&b?y.current=window.setTimeout((function(){y.current=0,w()&&E()}),xn):E()))}),[h.current,k]);var O=eo(i().useState("question"),2),C=O[0],N=O[1],j=i().useMemo((function(){return(0,Ae.oD)()}),[]),P=n?function(e,t){if(t===M.Create)return function(e){return Ei[e]}(e);if(t===M.View)return function(e){return un[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(Kn,Object.assign({optionsPortalNode:j,setView:N},e)),i().createElement(nt.Z,{className:"h-100",ref:v},i().createElement(Qn,Object.assign({},e)),!!n&&i().createElement("div",{className:"d-flex flex-column h-100"},i().createElement(vr,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:h,tabIndex:0}),i().createElement(P,Object.assign({state:a,setState:f,recalculateScroll:function(){v.current.recalculate()},showFeedback:I,optionsPortalNode:j},e)))),i().createElement(Jn,Object.assign({onClickSkip:function(){y.current&&window.clearTimeout(y.current),m()}},e))),"move"===C&&i().createElement(Di,Object.assign({back:function(){return N("question")}},e)),"reorder"===C&&i().createElement(Ji,Object.assign({back:function(){return N("question")},interactions:u.interactions},e)))))}function ro(e){var t=e.open,n=e.nextInteraction,r=e.nextInteractionState,o=e.timepointState,a=e.interaction,c=e.delayFocus,l=e.experimentalInteractiveQuestions,s=i().useMemo((function(){return(0,Ae.oD)({attributes:{class:"cv-interactive-lhs"}})}),[]),u=i().useMemo((function(){return(0,Ae.oD)({attributes:{class:"cv-interactive-full"}})}),[]),f=n&&o.nextInteractionIndex<o.interactionIndex,d=n&&o.nextInteractionIndex>o.interactionIndex,p=d&&o.slideIn,m=f&&o.slideIn,h=t&&!f&&!d;return i().createElement(i().Fragment,null,i().createElement("div",{className:"cv-interactive-full-container ".concat(h?"":"cv-closed-full")},i().createElement(Ae.t0,{node:u})),i().createElement("div",{className:"cv-interactive-lhs-container ".concat(h?"":"cv-closed-lhs")},i().createElement(Ae.t0,{node:s})),i().createElement("div",{className:"cv-interactive ".concat(t?"cv-open":"")},f&&i().createElement("div",{className:"cv-prev-interaction ".concat(o.slideIn?"cv-slide-in":"")},i().createElement(no,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:r}))),i().createElement("div",{className:"\n cv-main-slide\n ".concat(p?"cv-slide-out-up":"","\n ").concat(m?"cv-slide-out-down":"","\n ").concat(n?"cv-transitioning":"","\n ")},i().createElement(no,Object.assign({key:null==a?void 0:a.id},e,{currentIndex:o.interactionIndex,shouldFocus:a&&!f&&!d,delayFocus:c,leftHandSidePortalNode:s,fullWidthPortalNode:u,experimentalInteractiveQuestions:l}))),d&&i().createElement("div",{className:"cv-next-interaction ".concat(o.slideIn?"cv-slide-in":"")},i().createElement(no,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:r})))))}function io(e){return io="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},io(e)}function oo(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=io(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=io(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==io(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ao={interactions:{},timepoints:{}};function co(e,t){return"interaction"===t.type?{timepoints:e.timepoints,interactions:Object.assign(Object.assign({},e.interactions),oo({},t.id,t.value))}:"timepoint"===t.type?{interactions:e.interactions,timepoints:Object.assign(Object.assign({},e.timepoints),oo({},t.id,t.value))}:void 0}function lo(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 so={interactionIndex:0},uo=function(e){var t,n,r=e.mode,o=e.timepoint,a=e.latestSession,c=r===M.Create,l=i().useReducer(co,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]),oo(oo({},t.actionableItemId,t.data),"submitted",!0)),e}),{})}:ao}(a)})),s=(n=2,function(e){if(Array.isArray(e))return e}(t=l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return lo(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)?lo(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],f=s[1],d=y(null==o?void 0:o.id),p=null==o?void 0:o.interactions[d.interactionIndex],m="number"==typeof d.nextInteractionIndex?null==o?void 0:o.interactions[d.nextInteractionIndex]:null,h=g(null==p?void 0:p.id),v=g(null==m?void 0:m.id);function y(e){return e&&u.timepoints[e]||so}function g(e){if(!e)return{};var t=u.interactions[e];return t||c?t:{}}function b(e,t,n){var r=g(e);f({type:"interaction",id:e,value:Object.assign(Object.assign({},n?{}:r),t)})}return{state:u,interaction:p,interactionState:h,timepointState:d,nextInteraction:m,nextInteractionState:v,getTimepointState:y,getInteractionState:g,updateTimepointState:function(e,t){var n=y(e);f({type:"timepoint",id:e,value:Object.assign(Object.assign({},n),t)})},updateInteractionState:b,clearTimepointState:function(e){f({type:"timepoint",id:e,value:void 0})},clearInteractionState:function(e){f({type:"interaction",id:e,value:void 0})},userUpdateInteractionState:function(e,t){b(p.id,Object.assign(Object.assign({},e),{hasChanges:!0,error:null}),t)}}};function 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 po(){po=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==fo(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(fo(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var mo=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},ho=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},vo=!1;function yo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return go(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)?go(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 go(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 bo=n(25417),wo=n(81937),Eo=n(69184);function So(e,t){if(e){if("string"==typeof e)return ko(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)?ko(e,t):void 0}}function ko(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 xo=Xe.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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||So(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=qr.Radio.channel(bo.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 ko(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||So(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 l(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);s.q.isFunction(n.renderCustomDialog)?n.renderCustomDialog():Ft(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||l(e.id)})),window.removeEventListener("beforeunload",f),q.Q.C$.trigger(e)}(e)},variant:"danger",text:xo("discard")},cancelButtonProps:{text:xo("cancel"),variant:"outline-dark"}})}}function f(e){var t=r.find((function(e){return e.allowAppLinks}));return t||(t=Qe.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:xo("navLockTitle"),text:xo("navLockBody"),allowAppLinks:!0})}var t=qr.Radio.channel(Eo.Q4.VIDEO_UPLOAD);return t.on(wo.S.FILES_ADDED,e),t.on(wo.S.UNLOCK_NAV,l),function(){t.off(wo.S.FILES_ADDED,e),t.off(wo.S.UNLOCK_NAV,l)}}),[]),{lock:c,unlock:l}};function Co(e){return Co="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},Co(e)}function No(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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,Io(r.key),r)}}function Po(e,t,n){return t&&jo(e.prototype,t),n&&jo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Io(e){var t=function(e,t){if("object"!=Co(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Co(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Co(t)?t:t+""}function Lo(e,t,n){return t=_o(t),function(e,t){if(t&&("object"==Co(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||[],_o(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 Ao(){return Ao="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=_o(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ao.apply(null,arguments)}function _o(e){return _o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_o(e)}function Fo(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&&Do(e,t)}function Do(e,t){return Do=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Do(e,t)}var Ro=function(e){function t(e,n){return No(this,t),Lo(this,t,[e,n])}return Fo(t,e),Po(t,[{key:"dispose",value:function(){var e=this;setImmediate((function(){var t;null===(t=e.root)||void 0===t||t.unmount()})),Ao(_o(t.prototype),"dispose",this).call(this)}}])}(ae.Z.getComponent("Component")),Mo={tagName:"div"};function Uo(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mo;if(!e)throw new Error("componentCtor is required");var n=function(n){function r(){return No(this,r),Lo(this,r,arguments)}return Fo(r,n),Po(r,[{key:"createEl",value:function(){var n=ae.Z.dom.createEl(t.tagName,t.properties,t.attributes),r=(0,Tt.s)(n);return r.render(e(this.player_,this.options_)),this.root=r,n}}])}(Ro);return n}var Vo=n(42120),Bo=n(50028);function qo(e){var t,n=!e.parentVideo||(null===(t=e.parentVideo)||void 0===t?void 0:t.status)===Bo.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:C.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(Ae.Nq,{node:e.portalNode},i().createElement(Vo.e,{actions:o,actionsDropdownClassName:"btn btn-outline-dark ms-2"})):i().createElement(i().Fragment,null)}var Go=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Zo(e){var t=e.title,n=e.player,r=e.track,o=e.mode,a=e.interactive,c=e.imageApi,l=e.actionsPortalNode,s=e.questionListPortalNode,u=e.summaryPortalNode,f=e.resultsService,p=e.currentUser,m=e.progress,h=e.latestSession,v=e.clipOffset,y=e.analyticsService,g=e.enableImmersiveReader,b=e.mobile,w=e.parentVideo,E=e.hasPlayPageV2,S=e.experimentalInteractiveQuestions,k=function(e){var t=e.player,n=e.track,r=e.interactive,o=e.clipOffset,a=yo(i().useState(!1),2),c=a[0],l=a[1],s=yo(i().useState(!1),2),u=s[0],f=s[1],d=yo(i().useState(null),2),p=d[0],m=d[1];function h(e){return o?e+o:e}function v(e){f(!!e&&c),l(e)}function y(){var e=n.activeCues;if(!e.length)return v(!1),void m(null);var i=r.timepoints.find((function(t){return t.id.toString()===e[0].text.toString()}));if(!i)return v(!1),void m(null);i.shouldPause&&(t.seeking()?t.one("play",(function(){return t.pause()})):t.pause()),v(!0),m(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:h(r)-.001,endTime:h(r+1),text:e}),n.trigger("cv:cuechange"),t.paused()&&n.trigger("cuechange")},removeCue:function(e){e=h(e);for(var t=0;t<n.cues.length;){var r=n.cues[t];if(r.startTime<=e&&r.endTime>=e){n.removeCue(r),n.trigger("cv:cuechange"),n.trigger("cuechange");break}t++}},moveTimepoint:function(e){var r=g(p.id);if(r){var i=e/1e3;r.startTime=h(i),r.endTime=h(i+1),t.currentTime(i+.5,!0),p.visibleAt=e,n.trigger("cv:cuechange")}},getClipOffset:h}}({player:n,track:r,interactive:a,mode:o,clipOffset:v}),x=k.open,O=k.timepoint,C=k.wasOpen,N=Go(k,["open","timepoint","wasOpen"]),P=function(e){var t=e.interactive,n=e.timepoint,r=e.player,o=e.mode,a=e.resultsService,c=e.latestSession,l=e.analyticsService,s=e.imageApi,u=ho(e,["interactive","timepoint","player","mode","resultsService","latestSession","analyticsService","imageApi"]),f=uo({mode:o,timepoint:n,latestSession:c}),p=f.state,m=f.interaction,h=f.interactionState,v=f.timepointState,y=f.nextInteraction,g=f.nextInteractionState,b=ho(f,["state","interaction","interactionState","timepointState","nextInteraction","nextInteractionState"]),w=o===M.Create;function E(e){for(var n=0;n<t.timepoints.length;){for(var r=t.timepoints[n],i=0;i<r.interactions.length;){var o=r.interactions[i];if(o.id===e)return{localTimepoint:r,localInteraction:o};i++}n++}return{localInteraction:null,localTimepoint:null}}function S(e){var n=j.w.getTypeInfo(e.typeId);return{id:On(e.id)?void 0:e.id,typeId:e.typeId,type:n.typeName,interactiveId:t.id,timepointId:On(e.timepointId)?void 0:e.timepointId,order:e.order}}function k(e){return mo(this,void 0,void 0,po().mark((function n(){var r,i,o,a,c,s,f;return po().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=E(e),i=r.localInteraction,o=r.localTimepoint,i&&o){n.next=3;break}throw new Error("Could not find the interaction and timepoint for the interactionId ".concat(e));case 3:if(a=S(i),On(i.id)){n.next=10;break}return n.next=7,Pr.deleteInteraction(i.id);case 7:null==l||l.logUserAction(a,{actionType:d.Vw.Delete,entity:d.py.Interaction,workflowPhase:d.eu.Complete}),n.next=11;break;case 10:null==l||l.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),b.clearInteractionState(i.id),s=b.getTimepointState(o.id),c<s.interactionIndex&&b.updateTimepointState(o.id,{interactionIndex:s.interactionIndex-1}),!(o.interactions.length>0)){n.next=18;break}return n.abrupt("return");case 18:if(On(o.id)){n.next=21;break}return n.next=21,Pr.deleteTimepoint(o.id);case 21:f=t.timepoints.findIndex((function(e){return e.id===o.id})),t.timepoints.splice(f,1),u.removeCue(o.visibleAt/1e3),b.clearTimepointState(o.id);case 25:case"end":return n.stop()}}),n)})))}function x(e){if(m){var t=On(m.id);t||(null==h?void 0:h.hasChanges)||(null==v?void 0:v.hasChanges)?Ft(i().createElement("p",null,"Do you want to discard your changes?"),{title:"Unsaved changes",submitButtonProps:{onClick:function(){(null==v?void 0:v.hasChanges)&&I(!0),t?k(m.id):b.clearInteractionState(m.id),e&&e()},variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}}):e&&e()}else e&&e()}function O(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(w)x((function(){b.updateTimepointState(n.id,{interactionIndex:e})}));else{var r=function(){b.updateTimepointState(n.id,{nextInteractionIndex:e}),window.requestAnimationFrame((function(){b.updateTimepointState(n.id,{nextInteractionIndex:e,slideIn:!0}),window.setTimeout((function(){b.updateTimepointState(n.id,{interactionIndex:e,nextInteractionIndex:null,slideIn:null})}),xn)}))};t?x(r):r()}}function C(){v.interactionIndex+1>=n.interactions.length?u.continueInteractive():O(v.interactionIndex+1,!1)}function N(){t.timepoints.sort((function(e,t){return e.visibleAt>t.visibleAt?1:t.visibleAt>e.visibleAt?-1:0}))}function P(){O(n.interactions.length)}function I(e){(null==v?void 0:v.hasChanges)&&(e&&u.moveTimepoint(v.originalVisibleAt),b.updateTimepointState(n.id,{hasChanges:void 0,originalVisibleAt:void 0}),vo=!1)}return{state:p,interaction:m,interactionState:h,timepointState:v,nextInteraction:y,nextInteractionState:g,skip:C,cancel:function(){return mo(this,void 0,void 0,po().mark((function e(){return po().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==h?void 0:h.hasChanges)){e.next=3;break}return x(),e.abrupt("return");case 3:return e.next=5,k(m.id);case 5:u.setOpen(!0);case 6:case"end":return e.stop()}}),e)})))},addAnotherQuestion:P,goToTimepoint:function(e,n){var 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),b.updateTimepointState(i.id,{interactionIndex:i.interactions.indexOf(o)})},discardChanges:x,changeIndex:O,promptDelete:function(e){var t=S(E(e).localInteraction);null==l||l.logUserAction(t,{actionType:d.Vw.Delete,entity:d.py.Interaction,workflowPhase:d.eu.Start}),Ft(i().createElement("p",null,"Are you sure you want to delete this question?"),{title:"Delete question",submitButtonProps:{onClick:function(){return k(e)},variant:"danger",text:"Delete question"},cancelButtonProps:{variant:"link",text:"Cancel"}})},showTypeSelector:function(){r.pause(),u.setOpen(!0),n&&P()},cancelTypeSelector:function(){n?O(v.interactionIndex-1):(u.setOpen(!1),r.play())},deleteInteraction:k,saveInteraction:function(){return mo(this,void 0,void 0,po().mark((function e(){var t,r,i,o,a,c,s;return po().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(w){e.next=2;break}throw new Error("Should not be calling onClickSave while viewing an interactive");case 2:if(f=m.typeId,t=Si[f],!(r=t(b.getInteractionState(m.id),m))){e.next=7;break}return b.updateInteractionState(m.id,{error:r}),e.abrupt("return");case 7:if(b.updateInteractionState(m.id,{spinner:!0}),!On(n.id)){e.next=15;break}return i=n.id,e.next=12,Pr.saveTimepoint(n);case 12:u.updateCue(i,n.id),b.clearTimepointState(i),(null==v?void 0:v.hasChanges)&&(N(),I());case 15:return m.timepointId=n.id,o=m.id,a=xi(m.typeId),e.next=20,a(b.getInteractionState(m.id),m);case 20:b.clearInteractionState(o),c=On(o),s=S(m),null==l||l.logUserAction(s,{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=S(a);if(null==l||l.logUserAction(c,{actionType:d.Vw.Create,entity:d.py.Interaction,workflowPhase:d.eu.Start}),n)return n.interactions.push(a),void O(v.interactionIndex);var s=r.currentTime();t.timepoints||(t.timepoints=[]),t.timepoints.push({id:o,visibleAt:1e3*s,interactiveId:t.id,shouldPause:1,interactions:[a]}),N(),u.addCue(o)},submitInteractionAnswer:function(){return mo(this,void 0,void 0,po().mark((function e(){var r,i,c,f,p,y;return po().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(!(v.interactionIndex>=n.interactions.length)){e.next=6;break}return u.continueInteractive(),e.abrupt("return");case 6:return O(v.interactionIndex+1),e.abrupt("return");case 8:if(r=Cn(h),g=m.typeId,i=dn[g],!(c=i(r,m))){e.next=14;break}return b.updateInteractionState(m.id,{error:c}),e.abrupt("return");case 14:if(f={},!a||!h.hasChanges){e.next=27;break}if(p=mn(m.typeId),b.updateInteractionState(m.id,{spinner:!0}),!p){e.next=27;break}return e.next=21,p(r,m,a.save,{imageApi:s});case 21:if(e.t0=e.sent,e.t0){e.next=24;break}e.t0={};case 24:f=e.t0,y=S(m),null==l||l.logUserAction(y,{actionType:d.Vw.Submit,entity:d.py.Interaction});case 27:if(b.updateInteractionState(m.id,Object.assign(Object.assign({},f),{submitted:!0,error:null,hasChanges:!1,spinner:!1})),t.immediateFeedback){e.next=31;break}return C(),e.abrupt("return");case 31:sn(m.typeId)(m)||C();case 34:case"end":return e.stop()}var g}),e)})))},userUpdateInteractionState:b.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;vo||(vo=!0,b.updateTimepointState(n.id,{originalVisibleAt:a,hasChanges:!0})),u.moveTimepoint(o)}},saveTimepoint:function(){return mo(this,void 0,void 0,po().mark((function e(){return po().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!On(n.id)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Pr.updateTimepoint(n);case 4:N(),I();case 6:case"end":return e.stop()}}),e)})))},clearTimepointTimeState:I,reOrderQuestions:function(e){return mo(this,void 0,void 0,po().mark((function t(){var r,i;return po().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,Pr.saveInteraction(Object.assign(Object.assign({},e[r]),{order:r}));case 4:r++,t.next=1;break;case 7:i=n.interactions[v.interactionIndex],n.interactions=e,b.updateTimepointState(n.id,{interactionIndex:e.indexOf(i)});case 10:case"end":return t.stop()}}),t)})))}}}(Object.assign({mode:o,interactive:a,timepoint:O,player:n,resultsService:f,latestSession:h,analyticsService:y,imageApi:c},N)),I=P.interaction,L=P.interactionState,T=P.nextInteraction,A=P.nextInteractionState,_=P.timepointState,F=P.state,D=Go(P,["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,l=e.interactionState,s=e.timepointState,u=Oo(),f=n===M.Create;i().useEffect((function(){if(f){if(On(null==a?void 0:a.id)||(null==l?void 0:l.hasChanges)||(null==s?void 0:s.hasChanges))return u.lock({id:"interactive",title:"Are you sure you want to leave?",text:"Your interactive still has unsaved changes"}),void r.lock((function(e){c(e)}));r.unlock(),u.unlock("interactive")}}),[a,null==l?void 0:l.hasChanges,null===(t=null==o?void 0:o.interactions)||void 0===t?void 0:t.length,null==s?void 0:s.hasChanges])}({mode:o,player:n,timepoint:O,interaction:I,discardChanges:D.discardChanges,interactionState:L,timepointState:_});var R={mode:o,open:x,isCreate:o===M.Create,interaction:I,nextInteraction:T,timepoint:O,interactive:a,interactionState:L,nextInteractionState:A,timepointState:_,player:n};return i().createElement(i().Fragment,null,!!l&&i().createElement(qo,{interactive:a,onClickEditDetails:e.onClickEditDetails,onClickPublish:e.onClickPublish,onClickDelete:e.onClickDelete,onClickCopy:e.onClickCopy,portalNode:l,parentVideo:w}),i().createElement(Ie,Object.assign({},R,D)),i().createElement(ro,Object.assign({imageApi:c,currentUser:p,immediateFeedback:a.immediateFeedback,delayFocus:!C,enableImmersiveReader:g,experimentalInteractiveQuestions:S},R,D,N)),i().createElement(Rn,Object.assign({title:t,currentUser:p,state:F,portalNode:u,progress:m,resultsService:f,imageCdnUrl:c.toString(),onShowSummary:e.onShowSummary,mobile:b},R,D)),i().createElement(Bn,Object.assign({portalNode:s,hasPlayPageV2:E,experimentalInteractiveQuestions:S},R,D)))}ae.Z.registerComponent("Interactive",Uo((function(e,t){return i().createElement(Zo,Object.assign({player:e},t))})));function zo(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(At.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(_t.u,{className:"kw8gW"},i().createElement(_t.u.Cancel,{text:"Start again",onClick:function(){e.continue(!1),n()}}),i().createElement(_t.u.Submit,{variant:"dark",text:"Continue",onClick:r})))}function Ho(e){return Ho="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},Ho(e)}function Wo(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,Qo(r.key),r)}}function Qo(e){var t=function(e,t){if("object"!=Ho(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ho(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ho(t)?t:t+""}function Yo(e,t,n){return t=$o(t),function(e,t){if(t&&("object"==Ho(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,Ko()?Reflect.construct(t,n||[],$o(e).constructor):t.apply(e,n))}function Ko(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ko=function(){return!!e})()}function $o(e){return $o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$o(e)}function Xo(e,t){return Xo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Xo(e,t)}ae.Z.registerComponent("ContinueSession",Uo((function(e,t){return i().createElement(zo,Object.assign({player:e},t))})));var Jo=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=Yo(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&&Xo(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),"*")}}])&&Wo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getPlugin("plugin"));function ea(e){return ea="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},ea(e)}function ta(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,na(r.key),r)}}function na(e){var t=function(e,t){if("object"!=ea(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ea(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ea(t)?t:t+""}function ra(e,t,n){return t=oa(t),function(e,t){if(t&&("object"==ea(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,ia()?Reflect.construct(t,n||[],oa(e).constructor):t.apply(e,n))}function ia(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ia=function(){return!!e})()}function oa(e){return oa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},oa(e)}function aa(e,t){return aa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},aa(e,t)}ae.Z.registerPlugin("gradePassbackPlugin",Jo);var ca=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=ra(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&&aa(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this;this.player.gradePassbackPlugin(),Ce.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 Oe(this.player,{interactive:this.options.interactive,track:e}))}}])&&ta(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getPlugin("plugin"));function la(e){return la="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},la(e)}function sa(){sa=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==la(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(la(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ua(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 fa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,da(r.key),r)}}function da(e){var t=function(e,t){if("object"!=la(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=la(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==la(t)?t:t+""}function pa(e,t,n){return t=va(t),function(e,t){if(t&&("object"==la(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,ma()?Reflect.construct(t,n||[],va(e).constructor):t.apply(e,n))}function ma(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ma=function(){return!!e})()}function ha(){return ha="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=va(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}},ha.apply(null,arguments)}function va(e){return va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},va(e)}function ya(e,t){return ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ya(e,t)}ae.Z.registerPlugin("viewInteractivePlugin",ca),n(51976);var ga=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=pa(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&&ya(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=ha(va(t.prototype),"getPlayerOptions",this).call(this);return e.setMaxHeight=!1,this.options.embed||(e.aspectRatio="16:9"),e}},{key:"onFlushProgress",value:function(e){var n;ha(va(t.prototype),"onFlushProgress",this).call(this,e),this.options.mode!==M.Create&&(n=this.totalProgress).push.apply(n,function(e){return function(e){if(Array.isArray(e))return ua(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 ua(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)?ua(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 ha(va(t.prototype),"additionalSetup",a)}}});return n=this,r=void 0,i=void 0,o=sa().mark((function t(){return sa().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:c.additionalSetup.call(this,e),this.setupClipPlugin(e),this.setupPreventScrubbingPlugin(e);case 3:case"end":return t.stop()}}),t,this)})),new(i||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function c(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}l((o=o.apply(n,r||[])).next())}))}},{key:"setupAnalyticsDependentPlugins",value:function(e){ha(va(t.prototype),"setupAnalyticsDependentPlugins",this).call(this,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():ha(va(t.prototype),"handleAutoplay",this).call(this,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:"filterNewQuestionTypes",value:function(e){var t;return Object.assign(Object.assign({},e),{timepoints:null===(t=e.timepoints)||void 0===t?void 0:t.map((function(e){var t;return Object.assign(Object.assign({},e),{interactions:null===(t=e.interactions)||void 0===t?void 0:t.filter((function(e){return!O.IL[e.typeId]}))})})).filter((function(e){var t;return!!(null===(t=e.interactions)||void 0===t?void 0:t.length)}))})}},{key:"setupViewInteractivePlugin",value:function(e){var t;this.track=function(e,t){var n,r=e.addTextTrack("metadata","interactive"),i=t.additionalData.interactive,o=null===(n=t.additionalData.clipData)||void 0===n?void 0:n.startTime;return i.timepoints.forEach((function(e){var t,n=e.visibleAt/1e3,i=e.visibleFor?n+e.visibleFor/1e3:n+1;o&&(n+=o,i+=o),(null===(t=e.interactions)||void 0===t?void 0:t.length)&&r.addCue({startTime:Math.max(.001,n-.001),endTime:i,text:e.id})})),r}(this.player,e);var n=e.additionalData.interactive;this.options.experimentalInteractiveQuestions||(n=this.filterNewQuestionTypes(n));var r=null===(t=e.additionalData.clipData)||void 0===t?void 0:t.startTime;this.options.collectResults&&(this.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,experimentalInteractiveQuestions:this.options.experimentalInteractiveQuestions})}},{key:"getAdditionalAnalyticsData",value:function(e){var t,n,r,i;return(null===(n=null===(t=e.additionalData)||void 0===t?void 0:t.clipData)||void 0===n?void 0:n.clipId)?{clip:{id:null===(i=null===(r=e.additionalData)||void 0===r?void 0:r.clipData)||void 0===i?void 0:i.clipId}}:{}}},{key:"getSeekBarOptions",value:function(){return{ignoreChapters:!0}}},{key:"getAnalyticsPlayerType",value:function(){return"interactive-player"}},{key:"setActivityStatus",value:function(e,t){this.player.activityStatusPlugin().setActivityStatus(e,t)}}],r&&fa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.r);function ba(e){return new Proxy(e,{get:function(e,t,n){if("off"===t||!e.isDisposed())return Reflect.get(e,t,n)}})}var wa=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Ea(e){var t=e.onReady,n=e.className,r=wa(e,["onReady","className"]),o=i().useRef();return i().useEffect((function(){var e=new ga(o.current,r);return t&&e.ready((function(){t(ba(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 Sa={placeholder:"YUoDl"};function ka(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 xa(){return i().createElement("div",{className:"".concat(Sa.placeholder," partial-loading-background")})}function Oa(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,r)||function(e,t){if(e){if("string"==typeof e)return ka(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)?ka(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(Ea,{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(xa,null)}var Ca=n(82602),Na={avatarContainer:"hwnEk",comment:"LyFKD"},ja="libraryRequests.comments",Pa=Xe.T.encloseNamespace(ja);function Ia(e){var t,n,r,o,a,c,l=e.comment,s="".concat(null===(t=l.user)||void 0===t?void 0:t.name," ").concat(null===(n=l.user)||void 0===n?void 0:n.surname);return l.user||(s=Pa("deletedUser")),i().createElement("div",{className:"d-flex ".concat(Na.comment)},i().createElement("div",{className:"".concat(Na.avatarContainer," me-2 flex-shrink-0")},i().createElement(Re.q,{imageUrl:null===(o=null===(r=l.user)||void 0===r?void 0:r.avatar)||void 0===o?void 0:o.url,imageCdnUrl:e.imageCdnUrl,initials:$e.l.getInitials(null===(a=l.user)||void 0===a?void 0:a.name,null===(c=l.user)||void 0===c?void 0:c.surname)})),i().createElement("div",null,i().createElement("span",{className:"fw-bold pe-2"},s),i().createElement("span",{className:"text-secondary"},(0,Ca.WU)(l.dateCreated)),i().createElement("p",{className:"mb-0"},l.message)))}function La(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:ja,phrase:"comments"})),i().createElement("div",{className:"border rounded p-2"},e.comments.map((function(t,n){return i().createElement(Ia,{key:n,comment:t,imageCdnUrl:e.imageCdnUrl})})))):i().createElement(i().Fragment,null)}var Ta=n(56285),Aa=n(41087),_a=n(98496),Fa=n(50997),Da=n(89707),Ra={seriesLink:"Z5BW7"};function Ma(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 Ua(e){var t,n,r,o,a,c,l,s,u,f,d,p,m,h,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,m=e.config,h="series/".concat(p.id),Da.k.getMainProductUrl(m,h,h)),className:"".concat(Ra.seriesLink," text-reset")},v.series.name,i().createElement(_a.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(Aa.C,{type:Aa.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(Ma,{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(Ma,{items:v.directors})),!!(null===(l=null===(c=v.productionCompanies)||void 0===c?void 0:c.data)||void 0===l?void 0:l.length)&&i().createElement(g,{phrase:"productionCompanies"},i().createElement(Ma,{items:v.productionCompanies})),!!(null===(u=null===(s=v.distributors)||void 0===s?void 0:s.data)||void 0===u?void 0:u.length)&&i().createElement(g,{phrase:"distributors"},i().createElement(Ma,{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"},Ta.O.format(v.dateBroadcast,Fa.K4.FULL_YEAR))))}var Va,Ba,qa=n(17111),Ga=n(33937);function Za(e){return Za="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},Za(e)}function za(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,Ha(r.key),r)}}function Ha(e){var t=function(e,t){if("object"!=Za(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Za(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Za(t)?t:t+""}!function(e){e.AppleTv="apple-tv",e.Vivi="vivi"}(Va||(Va={})),function(e){e.Available="available",e.Offline="offline",e.Busy="busy"}(Ba||(Ba={}));var Wa=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)}}])&&za(t.prototype,n),r&&za(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function Qa(e){return Qa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qa(e)}function Ya(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ka(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Xa(r.key),r)}}function $a(e,t,n){return t&&Ka(e.prototype,t),n&&Ka(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xa(e){var t=function(e,t){if("object"!=Qa(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Qa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qa(t)?t:t+""}Symbol.toStringTag;var Ja=function(){return $a((function e(){Ya(this,e),this.callbacks=[],this.predicates=[],this.controller=new AbortController,this.signal=this.controller.signal,this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.isDisposed=this.isDisposed.bind(this)}),[{key:"trigger",value:function(e){var t=this;this.callbacks.forEach((function(n,r){var i=t.predicates[r];i&&!i(e)||n(e)}))}},{key:"on",value:function(e){var t=this;this.isDisposed()&&console.warn("This EventChannel instance been disposed - this is a no-op");var n=this.callbacks.length;this.callbacks[n]=e,this.predicates[n]=function(){return!0};var r=function(){t.off(e)};return{off:r,filter:function(e){return t.predicates[n]=e,r}}}},{key:"one",value:function(){var e,t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0};return this.isDisposed()?Wa.reject(new Error("This EventChannel instance has been disposed")):new Wa(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}}])}(),ec=function(){return $a((function e(){Ya(this,e),this.channels={},this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.getChannel=this.getChannel.bind(this)}),[{key:"trigger",value:function(e,t){this.getChannel(e).trigger(t)}},{key:"on",value:function(e,t){return this.getChannel(e).on(t)}},{key:"one",value:function(e,t){return this.getChannel(e).one(t)}},{key:"off",value:function(e,t){this.getChannel(e).off(t)}},{key:"dispose",value:function(){this.trigger("dispose",tc.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 Ja),this.channels[e]}}])}(),tc={void:void 0};function nc(e){return nc="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},nc(e)}function rc(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,ic(r.key),r)}}function ic(e){var t=function(e,t){if("object"!=nc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=nc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==nc(t)?t:t+""}var oc,ac,cc,lc=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}}])&&rc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),sc=n(90244),uc=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)}})},fc=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 dc(e){return dc="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},dc(e)}function pc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,hc(r.key),r)}}function mc(e,t,n){return t&&pc(e.prototype,t),n&&pc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function hc(e){var t=function(e,t){if("object"!=dc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=dc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==dc(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"}(oc||(oc={})),function(e){e[e.PlaybackStatusChange=0]="PlaybackStatusChange",e[e.PositionChange=1]="PositionChange"}(ac||(ac={})),function(e){e.Begin="BEGIN",e.Play="PLAY",e.Pause="PAUSE",e.Load="LOAD",e.Scan="SCAN",e.Stop="STOP"}(cc||(cc={}));var vc=mc((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=cc.Load,this.debounced=uc(this,2e3),fc(this)}));function yc(e){return yc="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},yc(e)}function gc(){gc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==yc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(yc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function bc(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,wc(r.key),r)}}function wc(e){var t=function(e,t){if("object"!=yc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=yc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yc(t)?t:t+""}function Ec(e,t,n){return t=xc(t),function(e,t){if(t&&("object"==yc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Sc()?Reflect.construct(t,n||[],xc(e).constructor):t.apply(e,n))}function Sc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Sc=function(){return!!e})()}function kc(){return kc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=xc(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},kc.apply(null,arguments)}function xc(e){return xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xc(e)}function Oc(e,t){return Oc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Oc(e,t)}var Cc=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=Ec(this,t)).client=e,r.localState=new vc(n.title,n.device),r.bindFunctions(),r.initialize(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Oc(e,t)}(t,e),n=t,(r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.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(){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)})),kc(xc(t.prototype),"dispose",this).call(this)}},{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 ac.PlaybackStatusChange:this.handlePlaybackChange(t,e);break;case ac.PositionChange:this.handlePositionChange(t,e)}}}},{key:"handlePlaybackChange",value:function(e,t){e.playbackStatus!==t.params.playbackStatus&&(e.playbackStatus=t.params.playbackStatus,this.trigger("playingchange",tc.void),e.playbackStatus===cc.Stop&&this.dispose())}},{key:"handlePositionChange",value:function(e,t){e.position!==t.params.position&&(e.position=t.params.position,this.trigger("positionchange",tc.void))}},{key:"loadSource",value:function(){return e=this,t=void 0,n=void 0,r=gc().mark((function e(){return gc().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",tc.void),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(0),console.error(e.t0),this.trigger("error",new Error("Could not load video on Apple TV device"));case 15:case"end":return e.stop()}}),e,this,[[0,11]])})),new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}},{key:"play",value:function(){this.localState.locked&&this.localState.playbackStatus!==cc.Play&&(this.localState.playbackStatus=cc.Play,this.client.play(this.getDevice().id),this.trigger("playingchange",tc.void))}},{key:"pause",value:function(){this.localState.locked&&this.localState.playbackStatus!==cc.Pause&&(this.localState.playbackStatus=cc.Pause,this.client.pause(this.getDevice().id),this.trigger("playingchange",tc.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",tc.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===cc.Play||this.localState.playbackStatus===cc.Begin||this.localState.playbackStatus===cc.Load}},{key:"isPlaybackFinished",value:function(){return this.localState.playbackStatus===cc.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}}])&&bc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ec);function Nc(e){return Nc="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},Nc(e)}function jc(){jc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Nc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Nc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Pc(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,Ic(r.key),r)}}function Ic(e){var t=function(e,t){if("object"!=Nc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Nc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Nc(t)?t:t+""}function Lc(e,t,n){return t=_c(t),function(e,t){if(t&&("object"==Nc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Tc()?Reflect.construct(t,n||[],_c(e).constructor):t.apply(e,n))}function Tc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Tc=function(){return!!e})()}function Ac(){return Ac="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=_c(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}},Ac.apply(null,arguments)}function _c(e){return _c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_c(e)}function Fc(e,t){return Fc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fc(e,t)}var Dc,Rc,Mc,Uc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))};!function(e){e.DeviceList="DeviceList",e.DeviceStateChange="DeviceStateChange",e.Paired="Paired",e.Unpaired="Unpaired",e.PlayStatusChange="PlayStatusChange",e.TimeSync="TimeSync"}(Dc||(Dc={})),function(e){e.Command="Command",e.Pair="Pair",e.Unpair="Unpair",e.RenameDevice="Renamedevice",e.Subscribe="Subscribe",e.Lock="Lock"}(Rc||(Rc={})),function(e){e[e.Connecting=0]="Connecting",e[e.Connected=1]="Connected",e[e.Reconnecting=2]="Reconnecting",e[e.Disconnected=4]="Disconnected"}(Mc||(Mc={}));var Vc=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=Lc(this,t)).options=e,n.accessToken=void 0,n.devices=[],n.heartbeat=new lc,n.bindFunctions(),n.initialize(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.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,sc.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 Uc(this,void 0,void 0,jc().mark((function e(){return jc().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,Ga.OB)(this.accessToken.host,{logging:!1}),this.hubProxy=this.connection.createHubProxy("DeviceUserHub"),this.hubProxy.on(Dc.DeviceList,this.handleDeviceList),this.hubProxy.on(Dc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.on(Dc.Paired,this.handleDevicePaired),this.hubProxy.on(Dc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.on(Dc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.on(Dc.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 Uc(this,void 0,void 0,jc().mark((function e(){var t=this;return jc().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 Uc(this,void 0,void 0,jc().mark((function t(){return jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(Rc.Subscribe,e);case 2:if(t.sent){t.next=5;break}throw new Error("The subscription request was rejected by Online API");case 5:case"end":return t.stop()}}),t,this)})))}},{key:"tryFixConnection",value:function(){return Uc(this,void 0,void 0,jc().mark((function e(){return jc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection.state===Mc.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 Uc(this,void 0,void 0,jc().mark((function t(){var r,i=this;return jc().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",Wa.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",tc.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",tc.void))}},{key:"handleDevicePaired",value:function(e){"vivi"!==e.type&&(this.devices.push(t.convertToGenericDevice(e)),this.trigger("deviceschange",tc.void))}},{key:"handleDeviceUnpaired",value:function(e){this.devices=this.devices.filter((function(t){return t.id!==e})),this.trigger("deviceschange",tc.void)}},{key:"handlePlayStatusChange",value:function(e,t){this.trigger("message",{event:ac.PlaybackStatusChange,deviceId:e,params:{playbackStatus:t.commandType}})}},{key:"handleTimeSync",value:function(e,t){this.trigger("message",{event:ac.PositionChange,deviceId:e,params:{position:t}})}},{key:"dispose",value:function(){this.hubProxy.off(Dc.DeviceList,this.handleDeviceList),this.hubProxy.off(Dc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.off(Dc.Paired,this.handleDevicePaired),this.hubProxy.off(Dc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.off(Dc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.off(Dc.TimeSync,this.handleTimeSync),this.hubProxy.connection.stop(!1,!0),this.heartbeat.stop(),Ac(_c(t.prototype),"dispose",this).call(this)}},{key:"canCastToDevice",value:function(e){return e===Va.AppleTv}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new Cc(this,e)}},{key:"lock",value:function(e){var t;return Uc(this,void 0,void 0,jc().mark((function n(){return jc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.invoke(Rc.Lock,e,this.options.userId,null!==(t=this.options.username)&&void 0!==t?t:"");case 2:if(n.sent){n.next=5;break}throw new Error("Could not lock device");case 5:case"end":return n.stop()}}),n,this)})))}},{key:"loadVideo",value:function(e){return Uc(this,void 0,void 0,jc().mark((function t(){return jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.options.trackingCode){t.next=2;break}throw new Error("Tracking code must be provided to cast videos");case 2:return t.next=4,this.invoke(Rc.Command,{DeviceId:e,CommandType:cc.Play,Data:this.options.trackingCode});case 4:case"end":return t.stop()}}),t,this)})))}},{key:"play",value:function(e){return Uc(this,void 0,void 0,jc().mark((function t(){return jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(Rc.Command,{DeviceId:e,CommandType:cc.Play});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return Uc(this,void 0,void 0,jc().mark((function t(){return jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(Rc.Command,{DeviceId:e,CommandType:cc.Pause});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"seek",value:function(e,t){this.invokeDebounced(Rc.Command,{DeviceId:e,CommandType:cc.Play,Params:"1,".concat(Math.trunc(t))})}},{key:"stop",value:function(e){return Uc(this,void 0,void 0,jc().mark((function t(){return jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(Rc.Command,{DeviceId:e,CommandType:cc.Stop});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pair",value:function(e){return Uc(this,void 0,void 0,jc().mark((function t(){var n;return jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(Rc.Pair,e);case 2:if(n=t.sent){t.next=5;break}throw new Error("Could not pair device");case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"unpair",value:function(e){return Uc(this,void 0,void 0,jc().mark((function t(){return jc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(Rc.Unpair,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"renameDevice",value:function(e){var t=e.deviceId,n=e.deviceName;return Uc(this,void 0,void 0,jc().mark((function e(){return jc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke(Rc.RenameDevice,t,n);case 2:if(e.sent){e.next=5;break}throw new Error("Could not rename device");case 5:case"end":return e.stop()}}),e,this)})))}}],i=[{key:"convertToGenericDeviceStatus",value:function(e){switch(e){case oc.Online:return Ba.Available;case oc.Locked:return Ba.Busy;case oc.Suspended:case oc.Offline:return Ba.Offline}}},{key:"convertToGenericDevice",value:function(e){return{id:e.deviceId,name:e.name,type:Va.AppleTv,status:t.convertToGenericDeviceStatus(e.status)}}}],r&&Pc(n.prototype,r),i&&Pc(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(ec);function Bc(e){return Bc="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},Bc(e)}function qc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Gc(r.key),r)}}function Gc(e){var t=function(e,t){if("object"!=Bc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Bc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Bc(t)?t:t+""}var Zc={reconnectIntervalInMilliseconds:3e3,heartbeatEnabled:!1,heartbeatIntervalInMillseconds:1e4,heartbeatMessage:""},zc=function(){return e=function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Zc;!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({},Zc),r),this.webSocket=this.connect(),this.heartbeat=(new lc).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()}}])&&qc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),Hc=n(27993);function Wc(e){return Wc="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},Wc(e)}function Qc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Yc(r.key),r)}}function Yc(e){var t=function(e,t){if("object"!=Wc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Wc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wc(t)?t:t+""}var Kc,$c=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=uc(this,2e3),fc(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}}])&&Qc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Xc(e){return Xc="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},Xc(e)}function Jc(){Jc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Xc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Xc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function el(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,tl(r.key),r)}}function tl(e){var t=function(e,t){if("object"!=Xc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Xc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xc(t)?t:t+""}function nl(e,t,n){return t=ol(t),function(e,t){if(t&&("object"==Xc(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,rl()?Reflect.construct(t,n||[],ol(e).constructor):t.apply(e,n))}function rl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(rl=function(){return!!e})()}function il(){return il="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ol(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},il.apply(null,arguments)}function ol(e){return ol=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ol(e)}function al(e,t){return al=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},al(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"}(Kc||(Kc={}));var cl=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},ll=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=nl(this,t)).client=e,r.localState=new $c(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&&al(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(){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)})),il(ol(t.prototype),"dispose",this).call(this)}},{key:"handleClientConnected",value:function(){return cl(this,void 0,void 0,Jc().mark((function e(){return Jc().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 Kc.Update:this.handleUpdateMessage(t,n);break;case Kc.NewChapter:this.handleNewChapterMessage(t,n);break;case Kc.Volume:this.handleVolumeMessage(t,n);break;case Kc.Playing:this.handlePlayingMessage(t);break;case Kc.Paused:this.handlePausedMessage(t);break;case Kc.Finished:this.handleFinishedMessage(t);break;case Kc.Stopped:this.handleStoppedMessage()}}},{key:"handleUpdateMessage",value:function(e,t){e.duration!==t.duration&&(e.duration=t.duration,this.trigger("durationchange",tc.void)),e.position!==t.position&&(e.position=t.position,this.trigger("positionchange",tc.void)),e.subtitles!==t.subtitles&&(e.subtitles=t.subtitles,this.trigger("subtitleschange",tc.void))}},{key:"handleVolumeMessage",value:function(e,t){e.volume!==t.level&&(e.volume=t.level,e.mute=0===t.level,this.trigger("volumechange",tc.void))}},{key:"handlePlayingMessage",value:function(e){!0!==e.playing&&(e.playing=!0,e.playbackFinished=!1,this.trigger("playingchange",tc.void))}},{key:"handlePausedMessage",value:function(e){!1!==e.playing&&(e.playing=!1,this.trigger("playingchange",tc.void))}},{key:"handleFinishedMessage",value:function(e){!0!==e.playbackFinished&&(e.playing=!1,e.playbackFinished=!0,this.trigger("playingchange",tc.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",tc.void))}},{key:"handleStoppedMessage",value:function(){this.dispose()}},{key:"loadSource",value:function(e,t){return cl(this,void 0,void 0,Jc().mark((function n(){var r,i;return Jc().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",tc.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",tc.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",tc.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",tc.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",tc.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",tc.void))}},{key:"setSubtitles",value:function(e){return cl(this,void 0,void 0,Jc().mark((function t(){var n;return Jc().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",tc.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}}])&&el(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ec);function sl(e){return sl="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},sl(e)}function ul(){ul=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==sl(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(sl(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),s(k,l,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function fl(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,dl(r.key),r)}}function dl(e){var t=function(e,t){if("object"!=sl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=sl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==sl(t)?t:t+""}function pl(e,t,n){return t=vl(t),function(e,t){if(t&&("object"==sl(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,ml()?Reflect.construct(t,n||[],vl(e).constructor):t.apply(e,n))}function ml(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ml=function(){return!!e})()}function hl(){return hl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=vl(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}},hl.apply(null,arguments)}function vl(e){return vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vl(e)}function yl(e,t){return yl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},yl(e,t)}var gl=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},bl=1e4,wl=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=pl(this,t)).options=e,n.accessToken="",n.devices=[],n.devicesFingerprint="",n.deviceDiscovery=new lc,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&&yl(e,t)}(t,e),n=t,i=[{key:"createAckId",value:function(){return Hc.x.generateRandomId()}},{key:"calculateFingerprint",value:function(e){return e.map((function(e){return e.id})).sort().join(",")}}],(r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendMessageDebounced=(0,sc.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 zc(this.options.url),this.webSocket.onMessage=function(t){return e.trigger("message",JSON.parse(t.data))},this.webSocket.onOpen=function(){return gl(e,void 0,void 0,ul().mark((function e(){return ul().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",tc.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 gl(e,void 0,void 0,ul().mark((function e(){var n,r;return ul().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:Va.Vivi,status:Ba.Available}})),this.devicesFingerprint=r,this.trigger("deviceschange",tc.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;this.deviceDiscovery.stop(),null===(e=this.webSocket)||void 0===e||e.dipose(),hl(vl(t.prototype),"dispose",this).call(this)}},{key:"canCastToDevice",value:function(e){return e===Va.Vivi}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new ll(this,e)}},{key:"authenticateWithVivi",value:function(){return gl(this,void 0,void 0,ul().mark((function e(){return ul().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(bl).catch((function(){throw new Error("Failed to authenticate with Vivi")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getRoomList",value:function(){return gl(this,void 0,void 0,ul().mark((function e(){var t;return ul().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(bl).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 gl(this,void 0,void 0,ul().mark((function t(){return ul().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(bl).catch((function(){throw new Error("Failed to join room")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"query",value:function(e){return gl(this,void 0,void 0,ul().mark((function n(){var r;return ul().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(bl).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 gl(this,void 0,void 0,ul().mark((function e(){return ul().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(bl).catch((function(){throw new Error("Failed to load media")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"play",value:function(e){return gl(this,void 0,void 0,ul().mark((function t(){return ul().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(bl).catch((function(){throw new Error("Failed to play video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return gl(this,void 0,void 0,ul().mark((function t(){return ul().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(bl).catch((function(){throw new Error("Failed to pause video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"stop",value:function(e){return gl(this,void 0,void 0,ul().mark((function t(){return ul().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(bl).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 gl(this,void 0,void 0,ul().mark((function n(){return ul().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(bl).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 gl(this,void 0,void 0,ul().mark((function n(){return ul().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(bl).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 gl(this,void 0,void 0,ul().mark((function n(){return ul().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(bl).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 gl(this,void 0,void 0,ul().mark((function r(){var i;return ul().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(bl).catch((function(){throw new Error("Failed to set subtitles")}));case 4:case"end":return r.stop()}}),r,this)})))}}])&&fl(n.prototype,r),i&&fl(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(ec);function El(e){return El="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},El(e)}function Sl(e){return function(e){if(Array.isArray(e))return kl(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 kl(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)?kl(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 kl(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 xl(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,Ol(r.key),r)}}function Ol(e){var t=function(e,t){if("object"!=El(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=El(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==El(t)?t:t+""}function Cl(e,t,n){return t=Pl(t),function(e,t){if(t&&("object"==El(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||[],Pl(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 jl(){return jl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Pl(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}},jl.apply(null,arguments)}function Pl(e){return Pl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pl(e)}function Il(e,t){return Il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Il(e,t)}var Ll=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=Cl(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&&Il(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(Sl(e),Sl(t))}),[]);this.trigger("deviceschange",e)}},{key:"dispose",value:function(){var e;null===(e=this.castSession)||void 0===e||e.dispose(),this.clients.forEach((function(e){return e.dispose()})),this.castSession=void 0,this.clients=[],jl(Pl(t.prototype),"dispose",this).call(this)}}],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&&xl(n.prototype,r),i&&xl(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(ec);Ll.instances={};var Tl=n(12424),Al=n(4579);function _l(e){return _l="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},_l(e)}function Fl(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,Dl(r.key),r)}}function Dl(e){var t=function(e,t){if("object"!=_l(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=_l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_l(t)?t:t+""}function Rl(e,t,n){return t=Vl(t),function(e,t){if(t&&("object"==_l(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,Ml()?Reflect.construct(t,n||[],Vl(e).constructor):t.apply(e,n))}function Ml(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ml=function(){return!!e})()}function Ul(){return Ul="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Vl(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}},Ul.apply(null,arguments)}function Vl(e){return Vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Vl(e)}function Bl(e,t){return Bl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Bl(e,t)}var ql=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=Rl(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&&Bl(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){return Ul(Vl(t.prototype),"createEl",this).call(this,"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(){Ul(Vl(t.prototype),"show",this).call(this)}},{key:"hide",value:function(){Ul(Vl(t.prototype),"hide",this).call(this)}},{key:"isVisible",value:function(){return!Ul(Vl(t.prototype),"hasClass",this).call(this,"vjs-hidden")}}])&&Fl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("MenuItem")),Gl=n(86777);function Zl(e){return Zl="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},Zl(e)}function zl(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,Hl(r.key),r)}}function Hl(e){var t=function(e,t){if("object"!=Zl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Zl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Zl(t)?t:t+""}function Wl(e,t,n){return t=Yl(t),function(e,t){if(t&&("object"==Zl(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,Ql()?Reflect.construct(t,n||[],Yl(e).constructor):t.apply(e,n))}function Ql(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ql=function(){return!!e})()}function Yl(e){return Yl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Yl(e)}function Kl(e,t){return Kl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Kl(e,t)}var $l=ae.Z.getComponent("Menu"),Xl=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Wl(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&&Kl(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){var e=$l.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 Gl.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"))}}])&&zl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}($l);function Jl(e){var t=e.inactiveIntegrations,n=e.canUserManageIntegrations,i=e.player,o=e.onDismiss,a=e.onInstall,c=e.onLearnMore,l=e.onContactSupport;if(0===t.length)return r.createElement(r.Fragment,null);var s,u=function(e){return i.localize(e)},f=function(e){return-1!==t.indexOf(e)};return s=f(Va.AppleTv)&&f(Va.Vivi)?"vivi_and_apple_tv":f(Va.Vivi)?"vivi":"apple_tv",r.createElement("div",{className:"cv-devices-cta",tabIndex:-1},r.createElement(es,{context:s,localize:u,onDismiss:function(){return o(s)}}),r.createElement(ts,{context:s}),r.createElement(ns,{context:s,canUserManageIntegrations:n,localize:u,onContactSupport:function(){return l(s)},onInstall:function(){return a(s)},onLearnMore:function(){return c(s)}}))}function es(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 ts(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 ns(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 rs(e){return rs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rs(e)}function is(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,os(r.key),r)}}function os(e){var t=function(e,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 as(e,t,n){return t=ss(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,cs()?Reflect.construct(t,n||[],ss(e).constructor):t.apply(e,n))}function cs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(cs=function(){return!!e})()}function ls(){return ls="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ss(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}},ls.apply(null,arguments)}function ss(e){return ss=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ss(e)}function us(e,t){return us=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},us(e,t)}ae.Z.registerComponent("DevicesMenu",Xl),ae.Z.registerComponent("DevicesCta",Uo((function(e,t){return r.createElement(Jl,Object.assign({player:e},t))}),{properties:{className:"cv-devices-cta-wrapper"}}));var fs=ae.Z.getComponent("DevicesCta"),ds=ae.Z.getComponent("MenuButton"),ps=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=as(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&&us(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=ds.prototype.createEl).apply.apply(e,[this].concat(n))}},{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-devices-button ".concat(ls(ss(t.prototype),"buildWrapperCSSClass",this).call(this))}},{key:"createMenu",value:function(){var e=this,t=new Xl(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 fs(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 Tl.Z(this.player_,{label:this.localize("Select a device"),selectable:!1}),this.searchInputItem=new Al.Z(this.player_,{menuButton:this,search:function(t){return e.setSearchText(t)},className:"cv-devices-search-input"}),this.emptyPlaceholder=new Al.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;ls(ss(t.prototype),"pressButton",this).call(this),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 ql}))}},{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 ql(t.player(),{id:e.id,label:e.name,selected:!1,multiSelectable:!1,selectable:!0,available:e.status===Ba.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===Ba.Available,c=!n||-1!==o.name.toLowerCase().indexOf(r),l=o.id===(null===(i=e.castSession)||void 0===i?void 0:i.getDevice().id);a?t.enable():t.disable(),c?t.show():t.hide(),l?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(){ls(ss(t.prototype),"handleClick",this).call(this,null),this.options_.onClick()}}],r&&is(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ds);function ms(e){return ms="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},ms(e)}function hs(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,vs(r.key),r)}}function vs(e){var t=function(e,t){if("object"!=ms(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ms(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ms(t)?t:t+""}function ys(e,t,n){return t=ws(t),function(e,t){if(t&&("object"==ms(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,gs()?Reflect.construct(t,n||[],ws(e).constructor):t.apply(e,n))}function gs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(gs=function(){return!!e})()}function bs(){return bs="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}},bs.apply(null,arguments)}function ws(e){return ws=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ws(e)}function Es(e,t){return Es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Es(e,t)}ps.prototype.controlText_="Devices",ae.Z.registerComponent("DevicesButton",ps);var Ss=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),ys(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&&Es(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){return bs(ws(t.prototype),"createEl",this).call(this,"div",{className:"cv-devices-tech"})}},{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:Va.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(){}}])&&hs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("Component"));function ks(e){return ks="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},ks(e)}function xs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Os(r.key),r)}}function Os(e){var t=function(e,t){if("object"!=ks(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ks(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ks(t)?t:t+""}function Cs(e,t,n){return t=Ps(t),function(e,t){if(t&&("object"==ks(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,Ns()?Reflect.construct(t,n||[],Ps(e).constructor):t.apply(e,n))}function Ns(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ns=function(){return!!e})()}function js(){return js="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ps(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}},js.apply(null,arguments)}function Ps(e){return Ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ps(e)}function Is(e,t){return Is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Is(e,t)}var Ls=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=Cs(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&&Is(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 Ce.O.findTrackByPredicate(this.videojsPlayer.player_,(function(e){return"showing"===e.mode&&!!e.src}))}},{key:"setSelectedTextTrack",value:function(e){Ce.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(),js(Ps(t.prototype),"cleanupAutoTextTracks",this).call(this),js(Ps(t.prototype),"dispose",this).call(this)}},{key:"createEl",value:function(){var e=this;return this.ui=this.ui||new Ss({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 js(Ps(t.prototype),"addRemoteTextTrack",this).call(this,e,!0)}},{key:"getCastSession",value:function(){var e;return Ll.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!!Ll.getOrCreateInstance(null!==(n=null==t?void 0:t.instanceId)&&void 0!==n?n:"").getCastSession()}},{key:"isSupported",value:function(){return Ll.isActive()}}],r&&xs(n.prototype,r),i&&xs(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(ae.Z.getComponent("Tech"));function Ts(e){return Ts="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},Ts(e)}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,_s(r.key),r)}}function _s(e){var t=function(e,t){if("object"!=Ts(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ts(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ts(t)?t:t+""}function Fs(e,t,n){return t=Ms(t),function(e,t){if(t&&("object"==Ts(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,Ds()?Reflect.construct(t,n||[],Ms(e).constructor):t.apply(e,n))}function Ds(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ds=function(){return!!e})()}function Rs(){return Rs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ms(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}},Rs.apply(null,arguments)}function Ms(e){return Ms=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ms(e)}function Us(e,t){return Us=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Us(e,t)}ae.Z.registerTech("devices",Ls);var Vs=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=Fs(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&&Us(e,t)}(t,e),n=t,(r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.onReady=this.onReady.bind(this),this.onDevicesChanged=this.onDevicesChanged.bind(this),this.onCastSessionChanged=this.onCastSessionChanged.bind(this),this.onDevicesError=this.onDevicesError.bind(this),this.addViviClient=this.addViviClient.bind(this),this.addAppleTvClient=this.addAppleTvClient.bind(this),this.reloadTech=this.reloadTech.bind(this),this.getSessionManager=this.getSessionManager.bind(this),this.dispose=this.dispose.bind(this)}},{key:"initialize",value:function(){this.player.ready(this.onReady)}},{key:"onReady",value:function(){var e=this,t=this.player.getChild("collapserator"),n=null==t?void 0:t.children().findIndex((function(e){return"CustomControlSpacer"===e.name()})),r=null==t?void 0:t.children().findIndex((function(e){return"OpenExternallyButton"===e.name()})),i=Math.max(n,r)+1,o=this.getSessionManager();if(t&&n&&-1!==n&&o){o.on("deviceschange",this.onDevicesChanged),o.on("castsessionchange",this.onCastSessionChanged),o.on("error",this.onDevicesError);var a=this.options.ctaOptions,c=this.options.vivi,l=[];this.options.appleTv.enabled||l.push(Va.AppleTv),c.enabled&&c.accountConnected||l.push(Va.Vivi);var s={onClick:function(){e.addViviClient(o),e.addAppleTvClient(o)},onDeviceMenuItemClick:function(t,n){var r;o.startCastSession({device:n,title:e.options.title}),null===(r=e.options.analyticsService)||void 0===r||r.logUserAction(n,{actionType: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:l})};this.devicesButton=t.addChild("DevicesButton",s,i)}}},{key:"onDevicesChanged",value:function(e){var t;null===(t=this.devicesButton)||void 0===t||t.setDevices(e)}},{key:"onCastSessionChanged",value:function(e){var t;null===(t=this.devicesButton)||void 0===t||t.setCastSession(e),this.reloadTech(),e?(this.player.addClass("cv-device-casting"),this.player.addClass("cv-device-".concat(e.getDevice().type)),this.player.isFullscreen()&&this.player.exitFullscreen()):(this.player.removeClass("cv-device-casting"),this.player.removeClass("cv-device-".concat(Va.AppleTv)),this.player.removeClass("cv-device-".concat(Va.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(wl)){var t=new wl({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(Vc)){var t=new Vc({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 Ll.getOrCreateInstance(this.instanceId)}},{key:"dispose",value:function(){var e=this.getSessionManager();e&&(e.off("deviceschange",this.onDevicesChanged),e.off("castsessionchange",this.onCastSessionChanged),e.off("error",this.onDevicesError),Ll.disposeAndRemoveInstance(e),Rs(Ms(t.prototype),"dispose",this).call(this))}}])&&As(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getPlugin("plugin"));function Bs(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 qs(e){var t,n,i,o=r.useRef(e.player.duration()-e.player.currentTime()),a=(n=r.useState(o.current),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,i)||function(e,t){if(e){if("string"==typeof e)return Bs(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)?Bs(e,t):void 0}}(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=a[0],l=a[1];function s(){var t=e.player.duration()-e.player.currentTime();l(t),t>o.current&&(o.current=t)}if(r.useEffect((function(){return e.player.on("timeupdate",s),function(){e.player.off("timeupdate",s)}}),[]),!e.nextVideo||!e.onPlayNext)return r.createElement(r.Fragment,null);var u=Math.ceil(c),f=1===u?"second":"seconds";return r.createElement(r.Fragment,null,r.createElement("div",{className:"cv-up-next-container"},r.createElement("div",{className:"cv-cancel-up-next cursor-pointer",role:"button",onClick:e.onCancel},"×"),r.createElement("div",{className:"cv-up-next-heading"},"Up next in ",u," ",f,":"),r.createElement("div",{className:"cv-up-next-image cursor-pointer",onClick:e.onPlayNext,style:{backgroundImage:"url(".concat(null===(t=e.nextVideo)||void 0===t?void 0:t.thumbnailUrl,")")}}),r.createElement("div",{className:"cv-up-next-title"},e.nextVideo.name)))}function Gs(e){return Gs="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},Gs(e)}function Zs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,zs(r.key),r)}}function zs(e){var t=function(e,t){if("object"!=Gs(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Gs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Gs(t)?t:t+""}function Hs(e,t,n){return t=Ys(t),function(e,t){if(t&&("object"==Gs(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||[],Ys(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 Qs(){return Qs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ys(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}},Qs.apply(null,arguments)}function Ys(e){return Ys=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ys(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.registerPlugin("devicesPlugin",Vs),ae.Z.registerComponent("UpNext",Uo((function(e,t){return r.createElement(qs,Object.assign({player:e},t))})));var $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=Hs(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&&Ks(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=Qs(Ys(t.prototype),"createEl",this).call(this,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 i.children[1].appendChild(this.toggleEl),i}}])&&Zs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("MenuItem"));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,eu(r.key),r)}}function eu(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 tu(e,t,n){return t=iu(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,nu()?Reflect.construct(t,n||[],iu(e).constructor):t.apply(e,n))}function nu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(nu=function(){return!!e})()}function ru(){return ru="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=iu(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}},ru.apply(null,arguments)}function iu(e){return iu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},iu(e)}function ou(e,t){return ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ou(e,t)}ae.Z.registerComponent("NextVideoMenuItem",$s);var au="cv-persisttest",cu="cv-play-next-video",lu=ae.Z.getPlugin("plugin"),su=(ae.Z.getComponent("MenuItem"),ae.Z.getComponent("NextVideoMenuItem")),uu=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=tu(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(cu);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&&ou(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.player.isDisposed()||this.bindListeners()}},{key:"getChapterTrack",value:function(){return Ce.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:su,name:"NextVideoMenuItem"})}},{key:"getShouldPlayNext",value:function(){return this.shouldPlayNextVideo}},{key:"setShouldPlayNext",value:function(e,t){this.shouldPlayNextVideo=e,this.hasLocalStorage&&t&&window.localStorage.setItem(cu,e.toString())}},{key:"bindListeners",value:function(){this.player.on("timeupdate",this.onTimeUpdate)}},{key:"dispose",value:function(){this.player.off("timeupdate",this.onTimeUpdate),this.hideUpNext(),ru(iu(t.prototype),"dispose",this).call(this)}},{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(au,"persistPlayNext"),window.localStorage.removeItem(au),!0}catch(e){return!1}}}])&&Js(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(lu);ae.Z.registerPlugin("nextVideoPlugin",uu);var fu=n(52765),du=n(75390),pu=n(86257),mu=n(87013),hu=n(38e3),vu={imageStyle:"FFgf3",imageTypeResource:"z4O5p",fallBackImage:"Xy4zX"},yu={width:200,resizeType:De.Nq.Cover};function gu(e){var t;return hu.G.isResource(e)?e.metadata.type===pu.L.Pdf||(null===(t=e.pdf)||void 0===t?void 0:t.url)?De.__.Pdf:De.__.Thumbnails:De.__.Link}function bu(e){var t,n,r,o=null,a=0;hu.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]:yu,a=gu(t);if("thumbnail"in t&&(null===(n=t.thumbnail)||void 0===n?void 0:n.url))return mu.j.createUrl(null===(r=t.thumbnail)||void 0===r?void 0:r.url,Object.assign({},o));var c=du._.safeUrlConcat(e,"/v1/previews");return hu.G.isResource(t)?a===De.__.Pdf?t.metadata.type===pu.L.Pdf?mu.j.createResourceImage(c,t.url,Object.assign({},o)):mu.j.createResourceImage(c,null===(i=t.pdf)||void 0===i?void 0:i.url,Object.assign({},o)):t.metadata.type!==pu.L.Zip?mu.j.createUrl(t.url,{size:De.h2.Medium,resizeType:De.Nq.Cover}):"/images/zip-resource.png":mu.j.createResourceImage(c,t.url,Object.assign({},o))}(e.imageCdnUrl,e.resource,e.dynamicRatioImageOptions);return i().createElement(Fe.Z,{data:c,imageType:gu(e.resource),imageStyle:{transform:"rotate(".concat(a,"deg)")},alt:e.resource.name,errorFallbackImageSrc:e.imageErrorFallbackUrl,errorFallbackImageClassName:vu.fallBackImage,imageClassName:(null==o?void 0:o.type)===pu.L.Image?"".concat(vu.imageTypeResource," ").concat(vu.imageStyle):"",preload:e.preloadImage,preventLoad:!e.preloadImage})}var wu=n(96461),Eu=n(43803),Su=n(74421),ku=n(13799),xu={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"}}},Ou={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 Cu(e){var t,n,r,o,a=null;"metadata"in e.data&&(a=e.data.metadata);var c=hu.G.isType(e.data,Su.E.Resource);return i().createElement(i().Fragment,null,i().createElement("div",{className:Ou.aspectRatio},i().createElement("div",{className:Ou.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 Ou.atomGuide;case"student-activity":return Ou.studentActivity;case"teacher-pack":return Ou.teacherPack;case"additional-materials":return Ou.additionalMaterials;default:return Ou.userUploaded}}(t)," ").concat(Ou.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(Ou.hoverState)),r}(null==a?void 0:a.resourceType)},"above"===e.titlePosition&&i().createElement(li.u,{title:e.data.name},i().createElement("h3",{className:"text-center text-break h5 mb-3 ".concat(Ou.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(Ou.thumbnailContainer," ").concat("above"===e.titlePosition?Ou.titleAbove:""," \n ").concat(Ou.imageStyle,"\n ")},i().createElement(bu,{resource:e.data,imageCdnUrl:e.imageCdnUrl,imageErrorFallbackUrl:e.imageErrorFallbackUrl,preloadImage:e.preloadImage})),c&&e.onClickDownload&&"normal"===e.actionBehaviour&&i().createElement("div",{className:Ou.actions},i().createElement(k.L,{onClick:function(t){return e.onClickDownload(t,e.data)},className:"".concat(Ou.download," d-flex align-items-center justify-content-center")},i().createElement(x.x,{svgName:C.vn.Download}))),!e.hideTypeBadge&&c&&i().createElement(Eu.y,{typeId:Su.E.Resource})))),"below"===e.titlePosition&&i().createElement("div",{className:"mt-1 ".concat(Ou.titleBelow)},hu.G.isType(e.data,Su.E.Resource)&&!!(null===(o=null===(r=e.data)||void 0===r?void 0:r.metadata)||void 0===o?void 0:o.resourceType)&&i().createElement(wu.m,null,xu.getResourceTypeName(e.data.metadata.resourceType)),i().createElement("h3",{className:"h6 clamp-2"},e.data.name)))}function Nu(e){return Nu="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},Nu(e)}function ju(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,Pu(r.key),r)}}function Pu(e){var t=function(e,t){if("object"!=Nu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Nu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Nu(t)?t:t+""}function Iu(e,t,n){return t=Tu(t),function(e,t){if(t&&("object"==Nu(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,Lu()?Reflect.construct(t,n||[],Tu(e).constructor):t.apply(e,n))}function Lu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Lu=function(){return!!e})()}function Tu(e){return Tu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Tu(e)}function Au(e,t){return Au=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Au(e,t)}function _u(e){return i().createElement("div",{className:"cv-resource-item"},i().createElement(Cu,{data:e.resource,imageCdnUrl:e.imageCdnUrl,titlePosition:"above",hideTypeBadge:!0}))}Cu.defaultProps={preloadImage:!0,actionBehaviour:"normal"},i().memo((function(e){var t,n,r,o,a=(t=e.data,n=e.actionBehaviour,o=i().useContext(ku.X),"public"===n||!o.xs&&!o.sm&&"resource"===t.type&&"metadata"in t&&(t.metadata.type===pu.L.Image||(t.metadata.type===pu.L.Pdf?!!t.url:!!(null===(r=t.pdf)||void 0===r?void 0:r.url)))),c=Object.assign(Object.assign({},e.analyticsData),e.data),l=Object.assign(Object.assign({},e.analyticsOptions),{actionType:d.Vw.Click,entity:e.data.typeId===Su.E.Resource?d.py.Resource:d.py.Link});function s(){or.k.logUserAction(c,l)}var u,f=Object.assign(Object.assign({},e),{applyHoverState:a||!!e.data.url});return i().createElement("div",{className:"px-1 flex-shrink-0 ".concat(Ou.item," ").concat("play-page"===e.location?Ou.playPage:Ou.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:s},i().createElement(Cu,Object.assign({},f))):a?"public"===e.actionBehaviour?i().createElement("div",{className:"".concat(u," cursor-pointer d-inline"),onClick:function(){s(),fu.C$.trigger(e.getAppLink(e.data))}},i().createElement(Cu,Object.assign({},f))):i().createElement(N.F,{appLink:e.getAppLink(e.data),className:u,analyticsData:c,analyticsOptions:l},i().createElement(Cu,Object.assign({},f))):e.data.url?i().createElement("a",{href:e.data.url,className:u,onClick:s},i().createElement(Cu,Object.assign({},f))):i().createElement("div",{className:u},i().createElement(Cu,Object.assign({},f)))))}));var Fu=Uo((function(e,t){return i().createElement(_u,Object.assign({},t))})),Du=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=Iu(this,t,[e,n]);var i=new Fu(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&&Au(e,t)}(t,e),n=t,(r=[{key:"handleClick",value:function(e){e.stopImmediatePropagation(),this.options_.downloadResource(this.options_.resource)}}])&&ju(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("MenuItem"));function Ru(e){return Ru="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},Ru(e)}function Mu(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,Uu(r.key),r)}}function Uu(e){var t=function(e,t){if("object"!=Ru(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ru(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ru(t)?t:t+""}function Vu(e,t,n){return t=Gu(t),function(e,t){if(t&&("object"==Ru(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,Bu()?Reflect.construct(t,n||[],Gu(e).constructor):t.apply(e,n))}function Bu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Bu=function(){return!!e})()}function qu(){return qu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Gu(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}},qu.apply(null,arguments)}function Gu(e){return Gu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Gu(e)}function Zu(e,t){return Zu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Zu(e,t)}var zu=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=Vu(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&&Zu(e,t)}(t,e),n=t,(r=[{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-resources-button-wrapper ".concat(qu(Gu(t.prototype),"buildWrapperCSSClass",this).call(this))}},{key:"buildCSSClass",value:function(){return"cv-resources-button ".concat(qu(Gu(t.prototype),"buildCSSClass",this).call(this))}},{key:"update",value:function(){qu(Gu(t.prototype),"update",this).call(this)}},{key:"createItems",value:function(){var e=this,t=[];return t.push(new Tl.Z(this.player_,{label:"Resources"})),this.options_.resources.forEach((function(n){var r=new Du(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:fu.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(){qu(Gu(t.prototype),"handleClick",this).call(this,null)}}])&&Mu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getComponent("MenuButton"));function Hu(e){return Hu="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},Hu(e)}function Wu(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,Qu(r.key),r)}}function Qu(e){var t=function(e,t){if("object"!=Hu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Hu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Hu(t)?t:t+""}function Yu(e,t,n){return t=$u(t),function(e,t){if(t&&("object"==Hu(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,Ku()?Reflect.construct(t,n||[],$u(e).constructor):t.apply(e,n))}function Ku(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ku=function(){return!!e})()}function $u(e){return $u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$u(e)}function Xu(e,t){return Xu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Xu(e,t)}zu.prototype.controlText_="Resources",ae.Z.registerComponent("ResourcesButton",zu);var Ju=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=Yu(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&&Xu(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)}}}])&&Wu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ae.Z.getPlugin("plugin"));ae.Z.registerPlugin("resourcesPlugin",Ju);var ef=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 tf(e){var t=e.className,n=void 0===t?"":t,r=e.playerApi,o=e.onReady,a=e.onDispose,c=ef(e,["className","playerApi","onReady","onDispose"]),l=i().useRef();return i().useEffect((function(){if(l){var e=new qa.J(l.current,Object.assign(Object.assign({},c),{playerApi:r}));return o&&e.ready((function(){o(ba(e))})),a&&e.one("dispose",a),function(){null==e||e.dispose()}}}),[e.viewKey]),i().createElement("div",{ref:l,className:n})}var nf={placeholder:"JemW5"};function rf(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 of(){return i().createElement("div",{className:"".concat(nf.placeholder," partial-loading-background")})}function af(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return rf(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)?rf(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(tf,{playerApi:new URL(e.config.get("playerApiUrl")),viewKey:o})):i().createElement(of,null)}var cf="libraryRequests.info";function lf(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(La,{comments:e.comments,imageCdnUrl:e.config.get("imageCdnUrl")}),i().createElement("h2",{className:"h5"},i().createElement(o.x,{namespace:cf,phrase:"videoDetails"})),t&&i().createElement(i().Fragment,null,i().createElement(h,{video:e.libraryRequest.object,user:e.user,createViewKey:e.createViewKey,config:e.config}),i().createElement(Ua,{libraryRequest:e.libraryRequest,hideBroadcastInfo:e.user.get("instanceRegion")===a.b.US,config:e.config})),n&&i().createElement(i().Fragment,null,i().createElement(Oa,{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(af,{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),l=n(70065),s=n(49642),u=n(99910),f=n(64038),d=n(39396),p=n(63791),m={container:"VwD1b",spinner:"eJ85e"};function h(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return h(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)?h(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(m.container),ref:o},e.isFetching?r.createElement(u.Spinner,{as:"span",animation:"border",role:"status",className:m.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 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 T=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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return L(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=a[0],l=a[1];r.useEffect((function(){l(o)}),[o]);var s="".concat("d-flex align-items-center justify-content-center"," cursor-pointer ").concat(I.favouriteButton," ").concat(c?I.favourited:"");return e.className&&(s+=" ".concat(e.className)),k.q.isFunction(e.setFavourite)&&k.q.isFunction(e.canFavourite)&&e.canFavourite(e.video)?r.createElement(x.L,{className:s,onClick:function(){var t=!c;l(t),e.setFavourite(e.video,t,null,(function(){i.error(T(j.M.isClip(e.video)?t?"favouriteClipError":"unfavouriteClipError":j.M.isInteractive(e.video)?t?"favouriteInteractiveError":"unfavouriteInteractiveError":t?"favouriteVideoError":"unfavouriteVideoError")),l(!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),l=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),s=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:l,className:"".concat(c," ").concat(null!==(t=e.svgContainerClassName)&&void 0!==t?t:""),tagName:"div",size:s}):r.createElement("div",{className:V.fallbackThumbnailImage,style:{backgroundImage:"url('".concat(l,"')")}}))}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",Q="span";function Y(e){var t=e.children,n=e.className,i=void 0===n?W:n,o=e.tagName,a=void 0===o?Q:o,c=e.size,l=void 0===c?d.S.Standard:c,s=e.onClick,u=e.title,f=e.tooltipPlacement,p=void 0===f?"right":f,m=a,h={className:"".concat(i," svg-container ").concat(l),onClick:k.q.isFunction(s)?s:null};return u?r.createElement(H.u,{title:u,placement:p},r.createElement(m,Object.assign({},h),t)):r.createElement(m,Object.assign({},h),t)}function K(){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(K,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(s.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 le(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)}le.defaultProps={size:"md"};var se=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 me=i().createContext({hasProvider:!1}),he={hoverContainer:"TzWQw",hovering:"gdTcW"};function ve(e){var t,n=i().useContext(me);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(he.hoverContainer," ").concat(r?he.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,s=e.setFavourite,u=e.canFavourite,f=e.preload,m=e.hovering,h=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,m),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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,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.")}()),L=I[0],T=I[1]&&S&&h,F=Object.assign(Object.assign({},e.analyticsData),{id:o.id,name:o.name}),D=Object.assign(Object.assign({},x),{actionType:l.Vw.Click,descriptor:l._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:L},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:s,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(le,{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},!(!m||!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(m)," ").concat(ge.title)},C&&i().createElement(se.$,{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}),m&&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)})))))),T&&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,l=e.height,s=document.getElementById("content-width-reference");if(!s)return{};var u=t||c*i,f=t?t*(l/c):l*i,d=t?u/c:i;r=o-(u-c)/2,u<n&&(r-=(n-u)/2,f=l*(d=(u=n)/c));var p=a-(f-l)/2+window.scrollY,m=r,h=Se.Center;return r-s.offsetLeft<8&&(m=o-4,h=Se.Left),s.offsetWidth+s.offsetLeft-(r+u)<8&&(m=t?o+c-t:o-c*(d-1)+8,h=Se.Right),{left:m,top:p,height:f,width:u,transformOrigin:h,position:"absolute",originalWidth:c,originalHeight:l}},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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Le(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)?Le(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 Le(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 Te(e){var t,n,r=e.hoverableComponent,o=e.componentProps,a=e.minHoverWidth,c=e.fixedHoverWidth,s=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],m=d[1],h=Ie((0,ye.X)(),2),v=h[0],y=h[1],g=Ie(i().useState(!1),2),b=g[0],w=(g[1],i().useRef(null)),E=i().useRef(!1),S=m||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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(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],s=a[1],u=i().useRef(e?new Date:null);i().useEffect((function(){if(t&&n&&n.entity&&t.location)if(e)c||s(!0),u.current=new Date,Ce.k.logUserAction(t,Object.assign(Object.assign({},n),{actionType:l.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:l.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,s)}),[x,O,C,N,s]),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)}Te.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(se.$,{type:e.subTextType,className:"text-truncate ".concat("h9k1p"),video:t,appLink:r,analyticsOptions:{location:l.LZ.VideoThumbnail}}),i().createElement("h2",{className:"h6"},i().createElement(s.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(s.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(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"},j.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:l.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(Object.assign({videoGuidanceType:"interactive",videoGuidanceTotalItems:n},j.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:l.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(Object.assign({videoGuidanceType:"resource",videoGuidanceTotalItems:o},j.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:l.Vw.Click,entity:j.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}function Qe(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",Ke=function(e){var t,n=e.video,r=e.appLink,o=e.imageOptions,a=e.preload,c=e.setFavourite,s=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:{},m=j.M.getCanBeConsumed(n),h=m.canNavigate,v=m.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:l.Vw.Click,descriptor:l._S.Thumbnail});return i().createElement("div",{className:y},E&&i().createElement("div",{className:Ye},i().createElement(A,{setFavourite:c,canFavourite:s,video:n,analyticsData:e.analyticsData,analyticsOptions:b,preventFocus:!0})),!h&&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:h?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:h?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(le,{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(Qe,{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(Te,{hoverableComponent:Ke,componentProps:e,fixedHoverWidth:400,minHoverWidth:400,analyticsData:Object.assign(Object.assign({},e.analyticsData),{id:e.video.id,name:e.video.name}),analyticsOptions:Object.assign(Object.assign({},e.analyticsOptions),{entity: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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return rt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=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 lt={titleOverlay:"krg9f",clip:"MPRU6",large:"g5_ww",interactive:"Zzo3e",titleBelow:"tZjPt",overlayContainer:"EElm1",topLeftContainer:"hrw3I",gradient:"LS_EH"};function st(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ut(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ut(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ut(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ft="shared.staticVideoThumbnail";function dt(e){var t,n=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=lt.titleOverlay,u&&(j.M.isClip(n)&&(f+=" "+lt.clip),j.M.isInteractive(n)&&(f+=" "+lt.interactive))):f=lt.titleBelow,i().createElement("div",{className:f},j.M.isVideo(n)&&i().createElement(se.$,{type:e.subTextType,className:c?"text-shadow clamp-1":"clamp-2",video:n,appLink:c?null:r,analyticsOptions:{location:l.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(s.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,s=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=st((0,ye.X)(),2),m=p[0],h=p[1],v=st((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:l.Vw.Click,descriptor:l._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){m.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:s,canFavourite:function(){var t;return(null===(t=e.canFavourite)||void 0===t?void 0:t.call(e,e.video))&&P.showFavouriteButton(r,h)},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(lt.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:lt.overlayContainer},a===ot.Overlay&&i().createElement(dt,Object.assign({},e)),i().createElement("div",{className:"".concat(lt.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(le,{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 mt(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}}mt.defaultProps={hideRating:!0,size:"md",hoverToPlay:!0};var ht=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(s.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(mt,{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(se.$,{type:"series",video:r.object,analyticsOptions:{location:l.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!==ht.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===ht.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),l=n(49642),s=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({},s.D.RecentlyAdded,{name:o.T.getPhrase(d,"recentlyAdded")}),s.D.AtoZ,{name:o.T.getPhrase(d,"atoz")}),s.D.ZtoA,{name:o.T.getPhrase(d,"ztoa")}),s.D.Newest,{name:o.T.getPhrase(d,"newest")}),s.D.Oldest,{name:o.T.getPhrase(d,"oldest")}),s.D.Series,{name:o.T.getPhrase(d,"series")})}));function m(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(l.F,{className:i,appLink:e.getSortAppLink(n),analyticsData:{sort:t[n].name},analyticsOptions:e.analyticsOptions},t[n].name))}))))}function h(e){return h="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},h(e)}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=h(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}m.defaultProps={variant:"light"};var y=o.T.encloseNamespace("libraryRequests.sort"),g=function(){return v(v({},s.D.Newest,{name:y("newest")}),s.D.Oldest,{name:y("oldest")})};function b(e){var t=g();return i().createElement(m,{variant:"outline-dark",type:e.queryParams.sort||s.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),l=n(50072),s={svgContainer:"O2Czg"},u=o.T.encloseNamespace("libraryRequests.statusIcon");function f(e){switch(e){case l.l.AutoApproved:return u("autoApproved");case l.l.Approved:return u("approved");case l.l.Closed:return u("closed");case l.l.Rejected:return u("rejected")}return""}function d(e){var t="",n="".concat(s.svgContainer," text-white d-inline-block svg-container rounded-circle ");switch(e.status){case l.l.AutoApproved:t=c.vn.Check,n+="bg-gray-500";break;case l.l.Approved:t=c.vn.Check,n+="bg-success";break;case l.l.Closed:t=c.vn.Minus,n+="bg-gray-500";break;case l.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),l=n(41087),s=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(l.C,{type:l.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(s.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 m=n(50997),h=o.T.encloseNamespace("libraryRequests.tabs");function v(e){var t=[{name:h("pending"),appLink:{application:m.OV.LIBRARY_REQUESTS,action:m.eX.LibraryRequests.PENDING_REQUESTS,args:[""]},active:"pending"===e.active},{name:h("past"),appLink:{application:m.OV.LIBRARY_REQUESTS,action:m.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 l}});var r=n(1024),i=n.n(r),o=n(57857),a=n(89375),c=o.T.encloseNamespace("libraryRequests.libraryRequestTitle");function l(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 l}});var r=n(1024),i=n.n(r),o=n(86120),a=n(94223),c=n(25796);function l(e,t){var n=o.a.useGetFetch(),r=function(n){return c.y.libraryRequests(e,t,n)},l=function(e){return n(r(e))},s=(0,a.P)(r&&function(e){return r(e).key});return i().useEffect((function(){s&&s.shouldInitialFetch&&l()}),[e,t]),Object.assign(Object.assign({},s),{fetchNext:l})}},30328:function(e,t,n){"use strict";n.d(t,{A:function(){return 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 l}});var r=n(1024),i=n.n(r),o=n(31647),a=n(50997),c=n(50072);function l(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 l}});var r=n(1024),i=n.n(r),o=n(48088),a=n(54096),c=n(50997);function l(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),l=n(88483),s=n(2772),u=n(10101),f=n(89167),d=n(57098),p=n(93569),m=n(264),h=n(57e3),v=n(37339),y=n.n(v);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}function w(e){var t=function(e,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 m.g.hasLite?this.playerViewKey?this.player?void this.seekToChapter(e):(this.listenToOnce(this.options.channelName,"player:loaded",i.bind(this.seekToChapter,this,e)),void this.renderVideoPreview()):(this.listenToOnce(this.options.channelName,"player:loaded",i.bind(this.seekToChapter,this,e)),void this.requestViewKey()):this.webPlayer?void this.seekToChapter(e):(this.listenToOnce(this.options.channelName,"webplayer:loaded",i.bind(this.seekToChapter,this,e)),void this.renderVideoPreview())}},{key:"seekToChapter",value:function(e){this.player?this.player.currentTime(e):this.webPlayer.seekTo(e)}},{key:"requestViewKey",value:function(){var e=this;this.playerViewKey||this._viewKeyRequested||(this._viewKeyRequested=!0,this.options.createViewKey(this.model.get("id"),(function(t){e.playerViewKey=t,e.renderVideoPreview()})))}},{key:"onClick",value:function(){this.model.get("id")&&(m.g.hasLite?this.requestViewKey():this.webPlayer||this.renderVideoPreview())}},{key:"renderThumbnail",value:function(){this.showChildView("thumbnail",new s.Z({model:this.model,thumbnailOptions:{size:l.h2.Medium},playIcon:!0,lazyload:!0,channelName:this.instanceChannelName,thumbnail:p.M2.getThumbnail(this.model),duration:p.M2.getDuration(this.model),durationNewStyle:!0}))}},{key:"renderVideoPreview",value:function(){if(this.playerViewKey)return this.player=new h.l({model:this.playerViewKey,playerApiUrl:this.options.playerApiUrl,channelName:this.options.channelName}),void this.showChildView("player",this.player);this.webPlayer=new f.Q({model:this.model,webPlayerUrl:this.options.webPlayerUrl,parentChannelName:this.options.channelName,autoplay:!0,analyticsOptions:a.k.mergeOptions(this.options.analyticsOptions,{entity:c.py.Video}),captureAnalytics:this.options.captureAnalytics,currentUser:this.options.currentUser}),this.showChildView("player",this.webPlayer)}},{key:"onRender",value:function(){this.playerViewKey?this.renderVideoPreview():this.renderThumbnail()}}])&&b(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o}(o.Q.wA)},37339:function(e,t,n){var r=n(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})}}]);