@jaaq/jaaq-sdk-js 1.1.1 → 1.2.0-dev-ec79f7e-20260605

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +18 -7
  2. package/dist/embed/embed-collection.html +17 -4
  3. package/dist/embed/embed.html +15 -3
  4. package/dist/index.cjs +57 -11
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.ts +100 -24
  7. package/dist/index.mjs +56 -12
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/jaaq-sdk.min.js +1 -1
  10. package/dist/jaaq-sdk.min.js.map +1 -1
  11. package/dist/ui/index.cjs +102 -17
  12. package/dist/ui/index.cjs.map +1 -1
  13. package/dist/ui/index.d.ts +89 -10
  14. package/dist/ui/index.mjs +102 -17
  15. package/dist/ui/index.mjs.map +1 -1
  16. package/dist/ui/jaaq-ui-bundled.min.js +2 -2
  17. package/dist/ui/jaaq-ui-bundled.min.js.map +1 -1
  18. package/dist/ui/jaaq-ui.min.js +2 -2
  19. package/dist/ui/jaaq-ui.min.js.map +1 -1
  20. package/dist/ui/react/index.cjs +78 -18
  21. package/dist/ui/react/index.cjs.map +1 -1
  22. package/dist/ui/react/index.d.ts +84 -7
  23. package/dist/ui/react/index.mjs +78 -18
  24. package/dist/ui/react/index.mjs.map +1 -1
  25. package/dist/ui/react/jaaq-ui-react.min.js +2 -2
  26. package/dist/ui/react/jaaq-ui-react.min.js.map +1 -1
  27. package/dist/ui/vanilla/index.cjs +102 -17
  28. package/dist/ui/vanilla/index.cjs.map +1 -1
  29. package/dist/ui/vanilla/index.d.ts +89 -10
  30. package/dist/ui/vanilla/index.mjs +102 -17
  31. package/dist/ui/vanilla/index.mjs.map +1 -1
  32. package/dist/ui/vanilla/jaaq-vanilla-bundled.min.js +2 -2
  33. package/dist/ui/vanilla/jaaq-vanilla-bundled.min.js.map +1 -1
  34. package/dist/ui/vanilla/jaaq-vanilla.min.js +2 -2
  35. package/dist/ui/vanilla/jaaq-vanilla.min.js.map +1 -1
  36. package/dist/ui/webcomponents/index.cjs +74 -14
  37. package/dist/ui/webcomponents/index.cjs.map +1 -1
  38. package/dist/ui/webcomponents/index.d.ts +86 -9
  39. package/dist/ui/webcomponents/index.mjs +74 -14
  40. package/dist/ui/webcomponents/index.mjs.map +1 -1
  41. package/dist/ui/webcomponents/jaaq-webcomponents-bundled.min.js +2 -2
  42. package/dist/ui/webcomponents/jaaq-webcomponents-bundled.min.js.map +1 -1
  43. package/dist/ui/webcomponents/jaaq-webcomponents.min.js +2 -2
  44. package/dist/ui/webcomponents/jaaq-webcomponents.min.js.map +1 -1
  45. package/package.json +38 -35
@@ -1,8 +1,8 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("hls.js")):"function"==typeof define&&define.amd?define(["exports","hls.js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).JaaqWebComponents={},t.Hls)}(this,function(t,e){"use strict";function n(t){const{baseUrl:e,apiKey:n,clientId:i,fetch:o}=t,s=o??globalThis.fetch;if(!s)throw new Error("No fetch implementation found. Provide one in SDKConfig.fetch for Node or custom environments.");const a={"Content-Type":"application/json","x-api-key":n},r=t=>function(t,e,n){if(/^https?:\/\//i.test(n))return n;const i=t.replace(/\/+$/,""),o=n.replace(/^\/+/,"");return`${i}/b2b/v1/subscription/${encodeURIComponent(e)}${o.startsWith("/")?o:`/${o}`}`}(e,i,t),l=async(t,e,n,i)=>{const o={method:t,headers:{...a,...n?.headers},...n};void 0!==i&&(o.body=JSON.stringify(i));return async function(t){if(!t.ok){const e=await t.text().catch(()=>"");throw new Error(`HTTP ${t.status}: ${e||t.statusText}`)}if(204!==t.status)return t.json()}(await s(r(e),o))};return{get:(t,e)=>l("GET",t,e),post:(t,e,n)=>l("POST",t,n,e),put:(t,e,n)=>l("PUT",t,n,e),patch:(t,e,n)=>l("PATCH",t,n,e),delete:(t,e)=>l("DELETE",t,e)}}const i="https://api.jaaq.app";class o{constructor(t){this.videos=function(t){return{async getById(e){const n=`/videos/${encodeURIComponent(e)}`;return(await t.get(n)).video}}}(t),this.collections=function(t){return{list:async()=>(await t.get("/collections")).collections,async getById(e){const n=`/collections/${encodeURIComponent(e)}`;return(await t.get(n)).collection}}}(t)}static fromHttp(t){return new o(t)}static init(t){return s(t)}}function s(t){const{baseUrl:e=i,apiKey:s,clientId:a,fetch:r}=t,l=n({baseUrl:e,apiKey:s,clientId:a,fetch:r??globalThis.fetch});return o.fromHttp(l)}function a(t,e,n){return Math.max(e,Math.min(n,t))}var r=".jaaq-video-player {\n position: relative;\n width: 100%;\n max-width: none;\n margin: 0;\n background: #000;\n border-radius: 12px;\n overflow: hidden;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n aspect-ratio: 9 / 16;\n}\n\n.jaaq-video-player video {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: block;\n background: #000;\n object-fit: cover;\n}\n\n.jaaq-video-player.fullscreen {\n max-width: 100%;\n border-radius: 0;\n aspect-ratio: auto;\n}\n\n.jaaq-controls {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);\n padding: 40px 16px 16px;\n opacity: 1;\n z-index: 5;\n}\n\n.jaaq-progress-bar {\n width: 100%;\n flex: 1 1 0;\n min-width: 80px;\n height: 4px;\n background: rgba(255, 255, 255, 0.3);\n border-radius: 2px;\n cursor: pointer;\n position: relative;\n}\n\n.jaaq-progress-filled {\n height: 100%;\n background: #007bff;\n border-radius: 2px;\n width: 0%;\n transition: width 0.1s linear;\n}\n\n.jaaq-progress-bar:hover .jaaq-progress-filled {\n background: #0056b3;\n}\n\n.jaaq-controls-bottom {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 12px;\n color: white;\n}\n\n.jaaq-control-btn {\n background: transparent;\n border: none;\n color: white;\n cursor: pointer;\n padding: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s;\n font-size: 20px;\n line-height: 1;\n}\n\n.jaaq-control-btn:hover {\n transform: scale(1.1);\n}\n\n.jaaq-control-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.jaaq-loading {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 50px;\n height: 50px;\n border: 4px solid rgba(255, 255, 255, 0.3);\n border-top-color: #007bff;\n border-radius: 50%;\n animation: jaaq-spin 1s linear infinite;\n}\n\n@keyframes jaaq-spin {\n to {\n transform: translate(-50%, -50%) rotate(360deg);\n }\n}\n\n.jaaq-error {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: rgba(220, 53, 69, 0.9);\n color: white;\n padding: 16px 24px;\n border-radius: 8px;\n max-width: 80%;\n text-align: center;\n font-size: 14px;\n}\n\n.jaaq-video-info {\n padding: 16px;\n background: #f8f9fa;\n border-radius: 0 0 12px 12px;\n margin-top: -12px;\n}\n\n.jaaq-video-info h3 {\n margin: 0 0 8px 0;\n color: #333;\n font-size: 18px;\n font-weight: 600;\n}\n\n.jaaq-video-info p {\n margin: 4px 0;\n color: #666;\n font-size: 14px;\n}\n\n.jaaq-video-info strong {\n color: #333;\n}\n\n.jaaq-logo {\n position: absolute;\n top: 20px;\n left: 22px;\n color: white;\n font-size: 16px;\n font-weight: 600;\n z-index: 10;\n font-family:\n 'Archivo',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n letter-spacing: 0.5px;\n pointer-events: none;\n}\n\n.jaaq-center-play-btn {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 84px;\n height: 84px;\n background: transparent;\n border: none;\n cursor: pointer;\n z-index: 15;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s;\n padding: 0;\n}\n\n.jaaq-center-play-btn:hover {\n transform: translate(-50%, -50%) scale(1.1);\n}\n\n.jaaq-center-play-btn svg {\n width: 100%;\n height: 100%;\n filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));\n}\n\n.jaaq-video-player.is-playing .jaaq-center-play-btn {\n display: none;\n}\n\n.jaaq-gradient-overlay {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background: linear-gradient(180deg, transparent 0%, #0f0f0f 100%);\n padding: 80px 22px 85px;\n pointer-events: none;\n z-index: 5;\n}\n\n.jaaq-caption-display {\n font-family:\n 'Archivo',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n font-weight: 400;\n font-size: 16px;\n line-height: 20px;\n color: white;\n background: rgba(0, 0, 0, 0.8);\n padding: 8px 16px;\n margin-bottom: 12px;\n border-radius: 4px;\n text-align: center;\n max-width: 90%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.jaaq-video-title {\n font-family:\n 'Archivo',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n font-weight: 600;\n font-size: 18.695px;\n line-height: 21.5px;\n color: white;\n margin-bottom: 8px;\n letter-spacing: 0.37px;\n}\n\n.jaaq-video-author {\n font-family:\n 'Archivo',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n font-weight: 500;\n font-size: 14.021px;\n line-height: 16.825px;\n color: white;\n opacity: 0.7;\n margin-bottom: 8px;\n letter-spacing: -0.14px;\n}\n\n.jaaq-video-description {\n font-family:\n 'Archivo',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n font-weight: 400;\n font-size: 11px;\n line-height: 16px;\n color: #aaa8aa;\n letter-spacing: -0.11px;\n}\n\n.jaaq-description-text {\n color: #aaa8aa;\n}\n\n.jaaq-read-more {\n color: white;\n cursor: pointer;\n pointer-events: auto;\n}\n\n.jaaq-read-more:hover {\n text-decoration: underline;\n}\n\n.jaaq-progress-bar {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.jaaq-progress-filled {\n background: white;\n}\n\n.jaaq-captions-btn {\n font-size: 14px;\n font-weight: 600;\n border: 1.5px solid white;\n border-radius: 3px;\n padding: 4px 6px;\n line-height: 1;\n}\n\n.jaaq-captions-btn.active {\n background: white;\n color: #000;\n}\n";class l{constructor(t,e){if(this.client=null,this.hls=null,this.videoElement=null,this.listeners=new Map,this.captionCues=[],this.elements={},this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");if(this.config=e,this.state={isPlaying:!1,currentTime:0,duration:0,volume:1,isMuted:!0===e.startMuted,isFullscreen:!1,isLoading:!0,error:null,videoData:null,captionsEnabled:!1},e.client)this.client=e.client;else{if(!e.apiKey||!e.clientId)throw new Error("Please provide either a client instance or apiKey and clientId");this.client=function(t){return s(t)}({apiKey:e.apiKey,clientId:e.clientId,baseUrl:e.baseUrl})}this.init()}async init(){this.createDOM(),await this.loadVideo(),this.attachEventListeners(),!0===this.config.startMuted&&this.updateVolumeUI()}createDOM(){this.container.innerHTML="";const t=document.createElement("div");t.style.width=this.config.width||"100%",t.style.height=this.config.height||"auto";const e=document.createElement("div");e.className=`jaaq-video-player jaaq-vanilla-player ${this.config.className||""}`,this.elements.player=e;const n=document.createElement("video");this.videoElement=n,!0===this.config.startMuted&&(n.muted=!0,n.setAttribute("muted","")),e.appendChild(n);const i=document.createElement("div");i.className="jaaq-logo",i.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="50" height="15" viewBox="0 0 50 15" fill="none">\n <path d="M48.0329 10.7826C48.7578 9.6622 49.1402 8.37108 49.1402 7.02322C49.1402 3.19784 46.0283 0.0859375 42.2029 0.0859375C38.3775 0.0859375 35.2656 3.19784 35.2656 7.02322C35.2656 10.8486 38.3753 13.9578 42.1985 13.9605C42.1991 13.9605 42.2002 13.9605 42.2007 13.9605H42.2029C43.8475 13.9605 45.4305 13.3687 46.6698 12.3285L49.9971 14.56V12.0999L48.0334 10.7826H48.0329ZM37.309 7.02322C37.309 4.32479 39.5045 2.12927 42.2035 2.12927C44.9024 2.12927 47.0974 4.32479 47.0974 7.02322C47.0974 7.96252 46.8345 8.862 46.3359 9.64475L43.9817 8.06561C43.4531 7.71378 42.8373 7.52778 42.2002 7.52778C40.4394 7.52778 39.0054 8.95036 38.9846 10.7062C37.9586 9.80839 37.3084 8.49053 37.3084 7.02322H37.309ZM42.2035 11.9172C42.2035 11.9172 42.2002 11.9172 42.1985 11.9172C41.5527 11.9161 41.0274 11.3903 41.0274 10.7439C41.0274 10.0975 41.5538 9.57056 42.2007 9.57056C42.4331 9.57056 42.6578 9.6382 42.8493 9.76584L44.8714 11.1224C44.0853 11.633 43.1586 11.9172 42.2029 11.9172H42.2035Z" fill="white"/>\n <path d="M31.0751 0.686201C30.9856 0.579834 30.8858 0.483286 30.7767 0.39983C30.4374 0.138004 30.0283 0 29.5946 0C29.161 0 28.7524 0.138549 28.4126 0.39983C28.2304 0.540561 28.0755 0.711838 27.9533 0.909844C27.8835 1.02276 27.8257 1.14003 27.7815 1.25785L23.1172 13.7317H25.4551L29.5946 2.66135L33.7342 13.7317H36.0721L31.4078 1.25785C31.3303 1.05003 31.218 0.858024 31.0745 0.686746L31.0751 0.686201Z" fill="white"/>\n <path d="M17.4969 0.686201C17.4075 0.579834 17.3076 0.483286 17.1986 0.39983C16.8593 0.138004 16.4502 0 16.0165 0C15.5829 0 15.1743 0.138549 14.8345 0.39983C14.6523 0.540561 14.4974 0.711838 14.3752 0.909844C14.3054 1.02276 14.2476 1.14003 14.2034 1.25785L9.53906 13.7317H11.8769L16.0165 2.66135L20.1561 13.7317H22.494L17.8302 1.25731C17.7527 1.04948 17.6404 0.857478 17.4969 0.686201Z" fill="white"/>\n <path d="M9.86046 0.511825V0.371094H7.82204V9.02333C7.82204 10.6248 6.51891 11.928 4.91741 11.928C3.47028 11.928 2.23261 10.849 2.03897 9.41771L2.01988 9.27807L1.88024 9.29716L0.13964 9.5328L0 9.5519L0.0190914 9.69154C0.348555 12.1292 2.45462 13.9669 4.91741 13.9669C7.64313 13.9669 9.86046 11.7496 9.86046 9.02388V0.511825Z" fill="white"/>\n </svg>\n ',this.elements.logo=i,e.appendChild(i);const o=document.createElement("button");o.className="jaaq-center-play-btn",o.innerHTML='\n <svg viewBox="0 0 84 84" fill="none">\n <circle cx="42" cy="42" r="42" fill="white" fill-opacity="0.9"/>\n <path d="M33 28L56 42L33 56V28Z" fill="#000"/>\n </svg>\n ',o.setAttribute("aria-label","Play video"),this.elements.centerPlayBtn=o,e.appendChild(o);const s=document.createElement("div");s.className="jaaq-gradient-overlay",this.elements.gradientOverlay=s;const a=document.createElement("div");a.className="jaaq-caption-display",a.style.display="none",this.elements.captionDisplay=a,s.appendChild(a);const r=document.createElement("div");r.className="jaaq-video-title",this.elements.videoTitle=r,s.appendChild(r);const l=document.createElement("div");l.className="jaaq-video-author",this.elements.videoAuthor=l,s.appendChild(l);const c=document.createElement("div");c.className="jaaq-video-description",this.elements.videoDescription=c,s.appendChild(c),e.appendChild(s);const d=document.createElement("div");d.className="jaaq-loading",this.elements.loading=d,e.appendChild(d);const u=document.createElement("div");u.className="jaaq-error",u.style.display="none",this.elements.error=u,e.appendChild(u);const h=document.createElement("div");h.className="jaaq-controls",this.elements.controls=h;const p=document.createElement("div");p.className="jaaq-controls-bottom";const f=document.createElement("button");f.className="jaaq-control-btn",f.textContent="▶",f.setAttribute("aria-label","Play"),this.elements.playPauseBtn=f,p.appendChild(f);const m=document.createElement("button");m.className="jaaq-control-btn",m.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" viewBox="0 0 22 20" fill="none">\n <path d="M11.2168 19.9287L4.20801 13.7031H0V6.22559H4.20898L11.2168 0V19.9287ZM14.0215 0.150391C16.2405 0.150468 18.1409 1.39074 19.4385 3.17676C20.7365 4.9634 21.499 7.36811 21.499 9.96484C21.499 12.5613 20.7363 14.9654 19.4385 16.752C18.1409 18.538 16.2405 19.7792 14.0215 19.7793V17.1025C15.2032 17.1025 16.3824 16.4464 17.3135 15.165C18.2442 13.8839 18.8593 12.0493 18.8594 9.96484C18.8594 7.88034 18.2442 6.04581 17.3135 4.76465C16.3824 3.4832 15.2033 2.82723 14.0215 2.82715V0.150391ZM14.0215 5.75879C15.5701 5.75896 16.8252 7.64189 16.8252 9.96484C16.8251 12.2877 15.57 14.1707 14.0215 14.1709V5.75879Z" fill="white"/>\n </svg>\n ',m.setAttribute("aria-label","Mute"),this.elements.volumeBtn=m,p.appendChild(m);const g=document.createElement("div");g.className="jaaq-progress-bar",this.elements.progressBar=g;const v=document.createElement("div");v.className="jaaq-progress-filled",this.elements.progressFilled=v,g.appendChild(v),p.appendChild(g);const y=document.createElement("button");y.className="jaaq-control-btn jaaq-captions-btn",y.innerHTML="CC",y.setAttribute("aria-label","Captions"),this.elements.captionsBtn=y,p.appendChild(y);const b=document.createElement("button");b.className="jaaq-control-btn",b.textContent="⛶",b.setAttribute("aria-label","Fullscreen"),this.elements.fullscreenBtn=b,p.appendChild(b),h.appendChild(p),e.appendChild(h),t.appendChild(e),this.container.appendChild(t),this.updateControlsVisibility()}updateControlsVisibility(){const t=!1!==this.config.controls;this.elements.controls&&(this.elements.controls.style.display=t?"":"none")}async loadVideo(){if(this.client&&this.videoElement)try{this.setState({isLoading:!0,error:null});const t=await this.client.videos.getById(this.config.videoId);this.setState({videoData:t}),t.subtitle&&(this.captionCues=this.parseWebVTT(t.subtitle)),this.updateOverlayContent(t),this.emit("loaded",t);const n=t.videoUrl;if(n.includes(".m3u8"))if(e.isSupported()){this.hls&&this.hls.destroy();const t=new e({enableWorker:!0,lowLatencyMode:!0});!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted","")),t.loadSource(n),t.attachMedia(this.videoElement),!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted","")),t.on(e.Events.MANIFEST_PARSED,()=>{this.setState({isLoading:!1}),this.elements.loading&&(this.elements.loading.style.display="none"),!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.config.autoplay&&(!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.play())}),t.on(e.Events.ERROR,(t,e)=>{if(e.fatal){const t=`HLS Error: ${e.type} - ${e.details}`;this.showError(t),this.emit("error",new Error(t))}}),this.hls=t}else{if(!this.videoElement.canPlayType("application/vnd.apple.mpegurl"))throw new Error("HLS is not supported in this browser");this.videoElement.src=n,!0===this.config.startMuted&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.setState({isLoading:!1}),this.elements.loading&&(this.elements.loading.style.display="none"),this.config.autoplay&&(!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.play())}else this.videoElement.src=n,!0===this.config.startMuted&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.setState({isLoading:!1}),this.elements.loading&&(this.elements.loading.style.display="none"),this.config.autoplay&&(!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.play())}catch(t){const e=t instanceof Error?t.message:"Failed to load video";this.showError(e),this.setState({isLoading:!1}),this.emit("error",t instanceof Error?t:new Error(e))}}parseWebVTT(t){const e=[],n=t.split("\n");let i=0;for(;i<n.length;){const t=n[i].trim();if(t.includes("--\x3e")){const[o,s]=t.split("--\x3e").map(t=>t.trim()),a=t=>{const e=t.split(":");if(3===e.length){return 3600*parseFloat(e[0])+60*parseFloat(e[1])+parseFloat(e[2])}if(2===e.length){return 60*parseFloat(e[0])+parseFloat(e[1])}return 0},r=a(o),l=a(s);i++;const c=[];for(;i<n.length&&""!==n[i].trim();)c.push(n[i].trim()),i++;c.length>0&&e.push({start:r,end:l,text:c.join(" ")})}i++}return e}updateOverlayContent(t){const e=!1!==this.config.showLogo,n=!1!==this.config.showTitle,i=!1!==this.config.showAuthor,o=!1!==this.config.showDescription,s=!1!==this.config.showCaptions;if(this.elements.logo&&(this.elements.logo.style.display=e?"block":"none"),this.elements.videoTitle){const e=t.question||"",i=t.creator||"",o=i?`${e} - ${i}`:e;this.elements.videoTitle.textContent=o,this.elements.videoTitle.style.display=n&&e?"block":"none"}if(this.elements.videoAuthor){const e=t.author||t.creator||t.userName||"";this.elements.videoAuthor.textContent=e,this.elements.videoAuthor.style.display=i&&e?"block":"none"}if(this.elements.videoDescription){const e=t.creatorBiography||t.description||"";if(e){const t=150,n=e.length>t?e.substring(0,t)+"...":e;this.elements.videoDescription.innerHTML=`\n <span class="jaaq-description-text">${n}</span>\n ${e.length>t?'<span class="jaaq-read-more"> Read more</span>':""}\n `}this.elements.videoDescription.style.display=o&&e?"block":"none"}this.elements.captionsBtn&&(this.elements.captionsBtn.style.display=s?"flex":"none")}attachEventListeners(){this.videoElement&&(this.videoElement.addEventListener("play",()=>{this.setState({isPlaying:!0}),this.updatePlayPauseButton(),this.elements.centerPlayBtn&&(this.elements.centerPlayBtn.style.display="none"),this.emit("play",void 0)}),this.videoElement.addEventListener("pause",()=>{this.setState({isPlaying:!1}),this.updatePlayPauseButton(),this.elements.centerPlayBtn&&(this.elements.centerPlayBtn.style.display="flex"),this.emit("pause",void 0)}),this.videoElement.addEventListener("timeupdate",()=>{this.setState({currentTime:this.videoElement.currentTime}),this.updateProgress(),this.updateCaptions(),this.emit("timeupdate",this.videoElement.currentTime)}),this.videoElement.addEventListener("durationchange",()=>{this.setState({duration:this.videoElement.duration})}),this.videoElement.addEventListener("volumechange",()=>{this.setState({volume:this.videoElement.volume,isMuted:this.videoElement.muted}),this.updateVolumeUI(),this.emit("volumechange",this.videoElement.volume)}),this.videoElement.addEventListener("ended",()=>{this.emit("ended",void 0)}),this.elements.playPauseBtn?.addEventListener("click",()=>{this.togglePlayPause()}),this.elements.centerPlayBtn?.addEventListener("click",()=>{this.play(),this.elements.centerPlayBtn&&(this.elements.centerPlayBtn.style.display="none")}),this.elements.progressBar?.addEventListener("click",t=>{this.handleSeek(t)}),this.elements.volumeBtn?.addEventListener("click",()=>{this.toggleMute()}),this.elements.captionsBtn?.addEventListener("click",()=>{this.toggleCaptions()}),this.elements.fullscreenBtn?.addEventListener("click",()=>{this.toggleFullscreen()}),document.addEventListener("fullscreenchange",()=>{const t=!!document.fullscreenElement;this.setState({isFullscreen:t}),this.elements.player?.classList.toggle("fullscreen",t),this.emit("fullscreenchange",t)}),this.elements.player?.addEventListener("mousemove",()=>{this.elements.player?.classList.remove("is-paused")}),this.videoElement.addEventListener("pause",()=>{this.elements.player?.classList.add("is-paused")}),this.videoElement.addEventListener("play",()=>{this.elements.player?.classList.remove("is-paused")}))}setState(t){this.state={...this.state,...t}}updatePlayPauseButton(){this.elements.playPauseBtn&&(this.elements.playPauseBtn.textContent=this.state.isPlaying?"⏸":"▶",this.elements.playPauseBtn.setAttribute("aria-label",this.state.isPlaying?"Pause":"Play"))}updateProgress(){if(this.elements.progressFilled&&this.state.duration>0){const t=this.state.currentTime/this.state.duration*100;this.elements.progressFilled.style.width=`${t}%`}}updateVolumeUI(){if(this.elements.volumeBtn){const{isMuted:t,volume:e}=this.state;this.elements.volumeBtn.innerHTML=t||0===e?'\n <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" viewBox="0 0 22 20" fill="none">\n <path d="M11.2168 19.9287L4.20801 13.7031H0V6.22559H4.20898L11.2168 0V19.9287Z" fill="white"/>\n </svg>\n ':'\n <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" viewBox="0 0 22 20" fill="none">\n <path d="M11.2168 19.9287L4.20801 13.7031H0V6.22559H4.20898L11.2168 0V19.9287ZM14.0215 0.150391C16.2405 0.150468 18.1409 1.39074 19.4385 3.17676C20.7365 4.9634 21.499 7.36811 21.499 9.96484C21.499 12.5613 20.7363 14.9654 19.4385 16.752C18.1409 18.538 16.2405 19.7792 14.0215 19.7793V17.1025C15.2032 17.1025 16.3824 16.4464 17.3135 15.165C18.2442 13.8839 18.8593 12.0493 18.8594 9.96484C18.8594 7.88034 18.2442 6.04581 17.3135 4.76465C16.3824 3.4832 15.2033 2.82723 14.0215 2.82715V0.150391ZM14.0215 5.75879C15.5701 5.75896 16.8252 7.64189 16.8252 9.96484C16.8251 12.2877 15.57 14.1707 14.0215 14.1709V5.75879Z" fill="white"/>\n </svg>\n '}}updateCaptions(){if(!this.elements.captionDisplay||!this.state.captionsEnabled)return void(this.elements.captionDisplay&&(this.elements.captionDisplay.style.display="none"));const t=this.state.currentTime,e=this.captionCues.find(e=>t>=e.start&&t<=e.end);e?(this.elements.captionDisplay.textContent=e.text,this.elements.captionDisplay.style.display="block"):this.elements.captionDisplay.style.display="none"}handleSeek(t){if(!this.videoElement||!this.state.duration||!this.elements.progressBar)return;const e=this.elements.progressBar.getBoundingClientRect(),n=(t.clientX-e.left)/e.width;this.videoElement.currentTime=this.state.duration*a(n,0,1)}showError(t){this.setState({error:t,isLoading:!1}),this.elements.error&&(this.elements.error.textContent=t,this.elements.error.style.display="block"),this.elements.loading&&(this.elements.loading.style.display="none")}togglePlayPause(){this.state.isPlaying?this.pause():this.play()}toggleCaptions(){this.setState({captionsEnabled:!this.state.captionsEnabled}),this.updateCaptionsButton(),this.updateCaptions()}updateCaptionsButton(){this.elements.captionsBtn&&(this.state.captionsEnabled?this.elements.captionsBtn.classList.add("active"):this.elements.captionsBtn.classList.remove("active"))}toggleFullscreen(){var t;this.elements.player&&(t=this.elements.player,document.fullscreenElement?document.exitFullscreen():t.requestFullscreen())}play(){this.videoElement&&(!0!==this.config.startMuted||this.videoElement.muted||(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0})),this.videoElement.play())}pause(){this.videoElement?.pause()}setVolume(t){this.videoElement&&(this.videoElement.volume=a(t,0,1),this.videoElement.muted=0===t)}toggleMute(){this.videoElement&&(this.videoElement.muted=!this.videoElement.muted)}seek(t){this.videoElement&&(this.videoElement.currentTime=a(t,0,this.state.duration))}setFeatures(t){this.config={...this.config,...t},void 0!==t.controls&&this.updateControlsVisibility(),void 0!==t.startMuted&&this.videoElement&&(this.videoElement.muted=!0===t.startMuted,!0===t.startMuted?this.videoElement.setAttribute("muted",""):this.videoElement.removeAttribute("muted"),this.setState({isMuted:!0===t.startMuted}),this.updateVolumeUI()),this.state.videoData?this.updateOverlayContent(this.state.videoData):(void 0!==t.showLogo&&this.elements.logo&&(this.elements.logo.style.display=t.showLogo?"block":"none"),void 0!==t.showCaptions&&this.elements.captionsBtn&&(this.elements.captionsBtn.style.display=t.showCaptions?"flex":"none"))}getState(){return{...this.state}}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(e)}off(t,e){const n=this.listeners.get(t);n&&n.delete(e)}emit(t,e){const n=this.listeners.get(t);n&&n.forEach(t=>t(e))}destroy(){this.hls&&(this.hls.destroy(),this.hls=null),this.videoElement&&(this.videoElement.pause(),this.videoElement.src="",this.videoElement=null),this.listeners.clear(),this.container.innerHTML=""}}class c extends HTMLElement{static get observedAttributes(){return["video-id","api-key","client-id","autoplay","base-url","width","height","controls","show-logo","show-title","show-author","show-description","show-captions","start-muted"]}constructor(){super(),this.player=null,this.container=null,this.clientInstance=null,this.connected=!1,this.attachShadow({mode:"open"})}connectedCallback(){this.connected=!0,this.render(),this.initPlayer()}disconnectedCallback(){this.connected=!1,this.destroyPlayer()}attributeChangedCallback(t,e,n){if(this.connected&&e!==n)if("video-id"===t&&this.player)this.destroyPlayer(),this.initPlayer();else if("width"===t||"height"===t)this.updateContainerStyles();else if(("controls"===t||"show-logo"===t||"show-title"===t||"show-author"===t||"show-description"===t||"show-captions"===t||"start-muted"===t)&&this.player){const e={};"controls"===t?e.controls=!this.hasAttribute("controls")||"false"!==this.getAttribute("controls"):"show-logo"===t?e.showLogo=!this.hasAttribute("show-logo")||"false"!==this.getAttribute("show-logo"):"show-title"===t?e.showTitle=!this.hasAttribute("show-title")||"false"!==this.getAttribute("show-title"):"show-author"===t?e.showAuthor=!this.hasAttribute("show-author")||"false"!==this.getAttribute("show-author"):"show-description"===t?e.showDescription=!this.hasAttribute("show-description")||"false"!==this.getAttribute("show-description"):"show-captions"===t?e.showCaptions=!this.hasAttribute("show-captions")||"false"!==this.getAttribute("show-captions"):"start-muted"===t&&(e.startMuted=this.hasAttribute("start-muted")&&"false"!==this.getAttribute("start-muted")),this.player.setFeatures(e)}}render(){if(!this.shadowRoot)return;const t=document.createElement("style");t.textContent=`\n ${r}\n .jaaq-vanilla-player {\n user-select: none;\n}\n\n.jaaq-vanilla-player video {\n outline: none;\n}\n\n.jaaq-collection-player {\n width: 100%;\n max-width: 1400px;\n margin: 0 auto;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n}\n\n.jaaq-collection-loading {\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 400px;\n}\n\n.jaaq-collection-spinner {\n width: 50px;\n height: 50px;\n border: 4px solid rgba(0, 123, 255, 0.3);\n border-top-color: #007bff;\n border-radius: 50%;\n animation: jaaq-collection-spin 1s linear infinite;\n}\n\n@keyframes jaaq-collection-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.jaaq-collection-error {\n background: rgba(220, 53, 69, 0.9);\n color: white;\n padding: 16px 24px;\n border-radius: 8px;\n text-align: center;\n font-size: 14px;\n margin: 20px;\n}\n\n.jaaq-collection-carousel .splide__track {\n padding: 40px 0;\n}\n\n.jaaq-collection-carousel .splide__slide {\n opacity: 0.7;\n transition: all 0.3s ease;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.jaaq-collection-carousel .splide__slide.is-active {\n opacity: 1;\n}\n\n.jaaq-collection-carousel .splide__slide jaaq-video-player {\n width: 100%;\n max-width: 600px;\n transition: all 0.3s ease;\n}\n\n.jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 800px;\n}\n\n.jaaq-collection-carousel .splide__arrow {\n background: rgba(0, 0, 0, 0.5);\n border: none;\n width: 48px;\n height: 48px;\n border-radius: 50%;\n color: white;\n cursor: pointer;\n transition: all 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 20px;\n}\n\n.jaaq-collection-carousel .splide__arrow:hover {\n background: rgba(0, 0, 0, 0.8);\n transform: scale(1.1);\n}\n\n.jaaq-collection-carousel .splide__arrow:disabled {\n opacity: 0.3;\n cursor: not-allowed;\n}\n\n.jaaq-collection-carousel .splide__arrow svg {\n fill: white;\n width: 20px;\n height: 20px;\n}\n\n.jaaq-collection-carousel .splide__pagination {\n bottom: -30px;\n}\n\n.jaaq-collection-carousel .splide__pagination__page {\n background: #ccc;\n border: none;\n width: 10px;\n height: 10px;\n margin: 0 4px;\n border-radius: 50%;\n transition: all 0.2s;\n cursor: pointer;\n}\n\n.jaaq-collection-carousel .splide__pagination__page.is-active {\n background: #007bff;\n transform: scale(1.3);\n}\n\n@media (max-width: 1024px) {\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 500px;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 650px;\n }\n}\n\n@media (max-width: 768px) {\n .jaaq-collection-carousel .splide__track {\n padding: 20px 0;\n }\n\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 400px;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 500px;\n }\n\n .jaaq-collection-carousel .splide__arrow {\n width: 40px;\n height: 40px;\n }\n}\n\n@media (max-width: 480px) {\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 100%;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 100%;\n }\n}\n\n \n:host {\n display: block;\n width: 100%;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n `,this.container=document.createElement("div"),this.container.className="jaaq-webcomponent-container",this.shadowRoot.appendChild(t),this.shadowRoot.appendChild(this.container),this.updateContainerStyles()}updateContainerStyles(){if(!this.container)return;const t=this.getAttribute("width")||"100%",e=this.getAttribute("height")||"auto";this.container.style.width=t,this.container.style.height=e}async initPlayer(){if(!this.container||this.player)return;const t=this.getAttribute("video-id");if(!t)return void this.emitError(new Error("video-id attribute is required"));const e=this.getAttribute("api-key"),n=this.getAttribute("client-id"),i=this.getAttribute("base-url")||void 0,o=this.hasAttribute("autoplay")&&"false"!==this.getAttribute("autoplay"),s=!this.hasAttribute("controls")||"false"!==this.getAttribute("controls"),a=!this.hasAttribute("show-logo")||"false"!==this.getAttribute("show-logo"),r=!this.hasAttribute("show-title")||"false"!==this.getAttribute("show-title"),c=!this.hasAttribute("show-author")||"false"!==this.getAttribute("show-author"),d=!this.hasAttribute("show-description")||"false"!==this.getAttribute("show-description"),u=!this.hasAttribute("show-captions")||"false"!==this.getAttribute("show-captions"),h=this.hasAttribute("start-muted")&&"false"!==this.getAttribute("start-muted");if(this.clientInstance||e||n)try{this.player=new l(this.container,{videoId:t??void 0,apiKey:e??void 0,clientId:n??void 0,client:this.clientInstance||void 0,baseUrl:i,autoplay:o,controls:s,showLogo:a,showTitle:r,showAuthor:c,showDescription:d,showCaptions:u,startMuted:h}),this.attachPlayerEvents()}catch(t){this.emitError(t instanceof Error?t:new Error("Failed to initialize player"))}else this.emitError(new Error("Either client property or api-key and client-id attributes are required"))}attachPlayerEvents(){this.player&&(this.player.on("loaded",t=>{this.dispatchEvent(new CustomEvent("jaaq:loaded",{detail:t,bubbles:!0,composed:!0}))}),this.player.on("play",()=>{this.dispatchEvent(new CustomEvent("jaaq:play",{bubbles:!0,composed:!0}))}),this.player.on("pause",()=>{this.dispatchEvent(new CustomEvent("jaaq:pause",{bubbles:!0,composed:!0}))}),this.player.on("timeupdate",t=>{this.dispatchEvent(new CustomEvent("jaaq:timeupdate",{detail:t,bubbles:!0,composed:!0}))}),this.player.on("volumechange",t=>{this.dispatchEvent(new CustomEvent("jaaq:volumechange",{detail:t,bubbles:!0,composed:!0}))}),this.player.on("ended",()=>{this.dispatchEvent(new CustomEvent("jaaq:ended",{bubbles:!0,composed:!0}))}),this.player.on("error",t=>{this.emitError(t)}),this.player.on("fullscreenchange",t=>{this.dispatchEvent(new CustomEvent("jaaq:fullscreenchange",{detail:t,bubbles:!0,composed:!0}))}))}emitError(t){this.dispatchEvent(new CustomEvent("jaaq:error",{detail:t,bubbles:!0,composed:!0}))}destroyPlayer(){this.player&&(this.player.destroy(),this.player=null)}get client(){return this.clientInstance}set client(t){this.clientInstance=t,this.connected&&(this.destroyPlayer(),this.initPlayer())}get videoId(){return this.getAttribute("video-id")}set videoId(t){t?this.setAttribute("video-id",t):this.removeAttribute("video-id")}play(){this.player?.play()}pause(){this.player?.pause()}setVolume(t){this.player?.setVolume(t)}toggleMute(){this.player?.toggleMute()}seek(t){this.player?.seek(t)}getState(){return this.player?.getState()||null}destroy(){this.destroyPlayer()}}function d(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("hls.js")):"function"==typeof define&&define.amd?define(["exports","hls.js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).JaaqWebComponents={},t.Hls)}(this,function(t,e){"use strict";function n(t){const{baseUrl:e,apiKey:n,clientId:i,fetch:o,apiVersion:s}=t,a=o??globalThis.fetch;if(!a)throw new Error("No fetch implementation found. Provide one in SDKConfig.fetch for Node or custom environments.");const r={"Content-Type":"application/json","x-api-key":n},l=t=>function(t,e,n,i){if(/^https?:\/\//i.test(i))return i;const o=t.replace(/\/+$/,""),s=i.replace(/^\/+/,"");return`${o}/b2b/${e}/subscription/${encodeURIComponent(n)}${s.startsWith("/")?s:`/${s}`}`}(e,function(t){const e=t.toLowerCase();return"v1"===e||"v2"===e?e:"v1"}(s),i,t),c=async(t,e,n,i)=>{const o={method:t,headers:{...r,...n?.headers},...n};void 0!==i&&(o.body=JSON.stringify(i));return async function(t){if(!t.ok){const e=await t.text().catch(()=>"");throw new Error(`HTTP ${t.status}: ${e||t.statusText}`)}if(204!==t.status)return t.json()}(await a(l(e),o))};return{get:(t,e)=>c("GET",t,e),post:(t,e,n)=>c("POST",t,n,e),put:(t,e,n)=>c("PUT",t,n,e),patch:(t,e,n)=>c("PATCH",t,n,e),delete:(t,e)=>c("DELETE",t,e)}}const i="https://api.jaaq.app";class o{constructor(t,e){"v2"===e?(this.videos=function(t){return{async getById(e){const n=`/videos/${encodeURIComponent(e)}`;return(await t.get(n)).video}}}(t),this.collections=function(t){return{list:async()=>(await t.get("/collections")).collections,async getById(e){const n=`/collections/${encodeURIComponent(e)}`;return(await t.get(n)).collection}}}(t)):(this.videos=function(t){return{async getById(e){const n=`/videos/${encodeURIComponent(e)}`;return(await t.get(n)).video}}}(t),this.collections=function(t){return{list:async()=>(await t.get("/collections")).collections,async getById(e){const n=`/collections/${encodeURIComponent(e)}`;return(await t.get(n)).collection}}}(t))}static fromHttp(t,e){return new o(t,e)}static init(t){return s(t)}}function s(t){const{baseUrl:e=i,apiKey:s,clientId:a,fetch:r,apiVersion:l="v1"}=t,c=n({baseUrl:e,apiKey:s,clientId:a,fetch:r??globalThis.fetch,apiVersion:l});return o.fromHttp(c,l)}function a(t,e,n){return Math.max(e,Math.min(n,t))}var r=".jaaq-video-player {\n position: relative;\n width: 100%;\n max-width: none;\n margin: 0;\n background: #000;\n border-radius: 12px;\n overflow: hidden;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n aspect-ratio: 9 / 16;\n}\n\n.jaaq-video-player video {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: block;\n background: #000;\n object-fit: cover;\n}\n\n.jaaq-video-player.fullscreen {\n max-width: 100%;\n border-radius: 0;\n aspect-ratio: auto;\n}\n\n.jaaq-controls {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);\n padding: 40px 16px 16px;\n opacity: 1;\n z-index: 5;\n}\n\n.jaaq-progress-bar {\n width: 100%;\n flex: 1 1 0;\n min-width: 80px;\n height: 4px;\n background: rgba(255, 255, 255, 0.3);\n border-radius: 2px;\n cursor: pointer;\n position: relative;\n}\n\n.jaaq-progress-filled {\n height: 100%;\n background: #007bff;\n border-radius: 2px;\n width: 0%;\n transition: width 0.1s linear;\n}\n\n.jaaq-progress-bar:hover .jaaq-progress-filled {\n background: #0056b3;\n}\n\n.jaaq-controls-bottom {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 12px;\n color: white;\n}\n\n.jaaq-control-btn {\n background: transparent;\n border: none;\n color: white;\n cursor: pointer;\n padding: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s;\n font-size: 20px;\n line-height: 1;\n}\n\n.jaaq-control-btn:hover {\n transform: scale(1.1);\n}\n\n.jaaq-control-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.jaaq-loading {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 50px;\n height: 50px;\n border: 4px solid rgba(255, 255, 255, 0.3);\n border-top-color: #007bff;\n border-radius: 50%;\n animation: jaaq-spin 1s linear infinite;\n}\n\n@keyframes jaaq-spin {\n to {\n transform: translate(-50%, -50%) rotate(360deg);\n }\n}\n\n.jaaq-error {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: rgba(220, 53, 69, 0.9);\n color: white;\n padding: 16px 24px;\n border-radius: 8px;\n max-width: 80%;\n text-align: center;\n font-size: 14px;\n}\n\n.jaaq-video-info {\n padding: 16px;\n background: #f8f9fa;\n border-radius: 0 0 12px 12px;\n margin-top: -12px;\n}\n\n.jaaq-video-info h3 {\n margin: 0 0 8px 0;\n color: #333;\n font-size: 18px;\n font-weight: 600;\n}\n\n.jaaq-video-info p {\n margin: 4px 0;\n color: #666;\n font-size: 14px;\n}\n\n.jaaq-video-info strong {\n color: #333;\n}\n\n.jaaq-logo {\n position: absolute;\n top: 20px;\n left: 22px;\n color: white;\n font-size: 16px;\n font-weight: 600;\n z-index: 10;\n font-family:\n 'Archivo',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n letter-spacing: 0.5px;\n pointer-events: none;\n}\n\n.jaaq-center-play-btn {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 84px;\n height: 84px;\n background: transparent;\n border: none;\n cursor: pointer;\n z-index: 15;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s;\n padding: 0;\n}\n\n.jaaq-center-play-btn:hover {\n transform: translate(-50%, -50%) scale(1.1);\n}\n\n.jaaq-center-play-btn svg {\n width: 100%;\n height: 100%;\n filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));\n}\n\n.jaaq-video-player.is-playing .jaaq-center-play-btn {\n display: none;\n}\n\n.jaaq-gradient-overlay {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background: linear-gradient(180deg, transparent 0%, #0f0f0f 100%);\n padding: 80px 22px 85px;\n pointer-events: none;\n z-index: 5;\n}\n\n.jaaq-caption-display {\n font-family:\n 'Archivo',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n font-weight: 400;\n font-size: 16px;\n line-height: 20px;\n color: white;\n background: rgba(0, 0, 0, 0.8);\n padding: 8px 16px;\n margin-bottom: 12px;\n border-radius: 4px;\n text-align: center;\n max-width: 90%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.jaaq-video-title {\n font-family:\n 'Archivo',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n font-weight: 600;\n font-size: 18.695px;\n line-height: 21.5px;\n color: white;\n margin-bottom: 8px;\n letter-spacing: 0.37px;\n}\n\n.jaaq-video-author {\n font-family:\n 'Archivo',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n font-weight: 500;\n font-size: 14.021px;\n line-height: 16.825px;\n color: white;\n opacity: 0.7;\n margin-bottom: 8px;\n letter-spacing: -0.14px;\n}\n\n.jaaq-video-description {\n font-family:\n 'Archivo',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n sans-serif;\n font-weight: 400;\n font-size: 11px;\n line-height: 16px;\n color: #aaa8aa;\n letter-spacing: -0.11px;\n}\n\n.jaaq-description-text {\n color: #aaa8aa;\n}\n\n.jaaq-read-more {\n color: white;\n cursor: pointer;\n pointer-events: auto;\n}\n\n.jaaq-read-more:hover {\n text-decoration: underline;\n}\n\n.jaaq-progress-bar {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.jaaq-progress-filled {\n background: white;\n}\n\n.jaaq-captions-btn {\n font-size: 14px;\n font-weight: 600;\n border: 1.5px solid white;\n border-radius: 3px;\n padding: 4px 6px;\n line-height: 1;\n}\n\n.jaaq-captions-btn.active {\n background: white;\n color: #000;\n}\n";class l{constructor(t,e){if(this.client=null,this.hls=null,this.videoElement=null,this.listeners=new Map,this.captionCues=[],this.elements={},this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");if(this.config=e,this.state={isPlaying:!1,currentTime:0,duration:0,volume:1,isMuted:!0===e.startMuted,isFullscreen:!1,isLoading:!0,error:null,videoData:null,captionsEnabled:!1},e.client)this.client=e.client;else{if(!e.apiKey||!e.clientId)throw new Error("Please provide either a client instance or apiKey and clientId");this.client=function(t){return s(t)}({apiKey:e.apiKey,clientId:e.clientId,baseUrl:e.baseUrl})}this.init()}async init(){this.createDOM(),await this.loadVideo(),this.attachEventListeners(),!0===this.config.startMuted&&this.updateVolumeUI()}createDOM(){this.container.innerHTML="";const t=document.createElement("div");t.style.width=this.config.width||"100%",t.style.height=this.config.height||"auto";const e=document.createElement("div");e.className=`jaaq-video-player jaaq-vanilla-player ${this.config.className||""}`,this.elements.player=e;const n=document.createElement("video");this.videoElement=n,!0===this.config.startMuted&&(n.muted=!0,n.setAttribute("muted","")),e.appendChild(n);const i=document.createElement("div");i.className="jaaq-logo",i.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="50" height="15" viewBox="0 0 50 15" fill="none">\n <path d="M48.0329 10.7826C48.7578 9.6622 49.1402 8.37108 49.1402 7.02322C49.1402 3.19784 46.0283 0.0859375 42.2029 0.0859375C38.3775 0.0859375 35.2656 3.19784 35.2656 7.02322C35.2656 10.8486 38.3753 13.9578 42.1985 13.9605C42.1991 13.9605 42.2002 13.9605 42.2007 13.9605H42.2029C43.8475 13.9605 45.4305 13.3687 46.6698 12.3285L49.9971 14.56V12.0999L48.0334 10.7826H48.0329ZM37.309 7.02322C37.309 4.32479 39.5045 2.12927 42.2035 2.12927C44.9024 2.12927 47.0974 4.32479 47.0974 7.02322C47.0974 7.96252 46.8345 8.862 46.3359 9.64475L43.9817 8.06561C43.4531 7.71378 42.8373 7.52778 42.2002 7.52778C40.4394 7.52778 39.0054 8.95036 38.9846 10.7062C37.9586 9.80839 37.3084 8.49053 37.3084 7.02322H37.309ZM42.2035 11.9172C42.2035 11.9172 42.2002 11.9172 42.1985 11.9172C41.5527 11.9161 41.0274 11.3903 41.0274 10.7439C41.0274 10.0975 41.5538 9.57056 42.2007 9.57056C42.4331 9.57056 42.6578 9.6382 42.8493 9.76584L44.8714 11.1224C44.0853 11.633 43.1586 11.9172 42.2029 11.9172H42.2035Z" fill="white"/>\n <path d="M31.0751 0.686201C30.9856 0.579834 30.8858 0.483286 30.7767 0.39983C30.4374 0.138004 30.0283 0 29.5946 0C29.161 0 28.7524 0.138549 28.4126 0.39983C28.2304 0.540561 28.0755 0.711838 27.9533 0.909844C27.8835 1.02276 27.8257 1.14003 27.7815 1.25785L23.1172 13.7317H25.4551L29.5946 2.66135L33.7342 13.7317H36.0721L31.4078 1.25785C31.3303 1.05003 31.218 0.858024 31.0745 0.686746L31.0751 0.686201Z" fill="white"/>\n <path d="M17.4969 0.686201C17.4075 0.579834 17.3076 0.483286 17.1986 0.39983C16.8593 0.138004 16.4502 0 16.0165 0C15.5829 0 15.1743 0.138549 14.8345 0.39983C14.6523 0.540561 14.4974 0.711838 14.3752 0.909844C14.3054 1.02276 14.2476 1.14003 14.2034 1.25785L9.53906 13.7317H11.8769L16.0165 2.66135L20.1561 13.7317H22.494L17.8302 1.25731C17.7527 1.04948 17.6404 0.857478 17.4969 0.686201Z" fill="white"/>\n <path d="M9.86046 0.511825V0.371094H7.82204V9.02333C7.82204 10.6248 6.51891 11.928 4.91741 11.928C3.47028 11.928 2.23261 10.849 2.03897 9.41771L2.01988 9.27807L1.88024 9.29716L0.13964 9.5328L0 9.5519L0.0190914 9.69154C0.348555 12.1292 2.45462 13.9669 4.91741 13.9669C7.64313 13.9669 9.86046 11.7496 9.86046 9.02388V0.511825Z" fill="white"/>\n </svg>\n ',this.elements.logo=i,e.appendChild(i);const o=document.createElement("button");o.className="jaaq-center-play-btn",o.innerHTML='\n <svg viewBox="0 0 84 84" fill="none">\n <circle cx="42" cy="42" r="42" fill="white" fill-opacity="0.9"/>\n <path d="M33 28L56 42L33 56V28Z" fill="#000"/>\n </svg>\n ',o.setAttribute("aria-label","Play video"),this.elements.centerPlayBtn=o,e.appendChild(o);const s=document.createElement("div");s.className="jaaq-gradient-overlay",this.elements.gradientOverlay=s;const a=document.createElement("div");a.className="jaaq-caption-display",a.style.display="none",this.elements.captionDisplay=a,s.appendChild(a);const r=document.createElement("div");r.className="jaaq-video-title",this.elements.videoTitle=r,s.appendChild(r);const l=document.createElement("div");l.className="jaaq-video-author",this.elements.videoAuthor=l,s.appendChild(l);const c=document.createElement("div");c.className="jaaq-video-description",this.elements.videoDescription=c,s.appendChild(c),e.appendChild(s);const d=document.createElement("div");d.className="jaaq-loading",this.elements.loading=d,e.appendChild(d);const u=document.createElement("div");u.className="jaaq-error",u.style.display="none",this.elements.error=u,e.appendChild(u);const h=document.createElement("div");h.className="jaaq-controls",this.elements.controls=h;const p=document.createElement("div");p.className="jaaq-controls-bottom";const f=document.createElement("button");f.className="jaaq-control-btn",f.textContent="▶",f.setAttribute("aria-label","Play"),this.elements.playPauseBtn=f,p.appendChild(f);const m=document.createElement("button");m.className="jaaq-control-btn",m.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" viewBox="0 0 22 20" fill="none">\n <path d="M11.2168 19.9287L4.20801 13.7031H0V6.22559H4.20898L11.2168 0V19.9287ZM14.0215 0.150391C16.2405 0.150468 18.1409 1.39074 19.4385 3.17676C20.7365 4.9634 21.499 7.36811 21.499 9.96484C21.499 12.5613 20.7363 14.9654 19.4385 16.752C18.1409 18.538 16.2405 19.7792 14.0215 19.7793V17.1025C15.2032 17.1025 16.3824 16.4464 17.3135 15.165C18.2442 13.8839 18.8593 12.0493 18.8594 9.96484C18.8594 7.88034 18.2442 6.04581 17.3135 4.76465C16.3824 3.4832 15.2033 2.82723 14.0215 2.82715V0.150391ZM14.0215 5.75879C15.5701 5.75896 16.8252 7.64189 16.8252 9.96484C16.8251 12.2877 15.57 14.1707 14.0215 14.1709V5.75879Z" fill="white"/>\n </svg>\n ',m.setAttribute("aria-label","Mute"),this.elements.volumeBtn=m,p.appendChild(m);const g=document.createElement("div");g.className="jaaq-progress-bar",this.elements.progressBar=g;const v=document.createElement("div");v.className="jaaq-progress-filled",this.elements.progressFilled=v,g.appendChild(v),p.appendChild(g);const y=document.createElement("button");y.className="jaaq-control-btn jaaq-captions-btn",y.innerHTML="CC",y.setAttribute("aria-label","Captions"),this.elements.captionsBtn=y,p.appendChild(y);const b=document.createElement("button");b.className="jaaq-control-btn",b.textContent="⛶",b.setAttribute("aria-label","Fullscreen"),this.elements.fullscreenBtn=b,p.appendChild(b),h.appendChild(p),e.appendChild(h),t.appendChild(e),this.container.appendChild(t),this.updateControlsVisibility()}updateControlsVisibility(){const t=!1!==this.config.controls;this.elements.controls&&(this.elements.controls.style.display=t?"":"none")}async loadVideo(){if(this.client&&this.videoElement)try{this.setState({isLoading:!0,error:null});const t=await this.client.videos.getById(this.config.videoId);this.setState({videoData:t}),t.subtitle&&(this.captionCues=this.parseWebVTT(t.subtitle)),this.updateOverlayContent(t),this.emit("loaded",t);const n=t.videoUrl;if(n.includes(".m3u8"))if(e.isSupported()){this.hls&&this.hls.destroy();const t=new e({enableWorker:!0,lowLatencyMode:!0});!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted","")),t.loadSource(n),t.attachMedia(this.videoElement),!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted","")),t.on(e.Events.MANIFEST_PARSED,()=>{this.setState({isLoading:!1}),this.elements.loading&&(this.elements.loading.style.display="none"),!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.config.autoplay&&(!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.play())}),t.on(e.Events.ERROR,(t,e)=>{if(e.fatal){const t=`HLS Error: ${e.type} - ${e.details}`;this.showError(t),this.emit("error",new Error(t))}}),this.hls=t}else{if(!this.videoElement.canPlayType("application/vnd.apple.mpegurl"))throw new Error("HLS is not supported in this browser");this.videoElement.src=n,!0===this.config.startMuted&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.setState({isLoading:!1}),this.elements.loading&&(this.elements.loading.style.display="none"),this.config.autoplay&&(!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.play())}else this.videoElement.src=n,!0===this.config.startMuted&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.setState({isLoading:!1}),this.elements.loading&&(this.elements.loading.style.display="none"),this.config.autoplay&&(!0===this.config.startMuted&&this.videoElement&&(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0}),this.updateVolumeUI()),this.play())}catch(t){const e=t instanceof Error?t.message:"Failed to load video";this.showError(e),this.setState({isLoading:!1}),this.emit("error",t instanceof Error?t:new Error(e))}}parseWebVTT(t){const e=[],n=t.split("\n");let i=0;for(;i<n.length;){const t=n[i].trim();if(t.includes("--\x3e")){const[o,s]=t.split("--\x3e").map(t=>t.trim()),a=t=>{const e=t.split(":");if(3===e.length){return 3600*parseFloat(e[0])+60*parseFloat(e[1])+parseFloat(e[2])}if(2===e.length){return 60*parseFloat(e[0])+parseFloat(e[1])}return 0},r=a(o),l=a(s);i++;const c=[];for(;i<n.length&&""!==n[i].trim();)c.push(n[i].trim()),i++;c.length>0&&e.push({start:r,end:l,text:c.join(" ")})}i++}return e}updateOverlayContent(t){const e=!1!==this.config.showLogo,n=!1!==this.config.showTitle,i=!1!==this.config.showAuthor,o=!1!==this.config.showDescription,s=!1!==this.config.showCaptions;if(this.elements.logo&&(this.elements.logo.style.display=e?"block":"none"),this.elements.videoTitle){const e=t.question||"",i=t.creator||"",o=i?`${e} - ${i}`:e;this.elements.videoTitle.textContent=o,this.elements.videoTitle.style.display=n&&e?"block":"none"}if(this.elements.videoAuthor){const e=t.author||t.creator||t.userName||"";this.elements.videoAuthor.textContent=e,this.elements.videoAuthor.style.display=i&&e?"block":"none"}if(this.elements.videoDescription){const e=t.creatorBiography||t.description||"";if(e){const t=150,n=e.length>t?e.substring(0,t)+"...":e;this.elements.videoDescription.innerHTML=`\n <span class="jaaq-description-text">${n}</span>\n ${e.length>t?'<span class="jaaq-read-more"> Read more</span>':""}\n `}this.elements.videoDescription.style.display=o&&e?"block":"none"}this.elements.captionsBtn&&(this.elements.captionsBtn.style.display=s?"flex":"none")}attachEventListeners(){this.videoElement&&(this.videoElement.addEventListener("play",()=>{this.setState({isPlaying:!0}),this.updatePlayPauseButton(),this.elements.centerPlayBtn&&(this.elements.centerPlayBtn.style.display="none"),this.emit("play",void 0)}),this.videoElement.addEventListener("pause",()=>{this.setState({isPlaying:!1}),this.updatePlayPauseButton(),this.elements.centerPlayBtn&&(this.elements.centerPlayBtn.style.display="flex"),this.emit("pause",void 0)}),this.videoElement.addEventListener("timeupdate",()=>{this.setState({currentTime:this.videoElement.currentTime}),this.updateProgress(),this.updateCaptions(),this.emit("timeupdate",this.videoElement.currentTime)}),this.videoElement.addEventListener("durationchange",()=>{this.setState({duration:this.videoElement.duration})}),this.videoElement.addEventListener("volumechange",()=>{this.setState({volume:this.videoElement.volume,isMuted:this.videoElement.muted}),this.updateVolumeUI(),this.emit("volumechange",this.videoElement.volume)}),this.videoElement.addEventListener("ended",()=>{this.emit("ended",void 0)}),this.elements.playPauseBtn?.addEventListener("click",()=>{this.togglePlayPause()}),this.elements.centerPlayBtn?.addEventListener("click",()=>{this.play(),this.elements.centerPlayBtn&&(this.elements.centerPlayBtn.style.display="none")}),this.elements.progressBar?.addEventListener("click",t=>{this.handleSeek(t)}),this.elements.volumeBtn?.addEventListener("click",()=>{this.toggleMute()}),this.elements.captionsBtn?.addEventListener("click",()=>{this.toggleCaptions()}),this.elements.fullscreenBtn?.addEventListener("click",()=>{this.toggleFullscreen()}),document.addEventListener("fullscreenchange",()=>{const t=!!document.fullscreenElement;this.setState({isFullscreen:t}),this.elements.player?.classList.toggle("fullscreen",t),this.emit("fullscreenchange",t)}),this.elements.player?.addEventListener("mousemove",()=>{this.elements.player?.classList.remove("is-paused")}),this.videoElement.addEventListener("pause",()=>{this.elements.player?.classList.add("is-paused")}),this.videoElement.addEventListener("play",()=>{this.elements.player?.classList.remove("is-paused")}))}setState(t){this.state={...this.state,...t}}updatePlayPauseButton(){this.elements.playPauseBtn&&(this.elements.playPauseBtn.textContent=this.state.isPlaying?"⏸":"▶",this.elements.playPauseBtn.setAttribute("aria-label",this.state.isPlaying?"Pause":"Play"))}updateProgress(){if(this.elements.progressFilled&&this.state.duration>0){const t=this.state.currentTime/this.state.duration*100;this.elements.progressFilled.style.width=`${t}%`}}updateVolumeUI(){if(this.elements.volumeBtn){const{isMuted:t,volume:e}=this.state;this.elements.volumeBtn.innerHTML=t||0===e?'\n <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" viewBox="0 0 22 20" fill="none">\n <path d="M11.2168 19.9287L4.20801 13.7031H0V6.22559H4.20898L11.2168 0V19.9287Z" fill="white"/>\n </svg>\n ':'\n <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" viewBox="0 0 22 20" fill="none">\n <path d="M11.2168 19.9287L4.20801 13.7031H0V6.22559H4.20898L11.2168 0V19.9287ZM14.0215 0.150391C16.2405 0.150468 18.1409 1.39074 19.4385 3.17676C20.7365 4.9634 21.499 7.36811 21.499 9.96484C21.499 12.5613 20.7363 14.9654 19.4385 16.752C18.1409 18.538 16.2405 19.7792 14.0215 19.7793V17.1025C15.2032 17.1025 16.3824 16.4464 17.3135 15.165C18.2442 13.8839 18.8593 12.0493 18.8594 9.96484C18.8594 7.88034 18.2442 6.04581 17.3135 4.76465C16.3824 3.4832 15.2033 2.82723 14.0215 2.82715V0.150391ZM14.0215 5.75879C15.5701 5.75896 16.8252 7.64189 16.8252 9.96484C16.8251 12.2877 15.57 14.1707 14.0215 14.1709V5.75879Z" fill="white"/>\n </svg>\n '}}updateCaptions(){if(!this.elements.captionDisplay||!this.state.captionsEnabled)return void(this.elements.captionDisplay&&(this.elements.captionDisplay.style.display="none"));const t=this.state.currentTime,e=this.captionCues.find(e=>t>=e.start&&t<=e.end);e?(this.elements.captionDisplay.textContent=e.text,this.elements.captionDisplay.style.display="block"):this.elements.captionDisplay.style.display="none"}handleSeek(t){if(!this.videoElement||!this.state.duration||!this.elements.progressBar)return;const e=this.elements.progressBar.getBoundingClientRect(),n=(t.clientX-e.left)/e.width;this.videoElement.currentTime=this.state.duration*a(n,0,1)}showError(t){this.setState({error:t,isLoading:!1}),this.elements.error&&(this.elements.error.textContent=t,this.elements.error.style.display="block"),this.elements.loading&&(this.elements.loading.style.display="none")}togglePlayPause(){this.state.isPlaying?this.pause():this.play()}toggleCaptions(){this.setState({captionsEnabled:!this.state.captionsEnabled}),this.updateCaptionsButton(),this.updateCaptions()}updateCaptionsButton(){this.elements.captionsBtn&&(this.state.captionsEnabled?this.elements.captionsBtn.classList.add("active"):this.elements.captionsBtn.classList.remove("active"))}toggleFullscreen(){var t;this.elements.player&&(t=this.elements.player,document.fullscreenElement?document.exitFullscreen():t.requestFullscreen())}play(){this.videoElement&&(!0!==this.config.startMuted||this.videoElement.muted||(this.videoElement.muted=!0,this.videoElement.setAttribute("muted",""),this.setState({isMuted:!0})),this.videoElement.play())}pause(){this.videoElement?.pause()}setVolume(t){this.videoElement&&(this.videoElement.volume=a(t,0,1),this.videoElement.muted=0===t)}toggleMute(){this.videoElement&&(this.videoElement.muted=!this.videoElement.muted)}seek(t){this.videoElement&&(this.videoElement.currentTime=a(t,0,this.state.duration))}setFeatures(t){this.config={...this.config,...t},void 0!==t.controls&&this.updateControlsVisibility(),void 0!==t.startMuted&&this.videoElement&&(this.videoElement.muted=!0===t.startMuted,!0===t.startMuted?this.videoElement.setAttribute("muted",""):this.videoElement.removeAttribute("muted"),this.setState({isMuted:!0===t.startMuted}),this.updateVolumeUI()),this.state.videoData?this.updateOverlayContent(this.state.videoData):(void 0!==t.showLogo&&this.elements.logo&&(this.elements.logo.style.display=t.showLogo?"block":"none"),void 0!==t.showCaptions&&this.elements.captionsBtn&&(this.elements.captionsBtn.style.display=t.showCaptions?"flex":"none"))}getState(){return{...this.state}}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(e)}off(t,e){const n=this.listeners.get(t);n&&n.delete(e)}emit(t,e){const n=this.listeners.get(t);n&&n.forEach(t=>t(e))}destroy(){this.hls&&(this.hls.destroy(),this.hls=null),this.videoElement&&(this.videoElement.pause(),this.videoElement.src="",this.videoElement=null),this.listeners.clear(),this.container.innerHTML=""}}class c extends HTMLElement{static get observedAttributes(){return["video-id","api-key","client-id","autoplay","base-url","width","height","controls","show-logo","show-title","show-author","show-description","show-captions","start-muted"]}constructor(){super(),this.player=null,this.container=null,this.clientInstance=null,this.connected=!1,this.attachShadow({mode:"open"})}connectedCallback(){this.connected=!0,this.render(),this.initPlayer()}disconnectedCallback(){this.connected=!1,this.destroyPlayer()}attributeChangedCallback(t,e,n){if(this.connected&&e!==n)if("video-id"===t&&this.player)this.destroyPlayer(),this.initPlayer();else if("width"===t||"height"===t)this.updateContainerStyles();else if(("controls"===t||"show-logo"===t||"show-title"===t||"show-author"===t||"show-description"===t||"show-captions"===t||"start-muted"===t)&&this.player){const e={};"controls"===t?e.controls=!this.hasAttribute("controls")||"false"!==this.getAttribute("controls"):"show-logo"===t?e.showLogo=!this.hasAttribute("show-logo")||"false"!==this.getAttribute("show-logo"):"show-title"===t?e.showTitle=!this.hasAttribute("show-title")||"false"!==this.getAttribute("show-title"):"show-author"===t?e.showAuthor=!this.hasAttribute("show-author")||"false"!==this.getAttribute("show-author"):"show-description"===t?e.showDescription=!this.hasAttribute("show-description")||"false"!==this.getAttribute("show-description"):"show-captions"===t?e.showCaptions=!this.hasAttribute("show-captions")||"false"!==this.getAttribute("show-captions"):"start-muted"===t&&(e.startMuted=this.hasAttribute("start-muted")&&"false"!==this.getAttribute("start-muted")),this.player.setFeatures(e)}}render(){if(!this.shadowRoot)return;const t=document.createElement("style");t.textContent=`\n ${r}\n .jaaq-vanilla-player {\n user-select: none;\n}\n\n.jaaq-vanilla-player video {\n outline: none;\n}\n\n.jaaq-collection-player {\n width: 100%;\n max-width: 1400px;\n margin: 0 auto;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n}\n\n.jaaq-collection-loading {\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 400px;\n}\n\n.jaaq-collection-spinner {\n width: 50px;\n height: 50px;\n border: 4px solid rgba(0, 123, 255, 0.3);\n border-top-color: #007bff;\n border-radius: 50%;\n animation: jaaq-collection-spin 1s linear infinite;\n}\n\n@keyframes jaaq-collection-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.jaaq-collection-error {\n background: rgba(220, 53, 69, 0.9);\n color: white;\n padding: 16px 24px;\n border-radius: 8px;\n text-align: center;\n font-size: 14px;\n margin: 20px;\n}\n\n.jaaq-collection-carousel .splide__track {\n padding: 40px 0;\n}\n\n.jaaq-collection-carousel .splide__slide {\n opacity: 0.7;\n transition: all 0.3s ease;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.jaaq-collection-carousel .splide__slide.is-active {\n opacity: 1;\n}\n\n.jaaq-collection-carousel .splide__slide jaaq-video-player {\n width: 100%;\n max-width: 600px;\n transition: all 0.3s ease;\n}\n\n.jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 800px;\n}\n\n.jaaq-collection-carousel .splide__arrow {\n background: rgba(0, 0, 0, 0.5);\n border: none;\n width: 48px;\n height: 48px;\n border-radius: 50%;\n color: white;\n cursor: pointer;\n transition: all 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 20px;\n}\n\n.jaaq-collection-carousel .splide__arrow:hover {\n background: rgba(0, 0, 0, 0.8);\n transform: scale(1.1);\n}\n\n.jaaq-collection-carousel .splide__arrow:disabled {\n opacity: 0.3;\n cursor: not-allowed;\n}\n\n.jaaq-collection-carousel .splide__arrow svg {\n fill: white;\n width: 20px;\n height: 20px;\n}\n\n.jaaq-collection-carousel .splide__pagination {\n bottom: -30px;\n}\n\n.jaaq-collection-carousel .splide__pagination__page {\n background: #ccc;\n border: none;\n width: 10px;\n height: 10px;\n margin: 0 4px;\n border-radius: 50%;\n transition: all 0.2s;\n cursor: pointer;\n}\n\n.jaaq-collection-carousel .splide__pagination__page.is-active {\n background: #007bff;\n transform: scale(1.3);\n}\n\n@media (max-width: 1024px) {\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 500px;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 650px;\n }\n}\n\n@media (max-width: 768px) {\n .jaaq-collection-carousel .splide__track {\n padding: 20px 0;\n }\n\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 400px;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 500px;\n }\n\n .jaaq-collection-carousel .splide__arrow {\n width: 40px;\n height: 40px;\n }\n}\n\n@media (max-width: 480px) {\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 100%;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 100%;\n }\n}\n\n \n:host {\n display: block;\n width: 100%;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n `,this.container=document.createElement("div"),this.container.className="jaaq-webcomponent-container",this.shadowRoot.appendChild(t),this.shadowRoot.appendChild(this.container),this.updateContainerStyles()}updateContainerStyles(){if(!this.container)return;const t=this.getAttribute("width")||"100%",e=this.getAttribute("height")||"auto";this.container.style.width=t,this.container.style.height=e}async initPlayer(){if(!this.container||this.player)return;const t=this.getAttribute("video-id");if(!t)return void this.emitError(new Error("video-id attribute is required"));const e=this.getAttribute("api-key"),n=this.getAttribute("client-id"),i=this.getAttribute("base-url")||void 0,o=this.getAttribute("api-version")||void 0,s=this.hasAttribute("autoplay")&&"false"!==this.getAttribute("autoplay"),a=!this.hasAttribute("controls")||"false"!==this.getAttribute("controls"),r=!this.hasAttribute("show-logo")||"false"!==this.getAttribute("show-logo"),c=!this.hasAttribute("show-title")||"false"!==this.getAttribute("show-title"),d=!this.hasAttribute("show-author")||"false"!==this.getAttribute("show-author"),u=!this.hasAttribute("show-description")||"false"!==this.getAttribute("show-description"),h=!this.hasAttribute("show-captions")||"false"!==this.getAttribute("show-captions"),p=this.hasAttribute("start-muted")&&"false"!==this.getAttribute("start-muted");if(this.clientInstance||e||n)try{this.player=new l(this.container,{videoId:t??void 0,apiKey:e??void 0,clientId:n??void 0,client:this.clientInstance||void 0,baseUrl:i,apiVersion:o,autoplay:s,controls:a,showLogo:r,showTitle:c,showAuthor:d,showDescription:u,showCaptions:h,startMuted:p}),this.attachPlayerEvents()}catch(t){this.emitError(t instanceof Error?t:new Error("Failed to initialize player"))}else this.emitError(new Error("Either client property or api-key and client-id attributes are required"))}attachPlayerEvents(){this.player&&(this.player.on("loaded",t=>{this.dispatchEvent(new CustomEvent("jaaq:loaded",{detail:t,bubbles:!0,composed:!0}))}),this.player.on("play",()=>{this.dispatchEvent(new CustomEvent("jaaq:play",{bubbles:!0,composed:!0}))}),this.player.on("pause",()=>{this.dispatchEvent(new CustomEvent("jaaq:pause",{bubbles:!0,composed:!0}))}),this.player.on("timeupdate",t=>{this.dispatchEvent(new CustomEvent("jaaq:timeupdate",{detail:t,bubbles:!0,composed:!0}))}),this.player.on("volumechange",t=>{this.dispatchEvent(new CustomEvent("jaaq:volumechange",{detail:t,bubbles:!0,composed:!0}))}),this.player.on("ended",()=>{this.dispatchEvent(new CustomEvent("jaaq:ended",{bubbles:!0,composed:!0}))}),this.player.on("error",t=>{this.emitError(t)}),this.player.on("fullscreenchange",t=>{this.dispatchEvent(new CustomEvent("jaaq:fullscreenchange",{detail:t,bubbles:!0,composed:!0}))}))}emitError(t){this.dispatchEvent(new CustomEvent("jaaq:error",{detail:t,bubbles:!0,composed:!0}))}destroyPlayer(){this.player&&(this.player.destroy(),this.player=null)}get client(){return this.clientInstance}set client(t){this.clientInstance=t,this.connected&&(this.destroyPlayer(),this.initPlayer())}get videoId(){return this.getAttribute("video-id")}set videoId(t){t?this.setAttribute("video-id",t):this.removeAttribute("video-id")}play(){this.player?.play()}pause(){this.player?.pause()}setVolume(t){this.player?.setVolume(t)}toggleMute(){this.player?.toggleMute()}seek(t){this.player?.seek(t)}getState(){return this.player?.getState()||null}destroy(){this.destroyPlayer()}}function d(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}
2
2
  /*!
3
3
  * Splide.js
4
4
  * Version : 4.1.4
5
5
  * License : MIT
6
6
  * Copyright: 2022 Naotoshi Fujita
7
- */var u="(prefers-reduced-motion: reduce)",h={CREATED:1,MOUNTED:2,IDLE:3,MOVING:4,SCROLLING:5,DRAGGING:6,DESTROYED:7};function p(t){t.length=0}function f(t,e,n){return Array.prototype.slice.call(t,e,n)}function m(t){return t.bind.apply(t,[null].concat(f(arguments,1)))}var g=setTimeout,v=function(){};function y(t){return requestAnimationFrame(t)}function b(t,e){return typeof e===t}function w(t){return!j(t)&&b("object",t)}var x=Array.isArray,_=m(b,"function"),E=m(b,"string"),C=m(b,"undefined");function j(t){return null===t}function q(t){try{return t instanceof(t.ownerDocument.defaultView||window).HTMLElement}catch(t){return!1}}function A(t){return x(t)?t:[t]}function k(t,e){A(t).forEach(e)}function S(t,e){return t.indexOf(e)>-1}function L(t,e){return t.push.apply(t,A(e)),t}function M(t,e,n){t&&k(e,function(e){e&&t.classList[n?"add":"remove"](e)})}function P(t,e){M(t,E(e)?e.split(" "):e,!0)}function I(t,e){k(e,t.appendChild.bind(t))}function T(t,e){k(t,function(t){var n=(e||t).parentNode;n&&n.insertBefore(t,e)})}function D(t,e){return q(t)&&(t.msMatchesSelector||t.matches).call(t,e)}function B(t,e){var n=t?f(t.children):[];return e?n.filter(function(t){return D(t,e)}):n}function z(t,e){return e?B(t,e)[0]:t.firstElementChild}var N=Object.keys;function F(t,e,n){return t&&(n?N(t).reverse():N(t)).forEach(function(n){"__proto__"!==n&&e(t[n],n)}),t}function H(t){return f(arguments,1).forEach(function(e){F(e,function(n,i){t[i]=e[i]})}),t}function V(t){return f(arguments,1).forEach(function(e){F(e,function(e,n){x(e)?t[n]=e.slice():w(e)?t[n]=V({},w(t[n])?t[n]:{},e):t[n]=e})}),t}function O(t,e){k(e||N(t),function(e){delete t[e]})}function R(t,e){k(t,function(t){k(e,function(e){t&&t.removeAttribute(e)})})}function U(t,e,n){w(e)?F(e,function(e,n){U(t,n,e)}):k(t,function(t){j(n)||""===n?R(t,e):t.setAttribute(e,String(n))})}function $(t,e,n){var i=document.createElement(t);return e&&(E(e)?P(i,e):U(i,e)),n&&I(n,i),i}function W(t,e,n){if(C(n))return getComputedStyle(t)[e];j(n)||(t.style[e]=""+n)}function X(t,e){W(t,"display",e)}function Z(t){t.setActive&&t.setActive()||t.focus({preventScroll:!0})}function K(t,e){return t.getAttribute(e)}function G(t,e){return t&&t.classList.contains(e)}function J(t){return t.getBoundingClientRect()}function Y(t){k(t,function(t){t&&t.parentNode&&t.parentNode.removeChild(t)})}function Q(t){return z((new DOMParser).parseFromString(t,"text/html").body)}function tt(t,e){t.preventDefault(),e&&(t.stopPropagation(),t.stopImmediatePropagation())}function et(t,e){return t&&t.querySelector(e)}function nt(t,e){return e?f(t.querySelectorAll(e)):[]}function it(t,e){M(t,e,!1)}function ot(t){return t.timeStamp}function st(t){return E(t)?t:t?t+"px":""}var at="splide",rt="data-"+at;function lt(t,e){if(!t)throw new Error("["+at+"] "+(e||""))}var ct=Math.min,dt=Math.max,ut=Math.floor,ht=Math.ceil,pt=Math.abs;function ft(t,e,n){return pt(t-e)<n}function mt(t,e,n,i){var o=ct(e,n),s=dt(e,n);return i?o<t&&t<s:o<=t&&t<=s}function gt(t,e,n){var i=ct(e,n),o=dt(e,n);return ct(dt(i,t),o)}function vt(t){return+(t>0)-+(t<0)}function yt(t,e){return k(e,function(e){t=t.replace("%s",""+e)}),t}function bt(t){return t<10?"0"+t:""+t}var wt={};function xt(){var t=[];function e(t,e,n){k(t,function(t){t&&k(e,function(e){e.split(" ").forEach(function(e){var i=e.split(".");n(t,i[0],i[1])})})})}return{bind:function(n,i,o,s){e(n,i,function(e,n,i){var a="addEventListener"in e,r=a?e.removeEventListener.bind(e,n,o,s):e.removeListener.bind(e,o);a?e.addEventListener(n,o,s):e.addListener(o),t.push([e,n,i,o,r])})},unbind:function(n,i,o){e(n,i,function(e,n,i){t=t.filter(function(t){return!!(t[0]!==e||t[1]!==n||t[2]!==i||o&&t[3]!==o)||(t[4](),!1)})})},dispatch:function(t,e,n){var i,o=!0;return"function"==typeof CustomEvent?i=new CustomEvent(e,{bubbles:o,detail:n}):(i=document.createEvent("CustomEvent")).initCustomEvent(e,o,!1,n),t.dispatchEvent(i),i},destroy:function(){t.forEach(function(t){t[4]()}),p(t)}}}var _t="mounted",Et="ready",Ct="move",jt="moved",qt="click",At="active",kt="inactive",St="visible",Lt="hidden",Mt="refresh",Pt="updated",It="resize",Tt="resized",Dt="scroll",Bt="scrolled",zt="destroy",Nt="arrows:mounted",Ft="navigation:mounted",Ht="autoplay:play",Vt="autoplay:pause",Ot="lazyload:loaded",Rt="sk",Ut="sh",$t="ei";function Wt(t){var e=t?t.event.bus:document.createDocumentFragment(),n=xt();return t&&t.event.on(zt,n.destroy),H(n,{bus:e,on:function(t,i){n.bind(e,A(t).join(" "),function(t){i.apply(i,x(t.detail)?t.detail:[])})},off:m(n.unbind,e),emit:function(t){n.dispatch(e,t,f(arguments,1))}})}function Xt(t,e,n,i){var o,s,a=Date.now,r=0,l=!0,c=0;function d(){if(!l){if(r=t?ct((a()-o)/t,1):1,n&&n(r),r>=1&&(e(),o=a(),i&&++c>=i))return u();s=y(d)}}function u(){l=!0}function h(){s&&cancelAnimationFrame(s),r=0,s=0,l=!0}return{start:function(e){e||h(),o=a()-(e?r*t:0),l=!1,s=y(d)},rewind:function(){o=a(),r=0,n&&n(r)},pause:u,cancel:h,set:function(e){t=e},isPaused:function(){return l}}}var Zt="Arrow",Kt=Zt+"Left",Gt=Zt+"Right",Jt=Zt+"Up",Yt=Zt+"Down",Qt="ttb",te={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[Jt,Gt],ArrowRight:[Yt,Kt]};var ee="role",ne="tabindex",ie="aria-",oe=ie+"controls",se=ie+"current",ae=ie+"selected",re=ie+"label",le=ie+"labelledby",ce=ie+"hidden",de=ie+"orientation",ue=ie+"roledescription",he=ie+"live",pe=ie+"busy",fe=ie+"atomic",me=[ee,ne,"disabled",oe,se,re,le,ce,de,ue],ge=at+"__",ve="is-",ye=at,be=ge+"track",we=ge+"list",xe=ge+"slide",_e=xe+"--clone",Ee=xe+"__container",Ce=ge+"arrows",je=ge+"arrow",qe=je+"--prev",Ae=je+"--next",ke=ge+"pagination",Se=ke+"__page",Le=ge+"progress"+"__bar",Me=ge+"toggle",Pe=ge+"sr",Ie=ve+"initialized",Te=ve+"active",De=ve+"prev",Be=ve+"next",ze=ve+"visible",Ne=ve+"loading",Fe=ve+"focus-in",He=ve+"overflow",Ve=[Te,ze,De,Be,Ne,Fe,He],Oe={slide:xe,clone:_e,arrows:Ce,arrow:je,prev:qe,next:Ae,pagination:ke,page:Se,spinner:ge+"spinner"};var Re="touchstart mousedown",Ue="touchmove mousemove",$e="touchend touchcancel mouseup click";var We="slide",Xe="loop",Ze="fade";function Ke(t,e,n,i){var o,s=Wt(t),a=s.on,r=s.emit,l=s.bind,c=t.Components,d=t.root,u=t.options,h=u.isNavigation,p=u.updateOnMove,f=u.i18n,g=u.pagination,v=u.slideFocus,y=c.Direction.resolve,b=K(i,"style"),w=K(i,re),x=n>-1,_=z(i,"."+Ee);function E(){var o=t.splides.map(function(t){var n=t.splide.Components.Slides.getAt(e);return n?n.slide.id:""}).join(" ");U(i,re,yt(f.slideX,(x?n:e)+1)),U(i,oe,o),U(i,ee,v?"button":""),v&&R(i,ue)}function C(){o||j()}function j(){if(!o){var n=t.index;(s=q())!==G(i,Te)&&(M(i,Te,s),U(i,se,h&&s||""),r(s?At:kt,A)),function(){var e=function(){if(t.is(Ze))return q();var e=J(c.Elements.track),n=J(i),o=y("left",!0),s=y("right",!0);return ut(e[o])<=ht(n[o])&&ut(n[s])<=ht(e[s])}(),n=!e&&(!q()||x);t.state.is([4,5])||U(i,ce,n||"");U(nt(i,u.focusableNodes||""),ne,n?-1:""),v&&U(i,ne,n?-1:0);e!==G(i,ze)&&(M(i,ze,e),r(e?St:Lt,A));if(!e&&document.activeElement===i){var o=c.Slides.getAt(t.index);o&&Z(o.slide)}}(),M(i,De,e===n-1),M(i,Be,e===n+1)}var s}function q(){var i=t.index;return i===e||u.cloneStatus&&i===n}var A={index:e,slideIndex:n,slide:i,container:_,isClone:x,mount:function(){x||(i.id=d.id+"-slide"+bt(e+1),U(i,ee,g?"tabpanel":"group"),U(i,ue,f.slide),U(i,re,w||yt(f.slideLabel,[e+1,t.length]))),l(i,"click",m(r,qt,A)),l(i,"keydown",m(r,Rt,A)),a([jt,Ut,Bt],j),a(Ft,E),p&&a(Ct,C)},destroy:function(){o=!0,s.destroy(),it(i,Ve),R(i,me),U(i,"style",b),U(i,re,w||"")},update:j,style:function(t,e,n){W(n&&_||i,t,e)},isWithin:function(n,i){var o=pt(n-e);return x||!u.rewind&&!t.is(Xe)||(o=ct(o,t.length-o)),o<=i}};return A}var Ge=rt+"-interval";var Je={passive:!1,capture:!0};var Ye={Spacebar:" ",Right:Gt,Left:Kt,Up:Jt,Down:Yt};function Qe(t){return t=E(t)?t:t.key,Ye[t]||t}var tn="keydown";var en=rt+"-lazy",nn=en+"-srcset",on="["+en+"], ["+nn+"]";var sn=[" ","Enter"];var an=Object.freeze({__proto__:null,Media:function(t,e,n){var i=t.state,o=n.breakpoints||{},s=n.reducedMotion||{},a=xt(),r=[];function l(t){t&&a.destroy()}function c(t,e){var n=matchMedia(e);a.bind(n,"change",d),r.push([t,n])}function d(){var e=i.is(7),o=n.direction,s=r.reduce(function(t,e){return V(t,e[1].matches?e[0]:{})},{});O(n),h(s),n.destroy?t.destroy("completely"===n.destroy):e?(l(!0),t.mount()):o!==n.direction&&t.refresh()}function h(e,o,s){V(n,e),o&&V(Object.getPrototypeOf(n),e),!s&&i.is(1)||t.emit(Pt,n)}return{setup:function(){var t="min"===n.mediaQuery;N(o).sort(function(e,n){return t?+e-+n:+n-+e}).forEach(function(e){c(o[e],"("+(t?"min":"max")+"-width:"+e+"px)")}),c(s,u),d()},destroy:l,reduce:function(t){matchMedia(u).matches&&(t?V(n,s):O(n,N(s)))},set:h}},Direction:function(t,e,n){return{resolve:function(t,e,i){var o="rtl"!==(i=i||n.direction)||e?i===Qt?0:-1:1;return te[t]&&te[t][o]||t.replace(/width|left|right/i,function(t,e){var n=te[t.toLowerCase()][o]||t;return e>0?n.charAt(0).toUpperCase()+n.slice(1):n})},orient:function(t){return t*("rtl"===n.direction?1:-1)}}},Elements:function(t,e,n){var i,o,s,a=Wt(t),r=a.on,l=a.bind,c=t.root,d=n.i18n,u={},h=[],f=[],m=[];function g(){i=b("."+be),o=z(i,"."+we),lt(i&&o,"A track/list element is missing."),L(h,B(o,"."+xe+":not(."+_e+")")),F({arrows:Ce,pagination:ke,prev:qe,next:Ae,bar:Le,toggle:Me},function(t,e){u[e]=b("."+t)}),H(u,{root:c,track:i,list:o,slides:h}),function(){var t=c.id||(s=at,""+s+bt(wt[s]=(wt[s]||0)+1)),e=n.role;var s;c.id=t,i.id=i.id||t+"-track",o.id=o.id||t+"-list",!K(c,ee)&&"SECTION"!==c.tagName&&e&&U(c,ee,e);U(c,ue,d.carousel),U(o,ee,"presentation")}(),y()}function v(t){var e=me.concat("style");p(h),it(c,f),it(i,m),R([i,o],e),R(c,t?e:["style",ue])}function y(){it(c,f),it(i,m),f=w(ye),m=w(be),P(c,f),P(i,m),U(c,re,n.label),U(c,le,n.labelledby)}function b(t){var e=et(c,t);return e&&function(t,e){if(_(t.closest))return t.closest(e);for(var n=t;n&&1===n.nodeType&&!D(n,e);)n=n.parentElement;return n}(e,"."+ye)===c?e:void 0}function w(t){return[t+"--"+n.type,t+"--"+n.direction,n.drag&&t+"--draggable",n.isNavigation&&t+"--nav",t===ye&&Te]}return H(u,{setup:g,mount:function(){r(Mt,v),r(Mt,g),r(Pt,y),l(document,Re+" keydown",function(t){s="keydown"===t.type},{capture:!0}),l(c,"focusin",function(){M(c,Fe,!!s)})},destroy:v})},Slides:function(t,e,n){var i=Wt(t),o=i.on,s=i.emit,a=i.bind,r=e.Elements,l=r.slides,c=r.list,d=[];function u(){l.forEach(function(t,e){f(t,e,-1)})}function h(){v(function(t){t.destroy()}),p(d)}function f(e,n,i){var o=Ke(t,n,i,e);o.mount(),d.push(o),d.sort(function(t,e){return t.index-e.index})}function g(t){return t?y(function(t){return!t.isClone}):d}function v(t,e){g(e).forEach(t)}function y(t){return d.filter(_(t)?t:function(e){return E(t)?D(e.slide,t):S(A(t),e.index)})}return{mount:function(){u(),o(Mt,h),o(Mt,u)},destroy:h,update:function(){v(function(t){t.update()})},register:f,get:g,getIn:function(t){var i=e.Controller,o=i.toIndex(t),s=i.hasFocus()?1:n.perPage;return y(function(t){return mt(t.index,o,o+s-1)})},getAt:function(t){return y(t)[0]},add:function(t,e){k(t,function(t){if(E(t)&&(t=Q(t)),q(t)){var i=l[e];i?T(t,i):I(c,t),P(t,n.classes.slide),o=t,r=m(s,It),d=nt(o,"img"),(u=d.length)?d.forEach(function(t){a(t,"load error",function(){--u||r()})}):r()}var o,r,d,u}),s(Mt)},remove:function(t){Y(y(t).map(function(t){return t.slide})),s(Mt)},forEach:v,filter:y,style:function(t,e,n){v(function(i){i.style(t,e,n)})},getLength:function(t){return t?l.length:d.length},isEnough:function(){return d.length>n.perPage}}},Layout:function(t,e,n){var i,o,s,a=Wt(t),r=a.on,l=a.bind,c=a.emit,d=e.Slides,u=e.Direction.resolve,h=e.Elements,p=h.root,f=h.track,g=h.list,v=d.getAt,y=d.style;function b(){i=n.direction===Qt,W(p,"maxWidth",st(n.width)),W(f,u("paddingLeft"),_(!1)),W(f,u("paddingRight"),_(!0)),x(!0)}function x(t){var e=J(p);(t||o.width!==e.width||o.height!==e.height)&&(W(f,"height",function(){var t="";i&&(lt(t=E(),"height or heightRatio is missing."),t="calc("+t+" - "+_(!1)+" - "+_(!0)+")");return t}()),y(u("marginRight"),st(n.gap)),y("width",n.autoWidth?null:st(n.fixedWidth)||(i?"":C())),y("height",st(n.fixedHeight)||(i?n.autoHeight?null:C():E()),!0),o=e,c(Tt),s!==(s=L())&&(M(p,He,s),c("overflow",s)))}function _(t){var e=n.padding,i=u(t?"right":"left");return e&&st(e[i]||(w(e)?0:e))||"0px"}function E(){return st(n.height||J(g).width*n.heightRatio)}function C(){var t=st(n.gap);return"calc((100%"+(t&&" + "+t)+")/"+(n.perPage||1)+(t&&" - "+t)+")"}function j(){return J(g)[u("width")]}function q(t,e){var n=v(t||0);return n?J(n.slide)[u("width")]+(e?0:S()):0}function A(t,e){var n=v(t);if(n){var i=J(n.slide)[u("right")],o=J(g)[u("left")];return pt(i-o)+(e?0:S())}return 0}function k(e){return A(t.length-1)-A(0)+q(0,e)}function S(){var t=v(0);return t&&parseFloat(W(t.slide,u("marginRight")))||0}function L(){return t.is(Ze)||k(!0)>j()}return{mount:function(){var t,e;b(),l(window,"resize load",(t=m(c,It),e=Xt(0,t,null,1),function(){e.isPaused()&&e.start()})),r([Pt,Mt],b),r(It,x)},resize:x,listSize:j,slideSize:q,sliderSize:k,totalSize:A,getPadding:function(t){return parseFloat(W(f,u("padding"+(t?"Right":"Left"))))||0},isOverflow:L}},Clones:function(t,e,n){var i,o=Wt(t),s=o.on,a=e.Elements,r=e.Slides,l=e.Direction.resolve,c=[];function d(){s(Mt,u),s([Pt,It],f),(i=m())&&(!function(e){var i=r.get().slice(),o=i.length;if(o){for(;i.length<e;)L(i,i);L(i.slice(-e),i.slice(0,e)).forEach(function(s,l){var d=l<e,u=function(e,i){var o=e.cloneNode(!0);return P(o,n.classes.clone),o.id=t.root.id+"-clone"+bt(i+1),o}(s.slide,l);d?T(u,i[0].slide):I(a.list,u),L(c,u),r.register(u,l-e+(d?0:o),s.index)})}}(i),e.Layout.resize(!0))}function u(){h(),d()}function h(){Y(c),p(c),o.destroy()}function f(){var t=m();i!==t&&(i<t||!t)&&o.emit(Mt)}function m(){var i=n.clones;if(t.is(Xe)){if(C(i)){var o=n[l("fixedWidth")]&&e.Layout.slideSize(0);i=o&&ht(J(a.track)[l("width")]/o)||n[l("autoWidth")]&&t.length||2*n.perPage}}else i=0;return i}return{mount:d,destroy:h}},Move:function(t,e,n){var i,o=Wt(t),s=o.on,a=o.emit,r=t.state.set,l=e.Layout,c=l.slideSize,d=l.getPadding,u=l.totalSize,h=l.listSize,p=l.sliderSize,f=e.Direction,m=f.resolve,g=f.orient,v=e.Elements,y=v.list,b=v.track;function w(){e.Controller.isBusy()||(e.Scroll.cancel(),x(t.index),e.Slides.update())}function x(t){_(A(t,!0))}function _(n,i){if(!t.is(Ze)){var o=i?n:function(n){if(t.is(Xe)){var i=q(n),o=i>e.Controller.getEnd();(i<0||o)&&(n=E(n,o))}return n}(n);W(y,"transform","translate"+m("X")+"("+o+"px)"),n!==o&&a(Ut)}}function E(t,e){var n=t-S(e),i=p();return t-=g(i*(ht(pt(n)/i)||1))*(e?1:-1)}function j(){_(k(),!0),i.cancel()}function q(t){for(var n=e.Slides.get(),i=0,o=1/0,s=0;s<n.length;s++){var a=n[s].index,r=pt(A(a,!0)-t);if(!(r<=o))break;o=r,i=a}return i}function A(e,i){var o=g(u(e-1)-function(t){var e=n.focus;return"center"===e?(h()-c(t,!0))/2:+e*c(t)||0}(e));return i?function(e){n.trimSpace&&t.is(We)&&(e=gt(e,0,g(p(!0)-h())));return e}(o):o}function k(){var t=m("left");return J(y)[t]-J(b)[t]+g(d(!1))}function S(t){return A(t?e.Controller.getEnd():0,!!n.trimSpace)}return{mount:function(){i=e.Transition,s([_t,Tt,Pt,Mt],w)},move:function(t,e,n,o){var s,l;t!==e&&(s=t>n,l=g(E(k(),s)),s?l>=0:l<=y[m("scrollWidth")]-J(b)[m("width")])&&(j(),_(E(k(),t>n),!0)),r(4),a(Ct,e,n,t),i.start(e,function(){r(3),a(jt,e,n,t),o&&o()})},jump:x,translate:_,shift:E,cancel:j,toIndex:q,toPosition:A,getPosition:k,getLimit:S,exceededLimit:function(t,e){e=C(e)?k():e;var n=!0!==t&&g(e)<g(S(!1)),i=!1!==t&&g(e)>g(S(!0));return n||i},reposition:w}},Controller:function(t,e,n){var i,o,s,a,r=Wt(t),l=r.on,c=r.emit,d=e.Move,u=d.getPosition,h=d.getLimit,p=d.toPosition,f=e.Slides,g=f.isEnough,v=f.getLength,y=n.omitEnd,b=t.is(Xe),w=t.is(We),x=m(S,!1),_=m(S,!0),j=n.start||0,q=j;function A(){o=v(!0),s=n.perMove,a=n.perPage,i=P();var t=gt(j,0,y?i:o-1);t!==j&&(j=t,d.reposition())}function k(){i!==P()&&c($t)}function S(t,e){var n=s||(B()?1:a),o=L(j+n*(t?-1:1),j,!(s||B()));return-1===o&&w&&!ft(u(),h(!t),1)?t?0:i:e?o:M(o)}function L(e,r,l){if(g()||B()){var c=function(e){if(w&&"move"===n.trimSpace&&e!==j)for(var i=u();i===p(e,!0)&&mt(e,0,t.length-1,!n.rewind);)e<j?--e:++e;return e}(e);c!==e&&(r=e,e=c,l=!1),e<0||e>i?e=s||!mt(0,e,r,!0)&&!mt(i,r,e,!0)?b?l?e<0?-(o%a||a):o:e:n.rewind?e<0?i:0:-1:I(T(e)):l&&e!==r&&(e=I(T(r)+(e<r?-1:1)))}else e=-1;return e}function M(t){return b?(t+o)%o||0:t}function P(){for(var t=o-(B()||b&&s?1:a);y&&t-- >0;)if(p(o-1,!0)!==p(t,!0)){t++;break}return gt(t,0,o-1)}function I(t){return gt(B()?t:a*t,0,i)}function T(t){return B()?ct(t,i):ut((t>=i?o-1:t)/a)}function D(t){t!==j&&(q=j,j=t)}function B(){return!C(n.focus)||n.isNavigation}function z(){return t.state.is([4,5])&&!!n.waitForTransition}return{mount:function(){A(),l([Pt,Mt,$t],A),l(Tt,k)},go:function(t,e,n){if(!z()){var o=function(t){var e=j;if(E(t)){var n=t.match(/([+\-<>])(\d+)?/)||[],o=n[1],s=n[2];"+"===o||"-"===o?e=L(j+ +(""+o+(+s||1)),j):">"===o?e=s?I(+s):x(!0):"<"===o&&(e=_(!0))}else e=b?t:gt(t,0,i);return e}(t),s=M(o);s>-1&&(e||s!==j)&&(D(s),d.move(o,s,q,n))}},scroll:function(t,n,o,s){e.Scroll.scroll(t,n,o,function(){var t=M(d.toIndex(u()));D(y?ct(t,i):t),s&&s()})},getNext:x,getPrev:_,getAdjacent:S,getEnd:P,setIndex:D,getIndex:function(t){return t?q:j},toIndex:I,toPage:T,toDest:function(t){var e=d.toIndex(t);return w?gt(e,0,i):e},hasFocus:B,isBusy:z}},Arrows:function(t,e,n){var i,o,s=Wt(t),a=s.on,r=s.bind,l=s.emit,c=n.classes,d=n.i18n,u=e.Elements,h=e.Controller,p=u.arrows,f=u.track,g=p,v=u.prev,y=u.next,b={};function w(){!function(){var t=n.arrows;!t||v&&y||(g=p||$("div",c.arrows),v=C(!0),y=C(!1),i=!0,I(g,[v,y]),!p&&T(g,f));v&&y&&(H(b,{prev:v,next:y}),X(g,t?"":"none"),P(g,o=Ce+"--"+n.direction),t&&(a([_t,jt,Mt,Bt,$t],j),r(y,"click",m(E,">")),r(v,"click",m(E,"<")),j(),U([v,y],oe,f.id),l(Nt,v,y)))}(),a(Pt,x)}function x(){_(),w()}function _(){s.destroy(),it(g,o),i?(Y(p?[v,y]:g),v=y=null):R([v,y],me)}function E(t){h.go(t,!0)}function C(t){return Q('<button class="'+c.arrow+" "+(t?c.prev:c.next)+'" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40" focusable="false"><path d="'+(n.arrowPath||"m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z")+'" />')}function j(){if(v&&y){var e=t.index,n=h.getPrev(),i=h.getNext(),o=n>-1&&e<n?d.last:d.prev,s=i>-1&&e>i?d.first:d.next;v.disabled=n<0,y.disabled=i<0,U(v,re,o),U(y,re,s),l("arrows:updated",v,y,n,i)}}return{arrows:b,mount:w,destroy:_,update:j}},Autoplay:function(t,e,n){var i,o,s=Wt(t),a=s.on,r=s.bind,l=s.emit,c=Xt(n.interval,t.go.bind(t,">"),function(t){var e=u.bar;e&&W(e,"width",100*t+"%"),l("autoplay:playing",t)}),d=c.isPaused,u=e.Elements,h=e.Elements,p=h.root,f=h.toggle,m=n.autoplay,g="pause"===m;function v(){d()&&e.Slides.isEnough()&&(c.start(!n.resetProgress),o=i=g=!1,w(),l(Ht))}function y(t){void 0===t&&(t=!0),g=!!t,w(),d()||(c.pause(),l(Vt))}function b(){g||(i||o?y(!1):v())}function w(){f&&(M(f,Te,!g),U(f,re,n.i18n[g?"play":"pause"]))}function x(t){var i=e.Slides.getAt(t);c.set(i&&+K(i.slide,Ge)||n.interval)}return{mount:function(){m&&(!function(){n.pauseOnHover&&r(p,"mouseenter mouseleave",function(t){i="mouseenter"===t.type,b()});n.pauseOnFocus&&r(p,"focusin focusout",function(t){o="focusin"===t.type,b()});f&&r(f,"click",function(){g?v():y(!0)});a([Ct,Dt,Mt],c.rewind),a(Ct,x)}(),f&&U(f,oe,u.track.id),g||v(),w())},destroy:c.cancel,play:v,pause:y,isPaused:d}},Cover:function(t,e,n){var i=Wt(t).on;function o(t){e.Slides.forEach(function(e){var n=z(e.container||e.slide,"img");n&&n.src&&s(t,n,e)})}function s(t,e,n){n.style("background",t?'center/cover no-repeat url("'+e.src+'")':"",!0),X(e,t?"none":"")}return{mount:function(){n.cover&&(i(Ot,m(s,!0)),i([_t,Pt,Mt],m(o,!0)))},destroy:m(o,!1)}},Scroll:function(t,e,n){var i,o,s=Wt(t),a=s.on,r=s.emit,l=t.state.set,c=e.Move,d=c.getPosition,u=c.getLimit,h=c.exceededLimit,p=c.translate,f=t.is(We),g=1;function v(t,n,s,a,u){var p=d();if(w(),s&&(!f||!h())){var v=e.Layout.sliderSize(),x=vt(t)*v*ut(pt(t)/v)||0;t=c.toPosition(e.Controller.toDest(t%v))+x}var _=ft(p,t,1);g=1,n=_?0:n||dt(pt(t-p)/1.5,800),o=a,i=Xt(n,y,m(b,p,t,u),1),l(5),r(Dt),i.start()}function y(){l(3),o&&o(),r(Bt)}function b(t,e,i,s){var a,r,l=d(),c=(t+(e-t)*(a=s,(r=n.easingFunc)?r(a):1-Math.pow(1-a,4))-l)*g;p(l+c),f&&!i&&h()&&(g*=.6,pt(c)<10&&v(u(h(!0)),600,!1,o,!0))}function w(){i&&i.cancel()}function x(){i&&!i.isPaused()&&(w(),y())}return{mount:function(){a(Ct,w),a([Pt,Mt],x)},destroy:w,scroll:v,cancel:x}},Drag:function(t,e,n){var i,o,s,a,r,l,c,d,u=Wt(t),h=u.on,p=u.emit,f=u.bind,m=u.unbind,g=t.state,y=e.Move,b=e.Scroll,x=e.Controller,_=e.Elements.track,E=e.Media.reduce,C=e.Direction,j=C.resolve,q=C.orient,A=y.getPosition,k=y.exceededLimit,S=!1;function L(){var t=n.drag;O(!t),a="free"===t}function M(t){if(l=!1,!c){var e=V(t);i=t.target,o=n.noDrag,D(i,"."+Se+", ."+je)||o&&D(i,o)||!e&&t.button||(x.isBusy()?tt(t,!0):(d=e?_:window,r=g.is([4,5]),s=null,f(d,Ue,P,Je),f(d,$e,I,Je),y.cancel(),b.cancel(),B(t)))}var i,o}function P(e){if(g.is(6)||(g.set(6),p("drag")),e.cancelable)if(r){y.translate(i+z(e)/(S&&t.is(We)?5:1));var o=N(e)>200,s=S!==(S=k());(o||s)&&B(e),l=!0,p("dragging"),tt(e)}else(function(t){return pt(z(t))>pt(z(t,!0))})(e)&&(r=function(t){var e=n.dragMinThreshold,i=w(e),o=i&&e.mouse||0,s=(i?e.touch:+e)||10;return pt(z(t))>(V(t)?s:o)}(e),tt(e))}function I(i){g.is(6)&&(g.set(3),p("dragged")),r&&(!function(i){var o=function(e){if(t.is(Xe)||!S){var n=N(e);if(n&&n<200)return z(e)/n}return 0}(i),s=function(t){return A()+vt(t)*ct(pt(t)*(n.flickPower||600),a?1/0:e.Layout.listSize()*(n.flickMaxPages||1))}(o),r=n.rewind&&n.rewindByDrag;E(!1),a?x.scroll(s,0,n.snap):t.is(Ze)?x.go(q(vt(o))<0?r?"<":"-":r?">":"+"):t.is(We)&&S&&r?x.go(k(!0)?">":"<"):x.go(x.toDest(s),!0);E(!0)}(i),tt(i)),m(d,Ue,P),m(d,$e,I),r=!1}function T(t){!c&&l&&tt(t,!0)}function B(t){s=o,o=t,i=A()}function z(t,e){return H(t,e)-H(F(t),e)}function N(t){return ot(t)-ot(F(t))}function F(t){return o===t&&s||o}function H(t,e){return(V(t)?t.changedTouches[0]:t)["page"+j(e?"Y":"X")]}function V(t){return"undefined"!=typeof TouchEvent&&t instanceof TouchEvent}function O(t){c=t}return{mount:function(){f(_,Ue,v,Je),f(_,$e,v,Je),f(_,Re,M,Je),f(_,"click",T,{capture:!0}),f(_,"dragstart",tt),h([_t,Pt],L)},disable:O,isDragging:function(){return r}}},Keyboard:function(t,e,n){var i,o,s=Wt(t),a=s.on,r=s.bind,l=s.unbind,c=t.root,d=e.Direction.resolve;function u(){var t=n.keyboard;t&&(i="global"===t?window:c,r(i,tn,f))}function h(){l(i,tn)}function p(){var t=o;o=!0,g(function(){o=t})}function f(e){if(!o){var n=Qe(e);n===d(Kt)?t.go("<"):n===d(Gt)&&t.go(">")}}return{mount:function(){u(),a(Pt,h),a(Pt,u),a(Ct,p)},destroy:h,disable:function(t){o=t}}},LazyLoad:function(t,e,n){var i=Wt(t),o=i.on,s=i.off,a=i.bind,r=i.emit,l="sequential"===n.lazyLoad,c=[jt,Bt],d=[];function u(){p(d),e.Slides.forEach(function(t){nt(t.slide,on).forEach(function(e){var i=K(e,en),o=K(e,nn);if(i!==e.src||o!==e.srcset){var s=n.classes.spinner,a=e.parentElement,r=z(a,"."+s)||$("span",s,a);d.push([e,t,r]),e.src||X(e,"none")}})}),l?v():(s(c),o(c,h),h())}function h(){(d=d.filter(function(e){var i=n.perPage*((n.preloadPages||1)+1)-1;return!e[1].isWithin(t.index,i)||f(e)})).length||s(c)}function f(t){var e=t[0];P(t[1].slide,Ne),a(e,"load error",m(g,t)),U(e,"src",K(e,en)),U(e,"srcset",K(e,nn)),R(e,en),R(e,nn)}function g(t,e){var n=t[0],i=t[1];it(i.slide,Ne),"error"!==e.type&&(Y(t[2]),X(n,""),r(Ot,n,i),r(It)),l&&v()}function v(){d.length&&f(d.shift())}return{mount:function(){n.lazyLoad&&(u(),o(Mt,u))},destroy:m(p,d),check:h}},Pagination:function(t,e,n){var i,o,s=Wt(t),a=s.on,r=s.emit,l=s.bind,c=e.Slides,d=e.Elements,u=e.Controller,h=u.hasFocus,g=u.getIndex,v=u.go,y=e.Direction.resolve,b=d.pagination,w=[];function x(){i&&(Y(b?f(i.children):i),it(i,o),p(w),i=null),s.destroy()}function _(t){v(">"+t,!0)}function E(t,e){var n=w.length,i=Qe(e),o=C(),s=-1;i===y(Gt,!1,o)?s=++t%n:i===y(Kt,!1,o)?s=(--t+n)%n:"Home"===i?s=0:"End"===i&&(s=n-1);var a=w[s];a&&(Z(a.button),v(">"+s),tt(e,!0))}function C(){return n.paginationDirection||n.direction}function j(t){return w[u.toPage(t)]}function q(){var t=j(g(!0)),e=j(g());if(t){var n=t.button;it(n,Te),R(n,ae),U(n,ne,-1)}if(e){var o=e.button;P(o,Te),U(o,ae,!0),U(o,ne,"")}r("pagination:updated",{list:i,items:w},t,e)}return{items:w,mount:function e(){x(),a([Pt,Mt,$t],e);var s=n.pagination;b&&X(b,s?"":"none"),s&&(a([Ct,Dt,Bt],q),function(){var e=t.length,s=n.classes,a=n.i18n,r=n.perPage,p=h()?u.getEnd()+1:ht(e/r);P(i=b||$("ul",s.pagination,d.track.parentElement),o=ke+"--"+C()),U(i,ee,"tablist"),U(i,re,a.select),U(i,de,C()===Qt?"vertical":"");for(var f=0;f<p;f++){var g=$("li",null,i),v=$("button",{class:s.page,type:"button"},g),y=c.getIn(f).map(function(t){return t.slide.id}),x=!h()&&r>1?a.pageX:a.slideX;l(v,"click",m(_,f)),n.paginationKeyboard&&l(v,"keydown",m(E,f)),U(g,ee,"presentation"),U(v,ee,"tab"),U(v,oe,y.join(" ")),U(v,re,yt(x,f+1)),U(v,ne,-1),w.push({li:g,button:v,page:f})}}(),q(),r("pagination:mounted",{list:i,items:w},j(t.index)))},destroy:x,getAt:j,update:q}},Sync:function(t,e,n){var i=n.isNavigation,o=n.slideFocus,s=[];function a(){var e,n;t.splides.forEach(function(e){e.isParent||(l(t,e.splide),l(e.splide,t))}),i&&(e=Wt(t),(n=e.on)(qt,d),n(Rt,u),n([_t,Pt],c),s.push(e),e.emit(Ft,t.splides))}function r(){s.forEach(function(t){t.destroy()}),p(s)}function l(t,e){var n=Wt(t);n.on(Ct,function(t,n,i){e.go(e.is(Xe)?i:t)}),s.push(n)}function c(){U(e.Elements.list,de,n.direction===Qt?"vertical":"")}function d(e){t.go(e.index)}function u(t,e){S(sn,Qe(e))&&(d(t),tt(e))}return{setup:m(e.Media.set,{slideFocus:C(o)?i:o},!0),mount:a,destroy:r,remount:function(){r(),a()}}},Wheel:function(t,e,n){var i=Wt(t).bind,o=0;function s(i){if(i.cancelable){var s=i.deltaY,a=s<0,r=ot(i),l=n.wheelMinThreshold||0,c=n.wheelSleep||0;pt(s)>l&&r-o>c&&(t.go(a?"<":">"),o=r),function(i){return!n.releaseWheel||t.state.is(4)||-1!==e.Controller.getAdjacent(i)}(a)&&tt(i)}}return{mount:function(){n.wheel&&i(e.Elements.track,"wheel",s,Je)}}},Live:function(t,e,n){var i=Wt(t).on,o=e.Elements.track,s=n.live&&!n.isNavigation,a=$("span",Pe),r=Xt(90,m(l,!1));function l(t){U(o,pe,t),t?(I(o,a),r.start()):(Y(a),r.cancel())}function c(t){s&&U(o,he,t?"off":"polite")}return{mount:function(){s&&(c(!e.Autoplay.isPaused()),U(o,fe,!0),a.textContent="…",i(Ht,m(c,!0)),i(Vt,m(c,!1)),i([jt,Bt],m(l,!0)))},disable:c,destroy:function(){R(o,[he,fe,pe]),Y(a)}}}}),rn={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:Oe,i18n:{prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select a slide to show",slideLabel:"%s of %s"},reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}};function ln(t,e,n){var i=e.Slides;function o(){i.forEach(function(t){t.style("transform","translateX(-"+100*t.index+"%)")})}return{mount:function(){Wt(t).on([_t,Mt],o)},start:function(t,e){i.style("transition","opacity "+n.speed+"ms "+n.easing),g(e)},cancel:v}}function cn(t,e,n){var i,o=e.Move,s=e.Controller,a=e.Scroll,r=e.Elements.list,l=m(W,r,"transition");function c(){l(""),a.cancel()}return{mount:function(){Wt(t).bind(r,"transitionend",function(t){t.target===r&&i&&(c(),i())})},start:function(e,r){var c=o.toPosition(e,!0),d=o.getPosition(),u=function(e){var i=n.rewindSpeed;if(t.is(We)&&i){var o=s.getIndex(!0),a=s.getEnd();if(0===o&&e>=a||o>=a&&0===e)return i}return n.speed}(e);pt(c-d)>=1&&u>=1?n.useScroll?a.scroll(c,u,!1,r):(l("transform "+u+"ms "+n.easing),o.translate(c,!0),i=r):(o.jump(e),r())},cancel:c}}var dn=function(){function t(e,n){var i;this.event=Wt(),this.Components={},this.state=(i=1,{set:function(t){i=t},is:function(t){return S(A(t),i)}}),this.splides=[],this._o={},this._E={};var o=E(e)?et(document,e):e;lt(o,o+" is invalid."),this.root=o,n=V({label:K(o,re)||"",labelledby:K(o,le)||""},rn,t.defaults,n||{});try{V(n,JSON.parse(K(o,rt)))}catch(t){lt(!1,"Invalid JSON")}this._o=Object.create(V({},n))}var e=t.prototype;return e.mount=function(t,e){var n=this,i=this.state,o=this.Components;return lt(i.is([1,7]),"Already mounted!"),i.set(1),this._C=o,this._T=e||this._T||(this.is(Ze)?ln:cn),this._E=t||this._E,F(H({},an,this._E,{Transition:this._T}),function(t,e){var i=t(n,o,n._o);o[e]=i,i.setup&&i.setup()}),F(o,function(t){t.mount&&t.mount()}),this.emit(_t),P(this.root,Ie),i.set(3),this.emit(Et),this},e.sync=function(t){return this.splides.push({splide:t}),t.splides.push({splide:this,isParent:!0}),this.state.is(3)&&(this._C.Sync.remount(),t.Components.Sync.remount()),this},e.go=function(t){return this._C.Controller.go(t),this},e.on=function(t,e){return this.event.on(t,e),this},e.off=function(t){return this.event.off(t),this},e.emit=function(t){var e;return(e=this.event).emit.apply(e,[t].concat(f(arguments,1))),this},e.add=function(t,e){return this._C.Slides.add(t,e),this},e.remove=function(t){return this._C.Slides.remove(t),this},e.is=function(t){return this._o.type===t},e.refresh=function(){return this.emit(Mt),this},e.destroy=function(t){void 0===t&&(t=!0);var e=this.event,n=this.state;return n.is(1)?Wt(this).on(Et,this.destroy.bind(this,t)):(F(this._C,function(e){e.destroy&&e.destroy(t)},!0),e.emit(zt),e.destroy(),t&&p(this.splides),n.set(7)),this},d(t,[{key:"options",get:function(){return this._o},set:function(t){this._C.Media.set(t,!0,!0)}},{key:"length",get:function(){return this._C.Slides.getLength(!0)}},{key:"index",get:function(){return this._C.Controller.getIndex()}}]),t}(),un=dn;un.defaults={},un.STATES=h;class hn extends HTMLElement{static get observedAttributes(){return["collection-id","api-key","client-id","subscription-id","base-url","autoplay","show-arrows","show-dots","video-settings"]}constructor(){super(),this.splide=null,this.container=null,this.carouselElement=null,this.clientInstance=null,this.connected=!1,this.collectionData=null,this.autoplayTimeoutId=null,this.attachShadow({mode:"open"})}connectedCallback(){this.connected=!0,this.render(),this.initCarousel()}disconnectedCallback(){this.connected=!1,this.destroyCarousel()}attributeChangedCallback(t,e,n){this.connected&&e!==n&&("collection-id"!==t&&"video-settings"!==t||(this.destroyCarousel(),this.initCarousel()),"show-arrows"!==t&&"show-dots"!==t||(this.destroyCarousel(),this.initCarousel()))}getBooleanAttr(t,e){const n=this.getAttribute(t);return null===n?e:"false"!==n}render(){if(!this.shadowRoot)return;const t=document.createElement("style");t.textContent=`\n ${r}\n .jaaq-collection-player {\n width: 100%;\n max-width: 1400px;\n margin: 0 auto;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n}\n\n.jaaq-collection-loading {\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 400px;\n}\n\n.jaaq-collection-spinner {\n width: 50px;\n height: 50px;\n border: 4px solid rgba(0, 123, 255, 0.3);\n border-top-color: #007bff;\n border-radius: 50%;\n animation: jaaq-collection-spin 1s linear infinite;\n}\n\n@keyframes jaaq-collection-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.jaaq-collection-error {\n background: rgba(220, 53, 69, 0.9);\n color: white;\n padding: 16px 24px;\n border-radius: 8px;\n text-align: center;\n font-size: 14px;\n margin: 20px;\n}\n\n.jaaq-collection-carousel .splide__track {\n padding: 40px 0;\n}\n\n.jaaq-collection-carousel .splide__slide {\n opacity: 0.7;\n transition: all 0.3s ease;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.jaaq-collection-carousel .splide__slide.is-active {\n opacity: 1;\n}\n\n.jaaq-collection-carousel .splide__slide jaaq-video-player {\n width: 100%;\n max-width: 600px;\n transition: all 0.3s ease;\n}\n\n.jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 800px;\n}\n\n.jaaq-collection-carousel .splide__arrow {\n background: rgba(0, 0, 0, 0.5);\n border: none;\n width: 48px;\n height: 48px;\n border-radius: 50%;\n color: white;\n cursor: pointer;\n transition: all 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 20px;\n}\n\n.jaaq-collection-carousel .splide__arrow:hover {\n background: rgba(0, 0, 0, 0.8);\n transform: scale(1.1);\n}\n\n.jaaq-collection-carousel .splide__arrow:disabled {\n opacity: 0.3;\n cursor: not-allowed;\n}\n\n.jaaq-collection-carousel .splide__arrow svg {\n fill: white;\n width: 20px;\n height: 20px;\n}\n\n.jaaq-collection-carousel .splide__pagination {\n bottom: -30px;\n}\n\n.jaaq-collection-carousel .splide__pagination__page {\n background: #ccc;\n border: none;\n width: 10px;\n height: 10px;\n margin: 0 4px;\n border-radius: 50%;\n transition: all 0.2s;\n cursor: pointer;\n}\n\n.jaaq-collection-carousel .splide__pagination__page.is-active {\n background: white;\n transform: scale(1.3);\n}\n\n@media (max-width: 1024px) {\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 500px;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 650px;\n }\n}\n\n@media (max-width: 768px) {\n .jaaq-collection-carousel .splide__track {\n padding: 20px 0;\n }\n\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 400px;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 500px;\n }\n\n .jaaq-collection-carousel .splide__arrow {\n width: 40px;\n height: 40px;\n }\n}\n\n@media (max-width: 480px) {\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 100%;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 100%;\n }\n}\n\n .splide__container{box-sizing:border-box;position:relative}.splide__list{backface-visibility:hidden;display:-ms-flexbox;display:flex;height:100%;margin:0!important;padding:0!important}.splide.is-initialized:not(.is-active) .splide__list{display:block}.splide__pagination{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:center;justify-content:center;margin:0;pointer-events:none}.splide__pagination li{display:inline-block;line-height:1;list-style-type:none;margin:0;pointer-events:auto}.splide:not(.is-overflow) .splide__pagination{display:none}.splide__progress__bar{width:0}.splide{position:relative;visibility:hidden}.splide.is-initialized,.splide.is-rendered{visibility:visible}.splide__slide{backface-visibility:hidden;box-sizing:border-box;-ms-flex-negative:0;flex-shrink:0;list-style-type:none!important;margin:0;position:relative}.splide__slide img{vertical-align:bottom}.splide__spinner{animation:splide-loading 1s linear infinite;border:2px solid #999;border-left-color:transparent;border-radius:50%;bottom:0;contain:strict;display:inline-block;height:20px;left:0;margin:auto;position:absolute;right:0;top:0;width:20px}.splide__sr{clip:rect(0 0 0 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.splide__toggle.is-active .splide__toggle__play,.splide__toggle__pause{display:none}.splide__toggle.is-active .splide__toggle__pause{display:inline}.splide__track{overflow:hidden;position:relative;z-index:0}@keyframes splide-loading{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.splide__track--draggable{-webkit-touch-callout:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.splide__track--fade>.splide__list>.splide__slide{margin:0!important;opacity:0;z-index:0}.splide__track--fade>.splide__list>.splide__slide.is-active{opacity:1;z-index:1}.splide--rtl{direction:rtl}.splide__track--ttb>.splide__list{display:block}.splide__arrow{-ms-flex-align:center;align-items:center;background:#ccc;border:0;border-radius:50%;cursor:pointer;display:-ms-flexbox;display:flex;height:2em;-ms-flex-pack:center;justify-content:center;opacity:.7;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:2em;z-index:1}.splide__arrow svg{fill:#000;height:1.2em;width:1.2em}.splide__arrow:hover:not(:disabled){opacity:.9}.splide__arrow:disabled{opacity:.3}.splide__arrow:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide__arrow--prev{left:1em}.splide__arrow--prev svg{transform:scaleX(-1)}.splide__arrow--next{right:1em}.splide.is-focus-in .splide__arrow:focus{outline:3px solid #0bf;outline-offset:3px}.splide__pagination{bottom:.5em;left:0;padding:0 1em;position:absolute;right:0;z-index:1}.splide__pagination__page{background:#ccc;border:0;border-radius:50%;display:inline-block;height:8px;margin:3px;opacity:.7;padding:0;position:relative;transition:transform .2s linear;width:8px}.splide__pagination__page.is-active{background:#fff;transform:scale(1.4);z-index:1}.splide__pagination__page:hover{cursor:pointer;opacity:.9}.splide__pagination__page:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__pagination__page:focus{outline:3px solid #0bf;outline-offset:3px}.splide__progress__bar{background:#ccc;height:3px}.splide__slide{-webkit-tap-highlight-color:rgba(0,0,0,0)}.splide__slide:focus{outline:0}@supports(outline-offset:-3px){.splide__slide:focus-visible{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide__slide:focus-visible{border:3px solid #0bf}}@supports(outline-offset:-3px){.splide.is-focus-in .splide__slide:focus{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide.is-focus-in .splide__slide:focus{border:3px solid #0bf}.splide.is-focus-in .splide__track>.splide__list>.splide__slide:focus{border-color:#0bf}}.splide__toggle{cursor:pointer}.splide__toggle:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__toggle:focus{outline:3px solid #0bf;outline-offset:3px}.splide__track--nav>.splide__list>.splide__slide{border:3px solid transparent;cursor:pointer}.splide__track--nav>.splide__list>.splide__slide.is-active{border:3px solid #000}.splide__arrows--rtl .splide__arrow--prev{left:auto;right:1em}.splide__arrows--rtl .splide__arrow--prev svg{transform:scaleX(1)}.splide__arrows--rtl .splide__arrow--next{left:1em;right:auto}.splide__arrows--rtl .splide__arrow--next svg{transform:scaleX(-1)}.splide__arrows--ttb .splide__arrow{left:50%;transform:translate(-50%)}.splide__arrows--ttb .splide__arrow--prev{top:1em}.splide__arrows--ttb .splide__arrow--prev svg{transform:rotate(-90deg)}.splide__arrows--ttb .splide__arrow--next{bottom:1em;top:auto}.splide__arrows--ttb .splide__arrow--next svg{transform:rotate(90deg)}.splide__pagination--ttb{bottom:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;left:auto;padding:1em 0;right:.5em;top:0}\n \n:host {\n display: block;\n width: 100%;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n `,this.container=document.createElement("div"),this.container.className="jaaq-collection-player",this.shadowRoot.appendChild(t),this.shadowRoot.appendChild(this.container)}async initCarousel(){if(!this.container)return;const t=this.getAttribute("collection-id");if(!t)return void this.emitError(new Error("collection-id attribute is required"));const e=this.getAttribute("api-key"),n=this.getAttribute("client-id"),s=this.getAttribute("base-url")||void 0;if(this.clientInstance||e||n){this.showLoading();try{const a=this.clientInstance||o.init({apiKey:e,clientId:n,baseUrl:s||i});if(this.collectionData=await a.collections.getById(t),!this.collectionData.videos||0===this.collectionData.videos.length)return void this.emitError(new Error("No videos found in collection"));this.renderCarousel(),this.initSplide(),this.dispatchEvent(new CustomEvent("jaaq:collection:loaded",{detail:this.collectionData,bubbles:!0,composed:!0}))}catch(t){this.emitError(t instanceof Error?t:new Error("Failed to load collection"))}}else this.emitError(new Error("Either client property or api-key and client-id attributes are required"))}showLoading(){this.container&&(this.container.innerHTML='\n <div class="jaaq-collection-loading">\n <div class="jaaq-collection-spinner"></div>\n </div>\n ')}renderCarousel(){if(!this.container||!this.collectionData)return;this.container.innerHTML="",this.carouselElement=document.createElement("div"),this.carouselElement.className="splide jaaq-collection-carousel";const t=document.createElement("div");t.className="splide__track";const e=document.createElement("ul");e.className="splide__list";const n=this.getAttribute("api-key"),i=this.getAttribute("client-id"),o=this.getAttribute("base-url"),s=this.getAttribute("video-settings");let a=null;if(s)try{a=JSON.parse(s)}catch(t){console.warn("[CollectionPlayer] Failed to parse video-settings attribute",t)}this.collectionData.videos.forEach(t=>{const s=document.createElement("li");s.className="splide__slide";const r=document.createElement("jaaq-video-player");r.setAttribute("video-id",t.videoId),n&&r.setAttribute("api-key",n),i&&r.setAttribute("client-id",i),o&&r.setAttribute("base-url",o),r.setAttribute("autoplay","false"),r.setAttribute("width","100%"),a&&(void 0!==a.controls&&r.setAttribute("controls",String(a.controls)),void 0!==a.showLogo&&r.setAttribute("show-logo",String(a.showLogo)),void 0!==a.showTitle&&r.setAttribute("show-title",String(a.showTitle)),void 0!==a.showAuthor&&r.setAttribute("show-author",String(a.showAuthor)),void 0!==a.showDescription&&r.setAttribute("show-description",String(a.showDescription)),void 0!==a.showCaptions&&r.setAttribute("show-captions",String(a.showCaptions)),void 0!==a.startMuted&&r.setAttribute("start-muted",String(a.startMuted)),void 0!==a.width&&r.setAttribute("width",String(a.width)),void 0!==a.height&&r.setAttribute("height",String(a.height))),s.appendChild(r),e.appendChild(s)}),t.appendChild(e),this.carouselElement.appendChild(t),this.container.appendChild(this.carouselElement)}initSplide(){if(!this.carouselElement)return;const t=this.getBooleanAttr("show-arrows",!0),e=this.getBooleanAttr("show-dots",!0);this.splide=new un(this.carouselElement,{type:"loop",perPage:3,focus:"center",gap:"0.5rem",perMove:1,autoHeight:!0,updateOnMove:!0,padding:"5 rem",breakpoints:{768:{perPage:1},1024:{perPage:2}},arrows:t,pagination:e,autoplay:!1}),this.splide.on("moved",t=>{console.log("[CollectionPlayer] Splide moved event",{newIndex:t,splideIndex:this.splide?.index,Components:this.splide?.Components}),this.handleSlideChange(t),this.dispatchEvent(new CustomEvent("jaaq:collection:slidechange",{detail:{index:t,video:this.collectionData?.videos[t]},bubbles:!0,composed:!0}))}),this.splide.mount(),console.log("[CollectionPlayer] After mount",{splideIndex:this.splide.index,length:this.splide.length}),setTimeout(()=>{this.splide&&(console.log("[CollectionPlayer] Initial handleSlideChange after DOM update"),this.handleSlideChange(this.splide.index))},100)}handleSlideChange(t){if(!this.carouselElement)return;const e=this.hasAttribute("autoplay")&&"false"!==this.getAttribute("autoplay");console.log("[CollectionPlayer] handleSlideChange called",{activeIndex:t,isAutoplayEnabled:e}),null!==this.autoplayTimeoutId&&(console.log("[CollectionPlayer] Clearing existing autoplay timeout",{timeoutId:this.autoplayTimeoutId}),clearTimeout(this.autoplayTimeoutId),this.autoplayTimeoutId=null);const n=this.carouselElement.querySelector(".splide__slide.is-active:not(.splide__slide--clone)"),i=n?.querySelector("jaaq-video-player"),o=i?.getAttribute("video-id");console.log("[CollectionPlayer] Active slide from DOM:",{activeIndex:t,activeVideoId:o,foundActiveSlide:!!n});const s=this.carouselElement.querySelectorAll(".splide__slide:not(.splide__slide--clone)");Array.from(s).map((t,e)=>{const n=t.querySelector("jaaq-video-player");return{index:e,videoId:n?.getAttribute("video-id")||"unknown",isActive:t.classList.contains("is-active")}}),s.forEach((t,n)=>{const i=t.querySelector("jaaq-video-player");if(!i)return;const o=i.getAttribute("video-id");t.classList.contains("is-active")?e&&(this.autoplayTimeoutId=window.setTimeout(()=>{console.log("[CollectionPlayer] 1s delay complete, playing video",{index:n,videoId:o}),i.play?.()},1e3)):i.pause?.()})}destroyCarousel(){null!==this.autoplayTimeoutId&&(clearTimeout(this.autoplayTimeoutId),this.autoplayTimeoutId=null),this.splide&&(this.splide.destroy(),this.splide=null),this.container&&(this.container.innerHTML=""),this.collectionData=null}emitError(t){this.container&&(this.container.innerHTML=`\n <div class="jaaq-collection-error">\n ${t.message}\n </div>\n `),this.dispatchEvent(new CustomEvent("jaaq:collection:error",{detail:t,bubbles:!0,composed:!0}))}get client(){return this.clientInstance}set client(t){this.clientInstance=t,this.connected&&(this.destroyCarousel(),this.initCarousel())}get collectionId(){return this.getAttribute("collection-id")}set collectionId(t){t?this.setAttribute("collection-id",t):this.removeAttribute("collection-id")}refresh(){this.destroyCarousel(),this.initCarousel()}next(){this.splide?.go("+1")}prev(){this.splide?.go("-1")}go(t){this.splide?.go(t)}destroy(){this.destroyCarousel()}getCollection(){return this.collectionData}}const pn="jaaq-video-player",fn="jaaq-collection-player";function mn(){"undefined"!=typeof window&&"undefined"!=typeof customElements?(customElements.get(pn)||customElements.define(pn,c),customElements.get(fn)||customElements.define(fn,hn)):console.warn("Custom Elements API is not available. Web components cannot be registered.")}"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{mn()}):mn()),t.JaaqCollectionPlayerElement=hn,t.JaaqVideoPlayerElement=c,t.isRegistered=function(){return"undefined"!=typeof window&&"undefined"!=typeof customElements&&(!!customElements.get(pn)&&!!customElements.get(fn))},t.registerJaaqComponents=mn});
7
+ */var u="(prefers-reduced-motion: reduce)",h={CREATED:1,MOUNTED:2,IDLE:3,MOVING:4,SCROLLING:5,DRAGGING:6,DESTROYED:7};function p(t){t.length=0}function f(t,e,n){return Array.prototype.slice.call(t,e,n)}function m(t){return t.bind.apply(t,[null].concat(f(arguments,1)))}var g=setTimeout,v=function(){};function y(t){return requestAnimationFrame(t)}function b(t,e){return typeof e===t}function w(t){return!j(t)&&b("object",t)}var x=Array.isArray,_=m(b,"function"),E=m(b,"string"),C=m(b,"undefined");function j(t){return null===t}function q(t){try{return t instanceof(t.ownerDocument.defaultView||window).HTMLElement}catch(t){return!1}}function A(t){return x(t)?t:[t]}function k(t,e){A(t).forEach(e)}function S(t,e){return t.indexOf(e)>-1}function L(t,e){return t.push.apply(t,A(e)),t}function M(t,e,n){t&&k(e,function(e){e&&t.classList[n?"add":"remove"](e)})}function P(t,e){M(t,E(e)?e.split(" "):e,!0)}function I(t,e){k(e,t.appendChild.bind(t))}function T(t,e){k(t,function(t){var n=(e||t).parentNode;n&&n.insertBefore(t,e)})}function B(t,e){return q(t)&&(t.msMatchesSelector||t.matches).call(t,e)}function D(t,e){var n=t?f(t.children):[];return e?n.filter(function(t){return B(t,e)}):n}function z(t,e){return e?D(t,e)[0]:t.firstElementChild}var N=Object.keys;function F(t,e,n){return t&&(n?N(t).reverse():N(t)).forEach(function(n){"__proto__"!==n&&e(t[n],n)}),t}function V(t){return f(arguments,1).forEach(function(e){F(e,function(n,i){t[i]=e[i]})}),t}function H(t){return f(arguments,1).forEach(function(e){F(e,function(e,n){x(e)?t[n]=e.slice():w(e)?t[n]=H({},w(t[n])?t[n]:{},e):t[n]=e})}),t}function R(t,e){k(e||N(t),function(e){delete t[e]})}function O(t,e){k(t,function(t){k(e,function(e){t&&t.removeAttribute(e)})})}function U(t,e,n){w(e)?F(e,function(e,n){U(t,n,e)}):k(t,function(t){j(n)||""===n?O(t,e):t.setAttribute(e,String(n))})}function $(t,e,n){var i=document.createElement(t);return e&&(E(e)?P(i,e):U(i,e)),n&&I(n,i),i}function W(t,e,n){if(C(n))return getComputedStyle(t)[e];j(n)||(t.style[e]=""+n)}function X(t,e){W(t,"display",e)}function Z(t){t.setActive&&t.setActive()||t.focus({preventScroll:!0})}function G(t,e){return t.getAttribute(e)}function K(t,e){return t&&t.classList.contains(e)}function J(t){return t.getBoundingClientRect()}function Y(t){k(t,function(t){t&&t.parentNode&&t.parentNode.removeChild(t)})}function Q(t){return z((new DOMParser).parseFromString(t,"text/html").body)}function tt(t,e){t.preventDefault(),e&&(t.stopPropagation(),t.stopImmediatePropagation())}function et(t,e){return t&&t.querySelector(e)}function nt(t,e){return e?f(t.querySelectorAll(e)):[]}function it(t,e){M(t,e,!1)}function ot(t){return t.timeStamp}function st(t){return E(t)?t:t?t+"px":""}var at="splide",rt="data-"+at;function lt(t,e){if(!t)throw new Error("["+at+"] "+(e||""))}var ct=Math.min,dt=Math.max,ut=Math.floor,ht=Math.ceil,pt=Math.abs;function ft(t,e,n){return pt(t-e)<n}function mt(t,e,n,i){var o=ct(e,n),s=dt(e,n);return i?o<t&&t<s:o<=t&&t<=s}function gt(t,e,n){var i=ct(e,n),o=dt(e,n);return ct(dt(i,t),o)}function vt(t){return+(t>0)-+(t<0)}function yt(t,e){return k(e,function(e){t=t.replace("%s",""+e)}),t}function bt(t){return t<10?"0"+t:""+t}var wt={};function xt(){var t=[];function e(t,e,n){k(t,function(t){t&&k(e,function(e){e.split(" ").forEach(function(e){var i=e.split(".");n(t,i[0],i[1])})})})}return{bind:function(n,i,o,s){e(n,i,function(e,n,i){var a="addEventListener"in e,r=a?e.removeEventListener.bind(e,n,o,s):e.removeListener.bind(e,o);a?e.addEventListener(n,o,s):e.addListener(o),t.push([e,n,i,o,r])})},unbind:function(n,i,o){e(n,i,function(e,n,i){t=t.filter(function(t){return!!(t[0]!==e||t[1]!==n||t[2]!==i||o&&t[3]!==o)||(t[4](),!1)})})},dispatch:function(t,e,n){var i,o=!0;return"function"==typeof CustomEvent?i=new CustomEvent(e,{bubbles:o,detail:n}):(i=document.createEvent("CustomEvent")).initCustomEvent(e,o,!1,n),t.dispatchEvent(i),i},destroy:function(){t.forEach(function(t){t[4]()}),p(t)}}}var _t="mounted",Et="ready",Ct="move",jt="moved",qt="click",At="active",kt="inactive",St="visible",Lt="hidden",Mt="refresh",Pt="updated",It="resize",Tt="resized",Bt="scroll",Dt="scrolled",zt="destroy",Nt="arrows:mounted",Ft="navigation:mounted",Vt="autoplay:play",Ht="autoplay:pause",Rt="lazyload:loaded",Ot="sk",Ut="sh",$t="ei";function Wt(t){var e=t?t.event.bus:document.createDocumentFragment(),n=xt();return t&&t.event.on(zt,n.destroy),V(n,{bus:e,on:function(t,i){n.bind(e,A(t).join(" "),function(t){i.apply(i,x(t.detail)?t.detail:[])})},off:m(n.unbind,e),emit:function(t){n.dispatch(e,t,f(arguments,1))}})}function Xt(t,e,n,i){var o,s,a=Date.now,r=0,l=!0,c=0;function d(){if(!l){if(r=t?ct((a()-o)/t,1):1,n&&n(r),r>=1&&(e(),o=a(),i&&++c>=i))return u();s=y(d)}}function u(){l=!0}function h(){s&&cancelAnimationFrame(s),r=0,s=0,l=!0}return{start:function(e){e||h(),o=a()-(e?r*t:0),l=!1,s=y(d)},rewind:function(){o=a(),r=0,n&&n(r)},pause:u,cancel:h,set:function(e){t=e},isPaused:function(){return l}}}var Zt="Arrow",Gt=Zt+"Left",Kt=Zt+"Right",Jt=Zt+"Up",Yt=Zt+"Down",Qt="ttb",te={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[Jt,Kt],ArrowRight:[Yt,Gt]};var ee="role",ne="tabindex",ie="aria-",oe=ie+"controls",se=ie+"current",ae=ie+"selected",re=ie+"label",le=ie+"labelledby",ce=ie+"hidden",de=ie+"orientation",ue=ie+"roledescription",he=ie+"live",pe=ie+"busy",fe=ie+"atomic",me=[ee,ne,"disabled",oe,se,re,le,ce,de,ue],ge=at+"__",ve="is-",ye=at,be=ge+"track",we=ge+"list",xe=ge+"slide",_e=xe+"--clone",Ee=xe+"__container",Ce=ge+"arrows",je=ge+"arrow",qe=je+"--prev",Ae=je+"--next",ke=ge+"pagination",Se=ke+"__page",Le=ge+"progress"+"__bar",Me=ge+"toggle",Pe=ge+"sr",Ie=ve+"initialized",Te=ve+"active",Be=ve+"prev",De=ve+"next",ze=ve+"visible",Ne=ve+"loading",Fe=ve+"focus-in",Ve=ve+"overflow",He=[Te,ze,Be,De,Ne,Fe,Ve],Re={slide:xe,clone:_e,arrows:Ce,arrow:je,prev:qe,next:Ae,pagination:ke,page:Se,spinner:ge+"spinner"};var Oe="touchstart mousedown",Ue="touchmove mousemove",$e="touchend touchcancel mouseup click";var We="slide",Xe="loop",Ze="fade";function Ge(t,e,n,i){var o,s=Wt(t),a=s.on,r=s.emit,l=s.bind,c=t.Components,d=t.root,u=t.options,h=u.isNavigation,p=u.updateOnMove,f=u.i18n,g=u.pagination,v=u.slideFocus,y=c.Direction.resolve,b=G(i,"style"),w=G(i,re),x=n>-1,_=z(i,"."+Ee);function E(){var o=t.splides.map(function(t){var n=t.splide.Components.Slides.getAt(e);return n?n.slide.id:""}).join(" ");U(i,re,yt(f.slideX,(x?n:e)+1)),U(i,oe,o),U(i,ee,v?"button":""),v&&O(i,ue)}function C(){o||j()}function j(){if(!o){var n=t.index;(s=q())!==K(i,Te)&&(M(i,Te,s),U(i,se,h&&s||""),r(s?At:kt,A)),function(){var e=function(){if(t.is(Ze))return q();var e=J(c.Elements.track),n=J(i),o=y("left",!0),s=y("right",!0);return ut(e[o])<=ht(n[o])&&ut(n[s])<=ht(e[s])}(),n=!e&&(!q()||x);t.state.is([4,5])||U(i,ce,n||"");U(nt(i,u.focusableNodes||""),ne,n?-1:""),v&&U(i,ne,n?-1:0);e!==K(i,ze)&&(M(i,ze,e),r(e?St:Lt,A));if(!e&&document.activeElement===i){var o=c.Slides.getAt(t.index);o&&Z(o.slide)}}(),M(i,Be,e===n-1),M(i,De,e===n+1)}var s}function q(){var i=t.index;return i===e||u.cloneStatus&&i===n}var A={index:e,slideIndex:n,slide:i,container:_,isClone:x,mount:function(){x||(i.id=d.id+"-slide"+bt(e+1),U(i,ee,g?"tabpanel":"group"),U(i,ue,f.slide),U(i,re,w||yt(f.slideLabel,[e+1,t.length]))),l(i,"click",m(r,qt,A)),l(i,"keydown",m(r,Ot,A)),a([jt,Ut,Dt],j),a(Ft,E),p&&a(Ct,C)},destroy:function(){o=!0,s.destroy(),it(i,He),O(i,me),U(i,"style",b),U(i,re,w||"")},update:j,style:function(t,e,n){W(n&&_||i,t,e)},isWithin:function(n,i){var o=pt(n-e);return x||!u.rewind&&!t.is(Xe)||(o=ct(o,t.length-o)),o<=i}};return A}var Ke=rt+"-interval";var Je={passive:!1,capture:!0};var Ye={Spacebar:" ",Right:Kt,Left:Gt,Up:Jt,Down:Yt};function Qe(t){return t=E(t)?t:t.key,Ye[t]||t}var tn="keydown";var en=rt+"-lazy",nn=en+"-srcset",on="["+en+"], ["+nn+"]";var sn=[" ","Enter"];var an=Object.freeze({__proto__:null,Media:function(t,e,n){var i=t.state,o=n.breakpoints||{},s=n.reducedMotion||{},a=xt(),r=[];function l(t){t&&a.destroy()}function c(t,e){var n=matchMedia(e);a.bind(n,"change",d),r.push([t,n])}function d(){var e=i.is(7),o=n.direction,s=r.reduce(function(t,e){return H(t,e[1].matches?e[0]:{})},{});R(n),h(s),n.destroy?t.destroy("completely"===n.destroy):e?(l(!0),t.mount()):o!==n.direction&&t.refresh()}function h(e,o,s){H(n,e),o&&H(Object.getPrototypeOf(n),e),!s&&i.is(1)||t.emit(Pt,n)}return{setup:function(){var t="min"===n.mediaQuery;N(o).sort(function(e,n){return t?+e-+n:+n-+e}).forEach(function(e){c(o[e],"("+(t?"min":"max")+"-width:"+e+"px)")}),c(s,u),d()},destroy:l,reduce:function(t){matchMedia(u).matches&&(t?H(n,s):R(n,N(s)))},set:h}},Direction:function(t,e,n){return{resolve:function(t,e,i){var o="rtl"!==(i=i||n.direction)||e?i===Qt?0:-1:1;return te[t]&&te[t][o]||t.replace(/width|left|right/i,function(t,e){var n=te[t.toLowerCase()][o]||t;return e>0?n.charAt(0).toUpperCase()+n.slice(1):n})},orient:function(t){return t*("rtl"===n.direction?1:-1)}}},Elements:function(t,e,n){var i,o,s,a=Wt(t),r=a.on,l=a.bind,c=t.root,d=n.i18n,u={},h=[],f=[],m=[];function g(){i=b("."+be),o=z(i,"."+we),lt(i&&o,"A track/list element is missing."),L(h,D(o,"."+xe+":not(."+_e+")")),F({arrows:Ce,pagination:ke,prev:qe,next:Ae,bar:Le,toggle:Me},function(t,e){u[e]=b("."+t)}),V(u,{root:c,track:i,list:o,slides:h}),function(){var t=c.id||(s=at,""+s+bt(wt[s]=(wt[s]||0)+1)),e=n.role;var s;c.id=t,i.id=i.id||t+"-track",o.id=o.id||t+"-list",!G(c,ee)&&"SECTION"!==c.tagName&&e&&U(c,ee,e);U(c,ue,d.carousel),U(o,ee,"presentation")}(),y()}function v(t){var e=me.concat("style");p(h),it(c,f),it(i,m),O([i,o],e),O(c,t?e:["style",ue])}function y(){it(c,f),it(i,m),f=w(ye),m=w(be),P(c,f),P(i,m),U(c,re,n.label),U(c,le,n.labelledby)}function b(t){var e=et(c,t);return e&&function(t,e){if(_(t.closest))return t.closest(e);for(var n=t;n&&1===n.nodeType&&!B(n,e);)n=n.parentElement;return n}(e,"."+ye)===c?e:void 0}function w(t){return[t+"--"+n.type,t+"--"+n.direction,n.drag&&t+"--draggable",n.isNavigation&&t+"--nav",t===ye&&Te]}return V(u,{setup:g,mount:function(){r(Mt,v),r(Mt,g),r(Pt,y),l(document,Oe+" keydown",function(t){s="keydown"===t.type},{capture:!0}),l(c,"focusin",function(){M(c,Fe,!!s)})},destroy:v})},Slides:function(t,e,n){var i=Wt(t),o=i.on,s=i.emit,a=i.bind,r=e.Elements,l=r.slides,c=r.list,d=[];function u(){l.forEach(function(t,e){f(t,e,-1)})}function h(){v(function(t){t.destroy()}),p(d)}function f(e,n,i){var o=Ge(t,n,i,e);o.mount(),d.push(o),d.sort(function(t,e){return t.index-e.index})}function g(t){return t?y(function(t){return!t.isClone}):d}function v(t,e){g(e).forEach(t)}function y(t){return d.filter(_(t)?t:function(e){return E(t)?B(e.slide,t):S(A(t),e.index)})}return{mount:function(){u(),o(Mt,h),o(Mt,u)},destroy:h,update:function(){v(function(t){t.update()})},register:f,get:g,getIn:function(t){var i=e.Controller,o=i.toIndex(t),s=i.hasFocus()?1:n.perPage;return y(function(t){return mt(t.index,o,o+s-1)})},getAt:function(t){return y(t)[0]},add:function(t,e){k(t,function(t){if(E(t)&&(t=Q(t)),q(t)){var i=l[e];i?T(t,i):I(c,t),P(t,n.classes.slide),o=t,r=m(s,It),d=nt(o,"img"),(u=d.length)?d.forEach(function(t){a(t,"load error",function(){--u||r()})}):r()}var o,r,d,u}),s(Mt)},remove:function(t){Y(y(t).map(function(t){return t.slide})),s(Mt)},forEach:v,filter:y,style:function(t,e,n){v(function(i){i.style(t,e,n)})},getLength:function(t){return t?l.length:d.length},isEnough:function(){return d.length>n.perPage}}},Layout:function(t,e,n){var i,o,s,a=Wt(t),r=a.on,l=a.bind,c=a.emit,d=e.Slides,u=e.Direction.resolve,h=e.Elements,p=h.root,f=h.track,g=h.list,v=d.getAt,y=d.style;function b(){i=n.direction===Qt,W(p,"maxWidth",st(n.width)),W(f,u("paddingLeft"),_(!1)),W(f,u("paddingRight"),_(!0)),x(!0)}function x(t){var e=J(p);(t||o.width!==e.width||o.height!==e.height)&&(W(f,"height",function(){var t="";i&&(lt(t=E(),"height or heightRatio is missing."),t="calc("+t+" - "+_(!1)+" - "+_(!0)+")");return t}()),y(u("marginRight"),st(n.gap)),y("width",n.autoWidth?null:st(n.fixedWidth)||(i?"":C())),y("height",st(n.fixedHeight)||(i?n.autoHeight?null:C():E()),!0),o=e,c(Tt),s!==(s=L())&&(M(p,Ve,s),c("overflow",s)))}function _(t){var e=n.padding,i=u(t?"right":"left");return e&&st(e[i]||(w(e)?0:e))||"0px"}function E(){return st(n.height||J(g).width*n.heightRatio)}function C(){var t=st(n.gap);return"calc((100%"+(t&&" + "+t)+")/"+(n.perPage||1)+(t&&" - "+t)+")"}function j(){return J(g)[u("width")]}function q(t,e){var n=v(t||0);return n?J(n.slide)[u("width")]+(e?0:S()):0}function A(t,e){var n=v(t);if(n){var i=J(n.slide)[u("right")],o=J(g)[u("left")];return pt(i-o)+(e?0:S())}return 0}function k(e){return A(t.length-1)-A(0)+q(0,e)}function S(){var t=v(0);return t&&parseFloat(W(t.slide,u("marginRight")))||0}function L(){return t.is(Ze)||k(!0)>j()}return{mount:function(){var t,e;b(),l(window,"resize load",(t=m(c,It),e=Xt(0,t,null,1),function(){e.isPaused()&&e.start()})),r([Pt,Mt],b),r(It,x)},resize:x,listSize:j,slideSize:q,sliderSize:k,totalSize:A,getPadding:function(t){return parseFloat(W(f,u("padding"+(t?"Right":"Left"))))||0},isOverflow:L}},Clones:function(t,e,n){var i,o=Wt(t),s=o.on,a=e.Elements,r=e.Slides,l=e.Direction.resolve,c=[];function d(){s(Mt,u),s([Pt,It],f),(i=m())&&(!function(e){var i=r.get().slice(),o=i.length;if(o){for(;i.length<e;)L(i,i);L(i.slice(-e),i.slice(0,e)).forEach(function(s,l){var d=l<e,u=function(e,i){var o=e.cloneNode(!0);return P(o,n.classes.clone),o.id=t.root.id+"-clone"+bt(i+1),o}(s.slide,l);d?T(u,i[0].slide):I(a.list,u),L(c,u),r.register(u,l-e+(d?0:o),s.index)})}}(i),e.Layout.resize(!0))}function u(){h(),d()}function h(){Y(c),p(c),o.destroy()}function f(){var t=m();i!==t&&(i<t||!t)&&o.emit(Mt)}function m(){var i=n.clones;if(t.is(Xe)){if(C(i)){var o=n[l("fixedWidth")]&&e.Layout.slideSize(0);i=o&&ht(J(a.track)[l("width")]/o)||n[l("autoWidth")]&&t.length||2*n.perPage}}else i=0;return i}return{mount:d,destroy:h}},Move:function(t,e,n){var i,o=Wt(t),s=o.on,a=o.emit,r=t.state.set,l=e.Layout,c=l.slideSize,d=l.getPadding,u=l.totalSize,h=l.listSize,p=l.sliderSize,f=e.Direction,m=f.resolve,g=f.orient,v=e.Elements,y=v.list,b=v.track;function w(){e.Controller.isBusy()||(e.Scroll.cancel(),x(t.index),e.Slides.update())}function x(t){_(A(t,!0))}function _(n,i){if(!t.is(Ze)){var o=i?n:function(n){if(t.is(Xe)){var i=q(n),o=i>e.Controller.getEnd();(i<0||o)&&(n=E(n,o))}return n}(n);W(y,"transform","translate"+m("X")+"("+o+"px)"),n!==o&&a(Ut)}}function E(t,e){var n=t-S(e),i=p();return t-=g(i*(ht(pt(n)/i)||1))*(e?1:-1)}function j(){_(k(),!0),i.cancel()}function q(t){for(var n=e.Slides.get(),i=0,o=1/0,s=0;s<n.length;s++){var a=n[s].index,r=pt(A(a,!0)-t);if(!(r<=o))break;o=r,i=a}return i}function A(e,i){var o=g(u(e-1)-function(t){var e=n.focus;return"center"===e?(h()-c(t,!0))/2:+e*c(t)||0}(e));return i?function(e){n.trimSpace&&t.is(We)&&(e=gt(e,0,g(p(!0)-h())));return e}(o):o}function k(){var t=m("left");return J(y)[t]-J(b)[t]+g(d(!1))}function S(t){return A(t?e.Controller.getEnd():0,!!n.trimSpace)}return{mount:function(){i=e.Transition,s([_t,Tt,Pt,Mt],w)},move:function(t,e,n,o){var s,l;t!==e&&(s=t>n,l=g(E(k(),s)),s?l>=0:l<=y[m("scrollWidth")]-J(b)[m("width")])&&(j(),_(E(k(),t>n),!0)),r(4),a(Ct,e,n,t),i.start(e,function(){r(3),a(jt,e,n,t),o&&o()})},jump:x,translate:_,shift:E,cancel:j,toIndex:q,toPosition:A,getPosition:k,getLimit:S,exceededLimit:function(t,e){e=C(e)?k():e;var n=!0!==t&&g(e)<g(S(!1)),i=!1!==t&&g(e)>g(S(!0));return n||i},reposition:w}},Controller:function(t,e,n){var i,o,s,a,r=Wt(t),l=r.on,c=r.emit,d=e.Move,u=d.getPosition,h=d.getLimit,p=d.toPosition,f=e.Slides,g=f.isEnough,v=f.getLength,y=n.omitEnd,b=t.is(Xe),w=t.is(We),x=m(S,!1),_=m(S,!0),j=n.start||0,q=j;function A(){o=v(!0),s=n.perMove,a=n.perPage,i=P();var t=gt(j,0,y?i:o-1);t!==j&&(j=t,d.reposition())}function k(){i!==P()&&c($t)}function S(t,e){var n=s||(D()?1:a),o=L(j+n*(t?-1:1),j,!(s||D()));return-1===o&&w&&!ft(u(),h(!t),1)?t?0:i:e?o:M(o)}function L(e,r,l){if(g()||D()){var c=function(e){if(w&&"move"===n.trimSpace&&e!==j)for(var i=u();i===p(e,!0)&&mt(e,0,t.length-1,!n.rewind);)e<j?--e:++e;return e}(e);c!==e&&(r=e,e=c,l=!1),e<0||e>i?e=s||!mt(0,e,r,!0)&&!mt(i,r,e,!0)?b?l?e<0?-(o%a||a):o:e:n.rewind?e<0?i:0:-1:I(T(e)):l&&e!==r&&(e=I(T(r)+(e<r?-1:1)))}else e=-1;return e}function M(t){return b?(t+o)%o||0:t}function P(){for(var t=o-(D()||b&&s?1:a);y&&t-- >0;)if(p(o-1,!0)!==p(t,!0)){t++;break}return gt(t,0,o-1)}function I(t){return gt(D()?t:a*t,0,i)}function T(t){return D()?ct(t,i):ut((t>=i?o-1:t)/a)}function B(t){t!==j&&(q=j,j=t)}function D(){return!C(n.focus)||n.isNavigation}function z(){return t.state.is([4,5])&&!!n.waitForTransition}return{mount:function(){A(),l([Pt,Mt,$t],A),l(Tt,k)},go:function(t,e,n){if(!z()){var o=function(t){var e=j;if(E(t)){var n=t.match(/([+\-<>])(\d+)?/)||[],o=n[1],s=n[2];"+"===o||"-"===o?e=L(j+ +(""+o+(+s||1)),j):">"===o?e=s?I(+s):x(!0):"<"===o&&(e=_(!0))}else e=b?t:gt(t,0,i);return e}(t),s=M(o);s>-1&&(e||s!==j)&&(B(s),d.move(o,s,q,n))}},scroll:function(t,n,o,s){e.Scroll.scroll(t,n,o,function(){var t=M(d.toIndex(u()));B(y?ct(t,i):t),s&&s()})},getNext:x,getPrev:_,getAdjacent:S,getEnd:P,setIndex:B,getIndex:function(t){return t?q:j},toIndex:I,toPage:T,toDest:function(t){var e=d.toIndex(t);return w?gt(e,0,i):e},hasFocus:D,isBusy:z}},Arrows:function(t,e,n){var i,o,s=Wt(t),a=s.on,r=s.bind,l=s.emit,c=n.classes,d=n.i18n,u=e.Elements,h=e.Controller,p=u.arrows,f=u.track,g=p,v=u.prev,y=u.next,b={};function w(){!function(){var t=n.arrows;!t||v&&y||(g=p||$("div",c.arrows),v=C(!0),y=C(!1),i=!0,I(g,[v,y]),!p&&T(g,f));v&&y&&(V(b,{prev:v,next:y}),X(g,t?"":"none"),P(g,o=Ce+"--"+n.direction),t&&(a([_t,jt,Mt,Dt,$t],j),r(y,"click",m(E,">")),r(v,"click",m(E,"<")),j(),U([v,y],oe,f.id),l(Nt,v,y)))}(),a(Pt,x)}function x(){_(),w()}function _(){s.destroy(),it(g,o),i?(Y(p?[v,y]:g),v=y=null):O([v,y],me)}function E(t){h.go(t,!0)}function C(t){return Q('<button class="'+c.arrow+" "+(t?c.prev:c.next)+'" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40" focusable="false"><path d="'+(n.arrowPath||"m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z")+'" />')}function j(){if(v&&y){var e=t.index,n=h.getPrev(),i=h.getNext(),o=n>-1&&e<n?d.last:d.prev,s=i>-1&&e>i?d.first:d.next;v.disabled=n<0,y.disabled=i<0,U(v,re,o),U(y,re,s),l("arrows:updated",v,y,n,i)}}return{arrows:b,mount:w,destroy:_,update:j}},Autoplay:function(t,e,n){var i,o,s=Wt(t),a=s.on,r=s.bind,l=s.emit,c=Xt(n.interval,t.go.bind(t,">"),function(t){var e=u.bar;e&&W(e,"width",100*t+"%"),l("autoplay:playing",t)}),d=c.isPaused,u=e.Elements,h=e.Elements,p=h.root,f=h.toggle,m=n.autoplay,g="pause"===m;function v(){d()&&e.Slides.isEnough()&&(c.start(!n.resetProgress),o=i=g=!1,w(),l(Vt))}function y(t){void 0===t&&(t=!0),g=!!t,w(),d()||(c.pause(),l(Ht))}function b(){g||(i||o?y(!1):v())}function w(){f&&(M(f,Te,!g),U(f,re,n.i18n[g?"play":"pause"]))}function x(t){var i=e.Slides.getAt(t);c.set(i&&+G(i.slide,Ke)||n.interval)}return{mount:function(){m&&(!function(){n.pauseOnHover&&r(p,"mouseenter mouseleave",function(t){i="mouseenter"===t.type,b()});n.pauseOnFocus&&r(p,"focusin focusout",function(t){o="focusin"===t.type,b()});f&&r(f,"click",function(){g?v():y(!0)});a([Ct,Bt,Mt],c.rewind),a(Ct,x)}(),f&&U(f,oe,u.track.id),g||v(),w())},destroy:c.cancel,play:v,pause:y,isPaused:d}},Cover:function(t,e,n){var i=Wt(t).on;function o(t){e.Slides.forEach(function(e){var n=z(e.container||e.slide,"img");n&&n.src&&s(t,n,e)})}function s(t,e,n){n.style("background",t?'center/cover no-repeat url("'+e.src+'")':"",!0),X(e,t?"none":"")}return{mount:function(){n.cover&&(i(Rt,m(s,!0)),i([_t,Pt,Mt],m(o,!0)))},destroy:m(o,!1)}},Scroll:function(t,e,n){var i,o,s=Wt(t),a=s.on,r=s.emit,l=t.state.set,c=e.Move,d=c.getPosition,u=c.getLimit,h=c.exceededLimit,p=c.translate,f=t.is(We),g=1;function v(t,n,s,a,u){var p=d();if(w(),s&&(!f||!h())){var v=e.Layout.sliderSize(),x=vt(t)*v*ut(pt(t)/v)||0;t=c.toPosition(e.Controller.toDest(t%v))+x}var _=ft(p,t,1);g=1,n=_?0:n||dt(pt(t-p)/1.5,800),o=a,i=Xt(n,y,m(b,p,t,u),1),l(5),r(Bt),i.start()}function y(){l(3),o&&o(),r(Dt)}function b(t,e,i,s){var a,r,l=d(),c=(t+(e-t)*(a=s,(r=n.easingFunc)?r(a):1-Math.pow(1-a,4))-l)*g;p(l+c),f&&!i&&h()&&(g*=.6,pt(c)<10&&v(u(h(!0)),600,!1,o,!0))}function w(){i&&i.cancel()}function x(){i&&!i.isPaused()&&(w(),y())}return{mount:function(){a(Ct,w),a([Pt,Mt],x)},destroy:w,scroll:v,cancel:x}},Drag:function(t,e,n){var i,o,s,a,r,l,c,d,u=Wt(t),h=u.on,p=u.emit,f=u.bind,m=u.unbind,g=t.state,y=e.Move,b=e.Scroll,x=e.Controller,_=e.Elements.track,E=e.Media.reduce,C=e.Direction,j=C.resolve,q=C.orient,A=y.getPosition,k=y.exceededLimit,S=!1;function L(){var t=n.drag;R(!t),a="free"===t}function M(t){if(l=!1,!c){var e=H(t);i=t.target,o=n.noDrag,B(i,"."+Se+", ."+je)||o&&B(i,o)||!e&&t.button||(x.isBusy()?tt(t,!0):(d=e?_:window,r=g.is([4,5]),s=null,f(d,Ue,P,Je),f(d,$e,I,Je),y.cancel(),b.cancel(),D(t)))}var i,o}function P(e){if(g.is(6)||(g.set(6),p("drag")),e.cancelable)if(r){y.translate(i+z(e)/(S&&t.is(We)?5:1));var o=N(e)>200,s=S!==(S=k());(o||s)&&D(e),l=!0,p("dragging"),tt(e)}else(function(t){return pt(z(t))>pt(z(t,!0))})(e)&&(r=function(t){var e=n.dragMinThreshold,i=w(e),o=i&&e.mouse||0,s=(i?e.touch:+e)||10;return pt(z(t))>(H(t)?s:o)}(e),tt(e))}function I(i){g.is(6)&&(g.set(3),p("dragged")),r&&(!function(i){var o=function(e){if(t.is(Xe)||!S){var n=N(e);if(n&&n<200)return z(e)/n}return 0}(i),s=function(t){return A()+vt(t)*ct(pt(t)*(n.flickPower||600),a?1/0:e.Layout.listSize()*(n.flickMaxPages||1))}(o),r=n.rewind&&n.rewindByDrag;E(!1),a?x.scroll(s,0,n.snap):t.is(Ze)?x.go(q(vt(o))<0?r?"<":"-":r?">":"+"):t.is(We)&&S&&r?x.go(k(!0)?">":"<"):x.go(x.toDest(s),!0);E(!0)}(i),tt(i)),m(d,Ue,P),m(d,$e,I),r=!1}function T(t){!c&&l&&tt(t,!0)}function D(t){s=o,o=t,i=A()}function z(t,e){return V(t,e)-V(F(t),e)}function N(t){return ot(t)-ot(F(t))}function F(t){return o===t&&s||o}function V(t,e){return(H(t)?t.changedTouches[0]:t)["page"+j(e?"Y":"X")]}function H(t){return"undefined"!=typeof TouchEvent&&t instanceof TouchEvent}function R(t){c=t}return{mount:function(){f(_,Ue,v,Je),f(_,$e,v,Je),f(_,Oe,M,Je),f(_,"click",T,{capture:!0}),f(_,"dragstart",tt),h([_t,Pt],L)},disable:R,isDragging:function(){return r}}},Keyboard:function(t,e,n){var i,o,s=Wt(t),a=s.on,r=s.bind,l=s.unbind,c=t.root,d=e.Direction.resolve;function u(){var t=n.keyboard;t&&(i="global"===t?window:c,r(i,tn,f))}function h(){l(i,tn)}function p(){var t=o;o=!0,g(function(){o=t})}function f(e){if(!o){var n=Qe(e);n===d(Gt)?t.go("<"):n===d(Kt)&&t.go(">")}}return{mount:function(){u(),a(Pt,h),a(Pt,u),a(Ct,p)},destroy:h,disable:function(t){o=t}}},LazyLoad:function(t,e,n){var i=Wt(t),o=i.on,s=i.off,a=i.bind,r=i.emit,l="sequential"===n.lazyLoad,c=[jt,Dt],d=[];function u(){p(d),e.Slides.forEach(function(t){nt(t.slide,on).forEach(function(e){var i=G(e,en),o=G(e,nn);if(i!==e.src||o!==e.srcset){var s=n.classes.spinner,a=e.parentElement,r=z(a,"."+s)||$("span",s,a);d.push([e,t,r]),e.src||X(e,"none")}})}),l?v():(s(c),o(c,h),h())}function h(){(d=d.filter(function(e){var i=n.perPage*((n.preloadPages||1)+1)-1;return!e[1].isWithin(t.index,i)||f(e)})).length||s(c)}function f(t){var e=t[0];P(t[1].slide,Ne),a(e,"load error",m(g,t)),U(e,"src",G(e,en)),U(e,"srcset",G(e,nn)),O(e,en),O(e,nn)}function g(t,e){var n=t[0],i=t[1];it(i.slide,Ne),"error"!==e.type&&(Y(t[2]),X(n,""),r(Rt,n,i),r(It)),l&&v()}function v(){d.length&&f(d.shift())}return{mount:function(){n.lazyLoad&&(u(),o(Mt,u))},destroy:m(p,d),check:h}},Pagination:function(t,e,n){var i,o,s=Wt(t),a=s.on,r=s.emit,l=s.bind,c=e.Slides,d=e.Elements,u=e.Controller,h=u.hasFocus,g=u.getIndex,v=u.go,y=e.Direction.resolve,b=d.pagination,w=[];function x(){i&&(Y(b?f(i.children):i),it(i,o),p(w),i=null),s.destroy()}function _(t){v(">"+t,!0)}function E(t,e){var n=w.length,i=Qe(e),o=C(),s=-1;i===y(Kt,!1,o)?s=++t%n:i===y(Gt,!1,o)?s=(--t+n)%n:"Home"===i?s=0:"End"===i&&(s=n-1);var a=w[s];a&&(Z(a.button),v(">"+s),tt(e,!0))}function C(){return n.paginationDirection||n.direction}function j(t){return w[u.toPage(t)]}function q(){var t=j(g(!0)),e=j(g());if(t){var n=t.button;it(n,Te),O(n,ae),U(n,ne,-1)}if(e){var o=e.button;P(o,Te),U(o,ae,!0),U(o,ne,"")}r("pagination:updated",{list:i,items:w},t,e)}return{items:w,mount:function e(){x(),a([Pt,Mt,$t],e);var s=n.pagination;b&&X(b,s?"":"none"),s&&(a([Ct,Bt,Dt],q),function(){var e=t.length,s=n.classes,a=n.i18n,r=n.perPage,p=h()?u.getEnd()+1:ht(e/r);P(i=b||$("ul",s.pagination,d.track.parentElement),o=ke+"--"+C()),U(i,ee,"tablist"),U(i,re,a.select),U(i,de,C()===Qt?"vertical":"");for(var f=0;f<p;f++){var g=$("li",null,i),v=$("button",{class:s.page,type:"button"},g),y=c.getIn(f).map(function(t){return t.slide.id}),x=!h()&&r>1?a.pageX:a.slideX;l(v,"click",m(_,f)),n.paginationKeyboard&&l(v,"keydown",m(E,f)),U(g,ee,"presentation"),U(v,ee,"tab"),U(v,oe,y.join(" ")),U(v,re,yt(x,f+1)),U(v,ne,-1),w.push({li:g,button:v,page:f})}}(),q(),r("pagination:mounted",{list:i,items:w},j(t.index)))},destroy:x,getAt:j,update:q}},Sync:function(t,e,n){var i=n.isNavigation,o=n.slideFocus,s=[];function a(){var e,n;t.splides.forEach(function(e){e.isParent||(l(t,e.splide),l(e.splide,t))}),i&&(e=Wt(t),(n=e.on)(qt,d),n(Ot,u),n([_t,Pt],c),s.push(e),e.emit(Ft,t.splides))}function r(){s.forEach(function(t){t.destroy()}),p(s)}function l(t,e){var n=Wt(t);n.on(Ct,function(t,n,i){e.go(e.is(Xe)?i:t)}),s.push(n)}function c(){U(e.Elements.list,de,n.direction===Qt?"vertical":"")}function d(e){t.go(e.index)}function u(t,e){S(sn,Qe(e))&&(d(t),tt(e))}return{setup:m(e.Media.set,{slideFocus:C(o)?i:o},!0),mount:a,destroy:r,remount:function(){r(),a()}}},Wheel:function(t,e,n){var i=Wt(t).bind,o=0;function s(i){if(i.cancelable){var s=i.deltaY,a=s<0,r=ot(i),l=n.wheelMinThreshold||0,c=n.wheelSleep||0;pt(s)>l&&r-o>c&&(t.go(a?"<":">"),o=r),function(i){return!n.releaseWheel||t.state.is(4)||-1!==e.Controller.getAdjacent(i)}(a)&&tt(i)}}return{mount:function(){n.wheel&&i(e.Elements.track,"wheel",s,Je)}}},Live:function(t,e,n){var i=Wt(t).on,o=e.Elements.track,s=n.live&&!n.isNavigation,a=$("span",Pe),r=Xt(90,m(l,!1));function l(t){U(o,pe,t),t?(I(o,a),r.start()):(Y(a),r.cancel())}function c(t){s&&U(o,he,t?"off":"polite")}return{mount:function(){s&&(c(!e.Autoplay.isPaused()),U(o,fe,!0),a.textContent="…",i(Vt,m(c,!0)),i(Ht,m(c,!1)),i([jt,Dt],m(l,!0)))},disable:c,destroy:function(){O(o,[he,fe,pe]),Y(a)}}}}),rn={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:Re,i18n:{prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select a slide to show",slideLabel:"%s of %s"},reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}};function ln(t,e,n){var i=e.Slides;function o(){i.forEach(function(t){t.style("transform","translateX(-"+100*t.index+"%)")})}return{mount:function(){Wt(t).on([_t,Mt],o)},start:function(t,e){i.style("transition","opacity "+n.speed+"ms "+n.easing),g(e)},cancel:v}}function cn(t,e,n){var i,o=e.Move,s=e.Controller,a=e.Scroll,r=e.Elements.list,l=m(W,r,"transition");function c(){l(""),a.cancel()}return{mount:function(){Wt(t).bind(r,"transitionend",function(t){t.target===r&&i&&(c(),i())})},start:function(e,r){var c=o.toPosition(e,!0),d=o.getPosition(),u=function(e){var i=n.rewindSpeed;if(t.is(We)&&i){var o=s.getIndex(!0),a=s.getEnd();if(0===o&&e>=a||o>=a&&0===e)return i}return n.speed}(e);pt(c-d)>=1&&u>=1?n.useScroll?a.scroll(c,u,!1,r):(l("transform "+u+"ms "+n.easing),o.translate(c,!0),i=r):(o.jump(e),r())},cancel:c}}var dn=function(){function t(e,n){var i;this.event=Wt(),this.Components={},this.state=(i=1,{set:function(t){i=t},is:function(t){return S(A(t),i)}}),this.splides=[],this._o={},this._E={};var o=E(e)?et(document,e):e;lt(o,o+" is invalid."),this.root=o,n=H({label:G(o,re)||"",labelledby:G(o,le)||""},rn,t.defaults,n||{});try{H(n,JSON.parse(G(o,rt)))}catch(t){lt(!1,"Invalid JSON")}this._o=Object.create(H({},n))}var e=t.prototype;return e.mount=function(t,e){var n=this,i=this.state,o=this.Components;return lt(i.is([1,7]),"Already mounted!"),i.set(1),this._C=o,this._T=e||this._T||(this.is(Ze)?ln:cn),this._E=t||this._E,F(V({},an,this._E,{Transition:this._T}),function(t,e){var i=t(n,o,n._o);o[e]=i,i.setup&&i.setup()}),F(o,function(t){t.mount&&t.mount()}),this.emit(_t),P(this.root,Ie),i.set(3),this.emit(Et),this},e.sync=function(t){return this.splides.push({splide:t}),t.splides.push({splide:this,isParent:!0}),this.state.is(3)&&(this._C.Sync.remount(),t.Components.Sync.remount()),this},e.go=function(t){return this._C.Controller.go(t),this},e.on=function(t,e){return this.event.on(t,e),this},e.off=function(t){return this.event.off(t),this},e.emit=function(t){var e;return(e=this.event).emit.apply(e,[t].concat(f(arguments,1))),this},e.add=function(t,e){return this._C.Slides.add(t,e),this},e.remove=function(t){return this._C.Slides.remove(t),this},e.is=function(t){return this._o.type===t},e.refresh=function(){return this.emit(Mt),this},e.destroy=function(t){void 0===t&&(t=!0);var e=this.event,n=this.state;return n.is(1)?Wt(this).on(Et,this.destroy.bind(this,t)):(F(this._C,function(e){e.destroy&&e.destroy(t)},!0),e.emit(zt),e.destroy(),t&&p(this.splides),n.set(7)),this},d(t,[{key:"options",get:function(){return this._o},set:function(t){this._C.Media.set(t,!0,!0)}},{key:"length",get:function(){return this._C.Slides.getLength(!0)}},{key:"index",get:function(){return this._C.Controller.getIndex()}}]),t}(),un=dn;un.defaults={},un.STATES=h;class hn extends HTMLElement{static get observedAttributes(){return["collection-id","api-key","client-id","subscription-id","base-url","autoplay","show-arrows","show-dots","video-settings"]}constructor(){super(),this.splide=null,this.container=null,this.carouselElement=null,this.clientInstance=null,this.connected=!1,this.collectionData=null,this.autoplayTimeoutId=null,this.attachShadow({mode:"open"})}connectedCallback(){this.connected=!0,this.render(),this.initCarousel()}disconnectedCallback(){this.connected=!1,this.destroyCarousel()}attributeChangedCallback(t,e,n){this.connected&&e!==n&&("collection-id"!==t&&"video-settings"!==t||(this.destroyCarousel(),this.initCarousel()),"show-arrows"!==t&&"show-dots"!==t||(this.destroyCarousel(),this.initCarousel()))}getBooleanAttr(t,e){const n=this.getAttribute(t);return null===n?e:"false"!==n}getVideosFromCollection(t){if(t.videos&&t.videos.length>0)return t.videos;if(t.videoGroups&&t.videoGroups.length>0){const e=[];return t.videoGroups.forEach(t=>{t.videos&&t.videos.length>0&&e.push(...t.videos)}),e}return[]}render(){if(!this.shadowRoot)return;const t=document.createElement("style");t.textContent=`\n ${r}\n .jaaq-collection-player {\n width: 100%;\n max-width: 1400px;\n margin: 0 auto;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n}\n\n.jaaq-collection-loading {\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 400px;\n}\n\n.jaaq-collection-spinner {\n width: 50px;\n height: 50px;\n border: 4px solid rgba(0, 123, 255, 0.3);\n border-top-color: #007bff;\n border-radius: 50%;\n animation: jaaq-collection-spin 1s linear infinite;\n}\n\n@keyframes jaaq-collection-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.jaaq-collection-error {\n background: rgba(220, 53, 69, 0.9);\n color: white;\n padding: 16px 24px;\n border-radius: 8px;\n text-align: center;\n font-size: 14px;\n margin: 20px;\n}\n\n.jaaq-collection-carousel .splide__track {\n padding: 40px 0;\n}\n\n.jaaq-collection-carousel .splide__slide {\n opacity: 0.7;\n transition: all 0.3s ease;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.jaaq-collection-carousel .splide__slide.is-active {\n opacity: 1;\n}\n\n.jaaq-collection-carousel .splide__slide jaaq-video-player {\n width: 100%;\n max-width: 600px;\n transition: all 0.3s ease;\n}\n\n.jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 800px;\n}\n\n.jaaq-collection-carousel .splide__arrow {\n background: rgba(0, 0, 0, 0.5);\n border: none;\n width: 48px;\n height: 48px;\n border-radius: 50%;\n color: white;\n cursor: pointer;\n transition: all 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 20px;\n}\n\n.jaaq-collection-carousel .splide__arrow:hover {\n background: rgba(0, 0, 0, 0.8);\n transform: scale(1.1);\n}\n\n.jaaq-collection-carousel .splide__arrow:disabled {\n opacity: 0.3;\n cursor: not-allowed;\n}\n\n.jaaq-collection-carousel .splide__arrow svg {\n fill: white;\n width: 20px;\n height: 20px;\n}\n\n.jaaq-collection-carousel .splide__pagination {\n bottom: -30px;\n}\n\n.jaaq-collection-carousel .splide__pagination__page {\n background: #ccc;\n border: none;\n width: 10px;\n height: 10px;\n margin: 0 4px;\n border-radius: 50%;\n transition: all 0.2s;\n cursor: pointer;\n}\n\n.jaaq-collection-carousel .splide__pagination__page.is-active {\n background: white;\n transform: scale(1.3);\n}\n\n@media (max-width: 1024px) {\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 500px;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 650px;\n }\n}\n\n@media (max-width: 768px) {\n .jaaq-collection-carousel .splide__track {\n padding: 20px 0;\n }\n\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 400px;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 500px;\n }\n\n .jaaq-collection-carousel .splide__arrow {\n width: 40px;\n height: 40px;\n }\n}\n\n@media (max-width: 480px) {\n .jaaq-collection-carousel .splide__slide jaaq-video-player {\n max-width: 100%;\n }\n\n .jaaq-collection-carousel .splide__slide.is-active jaaq-video-player {\n max-width: 100%;\n }\n}\n\n .splide__container{box-sizing:border-box;position:relative}.splide__list{backface-visibility:hidden;display:-ms-flexbox;display:flex;height:100%;margin:0!important;padding:0!important}.splide.is-initialized:not(.is-active) .splide__list{display:block}.splide__pagination{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:center;justify-content:center;margin:0;pointer-events:none}.splide__pagination li{display:inline-block;line-height:1;list-style-type:none;margin:0;pointer-events:auto}.splide:not(.is-overflow) .splide__pagination{display:none}.splide__progress__bar{width:0}.splide{position:relative;visibility:hidden}.splide.is-initialized,.splide.is-rendered{visibility:visible}.splide__slide{backface-visibility:hidden;box-sizing:border-box;-ms-flex-negative:0;flex-shrink:0;list-style-type:none!important;margin:0;position:relative}.splide__slide img{vertical-align:bottom}.splide__spinner{animation:splide-loading 1s linear infinite;border:2px solid #999;border-left-color:transparent;border-radius:50%;bottom:0;contain:strict;display:inline-block;height:20px;left:0;margin:auto;position:absolute;right:0;top:0;width:20px}.splide__sr{clip:rect(0 0 0 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.splide__toggle.is-active .splide__toggle__play,.splide__toggle__pause{display:none}.splide__toggle.is-active .splide__toggle__pause{display:inline}.splide__track{overflow:hidden;position:relative;z-index:0}@keyframes splide-loading{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.splide__track--draggable{-webkit-touch-callout:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.splide__track--fade>.splide__list>.splide__slide{margin:0!important;opacity:0;z-index:0}.splide__track--fade>.splide__list>.splide__slide.is-active{opacity:1;z-index:1}.splide--rtl{direction:rtl}.splide__track--ttb>.splide__list{display:block}.splide__arrow{-ms-flex-align:center;align-items:center;background:#ccc;border:0;border-radius:50%;cursor:pointer;display:-ms-flexbox;display:flex;height:2em;-ms-flex-pack:center;justify-content:center;opacity:.7;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:2em;z-index:1}.splide__arrow svg{fill:#000;height:1.2em;width:1.2em}.splide__arrow:hover:not(:disabled){opacity:.9}.splide__arrow:disabled{opacity:.3}.splide__arrow:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide__arrow--prev{left:1em}.splide__arrow--prev svg{transform:scaleX(-1)}.splide__arrow--next{right:1em}.splide.is-focus-in .splide__arrow:focus{outline:3px solid #0bf;outline-offset:3px}.splide__pagination{bottom:.5em;left:0;padding:0 1em;position:absolute;right:0;z-index:1}.splide__pagination__page{background:#ccc;border:0;border-radius:50%;display:inline-block;height:8px;margin:3px;opacity:.7;padding:0;position:relative;transition:transform .2s linear;width:8px}.splide__pagination__page.is-active{background:#fff;transform:scale(1.4);z-index:1}.splide__pagination__page:hover{cursor:pointer;opacity:.9}.splide__pagination__page:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__pagination__page:focus{outline:3px solid #0bf;outline-offset:3px}.splide__progress__bar{background:#ccc;height:3px}.splide__slide{-webkit-tap-highlight-color:rgba(0,0,0,0)}.splide__slide:focus{outline:0}@supports(outline-offset:-3px){.splide__slide:focus-visible{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide__slide:focus-visible{border:3px solid #0bf}}@supports(outline-offset:-3px){.splide.is-focus-in .splide__slide:focus{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide.is-focus-in .splide__slide:focus{border:3px solid #0bf}.splide.is-focus-in .splide__track>.splide__list>.splide__slide:focus{border-color:#0bf}}.splide__toggle{cursor:pointer}.splide__toggle:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__toggle:focus{outline:3px solid #0bf;outline-offset:3px}.splide__track--nav>.splide__list>.splide__slide{border:3px solid transparent;cursor:pointer}.splide__track--nav>.splide__list>.splide__slide.is-active{border:3px solid #000}.splide__arrows--rtl .splide__arrow--prev{left:auto;right:1em}.splide__arrows--rtl .splide__arrow--prev svg{transform:scaleX(1)}.splide__arrows--rtl .splide__arrow--next{left:1em;right:auto}.splide__arrows--rtl .splide__arrow--next svg{transform:scaleX(-1)}.splide__arrows--ttb .splide__arrow{left:50%;transform:translate(-50%)}.splide__arrows--ttb .splide__arrow--prev{top:1em}.splide__arrows--ttb .splide__arrow--prev svg{transform:rotate(-90deg)}.splide__arrows--ttb .splide__arrow--next{bottom:1em;top:auto}.splide__arrows--ttb .splide__arrow--next svg{transform:rotate(90deg)}.splide__pagination--ttb{bottom:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;left:auto;padding:1em 0;right:.5em;top:0}\n \n:host {\n display: block;\n width: 100%;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n `,this.container=document.createElement("div"),this.container.className="jaaq-collection-player",this.shadowRoot.appendChild(t),this.shadowRoot.appendChild(this.container)}async initCarousel(){if(!this.container)return;const t=this.getAttribute("collection-id");if(!t)return void this.emitError(new Error("collection-id attribute is required"));const e=this.getAttribute("api-key"),n=this.getAttribute("client-id"),s=this.getAttribute("base-url")||void 0,a=this.getAttribute("api-version")||void 0;if(this.clientInstance||e||n){this.showLoading();try{const r=this.clientInstance||o.init({apiKey:e,clientId:n,baseUrl:s||i,apiVersion:a});this.collectionData=await r.collections.getById(t);if(0===this.getVideosFromCollection(this.collectionData).length)return void this.emitError(new Error("No videos found in collection"));this.renderCarousel(),this.initSplide(),this.dispatchEvent(new CustomEvent("jaaq:collection:loaded",{detail:this.collectionData,bubbles:!0,composed:!0}))}catch(t){this.emitError(t instanceof Error?t:new Error("Failed to load collection"))}}else this.emitError(new Error("Either client property or api-key and client-id attributes are required"))}showLoading(){this.container&&(this.container.innerHTML='\n <div class="jaaq-collection-loading">\n <div class="jaaq-collection-spinner"></div>\n </div>\n ')}renderCarousel(){if(!this.container||!this.collectionData)return;this.container.innerHTML="",this.carouselElement=document.createElement("div"),this.carouselElement.className="splide jaaq-collection-carousel";const t=document.createElement("div");t.className="splide__track";const e=document.createElement("ul");e.className="splide__list";const n=this.getAttribute("api-key"),i=this.getAttribute("client-id"),o=this.getAttribute("base-url"),s=this.getAttribute("video-settings");let a=null;if(s)try{a=JSON.parse(s)}catch(t){console.warn("[CollectionPlayer] Failed to parse video-settings attribute",t)}this.getVideosFromCollection(this.collectionData).forEach(t=>{const s=document.createElement("li");s.className="splide__slide";const r=document.createElement("jaaq-video-player");r.setAttribute("video-id",t.videoId),n&&r.setAttribute("api-key",n),i&&r.setAttribute("client-id",i),o&&r.setAttribute("base-url",o),r.setAttribute("autoplay","false"),r.setAttribute("width","100%"),a&&(void 0!==a.controls&&r.setAttribute("controls",String(a.controls)),void 0!==a.showLogo&&r.setAttribute("show-logo",String(a.showLogo)),void 0!==a.showTitle&&r.setAttribute("show-title",String(a.showTitle)),void 0!==a.showAuthor&&r.setAttribute("show-author",String(a.showAuthor)),void 0!==a.showDescription&&r.setAttribute("show-description",String(a.showDescription)),void 0!==a.showCaptions&&r.setAttribute("show-captions",String(a.showCaptions)),void 0!==a.startMuted&&r.setAttribute("start-muted",String(a.startMuted)),void 0!==a.width&&r.setAttribute("width",String(a.width)),void 0!==a.height&&r.setAttribute("height",String(a.height))),s.appendChild(r),e.appendChild(s)}),t.appendChild(e),this.carouselElement.appendChild(t),this.container.appendChild(this.carouselElement)}initSplide(){if(!this.carouselElement)return;const t=this.getBooleanAttr("show-arrows",!0),e=this.getBooleanAttr("show-dots",!0);this.splide=new un(this.carouselElement,{type:"loop",perPage:3,focus:"center",gap:"0.5rem",perMove:1,autoHeight:!0,updateOnMove:!0,padding:"5 rem",breakpoints:{768:{perPage:1},1024:{perPage:2}},arrows:t,pagination:e,autoplay:!1}),this.splide.on("moved",t=>{console.log("[CollectionPlayer] Splide moved event",{newIndex:t,splideIndex:this.splide?.index,Components:this.splide?.Components}),this.handleSlideChange(t);const e=this.collectionData?this.getVideosFromCollection(this.collectionData):[];this.dispatchEvent(new CustomEvent("jaaq:collection:slidechange",{detail:{index:t,video:e[t]},bubbles:!0,composed:!0}))}),this.splide.mount(),console.log("[CollectionPlayer] After mount",{splideIndex:this.splide.index,length:this.splide.length}),setTimeout(()=>{this.splide&&(console.log("[CollectionPlayer] Initial handleSlideChange after DOM update"),this.handleSlideChange(this.splide.index))},100)}handleSlideChange(t){if(!this.carouselElement)return;const e=this.hasAttribute("autoplay")&&"false"!==this.getAttribute("autoplay");console.log("[CollectionPlayer] handleSlideChange called",{activeIndex:t,isAutoplayEnabled:e}),null!==this.autoplayTimeoutId&&(console.log("[CollectionPlayer] Clearing existing autoplay timeout",{timeoutId:this.autoplayTimeoutId}),clearTimeout(this.autoplayTimeoutId),this.autoplayTimeoutId=null);const n=this.carouselElement.querySelector(".splide__slide.is-active:not(.splide__slide--clone)"),i=n?.querySelector("jaaq-video-player"),o=i?.getAttribute("video-id");console.log("[CollectionPlayer] Active slide from DOM:",{activeIndex:t,activeVideoId:o,foundActiveSlide:!!n});const s=this.carouselElement.querySelectorAll(".splide__slide:not(.splide__slide--clone)");Array.from(s).map((t,e)=>{const n=t.querySelector("jaaq-video-player");return{index:e,videoId:n?.getAttribute("video-id")||"unknown",isActive:t.classList.contains("is-active")}}),s.forEach((t,n)=>{const i=t.querySelector("jaaq-video-player");if(!i)return;const o=i.getAttribute("video-id");t.classList.contains("is-active")?e&&(this.autoplayTimeoutId=window.setTimeout(()=>{console.log("[CollectionPlayer] 1s delay complete, playing video",{index:n,videoId:o}),i.play?.()},1e3)):i.pause?.()})}destroyCarousel(){null!==this.autoplayTimeoutId&&(clearTimeout(this.autoplayTimeoutId),this.autoplayTimeoutId=null),this.splide&&(this.splide.destroy(),this.splide=null),this.container&&(this.container.innerHTML=""),this.collectionData=null}emitError(t){this.container&&(this.container.innerHTML=`\n <div class="jaaq-collection-error">\n ${t.message}\n </div>\n `),this.dispatchEvent(new CustomEvent("jaaq:collection:error",{detail:t,bubbles:!0,composed:!0}))}get client(){return this.clientInstance}set client(t){this.clientInstance=t,this.connected&&(this.destroyCarousel(),this.initCarousel())}get collectionId(){return this.getAttribute("collection-id")}set collectionId(t){t?this.setAttribute("collection-id",t):this.removeAttribute("collection-id")}refresh(){this.destroyCarousel(),this.initCarousel()}next(){this.splide?.go("+1")}prev(){this.splide?.go("-1")}go(t){this.splide?.go(t)}destroy(){this.destroyCarousel()}getCollection(){return this.collectionData}}const pn="jaaq-video-player",fn="jaaq-collection-player";function mn(){"undefined"!=typeof window&&"undefined"!=typeof customElements?(customElements.get(pn)||customElements.define(pn,c),customElements.get(fn)||customElements.define(fn,hn)):console.warn("Custom Elements API is not available. Web components cannot be registered.")}"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{mn()}):mn()),t.JaaqCollectionPlayerElement=hn,t.JaaqVideoPlayerElement=c,t.isRegistered=function(){return"undefined"!=typeof window&&"undefined"!=typeof customElements&&(!!customElements.get(pn)&&!!customElements.get(fn))},t.registerJaaqComponents=mn});
8
8
  //# sourceMappingURL=jaaq-webcomponents.min.js.map