import{a as Me,n as $,O as ye,o as w,c as S,m as v,i as L,U as de,P as ke,B as be,Q as y,R as we,S as ee,r as T,H as W,T as ne,G as H,D as te,k as Oe,Z as ae,V as E,W as Ee,X as ze,Y as Fe,$ as Ve,a0 as xe,A as De,j,N as x,g as Y,h as le,E as D,C as Q,a1 as Re,a2 as He,F as Ae,d as Be,a3 as Ke,J as We}from"./index-2542deb7.js";const Zt=Me("XIcon",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Yt=[{label:"English(US)",value:"en-US"},{label:"English(India)",value:"en-IN"},{label:"Arabic",value:"ar-SA"},{label:"Chinese (Mandarin/China)",value:"zh-CN"},{label:"Hindi",value:"hi-IN"},{label:"Japanese",value:"ja-JP"}],Qt=[{label:"English(US)",value:"en-US"},{label:"English(India)",value:"en-IN"},{label:"Arabic",value:"ar-ae"},{label:"Chinese (Mandarin/China)",value:"zh"},{label:"Hindi",value:"hi-IN"},{label:"Japanese",value:"ja-JP"}],_t={"ar-ae":[{name:"Hala",gender:"female"}],"en-IN":[{name:"Aditi",gender:"female"},{name:"Raveena",gender:"female"},{name:"Kajal",gender:"female"}],"en-US":[{name:"Danielle",gender:"female"},{name:"Gregory",gender:"male"},{name:"Joanna",gender:"female"},{name:"Matthew",gender:"male"}],"hi-IN":[{name:"Kajal",gender:"female"}],"ja-JP":[{name:"Kazuha",gender:"female"},{name:"Takumi",gender:"male"}],zh:[{name:"Zhiyu",gender:"female"}]};var Ne=globalThis&&globalThis.__awaiter||function(t,e,i,n){function r(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(c){o(c)}}function d(l){try{u(n.throw(l))}catch(c){o(c)}}function u(l){l.done?s(l.value):r(l.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};function je(t,e){return Ne(this,void 0,void 0,function*(){const i=new AudioContext({sampleRate:e});return i.decodeAudioData(t).finally(()=>i.close())})}function Ge(t){const e=t[0];if(e.some(i=>i>1||i<-1)){const i=e.length;let n=0;for(let r=0;rn&&(n=s)}for(const r of t)for(let s=0;st==null?void 0:t[i],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}const he={decode:je,createBuffer:Ue};var ie=globalThis&&globalThis.__awaiter||function(t,e,i,n){function r(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(c){o(c)}}function d(l){try{u(n.throw(l))}catch(c){o(c)}}function u(l){l.done?s(l.value):r(l.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};function Xe(t,e){return ie(this,void 0,void 0,function*(){if(!t.body||!t.headers)return;const i=t.body.getReader(),n=Number(t.headers.get("Content-Length"))||0;let r=0;const s=a=>ie(this,void 0,void 0,function*(){r+=(a==null?void 0:a.length)||0;const d=Math.round(r/n*100);e(d)}),o=()=>ie(this,void 0,void 0,function*(){let a;try{a=yield i.read()}catch{return}a.done||(s(a.value),yield o())});o()})}function qe(t,e,i){return ie(this,void 0,void 0,function*(){const n=yield fetch(t,i);return Xe(n.clone(),e),n.blob()})}const Je={fetchBlob:qe};class se{constructor(){this.listeners={},this.on=this.addEventListener,this.un=this.removeEventListener}addEventListener(e,i,n){if(this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(i),n!=null&&n.once){const r=()=>{this.removeEventListener(e,r),this.removeEventListener(e,i)};return this.addEventListener(e,r),r}return()=>this.removeEventListener(e,i)}removeEventListener(e,i){var n;(n=this.listeners[e])===null||n===void 0||n.delete(i)}once(e,i){return this.on(e,i,{once:!0})}unAll(){this.listeners={}}emit(e,...i){this.listeners[e]&&this.listeners[e].forEach(n=>n(...i))}}class Ze extends se{constructor(e){super(),this.isExternalMedia=!1,e.media?(this.media=e.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),e.mediaControls&&(this.media.controls=!0),e.autoplay&&(this.media.autoplay=!0),e.playbackRate!=null&&this.onceMediaEvent("canplay",()=>{e.playbackRate!=null&&(this.media.playbackRate=e.playbackRate)})}onMediaEvent(e,i,n){return this.media.addEventListener(e,i,n),()=>this.media.removeEventListener(e,i)}onceMediaEvent(e,i){return this.onMediaEvent(e,i,{once:!0})}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const e=this.getSrc();e.startsWith("blob:")&&URL.revokeObjectURL(e)}setSrc(e,i){if(this.getSrc()===e)return;this.revokeSrc();const r=i instanceof Blob?URL.createObjectURL(i):e;this.media.src=r,this.media.load()}destroy(){this.media.pause(),!this.isExternalMedia&&(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(e){this.media=e}play(){return this.media.play()}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(e){this.media.currentTime=e}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(e){this.media.volume=e}getMuted(){return this.media.muted}setMuted(e){this.media.muted=e}getPlaybackRate(){return this.media.playbackRate}setPlaybackRate(e,i){i!=null&&(this.media.preservesPitch=i),this.media.playbackRate=e}getMediaElement(){return this.media}setSinkId(e){return this.media.setSinkId(e)}}function Ye(t,e,i,n,r=5){let s=()=>{};if(!t)return s;const o=a=>{if(a.button===2)return;a.preventDefault(),a.stopPropagation(),t.style.touchAction="none";let d=a.clientX,u=a.clientY,l=!1;const c=h=>{h.preventDefault(),h.stopPropagation();const b=h.clientX,O=h.clientY;if(l||Math.abs(b-d)>=r||Math.abs(O-u)>=r){const{left:m,top:g}=t.getBoundingClientRect();l||(l=!0,i==null||i(d-m,u-g)),e(b-d,O-u,b-m,O-g),d=b,u=O}},p=h=>{l&&(h.preventDefault(),h.stopPropagation())},f=()=>{t.style.touchAction="",l&&(n==null||n()),s()};document.addEventListener("pointermove",c),document.addEventListener("pointerup",f),document.addEventListener("pointerleave",f),document.addEventListener("click",p,!0),s=()=>{document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",f),document.removeEventListener("pointerleave",f),setTimeout(()=>{document.removeEventListener("click",p,!0)},10)}};return t.addEventListener("pointerdown",o),()=>{s(),t.removeEventListener("pointerdown",o)}}class re extends se{constructor(e,i){super(),this.timeouts=[],this.isScrolling=!1,this.audioData=null,this.resizeObserver=null,this.isDragging=!1,this.options=e;const n=this.parentFromOptionsContainer(e.container);this.parent=n;const[r,s]=this.initHtml();n.appendChild(r),this.container=r,this.scrollContainer=s.querySelector(".scroll"),this.wrapper=s.querySelector(".wrapper"),this.canvasWrapper=s.querySelector(".canvases"),this.progressWrapper=s.querySelector(".progress"),this.cursor=s.querySelector(".cursor"),i&&s.appendChild(i),this.initEvents()}parentFromOptionsContainer(e){let i;if(typeof e=="string"?i=document.querySelector(e):e instanceof HTMLElement&&(i=e),!i)throw new Error("Container not found");return i}initEvents(){const e=n=>{const r=this.wrapper.getBoundingClientRect(),s=n.clientX-r.left,o=n.clientX-r.left,a=s/r.width,d=o/r.height;return[a,d]};this.wrapper.addEventListener("click",n=>{const[r,s]=e(n);this.emit("click",r,s)}),this.wrapper.addEventListener("dblclick",n=>{const[r,s]=e(n);this.emit("dblclick",r,s)}),this.options.dragToSeek&&this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:n,scrollWidth:r,clientWidth:s}=this.scrollContainer,o=n/r,a=(n+s)/r;this.emit("scroll",o,a)});const i=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{i(()=>this.reRender())}),this.resizeObserver.observe(this.scrollContainer)}initDrag(){Ye(this.wrapper,(e,i,n)=>{this.emit("drag",Math.max(0,Math.min(1,n/this.wrapper.getBoundingClientRect().width)))},()=>this.isDragging=!0,()=>this.isDragging=!1)}getHeight(){return this.options.height==null?128:isNaN(Number(this.options.height))?this.options.height==="auto"&&this.parent.clientHeight||128:Number(this.options.height)}initHtml(){const e=document.createElement("div"),i=e.attachShadow({mode:"open"});return i.innerHTML=`
`,[e,i]}setOptions(e){if(this.options.container!==e.container){const i=this.parentFromOptionsContainer(e.container);i.appendChild(this.container),this.parent=i}e.dragToSeek&&!this.options.dragToSeek&&this.initDrag(),this.options=e,this.reRender()}getWrapper(){return this.wrapper}getScroll(){return this.scrollContainer.scrollLeft}destroy(){var e;this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect()}createDelay(e=10){const i={};return this.timeouts.push(i),n=>{i.timeout&&clearTimeout(i.timeout),i.timeout=setTimeout(n,e)}}convertColorValues(e){if(!Array.isArray(e))return e||"";if(e.length<2)return e[0]||"";const i=document.createElement("canvas"),r=i.getContext("2d").createLinearGradient(0,0,0,i.height),s=1/(e.length-1);return e.forEach((o,a)=>{const d=a*s;r.addColorStop(d,o)}),r}renderBarWaveform(e,i,n,r){const s=e[0],o=e[1]||e[0],a=s.length,{width:d,height:u}=n.canvas,l=u/2,c=window.devicePixelRatio||1,p=i.barWidth?i.barWidth*c:1,f=i.barGap?i.barGap*c:i.barWidth?p/2:0,h=i.barRadius||0,b=d/(p+f)/a,O=h&&"roundRect"in n?"roundRect":"rect";n.beginPath();let m=0,g=0,k=0;for(let C=0;C<=a;C++){const P=Math.round(C*b);if(P>m){const K=Math.round(g*l*r),oe=Math.round(k*l*r),A=K+oe||1;let I=l-K;i.barAlign==="top"?I=0:i.barAlign==="bottom"&&(I=u-A),n[O](m*(p+f),I,p,A,h),m=P,g=0,k=0}const M=Math.abs(s[C]||0),F=Math.abs(o[C]||0);M>g&&(g=M),F>k&&(k=F)}n.fill(),n.closePath()}renderLineWaveform(e,i,n,r){const s=o=>{const a=e[o]||e[0],d=a.length,{height:u}=n.canvas,l=u/2,c=n.canvas.width/d;n.moveTo(0,l);let p=0,f=0;for(let h=0;h<=d;h++){const b=Math.round(h*c);if(b>p){const m=Math.round(f*l*r)||1,g=l+m*(o===0?-1:1);n.lineTo(p,g),p=b,f=0}const O=Math.abs(a[h]||0);O>f&&(f=O)}n.lineTo(p,l)};n.beginPath(),s(0),s(1),n.fill(),n.closePath()}renderWaveform(e,i,n){if(n.fillStyle=this.convertColorValues(i.waveColor),i.renderFunction){i.renderFunction(e,n);return}let r=i.barHeight||1;if(i.normalize){const s=Array.from(e[0]).reduce((o,a)=>Math.max(o,Math.abs(a)),0);r=s?1/s:1}if(i.barWidth||i.barGap||i.barAlign){this.renderBarWaveform(e,i,n,r);return}this.renderLineWaveform(e,i,n,r)}renderSingleCanvas(e,i,n,r,s,o,a,d){const u=window.devicePixelRatio||1,l=document.createElement("canvas"),c=e[0].length;l.width=Math.round(n*(o-s)/c),l.height=r*u,l.style.width=`${Math.floor(l.width/u)}px`,l.style.height=`${r}px`,l.style.left=`${Math.floor(s*n/u/c)}px`,a.appendChild(l);const p=l.getContext("2d");if(this.renderWaveform(e.map(f=>f.slice(s,o)),i,p),l.width>0&&l.height>0){const f=l.cloneNode(),h=f.getContext("2d");h.drawImage(l,0,0),h.globalCompositeOperation="source-in",h.fillStyle=this.convertColorValues(i.progressColor),h.fillRect(0,0,l.width,l.height),d.appendChild(f)}}renderChannel(e,i,n){const r=document.createElement("div"),s=this.getHeight();r.style.height=`${s}px`,this.canvasWrapper.style.minHeight=`${s}px`,this.canvasWrapper.appendChild(r);const o=r.cloneNode();this.progressWrapper.appendChild(o);const{scrollLeft:a,scrollWidth:d,clientWidth:u}=this.scrollContainer,l=e[0].length,c=l/d;let p=Math.min(re.MAX_CANVAS_WIDTH,u);if(i.barWidth||i.barGap){const P=i.barWidth||.5,M=i.barGap||P/2,F=P+M;p%F!==0&&(p=Math.floor(p/F)*F)}const f=Math.floor(Math.abs(a)*c),h=Math.floor(f+p*c),b=h-f,O=(P,M)=>{this.renderSingleCanvas(e,i,n,s,Math.max(0,P),Math.min(M,l),r,o)},m=this.createDelay(),g=this.createDelay(),k=(P,M)=>{O(P,M),P>0&&m(()=>{k(P-b,M-b)})},C=(P,M)=>{O(P,M),M{C(P+b,M+b)})};k(f,h),ha.timeout&&clearTimeout(a.timeout)),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.wrapper.style.width="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const i=window.devicePixelRatio||1,n=this.scrollContainer.clientWidth,r=Math.ceil(e.duration*(this.options.minPxPerSec||0));this.isScrolling=r>n;const s=this.options.fillParent&&!this.isScrolling,o=(s?n:r)*i;if(this.wrapper.style.width=s?"100%":`${r}px`,this.scrollContainer.style.overflowX=this.isScrolling?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.options.splitChannels)for(let a=0;a1&&a.push(e.getChannelData(1)),this.renderChannel(a,this.options,o)}this.audioData=e,this.emit("render")}reRender(){if(!this.audioData)return;const e=this.progressWrapper.clientWidth;this.render(this.audioData);const i=this.progressWrapper.clientWidth;this.scrollContainer.scrollLeft+=i-e}zoom(e){this.options.minPxPerSec=e,this.reRender()}scrollIntoView(e,i=!1){const{clientWidth:n,scrollLeft:r,scrollWidth:s}=this.scrollContainer,o=s*e,a=n/2,d=i&&this.options.autoCenter&&!this.isDragging?a:n;if(o>r+d||o=u&&o{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}var ue=globalThis&&globalThis.__awaiter||function(t,e,i,n){function r(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(c){o(c)}}function d(l){try{u(n.throw(l))}catch(c){o(c)}}function u(l){l.done?s(l.value):r(l.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};class _e extends se{constructor(e=new AudioContext){super(),this.bufferNode=null,this.autoplay=!1,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.audioContext=e,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return ue(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(e){this.currentSrc=e,fetch(e).then(i=>i.arrayBuffer()).then(i=>this.audioContext.decodeAudioData(i)).then(i=>{this.buffer=i,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play()})}_play(){var e;this.paused&&(this.paused=!1,(e=this.bufferNode)===null||e===void 0||e.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.bufferNode.buffer=this.buffer,this.bufferNode.connect(this.gainNode),this.playedDuration>=this.duration&&(this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,this.playedDuration),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))})}_pause(){var e;this.paused||(this.paused=!0,(e=this.bufferNode)===null||e===void 0||e.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime)}play(){return ue(this,void 0,void 0,function*(){this._play(),this.emit("play")})}pause(){this._pause(),this.emit("pause")}setSinkId(e){return ue(this,void 0,void 0,function*(){return this.audioContext.setSinkId(e)})}get playbackRate(){var e,i;return(i=(e=this.bufferNode)===null||e===void 0?void 0:e.playbackRate.value)!==null&&i!==void 0?i:1}set playbackRate(e){this.bufferNode&&(this.bufferNode.playbackRate.value=e)}get currentTime(){return this.paused?this.playedDuration:this.playedDuration+this.audioContext.currentTime-this.playStartTime}set currentTime(e){this.emit("seeking"),this.paused?this.playedDuration=e:(this._pause(),this.playedDuration=e,this._play()),this.emit("timeupdate")}get duration(){var e;return((e=this.buffer)===null||e===void 0?void 0:e.duration)||0}get volume(){return this.gainNode.gain.value}set volume(e){this.gainNode.gain.value=e,this.emit("volumechange")}get muted(){return this._muted}set muted(e){this._muted!==e&&(this._muted=e,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}getGainNode(){return this.gainNode}}var _=globalThis&&globalThis.__awaiter||function(t,e,i,n){function r(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(c){o(c)}}function d(l){try{u(n.throw(l))}catch(c){o(c)}}function u(l){l.done?s(l.value):r(l.value).then(a,d)}u((n=n.apply(t,e||[])).next())})};const $e={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class Se extends Ze{static create(e){return new Se(e)}constructor(e){const i=e.media||(e.backend==="WebAudio"?new _e:void 0);super({media:i,mediaControls:e.mediaControls,autoplay:e.autoplay,playbackRate:e.audioRate}),this.plugins=[],this.decodedData=null,this.subscriptions=[],this.mediaSubscriptions=[],this.options=Object.assign({},$e,e),this.timer=new Qe;const n=i?void 0:this.getMediaElement();this.renderer=new re(this.options,n),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const r=this.options.url||this.getSrc()||"";(r||this.options.peaks&&this.options.duration)&&this.load(r,this.options.peaks,this.options.duration)}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{const e=this.getCurrentTime();this.renderer.renderProgress(e/this.getDuration(),!0),this.emit("timeupdate",e),this.emit("audioprocess",e)}))}initPlayerEvents(){this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const e=this.getCurrentTime();this.renderer.renderProgress(e/this.getDuration(),this.isPlaying()),this.emit("timeupdate",e)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop()}),this.onMediaEvent("emptied",()=>{this.timer.stop()}),this.onMediaEvent("ended",()=>{this.emit("finish")}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(e,i)=>{this.options.interact&&(this.seekTo(e),this.emit("interaction",e*this.getDuration()),this.emit("click",e,i))}),this.renderer.on("dblclick",(e,i)=>{this.emit("dblclick",e,i)}),this.renderer.on("scroll",(e,i)=>{const n=this.getDuration();this.emit("scroll",e*n,i*n)}),this.renderer.on("render",()=>{this.emit("redraw")}));{let e;this.subscriptions.push(this.renderer.on("drag",i=>{this.options.interact&&(this.renderer.renderProgress(i),clearTimeout(e),e=setTimeout(()=>{this.seekTo(i)},this.isPlaying()?0:200),this.emit("interaction",i*this.getDuration()),this.emit("drag",i))}))}}initPlugins(){var e;!((e=this.options.plugins)===null||e===void 0)&&e.length&&this.options.plugins.forEach(i=>{this.registerPlugin(i)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(e=>e()),this.mediaSubscriptions=[]}setOptions(e){this.options=Object.assign({},this.options,e),this.renderer.setOptions(this.options),e.audioRate&&this.setPlaybackRate(e.audioRate),e.mediaControls!=null&&(this.getMediaElement().controls=e.mediaControls)}registerPlugin(e){return e.init(this),this.plugins.push(e),this.subscriptions.push(e.once("destroy",()=>{this.plugins=this.plugins.filter(i=>i!==e)})),e}getWrapper(){return this.renderer.getWrapper()}getScroll(){return this.renderer.getScroll()}getActivePlugins(){return this.plugins}loadAudio(e,i,n,r){return _(this,void 0,void 0,function*(){if(this.emit("load",e),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,!i&&!n){const o=a=>this.emit("loading",a);i=yield Je.fetchBlob(e,o,this.options.fetchParams)}this.setSrc(e,i);const s=(yield Promise.resolve(r||this.getDuration()))||(yield new Promise(o=>{this.onceMediaEvent("loadedmetadata",()=>o(this.getDuration()))}));if(n)this.decodedData=he.createBuffer(n,s||0);else if(i){const o=yield i.arrayBuffer();this.decodedData=yield he.decode(o,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(e,i,n){return _(this,void 0,void 0,function*(){yield this.loadAudio(e,void 0,i,n)})}loadBlob(e,i,n){return _(this,void 0,void 0,function*(){yield this.loadAudio("blob",e,i,n)})}zoom(e){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(e),this.emit("zoom",e)}getDecodedData(){return this.decodedData}exportPeaks({channels:e=2,maxLength:i=8e3,precision:n=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const r=Math.min(e,this.decodedData.numberOfChannels),s=[];for(let o=0;oe.destroy()),this.subscriptions.forEach(e=>e()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}const et=t=>{const e=atob(t),i=Array.from(e).map(n=>n.charCodeAt(0));return new Uint8Array(i)},$t=t=>{t.getTracks().forEach(e=>e.stop())},tt=t=>{try{return JSON.parse(t)}catch{return t}},it=(t="/voice")=>{const e=window.location.protocol==="https:"?"wss:":"ws:",i=window.location.host;return new URL(t,`${e}//${i}`).href},ei=t=>{const e=$(""),i=$([]),n=$([]);return{currentText:e,originals:i,translateds:n,onmessage:o=>{var d,u,l,c;if(o instanceof Blob){(d=t==null?void 0:t.onAudioData)==null||d.call(t,o);return}const a=tt(o);if(typeof a!="string")if(a.type==="original"&&a.content)a.isFinal?(e.value="",i.value.push(a.content)):e.value=a.content;else if(a.type==="translated")n.value.push(a.content),(u=t==null?void 0:t.ontranslated)==null||u.call(t,a.content);else if(a.type==="audio"&&a.content){const p=et(a.content),f=new Blob([p],{type:"audio/mp3"});(l=t==null?void 0:t.onAudioData)==null||l.call(t,f)}else a.type==="lipSync"&&((c=t==null?void 0:t.onVisemes)==null||c.call(t,a.visemes))},cleanScreen:()=>{e.value="",i.value=[],n.value=[]}}},ti=(t,e)=>{const i=new WebSocket(it(t)),n=[];return i.onopen=()=>{var o;n.length>0&&(n.forEach(a=>{typeof a=="string"||a instanceof Blob||a instanceof ArrayBuffer?i.send(a):i.send(JSON.stringify(a))}),n.length=0),(o=e.onopen)==null||o.call(e,i)},i.onmessage=o=>{var a;return(a=e.onmessage)==null?void 0:a.call(e,o.data)},i.onerror=o=>{var a;(a=e.onerror)==null||a.call(e,o)},i.onclose=o=>{var a;(a=e.onclose)==null||a.call(e,o)},{ws:i,send:o=>{i.readyState===WebSocket.OPEN?typeof o=="string"||o instanceof Blob||o instanceof ArrayBuffer?i.send(o):i.send(JSON.stringify(o)):n.push(o)},close:()=>{i.close()}}};var Ie={name:"ChevronDownIcon",extends:ye},nt=L("path",{d:"M7.01744 10.398C6.91269 10.3985 6.8089 10.378 6.71215 10.3379C6.61541 10.2977 6.52766 10.2386 6.45405 10.1641L1.13907 4.84913C1.03306 4.69404 0.985221 4.5065 1.00399 4.31958C1.02276 4.13266 1.10693 3.95838 1.24166 3.82747C1.37639 3.69655 1.55301 3.61742 1.74039 3.60402C1.92777 3.59062 2.11386 3.64382 2.26584 3.75424L7.01744 8.47394L11.769 3.75424C11.9189 3.65709 12.097 3.61306 12.2748 3.62921C12.4527 3.64535 12.6199 3.72073 12.7498 3.84328C12.8797 3.96582 12.9647 4.12842 12.9912 4.30502C13.0177 4.48162 12.9841 4.662 12.8958 4.81724L7.58083 10.1322C7.50996 10.2125 7.42344 10.2775 7.32656 10.3232C7.22968 10.3689 7.12449 10.3944 7.01744 10.398Z",fill:"currentColor"},null,-1),st=[nt];function rt(t,e,i,n,r,s){return w(),S("svg",v({width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.pti()),st,16)}Ie.render=rt;var Ce={name:"FilterIcon",extends:ye,computed:{pathId:function(){return"pv_icon_clip_".concat(de())}}},ot=["clipPath"],at=L("path",{d:"M8.64708 14H5.35296C5.18981 13.9979 5.03395 13.9321 4.91858 13.8167C4.8032 13.7014 4.73745 13.5455 4.73531 13.3824V7L0.329431 0.98C0.259794 0.889466 0.217389 0.780968 0.20718 0.667208C0.19697 0.553448 0.219379 0.439133 0.271783 0.337647C0.324282 0.236453 0.403423 0.151519 0.500663 0.0920138C0.597903 0.0325088 0.709548 0.000692754 0.823548 0H13.1765C13.2905 0.000692754 13.4021 0.0325088 13.4994 0.0920138C13.5966 0.151519 13.6758 0.236453 13.7283 0.337647C13.7807 0.439133 13.8031 0.553448 13.7929 0.667208C13.7826 0.780968 13.7402 0.889466 13.6706 0.98L9.26472 7V13.3824C9.26259 13.5455 9.19683 13.7014 9.08146 13.8167C8.96609 13.9321 8.81022 13.9979 8.64708 14ZM5.97061 12.7647H8.02943V6.79412C8.02878 6.66289 8.07229 6.53527 8.15296 6.43177L11.9412 1.23529H2.05884L5.86355 6.43177C5.94422 6.53527 5.98773 6.66289 5.98708 6.79412L5.97061 12.7647Z",fill:"currentColor"},null,-1),lt=[at],ut=["id"],dt=L("rect",{width:"14",height:"14",fill:"white"},null,-1),ct=[dt];function ht(t,e,i,n,r,s){return w(),S("svg",v({width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.pti()),[L("g",{clipPath:"url(#".concat(s.pathId,")")},lt,8,ot),L("defs",null,[L("clipPath",{id:"".concat(s.pathId)},ct,8,ut)])],16)}Ce.render=ht;var pt=ke(),ft=` .p-virtualscroller { position: relative; overflow: auto; contain: strict; transform: translateZ(0); will-change: scroll-position; outline: 0 none; } .p-virtualscroller-content { position: absolute; top: 0; left: 0; /* contain: content; */ min-height: 100%; min-width: 100%; will-change: transform; } .p-virtualscroller-spacer { position: absolute; top: 0; left: 0; height: 1px; width: 1px; transform-origin: 0 0; pointer-events: none; } .p-virtualscroller .p-virtualscroller-loader { position: sticky; top: 0; left: 0; width: 100%; height: 100%; } .p-virtualscroller-loader.p-component-overlay { display: flex; align-items: center; justify-content: center; } .p-virtualscroller-loading-icon { font-size: 2rem; } .p-virtualscroller-loading-icon.p-icon { width: 2rem; height: 2rem; } .p-virtualscroller-horizontal > .p-virtualscroller-content { display: flex; } /* Inline */ .p-virtualscroller-inline .p-virtualscroller-content { position: static; } `,pe=be.extend({name:"virtualscroller",css:ft}),mt={name:"BaseVirtualScroller",extends:Oe,props:{id:{type:String,default:null},style:null,class:null,items:{type:Array,default:null},itemSize:{type:[Number,Array],default:0},scrollHeight:null,scrollWidth:null,orientation:{type:String,default:"vertical"},numToleratedItems:{type:Number,default:null},delay:{type:Number,default:0},resizeDelay:{type:Number,default:10},lazy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loaderDisabled:{type:Boolean,default:!1},columns:{type:Array,default:null},loading:{type:Boolean,default:!1},showSpacer:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!1},tabindex:{type:Number,default:0},inline:{type:Boolean,default:!1},step:{type:Number,default:0},appendOnly:{type:Boolean,default:!1},autoSize:{type:Boolean,default:!1}},style:pe,provide:function(){return{$parentInstance:this}},beforeMount:function(){pe.loadStyle()}};function U(t){"@babel/helpers - typeof";return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},U(t)}function fe(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function G(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"auto",r=this.isBoth(),s=this.isHorizontal(),o=this.first,a=this.calculateNumItems(),d=a.numToleratedItems,u=this.getContentPosition(),l=this.itemSize,c=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,g=arguments.length>1?arguments[1]:void 0;return m<=g?0:m},p=function(m,g,k){return m*g+k},f=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return i.scrollTo({left:m,top:g,behavior:n})},h=r?{rows:0,cols:0}:0,b=!1;r?(h={rows:c(e[0],d[0]),cols:c(e[1],d[1])},f(p(h.cols,l[1],u.left),p(h.rows,l[0],u.top)),b=h.rows!==o.rows||h.cols!==o.cols):(h=c(e,d),s?f(p(h,l,u.left),0):f(0,p(h,l,u.top)),b=h!==o),this.isRangeChanged=b,this.first=h},scrollInView:function(e,i){var n=this,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"auto";if(i){var s=this.isBoth(),o=this.isHorizontal(),a=this.getRenderedRange(),d=a.first,u=a.viewport,l=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return n.scrollTo({left:O,top:m,behavior:r})},c=i==="to-start",p=i==="to-end";if(c){if(s)u.first.rows-d.rows>e[0]?l(u.first.cols*this.itemSize[1],(u.first.rows-1)*this.itemSize[0]):u.first.cols-d.cols>e[1]&&l((u.first.cols-1)*this.itemSize[1],u.first.rows*this.itemSize[0]);else if(u.first-d>e){var f=(u.first-1)*this.itemSize;o?l(f,0):l(0,f)}}else if(p){if(s)u.last.rows-d.rows<=e[0]+1?l(u.first.cols*this.itemSize[1],(u.first.rows+1)*this.itemSize[0]):u.last.cols-d.cols<=e[1]+1&&l((u.first.cols+1)*this.itemSize[1],u.first.rows*this.itemSize[0]);else if(u.last-d<=e+1){var h=(u.first+1)*this.itemSize;o?l(h,0):l(0,h)}}}else this.scrollToIndex(e,r)},getRenderedRange:function(){var e=function(c,p){return Math.floor(c/(p||c))},i=this.first,n=0;if(this.element){var r=this.isBoth(),s=this.isHorizontal(),o=this.element.scrollTop,a=o.scrollTop,d=o.scrollLeft;if(r)i={rows:e(a,this.itemSize[0]),cols:e(d,this.itemSize[1])},n={rows:i.rows+this.numItemsInViewport.rows,cols:i.cols+this.numItemsInViewport.cols};else{var u=s?d:a;i=e(u,this.itemSize),n=i+this.numItemsInViewport}}return{first:this.first,last:this.last,viewport:{first:i,last:n}}},calculateNumItems:function(){var e=this.isBoth(),i=this.isHorizontal(),n=this.itemSize,r=this.getContentPosition(),s=this.element?this.element.offsetWidth-r.left:0,o=this.element?this.element.offsetHeight-r.top:0,a=function(p,f){return Math.ceil(p/(f||p))},d=function(p){return Math.ceil(p/2)},u=e?{rows:a(o,n[0]),cols:a(s,n[1])}:a(i?s:o,n),l=this.d_numToleratedItems||(e?[d(u.rows),d(u.cols)]:d(u));return{numItemsInViewport:u,numToleratedItems:l}},calculateOptions:function(){var e=this,i=this.isBoth(),n=this.first,r=this.calculateNumItems(),s=r.numItemsInViewport,o=r.numToleratedItems,a=function(l,c,p){var f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return e.getLast(l+c+(l0&&arguments[0]!==void 0?arguments[0]:0,i=arguments.length>1?arguments[1]:void 0;return this.items?Math.min(i?(this.columns||this.items[0]).length:this.items.length,e):0},getContentPosition:function(){if(this.content){var e=getComputedStyle(this.content),i=parseFloat(e.paddingLeft)+Math.max(parseFloat(e.left)||0,0),n=parseFloat(e.paddingRight)+Math.max(parseFloat(e.right)||0,0),r=parseFloat(e.paddingTop)+Math.max(parseFloat(e.top)||0,0),s=parseFloat(e.paddingBottom)+Math.max(parseFloat(e.bottom)||0,0);return{left:i,right:n,top:r,bottom:s,x:i+n,y:r+s}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},setSize:function(){var e=this;if(this.element){var i=this.isBoth(),n=this.isHorizontal(),r=this.element.parentElement,s=this.scrollWidth||"".concat(this.element.offsetWidth||r.offsetWidth,"px"),o=this.scrollHeight||"".concat(this.element.offsetHeight||r.offsetHeight,"px"),a=function(u,l){return e.element.style[u]=l};i||n?(a("height",o),a("width",s)):a("height",o)}},setSpacerSize:function(){var e=this,i=this.items;if(i){var n=this.isBoth(),r=this.isHorizontal(),s=this.getContentPosition(),o=function(d,u,l){var c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;return e.spacerStyle=G(G({},e.spacerStyle),Le({},"".concat(d),(u||[]).length*l+c+"px"))};n?(o("height",i,this.itemSize[0],s.y),o("width",this.columns||i[1],this.itemSize[1],s.x)):r?o("width",this.columns||i,this.itemSize,s.x):o("height",i,this.itemSize,s.y)}},setContentPosition:function(e){var i=this;if(this.content&&!this.appendOnly){var n=this.isBoth(),r=this.isHorizontal(),s=e?e.first:this.first,o=function(l,c){return l*c},a=function(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return i.contentStyle=G(G({},i.contentStyle),{transform:"translate3d(".concat(l,"px, ").concat(c,"px, 0)")})};if(n)a(o(s.cols,this.itemSize[1]),o(s.rows,this.itemSize[0]));else{var d=o(s,this.itemSize);r?a(d,0):a(0,d)}}},onScrollPositionChange:function(e){var i=this,n=e.target,r=this.isBoth(),s=this.isHorizontal(),o=this.getContentPosition(),a=function(I,z){return I?I>z?I-z:I:0},d=function(I,z){return Math.floor(I/(z||I))},u=function(I,z,N,J,R,B){return I<=R?R:B?N-J-R:z+R-1},l=function(I,z,N,J,R,B,Z){return I<=B?0:Math.max(0,Z?Iz?N:I-2*B)},c=function(I,z,N,J,R,B){var Z=z+J+2*R;return I>=R&&(Z+=R+1),i.getLast(Z,B)},p=a(n.scrollTop,o.top),f=a(n.scrollLeft,o.left),h=r?{rows:0,cols:0}:0,b=this.last,O=!1,m=this.lastScrollPos;if(r){var g=this.lastScrollPos.top<=p,k=this.lastScrollPos.left<=f;if(!this.appendOnly||this.appendOnly&&(g||k)){var C={rows:d(p,this.itemSize[0]),cols:d(f,this.itemSize[1])},P={rows:u(C.rows,this.first.rows,this.last.rows,this.numItemsInViewport.rows,this.d_numToleratedItems[0],g),cols:u(C.cols,this.first.cols,this.last.cols,this.numItemsInViewport.cols,this.d_numToleratedItems[1],k)};h={rows:l(C.rows,P.rows,this.first.rows,this.last.rows,this.numItemsInViewport.rows,this.d_numToleratedItems[0],g),cols:l(C.cols,P.cols,this.first.cols,this.last.cols,this.numItemsInViewport.cols,this.d_numToleratedItems[1],k)},b={rows:c(C.rows,h.rows,this.last.rows,this.numItemsInViewport.rows,this.d_numToleratedItems[0]),cols:c(C.cols,h.cols,this.last.cols,this.numItemsInViewport.cols,this.d_numToleratedItems[1],!0)},O=h.rows!==this.first.rows||b.rows!==this.last.rows||h.cols!==this.first.cols||b.cols!==this.last.cols||this.isRangeChanged,m={top:p,left:f}}}else{var M=s?f:p,F=this.lastScrollPos<=M;if(!this.appendOnly||this.appendOnly&&F){var K=d(M,this.itemSize),oe=u(K,this.first,this.last,this.numItemsInViewport,this.d_numToleratedItems,F);h=l(K,oe,this.first,this.last,this.numItemsInViewport,this.d_numToleratedItems,F),b=c(K,h,this.last,this.numItemsInViewport,this.d_numToleratedItems),O=h!==this.first||b!==this.last||this.isRangeChanged,m=M}}return{first:h,last:b,isRangeChanged:O,scrollPos:m}},onScrollChange:function(e){var i=this.onScrollPositionChange(e),n=i.first,r=i.last,s=i.isRangeChanged,o=i.scrollPos;if(s){var a={first:n,last:r};if(this.setContentPosition(a),this.first=n,this.last=r,this.lastScrollPos=o,this.$emit("scroll-index-change",a),this.lazy&&this.isPageChanged(n)){var d={first:this.step?Math.min(this.getPageByFirst(n)*this.step,this.items.length-this.step):n,last:Math.min(this.step?(this.getPageByFirst(n)+1)*this.step:r,this.items.length)},u=this.lazyLoadState.first!==d.first||this.lazyLoadState.last!==d.last;u&&this.$emit("lazy-load",d),this.lazyLoadState=d}}},onScroll:function(e){var i=this;if(this.$emit("scroll",e),this.delay&&this.isPageChanged()){if(this.scrollTimeout&&clearTimeout(this.scrollTimeout),!this.d_loading&&this.showLoader){var n=this.onScrollPositionChange(e),r=n.isRangeChanged,s=r||(this.step?this.isPageChanged():!1);s&&(this.d_loading=!0)}this.scrollTimeout=setTimeout(function(){i.onScrollChange(e),i.d_loading&&i.showLoader&&(!i.lazy||i.loading===void 0)&&(i.d_loading=!1,i.page=i.getPageByFirst())},this.delay)}else this.onScrollChange(e)},onResize:function(){var e=this;this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){if(y.isVisible(e.element)){var i=e.isBoth(),n=e.isVertical(),r=e.isHorizontal(),s=[y.getWidth(e.element),y.getHeight(e.element)],o=s[0],a=s[1],d=o!==e.defaultWidth,u=a!==e.defaultHeight,l=i?d||u:r?d:n?u:!1;l&&(e.d_numToleratedItems=e.numToleratedItems,e.defaultWidth=o,e.defaultHeight=a,e.defaultContentWidth=y.getWidth(e.content),e.defaultContentHeight=y.getHeight(e.content),e.init())}},this.resizeDelay)},bindResizeListener:function(){this.resizeListener||(this.resizeListener=this.onResize.bind(this),window.addEventListener("resize",this.resizeListener),window.addEventListener("orientationchange",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),window.removeEventListener("orientationchange",this.resizeListener),this.resizeListener=null)},getOptions:function(e){var i=(this.items||[]).length,n=this.isBoth()?this.first.rows+e:this.first+e;return{index:n,count:i,first:n===0,last:n===i-1,even:n%2===0,odd:n%2!==0}},getLoaderOptions:function(e,i){var n=this.loaderArr.length;return G({index:e,count:n,first:e===0,last:e===n-1,even:e%2===0,odd:e%2!==0},i)},getPageByFirst:function(e){return Math.floor(((e??this.first)+this.d_numToleratedItems*4)/(this.step||1))},isPageChanged:function(e){return this.step?this.page!==this.getPageByFirst(e??this.first):!0},setContentEl:function(e){this.content=e||this.content||y.findSingle(this.element,'[data-pc-section="content"]')},elementRef:function(e){this.element=e},contentRef:function(e){this.content=e}},computed:{containerClass:function(){return["p-virtualscroller",this.class,{"p-virtualscroller-inline":this.inline,"p-virtualscroller-both p-both-scroll":this.isBoth(),"p-virtualscroller-horizontal p-horizontal-scroll":this.isHorizontal()}]},contentClass:function(){return["p-virtualscroller-content",{"p-virtualscroller-loading":this.d_loading}]},loaderClass:function(){return["p-virtualscroller-loader",{"p-component-overlay":!this.$slots.loader}]},loadedItems:function(){var e=this;return this.items&&!this.d_loading?this.isBoth()?this.items.slice(this.appendOnly?0:this.first.rows,this.last.rows).map(function(i){return e.columns?i:i.slice(e.appendOnly?0:e.first.cols,e.last.cols)}):this.isHorizontal()&&this.columns?this.items:this.items.slice(this.appendOnly?0:this.first,this.last):[]},loadedRows:function(){return this.d_loading?this.loaderDisabled?this.loaderArr:[]:this.loadedItems},loadedColumns:function(){if(this.columns){var e=this.isBoth(),i=this.isHorizontal();if(e||i)return this.d_loading&&this.loaderDisabled?e?this.loaderArr[0]:this.loaderArr:this.columns.slice(e?this.first.cols:this.first,e?this.last.cols:this.last)}return this.columns}},components:{SpinnerIcon:we}},yt=["tabindex"];function bt(t,e,i,n,r,s){var o=ee("SpinnerIcon");return t.disabled?(w(),S(W,{key:1},[T(t.$slots,"default"),T(t.$slots,"content",{items:t.items,rows:t.items,columns:s.loadedColumns})],64)):(w(),S("div",v({key:0,ref:s.elementRef,class:s.containerClass,tabindex:t.tabindex,style:t.style,onScroll:e[0]||(e[0]=function(){return s.onScroll&&s.onScroll.apply(s,arguments)})},t.ptm("root"),{"data-pc-name":"virtualscroller"}),[T(t.$slots,"content",{styleClass:s.contentClass,items:s.loadedItems,getItemOptions:s.getOptions,loading:r.d_loading,getLoaderOptions:s.getLoaderOptions,itemSize:t.itemSize,rows:s.loadedRows,columns:s.loadedColumns,contentRef:s.contentRef,spacerStyle:r.spacerStyle,contentStyle:r.contentStyle,vertical:s.isVertical(),horizontal:s.isHorizontal(),both:s.isBoth()},function(){return[L("div",v({ref:s.contentRef,class:s.contentClass,style:r.contentStyle},t.ptm("content")),[(w(!0),S(W,null,ne(s.loadedItems,function(a,d){return T(t.$slots,"item",{key:d,item:a,options:s.getOptions(d)})}),128))],16)]}),t.showSpacer?(w(),S("div",v({key:0,class:"p-virtualscroller-spacer",style:r.spacerStyle},t.ptm("spacer")),null,16)):H("",!0),!t.loaderDisabled&&t.showLoader&&r.d_loading?(w(),S("div",v({key:1,class:s.loaderClass},t.ptm("loader")),[t.$slots&&t.$slots.loader?(w(!0),S(W,{key:0},ne(r.loaderArr,function(a,d){return T(t.$slots,"loader",{key:d,options:s.getLoaderOptions(d,s.isBoth()&&{numCols:t.d_numItemsInViewport.cols})})}),128)):H("",!0),T(t.$slots,"loadingicon",{},function(){return[te(o,v({spin:"",class:"p-virtualscroller-loading-icon"},t.ptm("loadingIcon")),null,16)]})],16)):H("",!0)],16,yt))}Te.render=bt;var wt=` @layer primevue { .p-dropdown { display: inline-flex; cursor: pointer; position: relative; user-select: none; } .p-dropdown-clear-icon { position: absolute; top: 50%; margin-top: -0.5rem; } .p-dropdown-trigger { display: flex; align-items: center; justify-content: center; flex-shrink: 0; } .p-dropdown-label { display: block; white-space: nowrap; overflow: hidden; flex: 1 1 auto; width: 1%; text-overflow: ellipsis; cursor: pointer; } .p-dropdown-label-empty { overflow: hidden; opacity: 0; } input.p-dropdown-label { cursor: default; } .p-dropdown .p-dropdown-panel { min-width: 100%; } .p-dropdown-panel { position: absolute; top: 0; left: 0; } .p-dropdown-items-wrapper { overflow: auto; } .p-dropdown-item { cursor: pointer; font-weight: normal; white-space: nowrap; position: relative; overflow: hidden; } .p-dropdown-item-group { cursor: auto; } .p-dropdown-items { margin: 0; padding: 0; list-style-type: none; } .p-dropdown-filter { width: 100%; } .p-dropdown-filter-container { position: relative; } .p-dropdown-filter-icon { position: absolute; top: 50%; margin-top: -0.5rem; } .p-fluid .p-dropdown { display: flex; } .p-fluid .p-dropdown .p-dropdown-label { width: 1%; } } `,Ot={root:function(e){var i=e.instance,n=e.props,r=e.state;return["p-dropdown p-component p-inputwrapper",{"p-disabled":n.disabled,"p-dropdown-clearable":n.showClear&&!n.disabled,"p-focus":r.focused,"p-inputwrapper-filled":i.hasSelectedOption,"p-inputwrapper-focus":r.focused||r.overlayVisible,"p-overlay-open":r.overlayVisible}]},input:function(e){var i=e.instance,n=e.props;return["p-dropdown-label p-inputtext",{"p-placeholder":!n.editable&&i.label===n.placeholder,"p-dropdown-label-empty":!n.editable&&!i.$slots.value&&(i.label==="p-emptylabel"||i.label.length===0)}]},clearIcon:"p-dropdown-clear-icon",trigger:"p-dropdown-trigger",loadingicon:"p-dropdown-trigger-icon",dropdownIcon:"p-dropdown-trigger-icon",panel:function(e){var i=e.instance;return["p-dropdown-panel p-component",{"p-input-filled":i.$primevue.config.inputStyle==="filled","p-ripple-disabled":i.$primevue.config.ripple===!1}]},header:"p-dropdown-header",filterContainer:"p-dropdown-filter-container",filterInput:"p-dropdown-filter p-inputtext p-component",filterIcon:"p-dropdown-filter-icon",wrapper:"p-dropdown-items-wrapper",list:"p-dropdown-items",itemGroup:"p-dropdown-item-group",item:function(e){var i=e.instance,n=e.state,r=e.option,s=e.focusedOption;return["p-dropdown-item",{"p-highlight":i.isSelected(r),"p-focus":n.focusedOptionIndex===s,"p-disabled":i.isOptionDisabled(r)}]},emptyMessage:"p-dropdown-empty-message"},St=be.extend({name:"dropdown",css:wt,classes:Ot}),It={name:"BaseDropdown",extends:Oe,props:{modelValue:null,options:Array,optionLabel:[String,Function],optionValue:[String,Function],optionDisabled:[String,Function],optionGroupLabel:[String,Function],optionGroupChildren:[String,Function],scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:{type:String,default:null},disabled:{type:Boolean,default:!1},dataKey:null,showClear:{type:Boolean,default:!1},inputId:{type:String,default:null},inputClass:{type:[String,Object],default:null},inputStyle:{type:Object,default:null},inputProps:{type:null,default:null},panelClass:{type:[String,Object],default:null},panelStyle:{type:Object,default:null},panelProps:{type:null,default:null},filterInputProps:{type:null,default:null},clearIconProps:{type:null,default:null},appendTo:{type:String,default:"body"},loading:{type:Boolean,default:!1},clearIcon:{type:String,default:void 0},dropdownIcon:{type:String,default:void 0},filterIcon:{type:String,default:void 0},loadingIcon:{type:String,default:void 0},resetFilterOnHide:{type:Boolean,default:!1},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},autoFilterFocus:{type:Boolean,default:!1},selectOnFocus:{type:Boolean,default:!1},filterMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},style:St,provide:function(){return{$parentInstance:this}}};function X(t){"@babel/helpers - typeof";return X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(t)}function Ct(t){return Mt(t)||Pt(t)||Tt(t)||Lt()}function Lt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tt(t,e){if(t){if(typeof t=="string")return ce(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return ce(t,e)}}function Pt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Mt(t){if(Array.isArray(t))return ce(t)}function ce(t,e){(e==null||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i2&&arguments[2]!==void 0?arguments[2]:!0,r=this.getOptionValue(i);this.updateModel(e,r),n&&this.hide(!0)},onOptionMouseMove:function(e,i){this.focusOnHover&&this.changeFocusedOptionIndex(e,i)},onFilterChange:function(e){var i=e.target.value;this.filterValue=i,this.focusedOptionIndex=-1,this.$emit("filter",{originalEvent:e,value:i}),!this.virtualScrollerDisabled&&this.virtualScroller.scrollToIndex(0)},onFilterKeyDown:function(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e,!0);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,!0);break;case"Home":this.onHomeKey(e,!0);break;case"End":this.onEndKey(e,!0);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e,!0);break}},onFilterBlur:function(){this.focusedOptionIndex=-1},onFilterUpdated:function(){this.overlayVisible&&this.alignOverlay()},onOverlayClick:function(e){pt.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown:function(e){switch(e.code){case"Escape":this.onEscapeKey(e);break}},onDeleteKey:function(e){this.showClear&&(this.updateModel(e,null),e.preventDefault())},onArrowDownKey:function(e){var i=this.focusedOptionIndex!==-1?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.changeFocusedOptionIndex(e,i),!this.overlayVisible&&this.show(),e.preventDefault()},onArrowUpKey:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e.altKey&&!i)this.focusedOptionIndex!==-1&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{var n=this.focusedOptionIndex!==-1?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.changeFocusedOptionIndex(e,n),!this.overlayVisible&&this.show(),e.preventDefault()}},onArrowLeftKey:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i&&(this.focusedOptionIndex=-1)},onHomeKey:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i?(e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1):(this.changeFocusedOptionIndex(e,this.findFirstOptionIndex()),!this.overlayVisible&&this.show()),e.preventDefault()},onEndKey:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(i){var n=e.currentTarget,r=n.value.length;n.setSelectionRange(r,r),this.focusedOptionIndex=-1}else this.changeFocusedOptionIndex(e,this.findLastOptionIndex()),!this.overlayVisible&&this.show();e.preventDefault()},onPageUpKey:function(e){this.scrollInView(0),e.preventDefault()},onPageDownKey:function(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey:function(e){this.overlayVisible?(this.focusedOptionIndex!==-1&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.hide()):this.onArrowDownKey(e),e.preventDefault()},onSpaceKey:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;!i&&this.onEnterKey(e)},onEscapeKey:function(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i||(this.overlayVisible&&this.hasFocusableElements()?(y.focus(this.$refs.firstHiddenFocusableElementOnOverlay),e.preventDefault()):(this.focusedOptionIndex!==-1&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(this.filter)))},onBackspaceKey:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i&&!this.overlayVisible&&this.show()},onOverlayEnter:function(e){ae.set("overlay",e,this.$primevue.config.zIndex.overlay),y.addStyles(e,{position:"absolute",top:"0",left:"0"}),this.alignOverlay(),this.scrollInView(),this.autoFilterFocus&&y.focus(this.$refs.filterInput)},onOverlayAfterEnter:function(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave:function(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave:function(e){ae.clear(e)},alignOverlay:function(){this.appendTo==="self"?y.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=y.getOuterWidth(this.$el)+"px",y.absolutePosition(this.overlay,this.$el))},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(i){e.overlayVisible&&e.overlay&&!e.$el.contains(i.target)&&!e.overlay.contains(i.target)&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new Ee(this.$refs.container,function(){e.overlayVisible&&e.hide()})),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.overlayVisible&&!y.isTouchDevice()&&e.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},hasFocusableElements:function(){return y.getFocusableElements(this.overlay,':not([data-p-hidden-focusable="true"])').length>0},isOptionMatched:function(e){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},isValidOption:function(e){return E.isNotEmpty(e)&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption:function(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected:function(e){return this.isValidOption(e)&&E.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},findFirstOptionIndex:function(){var e=this;return this.visibleOptions.findIndex(function(i){return e.isValidOption(i)})},findLastOptionIndex:function(){var e=this;return E.findLastIndex(this.visibleOptions,function(i){return e.isValidOption(i)})},findNextOptionIndex:function(e){var i=this,n=e-1?n+e+1:e},findPrevOptionIndex:function(e){var i=this,n=e>0?E.findLastIndex(this.visibleOptions.slice(0,e),function(r){return i.isValidOption(r)}):-1;return n>-1?n:e},findSelectedOptionIndex:function(){var e=this;return this.hasSelectedOption?this.visibleOptions.findIndex(function(i){return e.isValidSelectedOption(i)}):-1},findFirstFocusedOptionIndex:function(){var e=this.findSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex:function(){var e=this.findSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},searchOptions:function(e,i){var n=this;this.searchValue=(this.searchValue||"")+i;var r=-1,s=!1;return this.focusedOptionIndex!==-1?(r=this.visibleOptions.slice(this.focusedOptionIndex).findIndex(function(o){return n.isOptionMatched(o)}),r=r===-1?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex(function(o){return n.isOptionMatched(o)}):r+this.focusedOptionIndex):r=this.visibleOptions.findIndex(function(o){return n.isOptionMatched(o)}),r!==-1&&(s=!0),r===-1&&this.focusedOptionIndex===-1&&(r=this.findFirstFocusedOptionIndex()),r!==-1&&this.changeFocusedOptionIndex(e,r),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout(function(){n.searchValue="",n.searchTimeout=null},500),s},changeFocusedOptionIndex:function(e,i){this.focusedOptionIndex!==i&&(this.focusedOptionIndex=i,this.scrollInView(),this.selectOnFocus&&this.onOptionSelect(e,this.visibleOptions[i],!1))},scrollInView:function(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:-1,n=i!==-1?"".concat(this.id,"_").concat(i):this.focusedOptionId,r=y.findSingle(this.list,'li[id="'.concat(n,'"]'));r?r.scrollIntoView&&r.scrollIntoView({block:"nearest",inline:"start"}):this.virtualScrollerDisabled||setTimeout(function(){e.virtualScroller&&e.virtualScroller.scrollToIndex(i!==-1?i:e.focusedOptionIndex)},0)},autoUpdateModel:function(){this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex],!1))},updateModel:function(e,i){this.$emit("update:modelValue",i),this.$emit("change",{originalEvent:e,value:i})},flatOptions:function(e){var i=this;return(e||[]).reduce(function(n,r,s){n.push({optionGroup:r,group:!0,index:s});var o=i.getOptionGroupChildren(r);return o&&o.forEach(function(a){return n.push(a)}),n},[])},overlayRef:function(e){this.overlay=e},listRef:function(e,i){this.list=e,i&&i(e)},virtualScrollerRef:function(e){this.virtualScroller=e}},computed:{visibleOptions:function(){var e=this,i=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];if(this.filterValue){var n=ze.filter(i,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(this.optionGroupLabel){var r=this.options||[],s=[];return r.forEach(function(o){var a=e.getOptionGroupChildren(o),d=a.filter(function(u){return n.includes(u)});d.length>0&&s.push(ge(ge({},o),{},Pe({},typeof e.optionGroupChildren=="string"?e.optionGroupChildren:"items",Ct(d))))}),this.flatOptions(s)}return n}return i},hasSelectedOption:function(){return E.isNotEmpty(this.modelValue)},label:function(){var e=this.findSelectedOptionIndex();return e!==-1?this.getOptionLabel(this.visibleOptions[e]):this.placeholder||"p-emptylabel"},editableInputValue:function(){var e=this.findSelectedOptionIndex();return e!==-1?this.getOptionLabel(this.visibleOptions[e]):this.modelValue||""},equalityKey:function(){return this.optionValue?null:this.dataKey},searchFields:function(){return this.filterFields||[this.optionLabel]},filterResultMessageText:function(){return E.isNotEmpty(this.visibleOptions)?this.filterMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptyFilterMessageText},filterMessageText:function(){return this.filterMessage||this.$primevue.config.locale.searchMessage||""},emptyFilterMessageText:function(){return this.emptyFilterMessage||this.$primevue.config.locale.emptySearchMessage||this.$primevue.config.locale.emptyFilterMessage||""},emptyMessageText:function(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage||""},selectionMessageText:function(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText:function(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText:function(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}","1"):this.emptySelectionMessageText},focusedOptionId:function(){return this.focusedOptionIndex!==-1?"".concat(this.id,"_").concat(this.focusedOptionIndex):null},ariaSetSize:function(){var e=this;return this.visibleOptions.filter(function(i){return!e.isOptionGroup(i)}).length},virtualScrollerDisabled:function(){return!this.virtualScrollerOptions}},directives:{ripple:Fe},components:{VirtualScroller:Te,Portal:Ve,TimesIcon:xe,ChevronDownIcon:Ie,SpinnerIcon:we,FilterIcon:Ce}};function q(t){"@babel/helpers - typeof";return q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(t)}function ve(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function V(t){for(var e=1;e[]},current:{type:String}},setup(t){const e=$();return Ke(e,i=>{var r;const n=(r=e.value)==null?void 0:r.lastElementChild;n&&n.scrollIntoView({behavior:"smooth",block:"end"})},{childList:!0}),(i,n)=>(w(),S("section",{class:D([i.$style["lru-wrapper"]])},[L("section",{class:D([i.$style.lru])},[L("ul",{class:D([i.$style["lru-content"]]),ref_key:"listRef",ref:e},[(w(!0),S(W,null,ne(t.contents,(r,s)=>(w(),S("li",{key:r+s,class:D([i.$style["lru-item"]])},x(r),3))),128)),t.current?(w(),S("li",{key:0,class:D([i.$style["lru-item"]])},x(t.current),3)):H("",!0),L("li",{class:D([i.$style.hidden])},null,2)],2)],2)],2))}}),Gt="_lru_1ctad_2",Ut="_hidden_1ctad_63",Xt={"lru-wrapper":"_lru-wrapper_1ctad_2",lru:Gt,"lru-content":"_lru-content_1ctad_33","lru-item":"_lru-item_1ctad_43",hidden:Ut},qt={$style:Xt},ii=We(jt,[["__cssModules",qt]]);export{ii as S,Se as W,Zt as X,zt as a,Yt as b,ti as c,Qt as d,$t as s,ei as u,_t as v};