@jaaq/jaaq-sdk-js 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +733 -92
- package/dist/embed/embed-collection.html +275 -0
- package/dist/embed/embed.html +270 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/jaaq-sdk.min.js.map +1 -1
- package/dist/ui/index.cjs +5051 -0
- package/dist/ui/index.cjs.map +1 -0
- package/dist/ui/index.d.ts +378 -0
- package/dist/ui/index.mjs +5044 -0
- package/dist/ui/index.mjs.map +1 -0
- package/dist/ui/jaaq-ui-bundled.min.js +8 -0
- package/dist/ui/jaaq-ui-bundled.min.js.map +1 -0
- package/dist/ui/jaaq-ui.min.js +8 -0
- package/dist/ui/jaaq-ui.min.js.map +1 -0
- package/dist/ui/react/index.cjs +4756 -0
- package/dist/ui/react/index.cjs.map +1 -0
- package/dist/ui/react/index.d.ts +182 -0
- package/dist/ui/react/index.mjs +4735 -0
- package/dist/ui/react/index.mjs.map +1 -0
- package/dist/ui/react/jaaq-ui-react.min.js +8 -0
- package/dist/ui/react/jaaq-ui-react.min.js.map +1 -0
- package/dist/ui/vanilla/index.cjs +5052 -0
- package/dist/ui/vanilla/index.cjs.map +1 -0
- package/dist/ui/vanilla/index.d.ts +465 -0
- package/dist/ui/vanilla/index.mjs +5044 -0
- package/dist/ui/vanilla/index.mjs.map +1 -0
- package/dist/ui/vanilla/jaaq-vanilla-bundled.min.js +8 -0
- package/dist/ui/vanilla/jaaq-vanilla-bundled.min.js.map +1 -0
- package/dist/ui/vanilla/jaaq-vanilla.min.js +8 -0
- package/dist/ui/vanilla/jaaq-vanilla.min.js.map +1 -0
- package/dist/ui/webcomponents/index.cjs +4619 -0
- package/dist/ui/webcomponents/index.cjs.map +1 -0
- package/dist/ui/webcomponents/index.d.ts +288 -0
- package/dist/ui/webcomponents/index.mjs +4614 -0
- package/dist/ui/webcomponents/index.mjs.map +1 -0
- package/dist/ui/webcomponents/jaaq-webcomponents-bundled.min.js +8 -0
- package/dist/ui/webcomponents/jaaq-webcomponents-bundled.min.js.map +1 -0
- package/dist/ui/webcomponents/jaaq-webcomponents.min.js +8 -0
- package/dist/ui/webcomponents/jaaq-webcomponents.min.js.map +1 -0
- package/package.json +42 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("hls.js")):"function"==typeof define&&define.amd?define(["exports","hls.js"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JaaqWebComponents={},e.Hls)}(this,function(e,t){"use strict";function n(e){const{baseUrl:t,apiKey:n,clientId:i,fetch:o}=e,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=e=>function(e,t,n){if(/^https?:\/\//i.test(n))return n;const i=e.replace(/\/+$/,""),o=n.replace(/^\/+/,"");return`${i}/b2b/v1/subscription/${encodeURIComponent(t)}${o.startsWith("/")?o:`/${o}`}`}(t,i,e),l=async(e,t,n,i)=>{const o={method:e,headers:{...a,...n?.headers},...n};void 0!==i&&(o.body=JSON.stringify(i));return async function(e){if(!e.ok){const t=await e.text().catch(()=>"");throw new Error(`HTTP ${e.status}: ${t||e.statusText}`)}if(204!==e.status)return e.json()}(await s(r(t),o))};return{get:(e,t)=>l("GET",e,t),post:(e,t,n)=>l("POST",e,n,t),put:(e,t,n)=>l("PUT",e,n,t),patch:(e,t,n)=>l("PATCH",e,n,t),delete:(e,t)=>l("DELETE",e,t)}}const i="https://api.jaaq.app";class o{constructor(e){this.videos=function(e){return{async getById(t){const n=`/videos/${encodeURIComponent(t)}`;return(await e.get(n)).video}}}(e),this.collections=function(e){return{list:async()=>(await e.get("/collections")).collections,async getById(t){const n=`/collections/${encodeURIComponent(t)}`;return(await e.get(n)).collection}}}(e)}static fromHttp(e){return new o(e)}static init(e){return s(e)}}function s(e){const{baseUrl:t=i,apiKey:s,clientId:a,fetch:r}=e,l=n({baseUrl:t,apiKey:s,clientId:a,fetch:r??globalThis.fetch});return o.fromHttp(l)}function a(e,t,n){return Math.max(t,Math.min(n,e))}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(e,t){if(this.client=null,this.hls=null,this.videoElement=null,this.listeners=new Map,this.captionCues=[],this.elements={},this.container="string"==typeof e?document.querySelector(e):e,!this.container)throw new Error("Container element not found");if(this.config=t,this.state={isPlaying:!1,currentTime:0,duration:0,volume:1,isMuted:!1,isFullscreen:!1,isLoading:!0,error:null,videoData:null,captionsEnabled:!1},t.client)this.client=t.client;else{if(!t.apiKey||!t.clientId)throw new Error("Please provide either a client instance or apiKey and clientId");this.client=function(e){return s(e)}({apiKey:t.apiKey,clientId:t.clientId,baseUrl:t.baseUrl})}this.init()}async init(){this.createDOM(),await this.loadVideo(),this.attachEventListeners()}createDOM(){this.container.innerHTML="";const e=document.createElement("div");e.style.width=this.config.width||"100%",e.style.height=this.config.height||"auto";const t=document.createElement("div");t.className=`jaaq-video-player jaaq-vanilla-player ${this.config.className||""}`,this.elements.player=t;const n=document.createElement("video");this.videoElement=n,t.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,t.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,t.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),t.appendChild(s);const d=document.createElement("div");d.className="jaaq-loading",this.elements.loading=d,t.appendChild(d);const u=document.createElement("div");u.className="jaaq-error",u.style.display="none",this.elements.error=u,t.appendChild(u);const p=document.createElement("div");p.className="jaaq-controls",this.elements.controls=p;const h=document.createElement("div");h.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,h.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,h.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),h.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,h.appendChild(y);const b=document.createElement("button");b.className="jaaq-control-btn",b.textContent="⛶",b.setAttribute("aria-label","Fullscreen"),this.elements.fullscreenBtn=b,h.appendChild(b),p.appendChild(h),t.appendChild(p),e.appendChild(t),this.container.appendChild(e),this.updateControlsVisibility()}updateControlsVisibility(){const e=!1!==this.config.controls;this.elements.controls&&(this.elements.controls.style.display=e?"":"none")}async loadVideo(){if(this.client&&this.videoElement)try{this.setState({isLoading:!0,error:null});const e=await this.client.videos.getById(this.config.videoId);this.setState({videoData:e}),e.subtitle&&(this.captionCues=this.parseWebVTT(e.subtitle)),this.updateOverlayContent(e),this.emit("loaded",e);const n=e.videoUrl;if(n.includes(".m3u8"))if(t.isSupported()){this.hls&&this.hls.destroy();const e=new t({enableWorker:!0,lowLatencyMode:!0});e.loadSource(n),e.attachMedia(this.videoElement),e.on(t.Events.MANIFEST_PARSED,()=>{this.setState({isLoading:!1}),this.elements.loading&&(this.elements.loading.style.display="none"),this.config.autoplay&&this.play()}),e.on(t.Events.ERROR,(e,t)=>{if(t.fatal){const e=`HLS Error: ${t.type} - ${t.details}`;this.showError(e),this.emit("error",new Error(e))}}),this.hls=e}else{if(!this.videoElement.canPlayType("application/vnd.apple.mpegurl"))throw new Error("HLS is not supported in this browser");this.videoElement.src=n,this.setState({isLoading:!1}),this.elements.loading&&(this.elements.loading.style.display="none"),this.config.autoplay&&this.play()}else this.videoElement.src=n,this.setState({isLoading:!1}),this.elements.loading&&(this.elements.loading.style.display="none"),this.config.autoplay&&this.play()}catch(e){const t=e instanceof Error?e.message:"Failed to load video";this.showError(t),this.setState({isLoading:!1}),this.emit("error",e instanceof Error?e:new Error(t))}}parseWebVTT(e){const t=[],n=e.split("\n");let i=0;for(;i<n.length;){const e=n[i].trim();if(e.includes("--\x3e")){const[o,s]=e.split("--\x3e").map(e=>e.trim()),a=e=>{const t=e.split(":");if(3===t.length){return 3600*parseFloat(t[0])+60*parseFloat(t[1])+parseFloat(t[2])}if(2===t.length){return 60*parseFloat(t[0])+parseFloat(t[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&&t.push({start:r,end:l,text:c.join(" ")})}i++}return t}updateOverlayContent(e){const t=!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=t?"block":"none"),this.elements.videoTitle&&(this.elements.videoTitle.textContent=e.question||"",this.elements.videoTitle.style.display=n&&e.question?"block":"none"),this.elements.videoAuthor){const t=e.author||e.creator||e.userName||"";this.elements.videoAuthor.textContent=t,this.elements.videoAuthor.style.display=i&&t?"block":"none"}if(this.elements.videoDescription){if(e.description){const t=150,n=e.description.length>t?e.description.substring(0,t)+"...":e.description;this.elements.videoDescription.innerHTML=`\n <span class="jaaq-description-text">${n}</span>\n ${e.description.length>t?'<span class="jaaq-read-more"> Read more</span>':""}\n `}this.elements.videoDescription.style.display=o&&e.description?"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",e=>{this.handleSeek(e)}),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 e=!!document.fullscreenElement;this.setState({isFullscreen:e}),this.elements.player?.classList.toggle("fullscreen",e),this.emit("fullscreenchange",e)}),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(e){this.state={...this.state,...e}}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 e=this.state.currentTime/this.state.duration*100;this.elements.progressFilled.style.width=`${e}%`}}updateVolumeUI(){if(this.elements.volumeBtn){const{isMuted:e,volume:t}=this.state;this.elements.volumeBtn.innerHTML=e||0===t?'\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 e=this.state.currentTime,t=this.captionCues.find(t=>e>=t.start&&e<=t.end);t?(this.elements.captionDisplay.textContent=t.text,this.elements.captionDisplay.style.display="block"):this.elements.captionDisplay.style.display="none"}handleSeek(e){if(!this.videoElement||!this.state.duration||!this.elements.progressBar)return;const t=this.elements.progressBar.getBoundingClientRect(),n=(e.clientX-t.left)/t.width;this.videoElement.currentTime=this.state.duration*a(n,0,1)}showError(e){this.setState({error:e,isLoading:!1}),this.elements.error&&(this.elements.error.textContent=e,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 e;this.elements.player&&(e=this.elements.player,document.fullscreenElement?document.exitFullscreen():e.requestFullscreen())}play(){this.videoElement?.play()}pause(){this.videoElement?.pause()}setVolume(e){this.videoElement&&(this.videoElement.volume=a(e,0,1),this.videoElement.muted=0===e)}toggleMute(){this.videoElement&&(this.videoElement.muted=!this.videoElement.muted)}seek(e){this.videoElement&&(this.videoElement.currentTime=a(e,0,this.state.duration))}setFeatures(e){this.config={...this.config,...e},void 0!==e.controls&&this.updateControlsVisibility(),this.state.videoData?this.updateOverlayContent(this.state.videoData):(void 0!==e.showLogo&&this.elements.logo&&(this.elements.logo.style.display=e.showLogo?"block":"none"),void 0!==e.showCaptions&&this.elements.captionsBtn&&(this.elements.captionsBtn.style.display=e.showCaptions?"flex":"none"))}getState(){return{...this.state}}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){const n=this.listeners.get(e);n&&n.delete(t)}emit(e,t){const n=this.listeners.get(e);n&&n.forEach(e=>e(t))}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"]}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(e,t,n){if(this.connected&&t!==n)if("video-id"===e&&this.player)this.destroyPlayer(),this.initPlayer();else if("width"===e||"height"===e)this.updateContainerStyles();else if(("controls"===e||"show-logo"===e||"show-title"===e||"show-author"===e||"show-description"===e||"show-captions"===e)&&this.player){const t={};"controls"===e?t.controls=!this.hasAttribute("controls")||"false"!==this.getAttribute("controls"):"show-logo"===e?t.showLogo=!this.hasAttribute("show-logo")||"false"!==this.getAttribute("show-logo"):"show-title"===e?t.showTitle=!this.hasAttribute("show-title")||"false"!==this.getAttribute("show-title"):"show-author"===e?t.showAuthor=!this.hasAttribute("show-author")||"false"!==this.getAttribute("show-author"):"show-description"===e?t.showDescription=!this.hasAttribute("show-description")||"false"!==this.getAttribute("show-description"):"show-captions"===e&&(t.showCaptions=!this.hasAttribute("show-captions")||"false"!==this.getAttribute("show-captions")),this.player.setFeatures(t)}}render(){if(!this.shadowRoot)return;const e=document.createElement("style");e.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(e),this.shadowRoot.appendChild(this.container),this.updateContainerStyles()}updateContainerStyles(){if(!this.container)return;const e=this.getAttribute("width")||"100%",t=this.getAttribute("height")||"auto";this.container.style.width=e,this.container.style.height=t}async initPlayer(){if(!this.container||this.player)return;const e=this.getAttribute("video-id");if(!e)return void this.emitError(new Error("video-id attribute is required"));const t=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");if(this.clientInstance||t||n)try{this.player=new l(this.container,{videoId:e??void 0,apiKey:t??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}),this.attachPlayerEvents()}catch(e){this.emitError(e instanceof Error?e: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",e=>{this.dispatchEvent(new CustomEvent("jaaq:loaded",{detail:e,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",e=>{this.dispatchEvent(new CustomEvent("jaaq:timeupdate",{detail:e,bubbles:!0,composed:!0}))}),this.player.on("volumechange",e=>{this.dispatchEvent(new CustomEvent("jaaq:volumechange",{detail:e,bubbles:!0,composed:!0}))}),this.player.on("ended",()=>{this.dispatchEvent(new CustomEvent("jaaq:ended",{bubbles:!0,composed:!0}))}),this.player.on("error",e=>{this.emitError(e)}),this.player.on("fullscreenchange",e=>{this.dispatchEvent(new CustomEvent("jaaq:fullscreenchange",{detail:e,bubbles:!0,composed:!0}))}))}emitError(e){this.dispatchEvent(new CustomEvent("jaaq:error",{detail:e,bubbles:!0,composed:!0}))}destroyPlayer(){this.player&&(this.player.destroy(),this.player=null)}get client(){return this.clientInstance}set client(e){this.clientInstance=e,this.connected&&(this.destroyPlayer(),this.initPlayer())}get videoId(){return this.getAttribute("video-id")}set videoId(e){e?this.setAttribute("video-id",e):this.removeAttribute("video-id")}play(){this.player?.play()}pause(){this.player?.pause()}setVolume(e){this.player?.setVolume(e)}toggleMute(){this.player?.toggleMute()}seek(e){this.player?.seek(e)}getState(){return this.player?.getState()||null}destroy(){this.destroyPlayer()}}function d(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}
|
|
2
|
+
/*!
|
|
3
|
+
* Splide.js
|
|
4
|
+
* Version : 4.1.4
|
|
5
|
+
* License : MIT
|
|
6
|
+
* Copyright: 2022 Naotoshi Fujita
|
|
7
|
+
*/var u="(prefers-reduced-motion: reduce)",p={CREATED:1,MOUNTED:2,IDLE:3,MOVING:4,SCROLLING:5,DRAGGING:6,DESTROYED:7};function h(e){e.length=0}function f(e,t,n){return Array.prototype.slice.call(e,t,n)}function m(e){return e.bind.apply(e,[null].concat(f(arguments,1)))}var g=setTimeout,v=function(){};function y(e){return requestAnimationFrame(e)}function b(e,t){return typeof t===e}function w(e){return!j(e)&&b("object",e)}var x=Array.isArray,_=m(b,"function"),E=m(b,"string"),C=m(b,"undefined");function j(e){return null===e}function q(e){try{return e instanceof(e.ownerDocument.defaultView||window).HTMLElement}catch(e){return!1}}function k(e){return x(e)?e:[e]}function S(e,t){k(e).forEach(t)}function L(e,t){return e.indexOf(t)>-1}function A(e,t){return e.push.apply(e,k(t)),e}function P(e,t,n){e&&S(t,function(t){t&&e.classList[n?"add":"remove"](t)})}function M(e,t){P(e,E(t)?t.split(" "):t,!0)}function I(e,t){S(t,e.appendChild.bind(e))}function T(e,t){S(e,function(e){var n=(t||e).parentNode;n&&n.insertBefore(e,t)})}function B(e,t){return q(e)&&(e.msMatchesSelector||e.matches).call(e,t)}function D(e,t){var n=e?f(e.children):[];return t?n.filter(function(e){return B(e,t)}):n}function z(e,t){return t?D(e,t)[0]:e.firstElementChild}var N=Object.keys;function F(e,t,n){return e&&(n?N(e).reverse():N(e)).forEach(function(n){"__proto__"!==n&&t(e[n],n)}),e}function H(e){return f(arguments,1).forEach(function(t){F(t,function(n,i){e[i]=t[i]})}),e}function O(e){return f(arguments,1).forEach(function(t){F(t,function(t,n){x(t)?e[n]=t.slice():w(t)?e[n]=O({},w(e[n])?e[n]:{},t):e[n]=t})}),e}function R(e,t){S(t||N(e),function(t){delete e[t]})}function V(e,t){S(e,function(e){S(t,function(t){e&&e.removeAttribute(t)})})}function U(e,t,n){w(t)?F(t,function(t,n){U(e,n,t)}):S(e,function(e){j(n)||""===n?V(e,t):e.setAttribute(t,String(n))})}function $(e,t,n){var i=document.createElement(e);return t&&(E(t)?M(i,t):U(i,t)),n&&I(n,i),i}function W(e,t,n){if(C(n))return getComputedStyle(e)[t];j(n)||(e.style[t]=""+n)}function X(e,t){W(e,"display",t)}function Z(e){e.setActive&&e.setActive()||e.focus({preventScroll:!0})}function K(e,t){return e.getAttribute(t)}function G(e,t){return e&&e.classList.contains(t)}function J(e){return e.getBoundingClientRect()}function Y(e){S(e,function(e){e&&e.parentNode&&e.parentNode.removeChild(e)})}function Q(e){return z((new DOMParser).parseFromString(e,"text/html").body)}function ee(e,t){e.preventDefault(),t&&(e.stopPropagation(),e.stopImmediatePropagation())}function te(e,t){return e&&e.querySelector(t)}function ne(e,t){return t?f(e.querySelectorAll(t)):[]}function ie(e,t){P(e,t,!1)}function oe(e){return e.timeStamp}function se(e){return E(e)?e:e?e+"px":""}var ae="splide",re="data-"+ae;function le(e,t){if(!e)throw new Error("["+ae+"] "+(t||""))}var ce=Math.min,de=Math.max,ue=Math.floor,pe=Math.ceil,he=Math.abs;function fe(e,t,n){return he(e-t)<n}function me(e,t,n,i){var o=ce(t,n),s=de(t,n);return i?o<e&&e<s:o<=e&&e<=s}function ge(e,t,n){var i=ce(t,n),o=de(t,n);return ce(de(i,e),o)}function ve(e){return+(e>0)-+(e<0)}function ye(e,t){return S(t,function(t){e=e.replace("%s",""+t)}),e}function be(e){return e<10?"0"+e:""+e}var we={};function xe(){var e=[];function t(e,t,n){S(e,function(e){e&&S(t,function(t){t.split(" ").forEach(function(t){var i=t.split(".");n(e,i[0],i[1])})})})}return{bind:function(n,i,o,s){t(n,i,function(t,n,i){var a="addEventListener"in t,r=a?t.removeEventListener.bind(t,n,o,s):t.removeListener.bind(t,o);a?t.addEventListener(n,o,s):t.addListener(o),e.push([t,n,i,o,r])})},unbind:function(n,i,o){t(n,i,function(t,n,i){e=e.filter(function(e){return!!(e[0]!==t||e[1]!==n||e[2]!==i||o&&e[3]!==o)||(e[4](),!1)})})},dispatch:function(e,t,n){var i,o=!0;return"function"==typeof CustomEvent?i=new CustomEvent(t,{bubbles:o,detail:n}):(i=document.createEvent("CustomEvent")).initCustomEvent(t,o,!1,n),e.dispatchEvent(i),i},destroy:function(){e.forEach(function(e){e[4]()}),h(e)}}}var _e="mounted",Ee="ready",Ce="move",je="moved",qe="click",ke="active",Se="inactive",Le="visible",Ae="hidden",Pe="refresh",Me="updated",Ie="resize",Te="resized",Be="scroll",De="scrolled",ze="destroy",Ne="arrows:mounted",Fe="navigation:mounted",He="autoplay:play",Oe="autoplay:pause",Re="lazyload:loaded",Ve="sk",Ue="sh",$e="ei";function We(e){var t=e?e.event.bus:document.createDocumentFragment(),n=xe();return e&&e.event.on(ze,n.destroy),H(n,{bus:t,on:function(e,i){n.bind(t,k(e).join(" "),function(e){i.apply(i,x(e.detail)?e.detail:[])})},off:m(n.unbind,t),emit:function(e){n.dispatch(t,e,f(arguments,1))}})}function Xe(e,t,n,i){var o,s,a=Date.now,r=0,l=!0,c=0;function d(){if(!l){if(r=e?ce((a()-o)/e,1):1,n&&n(r),r>=1&&(t(),o=a(),i&&++c>=i))return u();s=y(d)}}function u(){l=!0}function p(){s&&cancelAnimationFrame(s),r=0,s=0,l=!0}return{start:function(t){t||p(),o=a()-(t?r*e:0),l=!1,s=y(d)},rewind:function(){o=a(),r=0,n&&n(r)},pause:u,cancel:p,set:function(t){e=t},isPaused:function(){return l}}}var Ze="Arrow",Ke=Ze+"Left",Ge=Ze+"Right",Je=Ze+"Up",Ye=Ze+"Down",Qe="ttb",et={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[Je,Ge],ArrowRight:[Ye,Ke]};var tt="role",nt="tabindex",it="aria-",ot=it+"controls",st=it+"current",at=it+"selected",rt=it+"label",lt=it+"labelledby",ct=it+"hidden",dt=it+"orientation",ut=it+"roledescription",pt=it+"live",ht=it+"busy",ft=it+"atomic",mt=[tt,nt,"disabled",ot,st,rt,lt,ct,dt,ut],gt=ae+"__",vt="is-",yt=ae,bt=gt+"track",wt=gt+"list",xt=gt+"slide",_t=xt+"--clone",Et=xt+"__container",Ct=gt+"arrows",jt=gt+"arrow",qt=jt+"--prev",kt=jt+"--next",St=gt+"pagination",Lt=St+"__page",At=gt+"progress"+"__bar",Pt=gt+"toggle",Mt=gt+"sr",It=vt+"initialized",Tt=vt+"active",Bt=vt+"prev",Dt=vt+"next",zt=vt+"visible",Nt=vt+"loading",Ft=vt+"focus-in",Ht=vt+"overflow",Ot=[Tt,zt,Bt,Dt,Nt,Ft,Ht],Rt={slide:xt,clone:_t,arrows:Ct,arrow:jt,prev:qt,next:kt,pagination:St,page:Lt,spinner:gt+"spinner"};var Vt="touchstart mousedown",Ut="touchmove mousemove",$t="touchend touchcancel mouseup click";var Wt="slide",Xt="loop",Zt="fade";function Kt(e,t,n,i){var o,s=We(e),a=s.on,r=s.emit,l=s.bind,c=e.Components,d=e.root,u=e.options,p=u.isNavigation,h=u.updateOnMove,f=u.i18n,g=u.pagination,v=u.slideFocus,y=c.Direction.resolve,b=K(i,"style"),w=K(i,rt),x=n>-1,_=z(i,"."+Et);function E(){var o=e.splides.map(function(e){var n=e.splide.Components.Slides.getAt(t);return n?n.slide.id:""}).join(" ");U(i,rt,ye(f.slideX,(x?n:t)+1)),U(i,ot,o),U(i,tt,v?"button":""),v&&V(i,ut)}function C(){o||j()}function j(){if(!o){var n=e.index;(s=q())!==G(i,Tt)&&(P(i,Tt,s),U(i,st,p&&s||""),r(s?ke:Se,k)),function(){var t=function(){if(e.is(Zt))return q();var t=J(c.Elements.track),n=J(i),o=y("left",!0),s=y("right",!0);return ue(t[o])<=pe(n[o])&&ue(n[s])<=pe(t[s])}(),n=!t&&(!q()||x);e.state.is([4,5])||U(i,ct,n||"");U(ne(i,u.focusableNodes||""),nt,n?-1:""),v&&U(i,nt,n?-1:0);t!==G(i,zt)&&(P(i,zt,t),r(t?Le:Ae,k));if(!t&&document.activeElement===i){var o=c.Slides.getAt(e.index);o&&Z(o.slide)}}(),P(i,Bt,t===n-1),P(i,Dt,t===n+1)}var s}function q(){var i=e.index;return i===t||u.cloneStatus&&i===n}var k={index:t,slideIndex:n,slide:i,container:_,isClone:x,mount:function(){x||(i.id=d.id+"-slide"+be(t+1),U(i,tt,g?"tabpanel":"group"),U(i,ut,f.slide),U(i,rt,w||ye(f.slideLabel,[t+1,e.length]))),l(i,"click",m(r,qe,k)),l(i,"keydown",m(r,Ve,k)),a([je,Ue,De],j),a(Fe,E),h&&a(Ce,C)},destroy:function(){o=!0,s.destroy(),ie(i,Ot),V(i,mt),U(i,"style",b),U(i,rt,w||"")},update:j,style:function(e,t,n){W(n&&_||i,e,t)},isWithin:function(n,i){var o=he(n-t);return x||!u.rewind&&!e.is(Xt)||(o=ce(o,e.length-o)),o<=i}};return k}var Gt=re+"-interval";var Jt={passive:!1,capture:!0};var Yt={Spacebar:" ",Right:Ge,Left:Ke,Up:Je,Down:Ye};function Qt(e){return e=E(e)?e:e.key,Yt[e]||e}var en="keydown";var tn=re+"-lazy",nn=tn+"-srcset",on="["+tn+"], ["+nn+"]";var sn=[" ","Enter"];var an=Object.freeze({__proto__:null,Media:function(e,t,n){var i=e.state,o=n.breakpoints||{},s=n.reducedMotion||{},a=xe(),r=[];function l(e){e&&a.destroy()}function c(e,t){var n=matchMedia(t);a.bind(n,"change",d),r.push([e,n])}function d(){var t=i.is(7),o=n.direction,s=r.reduce(function(e,t){return O(e,t[1].matches?t[0]:{})},{});R(n),p(s),n.destroy?e.destroy("completely"===n.destroy):t?(l(!0),e.mount()):o!==n.direction&&e.refresh()}function p(t,o,s){O(n,t),o&&O(Object.getPrototypeOf(n),t),!s&&i.is(1)||e.emit(Me,n)}return{setup:function(){var e="min"===n.mediaQuery;N(o).sort(function(t,n){return e?+t-+n:+n-+t}).forEach(function(t){c(o[t],"("+(e?"min":"max")+"-width:"+t+"px)")}),c(s,u),d()},destroy:l,reduce:function(e){matchMedia(u).matches&&(e?O(n,s):R(n,N(s)))},set:p}},Direction:function(e,t,n){return{resolve:function(e,t,i){var o="rtl"!==(i=i||n.direction)||t?i===Qe?0:-1:1;return et[e]&&et[e][o]||e.replace(/width|left|right/i,function(e,t){var n=et[e.toLowerCase()][o]||e;return t>0?n.charAt(0).toUpperCase()+n.slice(1):n})},orient:function(e){return e*("rtl"===n.direction?1:-1)}}},Elements:function(e,t,n){var i,o,s,a=We(e),r=a.on,l=a.bind,c=e.root,d=n.i18n,u={},p=[],f=[],m=[];function g(){i=b("."+bt),o=z(i,"."+wt),le(i&&o,"A track/list element is missing."),A(p,D(o,"."+xt+":not(."+_t+")")),F({arrows:Ct,pagination:St,prev:qt,next:kt,bar:At,toggle:Pt},function(e,t){u[t]=b("."+e)}),H(u,{root:c,track:i,list:o,slides:p}),function(){var e=c.id||(s=ae,""+s+be(we[s]=(we[s]||0)+1)),t=n.role;var s;c.id=e,i.id=i.id||e+"-track",o.id=o.id||e+"-list",!K(c,tt)&&"SECTION"!==c.tagName&&t&&U(c,tt,t);U(c,ut,d.carousel),U(o,tt,"presentation")}(),y()}function v(e){var t=mt.concat("style");h(p),ie(c,f),ie(i,m),V([i,o],t),V(c,e?t:["style",ut])}function y(){ie(c,f),ie(i,m),f=w(yt),m=w(bt),M(c,f),M(i,m),U(c,rt,n.label),U(c,lt,n.labelledby)}function b(e){var t=te(c,e);return t&&function(e,t){if(_(e.closest))return e.closest(t);for(var n=e;n&&1===n.nodeType&&!B(n,t);)n=n.parentElement;return n}(t,"."+yt)===c?t:void 0}function w(e){return[e+"--"+n.type,e+"--"+n.direction,n.drag&&e+"--draggable",n.isNavigation&&e+"--nav",e===yt&&Tt]}return H(u,{setup:g,mount:function(){r(Pe,v),r(Pe,g),r(Me,y),l(document,Vt+" keydown",function(e){s="keydown"===e.type},{capture:!0}),l(c,"focusin",function(){P(c,Ft,!!s)})},destroy:v})},Slides:function(e,t,n){var i=We(e),o=i.on,s=i.emit,a=i.bind,r=t.Elements,l=r.slides,c=r.list,d=[];function u(){l.forEach(function(e,t){f(e,t,-1)})}function p(){v(function(e){e.destroy()}),h(d)}function f(t,n,i){var o=Kt(e,n,i,t);o.mount(),d.push(o),d.sort(function(e,t){return e.index-t.index})}function g(e){return e?y(function(e){return!e.isClone}):d}function v(e,t){g(t).forEach(e)}function y(e){return d.filter(_(e)?e:function(t){return E(e)?B(t.slide,e):L(k(e),t.index)})}return{mount:function(){u(),o(Pe,p),o(Pe,u)},destroy:p,update:function(){v(function(e){e.update()})},register:f,get:g,getIn:function(e){var i=t.Controller,o=i.toIndex(e),s=i.hasFocus()?1:n.perPage;return y(function(e){return me(e.index,o,o+s-1)})},getAt:function(e){return y(e)[0]},add:function(e,t){S(e,function(e){if(E(e)&&(e=Q(e)),q(e)){var i=l[t];i?T(e,i):I(c,e),M(e,n.classes.slide),o=e,r=m(s,Ie),d=ne(o,"img"),(u=d.length)?d.forEach(function(e){a(e,"load error",function(){--u||r()})}):r()}var o,r,d,u}),s(Pe)},remove:function(e){Y(y(e).map(function(e){return e.slide})),s(Pe)},forEach:v,filter:y,style:function(e,t,n){v(function(i){i.style(e,t,n)})},getLength:function(e){return e?l.length:d.length},isEnough:function(){return d.length>n.perPage}}},Layout:function(e,t,n){var i,o,s,a=We(e),r=a.on,l=a.bind,c=a.emit,d=t.Slides,u=t.Direction.resolve,p=t.Elements,h=p.root,f=p.track,g=p.list,v=d.getAt,y=d.style;function b(){i=n.direction===Qe,W(h,"maxWidth",se(n.width)),W(f,u("paddingLeft"),_(!1)),W(f,u("paddingRight"),_(!0)),x(!0)}function x(e){var t=J(h);(e||o.width!==t.width||o.height!==t.height)&&(W(f,"height",function(){var e="";i&&(le(e=E(),"height or heightRatio is missing."),e="calc("+e+" - "+_(!1)+" - "+_(!0)+")");return e}()),y(u("marginRight"),se(n.gap)),y("width",n.autoWidth?null:se(n.fixedWidth)||(i?"":C())),y("height",se(n.fixedHeight)||(i?n.autoHeight?null:C():E()),!0),o=t,c(Te),s!==(s=A())&&(P(h,Ht,s),c("overflow",s)))}function _(e){var t=n.padding,i=u(e?"right":"left");return t&&se(t[i]||(w(t)?0:t))||"0px"}function E(){return se(n.height||J(g).width*n.heightRatio)}function C(){var e=se(n.gap);return"calc((100%"+(e&&" + "+e)+")/"+(n.perPage||1)+(e&&" - "+e)+")"}function j(){return J(g)[u("width")]}function q(e,t){var n=v(e||0);return n?J(n.slide)[u("width")]+(t?0:L()):0}function k(e,t){var n=v(e);if(n){var i=J(n.slide)[u("right")],o=J(g)[u("left")];return he(i-o)+(t?0:L())}return 0}function S(t){return k(e.length-1)-k(0)+q(0,t)}function L(){var e=v(0);return e&&parseFloat(W(e.slide,u("marginRight")))||0}function A(){return e.is(Zt)||S(!0)>j()}return{mount:function(){var e,t;b(),l(window,"resize load",(e=m(c,Ie),t=Xe(0,e,null,1),function(){t.isPaused()&&t.start()})),r([Me,Pe],b),r(Ie,x)},resize:x,listSize:j,slideSize:q,sliderSize:S,totalSize:k,getPadding:function(e){return parseFloat(W(f,u("padding"+(e?"Right":"Left"))))||0},isOverflow:A}},Clones:function(e,t,n){var i,o=We(e),s=o.on,a=t.Elements,r=t.Slides,l=t.Direction.resolve,c=[];function d(){s(Pe,u),s([Me,Ie],f),(i=m())&&(!function(t){var i=r.get().slice(),o=i.length;if(o){for(;i.length<t;)A(i,i);A(i.slice(-t),i.slice(0,t)).forEach(function(s,l){var d=l<t,u=function(t,i){var o=t.cloneNode(!0);return M(o,n.classes.clone),o.id=e.root.id+"-clone"+be(i+1),o}(s.slide,l);d?T(u,i[0].slide):I(a.list,u),A(c,u),r.register(u,l-t+(d?0:o),s.index)})}}(i),t.Layout.resize(!0))}function u(){p(),d()}function p(){Y(c),h(c),o.destroy()}function f(){var e=m();i!==e&&(i<e||!e)&&o.emit(Pe)}function m(){var i=n.clones;if(e.is(Xt)){if(C(i)){var o=n[l("fixedWidth")]&&t.Layout.slideSize(0);i=o&&pe(J(a.track)[l("width")]/o)||n[l("autoWidth")]&&e.length||2*n.perPage}}else i=0;return i}return{mount:d,destroy:p}},Move:function(e,t,n){var i,o=We(e),s=o.on,a=o.emit,r=e.state.set,l=t.Layout,c=l.slideSize,d=l.getPadding,u=l.totalSize,p=l.listSize,h=l.sliderSize,f=t.Direction,m=f.resolve,g=f.orient,v=t.Elements,y=v.list,b=v.track;function w(){t.Controller.isBusy()||(t.Scroll.cancel(),x(e.index),t.Slides.update())}function x(e){_(k(e,!0))}function _(n,i){if(!e.is(Zt)){var o=i?n:function(n){if(e.is(Xt)){var i=q(n),o=i>t.Controller.getEnd();(i<0||o)&&(n=E(n,o))}return n}(n);W(y,"transform","translate"+m("X")+"("+o+"px)"),n!==o&&a(Ue)}}function E(e,t){var n=e-L(t),i=h();return e-=g(i*(pe(he(n)/i)||1))*(t?1:-1)}function j(){_(S(),!0),i.cancel()}function q(e){for(var n=t.Slides.get(),i=0,o=1/0,s=0;s<n.length;s++){var a=n[s].index,r=he(k(a,!0)-e);if(!(r<=o))break;o=r,i=a}return i}function k(t,i){var o=g(u(t-1)-function(e){var t=n.focus;return"center"===t?(p()-c(e,!0))/2:+t*c(e)||0}(t));return i?function(t){n.trimSpace&&e.is(Wt)&&(t=ge(t,0,g(h(!0)-p())));return t}(o):o}function S(){var e=m("left");return J(y)[e]-J(b)[e]+g(d(!1))}function L(e){return k(e?t.Controller.getEnd():0,!!n.trimSpace)}return{mount:function(){i=t.Transition,s([_e,Te,Me,Pe],w)},move:function(e,t,n,o){var s,l;e!==t&&(s=e>n,l=g(E(S(),s)),s?l>=0:l<=y[m("scrollWidth")]-J(b)[m("width")])&&(j(),_(E(S(),e>n),!0)),r(4),a(Ce,t,n,e),i.start(t,function(){r(3),a(je,t,n,e),o&&o()})},jump:x,translate:_,shift:E,cancel:j,toIndex:q,toPosition:k,getPosition:S,getLimit:L,exceededLimit:function(e,t){t=C(t)?S():t;var n=!0!==e&&g(t)<g(L(!1)),i=!1!==e&&g(t)>g(L(!0));return n||i},reposition:w}},Controller:function(e,t,n){var i,o,s,a,r=We(e),l=r.on,c=r.emit,d=t.Move,u=d.getPosition,p=d.getLimit,h=d.toPosition,f=t.Slides,g=f.isEnough,v=f.getLength,y=n.omitEnd,b=e.is(Xt),w=e.is(Wt),x=m(L,!1),_=m(L,!0),j=n.start||0,q=j;function k(){o=v(!0),s=n.perMove,a=n.perPage,i=M();var e=ge(j,0,y?i:o-1);e!==j&&(j=e,d.reposition())}function S(){i!==M()&&c($e)}function L(e,t){var n=s||(D()?1:a),o=A(j+n*(e?-1:1),j,!(s||D()));return-1===o&&w&&!fe(u(),p(!e),1)?e?0:i:t?o:P(o)}function A(t,r,l){if(g()||D()){var c=function(t){if(w&&"move"===n.trimSpace&&t!==j)for(var i=u();i===h(t,!0)&&me(t,0,e.length-1,!n.rewind);)t<j?--t:++t;return t}(t);c!==t&&(r=t,t=c,l=!1),t<0||t>i?t=s||!me(0,t,r,!0)&&!me(i,r,t,!0)?b?l?t<0?-(o%a||a):o:t:n.rewind?t<0?i:0:-1:I(T(t)):l&&t!==r&&(t=I(T(r)+(t<r?-1:1)))}else t=-1;return t}function P(e){return b?(e+o)%o||0:e}function M(){for(var e=o-(D()||b&&s?1:a);y&&e-- >0;)if(h(o-1,!0)!==h(e,!0)){e++;break}return ge(e,0,o-1)}function I(e){return ge(D()?e:a*e,0,i)}function T(e){return D()?ce(e,i):ue((e>=i?o-1:e)/a)}function B(e){e!==j&&(q=j,j=e)}function D(){return!C(n.focus)||n.isNavigation}function z(){return e.state.is([4,5])&&!!n.waitForTransition}return{mount:function(){k(),l([Me,Pe,$e],k),l(Te,S)},go:function(e,t,n){if(!z()){var o=function(e){var t=j;if(E(e)){var n=e.match(/([+\-<>])(\d+)?/)||[],o=n[1],s=n[2];"+"===o||"-"===o?t=A(j+ +(""+o+(+s||1)),j):">"===o?t=s?I(+s):x(!0):"<"===o&&(t=_(!0))}else t=b?e:ge(e,0,i);return t}(e),s=P(o);s>-1&&(t||s!==j)&&(B(s),d.move(o,s,q,n))}},scroll:function(e,n,o,s){t.Scroll.scroll(e,n,o,function(){var e=P(d.toIndex(u()));B(y?ce(e,i):e),s&&s()})},getNext:x,getPrev:_,getAdjacent:L,getEnd:M,setIndex:B,getIndex:function(e){return e?q:j},toIndex:I,toPage:T,toDest:function(e){var t=d.toIndex(e);return w?ge(t,0,i):t},hasFocus:D,isBusy:z}},Arrows:function(e,t,n){var i,o,s=We(e),a=s.on,r=s.bind,l=s.emit,c=n.classes,d=n.i18n,u=t.Elements,p=t.Controller,h=u.arrows,f=u.track,g=h,v=u.prev,y=u.next,b={};function w(){!function(){var e=n.arrows;!e||v&&y||(g=h||$("div",c.arrows),v=C(!0),y=C(!1),i=!0,I(g,[v,y]),!h&&T(g,f));v&&y&&(H(b,{prev:v,next:y}),X(g,e?"":"none"),M(g,o=Ct+"--"+n.direction),e&&(a([_e,je,Pe,De,$e],j),r(y,"click",m(E,">")),r(v,"click",m(E,"<")),j(),U([v,y],ot,f.id),l(Ne,v,y)))}(),a(Me,x)}function x(){_(),w()}function _(){s.destroy(),ie(g,o),i?(Y(h?[v,y]:g),v=y=null):V([v,y],mt)}function E(e){p.go(e,!0)}function C(e){return Q('<button class="'+c.arrow+" "+(e?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 t=e.index,n=p.getPrev(),i=p.getNext(),o=n>-1&&t<n?d.last:d.prev,s=i>-1&&t>i?d.first:d.next;v.disabled=n<0,y.disabled=i<0,U(v,rt,o),U(y,rt,s),l("arrows:updated",v,y,n,i)}}return{arrows:b,mount:w,destroy:_,update:j}},Autoplay:function(e,t,n){var i,o,s=We(e),a=s.on,r=s.bind,l=s.emit,c=Xe(n.interval,e.go.bind(e,">"),function(e){var t=u.bar;t&&W(t,"width",100*e+"%"),l("autoplay:playing",e)}),d=c.isPaused,u=t.Elements,p=t.Elements,h=p.root,f=p.toggle,m=n.autoplay,g="pause"===m;function v(){d()&&t.Slides.isEnough()&&(c.start(!n.resetProgress),o=i=g=!1,w(),l(He))}function y(e){void 0===e&&(e=!0),g=!!e,w(),d()||(c.pause(),l(Oe))}function b(){g||(i||o?y(!1):v())}function w(){f&&(P(f,Tt,!g),U(f,rt,n.i18n[g?"play":"pause"]))}function x(e){var i=t.Slides.getAt(e);c.set(i&&+K(i.slide,Gt)||n.interval)}return{mount:function(){m&&(!function(){n.pauseOnHover&&r(h,"mouseenter mouseleave",function(e){i="mouseenter"===e.type,b()});n.pauseOnFocus&&r(h,"focusin focusout",function(e){o="focusin"===e.type,b()});f&&r(f,"click",function(){g?v():y(!0)});a([Ce,Be,Pe],c.rewind),a(Ce,x)}(),f&&U(f,ot,u.track.id),g||v(),w())},destroy:c.cancel,play:v,pause:y,isPaused:d}},Cover:function(e,t,n){var i=We(e).on;function o(e){t.Slides.forEach(function(t){var n=z(t.container||t.slide,"img");n&&n.src&&s(e,n,t)})}function s(e,t,n){n.style("background",e?'center/cover no-repeat url("'+t.src+'")':"",!0),X(t,e?"none":"")}return{mount:function(){n.cover&&(i(Re,m(s,!0)),i([_e,Me,Pe],m(o,!0)))},destroy:m(o,!1)}},Scroll:function(e,t,n){var i,o,s=We(e),a=s.on,r=s.emit,l=e.state.set,c=t.Move,d=c.getPosition,u=c.getLimit,p=c.exceededLimit,h=c.translate,f=e.is(Wt),g=1;function v(e,n,s,a,u){var h=d();if(w(),s&&(!f||!p())){var v=t.Layout.sliderSize(),x=ve(e)*v*ue(he(e)/v)||0;e=c.toPosition(t.Controller.toDest(e%v))+x}var _=fe(h,e,1);g=1,n=_?0:n||de(he(e-h)/1.5,800),o=a,i=Xe(n,y,m(b,h,e,u),1),l(5),r(Be),i.start()}function y(){l(3),o&&o(),r(De)}function b(e,t,i,s){var a,r,l=d(),c=(e+(t-e)*(a=s,(r=n.easingFunc)?r(a):1-Math.pow(1-a,4))-l)*g;h(l+c),f&&!i&&p()&&(g*=.6,he(c)<10&&v(u(p(!0)),600,!1,o,!0))}function w(){i&&i.cancel()}function x(){i&&!i.isPaused()&&(w(),y())}return{mount:function(){a(Ce,w),a([Me,Pe],x)},destroy:w,scroll:v,cancel:x}},Drag:function(e,t,n){var i,o,s,a,r,l,c,d,u=We(e),p=u.on,h=u.emit,f=u.bind,m=u.unbind,g=e.state,y=t.Move,b=t.Scroll,x=t.Controller,_=t.Elements.track,E=t.Media.reduce,C=t.Direction,j=C.resolve,q=C.orient,k=y.getPosition,S=y.exceededLimit,L=!1;function A(){var e=n.drag;R(!e),a="free"===e}function P(e){if(l=!1,!c){var t=O(e);i=e.target,o=n.noDrag,B(i,"."+Lt+", ."+jt)||o&&B(i,o)||!t&&e.button||(x.isBusy()?ee(e,!0):(d=t?_:window,r=g.is([4,5]),s=null,f(d,Ut,M,Jt),f(d,$t,I,Jt),y.cancel(),b.cancel(),D(e)))}var i,o}function M(t){if(g.is(6)||(g.set(6),h("drag")),t.cancelable)if(r){y.translate(i+z(t)/(L&&e.is(Wt)?5:1));var o=N(t)>200,s=L!==(L=S());(o||s)&&D(t),l=!0,h("dragging"),ee(t)}else(function(e){return he(z(e))>he(z(e,!0))})(t)&&(r=function(e){var t=n.dragMinThreshold,i=w(t),o=i&&t.mouse||0,s=(i?t.touch:+t)||10;return he(z(e))>(O(e)?s:o)}(t),ee(t))}function I(i){g.is(6)&&(g.set(3),h("dragged")),r&&(!function(i){var o=function(t){if(e.is(Xt)||!L){var n=N(t);if(n&&n<200)return z(t)/n}return 0}(i),s=function(e){return k()+ve(e)*ce(he(e)*(n.flickPower||600),a?1/0:t.Layout.listSize()*(n.flickMaxPages||1))}(o),r=n.rewind&&n.rewindByDrag;E(!1),a?x.scroll(s,0,n.snap):e.is(Zt)?x.go(q(ve(o))<0?r?"<":"-":r?">":"+"):e.is(Wt)&&L&&r?x.go(S(!0)?">":"<"):x.go(x.toDest(s),!0);E(!0)}(i),ee(i)),m(d,Ut,M),m(d,$t,I),r=!1}function T(e){!c&&l&&ee(e,!0)}function D(e){s=o,o=e,i=k()}function z(e,t){return H(e,t)-H(F(e),t)}function N(e){return oe(e)-oe(F(e))}function F(e){return o===e&&s||o}function H(e,t){return(O(e)?e.changedTouches[0]:e)["page"+j(t?"Y":"X")]}function O(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}function R(e){c=e}return{mount:function(){f(_,Ut,v,Jt),f(_,$t,v,Jt),f(_,Vt,P,Jt),f(_,"click",T,{capture:!0}),f(_,"dragstart",ee),p([_e,Me],A)},disable:R,isDragging:function(){return r}}},Keyboard:function(e,t,n){var i,o,s=We(e),a=s.on,r=s.bind,l=s.unbind,c=e.root,d=t.Direction.resolve;function u(){var e=n.keyboard;e&&(i="global"===e?window:c,r(i,en,f))}function p(){l(i,en)}function h(){var e=o;o=!0,g(function(){o=e})}function f(t){if(!o){var n=Qt(t);n===d(Ke)?e.go("<"):n===d(Ge)&&e.go(">")}}return{mount:function(){u(),a(Me,p),a(Me,u),a(Ce,h)},destroy:p,disable:function(e){o=e}}},LazyLoad:function(e,t,n){var i=We(e),o=i.on,s=i.off,a=i.bind,r=i.emit,l="sequential"===n.lazyLoad,c=[je,De],d=[];function u(){h(d),t.Slides.forEach(function(e){ne(e.slide,on).forEach(function(t){var i=K(t,tn),o=K(t,nn);if(i!==t.src||o!==t.srcset){var s=n.classes.spinner,a=t.parentElement,r=z(a,"."+s)||$("span",s,a);d.push([t,e,r]),t.src||X(t,"none")}})}),l?v():(s(c),o(c,p),p())}function p(){(d=d.filter(function(t){var i=n.perPage*((n.preloadPages||1)+1)-1;return!t[1].isWithin(e.index,i)||f(t)})).length||s(c)}function f(e){var t=e[0];M(e[1].slide,Nt),a(t,"load error",m(g,e)),U(t,"src",K(t,tn)),U(t,"srcset",K(t,nn)),V(t,tn),V(t,nn)}function g(e,t){var n=e[0],i=e[1];ie(i.slide,Nt),"error"!==t.type&&(Y(e[2]),X(n,""),r(Re,n,i),r(Ie)),l&&v()}function v(){d.length&&f(d.shift())}return{mount:function(){n.lazyLoad&&(u(),o(Pe,u))},destroy:m(h,d),check:p}},Pagination:function(e,t,n){var i,o,s=We(e),a=s.on,r=s.emit,l=s.bind,c=t.Slides,d=t.Elements,u=t.Controller,p=u.hasFocus,g=u.getIndex,v=u.go,y=t.Direction.resolve,b=d.pagination,w=[];function x(){i&&(Y(b?f(i.children):i),ie(i,o),h(w),i=null),s.destroy()}function _(e){v(">"+e,!0)}function E(e,t){var n=w.length,i=Qt(t),o=C(),s=-1;i===y(Ge,!1,o)?s=++e%n:i===y(Ke,!1,o)?s=(--e+n)%n:"Home"===i?s=0:"End"===i&&(s=n-1);var a=w[s];a&&(Z(a.button),v(">"+s),ee(t,!0))}function C(){return n.paginationDirection||n.direction}function j(e){return w[u.toPage(e)]}function q(){var e=j(g(!0)),t=j(g());if(e){var n=e.button;ie(n,Tt),V(n,at),U(n,nt,-1)}if(t){var o=t.button;M(o,Tt),U(o,at,!0),U(o,nt,"")}r("pagination:updated",{list:i,items:w},e,t)}return{items:w,mount:function t(){x(),a([Me,Pe,$e],t);var s=n.pagination;b&&X(b,s?"":"none"),s&&(a([Ce,Be,De],q),function(){var t=e.length,s=n.classes,a=n.i18n,r=n.perPage,h=p()?u.getEnd()+1:pe(t/r);M(i=b||$("ul",s.pagination,d.track.parentElement),o=St+"--"+C()),U(i,tt,"tablist"),U(i,rt,a.select),U(i,dt,C()===Qe?"vertical":"");for(var f=0;f<h;f++){var g=$("li",null,i),v=$("button",{class:s.page,type:"button"},g),y=c.getIn(f).map(function(e){return e.slide.id}),x=!p()&&r>1?a.pageX:a.slideX;l(v,"click",m(_,f)),n.paginationKeyboard&&l(v,"keydown",m(E,f)),U(g,tt,"presentation"),U(v,tt,"tab"),U(v,ot,y.join(" ")),U(v,rt,ye(x,f+1)),U(v,nt,-1),w.push({li:g,button:v,page:f})}}(),q(),r("pagination:mounted",{list:i,items:w},j(e.index)))},destroy:x,getAt:j,update:q}},Sync:function(e,t,n){var i=n.isNavigation,o=n.slideFocus,s=[];function a(){var t,n;e.splides.forEach(function(t){t.isParent||(l(e,t.splide),l(t.splide,e))}),i&&(t=We(e),(n=t.on)(qe,d),n(Ve,u),n([_e,Me],c),s.push(t),t.emit(Fe,e.splides))}function r(){s.forEach(function(e){e.destroy()}),h(s)}function l(e,t){var n=We(e);n.on(Ce,function(e,n,i){t.go(t.is(Xt)?i:e)}),s.push(n)}function c(){U(t.Elements.list,dt,n.direction===Qe?"vertical":"")}function d(t){e.go(t.index)}function u(e,t){L(sn,Qt(t))&&(d(e),ee(t))}return{setup:m(t.Media.set,{slideFocus:C(o)?i:o},!0),mount:a,destroy:r,remount:function(){r(),a()}}},Wheel:function(e,t,n){var i=We(e).bind,o=0;function s(i){if(i.cancelable){var s=i.deltaY,a=s<0,r=oe(i),l=n.wheelMinThreshold||0,c=n.wheelSleep||0;he(s)>l&&r-o>c&&(e.go(a?"<":">"),o=r),function(i){return!n.releaseWheel||e.state.is(4)||-1!==t.Controller.getAdjacent(i)}(a)&&ee(i)}}return{mount:function(){n.wheel&&i(t.Elements.track,"wheel",s,Jt)}}},Live:function(e,t,n){var i=We(e).on,o=t.Elements.track,s=n.live&&!n.isNavigation,a=$("span",Mt),r=Xe(90,m(l,!1));function l(e){U(o,ht,e),e?(I(o,a),r.start()):(Y(a),r.cancel())}function c(e){s&&U(o,pt,e?"off":"polite")}return{mount:function(){s&&(c(!t.Autoplay.isPaused()),U(o,ft,!0),a.textContent="…",i(He,m(c,!0)),i(Oe,m(c,!1)),i([je,De],m(l,!0)))},disable:c,destroy:function(){V(o,[pt,ft,ht]),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:Rt,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(e,t,n){var i=t.Slides;function o(){i.forEach(function(e){e.style("transform","translateX(-"+100*e.index+"%)")})}return{mount:function(){We(e).on([_e,Pe],o)},start:function(e,t){i.style("transition","opacity "+n.speed+"ms "+n.easing),g(t)},cancel:v}}function cn(e,t,n){var i,o=t.Move,s=t.Controller,a=t.Scroll,r=t.Elements.list,l=m(W,r,"transition");function c(){l(""),a.cancel()}return{mount:function(){We(e).bind(r,"transitionend",function(e){e.target===r&&i&&(c(),i())})},start:function(t,r){var c=o.toPosition(t,!0),d=o.getPosition(),u=function(t){var i=n.rewindSpeed;if(e.is(Wt)&&i){var o=s.getIndex(!0),a=s.getEnd();if(0===o&&t>=a||o>=a&&0===t)return i}return n.speed}(t);he(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(t),r())},cancel:c}}var dn=function(){function e(t,n){var i;this.event=We(),this.Components={},this.state=(i=1,{set:function(e){i=e},is:function(e){return L(k(e),i)}}),this.splides=[],this._o={},this._E={};var o=E(t)?te(document,t):t;le(o,o+" is invalid."),this.root=o,n=O({label:K(o,rt)||"",labelledby:K(o,lt)||""},rn,e.defaults,n||{});try{O(n,JSON.parse(K(o,re)))}catch(e){le(!1,"Invalid JSON")}this._o=Object.create(O({},n))}var t=e.prototype;return t.mount=function(e,t){var n=this,i=this.state,o=this.Components;return le(i.is([1,7]),"Already mounted!"),i.set(1),this._C=o,this._T=t||this._T||(this.is(Zt)?ln:cn),this._E=e||this._E,F(H({},an,this._E,{Transition:this._T}),function(e,t){var i=e(n,o,n._o);o[t]=i,i.setup&&i.setup()}),F(o,function(e){e.mount&&e.mount()}),this.emit(_e),M(this.root,It),i.set(3),this.emit(Ee),this},t.sync=function(e){return this.splides.push({splide:e}),e.splides.push({splide:this,isParent:!0}),this.state.is(3)&&(this._C.Sync.remount(),e.Components.Sync.remount()),this},t.go=function(e){return this._C.Controller.go(e),this},t.on=function(e,t){return this.event.on(e,t),this},t.off=function(e){return this.event.off(e),this},t.emit=function(e){var t;return(t=this.event).emit.apply(t,[e].concat(f(arguments,1))),this},t.add=function(e,t){return this._C.Slides.add(e,t),this},t.remove=function(e){return this._C.Slides.remove(e),this},t.is=function(e){return this._o.type===e},t.refresh=function(){return this.emit(Pe),this},t.destroy=function(e){void 0===e&&(e=!0);var t=this.event,n=this.state;return n.is(1)?We(this).on(Ee,this.destroy.bind(this,e)):(F(this._C,function(t){t.destroy&&t.destroy(e)},!0),t.emit(ze),t.destroy(),e&&h(this.splides),n.set(7)),this},d(e,[{key:"options",get:function(){return this._o},set:function(e){this._C.Media.set(e,!0,!0)}},{key:"length",get:function(){return this._C.Slides.getLength(!0)}},{key:"index",get:function(){return this._C.Controller.getIndex()}}]),e}(),un=dn;un.defaults={},un.STATES=p;class pn extends HTMLElement{static get observedAttributes(){return["collection-id","api-key","client-id","subscription-id","base-url","autoplay","show-arrows","show-dots"]}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(e,t,n){this.connected&&t!==n&&("collection-id"===e&&(this.destroyCarousel(),this.initCarousel()),"show-arrows"!==e&&"show-dots"!==e||(this.destroyCarousel(),this.initCarousel()))}getBooleanAttr(e,t){const n=this.getAttribute(e);return null===n?t:"false"!==n}render(){if(!this.shadowRoot)return;const e=document.createElement("style");e.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(e),this.shadowRoot.appendChild(this.container)}async initCarousel(){if(!this.container)return;const e=this.getAttribute("collection-id");if(!e)return void this.emitError(new Error("collection-id attribute is required"));const t=this.getAttribute("api-key"),n=this.getAttribute("client-id"),s=this.getAttribute("base-url")||void 0;if(this.clientInstance||t||n){this.showLoading();try{const a=this.clientInstance||o.init({apiKey:t,clientId:n,baseUrl:s||i});if(this.collectionData=await a.collections.getById(e),!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(e){this.emitError(e instanceof Error?e: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 e=document.createElement("div");e.className="splide__track";const t=document.createElement("ul");t.className="splide__list";const n=this.getAttribute("api-key"),i=this.getAttribute("client-id"),o=this.getAttribute("base-url");this.collectionData.videos.forEach(e=>{const s=document.createElement("li");s.className="splide__slide";const a=document.createElement("jaaq-video-player");a.setAttribute("video-id",e.videoId),n&&a.setAttribute("api-key",n),i&&a.setAttribute("client-id",i),o&&a.setAttribute("base-url",o),a.setAttribute("autoplay","false"),a.setAttribute("width","100%"),s.appendChild(a),t.appendChild(s)}),e.appendChild(t),this.carouselElement.appendChild(e),this.container.appendChild(this.carouselElement)}initSplide(){if(!this.carouselElement)return;const e=this.getBooleanAttr("show-arrows",!0),t=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:e,pagination:t,autoplay:!1}),this.splide.on("moved",e=>{console.log("[CollectionPlayer] Splide moved event",{newIndex:e,splideIndex:this.splide?.index,Components:this.splide?.Components}),this.handleSlideChange(e),this.dispatchEvent(new CustomEvent("jaaq:collection:slidechange",{detail:{index:e,video:this.collectionData?.videos[e]},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(e){if(!this.carouselElement)return;const t=this.hasAttribute("autoplay")&&"false"!==this.getAttribute("autoplay");console.log("[CollectionPlayer] handleSlideChange called",{activeIndex:e,isAutoplayEnabled:t}),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:e,activeVideoId:o,foundActiveSlide:!!n});const s=this.carouselElement.querySelectorAll(".splide__slide:not(.splide__slide--clone)");Array.from(s).map((e,t)=>{const n=e.querySelector("jaaq-video-player");return{index:t,videoId:n?.getAttribute("video-id")||"unknown",isActive:e.classList.contains("is-active")}}),s.forEach((e,n)=>{const i=e.querySelector("jaaq-video-player");if(!i)return;const o=i.getAttribute("video-id");e.classList.contains("is-active")?t&&(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(e){this.container&&(this.container.innerHTML=`\n <div class="jaaq-collection-error">\n ${e.message}\n </div>\n `),this.dispatchEvent(new CustomEvent("jaaq:collection:error",{detail:e,bubbles:!0,composed:!0}))}get client(){return this.clientInstance}set client(e){this.clientInstance=e,this.connected&&(this.destroyCarousel(),this.initCarousel())}get collectionId(){return this.getAttribute("collection-id")}set collectionId(e){e?this.setAttribute("collection-id",e):this.removeAttribute("collection-id")}refresh(){this.destroyCarousel(),this.initCarousel()}next(){this.splide?.go("+1")}prev(){this.splide?.go("-1")}go(e){this.splide?.go(e)}destroy(){this.destroyCarousel()}getCollection(){return this.collectionData}}const hn="jaaq-video-player",fn="jaaq-collection-player";function mn(){"undefined"!=typeof window&&"undefined"!=typeof customElements?(customElements.get(hn)||customElements.define(hn,c),customElements.get(fn)||customElements.define(fn,pn)):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()),e.JaaqCollectionPlayerElement=pn,e.JaaqVideoPlayerElement=c,e.isRegistered=function(){return"undefined"!=typeof window&&"undefined"!=typeof customElements&&(!!customElements.get(hn)&&!!customElements.get(fn))},e.registerJaaqComponents=mn});
|
|
8
|
+
//# sourceMappingURL=jaaq-webcomponents.min.js.map
|