UNPKG

@asicupv/paella-extra-plugins

Version:
40 lines (39 loc) 32.2 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@asicupv/paella-core"),Y="@asicupv/paella-extra-plugins",z="2.8.1",x={name:Y,version:z},T={},W="Siguiente",_="Atrás",J="Hecho",S={Next:W,Back:_,Done:J,"Don't show again":"No volver a mostrar","Getting started with Paella Player":"Comenzando con Paella Player","Paella Player is a multistream video player commonly used for lectures. It typically plays two synchronized streams: the presenter and the presentation.":"Paella Player es un reproductor de video multistream comúnmente utilizado para conferencias. Normalmente reproduce dos flujos sincronizados: el presentador y la presentación.","You're about to start a quick tour that will guide you through the main features of the player. You can skip it at any time, and optionally choose not to see this tour again.":"Estás a punto de comenzar un tutorial rápido que te guiará a través de las principales características del reproductor. Puedes omitirlo en cualquier momento y, opcionalmente, elegir no volver a ver este tutorial.","Video navigation":"Navegación de video","This is the timeline. You can navigate to any time in the video by clicking the timeline.":"Esta es la línea de tiempo. Puedes navegar a cualquier momento del video haciendo clic en la línea de tiempo.","Changing the layout of the player":"Reproductor Paella: Cambiando el diseño del reproductor","In multistream videos, the buttons on the video also affect the layout. Allowing you to make one video bigger than the other or even hide one of the vodeos.":"En videos multistream, los botones en el video también afectan el diseño. Permitiéndote hacer que un video sea más grande que el otro o incluso ocultar uno de los videos.","You're all set!":"¡Has terminado!","You've reached the end of the tour.<br/><br/>Now you're ready to explore and use the Paella Player on your own.":"Has llegado al final del tutorial.<br/><br/>Ahora estás listo para explorar y usar el reproductor Paella por tu cuenta.","This button opens a menu with multiple additional tools designed to enhance your experience.":"Este botón abre un menú con múltiples herramientas adicionales diseñadas para mejorar tu experiencia.","Here you’ll find all the available tools grouped in one place. Take a moment to explore what's available.":"Aquí encontrarás todas las herramientas disponibles agrupadas en un solo lugar. Tómate un momento para explorar lo que hay disponible.","Cookie Consent Plugin":"Consentimiento de Cookies","This plugin manages cookie consent preferences for the player, allowing users to accept or reject cookies and configure their preferences.":"Este plugin gestiona las preferencias de consentimiento de cookies para el reproductor, permitiendo a los usuarios aceptar o rechazar cookies y configurar sus preferencias."},k={};k["en-US"]=T;k.en=T;k["es-ES"]=S;k.es=S;let b=null;class g extends u.PluginModule{static Get(){return b||(b=new g),b}get moduleName(){return x.name}get moduleVersion(){return x.version}async getDictionaries(){return k}}class D extends u.EventLogPlugin{getPluginModuleInstance(){return g.Get()}get name(){return super.name||"es.upv.paella.onboarding"}get events(){return[u.Events.PLAYER_LOADED]}async onEvent(t,a){const o=await this.player.preferences.get("onboarding_hideUI",{global:!0}),n=await this.buildTour();o!==!0&&(setTimeout(()=>{this.player.pause()},100),n.start())}async buildTour(){const{default:t}=await Promise.resolve().then(()=>require("./paella-extra-plugins-shepherdjs.cjs.js")),a=new t.Tour({tourName:"paella-onboarding",useModalOverlay:!0,defaultStepOptions:{classes:"paella-onboarding",scrollTo:!0,highlightClass:"paella-onboarding-highlight",canClickTarget:!1,cancelIcon:{enabled:!0},buttons:[{text:this.player.translate("Back"),action:function(){this.back()}},{text:this.player.translate("Next"),action:function(){this.next()}}]}});return await this.generateTourSteps(a),a}async generateTourStepsForButtons(t,a){for await(const o of a){const n=await o.getTranslatedHelp();o instanceof u.ButtonGroupPlugin?(t.addStep({title:n?.title??this.player.translate(o.description),text:n?.description??this.player.translate("This button opens a menu with multiple additional tools designed to enhance your experience."),attachTo:{element:`li:has(> button[name="${o.name}"])`,on:"top"},when:{show:()=>{o.showPopUp()}}}),t.addStep({title:n?.title??this.player.translate(o.description),text:this.player.translate("Here you’ll find all the available tools grouped in one place. Take a moment to explore what's available."),attachTo:{element:".pop-up",on:"top"}}),await this.generateTourStepsForButtons(t,await o.getVisibleButtonPlugins())):n!=null&&t.addStep({title:n.title,text:n.description,attachTo:{element:`li:has(> button[name="${o.name}"])`,on:"top"}})}}async generateTourSteps(t){const a=this.player.translate("Paella Player is a multistream video player commonly used for lectures. It typically plays two synchronized streams: the presenter and the presentation."),o=this.player.translate("You're about to start a quick tour that will guide you through the main features of the player. You can skip it at any time, and optionally choose not to see this tour again.");t.addSteps([{title:this.player.translate("Getting started with Paella Player"),text:`${a}<br/><br/>${o}`,buttons:[{text:this.player.translate("Don't show again"),action:async()=>{await this.player.preferences.set("onboarding_hideUI",!0,{global:!0}),t.cancel()}},{text:this.player.translate("Next"),action:t.next}]}]),t.addStep({title:this.player.translate("Video navigation"),text:this.player.translate("This is the timeline. You can navigate to any time in the video by clicking the timeline."),attachTo:{element:".playback-bar .progress-indicator",on:"top"}});const n=this.player.playbackBar.getVisibleButtonPlugins();await this.generateTourStepsForButtons(t,n),t.addStep({title:this.player.translate("Changing the layout of the player"),text:this.player.translate("In multistream videos, the buttons on the video also affect the layout. Allowing you to make one video bigger than the other or even hide one of the vodeos."),attachTo:{element:".video-canvas .button-area",on:"bottom"}}),t.addSteps([{title:this.player.translate("You're all set!"),text:this.player.translate("You've reached the end of the tour.<br/><br/>Now you're ready to explore and use the Paella Player on your own."),buttons:[{text:this.player.translate("Don't show again"),action:async()=>{await this.player.preferences.set("onboarding_hideUI",!0,{global:!0}),t.complete()}},{text:this.player.translate("Back"),action:function(){this.back()}},{text:this.player.translate("Done"),action:t.complete}]}])}}const X='<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A9,9 0 0,0 21,12C21,11.5 20.96,11 20.87,10.5C20.6,10 20,10 20,10H18V9C18,8 17,8 17,8H15V7C15,6 14,6 14,6H13V4C13,3 12,3 12,3M9.5,6A1.5,1.5 0 0,1 11,7.5A1.5,1.5 0 0,1 9.5,9A1.5,1.5 0 0,1 8,7.5A1.5,1.5 0 0,1 9.5,6M6.5,10A1.5,1.5 0 0,1 8,11.5A1.5,1.5 0 0,1 6.5,13A1.5,1.5 0 0,1 5,11.5A1.5,1.5 0 0,1 6.5,10M11.5,11A1.5,1.5 0 0,1 13,12.5A1.5,1.5 0 0,1 11.5,14A1.5,1.5 0 0,1 10,12.5A1.5,1.5 0 0,1 11.5,11M16.5,13A1.5,1.5 0 0,1 18,14.5A1.5,1.5 0 0,1 16.5,16H16.5A1.5,1.5 0 0,1 15,14.5H15A1.5,1.5 0 0,1 16.5,13M11,16A1.5,1.5 0 0,1 12.5,17.5A1.5,1.5 0 0,1 11,19A1.5,1.5 0 0,1 9.5,17.5A1.5,1.5 0 0,1 11,16Z" /></svg>';class y extends u.ButtonPlugin{static CookieConsent;static acceptedCategory(t){return y.CookieConsent?.acceptedCategory(t)??!1}preload(){const t=this.config;if(this.player.config.cookieConsent&&t&&t.enabled){this.player.log.info("CookieConsentPlugin enabled",`${this.getPluginModuleInstance().moduleName} [${this.name}]`);const a=this.player.config.cookieConsent.reduce((n,r)=>(n[r.type]={enabled:!0,readOnly:r.required},n),{}),o=this.player.config.cookieConsent.map(n=>({title:n.title,description:n.description,linkedCategory:n.type}),{});Promise.resolve().then(()=>require("./paella-extra-plugins-cookieconsent.cjs.js")).then(n=>{y.CookieConsent=n,n.run({categories:a,disablePageInteraction:!0,language:{default:"en",translations:{en:{consentModal:{title:"We use cookies",description:"Cookie modal description",acceptAllBtn:"Accept all",acceptNecessaryBtn:"Reject all",showPreferencesBtn:"Manage individual preferences"},preferencesModal:{title:"Manage cookie preferences",acceptAllBtn:"Accept all",acceptNecessaryBtn:"Reject all",savePreferencesBtn:"Accept current selection",closeIconLabel:"Close modal",sections:[{title:"Somebody said ... cookies?",description:"I want one!"},...o,{title:"More information",description:'For any queries in relation to my policy on cookies and your choices, please <a href="#contact-page">contact us</a>'}]}}}},onFirstConsent:()=>{this.player.cookieConsent.updateConsentData()},onConsent:()=>{this.player.cookieConsent.updateConsentData()},onChange:()=>{this.player.log.info("Cookie consent changed.",`${this.getPluginModuleInstance().moduleName} [${this.name}]`),this.player.cookieConsent.updateConsentData()}}).catch(r=>{this.player.log.error(`Error initializing cookie consent: ${r}`,`${this.getPluginModuleInstance().moduleName} [${this.name}]`)})}).catch(n=>{this.player.log.error(`Error loading cookie consent module: ${n}`,`${this.getPluginModuleInstance().moduleName} [${this.name}]`)})}}getPluginModuleInstance(){return g.Get()}get name(){return super.name||"es.upv.paella.cookieconsent"}async isEnabled(){return await super.isEnabled()?!!this.player?.config?.cookieConsent&&y.CookieConsent!==void 0:!1}getAriaLabel(){return"Cookie consent"}getDescription(){return this.getAriaLabel()}async getHelp(){return{title:"Cookie Consent Plugin",description:"This plugin manages cookie consent preferences for the player, allowing users to accept or reject cookies and configure their preferences."}}async load(){this.icon=this.player.getCustomPluginIcon(this.name,"buttonIcon")||X}async action(){y.CookieConsent?.showPreferences()}}function Z(e){return y.acceptedCategory(e)}const Q='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-open-text-icon lucide-book-open-text"><path d="M12 7v14"/><path d="M16 12h2"/><path d="M16 8h2"/><path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"/><path d="M6 12h2"/><path d="M6 8h2"/></svg>';class A extends u.PopUpButtonPlugin{contentToShow=[];marked;getPluginModuleInstance(){return g.Get()}get name(){return super.name||"es.upv.paella.relatedDocuments"}getAriaLabel(){return this.player.translate("Related documents")}getDescription(){return this.getAriaLabel()}async getHelp(){return{title:this.player.translate("Related documents"),description:this.player.translate("Displays a list of documents related to the current video.")}}async load(){this.icon=this.player.getCustomPluginIcon(this.name,"buttonIcon")||Q}async isEnabled(){return await super.isEnabled()?(this.contentToShow=await this.player.data.read(this.config.dataContext??"related.documents","documents")??[],this.contentToShow.length>0):!1}async getMarkdownParser(){if(!this.marked){const{marked:t}=await Promise.resolve().then(()=>require("./paella-extra-plugins-marked.cjs.js")).then(i=>i.marked_esm),{default:a}=await Promise.resolve().then(()=>require("./paella-extra-plugins-marked.cjs.js")).then(i=>i.index),{markedEmoji:o}=await Promise.resolve().then(()=>require("./paella-extra-plugins-marked.cjs.js")).then(i=>i.index$1),{allEmojis:n}=await Promise.resolve().then(()=>require("./paella-extra-plugins-marked.cjs.js")).then(i=>i.emojis),r={emojis:n,renderer:i=>i.emoji};this.marked=t.setOptions({gfm:!0,breaks:!0}).use(a()).use(o(r))}return this.marked}async getContent(){const t=u.createElementWithHtmlText(` <div class="relared-documents-container"> <div class="relared-documents-tabs"></div> <div class="relared-documents-display"></div> </div> `),a=t.querySelector(".relared-documents-tabs"),o=t.querySelector(".relared-documents-display"),n=5,r=async i=>{const s=this.contentToShow[i];let l="";if(s.content?.mimeType==="text/markdown"&&s.content?.data)l=`<div class="markdown-body">${await(await this.getMarkdownParser()).parse(s.content.data)}</div>`;else if(s.content?.mimeType==="application/json"&&s.content?.data)try{const m=JSON.parse(s.content.data);l=`<pre>${JSON.stringify(m,null,2)}</pre>`}catch{l=`<pre>${s.content.data}</pre>`}else s.content?.mimeType==="text/plain"&&s.content?.data?l=`<pre style="white-space: pre-wrap;">${s.content.data}</pre>`:l=`<pre style="white-space: pre-wrap;">${s.content?.data||"No content available."}</pre>`;o.innerHTML=` ${s.media?.url?` <video controls src="${s.media.url}" type="${s.media.mimeType}" style="${s.media.mimeType.startsWith("audio/")?"width: 100%; height: 32px;":"max-width: 100%;"}"> </video>`:""} ${l} `,a.querySelectorAll(".relared-documents-tab").forEach(m=>{m.classList.remove("active")});const p=a.querySelector(`[data-index="${i}"]`);p&&p.classList.add("active")};if(this.contentToShow.slice(0,n).forEach((i,s)=>{const l=document.createElement("button");l.className="relared-documents-tab",l.textContent=i.title,l.setAttribute("data-index",s.toString()),l.addEventListener("click",()=>r(s)),a.appendChild(l)}),this.contentToShow.length>n){const i=document.createElement("select");i.className="relared-documents-selector",this.contentToShow.slice(n).forEach((s,l)=>{const p=document.createElement("option");p.value=l.toString(),p.textContent=s.title,i.appendChild(p)}),i.addEventListener("change",()=>r(parseInt(i.value,10))),a.appendChild(i)}return this.contentToShow.length>0&&await r(0),t}}class $ extends u.DataPlugin{getPluginModuleInstance(){return g.Get()}get name(){return super.name||"es.upv.paella.relatedDocuments.dataTest"}async read(t,a){if(this.config.docs){if(this.config.docs.length===0)return this.player.log.error("Plugin not configured correctly: 0 docs defined in docs property",`${this.getPluginModuleInstance().moduleName} [${this.name}]`),null;if(this.config.docs.length>0)return await Promise.all(this.config.docs.map(async n=>{const r=n.content?.url?.startsWith("http")?n.content.url:`${this.player.repositoryUrl}/${this.player.videoId}/${n.content?.url}`,i=n.media?.url?.startsWith("http")?n.media.url:`${this.player.repositoryUrl}/${this.player.videoId}/${n.media?.url}`,s=await fetch(r).then(async l=>l.ok?await l.text():null);return{title:n.title,content:n.content?{data:s??"",url:r,mimeType:n.content.mimeType}:void 0,media:n.media?{url:i,mimeType:n.media.mimeType}:void 0}}))}else return this.player.log.error("Plugin not configured correctly: No docs property configured",`${this.getPluginModuleInstance().moduleName} [${this.name}]`),null;return null}}const ee=`<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" fill="currentColor" sroke="none" width="24" height="24" viewBox="0 0 24 24"><path d="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z" /></svg>`;class E extends u.TableInfoPopUpPlugin{getPluginModuleInstance(){return g.Get()}get name(){return super.name||"es.upv.paella.version"}getAriaLabel(){return this.player.translate("Paella player version")}getDescription(){return this.getAriaLabel()}async getHelp(){return{title:this.player.translate("Version Information"),description:this.player.translate("View the version details of the player and its components.")}}async load(){this.icon=this.player.getCustomPluginIcon(this.name,"buttonIcon")||ee}async getContentTableInfo(){const t=this.player.pluginModules.find(o=>o.moduleName.startsWith("paella-core"))?.moduleVersion||this.player.translate("unknown"),a=this.player.pluginModules.filter(o=>!o.moduleName.startsWith("paella-core")).sort((o,n)=>o.moduleName.localeCompare(n.moduleName)).map(o=>({key:o.moduleName,value:o.moduleVersion}));return{table:[{category:this.player.translate("Paella Player"),rows:[{key:this.player.translate("Player"),value:this.player.version},{key:this.player.translate("Paella core"),value:t}]},{category:this.player.translate("Paella Modules"),rows:[...a]}]}}}const te=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-list-video-icon lucide-list-video"><path d="M12 12H3"/><path d="M16 6H3"/><path d="M12 18H3"/><path d="m16 12 5 3-5 3v-6Z"/></svg>`;function ne(e){const t=Math.floor(e/60/60),a=Math.floor(e/60)-t*60,o=Math.floor(e%60);return(t>0?t.toString().padStart(2,"0")+":":"")+a.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")}class V extends u.PopUpButtonPlugin{relatedVideosRes=null;getPluginModuleInstance(){return g.Get()}get name(){return super.name||"es.upv.paella.relatedVideos"}getAriaLabel(){return this.player.translate("Related Videos")}getDescription(){return this.getAriaLabel()}async getHelp(){return{title:this.player.translate("Related Videos"),description:this.player.translate("Displays a list of videos related to the current video.")}}async load(){this.icon=this.player.getCustomPluginIcon(this.name,"buttonIcon")||te}async isEnabled(){try{return await super.isEnabled()?(this.relatedVideosRes=await this.player.data.read("relatedVideos","relatedVideos"),this.relatedVideosRes?.items.length>0||!1):!1}catch{return!1}}async getContent(){const t=this.player.videoId,a=u.createElementWithHtmlText(` <div class="related-videos-container"> <div class="relatedvideos-list"> ${this.relatedVideosRes?.items.map(n=>this.createVideoItem(n,t)).join("")} </div> </div> `);return a.querySelectorAll(".relatedvideo-item").forEach((n,r)=>{const i=this.relatedVideosRes?.items[r];i&&i.id!==t&&n.addEventListener("click",()=>{this.navigateToVideo(i.url)})}),a}createVideoItem(t,a){const o=t.previewUrl,n=t.title??"Sin título",r=t.presenter??"Autor desconocido",i=t.startDate?t.startDate.toLocaleDateString():"",s=t.duration?ne(t.duration):"",l=t.id===a;return` <div class="relatedvideo-item${l?" current-video":""}${l?"":" clickable"}"> <div class="relatedvideo-preview"> ${o?`<img src="${o}" alt="${n}" />`:'<div class="no-preview"></div>'} ${s?`<span class="relatedvideo-duration">${s}</span>`:""} ${l?'<span class="current-indicator">Reproduciendo</span>':""} </div> <div class="relatedvideo-info"> <h5 class="relatedvideo-title">${n}</h5> <div class="relatedvideo-metadata"> <div class="relatedvideo-presenters">${r}</div> ${i?`<div class="relatedvideo-date">${i}</div>`:""} </div> </div> </div> `}navigateToVideo(t){window.location.href=t}}class L extends u.DataPlugin{getPluginModuleInstance(){return g.Get()}get name(){return super.name||"es.upv.paella.relatedVideos.dataTest"}async read(t,a){const o=this.config.videos??["ai-tool","belmar-single","belmar-multiresolution-single","belmar-multiresolution-remote","audio-and-images","hls-single","hls-multiquality","video-360","portrait","dual-video-audio","webvtt-captions"];try{const n=[];for(const r of o)try{const s=await(await fetch(`${this.player.repositoryUrl}/${r}/data.json`)).json();if(s.metadata){const l={id:r,title:s.metadata.title||r,url:`index.html?id=${r}`,previewUrl:s.metadata.preview,duration:s.metadata.duration};n.push(l)}}catch(i){this.player.log.warn(`Error loading data for video ${r}: ${i}`,`${this.getPluginModuleInstance().moduleName} [${this.name}]`)}return{total:n.length,skip:0,limit:n.length,items:n}}catch(n){return this.player.log.error(`Error fetching related videos: ${n}`,`${this.getPluginModuleInstance().moduleName} [${this.name}]`),{total:0,skip:0,limit:0,items:[]}}}}const oe='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-keyboard-icon lucide-keyboard"><path d="M10 8h.01"/><path d="M12 12h.01"/><path d="M14 8h.01"/><path d="M16 12h.01"/><path d="M18 8h.01"/><path d="M6 8h.01"/><path d="M7 16h10"/><path d="M8 12h.01"/><rect width="20" height="16" x="2" y="4" rx="2"/></svg>',ae='<svg xmlns="http://www.w3.org/2000/svg" style="fill:none;" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-captions-off-icon lucide-captions-off"><path d="M10.5 5H19a2 2 0 0 1 2 2v8.5"/><path d="M17 11h-.5"/><path d="M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2"/><path d="m2 2 20 20"/><path d="M7 11h4"/><path d="M7 15h2.5"/></svg>',ie='<svg xmlns="http://www.w3.org/2000/svg" style="fill:none;" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-captions-icon lucide-captions"><rect width="18" height="14" x="3" y="5" rx="2" ry="2"/><path d="M7 15h4M15 15h2M7 11h2M13 11h4"/></svg>',se='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-volume-off-icon lucide-volume-off"><path d="M16 9a5 5 0 0 1 .95 2.293"/><path d="M19.364 5.636a9 9 0 0 1 1.889 9.96"/><path d="m2 2 20 20"/><path d="m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11"/><path d="M9.828 4.172A.686.686 0 0 1 11 4.657v.686"/></svg>',M='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-volume1-icon lucide-volume-1"><path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"/><path d="M16 9a5 5 0 0 1 0 6"/></svg>',re='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-volume2-icon lucide-volume-2"><path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.364 18.364a9 9 0 0 0 0-12.728"/></svg>',I='<svg xmlns="http://www.w3.org/2000/svg" style="fill:none;" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-gauge-icon lucide-gauge"><path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/></svg>',le='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-fast-forward-icon lucide-fast-forward"><polygon points="13 19 22 12 13 5 13 19"/><polygon points="2 19 11 12 2 5 2 19"/></svg>',ce='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rewind-icon lucide-rewind"><polygon points="11 19 2 12 11 5 11 19"/><polygon points="22 19 13 12 22 5 22 19"/></svg>';class H extends u.TableInfoPopUpPlugin{isCaptionsEnabled=!1;isVolumeEnabled=!1;preload(){const t=this.config||{};t.enabled&&t.installKeyboardManager&&this.installKeyboardManager()}getPluginModuleInstance(){return g.Get()}get name(){return super.name||"es.upv.paella.keyboardShortcuts"}getAriaLabel(){return this.player.translate("Keyboard shortcuts")}getDescription(){return this.getAriaLabel()}async getHelp(){return{title:"Keyboard Shortcuts Help",description:"Displays a list of available keyboard shortcuts to control the video player."}}async load(){this.icon=this.player.getCustomPluginIcon(this.name,"buttonIcon")||oe}async isEnabled(){const t=/iphone/i.test(navigator.userAgent),a=await super.isEnabled();return!t&&a}async checkFunctionality(){this.isCaptionsEnabled=this.player.captionsCanvas.captions.length>0,this.isVolumeEnabled=await u.isVolumeApiAvailable()}async getShortcuts(){await this.checkFunctionality();const t=[{category:"Playback",shortcuts:[]},{category:"Navigation",shortcuts:[{key:"←/→",description:"Seek backward/forward 5 seconds on seek bar"},{key:"j",description:"Seek backward 10 seconds"},{key:"l",description:"Seek forward 10 seconds"},{key:"Home/End",description:"Seek to the beginning/last seconds of the video"},{key:"0-9",description:"Seek to the 0% to 90% of the video"}]},{category:"Control",shortcuts:[{key:"u",description:"Slow down the video playback rate"},{key:"o",description:"Speed up the video playback rate"}]}],a=[{key:"Spacebar",description:"Play/Pause when the seek bar is selected"},{key:"k",description:"Play/Pause in player"}];this.isVolumeEnabled&&a.push({key:"m",description:"Mute/unmute the video"}),t[0].shortcuts=a,this.isVolumeEnabled&&t[2].shortcuts.unshift({key:"↑/↓",description:"Increase/Decrease volume 5%"});const o=[{key:"f",description:"Activate full screen (press f again or Esc to exit)"}];return this.isCaptionsEnabled&&o.push({key:"c",description:"Activate/Hide closed captions and subtitles"}),t.push({category:"Interface",shortcuts:o}),t}async getContentTableInfo(){return{footer:"<small>Shortcuts work when the player has focus</small>",table:(await this.getShortcuts()).map(o=>({category:o.category,rows:o.shortcuts.map(n=>({key:`<kbd>${n.key}</kbd>`,value:n.description}))}))}}installKeyboardManager(){this.player.log.warn("Installing keyboard manager. Only do this if you're sure you want to install the keyboard manager; it may interfere with other functions of your site. For more information, see the Paella Player documentation page.",`${this.getPluginModuleInstance().moduleName} [${this.name}]`),document.addEventListener("keydown",N(this.player,this.config?.validPlaybackRates))}}const N=(e,t=[.5,.75,1,1.25,1.5,2])=>{const a=e.getCustomPluginIcon("es.upv.paella.keyboardShortcuts","volumeMuteIcon")||se,o=e.getCustomPluginIcon("es.upv.paella.keyboardShortcuts","volumeHighIcon")||M,n=e.getCustomPluginIcon("es.upv.paella.keyboardShortcuts","volumeLowIcon")||re,r=e.getCustomPluginIcon("es.upv.paella.keyboardShortcuts","captionsOffIcon")||ae,i=e.getCustomPluginIcon("es.upv.paella.keyboardShortcuts","captionsOnIcon")||ie,s=e.getCustomPluginIcon("es.upv.paella.keyboardShortcuts","increaseSpeedIcon")||I,l=e.getCustomPluginIcon("es.upv.paella.keyboardShortcuts","decreaseSpeedIcon")||I,p=e.getCustomPluginIcon("es.upv.paella.keyboardShortcuts","fastForwardIcon")||le,m=e.getCustomPluginIcon("es.upv.paella.keyboardShortcuts","rewindIcon")||ce,C=async()=>{const c=await e.playbackRate();let d=0;t.some(h=>{if(d===0&&(d=h),h<c)d=h;else return!0}),await e.setPlaybackRate(d),e.videoContainer.message.show({text:`${d}X`,icon:l,position:"centerMiddle",timeout:2e3})},B=async()=>{const c=await e.playbackRate();let d=0;t.some(h=>{if(h>c)return d=h,!0}),d===0&&(d=t[t.length-1]),await e.setPlaybackRate(d),e.videoContainer.message.show({text:`${d}X`,icon:s,position:"centerMiddle",timeout:2e3})},R=async()=>{if(e?.captionsCanvas?.captions?.length>0)if(e.captionsCanvas.currentCaptions!=null)e.captionsCanvas.disableCaptions(),e.videoContainer.message.show({text:e.translate("Disable captions"),icon:r,position:"centerMiddle",timeout:2e3});else{let c=null;navigator.languages.some(d=>e.captionsCanvas.captions.some((h,f)=>d==h.language?(c=f,!0):!1)),e.captionsCanvas.enableCaptions({index:c||0}),e.videoContainer.message.show({text:e.translate("Enable captions"),icon:i,position:"centerMiddle",timeout:2e3})}};let P;return async c=>{const d=document.querySelector(":focus-visible");if(!(d&&(d.tagName==="INPUT"||d.tagName==="TEXTAREA")))switch(c.code){case"KeyK":c.preventDefault(),await e.paused()?e.play():e.pause();break;case"KeyM":c.preventDefault();const h=await e.volume(),f=h>0?(P=h,0):P||1;await e.setVolume(f),e.videoContainer.message.show({text:`${Math.round(f*100)}%`,icon:f==0?a:M,position:"centerMiddle",timeout:2e3});break;case"ArrowLeft":if(!d){c.preventDefault();const w=await e.currentTime();e.setCurrentTime(Math.max(0,w-5)),e.videoContainer.message.show({text:void 0,icon:m,position:"centerLeft",timeout:2e3})}break;case"ArrowRight":if(!d){c.preventDefault();const w=await e.currentTime(),v=await e.duration();e.setCurrentTime(Math.min(v,w+5)),e.videoContainer.message.show({text:void 0,icon:p,position:"centerRight",timeout:2e3})}break;case"KeyJ":c.preventDefault();const j=await e.currentTime();e.setCurrentTime(Math.max(0,j-10)),e.videoContainer.message.show({text:void 0,icon:m,position:"centerLeft",timeout:2e3});break;case"KeyL":c.preventDefault();const q=await e.currentTime(),U=await e.duration();e.setCurrentTime(Math.min(U,q+10)),e.videoContainer.message.show({text:void 0,icon:p,position:"centerRight",timeout:2e3});break;case"Home":c.preventDefault(),e.setCurrentTime(0);break;case"End":c.preventDefault();const F=await e.duration();e.setCurrentTime(F);break;case"ArrowUp":if(!d){c.preventDefault();const w=await e.volume(),v=Math.min(1,w+.05);e.setVolume(v),e.videoContainer.message.show({text:`${Math.round(v*100)}%`,icon:o,position:"centerMiddle",timeout:2e3})}break;case"ArrowDown":if(!d){c.preventDefault();const w=await e.volume(),v=Math.max(0,w-.05);e.setVolume(v),e.videoContainer.message.show({text:`${Math.round(v*100)}%`,icon:v==0?a:n,position:"centerMiddle",timeout:2e3})}break;case"KeyU":c.preventDefault(),await C();break;case"KeyO":c.preventDefault(),await B();break;case"KeyF":c.preventDefault(),e.isFullscreen?e.exitFullscreen():e.enterFullscreen();break;case"KeyC":c.preventDefault(),await R();break;case"Escape":e.isFullscreen&&(c.preventDefault(),e.exitFullscreen());break;case"Digit0":case"Digit1":case"Digit2":case"Digit3":case"Digit4":case"Digit5":case"Digit6":case"Digit7":case"Digit8":case"Digit9":c.preventDefault();const K=parseInt(c.code.replace("Digit","")),O=await e.duration(),G=K/10*O;e.setCurrentTime(G);break}}},de=[{plugin:D,config:{enabled:!1}},{plugin:y,config:{enabled:!1,side:"right"}},{plugin:A,config:{enabled:!1,side:"right"}},{plugin:$,config:{enabled:!1,context:"related.documents",docs:[]}},{plugin:E,config:{enabled:!1,side:"right"}},{plugin:V,config:{enabled:!0,side:"right"}},{plugin:L,config:{enabled:!1,context:["relatedVideos"]}},{plugin:H,config:{enabled:!1,side:"right",installKeyboardManager:!1,validPlaybackRates:[.5,.75,1,1.25,1.5,2]}}];exports.CookieConsentPlugin=y;exports.KeyboardShortcutsPlugin=H;exports.OnBoardingPlugin=D;exports.RelatedDocumentsDataTestPlugin=$;exports.RelatedDocumentsPlugin=A;exports.RelatedVideosDataTestPlugin=L;exports.RelatedVideosPlugin=V;exports.VersionPlugin=E;exports.createKeyboardEventListener=N;exports.extraPlugins=de;exports.getCookieConsentFunction=Z; //# sourceMappingURL=paella-extra-plugins.cjs.js.map