1import{b as u,$ as s,d as m,w as y,p as b,e as p,t as d}from"./chunk-vendor-lit.NvY0u02.js";import{bC as _,S as f,C as g}from"./storefrontApp.CsApItsi.min.js";import{S as v}from"./chunk-storefront_base_lit_element.lX23Jvc.js";import{t as i}from"./chunk-translations_directive.DWSzkd6.js";import{T}from"./chunk-transcript_service.DEDoHy_.js";import"./chunk-vendor-di.Bh23gdA.js";import"./chunk-vendor-lodash.CWHFt7Z.js";import"./chunk-storefront_settings_constants.DIF02Gz.js";import"./chunk-vendor-rxjs.Dp7kflo.js";import"./chunk-vendor-phoenix.cdKS79L.js";var $=Object.defineProperty,a=(c,t,e,n)=>{for(var o=void 0,l=c.length-1,h;l>=0;l--)(h=c[l])&&(o=h(t,e,o)||o);return o&&$(t,e,o),o};class r extends v{constructor(){super(),this.src="",this.instanceId="",this.settings="{}",this._transcriptContent=null,this._settings={},this._modal=u(),this._transcriptService=new T}static{this.moduleName=_.component}_extractYouTubeId(t){if(!t)throw new Error("YouTube URL cannot be empty.");const e=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=|\/live\/|\/shorts\/)([^#&?]*).*/,n=t.match(e);if(n&&n[2].length===11)return n[2];throw new Error(`Invalid YouTube URL or could not extract video ID from: "${t}"`)}async _fetchTranscriptFile(){const t=this._settings.transcriptTrackLink;!t||this._transcriptContent!==null||(this._transcriptContent=await this._transcriptService.fetchTranscript(t))}connectedCallback(){super.connectedCallback(),this._youtubeId=this._extractYouTubeId(this.src)}willUpdate(t){if(t.has("settings"))try{this._settings=JSON.parse(this.settings)}catch(e){console.error("Failed to parse video settings JSON:",this.settings,e),this._settings={}}t.has("src")&&(this._youtubeId=this._extractYouTubeId(this.src))}_renderTranscriptContent(t){return t===null?s`<p class="video__transcript-content">${i("Loading transcript...")}</p>`:t==="ERROR_COULD_NOT_LOAD_TRANSCRIPT"?s`<p class="video__transcript-content"> 2 ${i("An error occurred while displaying the transcript. We apologize for the inconvenience.")} 3 </p>`:s`<pre class="video__transcript-content">${t}</pre>`}_renderTranscriptModal(){const t=this._renderTranscriptContent(this._transcriptContent);return s` 4 <h-modal-opener 5 class="video__transcript-modal-opener" 6 name="video__container__transcript-modal-${this.instanceId}" 7 @click=${this._fetchTranscriptFile} 8 > 9 ${i("This video includes a transcript.")} 10 </h-modal-opener> 11 12 <h-modal 13 id="video__container__transcript-modal-${this.instanceId}" 14 ${m(this._modal)} 15 hidden 16 > 17 <h-modal-header> 18 <h2 class="section-title section-title_s">${i("Transcript")}</h2> 19 <h-modal-close 20 class="btn btn_icon" 21 aria-label="${i("Close window")+"-"+i("Transcript")}" 22 > 23 <h-icon icon-name="icon-x"></h-icon> 24 </h-modal-close> 25 </h-modal-header> 26 27 <h-modal-body> ${t} </h-modal-body> 28 29 <h-modal-footer> 30 <h-modal-close class="modal__btn btn btn_primary"> ${i("Return to the page")} </h-modal-close> 31 </h-modal-footer> 32 </h-modal> 33 `}render(){if(!this.src)return s`<p>${i("No YouTube video configured yet")}.</p>`;if(!this._youtubeId)return s`<p>${i("Invalid YouTube link format")}.</p>`;const t={aspectRatio:this._settings.aspectRatio||"16/9"},e=new URLSearchParams({autoplay:this._settings.autoplay?"1":"0",mute:this._settings.autoplay||this._settings.muted?"1":"0",controls:this._settings.controls?"1":"0",playsinline:"1",iv_load_policy:"3",rel:"0",fs:"1",cc_load_policy:this._settings.captionTrackLink?"1":"0"});this._settings.loop&&this._youtubeId&&(e.set("loop","1"),e.set("playlist",this._youtubeId)),this._settings.captionLang&&e.set("cc_lang_pref",this._settings.captionLang);const n=`https://www.youtube-nocookie.com/embed/${this._youtubeId}?${e}`;return s` 34 <div 35 class="video__container yt-video__container" 36 style=${b(t)} 37 > 38 <iframe 39 width="100%" 40 height="100%" 41 src=${n} 42 frameborder="0" 43 allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" 44 allowfullscreen 45 playsinline 46 title=${this._settings.videoDescription||"video"} 47 ></iframe> 48 ${this._settings.transcriptTrackLink?this._renderTranscriptMod
48al():y} 49 </div> 50 `}}a([p({type:String,attribute:"src"})],r.prototype,"src");a([p({type:String,attribute:"instance-id"})],r.prototype,"instanceId");a([p({type:String,attribute:"settings"})],r.prototype,"settings");a([d()],r.prototype,"_transcriptContent");a([d()],r.prototype,"_settings");a([d()],r.prototype,"_youtubeId");class x extends f{static{this.featureName=_.feature}init(){return{cores:[{type:g,instance:[r]}]}}}export{x as VideoInitializer};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.