@clickview/lite 0.35.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles.json +1 -1
- package/dist/scripts/{1316-5123580c25-lite.chunk.js → 1316-6f10b36512-lite.chunk.js} +1 -1
- package/dist/scripts/{1366-e5b46ac15b-lite.chunk.js → 1366-9085be8f1d-lite.chunk.js} +1 -1
- package/dist/scripts/1517-b1cad166ec-lite.chunk.js +1 -0
- package/dist/scripts/{1526-eda6832e12-lite.chunk.js → 1526-93624f65f1-lite.chunk.js} +1 -1
- package/dist/scripts/{1672-4ff30fe0d9-lite.chunk.js → 1672-18d6a86a04-lite.chunk.js} +1 -1
- package/dist/scripts/{1830-8741ff0b49-lite.chunk.js → 1830-6aba57235d-lite.chunk.js} +1 -1
- package/dist/scripts/1944-23f4b400c6-lite.chunk.js +1 -0
- package/dist/scripts/2235-4a03aae86f-lite.chunk.js +1 -0
- package/dist/scripts/2608-5af270eedf-lite.chunk.js +1 -0
- package/dist/scripts/2743-deafaa1681-lite.chunk.js +1 -0
- package/dist/scripts/{287-3eba510d3a-lite.chunk.js → 287-c53e62a45c-lite.chunk.js} +1 -1
- package/dist/scripts/{3020-1f43870f76-lite.chunk.js → 3020-923bf44c9b-lite.chunk.js} +1 -1
- package/dist/scripts/3216-d62de73736-lite.chunk.js +1 -0
- package/dist/scripts/{3446-f4de03ea76-lite.chunk.js → 3446-f8a4d517dd-lite.chunk.js} +1 -1
- package/dist/scripts/3488-dd8581e604-lite.chunk.js +2 -0
- package/dist/scripts/355-59bd6e899f-lite.chunk.js +1 -0
- package/dist/scripts/3645-30ba602f0c-lite.chunk.js +2 -0
- package/dist/scripts/3654-0961346057-lite.chunk.js +1 -0
- package/dist/scripts/3667-c9a9052d61-lite.chunk.js +2 -0
- package/dist/scripts/3706-482b7bb8d2-lite.chunk.js +2 -0
- package/dist/scripts/3728-51b81bfa83-lite.chunk.js +1 -0
- package/dist/scripts/3836-5487914e10-lite.chunk.js +1 -0
- package/dist/scripts/3848-b85b763432-lite.chunk.js +1 -0
- package/dist/scripts/3966-80e9cd7a87-lite.chunk.js +1 -0
- package/dist/scripts/{4032-ad48f98700-lite.chunk.js → 4032-01f86c1e49-lite.chunk.js} +1 -1
- package/dist/scripts/414-50eeedf502-lite.chunk.js +1 -0
- package/dist/scripts/4145-8a549f2fd1-lite.chunk.js +1 -0
- package/dist/scripts/4393-56a2324cff-lite.chunk.js +1 -0
- package/dist/scripts/4436-2615b1ce10-lite.chunk.js +1 -0
- package/dist/scripts/4441-d12cc318db-lite.chunk.js +2 -0
- package/dist/scripts/4612-60a22d0dd6-lite.chunk.js +1 -0
- package/dist/scripts/4617-3f998d9b1e-lite.chunk.js +1 -0
- package/dist/scripts/4676-9295ffc870-lite.chunk.js +2 -0
- package/dist/scripts/{4690-b7b01cea5f-lite.chunk.js → 4690-57efd6540e-lite.chunk.js} +1 -1
- package/dist/scripts/{4753-d8e01a7af9-lite.chunk.js → 4753-e9cd640ceb-lite.chunk.js} +1 -1
- package/dist/scripts/5041-2af2a2541f-lite.chunk.js +1 -0
- package/dist/scripts/{5143-56be0b0492-lite.chunk.js → 5143-8ad2cd9a86-lite.chunk.js} +1 -1
- package/dist/scripts/5271-da40b4f079-lite.chunk.js +1 -1
- package/dist/scripts/5555-e227390cc4-lite.chunk.js +1 -0
- package/dist/scripts/5611-d521edcea1-lite.chunk.js +1 -0
- package/dist/scripts/5986-6f6b2bdf89-lite.chunk.js +1 -0
- package/dist/scripts/615-20af1b2df5-lite.chunk.js +1 -0
- package/dist/scripts/6330-34349d1457-lite.chunk.js +1 -0
- package/dist/scripts/6368-632bb31d55-lite.chunk.js +1 -0
- package/dist/scripts/6532-19e258fc3e-lite.chunk.js +1 -0
- package/dist/scripts/6572-02f3301356-lite.chunk.js +1 -0
- package/dist/scripts/{6609-5e0d55ee56-lite.chunk.js → 6609-433a3003e6-lite.chunk.js} +1 -1
- package/dist/scripts/6801-30961910e4-lite.chunk.js +1 -0
- package/dist/scripts/6823-ca63f0d5eb-lite.chunk.js +2 -0
- package/dist/scripts/689-30388920c3-lite.chunk.js +1 -0
- package/dist/scripts/6896-e0f3a08bf2-lite.chunk.js +2 -0
- package/dist/scripts/6998-309a16b24e-lite.chunk.js +1 -0
- package/dist/scripts/7017-5eb39ba9d6-lite.chunk.js +2 -0
- package/dist/scripts/7052-ff6e30ba46-lite.chunk.js +2 -0
- package/dist/scripts/{7072-e5581f0660-lite.chunk.js → 7072-1cf02994dd-lite.chunk.js} +2 -2
- package/dist/scripts/7117-a7ffb9474e-lite.chunk.js +1 -0
- package/dist/scripts/{7178-a1115d825b-lite.chunk.js → 7178-3c36d6ca9f-lite.chunk.js} +1 -1
- package/dist/scripts/7205-1852c97c81-lite.chunk.js +1 -0
- package/dist/scripts/{7221-d71ae05428-lite.chunk.js → 7221-f5d0743e30-lite.chunk.js} +2 -2
- package/dist/scripts/{7286-ba6c277af4-lite.chunk.js → 7286-96e1818fd0-lite.chunk.js} +1 -1
- package/dist/scripts/7288-3d3041485c-lite.chunk.js +1 -0
- package/dist/scripts/7506-75116824b9-lite.chunk.js +1 -0
- package/dist/scripts/{7540-2694a96451-lite.chunk.js → 7540-419fef286c-lite.chunk.js} +1 -1
- package/dist/scripts/{7555-3d6fa65b58-lite.chunk.js → 7555-e79e8614f1-lite.chunk.js} +1 -1
- package/dist/scripts/{7703-58a0f0e91e-lite.chunk.js → 7703-5b15c739bd-lite.chunk.js} +1 -1
- package/dist/scripts/8046-82f07ecfc6-lite.chunk.js +1 -0
- package/dist/scripts/8095-c6901b0fa6-lite.chunk.js +1 -0
- package/dist/scripts/{817-68aeef8671-lite.chunk.js → 817-fc0acd6208-lite.chunk.js} +1 -1
- package/dist/scripts/{8323-e7e2a0a948-lite.chunk.js → 8323-ca8e0d6371-lite.chunk.js} +1 -1
- package/dist/scripts/8323-ca8e0d6371-lite.chunk.js.LICENSE.txt +1 -0
- package/dist/scripts/{8367-87790190cb-lite.chunk.js → 8367-6946446a01-lite.chunk.js} +1 -1
- package/dist/scripts/8564-3183d8595c-lite.chunk.js +1 -0
- package/dist/scripts/8759-46b3f7b560-lite.chunk.js +1 -0
- package/dist/scripts/8763-8fc868e00e-lite.chunk.js +1 -0
- package/dist/scripts/{9016-e97d214ce1-lite.chunk.js → 9016-236a5997d4-lite.chunk.js} +1 -1
- package/dist/scripts/9226-8d25ca41f8-lite.chunk.js +1 -0
- package/dist/scripts/9242-02b00e644d-lite.chunk.js +1 -0
- package/dist/scripts/{9869-601bc00f9b-lite.chunk.js → 9869-87a902e2d1-lite.chunk.js} +2 -2
- package/dist/scripts/9869-87a902e2d1-lite.chunk.js.LICENSE.txt +1 -0
- package/dist/scripts/bundle-efcc879242.min.js +2 -0
- package/jest.config.js +11 -11
- package/package.json +61 -61
- package/typings/libs/CVEvents.d.ts +12 -12
- package/typings/libs/CVLanguages.d.ts +24 -24
- package/typings/libs/cloneDeep.d.ts +4 -4
- package/typings/libs/cookiesjs.d.ts +25 -25
- package/typings/libs/draft-convert.d.ts +3 -3
- package/typings/libs/google-api.d.ts +93 -93
- package/typings/libs/intersection-observer.d.ts +82 -82
- package/typings/libs/microsoft-teams.d.ts +2 -2
- package/typings/libs/react-table-config.d.ts +138 -138
- package/typings/libs/trackjs.d.ts +2 -2
- package/typings/libs/videojs-contrib-quality-levels.d.ts +28 -28
- package/typings/utils/imports.d.ts +13 -13
- package/dist/scripts/1517-9158f5a30a-lite.chunk.js +0 -1
- package/dist/scripts/1944-8faad6e742-lite.chunk.js +0 -1
- package/dist/scripts/2235-02fa6854c8-lite.chunk.js +0 -1
- package/dist/scripts/2608-9d9eb7d113-lite.chunk.js +0 -1
- package/dist/scripts/2743-550d89b378-lite.chunk.js +0 -1
- package/dist/scripts/3216-9caff8afdd-lite.chunk.js +0 -1
- package/dist/scripts/3488-402969da0d-lite.chunk.js +0 -2
- package/dist/scripts/355-3eb0659bd4-lite.chunk.js +0 -1
- package/dist/scripts/3645-e68fabc894-lite.chunk.js +0 -2
- package/dist/scripts/3654-96999f107e-lite.chunk.js +0 -1
- package/dist/scripts/3667-289cb6db16-lite.chunk.js +0 -2
- package/dist/scripts/3706-e997fb8467-lite.chunk.js +0 -2
- package/dist/scripts/3728-8f767eeedd-lite.chunk.js +0 -1
- package/dist/scripts/3836-060f903a23-lite.chunk.js +0 -1
- package/dist/scripts/3848-a3b274c11c-lite.chunk.js +0 -1
- package/dist/scripts/3966-e4ad0f453d-lite.chunk.js +0 -1
- package/dist/scripts/4145-24137c0973-lite.chunk.js +0 -1
- package/dist/scripts/4393-bb6bbe6eb1-lite.chunk.js +0 -1
- package/dist/scripts/4436-b92639529d-lite.chunk.js +0 -1
- package/dist/scripts/4441-3d09d55849-lite.chunk.js +0 -2
- package/dist/scripts/4612-cfc046e6e9-lite.chunk.js +0 -1
- package/dist/scripts/4617-94a4942af7-lite.chunk.js +0 -1
- package/dist/scripts/5041-8e820ed93c-lite.chunk.js +0 -1
- package/dist/scripts/5555-e3cdd91f35-lite.chunk.js +0 -1
- package/dist/scripts/5611-1eeee649ed-lite.chunk.js +0 -1
- package/dist/scripts/5986-1e0b21c0d6-lite.chunk.js +0 -1
- package/dist/scripts/615-0322d641a3-lite.chunk.js +0 -1
- package/dist/scripts/6330-ff1a098eb1-lite.chunk.js +0 -1
- package/dist/scripts/6368-38cc77beda-lite.chunk.js +0 -1
- package/dist/scripts/6532-5bc872b460-lite.chunk.js +0 -1
- package/dist/scripts/6572-a77a3b657b-lite.chunk.js +0 -1
- package/dist/scripts/6725-6fe76436f5-lite.chunk.js +0 -1
- package/dist/scripts/6736-7223de888f-lite.chunk.js +0 -2
- package/dist/scripts/6801-fb5064f563-lite.chunk.js +0 -1
- package/dist/scripts/6823-b2eb2f9837-lite.chunk.js +0 -2
- package/dist/scripts/689-1c6a46496d-lite.chunk.js +0 -1
- package/dist/scripts/6896-8b4fc3fd6d-lite.chunk.js +0 -1
- package/dist/scripts/6998-1aa38379f3-lite.chunk.js +0 -1
- package/dist/scripts/7017-dc16719bf3-lite.chunk.js +0 -1
- package/dist/scripts/7052-d9ae572322-lite.chunk.js +0 -2
- package/dist/scripts/7117-1da2d8e101-lite.chunk.js +0 -1
- package/dist/scripts/7205-20ace43ff9-lite.chunk.js +0 -1
- package/dist/scripts/7288-8fca167593-lite.chunk.js +0 -1
- package/dist/scripts/7506-d91786f020-lite.chunk.js +0 -1
- package/dist/scripts/8046-1c2056961d-lite.chunk.js +0 -1
- package/dist/scripts/8095-ee8a101682-lite.chunk.js +0 -1
- package/dist/scripts/8564-fbf34ea798-lite.chunk.js +0 -1
- package/dist/scripts/8759-d8e5c29a2e-lite.chunk.js +0 -1
- package/dist/scripts/8772-0cae662668-lite.chunk.js +0 -1
- package/dist/scripts/9226-f59a8a5d53-lite.chunk.js +0 -1
- package/dist/scripts/9242-a9f54957c0-lite.chunk.js +0 -1
- package/dist/scripts/bundle-6f143bc21b.min.js +0 -2
- /package/dist/css/{6725-lite-db1dbcbd39.chunk.css → 414-lite-db1dbcbd39.chunk.css} +0 -0
- /package/dist/css/{8772-lite-db1dbcbd39.chunk.css → 8763-lite-db1dbcbd39.chunk.css} +0 -0
- /package/dist/scripts/{1366-e5b46ac15b-lite.chunk.js.LICENSE.txt → 1366-9085be8f1d-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{1672-4ff30fe0d9-lite.chunk.js.LICENSE.txt → 1672-18d6a86a04-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{1725-082ef05b56-lite.chunk.js → 1725-2eb898f9e6-lite.chunk.js} +0 -0
- /package/dist/scripts/{1891-af9f943f4d-lite.chunk.js → 1891-c0e59b8132-lite.chunk.js} +0 -0
- /package/dist/scripts/{1913-196e6dbf6e-lite.chunk.js → 1913-00de345658-lite.chunk.js} +0 -0
- /package/dist/scripts/{209-03f1ffaa32-lite.chunk.js → 209-d5def5db16-lite.chunk.js} +0 -0
- /package/dist/scripts/{2208-8e54f2060f-lite.chunk.js → 2208-c345263710-lite.chunk.js} +0 -0
- /package/dist/scripts/{2452-446607a894-lite.chunk.js → 2452-f96e548d17-lite.chunk.js} +0 -0
- /package/dist/scripts/{275-cfe76208a9-lite.chunk.js → 275-ba99531836-lite.chunk.js} +0 -0
- /package/dist/scripts/{3488-402969da0d-lite.chunk.js.LICENSE.txt → 3488-dd8581e604-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{3645-e68fabc894-lite.chunk.js.LICENSE.txt → 3645-30ba602f0c-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{3667-289cb6db16-lite.chunk.js.LICENSE.txt → 3667-c9a9052d61-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{3706-e997fb8467-lite.chunk.js.LICENSE.txt → 3706-482b7bb8d2-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{4182-e9700be806-lite.chunk.js → 4182-2de6622588-lite.chunk.js} +0 -0
- /package/dist/scripts/{4373-d7d9c8effd-lite.chunk.js → 4373-388f025686-lite.chunk.js} +0 -0
- /package/dist/scripts/{4441-3d09d55849-lite.chunk.js.LICENSE.txt → 4441-d12cc318db-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{6736-7223de888f-lite.chunk.js.LICENSE.txt → 4676-9295ffc870-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{5171-4e637c7361-lite.chunk.js → 5171-8572a352e6-lite.chunk.js} +0 -0
- /package/dist/scripts/{519-30f9dc5f0c-lite.chunk.js → 519-4140367219-lite.chunk.js} +0 -0
- /package/dist/scripts/{5606-404debcda3-lite.chunk.js → 5606-2596d38d1b-lite.chunk.js} +0 -0
- /package/dist/scripts/{5877-d728cd98a7-lite.chunk.js → 5877-0acd7d3124-lite.chunk.js} +0 -0
- /package/dist/scripts/{6290-4f53628aac-lite.chunk.js → 6290-337e7cf0ba-lite.chunk.js} +0 -0
- /package/dist/scripts/{6450-87b22756f6-lite.chunk.js → 6450-1b69ecb4d2-lite.chunk.js} +0 -0
- /package/dist/scripts/{6604-19f0427fcc-lite.chunk.js → 6604-d331808398-lite.chunk.js} +0 -0
- /package/dist/scripts/{6702-7f040268d0-lite.chunk.js → 6702-d96686b5d6-lite.chunk.js} +0 -0
- /package/dist/scripts/{6823-b2eb2f9837-lite.chunk.js.LICENSE.txt → 6823-ca63f0d5eb-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{7052-d9ae572322-lite.chunk.js.LICENSE.txt → 6896-e0f3a08bf2-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{7072-e5581f0660-lite.chunk.js.LICENSE.txt → 7017-5eb39ba9d6-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{7221-d71ae05428-lite.chunk.js.LICENSE.txt → 7052-ff6e30ba46-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{8323-e7e2a0a948-lite.chunk.js.LICENSE.txt → 7072-1cf02994dd-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{714-676e0b469a-lite.chunk.js → 714-02e02b6b62-lite.chunk.js} +0 -0
- /package/dist/scripts/{7164-9dec6a0e20-lite.chunk.js → 7164-6489adf352-lite.chunk.js} +0 -0
- /package/dist/scripts/{9869-601bc00f9b-lite.chunk.js.LICENSE.txt → 7221-f5d0743e30-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{7432-337ec5be0e-lite.chunk.js → 7432-ed0fdcb18c-lite.chunk.js} +0 -0
- /package/dist/scripts/{7701-3eb0dab472-lite.chunk.js → 7701-d1233778f2-lite.chunk.js} +0 -0
- /package/dist/scripts/{7818-c81c2d60b9-lite.chunk.js → 7818-a9ab33bdd4-lite.chunk.js} +0 -0
- /package/dist/scripts/{9016-e97d214ce1-lite.chunk.js.LICENSE.txt → 9016-236a5997d4-lite.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{bundle-6f143bc21b.min.js.LICENSE.txt → bundle-efcc879242.min.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 3706-482b7bb8d2-lite.chunk.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.webpackChunk_clickview_lite=self.webpackChunk_clickview_lite||[]).push([[3706],{73758:(t,e,n)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function o(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}n.d(e,{n:()=>a});var a=new(function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.listeners={}}var e,n;return e=t,n=[{key:"subscribe",value:function(t,e){this.registerListener(t,e)}},{key:"subscribeOnce",value:function(t,e){this.registerListener(t,e,1)}},{key:"unsubscribe",value:function(t,e){this.deregisterListener(t,e)}},{key:"trigger",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.triggerCallbacks(t,n)}},{key:"registerListener",value:function(t,e,n){var r;if("string"!=typeof t)throw new Error("Event name must be a string");if("function"!=typeof e)throw new Error("Event callback must be a function");if(n&&"number"!=typeof n)throw new Error("Execution limit must be a number or undefined");this.listeners[t]=null!==(r=this.listeners[t])&&void 0!==r?r:[],this.listeners[t].push({callback:e,executionLimit:n})}},{key:"deregisterListener",value:function(t,e){var n;if("string"!=typeof t)throw new Error("Event name must be a string");if(e&&"function"!=typeof e)throw new Error("Event callback must be a function");if(e){var r=null===(n=this.listeners[t])||void 0===n?void 0:n.findIndex((function(t){return t.callback===e}));"number"==typeof r&&-1!==r&&(this.listeners[t].splice(r,1),0===this.listeners[t].length&&delete this.listeners[t])}else this.listeners[t]=[]}},{key:"triggerCallbacks",value:function(t){for(var e=this,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(this.listeners[t]){var o=[];this.listeners[t].forEach((function(t){var e,n;"number"==typeof t.executionLimit&&(t.executionCount=null!==(n=t.executionCount)&&void 0!==n?n:0,t.executionCount++,t.executionCount===t.executionLimit&&o.push(t.callback)),(e=t.callback).apply.apply(e,[null].concat(r))})),o.length&&o.forEach((function(n){return e.deregisterListener(t,n)}))}}}],n&&i(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}())},26733:(t,e,n)=>{n.d(e,{s:()=>P,R:()=>S});var r=n(32735),i=n(39202),o=n(97395),a=n(49985),s=n(65858),c=n(36848),u=n(78276),l=n(76177),f=n(71063),h=n(54610),p=n(4594),d=n(1164),y=n(79967),v=n(67453);const b={imageStyle:"I9E5O",item:"tqUFn",background:"s1dNr",thumbnailContainer:"EDiGi",teacherPack:"_tdVE",text:"g5NWS",hoverState:"xRYhX",atomGuide:"X39wU",studentActivity:"X9pMl",additionalMaterials:"qRVUo",userUploaded:"_18JaV",imageTypeResource:"KYtZL"};var g={width:200,resizeType:h.Nq.Cover};function m(t,e){var n,r,i;if("thumbnail"in e&&(null===(n=e.thumbnail)||void 0===n?void 0:n.url))return v.j.createUrl(null===(r=e.thumbnail)||void 0===r?void 0:r.url,Object.assign({},g));var a=o._.safeUrlConcat(t,"/v1/previews");return"metadata"in e?e.metadata.type===d.L.Pdf?v.j.createResourceImage(a,e.url,g):e.metadata.type===d.L.Image?v.j.createUrl(e.url,{size:h.h2.Medium,resizeType:h.Nq.Cover}):(null===(i=e.pdf)||void 0===i?void 0:i.url)?v.j.createResourceImage(a,e.pdf.url,g):(e.metadata.type,d.L.Zip,"/images/zip-resource.png"):v.j.createResourceImage(a,e.url,Object.assign({},g))}function w(t){var e;return"metadata"in t?t.metadata.type===d.L.Pdf?h.__.Pdf:t.metadata.type===d.L.Image?h.__.Thumbnails:(null===(e=t.pdf)||void 0===e?void 0:e.url)?h.__.Pdf:(t.metadata.type,d.L.Zip,h.__.Thumbnails):h.__.Link}function P(t){var e,n,i,o,a,c,f,h=null,p=0;"metadata"in t.data&&(h=t.data.metadata,p=null!==(i=null===(n=null===(e=t.data.thumbnail)||void 0===e?void 0:e.metadata)||void 0===n?void 0:n.rotation)&&void 0!==i?i:0);var y="".concat(null!==(a=null===(o=t.theme)||void 0===o?void 0:o.containerClass)&&void 0!==a?a:""," pt-3 px-3 rounded-3 d-flex flex-column align-items-center")+" justify-content-end ".concat(function(t){switch(t){case"atom-guide":return b.atomGuide;case"student-activity":return b.studentActivity;case"teacher-pack":return b.teacherPack;case"additional-materials":return b.additionalMaterials;default:return b.userUploaded}}(null==h?void 0:h.resourceType)," ").concat(b.background," ").concat(t.applyHoverState?b.hoverState:""," ");return r.createElement("div",{className:y},!t.hideHeading&&r.createElement(l.u,{title:t.data.name},r.createElement("h3",{className:"text-center text-break h5 mb-3 ".concat(b.text)},r.createElement("span",{className:"clamp-1"},t.data.name))),r.createElement("div",{className:"".concat(null!==(f=null===(c=t.theme)||void 0===c?void 0:c.thumbnailContainerClass)&&void 0!==f?f:""," w-75 overflow-hidden ").concat(b.thumbnailContainer," ").concat(b.imageStyle)},r.createElement(u.Z,{data:m(t.imageCdnUrl,t.data),imageType:w(t.data),imageStyle:{transform:"rotate(".concat(p,"deg)")},alt:t.data.name,analyticsOptions:{location:s.LZ.SlidingListItem},errorFallbackImageSrc:t.imageErrorFallbackUrl,imageClassName:(null==h?void 0:h.type)===d.L.Image?"".concat(b.imageTypeResource," ").concat(b.imageStyle):"",preload:t.preloadImage,preventLoad:!t.preloadImage})))}P.defaultProps={preloadImage:!0,actionBehaviour:"normal"};var S=r.memo((function(t){var e,n,o,u,l=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,[]),h=(e=t.data,n=t.actionBehaviour,u=(0,y.k)(),"public"===n||!u.xs&&!u.sm&&"resource"===e.type&&"metadata"in e&&(e.metadata.type===d.L.Image||(e.metadata.type===d.L.Pdf?!!e.url:!!(null===(o=e.pdf)||void 0===o?void 0:o.url)))),v=Object.assign(Object.assign({},t.analyticsData),t.data),g=Object.assign(Object.assign({},t.analyticsOptions),{actionType:s.Vw.Click,entity:t.data.typeId===p.E.Resource?s.py.Resource:s.py.Link});function m(){a.k.logUserAction(v,g)}var w,S=!!t.data.url;return l.applyHoverState=h||S,r.createElement("div",{className:"pt-1 px-1 flex-shrink-0 ".concat(b.item," ").concat(f.M.RESOURCE_ITEM_SELECTOR)},(w="d-block no-decoration","link"===t.data.type?r.createElement("a",{href:t.data.url,target:"_blank",className:w,onClick:m},r.createElement(P,Object.assign({},l))):h?"public"===t.actionBehaviour?r.createElement("div",{className:"".concat(w," cursor-pointer d-inline"),onClick:function(){m(),i.C$.trigger(t.getAppLink(t.data))}},r.createElement(P,Object.assign({},l))):r.createElement(c.F,{appLink:t.getAppLink(t.data),className:w,analyticsData:v,analyticsOptions:g},r.createElement(P,Object.assign({},l))):S?r.createElement("a",{href:t.data.url,className:w,onClick:m},r.createElement(P,Object.assign({},l))):r.createElement("div",{className:w},r.createElement(P,Object.assign({},l)))))}))},6274:(t,e,n)=>{n.r(e),n.d(e,{ClickViewPlayer:()=>Tr});var r=n(32735),i=n(51482),o=(n(16852),n(93861));function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,c(r.key),r)}}function c(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:String(e)}function u(){return u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},u.apply(this,arguments)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(c,t);var e,n,r,i,o=(r=c,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=f(r);if(i){var n=f(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function c(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=o.apply(this,arguments)).alwaysCollapsed=!1,t.isCollapsed=!1,t.isCollabsible=!0,t}return e=c,(n=[{key:"buildCSSClass",value:function(){return"cv-create-clip-button"}},{key:"getCollabsibleName",value:function(){return this.controlText_}},{key:"getCollabsibleValue",value:function(){return""}},{key:"showInCollabsibleMenu",value:function(){return!0}},{key:"showCollapsibleMenu",value:function(){u(f(c.prototype),"handleClick",this).call(this,null)}}])&&s(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),c}(o.Z.getComponent("Button"));function p(t){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(t)}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}function y(t){var e=function(t,e){if("object"!=p(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==p(e)?e:String(e)}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}h.prototype.controlText_="Create Clip",o.Z.registerComponent("CreateClipButton",h);var g=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=b(r);if(i){var n=b(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===p(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(n=o.call(this,t,e)).options=e,t.ready((function(){return n.onReady()})),n}return e=a,(n=[{key:"onReady",value:function(){var t,e=this.player.getChild("collapserator"),n=null===(t=null==e?void 0:e.children())||void 0===t?void 0:t.findIndex((function(t){return"CustomControlSpacer"===t.name()}));n&&-1!==n&&e.addChild("CreateClipButton",{clickHandler:this.options.onClick},n+1)}}])&&d(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(o.Z.getPlugin("plugin"));function m(t){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,P(r.key),r)}}function P(t){var e=function(t,e){if("object"!=m(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==m(e)?e:String(e)}function S(t,e){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},S(t,e)}function k(t){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},k(t)}o.Z.registerPlugin("createClipButtonPlugin",g);var O=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&S(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=k(r);if(i){var n=k(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===m(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),o.apply(this,arguments)}return e=a,(n=[{key:"handlePictureInPictureEnabledChange",value:function(){this.enable()}}])&&w(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(o.Z.getComponent("PictureInPictureToggle"));function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function E(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,C(r.key),r)}}function C(t){var e=function(t,e){if("object"!=j(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==j(e)?e:String(e)}function x(){return x="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},x.apply(this,arguments)}function T(t,e){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},T(t,e)}function _(t){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_(t)}o.Z.registerComponent("PictureInPictureToggle",O);var I=o.Z.getComponent("PlayToggle"),R=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&T(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=_(r);if(i){var n=_(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===j(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(n=o.call(this,t,e)).pictureInPictureEnabled=!1,n.options=e,n.bindFunctions(),n}return e=a,(n=[{key:"bindFunctions",value:function(){this.requestPictureInPicture=this.requestPictureInPicture.bind(this),this.exitPictureInPicture=this.exitPictureInPicture.bind(this),this.onPlayerResize=this.onPlayerResize.bind(this),this.playerRequestPictureInPictureFn=this.player.requestPictureInPicture,this.playerExitPictureInPictureFn=this.player.exitPictureInPicture,this.player.requestPictureInPicture=this.requestPictureInPicture,this.player.exitPictureInPicture=this.exitPictureInPicture}},{key:"enablePictureInPicture",value:function(){var t=this;if(this.player.options_.fluid&&!this.pictureInPictureEnabled){var e=this.getToggleParentComponent();if(e){this.pictureInPictureEnabled=!0;var n=e.children().findIndex((function(t){var e;return"fullscreentoggle"===(null===(e=t.name())||void 0===e?void 0:e.toLowerCase())}));-1===n&&(n=e.children().length-1),e.addChild("pictureInPictureToggle",{},n);var r=e.getChild("pictureInPictureToggle");null==r||r.enable(),this.player.on("playerresize",this.onPlayerResize),this.player.on("dispose",(function(){var e;null===(e=t.player)||void 0===e||e.off("playerresize",t.onPlayerResize)}))}}}},{key:"disablePictureInPicture",value:function(){if(this.pictureInPictureEnabled){this.pictureInPictureEnabled=!1;var t=this.getToggleParentComponent(),e=null==t?void 0:t.getChild("pictureInPictureToggle");e&&t.removeChild(e),this.player.off("playerresize",this.onPlayerResize)}}},{key:"togglePictureInPicture",value:function(t){if(t!==this.player.isInPictureInPicture()){var e=t?"enterpictureinpicture":"leavepictureinpicture";this.player.isInPictureInPicture(t),this.player.trigger(e),t?this.addPipStyles():this.removePipStyles()}}},{key:"onPlayerResize",value:function(){if(!this.player.isInPictureInPicture()){var t=this.player.el().getBoundingClientRect();0!==t.width&&(t.width<800?this.disablePictureInPicture():this.enablePictureInPicture())}}},{key:"addPipStyles",value:function(){this.player.addClass("cv-picture-in-picture"),this.playToggle=new I(this.player),this.playToggle.addClass("cv-pip-play-toggle"),this.player.addChild(this.playToggle),this.player.paused()?this.playToggle.handlePause():this.playToggle.handlePlay()}},{key:"removePipStyles",value:function(){this.player.removeClass("cv-picture-in-picture"),this.player.removeChild(this.playToggle),delete this.playToggle}},{key:"requestPictureInPicture",value:function(){var t;this.pictureInPictureEnabled&&(this.togglePictureInPicture(!0),"function"==typeof(null===(t=this.options)||void 0===t?void 0:t.onRequestPictureInPicture)&&this.options.onRequestPictureInPicture(!0))}},{key:"exitPictureInPicture",value:function(){this.togglePictureInPicture(!1),this.options.onRequestPictureInPicture(!1),this.removePipStyles()}},{key:"getToggleParentComponent",value:function(){return this.player.getChild("collapserator")}},{key:"dispose",value:function(){this.player.requestPictureInPicture=this.playerRequestPictureInPictureFn,this.player.exitPictureInPicture=this.playerExitPictureInPictureFn,x(_(a.prototype),"dispose",this).call(this)}}])&&E(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(o.Z.getPlugin("plugin"));o.Z.registerPlugin("pictureInPicture",R);var L=n(23035),D=n(42892),M=n(73758);function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function A(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,V(r.key),r)}}function V(t){var e=function(t,e){if("object"!=N(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==N(e)?e:String(e)}function F(){return F="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=G(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},F.apply(this,arguments)}function B(t,e){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},B(t,e)}function U(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function G(t){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},G(t)}var Z=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&B(t,e)}(s,t);var e,n,r,i,a=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=G(r);if(i){var n=G(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===N(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return U(t)}(this,t)});function s(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(n=a.call(this,t,e)).hasBuffered=!1,n.hasPlayed=!1,n.eventsService=M.n,n.pointOfInterest=e.pointOfInterest,n.onMouseOver=n.onMouseOver.bind(U(n)),n.onMouseLeave=n.onMouseLeave.bind(U(n)),n.onGlancePointOfInterestMouseEnter=n.onGlancePointOfInterestMouseEnter.bind(U(n)),n.onGlancePointOfInterestMouseLeave=n.onGlancePointOfInterestMouseLeave.bind(U(n)),n.initialize(),n}return e=s,(n=[{key:"initialize",value:function(){this.setPosition(),this.bindListeners()}},{key:"buildCSSClass",value:function(){return"cv-point-of-interest-indicator ".concat(F(G(s.prototype),"buildCSSClass",this).call(this))}},{key:"createEl",value:function(t,e,n){return F(G(s.prototype),"createEl",this).call(this,t,Object.assign(Object.assign({},e),{className:this.buildCSSClass()}),n)}},{key:"bindListeners",value:function(){this.on("mouseover",this.onMouseOver),this.on("mouseleave",this.onMouseLeave),this.eventsService.subscribe("glance:poi:mouseover",this.onGlancePointOfInterestMouseEnter),this.eventsService.subscribe("glance:poi:mouseleave",this.onGlancePointOfInterestMouseLeave)}},{key:"dispose",value:function(){this.eventsService.unsubscribe("glance:poi:mouseover",this.onGlancePointOfInterestMouseEnter),this.eventsService.unsubscribe("glance:poi:mouseleave",this.onGlancePointOfInterestMouseLeave)}},{key:"getPointOfInterestTime",value:function(){return this.pointOfInterest.startTime}},{key:"setPosition",value:function(){var t=this.player().duration();this.el_.style.left=this.getPointOfInterestTime()/t*100+"%"}},{key:"updateBuffered",value:function(t){var e=this.getPointOfInterestTime()<=t;if(e!==this.hasBuffered){this.hasBuffered=e;var n="cv-point-of-interest-indicator-buffered";this.hasBuffered?this.addClass(n):this.removeClass(n)}}},{key:"updatePlaybackProgress",value:function(t){var e=this.getPointOfInterestTime()<=t;if(e!==this.hasPlayed){this.hasPlayed=e;var n="cv-point-of-interest-indicator-played";e?this.addClass(n):this.removeClass(n)}}},{key:"toggleVisibility",value:function(t){var e="cv-point-of-interest-indicator-hidden";t?this.removeClass(e):this.addClass(e)}},{key:"onMouseOver",value:function(){this.setTimeTooltipText(),this.eventsService.trigger("player:poi:mouseover",this.pointOfInterest)}},{key:"onMouseLeave",value:function(){this.clearTimeTooltipText(),this.eventsService.trigger("player:poi:mouseleave")}},{key:"onGlancePointOfInterestMouseEnter",value:function(t){t.id===this.pointOfInterest.id&&(this.addClass("cv-point-of-interest-indicator-highlight"),this.setTimeTooltipTime(),this.setTimeTooltipText(),this.positionMouseTimeDisplay(),this.showMouseTimeDisplay())}},{key:"onGlancePointOfInterestMouseLeave",value:function(){this.removeClass("cv-point-of-interest-indicator-highlight"),this.hideMouseTimeDisplay()}},{key:"setTimeTooltipText",value:function(){var t;null===(t=this.getTimeTooltip())||void 0===t||t.setCustomChapterText(this.pointOfInterest.description)}},{key:"clearTimeTooltipText",value:function(){var t;null===(t=this.getTimeTooltip())||void 0===t||t.setCustomChapterText()}},{key:"setTimeTooltipTime",value:function(){var t=this.getTimeTooltip();null==t||t.updateTime(this.getPointOfInterestTime())}},{key:"positionMouseTimeDisplay",value:function(){var t,e,n=null===(t=this.getSeekBar())||void 0===t?void 0:t.el();if(n){var r=o.Z.dom.findPosition(n),i=this.getPointOfInterestTime()/this.player().duration();null===(e=this.getMouseTimeDisplay())||void 0===e||e.update(r,i)}}},{key:"showMouseTimeDisplay",value:function(){var t;null===(t=this.getMouseTimeDisplay())||void 0===t||t.forceShow()}},{key:"hideMouseTimeDisplay",value:function(){var t;null===(t=this.getMouseTimeDisplay())||void 0===t||t.removeForceShow()}},{key:"getSeekBar",value:function(){var t;return null===(t=this.player().controlBar.getChild("ProgressControl"))||void 0===t?void 0:t.getChild("SeekBar")}},{key:"getMouseTimeDisplay",value:function(){var t;return null===(t=this.getSeekBar())||void 0===t?void 0:t.getChild("MouseTimeDisplay")}},{key:"getTimeTooltip",value:function(){var t;return null===(t=this.getMouseTimeDisplay())||void 0===t?void 0:t.getChild("TimeTooltip")}}])&&A(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(o.Z.getComponent("Component"));function z(t){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},z(t)}function q(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,H(r.key),r)}}function H(t){var e=function(t,e){if("object"!=z(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==z(e)?e:String(e)}function Y(){return Y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=$(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Y.apply(this,arguments)}function W(t,e){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},W(t,e)}function $(t){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$(t)}var Q=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&W(t,e)}(s,t);var e,n,r,i,a=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=$(r);if(i){var n=$(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===z(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(n=a.call(this,t,e)).pointsOfInterestVisible=e.pointsOfInterestVisible,n.toggle(n.pointsOfInterestVisible),n}return e=s,(n=[{key:"handleToggle",value:function(){this.toggle(!this.pointsOfInterestVisible)}},{key:"toggle",value:function(t){t?this.toggleOn():this.toggleOff()}},{key:"toggleOn",value:function(){o.Z.dom.addClass(this.toggleEl,"on"),this.pointsOfInterestVisible=!0,this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible)}},{key:"toggleOff",value:function(){o.Z.dom.removeClass(this.toggleEl,"on"),this.pointsOfInterestVisible=!1,this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible)}},{key:"handleClick",value:function(t){t.stopImmediatePropagation()}},{key:"createEl",value:function(t,e,n){this.handlerBound||(this.handleToggle=this.handleToggle.bind(this),this.handlerBound=!0),this.toggleEl&&this.toggleEl.removeEventListener("click",this.handleToggle),this.toggleEl=o.Z.dom.createEl("div",{className:"custom-toggle toggle-option float-end",innerHTML:'<span class="handle"></span></div>'}),this.toggleEl.addEventListener("click",this.handleToggle);var r=Y($(s.prototype),"createEl",this).call(this,t,{className:"vjs-menu-item cv-cog-menu-item",innerHTML:'\n <span class="vjs-menu-item-text">Points of Interest</span>\n <span class="cv-toggle-container"></span>'},n);return r.children[1].appendChild(this.toggleEl),r}}])&&q(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(o.Z.getComponent("MenuItem"));function X(t){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},X(t)}function J(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,K(r.key),r)}}function K(t){var e=function(t,e){if("object"!=X(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=X(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==X(e)?e:String(e)}function tt(t,e){return tt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},tt(t,e)}function et(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function nt(t){return nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nt(t)}o.Z.registerComponent("PointsOfInterestMenuItem",Q);var rt=o.Z.getPlugin("plugin"),it="cvplayer-points-of-interest",ot=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&tt(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=nt(r);if(i){var n=nt(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===X(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return et(t)}(this,t)});function a(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(n=o.call(this,t)).pointOfInterestIndicators=[],n.enabled=!0,n.pointsOfInterest=null==e?void 0:e.pointsOfInterest,n.initialize=n.initialize.bind(et(n)),n.updateBuffered=n.updateBuffered.bind(et(n)),n.updatePlaybackProgress=n.updatePlaybackProgress.bind(et(n)),n.player.one("loadedmetadata",(function(){return n.player.ready(n.initialize)})),n}return e=a,(n=[{key:"initialize",value:function(){this.pointsOfInterest&&(D.S.hasLocalStorage()&&"false"===D.S.get(it)&&(this.enabled=!1),this.setupTrack(),this.createPointOfInterestIndicators(),this.addMenuItem(),this.bindListeners())}},{key:"bindListeners",value:function(){var t=this;this.player.on("progress",this.updateBuffered),this.player.on("timeupdate",this.updatePlaybackProgress),this.player.on("dispose",(function(){var e,n;null===(e=t.player)||void 0===e||e.off("progress",t.updateBuffered),null===(n=t.player)||void 0===n||n.off("timeupdate",t.updatePlaybackProgress)}))}},{key:"togglePointsOfInterest",value:function(t){D.S.set(it,t.toString()),this.pointOfInterestIndicators.forEach((function(e){return e.toggleVisibility(t)}))}},{key:"setupTrack",value:function(){var t=this.player.addTextTrack("metadata","pointsofinterest");this.pointsOfInterest.forEach((function(e){t.addCue({startTime:e.startTime,endTime:e.endTime,text:e.description})})),t.trigger({type:"loadeddata",target:t})}},{key:"createPointOfInterestIndicators",value:function(){var t,e=this,n=null===(t=this.player.controlBar.getChild("ProgressControl"))||void 0===t?void 0:t.getChild("SeekBar");this.pointsOfInterest.forEach((function(t){var r=new Z(e.player,{pointOfInterest:t});e.pointOfInterestIndicators.push(r),n.addChild(r)}))}},{key:"addMenuItem",value:function(){var t;(null===(t=this.player.getChild("collapserator"))||void 0===t?void 0:t.getChild("cogButton")).addItem({index:0,ctor:Q,name:"PointsOfInterestMenuItem",options:{pointsOfInterestVisible:this.enabled}})}},{key:"updateBuffered",value:function(){var t=this;this.pointOfInterestIndicators.forEach((function(e){return e.updateBuffered((0,L.b)(t.player))}))}},{key:"updatePlaybackProgress",value:function(){var t=this;this.pointOfInterestIndicators.forEach((function(e){return e.updatePlaybackProgress(t.player.currentTime())}))}}])&&J(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(rt);o.Z.registerPlugin("pointsOfInterestPlugin",ot),n(93262);var at,st=n(65858),ct=n(33937);function ut(t){var e="function"==typeof Map?new Map:void 0;return ut=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return lt(t,arguments,pt(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ht(n,t)},ut(t)}function lt(t,e,n){return lt=ft()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&ht(i,n.prototype),i},lt.apply(null,arguments)}function ft(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function ht(t,e){return ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ht(t,e)}function pt(t){return pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pt(t)}function dt(t){return dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dt(t)}function yt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,gt(r.key),r)}}function bt(t,e,n){return e&&vt(t.prototype,e),n&&vt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function gt(t){var e=function(t,e){if("object"!=dt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=dt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dt(e)?e:String(e)}!function(t){t.AppleTv="apple-tv",t.Vivi="vivi"}(at||(at={}));var mt,wt,Pt,St=function(){function t(){yt(this,t),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)}return bt(t,[{key:"trigger",value:function(t){var e=this;this.callbacks.forEach((function(n,r){var i=e.predicates[r];i&&!i(t)||n(t)}))}},{key:"on",value:function(t){var e=this;this.isDisposed()&&console.warn("This EventChannel instance been disposed - this is a no-op");var n=this.callbacks.length;this.callbacks[n]=t,this.predicates[n]=function(){return!0};var r=function(){e.off(t)};return{off:r,filter:function(t){return e.predicates[n]=t,r}}}},{key:"one",value:function(){var t,e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0};return this.isDisposed()?kt.reject(new Error("This EventChannel instance has been disposed")):new kt((function(r,i){t=e.on((function(n){e.signal.removeEventListener("abort",o),t(),r(n)})).filter(n);var o=function(){t(),i(new Error("Aborted while waiting for message"))};e.signal.addEventListener("abort",o,{once:!0})}),(function(){t()}))}},{key:"off",value:function(t){var e=this.callbacks.indexOf(t);-1!==e&&(this.callbacks.splice(e,1),this.predicates.splice(e,1))}},{key:"dispose",value:function(){this.callbacks.length=0,this.predicates.length=0,this.controller.abort()}},{key:"isDisposed",value:function(){return this.signal.aborted}}]),t}(),kt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ht(t,e)}(i,t);var e,n,r=(e=i,n=ft(),function(){var t,r=pt(e);if(n){var i=pt(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return function(t,e){if(e&&("object"===dt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function i(t,e){var n;return yt(this,i),(n=r.call(this,t)).onTimeout=e,n.bindFunctions(),n}return bt(i,[{key:"bindFunctions",value:function(){this.timeout=this.timeout.bind(this)}},{key:"timeout",value:function(t){var e=this;return new Promise((function(n,r){e.then(n).catch(r).finally((function(){return clearTimeout(i)}));var i=setTimeout((function(){var t;null===(t=e.onTimeout)||void 0===t||t.call(e),r(new Error("Promise timed out"))}),t)}))}}],[{key:"reject",value:function(t){return new i((function(e,n){return n(t)}))}}]),i}(ut(Promise)),Ot=function(){function t(){yt(this,t),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)}return bt(t,[{key:"trigger",value:function(t,e){this.getChannel(t).trigger(e)}},{key:"on",value:function(t,e){return this.getChannel(t).on(e)}},{key:"one",value:function(t,e){return this.getChannel(t).one(e)}},{key:"off",value:function(t,e){this.getChannel(t).off(e)}},{key:"dispose",value:function(){this.trigger("dispose",jt.void),Object.values(this.channels).forEach((function(t){return t.dispose()})),this.channels={}}},{key:"getChannel",value:function(t){return this.channels[t]||(this.channels[t]=new St),this.channels[t]}}]),t}(),jt={void:void 0},Et=n(95569),Ct=function(t,e){return t._lastModified||(t._lastModified={}),new Proxy(t,{set:function(n,r,i,o){var a=t._lastModified[r.toString()];return!!(a&&Date.now()<a+e)||Reflect.set(n,r,i,o)}})},xt=function(t){return t._lastModified||(t._lastModified={}),new Proxy(t,{set:function(e,n,r,i){return t._lastModified[n.toString()]=Date.now(),Reflect.set(e,n,r,i)}})};function Tt(t){return Tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tt(t)}function _t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rt(r.key),r)}}function It(t,e,n){return e&&_t(t.prototype,e),n&&_t(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Rt(t){var e=function(t,e){if("object"!=Tt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Tt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tt(e)?e:String(e)}!function(t){t[t.Offline=0]="Offline",t[t.Online=1]="Online",t[t.Locked=2]="Locked",t[t.Suspended=3]="Suspended"}(mt||(mt={})),function(t){t[t.PlaybackStatusChange=0]="PlaybackStatusChange",t[t.PositionChange=1]="PositionChange"}(wt||(wt={})),function(t){t.Begin="BEGIN",t.Play="PLAY",t.Pause="PAUSE",t.Load="LOAD",t.Scan="SCAN",t.Stop="STOP"}(Pt||(Pt={}));var Lt=It((function t(e,n){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.title=e,this.device=n,this.locked=!1,this.position=0,this.playbackStatus=Pt.Load,this.debounced=Ct(this,2e3),xt(this)}));function Dt(t){return Dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dt(t)}function Mt(){Mt=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new _(r||[]);return i(a,"_invoke",{value:E(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={};function b(){}function g(){}function m(){}var w={};u(w,a,(function(){return this}));var P=Object.getPrototypeOf,S=P&&P(P(I([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=m.prototype=b.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(i,o,a,s){var c=f(t[i],t,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==Dt(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function E(e,n,r){var i=h;return function(o,a){if(i===d)throw new Error("Generator is already running");if(i===y){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var c=C(s,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=d;var u=f(e,n,r);if("normal"===u.type){if(i=r.done?y:p,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=y,r.method="throw",r.arg=u.arg)}}}function C(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,C(e,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,e.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[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(Dt(e)+" is not iterable")}return g.prototype=m,i(k,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:g,configurable:!0}),g.displayName=u(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,c,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},O(j.prototype),u(j.prototype,s,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new j(l(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(k),u(k,c,"Generator"),u(k,a,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){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"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Nt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,At(r.key),r)}}function At(t){var e=function(t,e){if("object"!=Dt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Dt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Dt(e)?e:String(e)}function Vt(){return Vt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Bt(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Vt.apply(this,arguments)}function Ft(t,e){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ft(t,e)}function Bt(t){return Bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bt(t)}var Ut=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ft(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Bt(r);if(i){var n=Bt(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Dt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(n=o.call(this)).client=t,n.localState=new Lt(e.title,e.device),n.bindFunctions(),n.initialize(),n}return e=a,(n=[{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(t){return console.error(t)})),Vt(Bt(a.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(t){if(t.deviceId===this.getDevice().id){var e=this.localState.debounced;switch(t.event){case wt.PlaybackStatusChange:this.handlePlaybackChange(e,t);break;case wt.PositionChange:this.handlePositionChange(e,t)}}}},{key:"handlePlaybackChange",value:function(t,e){t.playbackStatus!==e.params.playbackStatus&&(t.playbackStatus=e.params.playbackStatus,this.trigger("playingchange",jt.void),t.playbackStatus===Pt.Stop&&this.dispose())}},{key:"handlePositionChange",value:function(t,e){t.position!==e.params.position&&(t.position=e.params.position,this.trigger("positionchange",jt.void))}},{key:"loadSource",value:function(){return t=this,e=void 0,n=void 0,r=Mt().mark((function t(){return Mt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!this.localState.locked){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,this.client.lock(this.getDevice().id);case 5:return this.localState.locked=!0,t.next=8,this.client.loadVideo(this.getDevice().id);case 8:this.trigger("sourceloaded",jt.void),t.next=15;break;case 11:t.prev=11,t.t0=t.catch(0),console.error(t.t0),this.trigger("error",new Error("Could not load video on Apple TV device"));case 15:case"end":return t.stop()}}),t,this,[[0,11]])})),new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}));var t,e,n,r}},{key:"play",value:function(){this.localState.locked&&this.localState.playbackStatus!==Pt.Play&&(this.localState.playbackStatus=Pt.Play,this.client.play(this.getDevice().id),this.trigger("playingchange",jt.void))}},{key:"pause",value:function(){this.localState.locked&&this.localState.playbackStatus!==Pt.Pause&&(this.localState.playbackStatus=Pt.Pause,this.client.pause(this.getDevice().id),this.trigger("playingchange",jt.void))}},{key:"seek",value:function(t){this.localState.locked&&this.localState.position!==t&&(this.localState.position=t,this.client.seek(this.getDevice().id,t),this.trigger("positionchange",jt.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===Pt.Play||this.localState.playbackStatus===Pt.Begin||this.localState.playbackStatus===Pt.Load}},{key:"isPlaybackFinished",value:function(){return this.localState.playbackStatus===Pt.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}}])&&Nt(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(Ot);function Gt(t){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gt(t)}function Zt(){Zt=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new _(r||[]);return i(a,"_invoke",{value:E(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={};function b(){}function g(){}function m(){}var w={};u(w,a,(function(){return this}));var P=Object.getPrototypeOf,S=P&&P(P(I([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=m.prototype=b.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(i,o,a,s){var c=f(t[i],t,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==Gt(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function E(e,n,r){var i=h;return function(o,a){if(i===d)throw new Error("Generator is already running");if(i===y){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var c=C(s,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=d;var u=f(e,n,r);if("normal"===u.type){if(i=r.done?y:p,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=y,r.method="throw",r.arg=u.arg)}}}function C(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,C(e,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,e.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[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(Gt(e)+" is not iterable")}return g.prototype=m,i(k,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:g,configurable:!0}),g.displayName=u(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,c,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},O(j.prototype),u(j.prototype,s,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new j(l(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(k),u(k,c,"Generator"),u(k,a,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){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"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function zt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,qt(r.key),r)}}function qt(t){var e=function(t,e){if("object"!=Gt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Gt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Gt(e)?e:String(e)}function Ht(){return Ht="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Wt(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Ht.apply(this,arguments)}function Yt(t,e){return Yt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Yt(t,e)}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wt(t)}var $t,Qt=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))};!function(t){t.DeviceList="DeviceList",t.DeviceStateChange="DeviceStateChange",t.Paired="Paired",t.Unpaired="Unpaired",t.PlayStatusChange="PlayStatusChange",t.TimeSync="TimeSync"}($t||($t={}));var Xt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Yt(t,e)}(s,t);var e,n,r,i,o,a=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Wt(i);if(o){var n=Wt(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Gt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=a.call(this)).options=t,e.accessToken="",e.devices=[],e.bindFunctions(),e.initialize(),e}return e=s,n=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.invoke=this.invoke.bind(this),this.invokeDebounced=(0,Et.Ds)(this.invoke,500,!0),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.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)}},{key:"initialize",value:function(){var t=this;this.connection=(0,ct.OB)(this.options.url.toString(),{logging:!1}),this.hubProxy=this.connection.createHubProxy("DeviceUserHub"),this.hubProxy.on($t.DeviceList,this.handleDeviceList),this.hubProxy.on($t.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.on($t.Paired,this.handleDevicePaired),this.hubProxy.on($t.Paired,this.handleDeviceUnpaired),this.hubProxy.on($t.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.on($t.TimeSync,this.handleTimeSync),this.connection.start({jsonp:!1,withCredentials:!1}).done((function(){return Qt(t,void 0,void 0,Zt().mark((function t(){return Zt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.options.fetchAccessToken();case 3:return this.accessToken=t.sent,t.next=6,this.invoke("Subscribe",this.accessToken);case 6:if(t.sent){t.next=9;break}throw new Error("The subscription request was rejected by Online API");case 9:this.trigger("connected",jt.void),t.next=16;break;case 12:t.prev=12,t.t0=t.catch(0),console.error(t.t0),this.trigger("error",new Error("Could not subscribe to Online API"));case 16:case"end":return t.stop()}}),t,this,[[0,12]])})))})).fail((function(){t.trigger("error",new Error("Could not connect to Online API"))})),this.connection.disconnected((function(){return t.trigger("disconnected",jt.void)}))}},{key:"invoke",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i;return Qt(this,void 0,void 0,Zt().mark((function e(){var r;return Zt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(i=this.hubProxy)||void 0===i?void 0:(r=i).invoke.apply(r,[t].concat(n));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"dispose",value:function(){this.hubProxy.off($t.DeviceList,this.handleDeviceList),this.hubProxy.off($t.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.off($t.Paired,this.handleDevicePaired),this.hubProxy.off($t.Paired,this.handleDeviceUnpaired),this.hubProxy.off($t.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.off($t.TimeSync,this.handleTimeSync),this.hubProxy.connection.stop(!1,!0),Ht(Wt(s.prototype),"dispose",this).call(this)}},{key:"canCastToDevice",value:function(t){return t===at.AppleTv}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(t){return new Ut(this,t)}},{key:"lock",value:function(t){return Qt(this,void 0,void 0,Zt().mark((function e(){return Zt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke("lock",t,this.options.userId,this.options.username);case 2:if(e.sent){e.next=5;break}throw new Error("Could not lock device");case 5:case"end":return e.stop()}}),e,this)})))}},{key:"loadVideo",value:function(t){return Qt(this,void 0,void 0,Zt().mark((function e(){return Zt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke("command",{DeviceId:t,CommandType:Pt.Play,Data:this.options.trackingCode});case 2:case"end":return e.stop()}}),e,this)})))}},{key:"play",value:function(t){return Qt(this,void 0,void 0,Zt().mark((function e(){return Zt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke("command",{DeviceId:t,CommandType:Pt.Play});case 2:case"end":return e.stop()}}),e,this)})))}},{key:"pause",value:function(t){return Qt(this,void 0,void 0,Zt().mark((function e(){return Zt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke("command",{DeviceId:t,CommandType:Pt.Pause});case 2:case"end":return e.stop()}}),e,this)})))}},{key:"seek",value:function(t,e){this.invokeDebounced("command",{DeviceId:t,CommandType:Pt.Play,Params:"1,".concat(Math.trunc(e))})}},{key:"stop",value:function(t){return Qt(this,void 0,void 0,Zt().mark((function e(){return Zt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke("command",{DeviceId:t,CommandType:Pt.Stop});case 2:case"end":return e.stop()}}),e,this)})))}},{key:"handleDeviceList",value:function(t){this.devices=t.map(s.convertToGenericDevice),this.trigger("deviceschange",jt.void)}},{key:"handleDeviceStateChange",value:function(t){var e=this.devices.findIndex((function(e){return e.id===t.deviceId}));e>=0&&(this.devices[e]=s.convertToGenericDevice(t),this.trigger("deviceschange",jt.void))}},{key:"handleDevicePaired",value:function(t){this.devices.push(s.convertToGenericDevice(t)),this.trigger("deviceschange",jt.void)}},{key:"handleDeviceUnpaired",value:function(t){this.devices=this.devices.filter((function(e){return e.id!==t})),this.trigger("deviceschange",jt.void)}},{key:"handlePlayStatusChange",value:function(t,e){this.trigger("message",{event:wt.PlaybackStatusChange,deviceId:t,params:{playbackStatus:e.commandType}})}},{key:"handleTimeSync",value:function(t,e){this.trigger("message",{event:wt.PositionChange,deviceId:t,params:{position:e}})}}],r=[{key:"convertToGenericDevice",value:function(t){return{id:t.deviceId,name:t.name,type:at.AppleTv,available:t.status===mt.Online}}}],n&&zt(e.prototype,n),r&&zt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ot);function Jt(t){return Jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jt(t)}function Kt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,te(r.key),r)}}function te(t){var e=function(t,e){if("object"!=Jt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Jt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Jt(e)?e:String(e)}var ee=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.bindFunctions()}var e,n;return e=t,(n=[{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(t){return this.task=t,this}},{key:"every",value:function(t){return this.intervalInMilliseconds=t,this}},{key:"trigger",value:function(){var t;return null===(t=this.task)||void 0===t||t.call(this,this),this}},{key:"start",value:function(){var t=this;return this.intervalId||(this.intervalId=setInterval((function(){return t.trigger()}),this.intervalInMilliseconds)),this}},{key:"stop",value:function(){return this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this}}])&&Kt(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ne(t){return ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ne(t)}function re(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ie(r.key),r)}}function ie(t){var e=function(t,e){if("object"!=ne(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=ne(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ne(e)?e:String(e)}var oe={reconnectIntervalInMilliseconds:3e3,heartbeatEnabled:!1,heartbeatIntervalInMillseconds:1e4,heartbeatMessage:""},ae=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oe;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.bindFunctions(),this.url=e,this.options=Object.assign(Object.assign({},oe),r),this.webSocket=this.connect(),this.heartbeat=(new ee).schedule((function(){return n.send(n.options.heartbeatMessage)})).every(this.options.heartbeatIntervalInMillseconds)}var e,n;return e=t,(n=[{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(t){var e;null===(e=this.onOpen)||void 0===e||e.call(this,t),this.options.heartbeatEnabled&&this.heartbeat.start()}},{key:"handleMessage",value:function(t){var e;null===(e=this.onMessage)||void 0===e||e.call(this,t)}},{key:"handleClose",value:function(t){var e,n=this;null===(e=this.onClose)||void 0===e||e.call(this,t),this.cleanup(),setTimeout((function(){n.webSocket=n.connect()}),this.options.reconnectIntervalInMilliseconds)}},{key:"handleError",value:function(t){var e;null===(e=this.onError)||void 0===e||e.call(this,t),this.handleClose()}},{key:"connect",value:function(){var t=new WebSocket(this.url);return t.addEventListener("open",this.handleOpen),t.addEventListener("message",this.handleMessage),t.addEventListener("close",this.handleClose),t.addEventListener("error",this.handleError),t}},{key:"send",value:function(t){this.webSocket.send(t)}},{key:"dipose",value:function(){this.cleanup(),this.webSocket.close()}}])&&re(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),se=function(){var t,e;return null!==(e=null===(t=window.crypto)||void 0===t?void 0:t.randomUUID())&&void 0!==e?e:Math.random().toString()};function ce(t){return ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(t)}function ue(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,le(r.key),r)}}function le(t){var e=function(t,e){if("object"!=ce(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=ce(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ce(e)?e:String(e)}var fe,he=function(){function t(e,n){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),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=e,this.device=n,this.ready=!1,this.playbackFinished=!1,this.debounced=Ct(this,2e3),xt(this)}var e,n;return e=t,(n=[{key:"position",get:function(){return this._position+this.getTimerDurationInSeconds()},set:function(t){this._position=t,this.restartTimer()}},{key:"playing",get:function(){return this._playing},set:function(t){this._playing=t,t?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}}])&&ue(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function pe(t){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pe(t)}function de(){de=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new _(r||[]);return i(a,"_invoke",{value:E(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={};function b(){}function g(){}function m(){}var w={};u(w,a,(function(){return this}));var P=Object.getPrototypeOf,S=P&&P(P(I([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=m.prototype=b.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(i,o,a,s){var c=f(t[i],t,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==pe(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function E(e,n,r){var i=h;return function(o,a){if(i===d)throw new Error("Generator is already running");if(i===y){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var c=C(s,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=d;var u=f(e,n,r);if("normal"===u.type){if(i=r.done?y:p,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=y,r.method="throw",r.arg=u.arg)}}}function C(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,C(e,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,e.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[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(pe(e)+" is not iterable")}return g.prototype=m,i(k,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:g,configurable:!0}),g.displayName=u(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,c,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},O(j.prototype),u(j.prototype,s,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new j(l(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(k),u(k,c,"Generator"),u(k,a,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){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"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ye(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ve(r.key),r)}}function ve(t){var e=function(t,e){if("object"!=pe(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=pe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pe(e)?e:String(e)}function be(){return be="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=me(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},be.apply(this,arguments)}function ge(t,e){return ge=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ge(t,e)}function me(t){return me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},me(t)}!function(t){t.Update="update",t.Volume="volume",t.Playing="playing",t.Paused="paused",t.NewChapter="new_chapter",t.Stopped="stopped",t.Ready="ready",t.Mute="mute",t.Finished="finished"}(fe||(fe={}));var we=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},Pe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ge(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=me(r);if(i){var n=me(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===pe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(n=o.call(this)).client=t,n.localState=new he(e.title,e.device),n.bindFunctions(),n.initialize(),n}return e=a,(n=[{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 t=this;this.client.on("dispose",this.dispose),this.client.on("connected",this.handleClientConnected),this.client.on("message",this.handleDisconnectMessage).filter((function(e){return e.source===t.getDevice().id&&"disconnect"===e.message.type})),this.client.on("message",this.handleAllVideoMessages).filter((function(e){return e.source===t.getDevice().id&&"video_event"===e.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(t){return console.error(t)})),be(me(a.prototype),"dispose",this).call(this)}},{key:"handleClientConnected",value:function(){return we(this,void 0,void 0,de().mark((function t(){return de().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.client.joinRoom(this.getDevice().id);case 3:t.next=8;break;case 5:t.prev=5,t.t0=t.catch(0),this.trigger("error",t.t0);case 8:case"end":return t.stop()}}),t,this,[[0,5]])})))}},{key:"handleDisconnectMessage",value:function(){this.dispose()}},{key:"handleAllVideoMessages",value:function(t){var e=this.localState.debounced,n=t.message.payload.params||{};switch(t.message.payload.event){case fe.Update:this.handleUpdateMessage(e,n);break;case fe.NewChapter:this.handleNewChapterMessage(e,n);break;case fe.Volume:this.handleVolumeMessage(e,n);break;case fe.Playing:this.handlePlayingMessage(e);break;case fe.Paused:this.handlePausedMessage(e);break;case fe.Finished:this.handleFinishedMessage(e);break;case fe.Stopped:this.handleStoppedMessage()}}},{key:"handleUpdateMessage",value:function(t,e){t.duration!==e.duration&&(t.duration=e.duration,this.trigger("durationchange",jt.void)),t.position!==e.position&&(t.position=e.position,this.trigger("positionchange",jt.void)),t.subtitles!==e.subtitles&&(t.subtitles=e.subtitles,this.trigger("subtitleschange",jt.void))}},{key:"handleVolumeMessage",value:function(t,e){t.volume!==e.level&&(t.volume=e.level,t.mute=0===e.level,this.trigger("volumechange",jt.void))}},{key:"handlePlayingMessage",value:function(t){!0!==t.playing&&(t.playing=!0,t.playbackFinished=!1,this.trigger("playingchange",jt.void))}},{key:"handlePausedMessage",value:function(t){!1!==t.playing&&(t.playing=!1,this.trigger("playingchange",jt.void))}},{key:"handleFinishedMessage",value:function(t){!0!==t.playbackFinished&&(t.playing=!1,t.playbackFinished=!0,this.trigger("playingchange",jt.void))}},{key:"handleNewChapterMessage",value:function(t,e){var n,r=(null!==(n=e.queue)&&void 0!==n?n:[]).find((function(e){return e.url===t.videoSource}));if(!r)return console.info("The device is no longer playing the source we loaded - disposing the session"),void this.dispose();t.subtitleSource!==r.suburl&&(t.subtitleSource=r.suburl,this.trigger("subtitleschange",jt.void))}},{key:"handleStoppedMessage",value:function(){this.dispose()}},{key:"loadSource",value:function(t,e){return we(this,void 0,void 0,de().mark((function n(){var r,i;return de().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.localState.videoSource!==t||this.localState.subtitleSource!==e){n.next=2;break}return n.abrupt("return");case 2:return n.prev=2,r=this.getDevice().id,i=this.getPosition(),this.localState.videoSource=t,this.localState.subtitleSource=e,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:t,subtitleSource:e});case 12:this.localState.ready=!0,this.trigger("sourceloaded",jt.void),i>0&&this.client.seek(r,i),n.next=21;break;case 17:n.prev=17,n.t0=n.catch(2),console.error(n.t0),this.trigger("error",new Error("Could not load video on Vivi device"));case 21:case"end":return n.stop()}}),n,this,[[2,17]])})))}},{key:"play",value:function(){this.localState.ready&&!0!==this.localState.playing&&(this.localState.playing=!0,this.client.play(this.getDevice().id),this.trigger("playingchange",jt.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",jt.void))}},{key:"seek",value:function(t){this.localState.ready&&this.localState.position!==t&&(this.localState.position=t,this.client.seek(this.getDevice().id,t),this.trigger("positionchange",jt.void))}},{key:"setVolume",value:function(t){this.localState.ready&&this.localState.volume!==t&&(this.localState.volume=t,this.client.setVolume(this.getDevice().id,t),this.trigger("volumechange",jt.void))}},{key:"setMuted",value:function(t){this.localState.ready&&this.localState.mute!==t&&(this.localState.mute=t,this.client.setMuted(this.getDevice().id,t),this.trigger("volumechange",jt.void))}},{key:"setSubtitles",value:function(t){return we(this,void 0,void 0,de().mark((function e(){var n;return de().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.localState.ready){e.next=2;break}return e.abrupt("return");case 2:if(!t){e.next=5;break}return e.next=5,this.loadSource(this.localState.videoSource,t);case 5:n=!!t,this.localState.subtitles!==n&&(this.localState.subtitles=n,this.client.setSubtitles(this.getDevice().id,n),this.trigger("subtitleschange",jt.void));case 7:case"end":return e.stop()}}),e,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}}])&&ye(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(Ot);function Se(t){return Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Se(t)}function ke(){ke=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new _(r||[]);return i(a,"_invoke",{value:E(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={};function b(){}function g(){}function m(){}var w={};u(w,a,(function(){return this}));var P=Object.getPrototypeOf,S=P&&P(P(I([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=m.prototype=b.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(i,o,a,s){var c=f(t[i],t,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==Se(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function E(e,n,r){var i=h;return function(o,a){if(i===d)throw new Error("Generator is already running");if(i===y){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var c=C(s,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=d;var u=f(e,n,r);if("normal"===u.type){if(i=r.done?y:p,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=y,r.method="throw",r.arg=u.arg)}}}function C(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,C(e,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,e.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[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(Se(e)+" is not iterable")}return g.prototype=m,i(k,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:g,configurable:!0}),g.displayName=u(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,c,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},O(j.prototype),u(j.prototype,s,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new j(l(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(k),u(k,c,"Generator"),u(k,a,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){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"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Oe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,je(r.key),r)}}function je(t){var e=function(t,e){if("object"!=Se(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Se(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Se(e)?e:String(e)}function Ee(){return Ee="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=xe(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Ee.apply(this,arguments)}function Ce(t,e){return Ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ce(t,e)}function xe(t){return xe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xe(t)}var Te=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},_e=1e4,Ie=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ce(t,e)}(s,t);var e,n,r,i,o,a=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=xe(i);if(o){var n=xe(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Se(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=a.call(this)).options=t,e.accessToken="",e.devices=[],e.devicesFingerprint="",e.deviceDiscovery=new ee,e.bindFunctions(),e.initialize(),e}return e=s,r=[{key:"createAckId",value:function(){return se()}},{key:"calculateFingerprint",value:function(t){return t.map((function(t){return t.id})).sort().join(",")}}],(n=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendMessageDebounced=(0,Et.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 t=this;this.webSocket=new ae(this.options.url.toString()),this.webSocket.onMessage=function(e){return t.trigger("message",JSON.parse(e.data))},this.webSocket.onOpen=function(){return Te(t,void 0,void 0,ke().mark((function t(){return ke().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.options.fetchAccessToken();case 3:return this.accessToken=t.sent,t.next=6,this.authenticateWithVivi();case 6:this.beginDeviceDiscovery(),this.trigger("connected",jt.void),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(0),console.error(t.t0),this.trigger("error",new Error("Could not connect to Vivi"));case 14:case"end":return t.stop()}}),t,this,[[0,10]])})))}}},{key:"sendMessage",value:function(t){var e;null===(e=this.webSocket)||void 0===e||e.send(JSON.stringify(t))}},{key:"beginDeviceDiscovery",value:function(){var t=this;this.deviceDiscovery.every(1e4).schedule((function(){return Te(t,void 0,void 0,ke().mark((function t(){var e,n;return ke().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getRoomList();case 3:if(e=t.sent,(n=s.calculateFingerprint(e))!==this.devicesFingerprint){t.next=7;break}return t.abrupt("return");case 7:this.devices=e.map((function(t){return{id:t.id,name:t.name,type:at.Vivi,available:!0}})),this.devicesFingerprint=n,this.trigger("deviceschange",jt.void),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),console.warn(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})))})).trigger().start()}},{key:"dispose",value:function(){var t;this.deviceDiscovery.stop(),null===(t=this.webSocket)||void 0===t||t.dipose(),Ee(xe(s.prototype),"dispose",this).call(this)}},{key:"canCastToDevice",value:function(t){return t===at.Vivi}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(t){return new Pe(this,t)}},{key:"authenticateWithVivi",value:function(){return Te(this,void 0,void 0,ke().mark((function t(){return ke().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:"relay",message:{token:this.accessToken,type:"identify_video_api"}}),t.next=3,this.one("message",(function(t){return"video_api_identified"===t.message.type})).timeout(_e).catch((function(){throw new Error("Failed to authenticate with Vivi")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getRoomList",value:function(){return Te(this,void 0,void 0,ke().mark((function t(){var e;return ke().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:"relay",message:{type:"video_api_rooms"}}),t.next=3,this.one("message",(function(t){return"video_api_rooms"===t.message.type})).timeout(_e).catch((function(){throw new Error("Failed to fetch rooms")}));case 3:return e=t.sent,t.abrupt("return",e.message.rooms||[]);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"joinRoom",value:function(t){return Te(this,void 0,void 0,ke().mark((function e(){return ke().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:"relay",message:{destination_type:"box",new_destination:t,token:this.accessToken,type:"connect"}}),e.next=3,this.one("message",(function(e){return e.source===t&&"connect"===e.message.type||"error"===e.message.type&&"already_connected"===e.message.error_type||void 0})).timeout(_e).catch((function(){throw new Error("Failed to join room")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"query",value:function(t){return Te(this,void 0,void 0,ke().mark((function e(){var n;return ke().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.createAckId(),this.sendMessage({destination:t,message:{type:"message_with_ack",ack_id:n,name:"query"}}),e.next=4,this.one("message",(function(t){return t.message.ack_id===n})).timeout(_e).catch((function(){throw new Error("Failed to fetch query")}));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)})))}},{key:"loadQueue",value:function(t){var e=t.roomId,n=t.title,r=t.videoSource,i=t.subtitleSource;return Te(this,void 0,void 0,ke().mark((function t(){return ke().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:e,message:{type:"message_with_ack",ack_id:s.createAckId(),name:"queue_load",payload:{urls:[{title:n,url:r,suburl:i}]}}}),t.next=3,this.one("message",(function(t){var n;return t.source===e&&"ready"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(_e).catch((function(){throw new Error("Failed to load media")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"play",value:function(t){return Te(this,void 0,void 0,ke().mark((function e(){return ke().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:t,message:{type:"message",name:"video_play",payload:{}}}),e.next=3,this.one("message",(function(e){var n;return e.source===t&&"playing"===(null===(n=e.message.payload)||void 0===n?void 0:n.event)})).timeout(_e).catch((function(){throw new Error("Failed to play video")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"pause",value:function(t){return Te(this,void 0,void 0,ke().mark((function e(){return ke().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:t,message:{type:"message",name:"video_pause"}}),e.next=3,this.one("message",(function(e){var n;return e.source===t&&"paused"===(null===(n=e.message.payload)||void 0===n?void 0:n.event)})).timeout(_e).catch((function(){throw new Error("Failed to pause video")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"stop",value:function(t){return Te(this,void 0,void 0,ke().mark((function e(){return ke().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:t,message:{type:"message",name:"video_stop"}}),e.next=3,this.one("message",(function(e){var n;return e.source===t&&"stopped"===(null===(n=e.message.payload)||void 0===n?void 0:n.event)})).timeout(_e).catch((function(){throw new Error("Failed to stop video")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"seek",value:function(t,e){return Te(this,void 0,void 0,ke().mark((function n(){return ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this.sendMessageDebounced({destination:t,message:{type:"message",name:"video_seek",payload:{position:e}}})){n.next=4;break}return n.next=4,this.one("message",(function(e){var n;return e.source===t&&"playing"===(null===(n=e.message.payload)||void 0===n?void 0:n.event)})).timeout(_e).catch((function(){throw new Error("Failed to seek video")}));case 4:case"end":return n.stop()}}),n,this)})))}},{key:"setVolume",value:function(t,e){return Te(this,void 0,void 0,ke().mark((function n(){return ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this.sendMessageDebounced({destination:t,message:{type:"message",name:"set_volume",payload:{volume:e}}})){n.next=4;break}return n.next=4,this.one("message",(function(e){var n;return e.source===t&&"volume"===(null===(n=e.message.payload)||void 0===n?void 0:n.event)})).timeout(_e).catch((function(){throw new Error("Failed to set volume")}));case 4:case"end":return n.stop()}}),n,this)})))}},{key:"setMuted",value:function(t,e){return Te(this,void 0,void 0,ke().mark((function n(){return ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.sendMessage({destination:t,message:{type:"message",name:"set_mute",payload:{mute:e}}}),n.next=3,this.one("message",(function(e){var n;return e.source===t&&"mute"===(null===(n=e.message.payload)||void 0===n?void 0:n.event)})).timeout(_e).catch((function(){throw new Error("Failed to set mute")}));case 3:case"end":return n.stop()}}),n,this)})))}},{key:"setSubtitles",value:function(t,e){return Te(this,void 0,void 0,ke().mark((function n(){var r;return ke().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=s.createAckId(),this.sendMessage({destination:t,message:{type:"message_with_ack",ack_id:r,name:"set_subtitles",payload:{subtitles:e}}}),n.next=4,this.one("message",(function(e){return e.source===t&&e.message.ack_id===r})).timeout(_e).catch((function(){throw new Error("Failed to set subtitles")}));case 4:case"end":return n.stop()}}),n,this)})))}}])&&Oe(e.prototype,n),r&&Oe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ot);function Re(t){return Re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Re(t)}function Le(t){return function(t){if(Array.isArray(t))return De(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return De(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?De(t,e):void 0}}(t)||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 De(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Me(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ne(r.key),r)}}function Ne(t){var e=function(t,e){if("object"!=Re(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Re(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Re(e)?e:String(e)}function Ae(){return Ae="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Fe(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Ae.apply(this,arguments)}function Ve(t,e){return Ve=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ve(t,e)}function Fe(t){return Fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fe(t)}var Be=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ve(t,e)}(s,t);var e,n,r,i,o,a=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Fe(i);if(o){var n=Fe(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Re(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=a.call(this)).instanceId=t,e.clients=[],e.bindFunctions(),e}return e=s,r=[{key:"getOrCreateInstance",value:function(t){if(!t)throw new Error("instanceId is required");return this.instances[t]||(this.instances[t]=new s(t)),this.instances[t]}},{key:"disposeAndRemoveInstance",value:function(t){t.dispose(),delete this.instances[t.instanceId]}},{key:"isActive",value:function(){return Object.keys(this.instances).length>0}}],(n=[{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(t){var e=this;t.on("deviceschange",this.gatherAndPublishDevices),t.on("error",(function(t){return e.trigger("error",t)})),this.clients.push(t)}},{key:"hasInstanceOfClient",value:function(t){return this.clients.some((function(e){return e instanceof t}))}},{key:"startCastSession",value:function(t){var e=this;if(this.castSession){if(this.castSession.getDevice().id===t.device.id)return void console.info("A session with device ".concat(t.device.id," already exists - this is a no-op"));this.castSession.dispose()}var n=this.clients.find((function(e){return e.canCastToDevice(t.device.type)}));n&&(this.castSession=n.startCastSession(t),this.castSession.on("error",(function(t){e.castSession.dispose(),e.trigger("error",t)})),this.castSession.on("dispose",(function(){e.castSession=void 0,e.trigger("castsessionchange",void 0)})),this.trigger("castsessionchange",this.castSession))}},{key:"getCastSession",value:function(){return this.castSession}},{key:"gatherAndPublishDevices",value:function(){var t=this.clients.map((function(t){return t.getDevices()})).reduce((function(t,e){return[].concat(Le(t),Le(e))}),[]);this.trigger("deviceschange",t)}},{key:"dispose",value:function(){var t;null===(t=this.castSession)||void 0===t||t.dispose(),this.clients.forEach((function(t){return t.dispose()})),this.castSession=void 0,this.clients=[],Ae(Fe(s.prototype),"dispose",this).call(this)}}])&&Me(e.prototype,n),r&&Me(e,r),Object.defineProperty(e,"prototype",{writable:!1}),s}(Ot);Be.instances={};var Ue=n(30050),Ge=n(98115);function Ze(t){return Ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ze(t)}function ze(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,qe(r.key),r)}}function qe(t){var e=function(t,e){if("object"!=Ze(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Ze(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ze(e)?e:String(e)}function He(){return He="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=$e(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},He.apply(this,arguments)}function Ye(t,e){return Ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ye(t,e)}function We(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function $e(t){return $e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$e(t)}var Qe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ye(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=$e(r);if(i){var n=$e(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Ze(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return We(t)}(this,t)});function a(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(n=o.call(this,t,e)).isVisible=n.isVisible.bind(We(n)),n}return e=a,(n=[{key:"createEl",value:function(){return He($e(a.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(){He($e(a.prototype),"show",this).call(this)}},{key:"hide",value:function(){He($e(a.prototype),"hide",this).call(this)}},{key:"isVisible",value:function(){return!He($e(a.prototype),"hasClass",this).call(this,"vjs-hidden")}}])&&ze(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(o.Z.getComponent("MenuItem"));function Xe(t){return Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xe(t)}function Je(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ke(r.key),r)}}function Ke(t){var e=function(t,e){if("object"!=Xe(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Xe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xe(e)?e:String(e)}function tn(){return tn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=nn(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},tn.apply(this,arguments)}function en(t,e){return en=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},en(t,e)}function nn(t){return nn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nn(t)}var rn=o.Z.getComponent("MenuButton"),on=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&en(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=nn(r);if(i){var n=nn(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Xe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(n=o.call(this,t,e)).alwaysCollapsed=!1,n.isCollapsed=!1,n.isCollabsible=!0,n.className="cv-devices-menu-button",n.searchText="",n.devices=[],n.castSession=void 0,n.bindFunctions(),n.bindEventListeners(),n}return e=a,n=[{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.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 t=this,e=this.$("button"),n=function(e){t.menu.handleBlur(e)};e.addEventListener("blur",n),this.one("dispose",(function(){e.removeEventListener("blur",n)}))}},{key:"createEl",value:function(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=rn.prototype.createEl).apply.apply(t,[this].concat(n))}},{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-devices-button ".concat(tn(nn(a.prototype),"buildWrapperCSSClass",this).call(this))}},{key:"createItems",value:function(){var t=this,e=[];return this.headingItem=new Ue.Z(this.player_,{label:this.localize("Select a device"),selectable:!1}),this.searchInputItem=new Ge.Z(this.player_,{menuButton:this,search:function(e){return t.setSearchText(e)},className:"cv-devices-search-input"}),this.emptyPlaceholder=new Ge.C(this.player_,{label:"No devices found",selected:!1,selectable:!1,multiSelectable:!1}),this.headingItem.show(),this.searchInputItem.hide(),this.emptyPlaceholder.show(),e.push(this.headingItem,this.searchInputItem,this.emptyPlaceholder),e}},{key:"pressButton",value:function(){var t;tn(nn(a.prototype),"pressButton",this).call(this),this.shouldShowSearchInput()&&(null===(t=this.searchInputItem)||void 0===t||t.focus())}},{key:"setDevices",value:function(t){this.devices=t,this.render()}},{key:"setCastSession",value:function(t){this.castSession=t,this.render()}},{key:"setSearchText",value:function(t){this.searchText=t,this.render()}},{key:"getDeviceMenuItems",value:function(){return this.menu.children_.filter((function(t){return t instanceof Qe}))}},{key:"render",value:function(){this.removeMenuItems(this.getDeviceMenuItems()),this.addMenuItemsForDevices(this.devices),this.toggleSearchInput(),this.toggleDeviceMenuItems(),this.toggleEmptyStatePlaceholder()}},{key:"removeMenuItems",value:function(t){var e=this;t.forEach((function(t){e.menu.removeChild(t),t.dispose()}))}},{key:"addMenuItemsForDevices",value:function(t){var e=this;t.sort((function(t,e){return"".concat(t.type,"-").concat(t.name).localeCompare("".concat(e.type,"-").concat(e.name))})).forEach((function(t){var n=new Qe(e.player(),{id:t.id,label:t.name,selected:!1,multiSelectable:!1,selectable:!0,available:t.available,type:t.type,onClick:function(){e.options_.onDeviceMenuItemClick(n,t)}});e.menu.addItem(n)}))}},{key:"shouldShowSearchInput",value:function(){return this.getDeviceMenuItems().length>=20}},{key:"toggleSearchInput",value:function(){this.shouldShowSearchInput()?(this.headingItem.hide(),this.searchInputItem.show(),this.menu.addClass("vertical-fill")):(this.headingItem.show(),this.searchInputItem.hide(),this.menu.removeClass("vertical-fill"))}},{key:"toggleDeviceMenuItems",value:function(){var t=this,e=this.getDeviceMenuItems(),n=this.shouldShowSearchInput(),r=this.searchText.toLowerCase();e.forEach((function(e){var i,o=t.devices.find((function(t){return t.id===e.options_.id}));if(o){var a=o.available,s=!n||-1!==o.name.toLowerCase().indexOf(r),c=o.id===(null===(i=t.castSession)||void 0===i?void 0:i.getDevice().id);a?e.enable():e.disable(),s?e.show():e.hide(),c?e.selected(!0):e.selected(!1)}}))}},{key:"toggleEmptyStatePlaceholder",value:function(){var t=this.getDeviceMenuItems();t.filter((function(t){return t.isVisible()})).length?this.emptyPlaceholder.hide():this.emptyPlaceholder.show(),t.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 t,e;return null!==(e=null===(t=this.castSession)||void 0===t?void 0:t.getDevice().name)&&void 0!==e?e:" "}},{key:"showInCollabsibleMenu",value:function(){return!0}},{key:"showCollapsibleMenu",value:function(){this.handleClick()}},{key:"handleClick",value:function(){tn(nn(a.prototype),"handleClick",this).call(this,null),this.options_.onClick()}}],n&&Je(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(rn);on.prototype.controlText_="Devices",o.Z.registerComponent("DevicesButton",on);var an=n(10463);function sn(t){return sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sn(t)}function cn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,un(r.key),r)}}function un(t){var e=function(t,e){if("object"!=sn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=sn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sn(e)?e:String(e)}function ln(){return ln="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=hn(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},ln.apply(this,arguments)}function fn(t,e){return fn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fn(t,e)}function hn(t){return hn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hn(t)}var pn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fn(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=hn(r);if(i){var n=hn(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===sn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),o.call(this,null,t)}return e=a,(n=[{key:"createEl",value:function(){return ln(hn(a.prototype),"createEl",this).call(this,"div",{className:"cv-devices-tech"})}},{key:"setPoster",value:function(t){this.poster=t,this.update()}},{key:"setDevice",value:function(t){this.device=t,this.update()}},{key:"update",value:function(){var t,e,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!==(e=null===(t=this.device)||void 0===t?void 0:t.type)&&void 0!==e?e:at.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(t){t.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(){}}])&&cn(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(o.Z.getComponent("Component"));function dn(t){return dn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dn(t)}function yn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,vn(r.key),r)}}function vn(t){var e=function(t,e){if("object"!=dn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=dn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dn(e)?e:String(e)}function bn(){return bn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=mn(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},bn.apply(this,arguments)}function gn(t,e){return gn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gn(t,e)}function mn(t){return mn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mn(t)}var wn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gn(t,e)}(c,t);var e,n,r,i,a,s=(i=c,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=mn(i);if(a){var n=mn(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===dn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function c(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(n=s.call(this,t,e)).featuresVolumeControl=!0,n.featuresPlaybackRate=!1,n.movingMediaElementInDOM=!1,n.featuresFullscreenResize=!0,n.featuresTimeupdateEvents=!0,n.featuresProgressEvents=!1,n.featuresNativeTextTracks=!1,n.featuresNativeAudioTracks=!1,n.featuresNativeVideoTracks=!1,n.featuresMuteControl=!0,n.featuresSourceset=!1,n.videojsPlayer=(0,o.Z)(n.options_.playerId),n.bindFunctions(),n.bindEventListeners(),n.ready((function(){n.setSource(n.options_.source)})),n.triggerReady(),n}return e=c,r=[{key:"canPlayType",value:function(){return""}},{key:"canPlaySource",value:function(t,e){var n;return!!Be.getOrCreateInstance(null!==(n=null==e?void 0:e.instanceId)&&void 0!==n?n:"").getCastSession()}},{key:"isSupported",value:function(){return Be.isActive()}}],(n=[{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 t=this,e=this.getCastSession();e&&(this.textTracks().on("change",this.onTextTrackChanged),this.videojsPlayer.one("ended",(function(){e.dispose()})),e.on("durationchange",(function(){t.trigger("durationchange")})),e.on("dispose",(function(){t.trigger("ended"),t.hideUI()})),e.on("playingchange",(function(){e.isPlaying()?(t.trigger("play"),t.trigger("playing")):t.trigger("pause")})),e.on("volumechange",(function(){t.trigger("volumechange")})),e.on("sourceloaded",(function(){t.trigger("loadeddata")})),e.on("subtitleschange",(function(){t.setSelectedTextTrack(e.getSubtitles())})))}},{key:"onTextTrackChanged",value:function(){var t,e=this.getSelectedTextTrack();null===(t=this.getCastSession())||void 0===t||t.setSubtitles(null==e?void 0:e.src)}},{key:"getSelectedTextTrack",value:function(){return an.O.findTrackByPredicate(this.videojsPlayer.player_,(function(t){return"showing"===t.mode&&!!t.src}))}},{key:"setSelectedTextTrack",value:function(t){an.O.forEachTrack(this.videojsPlayer.player_,(function(e){e.src===t?e.mode="showing":e.mode="hidden"}))}},{key:"showUI",value:function(t){this.ui&&(this.ui.setPoster(this.options_.poster),this.ui.setDevice(t),this.ui.show())}},{key:"hideUI",value:function(){var t;null===(t=this.ui)||void 0===t||t.hide()}},{key:"dispose",value:function(){this.textTracks().off("change",this.onTextTrackChanged);var t=this.getCastSession();t&&t.dispose(),bn(mn(c.prototype),"cleanupAutoTextTracks",this).call(this),bn(mn(c.prototype),"dispose",this).call(this)}},{key:"createEl",value:function(){var t=this;return this.ui=this.ui||new pn({onStopCasting:function(){var e;null===(e=t.getCastSession())||void 0===e||e.dispose()}}),this.ui.el()}},{key:"setSource",value:function(t){var e=this.getCastSession();if(e){this.showUI(e.getDevice()),this.trigger("loadstart");var n=this.getSelectedTextTrack();e.loadSource(t.src,null==n?void 0:n.src)}}},{key:"addRemoteTextTrack",value:function(t){return bn(mn(c.prototype),"addRemoteTextTrack",this).call(this,t,!0)}},{key:"getCastSession",value:function(){var t;return Be.getOrCreateInstance(null!==(t=this.options_.instanceId)&&void 0!==t?t:"").getCastSession()}},{key:"play",value:function(){var t;null===(t=this.getCastSession())||void 0===t||t.play()}},{key:"pause",value:function(){var t;null===(t=this.getCastSession())||void 0===t||t.pause()}},{key:"paused",value:function(){var t;return!1===(null===(t=this.getCastSession())||void 0===t?void 0:t.isPlaying())}},{key:"ended",value:function(){var t,e;return null!==(e=null===(t=this.getCastSession())||void 0===t?void 0:t.isPlaybackFinished())&&void 0!==e&&e}},{key:"setCurrentTime",value:function(t){var e;null===(e=this.getCastSession())||void 0===e||e.seek(null!=t?t:0)}},{key:"currentTime",value:function(){var t,e;return null!==(e=null===(t=this.getCastSession())||void 0===t?void 0:t.getPosition())&&void 0!==e?e:0}},{key:"duration",value:function(){var t,e;return null!==(e=null===(t=this.getCastSession())||void 0===t?void 0:t.getDuration())&&void 0!==e?e:this.videojsPlayer.duration()}},{key:"volume",value:function(){var t,e;return null!==(e=null===(t=this.getCastSession())||void 0===t?void 0:t.getVolume())&&void 0!==e?e:1}},{key:"setVolume",value:function(t){var e;null===(e=this.getCastSession())||void 0===e||e.setVolume(t)}},{key:"muted",value:function(){var t,e;return null!==(e=null===(t=this.getCastSession())||void 0===t?void 0:t.getMuted())&&void 0!==e&&e}},{key:"setMuted",value:function(t){var e;null===(e=this.getCastSession())||void 0===e||e.setMuted(t)}},{key:"buffered",value:function(){}},{key:"seekable",value:function(){return o.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(){}}])&&yn(e.prototype,n),r&&yn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(o.Z.getComponent("Tech"));function Pn(t){return Pn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pn(t)}function Sn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,kn(r.key),r)}}function kn(t){var e=function(t,e){if("object"!=Pn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Pn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Pn(e)?e:String(e)}function On(){return On="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=En(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},On.apply(this,arguments)}function jn(t,e){return jn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jn(t,e)}function En(t){return En=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},En(t)}o.Z.registerTech("devices",wn);var Cn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jn(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=En(r);if(i){var n=En(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Pn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t,e){var n,r,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(n=o.call(this,t,e)).options=e,n.instanceId=null!==(i=null===(r=n.player.options_.devices)||void 0===r?void 0:r.instanceId)&&void 0!==i?i:"",n.bindFunctions(),n.initialize(),n}return e=a,(n=[{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 t=this,e=this.player.getChild("collapserator"),n=null==e?void 0:e.children().findIndex((function(t){return"CustomControlSpacer"===t.name()})),r=this.getSessionManager();if(e&&n&&-1!==n&&r){r.on("deviceschange",this.onDevicesChanged),r.on("castsessionchange",this.onCastSessionChanged),r.on("error",this.onDevicesError);var i={onClick:function(){t.addViviClient(r),t.addAppleTvClient(r)},onDeviceMenuItemClick:function(e,n){var i;r.startCastSession({device:n,title:t.options.title}),null===(i=t.options.analyticsService)||void 0===i||i.logUserAction({device:n},{actionType:st.Vw.Play,workflowPhase:st.eu.Complete,descriptor:st.UX.CastToDevice})}};this.devicesButton=e.addChild("DevicesButton",i,n+1)}}},{key:"onDevicesChanged",value:function(t){var e;null===(e=this.devicesButton)||void 0===e||e.setDevices(t)}},{key:"onCastSessionChanged",value:function(t){var e;null===(e=this.devicesButton)||void 0===e||e.setCastSession(t),this.reloadTech(),t?(this.player.addClass("cv-device-casting"),this.player.addClass("cv-device-".concat(t.getDevice().type)),this.player.isFullscreen()&&this.player.exitFullscreen()):(this.player.removeClass("cv-device-casting"),this.player.removeClass("cv-device-".concat(at.AppleTv)),this.player.removeClass("cv-device-".concat(at.Vivi)))}},{key:"onDevicesError",value:function(t){this.player.error(t.message),this.player.pause()}},{key:"addViviClient",value:function(t){if(this.options.viviEnabled&&this.options.viviApi&&this.options.fetchViviAccessToken&&!t.hasInstanceOfClient(Ie)){var e=new Ie({url:this.options.viviApi,fetchAccessToken:this.options.fetchViviAccessToken});t.addClient(e)}}},{key:"addAppleTvClient",value:function(t){if(this.options.appleTvEnabled&&this.options.onlineApi&&this.options.fetchOnlineApiAccessToken&&this.options.trackingCode&&this.options.userId&&!t.hasInstanceOfClient(Xt)){var e=new Xt({url:this.options.onlineApi,fetchAccessToken:this.options.fetchOnlineApiAccessToken,trackingCode:this.options.trackingCode,userId:this.options.userId,username:""});t.addClient(e)}}},{key:"reloadTech",value:function(){var t=this.player,e=t.currentSources(),n=t.volume(),r=t.muted(),i=t.currentTime(),o=t.paused();t.src(e),t.one("playing",(function(){t.volume(n),t.muted(r),t.currentTime(i),o?t.pause():t.play()}))}},{key:"getSessionManager",value:function(){if(this.instanceId)return Be.getOrCreateInstance(this.instanceId)}},{key:"dispose",value:function(){var t=this.getSessionManager();t&&(t.off("deviceschange",this.onDevicesChanged),t.off("castsessionchange",this.onCastSessionChanged),t.off("error",this.onDevicesError),Be.disposeAndRemoveInstance(t),On(En(a.prototype),"dispose",this).call(this))}}])&&Sn(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(o.Z.getPlugin("plugin"));function xn(t){return xn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xn(t)}function Tn(){Tn=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new _(r||[]);return i(a,"_invoke",{value:E(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={};function b(){}function g(){}function m(){}var w={};u(w,a,(function(){return this}));var P=Object.getPrototypeOf,S=P&&P(P(I([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=m.prototype=b.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(i,o,a,s){var c=f(t[i],t,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==xn(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function E(e,n,r){var i=h;return function(o,a){if(i===d)throw new Error("Generator is already running");if(i===y){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var c=C(s,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=d;var u=f(e,n,r);if("normal"===u.type){if(i=r.done?y:p,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=y,r.method="throw",r.arg=u.arg)}}}function C(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,C(e,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,e.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[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(xn(e)+" is not iterable")}return g.prototype=m,i(k,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:g,configurable:!0}),g.displayName=u(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,c,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},O(j.prototype),u(j.prototype,s,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new j(l(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(k),u(k,c,"Generator"),u(k,a,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){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"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function _n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function In(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rn(r.key),r)}}function Rn(t){var e=function(t,e){if("object"!=xn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=xn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xn(e)?e:String(e)}function Ln(){return Ln="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Mn(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Ln.apply(this,arguments)}function Dn(t,e){return Dn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Dn(t,e)}function Mn(t){return Mn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mn(t)}o.Z.registerPlugin("devicesPlugin",Cn);var Nn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dn(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Mn(r);if(i){var n=Mn(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===xn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t,e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),o.call(this,t,e)}return e=a,(n=[{key:"getPlayerOptions",value:function(){var t,e=Ln(Mn(a.prototype),"getPlayerOptions",this).call(this);return this.areDevicesEnabled()?Object.assign(Object.assign({},e),{techOrder:["devices"].concat((t=e.techOrder,function(t){if(Array.isArray(t))return _n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return _n(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_n(t,e):void 0}}(t)||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.")}())),devices:{instanceId:se()}}):e}},{key:"configurePlugins",value:function(){var t;try{this.options.onClickCreateClip&&this.player.createClipButtonPlugin({onClick:this.options.onClickCreateClip}),this.options.onRequestPictureInPicture&&this.player.pictureInPicture({onRequestPictureInPicture:this.options.onRequestPictureInPicture}),(null===(t=this.options.pointsOfInterest)||void 0===t?void 0:t.length)&&this.player.pointsOfInterestPlugin({pointsOfInterest:this.options.pointsOfInterest})}catch(t){console.log("failed to register plugins",t)}}},{key:"setNextVideo",value:function(t,e,n){this.player.nextVideoPlugin&&this.player.nextVideoPlugin().setNextVideo(t,e,n)}},{key:"enablePictureInPicture",value:function(){var t=this.player.pictureInPicture();t&&t.enablePictureInPicture()}},{key:"disablePictureInPicture",value:function(){var t=this.player.pictureInPicture();t&&t.disablePictureInPicture()}},{key:"togglePictureInPicture",value:function(t){var e=this.player.pictureInPicture();e&&e.togglePictureInPicture(t)}},{key:"additionalSetup",value:function(t){var e,n,r,i,o,s,c,u,l,f,h,p=this,d=Object.create(null,{additionalSetup:{get:function(){return Ln(Mn(a.prototype),"additionalSetup",p)}}});return u=this,l=void 0,f=void 0,h=Tn().mark((function a(){var u;return Tn().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(d.additionalSetup.call(this,t),this.options.showResources&&t.resources&&this.player.resourcesPlugin&&this.player.resourcesPlugin({resources:t.resources.list,imageCdnUrl:this.options.imageCdnUrl}),"MasterClip"!==t.mediaType){a.next=7;break}if(null!==(u=t.additionalData)){a.next=6;break}throw Error("Invalid clip data");case 6:this.player.clipPlugin({startTime:u.startTime,endTime:u.endTime});case 7:this.areDevicesEnabled()&&this.player.devicesPlugin({viviEnabled:null===(e=this.options.devicesConfig)||void 0===e?void 0:e.viviEnabled,viviApi:null===(n=this.options.devicesConfig)||void 0===n?void 0:n.viviApi,fetchViviAccessToken:null===(r=this.options.devicesConfig)||void 0===r?void 0:r.fetchViviAccessToken,appleTvEnabled:null===(i=this.options.devicesConfig)||void 0===i?void 0:i.appleTvEnabled,onlineApi:null===(o=this.options.devicesConfig)||void 0===o?void 0:o.onlineApi,fetchOnlineApiAccessToken:null===(s=this.options.devicesConfig)||void 0===s?void 0:s.fetchOnlineApiAccessToken,trackingCode:null===(c=this.options.devicesConfig)||void 0===c?void 0:c.trackingCode,userId:parseInt(t.viewerId),title:t.title,analyticsService:this.analyticsService});case 8:case"end":return a.stop()}}),a,this)})),new(f||(f=Promise))((function(t,e){function n(t){try{i(h.next(t))}catch(t){e(t)}}function r(t){try{i(h.throw(t))}catch(t){e(t)}}function i(e){var i;e.done?t(e.value):(i=e.value,i instanceof f?i:new f((function(t){t(i)}))).then(n,r)}i((h=h.apply(u,l||[])).next())}))}},{key:"setActivityStatus",value:function(t,e){this.player.activityStatusPlugin().setActivityStatus(t,e)}}])&&In(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(i.r),An=n(63816),Vn=n(14735);function Fn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Bn(t){var e,n,i,o=r.useRef(t.player.duration()-t.player.currentTime()),a=(n=r.useState(o.current),i=2,function(t){if(Array.isArray(t))return t}(n)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],c=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);c=!0);}catch(t){u=!0,i=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(n,i)||function(t,e){if(t){if("string"==typeof t)return Fn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fn(t,e):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.")}()),s=a[0],c=a[1];function u(){var e=t.player.duration()-t.player.currentTime();c(e),e>o.current&&(o.current=e)}if(r.useEffect((function(){return t.player.on("timeupdate",u),function(){t.player.off("timeupdate",u)}}),[]),!t.nextVideo||!t.onPlayNext)return r.createElement(r.Fragment,null);var l=Math.ceil(s),f=1===l?"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:t.onCancel},"×"),r.createElement("div",{className:"cv-up-next-heading"},"Up next in ",l," ",f,":"),r.createElement("div",{className:"cv-up-next-image cursor-pointer",onClick:t.onPlayNext,style:{backgroundImage:"url(".concat(null===(e=t.nextVideo)||void 0===e?void 0:e.thumbnailUrl,")")}}),r.createElement("div",{className:"cv-up-next-title"},t.nextVideo.name)))}function Un(t){return Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(t)}function Gn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zn(r.key),r)}}function Zn(t){var e=function(t,e){if("object"!=Un(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Un(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Un(e)?e:String(e)}function zn(){return zn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Hn(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},zn.apply(this,arguments)}function qn(t,e){return qn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qn(t,e)}function Hn(t){return Hn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Hn(t)}o.Z.registerComponent("UpNext",(0,Vn.Z)((function(t,e){return r.createElement(Bn,Object.assign({player:t},e))})));var Yn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qn(t,e)}(s,t);var e,n,r,i,a=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Hn(r);if(i){var n=Hn(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Un(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(n=a.call(this,t,e)).playNext=t.nextVideoPlugin().getShouldPlayNext(),n.toggle(n.playNext),n}return e=s,(n=[{key:"handleToggle",value:function(){this.toggle(!this.playNext)}},{key:"toggle",value:function(t){t?this.toggleOn():this.toggleOff()}},{key:"toggleOn",value:function(){this.playNext=!0,o.Z.dom.addClass(this.toggleEl,"on"),this.player_.nextVideoPlugin().setShouldPlayNext(this.playNext,!0)}},{key:"toggleOff",value:function(){this.playNext=!1,o.Z.dom.removeClass(this.toggleEl,"on"),this.player_.nextVideoPlugin().setShouldPlayNext(this.playNext,!0)}},{key:"handleClick",value:function(t){t.stopImmediatePropagation()}},{key:"createEl",value:function(t,e,n){this.handlerBound||(this.handleToggle=this.handleToggle.bind(this),this.handlerBound=!0),this.toggleEl&&this.toggleEl.removeEventListener("click",this.handleToggle),this.toggleEl=o.Z.dom.createEl("div",{className:"custom-toggle toggle-option float-end",innerHTML:'<span class="handle"></span></div>'}),this.toggleEl.addEventListener("click",this.handleToggle);var r=zn(Hn(s.prototype),"createEl",this).call(this,t,{className:"vjs-menu-item cv-cog-menu-item",innerHTML:'\n <span class="vjs-menu-item-text">Play next video</span>\n <span class="cv-toggle-container"></span>'},n);return r.children[1].appendChild(this.toggleEl),r}}])&&Gn(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(o.Z.getComponent("MenuItem"));function Wn(t){return Wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wn(t)}function $n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qn(r.key),r)}}function Qn(t){var e=function(t,e){if("object"!=Wn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Wn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wn(e)?e:String(e)}function Xn(){return Xn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=tr(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Xn.apply(this,arguments)}function Jn(t,e){return Jn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jn(t,e)}function Kn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function tr(t){return tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tr(t)}o.Z.registerComponent("NextVideoMenuItem",Yn);var er="cv-persisttest",nr="cv-play-next-video",rr=o.Z.getPlugin("plugin"),ir=(o.Z.getComponent("MenuItem"),o.Z.getComponent("NextVideoMenuItem")),or=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jn(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=tr(r);if(i){var n=tr(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Wn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Kn(t)}(this,t)});function a(t){var e;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(e=o.call(this,t)).setShouldPlayNext=e.setShouldPlayNext.bind(Kn(e)),e.getShouldPlayNext=e.getShouldPlayNext.bind(Kn(e)),e.getChapterTrack=e.getChapterTrack.bind(Kn(e)),e.onTimeUpdate=e.onTimeUpdate.bind(Kn(e)),e.hasLocalStorage=e.testHasLocalStorage(),e.shouldPlayNextVideo=!1,e.hasLocalStorage){var n=window.localStorage.getItem(nr);e.shouldPlayNextVideo="true"===n}return t.ready((function(){e.initialize()})),e}return e=a,(n=[{key:"initialize",value:function(){this.player.isDisposed()||this.bindListeners()}},{key:"getChapterTrack",value:function(){return an.O.getTrack(this.player,"chapters",null)}},{key:"setNextVideo",value:function(t,e,n){var r;this.nextVideo=t,this.callback=n,e&&this.setShouldPlayNext(!0),(null===(r=this.player.getChild("collapserator"))||void 0===r?void 0:r.getChild("cogButton")).addItem({index:0,ctor:ir,name:"NextVideoMenuItem"})}},{key:"getShouldPlayNext",value:function(){return this.shouldPlayNextVideo}},{key:"setShouldPlayNext",value:function(t,e){this.shouldPlayNextVideo=t,this.hasLocalStorage&&e&&window.localStorage.setItem(nr,t.toString())}},{key:"bindListeners",value:function(){this.player.on("timeupdate",this.onTimeUpdate)}},{key:"dispose",value:function(){this.player.off("timeupdate",this.onTimeUpdate),this.hideUpNext(),Xn(tr(a.prototype),"dispose",this).call(this)}},{key:"onTimeUpdate",value:function(){var t,e;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===(t=null==n?void 0:n.activeCues)||void 0===t?void 0:t.length)&&n.activeCues[0];"credits"===(null===(e=null==r?void 0:r.text)||void 0===e?void 0:e.toLowerCase())||this.player.currentTime()>=this.player.duration()-5?this.showUpNext():this.hideUpNext()}}else this.hideUpNext()}},{key:"showUpNext",value:function(){var t=this;this.upNextRendered||(this.upNextRendered=!0,this.upNextTimepoint=this.player.currentTime(),this.player.addChild("UpNext",{nextVideo:this.nextVideo,onPlayNext:this.callback,onCancel:function(){t.hideUpNext(),t.setShouldPlayNext(!1)}}))}},{key:"hideUpNext",value:function(){if(this.upNextRendered){this.upNextRendered=!1,this.upNextTimepoint=null;var t=this.player.getChild("UpNext");t&&(this.player.removeChild(t),t.dispose())}}},{key:"testHasLocalStorage",value:function(){try{return window.localStorage.setItem(er,"persistPlayNext"),window.localStorage.removeItem(er),!0}catch(t){return!1}}}])&&$n(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(rr);o.Z.registerPlugin("nextVideoPlugin",or);var ar=n(26733);function sr(t){return sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sr(t)}function cr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ur(r.key),r)}}function ur(t){var e=function(t,e){if("object"!=sr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=sr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sr(e)?e:String(e)}function lr(t,e){return lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},lr(t,e)}function fr(t){return fr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fr(t)}function hr(t){return r.createElement("div",{className:"cv-resource-item"},r.createElement(ar.s,{data:t.resource,imageCdnUrl:t.imageCdnUrl}))}var pr=(0,Vn.Z)((function(t,e){return r.createElement(hr,Object.assign({},e))})),dr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&lr(t,e)}(s,t);var e,n,r,i,a=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=fr(r);if(i){var n=fr(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===sr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(t,e){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),n=a.call(this,t,e);var r=new pr(t,{resource:e.resource,imageCdnUrl:e.imageCdnUrl});return n.addChild(r),n}return e=s,(n=[{key:"createEl",value:function(){return o.Z.dom.createEl("div")}},{key:"handleClick",value:function(t){t.stopImmediatePropagation(),this.options_.downloadResource(this.options_.resource)}}])&&cr(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(o.Z.getComponent("ClickableComponent"));function yr(t){return yr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(t)}function vr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,br(r.key),r)}}function br(t){var e=function(t,e){if("object"!=yr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=yr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yr(e)?e:String(e)}function gr(){return gr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=wr(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},gr.apply(this,arguments)}function mr(t,e){return mr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mr(t,e)}function wr(t){return wr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wr(t)}var Pr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mr(t,e)}(s,t);var e,n,r,i,a=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=wr(r);if(i){var n=wr(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===yr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=a.apply(this,arguments)).alwaysCollapsed=!1,t.isCollapsed=!1,t.isCollabsible=!0,t}return e=s,(n=[{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small ".concat(gr(wr(s.prototype),"buildWrapperCSSClass",this).call(this))}},{key:"buildCSSClass",value:function(){return"cv-resources-button ".concat(gr(wr(s.prototype),"buildCSSClass",this).call(this))}},{key:"update",value:function(){gr(wr(s.prototype),"update",this).call(this)}},{key:"createMenu",value:function(){return this.options_.title="Resources",gr(wr(s.prototype),"createMenu",this).call(this)}},{key:"createItems",value:function(){var t=this,e=[];return this.options_.resources.forEach((function(n){var r=new dr(t.player(),{resource:n,imageCdnUrl:t.options_.imageCdnUrl,downloadResource:function(e){return t.downloadResource(e)}});e.push(r)})),e}},{key:"downloadResource",value:function(t){this.getDownloadIframe().src=t.url}},{key:"getDownloadIframe",value:function(){return this.downloadIframe||(this.downloadIframe=o.Z.dom.createEl("iframe"),this.downloadIframe.style.display="none",o.Z.dom.appendContent(o.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(){gr(wr(s.prototype),"handleClick",this).call(this,null)}}])&&vr(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),s}(o.Z.getComponent("MenuButton"));function Sr(t){return Sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sr(t)}function kr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Or(r.key),r)}}function Or(t){var e=function(t,e){if("object"!=Sr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Sr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Sr(e)?e:String(e)}function jr(t,e){return jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jr(t,e)}function Er(t){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Er(t)}Pr.prototype.controlText_="Resources",o.Z.registerComponent("ResourcesButton",Pr);var Cr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jr(t,e)}(a,t);var e,n,r,i,o=(r=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Er(r);if(i){var n=Er(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Sr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(n=o.call(this,t,e)).options=e,t.ready((function(){return n.onReady()})),n}return e=a,(n=[{key:"onReady",value:function(){if(this.options.resources.length){var t=this.player.getChild("collapserator");t.addChild("ResourcesButton",{resources:this.options.resources,imageCdnUrl:this.options.imageCdnUrl},t.children_.length-3)}}}])&&kr(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),a}(o.Z.getPlugin("plugin"));o.Z.registerPlugin("resourcesPlugin",Cr);var xr=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};function Tr(t){var e=t.className,n=void 0===e?"":e,i=t.playerApi,o=t.onReady,a=t.onDispose,s=xr(t,["className","playerApi","onReady","onDispose"]),c=r.useRef();return r.useEffect((function(){if(c){var t=new Nn(c.current,Object.assign(Object.assign({},s),{playerApi:i}));return o&&t.ready((function(){o((0,An.G)(t))})),a&&t.one("dispose",a),function(){null==t||t.dispose()}}}),[t.viewKey]),r.createElement("div",{ref:c,className:n})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_clickview_lite=self.webpackChunk_clickview_lite||[]).push([[3728],{49935:(e,a,t)=>{t.d(a,{Oo:()=>d,b2:()=>m});var n=t(32735),c=t(36848),r=t(86764),i=t(3747),o=t(5859),l=t(35223),s=t(83914),u=function(e){var a=e.breadcrumb,t=a.name,r=a.appLink,i=a.active,o=e.withBackIcon;return n.createElement("li",{className:"breadcrumb-item".concat(i?" active":"")},i?n.createElement("strong",null,t):n.createElement(c.F,{appLink:r},o&&n.createElement(s.x,{svgName:l.vn.ChevronLeft,size:s.S.Small}),n.createElement("span",{className:o?"ms-2":""},t)))},d=function(e){var a=e.breadcrumbs,t=(0,i.a)(r.r.XS),c=null==a?void 0:a.length;return!c||t&&c<2?n.createElement(n.Fragment,null):t?n.createElement("nav",{"aria-label":"breadcrumb"},n.createElement("ol",{className:"breadcrumb m-0 p-0"},n.createElement(u,{breadcrumb:a[c-2],withBackIcon:!0}))):n.createElement("nav",{"aria-label":"breadcrumb"},n.createElement("ol",{className:"breadcrumb m-0 p-0"},a.map((function(e,a){return n.createElement(u,{key:a,breadcrumb:e})}))))},m=n.memo((function(e){var a=e.numItems,t=void 0===a?3:a;return(0,i.a)(r.r.XS)?n.createElement("div",{className:"partial-loading-background",style:{height:"1.3125rem",width:"6rem"}}):n.createElement("nav",{"aria-label":"breadcrumb"},n.createElement("ol",{className:"breadcrumb m-0 p-0"},o.u.getPartialLoadingItems({numItems:t}).map((function(e,a){var t=e.width;return n.createElement("li",{key:a,className:"breadcrumb-item"},n.createElement("span",{className:"d-inline-block partial-loading-background",style:{width:t},dangerouslySetInnerHTML:{__html:" "}}))}))))}))},5859:(e,a,t)=>{function n(e,a){(null==a||a>e.length)&&(a=e.length);for(var t=0,n=new Array(a);t<a;t++)n[t]=e[t];return n}t.d(a,{u:()=>r});var c={numItems:5,minWidth:50,maxWidth:100},r={getPartialLoadingItems:function(){var e,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign(Object.assign({},c),a);return(e=Array(t.numItems),function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,a){if(e){if("string"==typeof e)return n(e,a);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(e,a):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.")}()).map((function(){return{width:"".concat(Math.max(Math.floor(Math.random()*t.maxWidth),t.minWidth),"px")}}))}}},20342:(e,a,t)=>{t.d(a,{W:()=>E});var n=t(32735),c=t(82602),r=t(23481),i=t(36848),o=t(83345),l=t(76177),s=t(99742),u=t(14070),d=t(97291),m=t(19577);const v={status:"NXBdA"};function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function f(e,a,t){var n;return n=function(e,a){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==p(n)?n:String(n))in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}var b="0001-01-01T00:00:00Z",h="settings.localCacheItem",y=r.T.encloseNamespace(h),g=f(f(f({},m._.Inactive,"offline"),m._.Active,"online"),m._.Updating,"updating");function k(e,a){return a===m._.Active?y("justNow"):e&&e!==b?(0,c.WU)(e):y("never")}function E(e){var a=e.localCache,t=e.canManage,c=e.minimal,r=a.status,p=a.deviceName,f=a.deviceId,b=a.lastSeen,E=r===m._.Inactive?s.W.LocalCache.OFFLINE:s.W.LocalCache.ONLINE,w=r===m._.Active?"bg-green":"bg-gray";return n.createElement("div",{className:"border rounded text-center ".concat(c?"py-3":"")},!c&&n.createElement("div",{className:"my-2 overflow-hidden"},n.createElement("h2",{className:"h6 text-truncate"},p)),n.createElement("img",{src:E,className:"img-fluid"}),n.createElement("div",{className:"pt-2 align-middle"},n.createElement("span",{className:"".concat(v.status," ").concat(w," d-inline-block rounded-circle align-middle me-1")}),n.createElement("span",{className:"align-middle"},n.createElement(l.u,{spanHack:!0,title:y("lastSeen",{time:k(b,r)}),spanHackClassName:""},n.createElement(o.x,{namespace:h,phrase:g[r]})))),!c&&(t?n.createElement(i.F,{appLink:{application:d.O.SETTINGS,action:u.e.Settings.LOCAL_CACHE,args:[f]},className:"btn btn-link text-info mb-1"},n.createElement(o.x,{namespace:h,phrase:"canManage"})):n.createElement("div",{className:"btn text-muted text-muted mb-1"},n.createElement(o.x,{namespace:h,phrase:"cantManage"}))))}},19577:(e,a,t)=>{var n;t.d(a,{_:()=>n}),function(e){e[e.Inactive=0]="Inactive",e[e.Active=1]="Active",e[e.Updating=2]="Updating"}(n||(n={}))},17923:(e,a,t)=>{t.d(a,{q:()=>o});var n=t(99940),c=t(97395),r=t(71995),i={namespace:"localcache",idAttribute:"deviceId"},o={devices:function(){return{url:"/api/localcache/v1/customers/devices",key:"localcache:devices",normalizeOptions:i}},device:function(e){return{url:"/api/localcache/v1/devices/".concat(e),key:"localcache:devices:".concat(e),normalizeOptions:i}},updateDevice:function(e,a,t,c,r){return{url:"/api/localcache/v1/devices/".concat(e),key:"localcache:devices:update",type:n.k.PUT,data:a,normalizeOptions:i,success:t,error:c,always:r}},deleteDevice:function(e,a,t,c){return{url:"/api/localcache/v1/devices/".concat(e),key:"localcache:devices:delete",type:n.k.DELETE,normalizeOptions:i,success:a,error:t,always:c}},updates:function(e){return{url:"/api/localcache/v1/devices/".concat(e,"/update"),key:"localcache:devices:".concat(e,":updates"),normalize:!1}},deviceUpdate:function(e){return{url:"/api/localcache/v1/devices/".concat(e,"/deviceupdate"),key:"localcache:devices:".concat(e,":deviceupdate"),normalize:!1}},update:function(e,a){return{url:"/api/localcache/v1/devices/".concat(e,"/update"),key:"localcache:update",type:n.k.POST,data:{versionString:a},normalize:!1,invalidationKeys:["localcache"]}},stats:function(e){var a={bytesDownloaded:"httpprovider.bytes_downloaded",bytesRead:"store.bytes_read",storageFree:"store.storage_free",storageUsed:"store.storage_used",count:"store.objects"},t={key:Object.values(a)};return{url:c._.urlBuilder("/api/localcache/v1/devices/".concat(e,"/stats/latest"),t),key:"localcache:devices:".concat(e,":stats"),normalize:!1,formatData:function(e){if(!e)return{};var t=e.reduce((function(e,a){return e[a.key]=a.value,e}),{});return Object.keys(a).reduce((function(e,n){return e[n]=t[a[n]],e}),{})}}},channels:function(e){return{url:"/api/localcache/v1/devices/".concat(e,"/channels"),key:"localcache:devices:".concat(e,":channels"),normalize:!1}},config:function(e){return{url:"/api/localcache/v1/configs/devices/".concat(e),key:"localcache:devices:".concat(e,":config"),normalize:!1,formatData:function(e){return null==e?void 0:e.configuration}}},updateConfig:function(e,a,t,c){var r={downloadQuality:a.downloadQuality,autoUpdate:a.autoUpdate,downloadTime:{start:a.downloadStartTime,end:a.downloadEndTime}};return{url:"/api/localcache/v1/configs/devices/".concat(e),key:"localcache:update:config",type:n.k.PUT,data:r,invalidationKeys:["localcache:devices:".concat(e,":config")],normalize:!1,success:t,error:c}},address:function(e){return{url:"/api/localcache/v1/devices/".concat(e,"/address"),key:"localcache:devices:".concat(e,":address"),normalize:!1}},ping:function(e,a){return{url:"".concat(a,"/ping"),key:"localcache:devices:".concat(e,":ping"),normalize:!1,expiryTime:r.f.SHORT}}}},82602:(e,a,t)=>{t.d(a,{WU:()=>s});var n=["second","minute","hour","day","week","month","year"],c=["秒","分钟","小时","天","周","个月","年"],r={},i=function(e,a){r[e]=a},o=[60,60,24,7,365/7/12,12];function l(e){return e instanceof Date?e:!isNaN(e)||/^\d+$/.test(e)?new Date(parseInt(e)):(e=(e||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([+-]\d\d):?(\d\d)/," $1$2"),new Date(e))}var s=function(e,a,t){var n=function(e,a){return(+(a?l(a):new Date)-+l(e))/1e3}(e,t&&t.relativeDate);return function(e,a){for(var t=e<0?1:0,n=e=Math.abs(e),c=0;e>=o[c]&&c<o.length;c++)e/=o[c];return(e=Math.floor(e))>(0==(c*=2)?9:1)&&(c+=1),a(e,c,n)[t].replace("%s",e.toString())}(n,function(e){return r[e]||r.en_US}(a))};i("en_US",(function(e,a){if(0===a)return["just now","right now"];var t=n[Math.floor(a/2)];return e>1&&(t+="s"),[e+" "+t+" ago","in "+e+" "+t]})),i("zh_CN",(function(e,a){if(0===a)return["刚刚","片刻后"];var t=c[~~(a/2)];return[e+" "+t+"前",e+" "+t+"后"]}))}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_clickview_lite=self.webpackChunk_clickview_lite||[]).push([[3836,5041],{86877:(e,t,n)=>{n.d(t,{Z:()=>l});var r=n(23481);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:String(t)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}var l=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(f,e);var t,n,a,l,s=(a=f,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=u(a);if(l){var n=u(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===o(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)}(this,e)});function f(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),s.call(this,e)}return t=f,(n=[{key:"name",get:function(){return"FileTypeError"}},{key:"lang",get:function(){return"upload.fileType"}},{key:"dialogOptions",get:function(){return{title:r.T.getPhrase(this.lang,"heading"),text:r.T.getPhrase(this.lang,"body"),buttons:[{text:r.T.getPhrase(this.lang,"okay"),className:"btn btn-dark",success:!0},{text:r.T.getPhrase(this.lang,"close"),className:"btn btn-link",close:!0}]}}}])&&i(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),f}(n(47663).S)},25041:(e,t,n)=>{n.r(t),n.d(t,{BaseVideoUploadService:()=>X,LearningResourceUploadService:()=>te,SubtitleUploadService:()=>ee,UploadType:()=>K});var r,o=n(48088),i=n(39479),a=n(46865),c=n(79976),u=n(37433),l=n(54149),s=n(71365),f=n(23481),p=n(70794),d=n(81886),y=n(49985),h=n(65858),g=n(29555);!function(e){e[e.Permanent=0]="Permanent",e[e.Temporary=1]="Temporary"}(r||(r={}));var v=n(86877),b=n(6339),m=n(52003),O=n(60735),S=n(53301),w=n(47663);function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function k(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,U(r.key),r)}}function U(e){var t=function(e,t){if("object"!=P(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=P(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==P(t)?t:String(t)}function j(e,t){return j=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},j(e,t)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}var T="upload.internetConnectivityError",R=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&j(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=E(r);if(o){var n=E(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===P(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)}(this,e)});function a(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),i.call(this,f.T.getPhrase(T,"title"))}return t=a,(n=[{key:"name",get:function(){return"InternetConnectivityError"}},{key:"dialogOptions",get:function(){return{title:f.T.getPhrase(T,"heading"),text:f.T.getPhrase(T,"body"),buttons:[{text:f.T.getPhrase(T,"okay"),className:"btn",success:!0}]}}}])&&k(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),a}(w.S),_=n(44331);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 L(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,C(r.key),r)}}function C(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:String(t)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function A(e){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},A(e)}var D=[],F=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(l,e);var t,n,r,a,c,u=(a=l,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=A(a);if(c){var n=A(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===I(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)}(this,e)});function l(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),u.call(this,e)}return t=l,n=[{key:"name",get:function(){return"DropzoneWrapper"}},{key:"initialize",value:function(e){var t=this.options.loggingEnabled,n=o.Radio.channel(e.channelName),r=this;this.dropzone=new S(document.createElement("div"),{url:function(e){return e[0].cvUpload.ingestUrl},chunking:this.options.chunkingEnabled,chunkSize:this.options.chunkSize,forceChunking:!0,autoProcessQueue:!0,maxFilesize:this.options.maxFileSize,acceptedFiles:this.options.acceptedFiles,paramName:"content",init:function(){var e=this;t&&(i.each(D,(function(t){e.on(t,(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=n[0]instanceof File?n[0].name:n[0];console.info(t,o,n)}))})),this.on("uploadprogress",(function(e,t,o){var i=o/e.size*100;n.trigger("progress",r.getId(e),i,o)})),this.on("success",(function(e){var t=e.upload.chunks,r=i.last(t),o=r.xhr;o||(o=r.file.xhr);var a=JSON.parse(o.response);e.cvUpload.fileId=a.id,n.trigger("upload:success",e,a)})),this.on("error",(function(e,t,n){n&&0===n.status?d.Q.Ry.throw(new R):"canceled"!==e.status&&d.Q.Ry.throw(new _.n(f.T.getPhrase("upload.services","uploadError",{fileName:e.name,message:t.message})))})))},params:function(e,t,n){if(n)return{chunk_index:n.index,upload_length:n.file.size}},addedfile:function(){},thumbnail:function(){},uploadprogress:function(){}})}},{key:"getId",value:function(e){return e.upload.uuid}},{key:"addFile",value:function(e){this.dropzone.addFile(e)}},{key:"removeFile",value:function(e){this.dropzone.removeFile(e)}},{key:"start",value:function(){this.dropzone.processQueue()}},{key:"destroy",value:function(){this.dropzone.destroy()}}],r=[{key:"isValidFile",value:function(e,t){return S.isValidFile(e,t)}}],n&&L(t.prototype,n),r&&L(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(d.Q.t6);function V(e){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},V(e)}function N(e,t,n){return(t=Q(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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,Q(r.key),r)}}function M(e,t,n){return t&&B(e.prototype,t),n&&B(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Q(e){var t=function(e,t){if("object"!=V(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=V(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==V(t)?t:String(t)}function q(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)}function Y(e,t){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Y(e,t)}function W(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Z(e);if(t){var o=Z(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===V(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)}(this,n)}}function Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Z(e)}var K,H=function(e){q(n,e);var t=W(n);function n(){var e;return z(this,n),(e=t.call(this,{dataProvider:s.u.getInstance(u.R.Ajax),cache:s.u.getInstance(a.p.Fifo),alertService:s.u.getInstance(c.P.ALERT)})).incrementingUploadId=0,e}return M(n,[{key:"name",get:function(){return"UploadDataService"}},{key:"channelName",get:function(){return"private:upload:data:service"}},{key:"requestUploads",value:function(e,t,n,r,o){var a=this,c=this.chain();i.each(t,(function(t){a.incrementingUploadId++,c.create({resource:e,eventPrefix:"request:upload:".concat(a.incrementingUploadId),data:a.getFileUploadRequest(t,n),callback:function(e){r(t,e)},errorHandler:a.alertService.error("Something went wrong while we were uploading your video. Please try again.")})})),c.func((function(){o()})).run()}},{key:"cancelUpload",value:function(e,t,n){this.create({resource:"/api/upload/cancel",eventPrefix:"cancel:upload",data:{uploadId:e,ingestUrl:t},callback:n})}},{key:"getFileUploadRequest",value:function(e,t){var n=e.name.split(".");return{name:n.join("."),extension:n.length>1?n.pop():"",fileSize:e.size,fileLifestyle:t}}},{key:"onDestroy",value:function(){s.u.releaseInstance(u.R.Ajax).releaseInstance(a.p.Fifo)}}]),n}(l.B);!function(e){e[e.Video=0]="Video",e[e.LearningResource=1]="LearningResource",e[e.Subtitle=2]="Subtitle"}(K||(K={}));var J=N(N(N({},K.Video,"video/*"),K.LearningResource,b.l.RESOURCES),K.Subtitle,b.l.SUBTITLES),G=N(N(N({},K.Video,m.Q4.VIDEO_UPLOAD),K.LearningResource,m.Q4.RESOURCE_UPLOAD),K.Subtitle,m.Q4.SUBTITLE_UPLOAD),$=function(e){q(n,e);var t=W(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return z(this,n),t.call(this,Object.assign({uploadUrl:"/api/upload"},e))}return M(n,[{key:"initialize",value:function(){this.uploadDataService=new H,this.progressViewModel=p.r.get("upload:progress:".concat(this.uploadType)),this.bindListeners()}},{key:"channelName",get:function(){return G[this.uploadType]}},{key:"lang",get:function(){return"uploadShared.services"}},{key:"initUploader",value:function(e,t){if(!this.uploader){var n=4194304;e&&n<e&&(n=e),t&&n>t&&(n=t),this.uploader=new F({chunkingEnabled:!0,loggingEnabled:!0,chunkSize:n,maxFileSize:53687091200,acceptedFiles:this.getAcceptedFiles(),channelName:this.channelName})}}},{key:"bindListeners",value:function(){this.listenTo(this.channelName,"progress",this.onProgress),this.listenTo(this.channelName,"upload:success",this.onSuccess)}},{key:"onProgress",value:function(e,t,n){var r=this.collection.get(e);r&&(r.set({progress:t>100?100:t,totalUploaded:n}),this.setOverallProgress())}},{key:"isUploading",value:function(){return!!this.getCollection().length}},{key:"getCollection",value:function(){return this.collection||(this.collection=new d.Q.FE),this.collection}},{key:"setOverallProgress",value:function(){var e=this,t=0,n=0,r=this.getCollection();if(r.length){r.each((function(e){t+=e.get("totalUploaded")||0,n+=e.get("file").size||0}));var o=t/n*100,i=o>=100,a=function(){e.progressViewModel.set({progress:i?100:o,done:i})};i?window.setTimeout(a,2e3):a()}else this.progressViewModel.set({progress:0})}},{key:"isValidFile",value:function(e){return F.isValidFile(e,this.getAcceptedFiles())}},{key:"addFiles",value:function(e,t){var n=this;i.any(e,(function(e){return!n.isValidFile(e)}))?d.Q.Ry.throw(new v.Z(f.T.getPhrase(this.lang,"invalidFileType"))):this.requestUploads(e,t)}},{key:"requestUploads",value:function(e,t){var n=this,r=this.isUploading(),i=this.getCollection();this.uploadDataService.requestUploads(this.options.uploadUrl,e,this.fileLifestyle,(function(e,t){n.initUploader(1024*t.minChunkSize,1024*t.maxChunkSize),e.cvUpload={uploadId:t.uploadId,ingestUrl:t.ingestUrl},n.uploader.addFile(e);var r=e.name;n.uploadType===K.Video&&(r=r.replace(/\.[^/.]+$/,"")),i.add(Object.assign({id:n.uploader.getId(e),file:e,name:r},n.getAdditionalFileInfo(e,t)),{at:i.length-1})}),(function(){t&&y.k.logUserAction({uploadCount:e.length},t),o.Radio.channel(n.channelName).trigger(g.S.FILES_ADDED,e,r)}))}},{key:"addFile",value:function(e,t){this.addFiles([e],t)}},{key:"cancelUpload",value:function(e){var t=this,n=this.getCollection(),r=n.get(e);if(r){var i=r.get("file");this.uploader.removeFile(i),n.remove(r),this.uploadDataService.cancelUpload(i.cvUpload.uploadId,i.cvUpload.ingestUrl,(function(){y.k.logUserAction(r.toJSON(),{entity:h.py.Video,actionType:h.Vw.Upload,workflowPhase:h.eu.Discard,descriptor:h.yh.Single,location:h.LZ.MyUploads}),o.Radio.channel(t.channelName).trigger(g.S.UPLOAD_CANCELLED)})),this.setOverallProgress()}}},{key:"onSuccess",value:function(e,t){var n=this.uploader.getId(e),r=this.getCollection().get(n);r.set("fileInfo",t),y.k.logUserAction({id:e.cvUpload.uploadId},{entity:h.py.Video,actionType:h.Vw.Upload,workflowPhase:h.eu.Complete,descriptor:h.yh.Single,location:h.LZ.VideoUpload}),o.Radio.channel(this.channelName).trigger(g.S.UPLOAD_COMPLETE,r)}},{key:"cancelAllUploads",value:function(){var e=this,t=this.getCollection().map((function(e){return e.get("id")}));i.each(t,(function(t){return e.cancelUpload(t)}))}},{key:"getAcceptedFiles",value:function(){return J[this.uploadType]}},{key:"getAdditionalFileInfo",value:function(e,t){return{}}}]),n}(d.Q.t6),X=function(e){q(n,e);var t=W(n);function n(){return z(this,n),t.apply(this,arguments)}return M(n,[{key:"uploadType",get:function(){return K.Video}},{key:"name",get:function(){return O.D.VideoUpload}},{key:"fileLifestyle",get:function(){return r.Temporary}}]),n}($),ee=function(e){q(n,e);var t=W(n);function n(){return z(this,n),t.apply(this,arguments)}return M(n,[{key:"uploadType",get:function(){return K.Subtitle}},{key:"name",get:function(){return O.D.SubtitleUpload}},{key:"fileLifestyle",get:function(){return r.Permanent}}]),n}($),te=function(e){q(n,e);var t=W(n);function n(){return z(this,n),t.apply(this,arguments)}return M(n,[{key:"uploadType",get:function(){return K.LearningResource}},{key:"name",get:function(){return O.D.ResourceUpload}},{key:"fileLifestyle",get:function(){return r.Permanent}}]),n}($)},6339:(e,t,n)=>{n.d(t,{l:()=>p,v:()=>d});var r=n(39479),o=["pdf"],i=["doc","docx","dotx","dot","rtf","docm","odt"],a=["csv","txt"],c=["xls","xlt","xlsx"],u=["jpg","tif","png","bmp","gif","jpeg"],l=["zip","rar"],s=["ppt","pot","pps","pptx"],f=["srt"],p={IMAGES:".".concat(u.join(",.")),RESOURCES:".".concat([].concat(i,c,s,o,a,u,l).join(",.")),SUBTITLES:".".concat(f.join(",."))},d={getResourceType:function(e){var t=e.toLowerCase();return r.contains(i,t)?"document":r.contains(c,t)?"excel":r.contains(s,t)?"powerpoint":r.contains(o,t)?"pdf":r.contains(a,t)?"text":r.contains(u,t)?"image":r.contains(l,t)?"archive":r.contains(f,t)?"subtitle":""}}},3836:(e,t,n)=>{n.r(t),n.d(t,{VideoUploadService:()=>j});var r,o=n(48088),i=n(79976),a=n(60139),c=n(71365),u=n(23481),l=n(29555),s=n(25041);!function(e){e[e.Upload=1]="Upload",e[e.Tv=2]="Tv"}(r||(r={}));var f,p,d=n(65728);!function(e){e[e.ExternalOnly=0]="ExternalOnly",e[e.EmbeddedOnly=1]="EmbeddedOnly"}(f||(f={})),function(e){e[e.IosApp=1]="IosApp",e[e.AndroidApp=2]="AndroidApp",e[e.WinApp=3]="WinApp",e[e.LibraryPublisher=4]="LibraryPublisher",e[e.ExchangeClient=5]="ExchangeClient",e[e.Online=6]="Online",e[e.Tinder=7]="Tinder",e[e.Cloud247=8]="Cloud247",e[e.Livestream=9]="Livestream",e[e.Curator=10]="Curator",e[e.LibraryEditor=11]="LibraryEditor",e[e.Lite=12]="Lite"}(p||(p={}));var y=n(75795),h=n(14070),g=n(97291),v=n(57322),b=n(16800);function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,S(r.key),r)}}function S(e){var t=function(e,t){if("object"!=m(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:String(t)}function w(){return w="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},w.apply(this,arguments)}function P(e,t){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},P(e,t)}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}var U=u.T.encloseNamespace("upload.services"),j=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P(e,t)}(j,e);var t,n,u,s,S=(u=j,s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=k(u);if(s){var n=k(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===m(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)}(this,e)});function j(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,j),S.call(this,e)}return t=j,(n=[{key:"initialize",value:function(){w(k(j.prototype),"initialize",this).call(this),this.videoUploadDataService=c.u.getInstance(v.O.VideoUpload,this),this.pendingItemsService=c.u.getInstance(v.K.PendingItems,this),this.userDataService=c.u.getInstance(v.O.FlightUser,this),this.alertService=c.u.getInstance(i.P.ALERT,this),this.listenTo(this.channelName,l.S.FILES_ADDED,this.onUploadStart),this.listenTo(this.channelName,l.S.UPLOAD_COMPLETE,this.unlockNav),this.listenTo(this.channelName,l.S.UPLOAD_CANCELLED,this.unlockNav)}},{key:"onUploadStart",value:function(e){var t={type:a.NK.Success,heading:U("startUploadAlertHeading"),message:1===e.length?U("startUploadSingleAlertBody",{videoName:e[0].name}):U("startUploadMultipleAlertBody",{uploadCount:e.length})},n=y.O.getCurrentContext().appLink;!!b.Y.getMyVideosAppLinks().find((function(e){return n.application===e.application&&n.action===e.action}))||(t.appLinkText=U("startUploadAlertAppLinkText",{smartCount:e.length}),t.appLink={application:g.O.MY_VIDEOS,action:h.e.MyVideos.MY_VIDEOS},t.appLinkClassName="info-link"),this.alertService.createAlert(t)}},{key:"unlockNav",value:function(){this.getCollection().some((function(e){return e.get("progress")<100}))||o.Radio.channel(this.channelName).trigger(l.S.UNLOCK_NAV)}},{key:"getUpload",value:function(e){var t=this.uploader.getId(e);return this.getCollection().get(t)}},{key:"completeUpload",value:function(e,t){var n=this;e.set("sending",!0),this.userDataService.getCurrentUser((function(o){n.userDataService.getCustomerSettings(o.customerId,(function(i){n.userDataService.getWorkspace((function(a){n.videoUploadDataService.completeVideoUpload({id:e.get("id"),userId:o.id,customerId:o.customerId,libraryId:a.id,categoryId:e.get("categoryId")||null,pendingProcessOrigin:r.Upload,origin:p.Lite,fileId:t.id,subtitleOptions:{subtitleExtractOptions:f.EmbeddedOnly},video:{name:e.get("name"),description:e.get("description")},autoCaption:!!i[d.E.AutoCaptioning].value},(function(t){e.set("pendingProcessId",t.pendingProcessId),n.pendingItemsService.forceFetchPendingItems({resetTimeout:!0})}))}))}))}))}},{key:"onSuccess",value:function(e,t){var n=this;w(k(j.prototype),"onSuccess",this).call(this,e,t);var r=this.getUpload(e);r.get("editingMetadata")?this.listenToOnce(r,"change:editingMetadata",(function(){n.completeUpload(r,t)})):this.completeUpload(r,t)}},{key:"getAdditionalFileInfo",value:function(e,t){var n=y.O.getCurrentRoute().appLink;return n.application!==g.O.MY_VIDEOS||n.action!==h.e.MyVideos.MY_VIDEOS_FOLDER?{}:{categoryId:+n.args[0]}}}])&&O(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),j}(s.BaseVideoUploadService)}}]);
|