@ddict/popup 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/popup.umd.js CHANGED
@@ -1 +1,35 @@
1
- (function(d,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(d=typeof globalThis!="undefined"?globalThis:d||self,t(d.Popup={},d.Vue))})(this,function(d,t){"use strict";var y={isRTL:N};function N(e){return["ar","fa","iw","yi","ur","pa"].indexOf(e)>-1}var m=(e,s)=>{const l=e.__vccOpts||e;for(const[c,r]of s)l[c]=r;return l};const w={props:{select:{type:Object,default:null}},emits:["select"],data(){return{src:"",target:"",recents:{src:[],target:[]}}},watch:{select(e){!e||(this.src=e.src,this.target=e.target,this.loadRecents())}},methods:{onRecentSrc(e){this.src=e,this.onSelect()},onRecentTarget(e){this.target=e,this.onSelect()},swap(){if(this.src==="auto"||!this.select.srcs[this.target]||!this.select.targets[this.src])return;const e=this.target;this.target=this.src,this.src=e,this.onSelect()},onSelect(){const e=JSON.parse(JSON.stringify(this.select));e.src=this.src,e.target=this.target,this.$emit("select",e),this.saveRecents(this.src,this.target)},loadRecents(){const e=JSON.parse(localStorage.getItem("recents"));!e||(this.recents=e)},saveRecents(e,s){this.recents.src.includes(e)||this.recents.src.push(e),this.recents.target.includes(s)||this.recents.target.push(s),this.recents.src.length>3&&this.recents.src.shift(),this.recents.target.length>3&&this.recents.target.shift(),localStorage.setItem("recents",JSON.stringify(this.recents))}}},V={key:0,class:"flex flex-row"},u=["value"],$={key:0,xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},x=[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"},null,-1)],b={key:1,xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},S=[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 7l5 5m0 0l-5 5m5-5H6"},null,-1)],C=["value"],T={key:1,class:"flex flex-row"},L={class:"grow"},M=["onClick"],D={class:"grow"},j=["onClick"];function I(e,s,l,c,r,a){return t.openBlock(),t.createElementBlock(t.Fragment,null,[l.select?(t.openBlock(),t.createElementBlock("div",V,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":s[0]||(s[0]=n=>r.src=n),class:"select select-bordered grow",onChange:s[1]||(s[1]=(...n)=>a.onSelect&&a.onSelect(...n))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.select.srcs,(n,o)=>(t.openBlock(),t.createElementBlock("option",{value:o,key:o},t.toDisplayString(n),9,u))),128))],544),[[t.vModelSelect,r.src]]),t.createElementVNode("button",{class:"grow-0 ml-2 mr-2",onClick:s[2]||(s[2]=(...n)=>a.swap&&a.swap(...n))},[r.src!="auto"?(t.openBlock(),t.createElementBlock("svg",$,x)):t.createCommentVNode("",!0),r.src=="auto"?(t.openBlock(),t.createElementBlock("svg",b,S)):t.createCommentVNode("",!0)]),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":s[3]||(s[3]=n=>r.target=n),class:"select select-bordered grow",onChange:s[4]||(s[4]=(...n)=>a.onSelect&&a.onSelect(...n))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.select.targets,(n,o)=>(t.openBlock(),t.createElementBlock("option",{value:o,key:o},t.toDisplayString(n),9,C))),128))],544),[[t.vModelSelect,r.target]])])):t.createCommentVNode("",!0),l.select&&r.src&&r.target&&r.recents?(t.openBlock(),t.createElementBlock("div",T,[t.createElementVNode("div",L,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.recents.src,n=>(t.openBlock(),t.createElementBlock("span",{key:n,onClick:o=>a.onRecentSrc(n),class:"badge badge-sm ml-1 badge-outline"},t.toDisplayString(l.select.srcs[n]),9,M))),128))]),t.createElementVNode("div",D,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.recents.target,n=>(t.openBlock(),t.createElementBlock("span",{key:n,onClick:o=>a.onRecentTarget(n),class:"badge badge-sm ml-1 float-right mt-1"},t.toDisplayString(l.select.targets[n]),9,j))),128))])])):t.createCommentVNode("",!0)],64)}var H=m(w,[["render",I]]),k={INPUT_MAX_LENGTH:5e3,INPUT_DELAY:1e3},h={init:z,autoResize:R};const g=100,E=600,O=10;function z(e,s){s&&(e.maxlength=s),e.spellcheck=!1,p(e,g)}function R(e){if(e.value==""){p(e,g);return}if(e.scrollHeight<g){p(e,g);return}if(e.scrollHeight>E){p(e,E);return}e.style.height.replace("px","")>e.scrollHeight||p(e,e.scrollHeight+O)}function p(e,s){e.style.height=`${s}px`}const B="auto_translate",A={props:{data:{type:Object,default:null},tts:{type:Object,default:null},replace:{type:String,default:""}},data(){return{input:"",INPUT_MAX_LENGTH:k.INPUT_MAX_LENGTH,input_timeout:null,player:new Audio,playing:!1,ttsIndex:0,auto_translate:!0,firstTime:!0}},computed:{rtl(){return this.data?y.isRTL(this.data.src):!1}},watch:{replace(e){this.input=e,(this.firstTime||!this.auto_translate)&&setTimeout(()=>{this.$refs.input.select()},100),this.firstTime=!1},tts(){this.ttsIndex=0},auto_translate(e){e&&this.translate(),localStorage.setItem(B,e)}},mounted(){h.init(this.$refs.input,k.INPUT_MAX_LENGTH),this.player.addEventListener("ended",()=>{if(this.ttsIndex++,this.ttsIndex>=this.tts.src.length){this.stop();return}this.play()}),this.$refs.input.addEventListener("input",()=>{h.autoResize(this.$refs.input),!!this.auto_translate&&(clearTimeout(this.input_timeout),this.input_timeout=setTimeout(this.translate,k.INPUT_DELAY))}),this.$refs.input.addEventListener("keyup",e=>{this.auto_translate||e&&e.keyCode===13&&this.translate()})},created(){localStorage.getItem(B)==="false"&&(this.auto_translate=!1)},methods:{play(){!this.tts.src||(this.player.src=this.tts.src[this.ttsIndex],this.playing=!0,this.player.play().catch(()=>{this.playing=!1}))},stop(){this.playing=!1,this.ttsIndex=0,this.player.pause()},clear(){this.$emit("clear"),this.input="",h.init(this.$refs.input,k.INPUT_MAX_LENGTH),this.$refs.input.focus()},translate(){if(!this.input){this.clear();return}this.$emit("translate",this.input)}}},F={class:"relative indicator w-full"},P={key:0,class:"absolute top-0 left-0 w-4/5 ml-2 text-sm truncate"},U=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 inline",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"})],-1)],G=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 inline",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})],-1)],J={key:2,class:"ml-1"},X={key:0},Y=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)],q={class:"cursor-pointer label justify-start"},K=t.createElementVNode("span",{class:"ml-1 label-text text-xs"},"Auto translate",-1);function Q(e,s,l,c,r,a){return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",F,[l.data?(t.openBlock(),t.createElementBlock("div",P,[r.playing?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:"pointer",onClick:s[0]||(s[0]=(...n)=>a.play&&a.play(...n))},U)),r.playing?(t.openBlock(),t.createElementBlock("span",{key:1,class:"pointer",onClick:s[1]||(s[1]=(...n)=>a.stop&&a.stop(...n))},G)):t.createCommentVNode("",!0),l.data.ddictSrc?(t.openBlock(),t.createElementBlock("span",J,t.toDisplayString(l.data.ddictSrc),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.sentences,(n,o)=>(t.openBlock(),t.createElementBlock("span",{key:`${n.src_translit}-${o}`,class:"italic"},[n.src_translit?(t.openBlock(),t.createElementBlock("span",X," \u2015 "+t.toDisplayString(n.src_translit),1)):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),r.input!=""?(t.openBlock(),t.createElementBlock("div",{key:1,onClick:s[2]||(s[2]=(...n)=>a.clear&&a.clear(...n)),class:"indicator-item m-3"},Y)):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("textarea",{id:"input",ref:"input","onUpdate:modelValue":s[3]||(s[3]=n=>r.input=n),class:"text-lg textarea textarea-bordered w-full pt-5",style:t.normalizeStyle({"text-align":a.rtl?"right":"left"}),autofocus:""},null,4),[[t.vModelText,r.input,void 0,{trim:!0}]])]),t.createElementVNode("label",q,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":s[4]||(s[4]=n=>r.auto_translate=n),type:"checkbox",class:"toggle toggle-xs"},null,512),[[t.vModelCheckbox,r.auto_translate]]),K])])}var W=m(A,[["render",Q]]);const Z={props:{data:{type:Object,default:null},tts:{type:Object,default:null}},data(){return{player:new Audio,playing:!1,copied:!1,ttsIndex:0}},computed:{rtl(){return this.data?y.isRTL(this.data.target):!1}},watch:{data(e){if(!e){this.$refs.input.value="",h.init(this.$refs.input);return}this.$refs.input.value=e.sentences.map(s=>s.trans).join(""),h.autoResize(this.$refs.input)},tts(){this.ttsIndex=0}},mounted(){h.init(this.$refs.input),h.autoResize(this.$refs.input),this.player.addEventListener("ended",()=>{if(this.ttsIndex++,this.ttsIndex>=this.tts.target.length){this.stop();return}this.play()})},methods:{play(){!this.tts.target||(this.player.src=this.tts.target[this.ttsIndex],this.playing=!0,this.player.play().catch(()=>{this.playing=!1}))},stop(){this.playing=!1,this.ttsIndex=0,this.player.pause()},copy(){const e=this.$refs.input.value;!e||(navigator.clipboard.writeText(e),this.copied=!0,setTimeout(()=>{this.copied=!1},500))}}},v={class:"relative indicator w-full"},tt={key:0,class:"absolute top-0 left-0 w-2/3 ml-2 text-sm truncate"},et=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 inline",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"})],-1)],st=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 inline",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})],-1)],nt={key:2,class:"ml-1"},lt={key:0,xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},rt=[t.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"},null,-1)],at={key:1,xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},ot=[t.createElementVNode("path",{d:"M8 2a1 1 0 000 2h2a1 1 0 100-2H8z"},null,-1),t.createElementVNode("path",{d:"M3 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v6h-4.586l1.293-1.293a1 1 0 00-1.414-1.414l-3 3a1 1 0 000 1.414l3 3a1 1 0 001.414-1.414L10.414 13H15v3a2 2 0 01-2 2H5a2 2 0 01-2-2V5zM15 11h2a1 1 0 110 2h-2v-2z"},null,-1)],ct={key:0,class:"label justify-end"},it=[t.createElementVNode("span",{class:"text-xs"},"Powered by Google Translate.",-1)];function dt(e,s,l,c,r,a){return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",v,[l.data?(t.openBlock(),t.createElementBlock("div",tt,[r.playing?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:"pointer",onClick:s[0]||(s[0]=(...n)=>a.play&&a.play(...n))},et)),r.playing?(t.openBlock(),t.createElementBlock("span",{key:1,class:"pointer",onClick:s[1]||(s[1]=(...n)=>a.stop&&a.stop(...n))},st)):t.createCommentVNode("",!0),l.data.ddictTarget?(t.openBlock(),t.createElementBlock("span",nt,t.toDisplayString(l.data.ddictTarget),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),l.data?(t.openBlock(),t.createElementBlock("div",{key:1,onClick:s[2]||(s[2]=(...n)=>a.copy&&a.copy(...n)),class:"indicator-item m-3"},[r.copied?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("svg",lt,rt)),r.copied?(t.openBlock(),t.createElementBlock("svg",at,ot)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("textarea",{ref:"input",class:"text-lg textarea textarea-bordered w-full pt-5",style:t.normalizeStyle({"text-align":a.rtl?"right":"left"}),readonly:"",spellcheck:"false"},null,4)]),l.data?(t.openBlock(),t.createElementBlock("p",ct,it)):t.createCommentVNode("",!0)],64)}var mt=m(Z,[["render",dt]]);const ht={props:{data:{type:Object,default:null}},data(){return{name:"Definitions"}}},pt={key:0},_t={class:"card-body p-4"},kt={class:"card-title font-bold"},gt={class:"list-decimal"},ft={class:"capitalize font-bold"},yt=t.createElementVNode("br",null,null,-1),Et={class:"italic"};function Bt(e,s,l,c,r,a){return l.data.definitions?(t.openBlock(),t.createElementBlock("div",pt,[t.createElementVNode("div",_t,[t.createElementVNode("h2",kt,t.toDisplayString(r.name),1),t.createElementVNode("ul",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.definitions,(n,o)=>(t.openBlock(),t.createElementBlock("li",{key:`${n.pos}-${o}`,class:"mb-2"},[t.createElementVNode("ul",gt,[t.createElementVNode("h5",ft,t.toDisplayString(n.pos),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.entry,(i,_)=>(t.openBlock(),t.createElementBlock("li",{key:`${i.definition_id}-${_}`,class:"ml-5 mb-2"},[t.createElementVNode("span",null,t.toDisplayString(i.gloss),1),yt,t.createElementVNode("small",Et,'"'+t.toDisplayString(i.example)+'"',1)]))),128))])]))),128))])])])):t.createCommentVNode("",!0)}var Nt=m(ht,[["render",Bt]]);const wt={props:{data:{type:Object,default:null}},data(){return{name:"Translations"}},methods:{translate(e){this.$emit("translate",e)}}},Vt={key:0},ut={class:"card-body p-4"},$t={class:"card-title"},xt={class:"capitalize font-bold"},bt=["onClick"],St={class:"italic"};function Ct(e,s,l,c,r,a){return l.data.dict?(t.openBlock(),t.createElementBlock("div",Vt,[t.createElementVNode("div",ut,[t.createElementVNode("h2",$t,t.toDisplayString(r.name),1),t.createElementVNode("ul",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.dict,(n,o)=>(t.openBlock(),t.createElementBlock("li",{key:`${n.pos}-${o}`,class:"mb-2"},[t.createElementVNode("h5",xt,t.toDisplayString(n.pos),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.entry,(i,_)=>(t.openBlock(),t.createElementBlock("div",{key:`${i.word}-${_}`},[t.createElementVNode("span",{class:"badge bg-neutral",onClick:f=>a.translate(i.word)},t.toDisplayString(i.word),9,bt),t.createElementVNode("small",St," \u2015 "+t.toDisplayString(i.reverse_translation.join(", ")),1)]))),128))]))),128))])])])):t.createCommentVNode("",!0)}var Tt=m(wt,[["render",Ct]]);const Lt={props:{data:{type:Object,default:null}},data(){return{name:"Examples"}}},Mt={key:0},Dt={class:"card-body p-4"},jt={class:"card-title font-bold"},It={class:"list-disc"},Ht=["innerHTML"];function Ot(e,s,l,c,r,a){return l.data.examples&&l.data.examples.example?(t.openBlock(),t.createElementBlock("div",Mt,[t.createElementVNode("div",Dt,[t.createElementVNode("h2",jt,t.toDisplayString(r.name),1),t.createElementVNode("ul",It,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.examples.example,(n,o)=>(t.openBlock(),t.createElementBlock("li",{key:`${n.definition_id}-${o}`,class:"ml-4 mb-2",innerHTML:n.text},null,8,Ht))),128))])])])):t.createCommentVNode("",!0)}var zt=m(Lt,[["render",Ot]]);const Rt={props:{data:{type:Object,default:null}},data(){return{name:"Synonyms"}}},At={key:0},Ft={class:"card-body p-4"},Pt={class:"card-title font-bold"},Ut={class:"capitalize font-bold"},Gt=["onClick"],Jt=t.createElementVNode("span",null,null,-1);function Xt(e,s,l,c,r,a){return l.data.synsets?(t.openBlock(),t.createElementBlock("div",At,[t.createElementVNode("div",Ft,[t.createElementVNode("h2",Pt,t.toDisplayString(r.name),1),t.createElementVNode("ul",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.synsets,(n,o)=>(t.openBlock(),t.createElementBlock("li",{key:`${n.pos}-${o}`,class:"mb-2"},[t.createElementVNode("h5",Ut,t.toDisplayString(n.pos),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.entry,(i,_)=>(t.openBlock(),t.createElementBlock("div",{key:`${i.definition_id}-${_}`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.synonym,(f,oe)=>(t.openBlock(),t.createElementBlock("span",{key:`${f}-${oe}`},[t.createElementVNode("span",{class:"badge bg-neutral mr-1",onClick:Be=>e.$emit("translate",f)},t.toDisplayString(f),9,Gt),Jt]))),128))]))),128))]))),128))])])])):t.createCommentVNode("",!0)}var Yt=m(Rt,[["render",Xt]]);const qt={props:{data:{type:Object,default:null}},data(){return{name:"See also"}}},Kt={key:0},Qt={class:"card-body p-4"},Wt={class:"card-title font-bold"},Zt=["onClick"],vt=t.createElementVNode("span",null,null,-1);function te(e,s,l,c,r,a){return l.data.related_words&&l.data.related_words.word?(t.openBlock(),t.createElementBlock("div",Kt,[t.createElementVNode("div",Qt,[t.createElementVNode("h2",Wt,t.toDisplayString(r.name),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.data.related_words.word,(n,o)=>(t.openBlock(),t.createElementBlock("span",{key:`${n}-${o}`},[t.createElementVNode("span",{class:"badge bg-neutral",onClick:i=>e.$emit("translate",n)},t.toDisplayString(n),9,Zt),vt]))),128))])])):t.createCommentVNode("",!0)}var ee=m(qt,[["render",te]]);const se={class:"p-2"},ne={class:"mt-2 grid grid-cols-1 md:grid-cols-2 gap-3"},le={class:"w-full"},re={class:"w-full"},ae=Object.assign({name:"Popup",props:{export_data:{type:Object,default:null},export_select:{type:Object,default:null},export_tts:{type:Object,default:null}},data(){return{data:null,select:null,tts:null,replace:""}},computed:{rtl(){return this.data?y.isRTL(this.data.target):!1}},watch:{export_data(e){this.data=e,e.text&&this.replace!=e.text&&(this.replace=e.text)},export_select(e){this.select=e},export_tts(e){this.tts=e}},methods:{clear(){this.data=null,this.$emit("clear")},translateReplace(e){return this.translate(e,!0)},translateSwap(e){return this.translate(e,!0,!0)},translate(e,s,l){if(l){if(!this.data.src||this.data.src==="auto"||!this.data.target)return;const c=JSON.parse(JSON.stringify(this.select));c.src=this.data.target,c.target=this.data.src,this.$emit("srctarget",c)}window.scrollTo(0,0),this.clear(),s&&(this.replace=e),this.$emit("translate",e)},onSelect(e){if(this.$emit("srctarget",e),this.data){const s=this.data.sentences.map(l=>l.orig).join("");this.$emit("translate",s)}}}},{setup(e){return(s,l)=>(t.openBlock(),t.createElementBlock("div",se,[t.createVNode(H,{select:s.select,onSelect:s.onSelect},null,8,["select","onSelect"]),t.createElementVNode("div",ne,[t.createElementVNode("div",le,[t.createVNode(W,{data:s.data,tts:s.tts,replace:s.replace,onTranslate:s.translate,onClear:s.clear},null,8,["data","tts","replace","onTranslate","onClear"])]),t.createElementVNode("div",re,[t.createVNode(mt,{data:s.data,tts:s.tts},null,8,["data","tts"])])]),s.data?(t.openBlock(),t.createElementBlock("div",{key:0,class:"mt-3 grid grid-cols-1 md:grid-cols-3 gap-3",style:t.normalizeStyle({"text-align":s.rtl?"right":"left"})},[t.createVNode(Nt,{class:"card border",data:s.data},null,8,["data"]),t.createVNode(Tt,{class:"card border",data:s.data,onTranslate:s.translateSwap},null,8,["data","onTranslate"]),t.createVNode(Yt,{class:"card border",data:s.data,onTranslate:s.translateReplace},null,8,["data","onTranslate"]),t.createVNode(ee,{class:"card border",data:s.data,onTranslate:s.translateReplace},null,8,["data","onTranslate"])],4)):t.createCommentVNode("",!0),s.data?(t.openBlock(),t.createElementBlock("div",{key:1,class:"mt-5 grid grid-cols-1 gap-6",style:t.normalizeStyle({"text-align":s.rtl?"right":"left"})},[t.createVNode(zt,{class:"card border",data:s.data},null,8,["data"])],4)):t.createCommentVNode("",!0)]))}});d.default=ae,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"});
1
+ (function(q,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(q=typeof globalThis<"u"?globalThis:q||self,i(q.Popup={},q.Vue))})(this,function(q,i){"use strict";function At(n,l){for(var e=0;e<l.length;e++){const o=l[e];if(typeof o!="string"&&!Array.isArray(o)){for(const r in o)if(r!=="default"&&!(r in n)){const s=Object.getOwnPropertyDescriptor(o,r);s&&Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>o[r]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}function oe(n,l,e){let o=e.initialDeps??[],r;return()=>{var s,d,u,p;let _;e.key&&((s=e.debug)!=null&&s.call(e))&&(_=Date.now());const g=n();if(!(g.length!==o.length||g.some((c,f)=>o[f]!==c)))return r;o=g;let a;if(e.key&&((d=e.debug)!=null&&d.call(e))&&(a=Date.now()),r=l(...g),e.key&&((u=e.debug)!=null&&u.call(e))){const c=Math.round((Date.now()-_)*100)/100,f=Math.round((Date.now()-a)*100)/100,h=f/16,v=(m,w)=>{for(m=String(m);m.length<w;)m=" "+m;return m};console.info(`%c⏱ ${v(f,5)} /${v(c,5)} ms`,`
2
+ font-size: .6rem;
3
+ font-weight: bold;
4
+ color: hsl(${Math.max(0,Math.min(120-120*h,120))}deg 100% 31%);`,e==null?void 0:e.key)}return(p=e==null?void 0:e.onChange)==null||p.call(e,r),r}}function xe(n,l){if(n===void 0)throw new Error("Unexpected undefined");return n}const Ot=(n,l)=>Math.abs(n-l)<1,kt=(n,l,e)=>{let o;return function(...r){n.clearTimeout(o),o=n.setTimeout(()=>l.apply(this,r),e)}},It=n=>n,Ct=n=>{const l=Math.max(n.startIndex-n.overscan,0),e=Math.min(n.endIndex+n.overscan,n.count-1),o=[];for(let r=l;r<=e;r++)o.push(r);return o},Pt=(n,l)=>{const e=n.scrollElement;if(!e)return;const o=n.targetWindow;if(!o)return;const r=d=>{const{width:u,height:p}=d;l({width:Math.round(u),height:Math.round(p)})};if(r(e.getBoundingClientRect()),!o.ResizeObserver)return()=>{};const s=new o.ResizeObserver(d=>{const u=d[0];if(u!=null&&u.borderBoxSize){const p=u.borderBoxSize[0];if(p){r({width:p.inlineSize,height:p.blockSize});return}}r(e.getBoundingClientRect())});return s.observe(e,{box:"border-box"}),()=>{s.unobserve(e)}},Me={passive:!0},Vt=typeof window>"u"?!0:"onscrollend"in window,$t=(n,l)=>{const e=n.scrollElement;if(!e)return;const o=n.targetWindow;if(!o)return;let r=0;const s=Vt?()=>{}:kt(o,()=>{l(r,!1)},n.options.isScrollingResetDelay),d=_=>()=>{r=e[n.options.horizontal?"scrollLeft":"scrollTop"],s(),l(r,_)},u=d(!0),p=d(!1);return p(),e.addEventListener("scroll",u,Me),e.addEventListener("scrollend",p,Me),()=>{e.removeEventListener("scroll",u),e.removeEventListener("scrollend",p)}},Nt=(n,l,e)=>{if(l!=null&&l.borderBoxSize){const o=l.borderBoxSize[0];if(o)return Math.round(o[e.options.horizontal?"inlineSize":"blockSize"])}return Math.round(n.getBoundingClientRect()[e.options.horizontal?"width":"height"])},Rt=(n,{adjustments:l=0,behavior:e},o)=>{var r,s;const d=n+l;(s=(r=o.scrollElement)==null?void 0:r.scrollTo)==null||s.call(r,{[o.options.horizontal?"left":"top"]:d,behavior:e})};class Mt{constructor(l){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const o=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(r=>{r.forEach(s=>{this._measureElement(s.target,s)})}));return{disconnect:()=>{var r;return(r=o())==null?void 0:r.disconnect()},observe:r=>{var s;return(s=o())==null?void 0:s.observe(r,{box:"border-box"})},unobserve:r=>{var s;return(s=o())==null?void 0:s.unobserve(r)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([o,r])=>{typeof r>"u"&&delete e[o]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:It,rangeExtractor:Ct,onChange:()=>{},measureElement:Nt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,...e}},this.notify=(e,o)=>{var r,s;const{startIndex:d,endIndex:u}=this.range??{startIndex:void 0,endIndex:void 0},p=this.calculateRange();(e||d!==(p==null?void 0:p.startIndex)||u!==(p==null?void 0:p.endIndex))&&((s=(r=this.options).onChange)==null||s.call(r,this,o))},this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.observer.disconnect(),this.elementsCache.clear()},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const o=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==o){if(this.cleanup(),!o){this.notify(!1,!1);return}this.scrollElement=o,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.notify(!1,!1)})),this.unsubs.push(this.options.observeElementOffset(this,(r,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r;const d=this.isScrolling;this.isScrolling=s,this.notify(d!==s,s)}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,o)=>{const r=new Map,s=new Map;for(let d=o-1;d>=0;d--){const u=e[d];if(r.has(u.lane))continue;const p=s.get(u.lane);if(p==null||u.end>p.end?s.set(u.lane,u):u.end<p.end&&r.set(u.lane,!0),r.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((d,u)=>d.end===u.end?d.index-u.index:d.end-u.end)[0]:void 0},this.getMeasurementOptions=oe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(e,o,r,s,d)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:o,scrollMargin:r,getItemKey:s,enabled:d}),{key:!1}),this.getMeasurements=oe(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:o,scrollMargin:r,getItemKey:s,enabled:d},u)=>{var p;if(!d)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(t=>{this.itemSizeCache.set(t.key,t.size)}));const _=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const g=this.measurementsCache.slice(0,_);for(let t=_;t<e;t++){let a=(p=this.measurementsCache[t])==null?void 0:p.measureElement;a||(a=I=>{const x=s(t),C=this.elementsCache.get(x);if(!I){C&&(this.observer.unobserve(C),this.elementsCache.delete(x));return}C!==I&&(C&&this.observer.unobserve(C),this.observer.observe(I),this.elementsCache.set(x,I)),I.isConnected&&this.resizeItem(t,this.options.measureElement(I,void 0,this))});const c=s(t),f=this.options.lanes===1?g[t-1]:this.getFurthestMeasurement(g,t),h=f?f.end+this.options.gap:o+r,v=u.get(c),m=typeof v=="number"?v:this.options.estimateSize(t),w=h+m,O=f?f.lane:t%this.options.lanes;g[t]={index:t,start:h,size:m,end:w,key:c,lane:O,measureElement:a}}return this.measurementsCache=g,g},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=oe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(e,o,r)=>this.range=e.length>0&&o>0?Dt({measurements:e,outerSize:o,scrollOffset:r}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getIndexes=oe(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(e,o,r,s)=>o===null?[]:e({startIndex:o.startIndex,endIndex:o.endIndex,overscan:r,count:s}),{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:()=>this.options.debug}),this.indexFromElement=e=>{const o=this.options.indexAttribute,r=e.getAttribute(o);return r?parseInt(r,10):(console.warn(`Missing attribute name '${o}={index}' on measured element.`),-1)},this._measureElement=(e,o)=>{const r=this.indexFromElement(e),s=this.getMeasurements()[r];if(!s||!e.isConnected){this.elementsCache.forEach((u,p)=>{u===e&&(this.observer.unobserve(e),this.elementsCache.delete(p))});return}const d=this.elementsCache.get(s.key);d!==e&&(d&&this.observer.unobserve(d),this.observer.observe(e),this.elementsCache.set(s.key,e)),this.resizeItem(r,this.options.measureElement(e,o,this))},this.resizeItem=(e,o)=>{const r=this.getMeasurements()[e];if(!r)return;const s=this.itemSizeCache.get(r.key)??r.size,d=o-s;d!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,d,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",d),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=d,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,o)),this.notify(!0,!1))},this.measureElement=e=>{e&&this._measureElement(e,void 0)},this.getVirtualItems=oe(()=>[this.getIndexes(),this.getMeasurements()],(e,o)=>{const r=[];for(let s=0,d=e.length;s<d;s++){const u=e[s],p=o[u];r.push(p)}return r},{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const o=this.getMeasurements();if(o.length!==0)return xe(o[De(0,o.length-1,r=>xe(o[r]).start,e)])},this.getOffsetForAlignment=(e,o)=>{const r=this.getSize(),s=this.getScrollOffset();o==="auto"&&(e<=s?o="start":e>=s+r?o="end":o="start"),o==="start"?e=e:o==="end"?e=e-r:o==="center"&&(e=e-r/2);const d=this.options.horizontal?"scrollWidth":"scrollHeight",p=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[d]:this.scrollElement[d]:0)-r;return Math.max(Math.min(p,e),0)},this.getOffsetForIndex=(e,o="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const r=this.getMeasurements()[e];if(!r)return;const s=this.getSize(),d=this.getScrollOffset();if(o==="auto")if(r.end>=d+s-this.options.scrollPaddingEnd)o="end";else if(r.start<=d+this.options.scrollPaddingStart)o="start";else return[d,o];const u=o==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(u,o),o]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(e,{align:o="start",behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,o),{adjustments:void 0,behavior:r})},this.scrollToIndex=(e,{align:o="auto",behavior:r}={})=>{e=Math.max(0,Math.min(e,this.options.count-1)),this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const s=this.getOffsetForIndex(e,o);if(!s)return;const[d,u]=s;this._scrollToOffset(d,{adjustments:void 0,behavior:r}),r!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(e))){const[_]=xe(this.getOffsetForIndex(e,u));Ot(_,this.getScrollOffset())||this.scrollToIndex(e,{align:u,behavior:r})}else this.scrollToIndex(e,{align:u,behavior:r})}))},this.scrollBy=(e,{behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:o})},this.getTotalSize=()=>{var e;const o=this.getMeasurements();let r;return o.length===0?r=this.options.paddingStart:r=this.options.lanes===1?((e=o[o.length-1])==null?void 0:e.end)??0:Math.max(...o.slice(-this.options.lanes).map(s=>s.end)),r-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(e,{adjustments:o,behavior:r})=>{this.options.scrollToFn(e,{behavior:r,adjustments:o},this)},this.measure=()=>{var e,o;this.itemSizeCache=new Map,(o=(e=this.options).onChange)==null||o.call(e,this,!1)},this.setOptions(l)}}const De=(n,l,e,o)=>{for(;n<=l;){const r=(n+l)/2|0,s=e(r);if(s<o)n=r+1;else if(s>o)l=r-1;else return r}return n>0?n-1:0};function Dt({measurements:n,outerSize:l,scrollOffset:e}){const o=n.length-1,s=De(0,o,u=>n[u].start,e);let d=s;for(;d<o&&n[d].end<e+l;)d++;return{startIndex:s,endIndex:d}}function Lt(n){const l=new Mt(i.unref(n)),e=i.shallowRef(l),o=l._didMount();return i.watch(()=>i.unref(n).getScrollElement(),r=>{r&&l._willUpdate()},{immediate:!0}),i.watch(()=>i.unref(n),r=>{l.setOptions({...r,onChange:(s,d)=>{var u;i.triggerRef(e),(u=r.onChange)==null||u.call(r,s,d)}}),l._willUpdate(),i.triggerRef(e)},{immediate:!0}),i.onScopeDispose(o),e}function Bt(n){return Lt(i.computed(()=>({observeElementRect:Pt,observeElementOffset:$t,scrollToFn:Rt,...i.unref(n)})))}function Ft(n,l,e){let o=i.ref(e==null?void 0:e.value),r=i.computed(()=>n.value!==void 0);return[i.computed(()=>r.value?n.value:o.value),function(s){return r.value||(o.value=s),l==null?void 0:l(s)}]}function jt(n){typeof queueMicrotask=="function"?queueMicrotask(n):Promise.resolve().then(n).catch(l=>setTimeout(()=>{throw l}))}function de(){let n=[],l={addEventListener(e,o,r,s){return e.addEventListener(o,r,s),l.add(()=>e.removeEventListener(o,r,s))},requestAnimationFrame(...e){let o=requestAnimationFrame(...e);l.add(()=>cancelAnimationFrame(o))},nextFrame(...e){l.requestAnimationFrame(()=>{l.requestAnimationFrame(...e)})},setTimeout(...e){let o=setTimeout(...e);l.add(()=>clearTimeout(o))},microTask(...e){let o={current:!0};return jt(()=>{o.current&&e[0]()}),l.add(()=>{o.current=!1})},style(e,o,r){let s=e.style.getPropertyValue(o);return Object.assign(e.style,{[o]:r}),this.add(()=>{Object.assign(e.style,{[o]:s})})},group(e){let o=de();return e(o),this.add(()=>o.dispose())},add(e){return n.push(e),()=>{let o=n.indexOf(e);if(o>=0)for(let r of n.splice(o,1))r()}},dispose(){for(let e of n.splice(0))e()}};return l}function Ht(){let n=de();return i.onUnmounted(()=>n.dispose()),n}function Ut(){let n=Ht();return l=>{n.dispose(),n.nextFrame(l)}}let Gt=Symbol("headlessui.useid"),zt=0;function re(){return i.inject(Gt,()=>`${++zt}`)()}function V(n){var l;if(n==null||n.value==null)return null;let e=(l=n.value.$el)!=null?l:n.value;return e instanceof Node?e:null}function G(n,l,...e){if(n in l){let r=l[n];return typeof r=="function"?r(...e):r}let o=new Error(`Tried to handle "${n}" but there is no handler defined. Only defined handlers are: ${Object.keys(l).map(r=>`"${r}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,G),o}var Wt=Object.defineProperty,qt=(n,l,e)=>l in n?Wt(n,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[l]=e,Le=(n,l,e)=>(qt(n,typeof l!="symbol"?l+"":l,e),e);let Xt=class{constructor(){Le(this,"current",this.detect()),Le(this,"currentId",0)}set(l){this.current!==l&&(this.currentId=0,this.current=l)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}},Se=new Xt;function Ee(n){if(Se.isServer)return null;if(n instanceof Node)return n.ownerDocument;if(n!=null&&n.hasOwnProperty("value")){let l=V(n);if(l)return l.ownerDocument}return document}let Be=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(n=>`${n}:not([tabindex='-1'])`).join(",");var Yt=(n=>(n[n.First=1]="First",n[n.Previous=2]="Previous",n[n.Next=4]="Next",n[n.Last=8]="Last",n[n.WrapAround=16]="WrapAround",n[n.NoScroll=32]="NoScroll",n))(Yt||{}),Qt=(n=>(n[n.Error=0]="Error",n[n.Overflow=1]="Overflow",n[n.Success=2]="Success",n[n.Underflow=3]="Underflow",n))(Qt||{}),Zt=(n=>(n[n.Previous=-1]="Previous",n[n.Next=1]="Next",n))(Zt||{}),Fe=(n=>(n[n.Strict=0]="Strict",n[n.Loose=1]="Loose",n))(Fe||{});function Kt(n,l=0){var e;return n===((e=Ee(n))==null?void 0:e.body)?!1:G(l,{0(){return n.matches(Be)},1(){let o=n;for(;o!==null;){if(o.matches(Be))return!0;o=o.parentElement}return!1}})}var Jt=(n=>(n[n.Keyboard=0]="Keyboard",n[n.Mouse=1]="Mouse",n))(Jt||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",n=>{n.metaKey||n.altKey||n.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",n=>{n.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:n.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function en(n,l=e=>e){return n.slice().sort((e,o)=>{let r=l(e),s=l(o);if(r===null||s===null)return 0;let d=r.compareDocumentPosition(s);return d&Node.DOCUMENT_POSITION_FOLLOWING?-1:d&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function tn(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function nn(){return/Android/gi.test(window.navigator.userAgent)}function je(){return tn()||nn()}function fe(n,l,e){Se.isServer||i.watchEffect(o=>{document.addEventListener(n,l,e),o(()=>document.removeEventListener(n,l,e))})}function on(n,l,e){Se.isServer||i.watchEffect(o=>{window.addEventListener(n,l,e),o(()=>window.removeEventListener(n,l,e))})}function rn(n,l,e=i.computed(()=>!0)){function o(s,d){if(!e.value||s.defaultPrevented)return;let u=d(s);if(u===null||!u.getRootNode().contains(u))return;let p=function _(g){return typeof g=="function"?_(g()):Array.isArray(g)||g instanceof Set?g:[g]}(n);for(let _ of p){if(_===null)continue;let g=_ instanceof HTMLElement?_:V(_);if(g!=null&&g.contains(u)||s.composed&&s.composedPath().includes(g))return}return!Kt(u,Fe.Loose)&&u.tabIndex!==-1&&s.preventDefault(),l(s,u)}let r=i.ref(null);fe("pointerdown",s=>{var d,u;e.value&&(r.value=((u=(d=s.composedPath)==null?void 0:d.call(s))==null?void 0:u[0])||s.target)},!0),fe("mousedown",s=>{var d,u;e.value&&(r.value=((u=(d=s.composedPath)==null?void 0:d.call(s))==null?void 0:u[0])||s.target)},!0),fe("click",s=>{je()||r.value&&(o(s,()=>r.value),r.value=null)},!0),fe("touchend",s=>o(s,()=>s.target instanceof HTMLElement?s.target:null),!0),on("blur",s=>o(s,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function He(n,l){if(n)return n;let e=l??"button";if(typeof e=="string"&&e.toLowerCase()==="button")return"button"}function an(n,l){let e=i.ref(He(n.value.type,n.value.as));return i.onMounted(()=>{e.value=He(n.value.type,n.value.as)}),i.watchEffect(()=>{var o;e.value||V(l)&&V(l)instanceof HTMLButtonElement&&!((o=V(l))!=null&&o.hasAttribute("type"))&&(e.value="button")}),e}function Ue(n){return[n.screenX,n.screenY]}function ln(){let n=i.ref([-1,-1]);return{wasMoved(l){let e=Ue(l);return n.value[0]===e[0]&&n.value[1]===e[1]?!1:(n.value=e,!0)},update(l){n.value=Ue(l)}}}function sn({container:n,accept:l,walk:e,enabled:o}){i.watchEffect(()=>{let r=n.value;if(!r||o!==void 0&&!o.value)return;let s=Ee(n);if(!s)return;let d=Object.assign(p=>l(p),{acceptNode:l}),u=s.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,d,!1);for(;u.nextNode();)e(u.currentNode)})}var ae=(n=>(n[n.None=0]="None",n[n.RenderStrategy=1]="RenderStrategy",n[n.Static=2]="Static",n))(ae||{}),un=(n=>(n[n.Unmount=0]="Unmount",n[n.Hidden=1]="Hidden",n))(un||{});function X({visible:n=!0,features:l=0,ourProps:e,theirProps:o,...r}){var s;let d=ze(o,e),u=Object.assign(r,{props:d});if(n||l&2&&d.static)return Te(u);if(l&1){let p=(s=d.unmount)==null||s?0:1;return G(p,{0(){return null},1(){return Te({...r,props:{...d,hidden:!0,style:{display:"none"}}})}})}return Te(u)}function Te({props:n,attrs:l,slots:e,slot:o,name:r}){var s,d;let{as:u,...p}=pe(n,["unmount","static"]),_=(s=e.default)==null?void 0:s.call(e,o),g={};if(o){let t=!1,a=[];for(let[c,f]of Object.entries(o))typeof f=="boolean"&&(t=!0),f===!0&&a.push(c);t&&(g["data-headlessui-state"]=a.join(" "))}if(u==="template"){if(_=Ge(_??[]),Object.keys(p).length>0||Object.keys(l).length>0){let[t,...a]=_??[];if(!dn(t)||a.length>0)throw new Error(['Passing props on "template"!',"",`The current component <${r} /> is rendering a "template".`,"However we need to passthrough the following props:",Object.keys(p).concat(Object.keys(l)).map(h=>h.trim()).filter((h,v,m)=>m.indexOf(h)===v).sort((h,v)=>h.localeCompare(v)).map(h=>` - ${h}`).join(`
5
+ `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".',"Render a single element as the child so that we can forward the props onto that element."].map(h=>` - ${h}`).join(`
6
+ `)].join(`
7
+ `));let c=ze((d=t.props)!=null?d:{},p,g),f=i.cloneVNode(t,c,!0);for(let h in c)h.startsWith("on")&&(f.props||(f.props={}),f.props[h]=c[h]);return f}return Array.isArray(_)&&_.length===1?_[0]:_}return i.h(u,Object.assign({},p,g),{default:()=>_})}function Ge(n){return n.flatMap(l=>l.type===i.Fragment?Ge(l.children):[l])}function ze(...n){if(n.length===0)return{};if(n.length===1)return n[0];let l={},e={};for(let o of n)for(let r in o)r.startsWith("on")&&typeof o[r]=="function"?(e[r]!=null||(e[r]=[]),e[r].push(o[r])):l[r]=o[r];if(l.disabled||l["aria-disabled"])return Object.assign(l,Object.fromEntries(Object.keys(e).map(o=>[o,void 0])));for(let o in e)Object.assign(l,{[o](r,...s){let d=e[o];for(let u of d){if(r instanceof Event&&r.defaultPrevented)return;u(r,...s)}}});return l}function cn(n){let l=Object.assign({},n);for(let e in l)l[e]===void 0&&delete l[e];return l}function pe(n,l=[]){let e=Object.assign({},n);for(let o of l)o in e&&delete e[o];return e}function dn(n){return n==null?!1:typeof n.type=="string"||typeof n.type=="object"||typeof n.type=="function"}var We=(n=>(n[n.None=1]="None",n[n.Focusable=2]="Focusable",n[n.Hidden=4]="Hidden",n))(We||{});let fn=i.defineComponent({name:"Hidden",props:{as:{type:[Object,String],default:"div"},features:{type:Number,default:1}},setup(n,{slots:l,attrs:e}){return()=>{var o;let{features:r,...s}=n,d={"aria-hidden":(r&2)===2?!0:(o=s["aria-hidden"])!=null?o:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return X({ourProps:d,theirProps:s,slot:{},attrs:e,slots:l,name:"Hidden"})}}}),qe=Symbol("Context");var ie=(n=>(n[n.Open=1]="Open",n[n.Closed=2]="Closed",n[n.Closing=4]="Closing",n[n.Opening=8]="Opening",n))(ie||{});function pn(){return i.inject(qe,null)}function _n(n){i.provide(qe,n)}var L=(n=>(n.Space=" ",n.Enter="Enter",n.Escape="Escape",n.Backspace="Backspace",n.Delete="Delete",n.ArrowLeft="ArrowLeft",n.ArrowUp="ArrowUp",n.ArrowRight="ArrowRight",n.ArrowDown="ArrowDown",n.Home="Home",n.End="End",n.PageUp="PageUp",n.PageDown="PageDown",n.Tab="Tab",n))(L||{}),Xe=(n=>(n[n.Left=0]="Left",n[n.Right=2]="Right",n))(Xe||{});function mn(n){function l(){document.readyState!=="loading"&&(n(),document.removeEventListener("DOMContentLoaded",l))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",l),l())}let Y=[];mn(()=>{function n(l){l.target instanceof HTMLElement&&l.target!==document.body&&Y[0]!==l.target&&(Y.unshift(l.target),Y=Y.filter(e=>e!=null&&e.isConnected),Y.splice(10))}window.addEventListener("click",n,{capture:!0}),window.addEventListener("mousedown",n,{capture:!0}),window.addEventListener("focus",n,{capture:!0}),document.body.addEventListener("click",n,{capture:!0}),document.body.addEventListener("mousedown",n,{capture:!0}),document.body.addEventListener("focus",n,{capture:!0})});function hn(n){throw new Error("Unexpected object: "+n)}var M=(n=>(n[n.First=0]="First",n[n.Previous=1]="Previous",n[n.Next=2]="Next",n[n.Last=3]="Last",n[n.Specific=4]="Specific",n[n.Nothing=5]="Nothing",n))(M||{});function Ye(n,l){let e=l.resolveItems();if(e.length<=0)return null;let o=l.resolveActiveIndex(),r=o??-1;switch(n.focus){case 0:{for(let s=0;s<e.length;++s)if(!l.resolveDisabled(e[s],s,e))return s;return o}case 1:{r===-1&&(r=e.length);for(let s=r-1;s>=0;--s)if(!l.resolveDisabled(e[s],s,e))return s;return o}case 2:{for(let s=r+1;s<e.length;++s)if(!l.resolveDisabled(e[s],s,e))return s;return o}case 3:{for(let s=e.length-1;s>=0;--s)if(!l.resolveDisabled(e[s],s,e))return s;return o}case 4:{for(let s=0;s<e.length;++s)if(l.resolveId(e[s],s,e)===n.id)return s;return o}case 5:return null;default:hn(n)}}function Qe(n={},l=null,e=[]){for(let[o,r]of Object.entries(n))Ke(e,Ze(l,o),r);return e}function Ze(n,l){return n?n+"["+l+"]":l}function Ke(n,l,e){if(Array.isArray(e))for(let[o,r]of e.entries())Ke(n,Ze(l,o.toString()),r);else e instanceof Date?n.push([l,e.toISOString()]):typeof e=="boolean"?n.push([l,e?"1":"0"]):typeof e=="string"?n.push([l,e]):typeof e=="number"?n.push([l,`${e}`]):e==null?n.push([l,""]):Qe(e,l,n)}function vn(n,l){return n===l}var gn=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(gn||{}),bn=(n=>(n[n.Single=0]="Single",n[n.Multi=1]="Multi",n))(bn||{}),yn=(n=>(n[n.Pointer=0]="Pointer",n[n.Focus=1]="Focus",n[n.Other=2]="Other",n))(yn||{});let Je=Symbol("ComboboxContext");function Q(n){let l=i.inject(Je,null);if(l===null){let e=new Error(`<${n} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,Q),e}return l}let et=Symbol("VirtualContext"),wn=i.defineComponent({name:"VirtualProvider",setup(n,{slots:l}){let e=Q("VirtualProvider"),o=i.computed(()=>{let u=V(e.optionsRef);if(!u)return{start:0,end:0};let p=window.getComputedStyle(u);return{start:parseFloat(p.paddingBlockStart||p.paddingTop),end:parseFloat(p.paddingBlockEnd||p.paddingBottom)}}),r=Bt(i.computed(()=>({scrollPaddingStart:o.value.start,scrollPaddingEnd:o.value.end,count:e.virtual.value.options.length,estimateSize(){return 40},getScrollElement(){return V(e.optionsRef)},overscan:12}))),s=i.computed(()=>{var u;return(u=e.virtual.value)==null?void 0:u.options}),d=i.ref(0);return i.watch([s],()=>{d.value+=1}),i.provide(et,e.virtual.value?r:null),()=>[i.h("div",{style:{position:"relative",width:"100%",height:`${r.value.getTotalSize()}px`},ref:u=>{if(u){if(typeof process<"u"&&process.env.JEST_WORKER_ID!==void 0||e.activationTrigger.value===0)return;e.activeOptionIndex.value!==null&&e.virtual.value.options.length>e.activeOptionIndex.value&&r.value.scrollToIndex(e.activeOptionIndex.value)}}},r.value.getVirtualItems().map(u=>i.cloneVNode(l.default({option:e.virtual.value.options[u.index],open:e.comboboxState.value===0})[0],{key:`${d.value}-${u.index}`,"data-index":u.index,"aria-setsize":e.virtual.value.options.length,"aria-posinset":u.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${u.start}px)`,overflowAnchor:"none"}})))]}}),xn=i.defineComponent({name:"Combobox",emits:{"update:modelValue":n=>!0},props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],nullable:!0,default:null},modelValue:{type:[Object,String,Number,Boolean],default:void 0},defaultValue:{type:[Object,String,Number,Boolean],default:void 0},form:{type:String,optional:!0},name:{type:String,optional:!0},nullable:{type:Boolean,default:!1},multiple:{type:[Boolean],default:!1},immediate:{type:[Boolean],default:!1},virtual:{type:Object,default:null}},inheritAttrs:!1,setup(n,{slots:l,attrs:e,emit:o}){let r=i.ref(1),s=i.ref(null),d=i.ref(null),u=i.ref(null),p=i.ref(null),_=i.ref({static:!1,hold:!1}),g=i.ref([]),t=i.ref(null),a=i.ref(2),c=i.ref(!1);function f(b=y=>y){let y=t.value!==null?g.value[t.value]:null,T=b(g.value.slice()),k=T.length>0&&T[0].dataRef.order.value!==null?T.sort(($,F)=>$.dataRef.order.value-F.dataRef.order.value):en(T,$=>V($.dataRef.domRef)),P=y?k.indexOf(y):null;return P===-1&&(P=null),{options:k,activeOptionIndex:P}}let h=i.computed(()=>n.multiple?1:0),v=i.computed(()=>n.nullable),[m,w]=Ft(i.computed(()=>n.modelValue),b=>o("update:modelValue",b),i.computed(()=>n.defaultValue)),O=i.computed(()=>m.value===void 0?G(h.value,{1:[],0:void 0}):m.value),I=null,x=null;function C(b){return G(h.value,{0(){return w==null?void 0:w(b)},1:()=>{let y=i.toRaw(E.value.value).slice(),T=i.toRaw(b),k=y.findIndex(P=>E.compare(T,i.toRaw(P)));return k===-1?y.push(T):y.splice(k,1),w==null?void 0:w(y)}})}let S=i.computed(()=>{});i.watch([S],([b],[y])=>{if(E.virtual.value&&b&&y&&t.value!==null){let T=b.indexOf(y[t.value]);T!==-1?t.value=T:t.value=null}});let E={comboboxState:r,value:O,mode:h,compare(b,y){if(typeof n.by=="string"){let T=n.by;return(b==null?void 0:b[T])===(y==null?void 0:y[T])}return n.by===null?vn(b,y):n.by(b,y)},calculateIndex(b){return E.virtual.value?n.by===null?E.virtual.value.options.indexOf(b):E.virtual.value.options.findIndex(y=>E.compare(y,b)):g.value.findIndex(y=>E.compare(y.dataRef.value,b))},defaultValue:i.computed(()=>n.defaultValue),nullable:v,immediate:i.computed(()=>!1),virtual:i.computed(()=>null),inputRef:d,labelRef:s,buttonRef:u,optionsRef:p,disabled:i.computed(()=>n.disabled),options:g,change(b){w(b)},activeOptionIndex:i.computed(()=>{if(c.value&&t.value===null&&(E.virtual.value?E.virtual.value.options.length>0:g.value.length>0)){if(E.virtual.value){let y=E.virtual.value.options.findIndex(T=>{var k;return!((k=E.virtual.value)!=null&&k.disabled(T))});if(y!==-1)return y}let b=g.value.findIndex(y=>!y.dataRef.disabled);if(b!==-1)return b}return t.value}),activationTrigger:a,optionsPropsRef:_,closeCombobox(){c.value=!1,!n.disabled&&r.value!==1&&(r.value=1,t.value=null)},openCombobox(){if(c.value=!0,!n.disabled&&r.value!==0){if(E.value.value){let b=E.calculateIndex(E.value.value);b!==-1&&(t.value=b)}r.value=0}},setActivationTrigger(b){a.value=b},goToOption(b,y,T){c.value=!1,I!==null&&cancelAnimationFrame(I),I=requestAnimationFrame(()=>{if(n.disabled||p.value&&!_.value.static&&r.value===1)return;if(E.virtual.value){t.value=b===M.Specific?y:Ye({focus:b},{resolveItems:()=>E.virtual.value.options,resolveActiveIndex:()=>{var $,F;return(F=($=E.activeOptionIndex.value)!=null?$:E.virtual.value.options.findIndex(j=>{var R;return!((R=E.virtual.value)!=null&&R.disabled(j))}))!=null?F:null},resolveDisabled:$=>E.virtual.value.disabled($),resolveId(){throw new Error("Function not implemented.")}}),a.value=T??2;return}let k=f();if(k.activeOptionIndex===null){let $=k.options.findIndex(F=>!F.dataRef.disabled);$!==-1&&(k.activeOptionIndex=$)}let P=b===M.Specific?y:Ye({focus:b},{resolveItems:()=>k.options,resolveActiveIndex:()=>k.activeOptionIndex,resolveId:$=>$.id,resolveDisabled:$=>$.dataRef.disabled});t.value=P,a.value=T??2,g.value=k.options})},selectOption(b){let y=g.value.find(k=>k.id===b);if(!y)return;let{dataRef:T}=y;C(T.value)},selectActiveOption(){if(E.activeOptionIndex.value!==null){if(E.virtual.value)C(E.virtual.value.options[E.activeOptionIndex.value]);else{let{dataRef:b}=g.value[E.activeOptionIndex.value];C(b.value)}E.goToOption(M.Specific,E.activeOptionIndex.value)}},registerOption(b,y){let T=i.reactive({id:b,dataRef:y});if(E.virtual.value){g.value.push(T);return}x&&cancelAnimationFrame(x);let k=f(P=>(P.push(T),P));t.value===null&&E.isSelected(y.value.value)&&(k.activeOptionIndex=k.options.indexOf(T)),g.value=k.options,t.value=k.activeOptionIndex,a.value=2,k.options.some(P=>!V(P.dataRef.domRef))&&(x=requestAnimationFrame(()=>{let P=f();g.value=P.options,t.value=P.activeOptionIndex}))},unregisterOption(b,y){if(I!==null&&cancelAnimationFrame(I),y&&(c.value=!0),E.virtual.value){g.value=g.value.filter(k=>k.id!==b);return}let T=f(k=>{let P=k.findIndex($=>$.id===b);return P!==-1&&k.splice(P,1),k});g.value=T.options,t.value=T.activeOptionIndex,a.value=2},isSelected(b){return G(h.value,{0:()=>E.compare(i.toRaw(E.value.value),i.toRaw(b)),1:()=>i.toRaw(E.value.value).some(y=>E.compare(i.toRaw(y),i.toRaw(b)))})},isActive(b){return t.value===E.calculateIndex(b)}};rn([d,u,p],()=>E.closeCombobox(),i.computed(()=>r.value===0)),i.provide(Je,E),_n(i.computed(()=>G(r.value,{0:ie.Open,1:ie.Closed})));let A=i.computed(()=>{var b;return(b=V(d))==null?void 0:b.closest("form")});return i.onMounted(()=>{i.watch([A],()=>{if(!A.value||n.defaultValue===void 0)return;function b(){E.change(n.defaultValue)}return A.value.addEventListener("reset",b),()=>{var y;(y=A.value)==null||y.removeEventListener("reset",b)}},{immediate:!0})}),()=>{var b,y,T;let{name:k,disabled:P,form:$,...F}=n,j={open:r.value===0,disabled:P,activeIndex:E.activeOptionIndex.value,activeOption:E.activeOptionIndex.value===null?null:E.virtual.value?E.virtual.value.options[(b=E.activeOptionIndex.value)!=null?b:0]:(T=(y=E.options.value[E.activeOptionIndex.value])==null?void 0:y.dataRef.value)!=null?T:null,value:O.value};return i.h(i.Fragment,[...k!=null&&O.value!=null?Qe({[k]:O.value}).map(([R,_r])=>i.h(fn,cn({features:We.Hidden,key:R,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:$,disabled:P,name:R,value:_r}))):[],X({theirProps:{...e,...pe(F,["by","defaultValue","immediate","modelValue","multiple","nullable","onUpdate:modelValue","virtual"])},ourProps:{},slot:j,slots:l,attrs:e,name:"Combobox"})])}}});i.defineComponent({name:"ComboboxLabel",props:{as:{type:[Object,String],default:"label"},id:{type:String,default:null}},setup(n,{attrs:l,slots:e}){var o;let r=(o=n.id)!=null?o:`headlessui-combobox-label-${re()}`,s=Q("ComboboxLabel");function d(){var u;(u=V(s.inputRef))==null||u.focus({preventScroll:!0})}return()=>{let u={open:s.comboboxState.value===0,disabled:s.disabled.value},{...p}=n,_={id:r,ref:s.labelRef,onClick:d};return X({ourProps:_,theirProps:p,slot:u,attrs:l,slots:e,name:"ComboboxLabel"})}}});let Sn=i.defineComponent({name:"ComboboxButton",props:{as:{type:[Object,String],default:"button"},id:{type:String,default:null}},setup(n,{attrs:l,slots:e,expose:o}){var r;let s=(r=n.id)!=null?r:`headlessui-combobox-button-${re()}`,d=Q("ComboboxButton");o({el:d.buttonRef,$el:d.buttonRef});function u(g){d.disabled.value||(d.comboboxState.value===0?d.closeCombobox():(g.preventDefault(),d.openCombobox()),i.nextTick(()=>{var t;return(t=V(d.inputRef))==null?void 0:t.focus({preventScroll:!0})}))}function p(g){switch(g.key){case L.ArrowDown:g.preventDefault(),g.stopPropagation(),d.comboboxState.value===1&&d.openCombobox(),i.nextTick(()=>{var t;return(t=d.inputRef.value)==null?void 0:t.focus({preventScroll:!0})});return;case L.ArrowUp:g.preventDefault(),g.stopPropagation(),d.comboboxState.value===1&&(d.openCombobox(),i.nextTick(()=>{d.value.value||d.goToOption(M.Last)})),i.nextTick(()=>{var t;return(t=d.inputRef.value)==null?void 0:t.focus({preventScroll:!0})});return;case L.Escape:if(d.comboboxState.value!==0)return;g.preventDefault(),d.optionsRef.value&&!d.optionsPropsRef.value.static&&g.stopPropagation(),d.closeCombobox(),i.nextTick(()=>{var t;return(t=d.inputRef.value)==null?void 0:t.focus({preventScroll:!0})});return}}let _=an(i.computed(()=>({as:n.as,type:l.type})),d.buttonRef);return()=>{var g,t;let a={open:d.comboboxState.value===0,disabled:d.disabled.value,value:d.value.value},{...c}=n,f={ref:d.buttonRef,id:s,type:_.value,tabindex:"-1","aria-haspopup":"listbox","aria-controls":(g=V(d.optionsRef))==null?void 0:g.id,"aria-expanded":d.comboboxState.value===0,"aria-labelledby":d.labelRef.value?[(t=V(d.labelRef))==null?void 0:t.id,s].join(" "):void 0,disabled:d.disabled.value===!0?!0:void 0,onKeydown:p,onClick:u};return X({ourProps:f,theirProps:c,slot:a,attrs:l,slots:e,name:"ComboboxButton"})}}}),En=i.defineComponent({name:"ComboboxInput",props:{as:{type:[Object,String],default:"input"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},displayValue:{type:Function},defaultValue:{type:String,default:void 0},id:{type:String,default:null}},emits:{change:n=>!0},setup(n,{emit:l,attrs:e,slots:o,expose:r}){var s;let d=(s=n.id)!=null?s:`headlessui-combobox-input-${re()}`,u=Q("ComboboxInput"),p=i.computed(()=>Ee(V(u.inputRef))),_={value:!1};r({el:u.inputRef,$el:u.inputRef});function g(){u.change(null);let x=V(u.optionsRef);x&&(x.scrollTop=0),u.goToOption(M.Nothing)}let t=i.computed(()=>{var x;let C=u.value.value;return V(u.inputRef)?typeof n.displayValue<"u"&&C!==void 0?(x=n.displayValue(C))!=null?x:"":typeof C=="string"?C:"":""});i.onMounted(()=>{i.watch([t,u.comboboxState,p],([x,C],[S,E])=>{if(_.value)return;let A=V(u.inputRef);A&&((E===0&&C===1||x!==S)&&(A.value=x),requestAnimationFrame(()=>{var b;if(_.value||!A||((b=p.value)==null?void 0:b.activeElement)!==A)return;let{selectionStart:y,selectionEnd:T}=A;Math.abs((T??0)-(y??0))===0&&y===0&&A.setSelectionRange(A.value.length,A.value.length)}))},{immediate:!0}),i.watch([u.comboboxState],([x],[C])=>{if(x===0&&C===1){if(_.value)return;let S=V(u.inputRef);if(!S)return;let E=S.value,{selectionStart:A,selectionEnd:b,selectionDirection:y}=S;S.value="",S.value=E,y!==null?S.setSelectionRange(A,b,y):S.setSelectionRange(A,b)}})});let a=i.ref(!1);function c(){a.value=!0}function f(){de().nextFrame(()=>{a.value=!1})}let h=Ut();function v(x){switch(_.value=!0,h(()=>{_.value=!1}),x.key){case L.Enter:if(_.value=!1,u.comboboxState.value!==0||a.value)return;if(x.preventDefault(),x.stopPropagation(),u.activeOptionIndex.value===null){u.closeCombobox();return}u.selectActiveOption(),u.mode.value===0&&u.closeCombobox();break;case L.ArrowDown:return _.value=!1,x.preventDefault(),x.stopPropagation(),G(u.comboboxState.value,{0:()=>u.goToOption(M.Next),1:()=>u.openCombobox()});case L.ArrowUp:return _.value=!1,x.preventDefault(),x.stopPropagation(),G(u.comboboxState.value,{0:()=>u.goToOption(M.Previous),1:()=>{u.openCombobox(),i.nextTick(()=>{u.value.value||u.goToOption(M.Last)})}});case L.Home:if(x.shiftKey)break;return _.value=!1,x.preventDefault(),x.stopPropagation(),u.goToOption(M.First);case L.PageUp:return _.value=!1,x.preventDefault(),x.stopPropagation(),u.goToOption(M.First);case L.End:if(x.shiftKey)break;return _.value=!1,x.preventDefault(),x.stopPropagation(),u.goToOption(M.Last);case L.PageDown:return _.value=!1,x.preventDefault(),x.stopPropagation(),u.goToOption(M.Last);case L.Escape:if(_.value=!1,u.comboboxState.value!==0)return;x.preventDefault(),u.optionsRef.value&&!u.optionsPropsRef.value.static&&x.stopPropagation(),u.nullable.value&&u.mode.value===0&&u.value.value===null&&g(),u.closeCombobox();break;case L.Tab:if(_.value=!1,u.comboboxState.value!==0)return;u.mode.value===0&&u.activationTrigger.value!==1&&u.selectActiveOption(),u.closeCombobox();break}}function m(x){l("change",x),u.nullable.value&&u.mode.value===0&&x.target.value===""&&g(),u.openCombobox()}function w(x){var C,S,E;let A=(C=x.relatedTarget)!=null?C:Y.find(b=>b!==x.currentTarget);if(_.value=!1,!((S=V(u.optionsRef))!=null&&S.contains(A))&&!((E=V(u.buttonRef))!=null&&E.contains(A))&&u.comboboxState.value===0)return x.preventDefault(),u.mode.value===0&&(u.nullable.value&&u.value.value===null?g():u.activationTrigger.value!==1&&u.selectActiveOption()),u.closeCombobox()}function O(x){var C,S,E;let A=(C=x.relatedTarget)!=null?C:Y.find(b=>b!==x.currentTarget);(S=V(u.buttonRef))!=null&&S.contains(A)||(E=V(u.optionsRef))!=null&&E.contains(A)||u.disabled.value||u.immediate.value&&u.comboboxState.value!==0&&(u.openCombobox(),de().nextFrame(()=>{u.setActivationTrigger(1)}))}let I=i.computed(()=>{var x,C,S,E;return(E=(S=(C=n.defaultValue)!=null?C:u.defaultValue.value!==void 0?(x=n.displayValue)==null?void 0:x.call(n,u.defaultValue.value):null)!=null?S:u.defaultValue.value)!=null?E:""});return()=>{var x,C,S,E,A,b,y;let T={open:u.comboboxState.value===0},{displayValue:k,onChange:P,...$}=n,F={"aria-controls":(x=u.optionsRef.value)==null?void 0:x.id,"aria-expanded":u.comboboxState.value===0,"aria-activedescendant":u.activeOptionIndex.value===null?void 0:u.virtual.value?(C=u.options.value.find(j=>!u.virtual.value.disabled(j.dataRef.value)&&u.compare(j.dataRef.value,u.virtual.value.options[u.activeOptionIndex.value])))==null?void 0:C.id:(S=u.options.value[u.activeOptionIndex.value])==null?void 0:S.id,"aria-labelledby":(b=(E=V(u.labelRef))==null?void 0:E.id)!=null?b:(A=V(u.buttonRef))==null?void 0:A.id,"aria-autocomplete":"list",id:d,onCompositionstart:c,onCompositionend:f,onKeydown:v,onInput:m,onFocus:O,onBlur:w,role:"combobox",type:(y=e.type)!=null?y:"text",tabIndex:0,ref:u.inputRef,defaultValue:I.value,disabled:u.disabled.value===!0?!0:void 0};return X({ourProps:F,theirProps:$,slot:T,attrs:e,slots:o,features:ae.RenderStrategy|ae.Static,name:"ComboboxInput"})}}}),Tn=i.defineComponent({name:"ComboboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},hold:{type:[Boolean],default:!1}},setup(n,{attrs:l,slots:e,expose:o}){let r=Q("ComboboxOptions"),s=`headlessui-combobox-options-${re()}`;o({el:r.optionsRef,$el:r.optionsRef}),i.watchEffect(()=>{r.optionsPropsRef.value.static=n.static}),i.watchEffect(()=>{r.optionsPropsRef.value.hold=n.hold});let d=pn(),u=i.computed(()=>d!==null?(d.value&ie.Open)===ie.Open:r.comboboxState.value===0);sn({container:i.computed(()=>V(r.optionsRef)),enabled:i.computed(()=>r.comboboxState.value===0),accept(_){return _.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:_.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(_){_.setAttribute("role","none")}});function p(_){_.preventDefault()}return()=>{var _,g,t;let a={open:r.comboboxState.value===0},c={"aria-labelledby":(t=(_=V(r.labelRef))==null?void 0:_.id)!=null?t:(g=V(r.buttonRef))==null?void 0:g.id,id:s,ref:r.optionsRef,role:"listbox","aria-multiselectable":r.mode.value===1?!0:void 0,onMousedown:p},f=pe(n,["hold"]);return X({ourProps:c,theirProps:f,slot:a,attrs:l,slots:r.virtual.value&&r.comboboxState.value===0?{...e,default:()=>[i.h(wn,{},e.default)]}:e,features:ae.RenderStrategy|ae.Static,visible:u.value,name:"ComboboxOptions"})}}}),An=i.defineComponent({name:"ComboboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1},order:{type:[Number],default:null}},setup(n,{slots:l,attrs:e,expose:o}){let r=Q("ComboboxOption"),s=`headlessui-combobox-option-${re()}`,d=i.ref(null),u=i.computed(()=>n.disabled);o({el:d,$el:d});let p=i.computed(()=>{var w;return r.virtual.value?r.activeOptionIndex.value===r.calculateIndex(n.value):r.activeOptionIndex.value===null?!1:((w=r.options.value[r.activeOptionIndex.value])==null?void 0:w.id)===s}),_=i.computed(()=>r.isSelected(n.value)),g=i.inject(et,null),t=i.computed(()=>({disabled:n.disabled,value:n.value,domRef:d,order:i.computed(()=>n.order)}));i.onMounted(()=>r.registerOption(s,t)),i.onUnmounted(()=>r.unregisterOption(s,p.value)),i.watchEffect(()=>{let w=V(d);w&&(g==null||g.value.measureElement(w))}),i.watchEffect(()=>{r.comboboxState.value===0&&p.value&&(r.virtual.value||r.activationTrigger.value!==0&&i.nextTick(()=>{var w,O;return(O=(w=V(d))==null?void 0:w.scrollIntoView)==null?void 0:O.call(w,{block:"nearest"})}))});function a(w){w.preventDefault(),w.button===Xe.Left&&(u.value||(r.selectOption(s),je()||requestAnimationFrame(()=>{var O;return(O=V(r.inputRef))==null?void 0:O.focus({preventScroll:!0})}),r.mode.value===0&&r.closeCombobox()))}function c(){var w;if(n.disabled||(w=r.virtual.value)!=null&&w.disabled(n.value))return r.goToOption(M.Nothing);let O=r.calculateIndex(n.value);r.goToOption(M.Specific,O)}let f=ln();function h(w){f.update(w)}function v(w){var O;if(!f.wasMoved(w)||n.disabled||(O=r.virtual.value)!=null&&O.disabled(n.value)||p.value)return;let I=r.calculateIndex(n.value);r.goToOption(M.Specific,I,0)}function m(w){var O;f.wasMoved(w)&&(n.disabled||(O=r.virtual.value)!=null&&O.disabled(n.value)||p.value&&(r.optionsPropsRef.value.hold||r.goToOption(M.Nothing)))}return()=>{let{disabled:w}=n,O={active:p.value,selected:_.value,disabled:w},I={id:s,ref:d,role:"option",tabIndex:w===!0?void 0:-1,"aria-disabled":w===!0?!0:void 0,"aria-selected":_.value,disabled:void 0,onMousedown:a,onFocus:c,onPointerenter:h,onMouseenter:h,onPointermove:v,onMousemove:v,onPointerleave:m,onMouseleave:m},x=pe(n,["order","value"]);return X({ourProps:I,theirProps:x,slot:O,attrs:e,slots:l,name:"ComboboxOption"})}}});function On(n,l){return i.openBlock(),i.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i.createElementVNode("path",{"fill-rule":"evenodd",d:"M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z","clip-rule":"evenodd"})])}const tt={__name:"Select",props:i.mergeModels({languages:{type:Object,required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,e=i.useModel(n,"modelValue"),o=i.ref(""),r=i.ref(null),s=i.computed(()=>Object.entries(l.languages).filter(([,u])=>u.toLowerCase().includes(o.value.toLowerCase()))),d=u=>{u.target.value="",o.value="",r.value&&r.value.$el.click()};return(u,p)=>(i.openBlock(),i.createBlock(i.unref(xn),{modelValue:e.value,"onUpdate:modelValue":p[2]||(p[2]=_=>e.value=_),as:"div",class:"relative mt-1"},{default:i.withCtx(()=>[i.createVNode(i.unref(En),{class:"w-full border border-gray-300 rounded-md py-2 pl-3 pr-10 text-sm leading-5 focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",onChange:p[0]||(p[0]=_=>o.value=_.target.value),displayValue:_=>n.languages[_],onFocus:p[1]||(p[1]=_=>d(_))},null,8,["displayValue"]),i.createVNode(i.unref(Sn),{ref_key:"btnSelect",ref:r,class:"absolute inset-y-0 right-0 flex items-center pr-2"},{default:i.withCtx(()=>[i.createVNode(i.unref(On),{class:"h-5 w-5 text-gray-400","aria-hidden":"true"})]),_:1},512),i.createVNode(i.unref(Tn),{class:"absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm z-50"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,([_,g])=>(i.openBlock(),i.createBlock(i.unref(An),{key:_,value:_},{default:i.withCtx(({active:t,selected:a})=>[i.createElementVNode("li",{class:i.normalizeClass(["relative cursor-default select-none py-2 pl-3 pr-9",t?"bg-[#3B5695] text-white":"text-gray-900"])},[i.createElementVNode("span",{class:i.normalizeClass(["block truncate",a&&"font-semibold"])},i.toDisplayString(g),3)],2)]),_:2},1032,["value"]))),128))]),_:1})]),_:1},8,["modelValue"]))}},kn={key:0},In=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 7l5 5m0 0l-5 5m5-5H6"})],-1)],Cn=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"})],-1)],Pn={__name:"SwapBtn",props:{isBidirect:{type:Boolean,default:!1}},emits:["swap"],setup(n,{emit:l}){const e=l;return(o,r)=>n.isBidirect?(i.openBlock(),i.createElementBlock("button",{key:1,onClick:r[0]||(r[0]=s=>e("swap"))},Cn)):(i.openBlock(),i.createElementBlock("button",kn,In))}};var nt=!1;function _e(n,l,e){return Array.isArray(n)?(n.length=Math.max(n.length,l),n.splice(l,1,e),e):(n[l]=e,e)}function Ae(n,l){if(Array.isArray(n)){n.splice(l,1);return}delete n[l]}function Vn(){return ot().__VUE_DEVTOOLS_GLOBAL_HOOK__}function ot(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const $n=typeof Proxy=="function",Nn="devtools-plugin:setup",Rn="plugin:settings:set";let J,Oe;function Mn(){var n;return J!==void 0||(typeof window<"u"&&window.performance?(J=!0,Oe=window.performance):typeof globalThis<"u"&&(!((n=globalThis.perf_hooks)===null||n===void 0)&&n.performance)?(J=!0,Oe=globalThis.perf_hooks.performance):J=!1),J}function Dn(){return Mn()?Oe.now():Date.now()}class Ln{constructor(l,e){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=l,this.hook=e;const o={};if(l.settings)for(const d in l.settings){const u=l.settings[d];o[d]=u.defaultValue}const r=`__vue-devtools-plugin-settings__${l.id}`;let s=Object.assign({},o);try{const d=localStorage.getItem(r),u=JSON.parse(d);Object.assign(s,u)}catch{}this.fallbacks={getSettings(){return s},setSettings(d){try{localStorage.setItem(r,JSON.stringify(d))}catch{}s=d},now(){return Dn()}},e&&e.on(Rn,(d,u)=>{d===this.plugin.id&&this.fallbacks.setSettings(u)}),this.proxiedOn=new Proxy({},{get:(d,u)=>this.target?this.target.on[u]:(...p)=>{this.onQueue.push({method:u,args:p})}}),this.proxiedTarget=new Proxy({},{get:(d,u)=>this.target?this.target[u]:u==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(u)?(...p)=>(this.targetQueue.push({method:u,args:p,resolve:()=>{}}),this.fallbacks[u](...p)):(...p)=>new Promise(_=>{this.targetQueue.push({method:u,args:p,resolve:_})})})}async setRealTarget(l){this.target=l;for(const e of this.onQueue)this.target.on[e.method](...e.args);for(const e of this.targetQueue)e.resolve(await this.target[e.method](...e.args))}}function rt(n,l){const e=n,o=ot(),r=Vn(),s=$n&&e.enableEarlyProxy;if(r&&(o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!s))r.emit(Nn,n,l);else{const d=s?new Ln(e,r):null;(o.__VUE_DEVTOOLS_PLUGINS__=o.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:e,setupFn:l,proxy:d}),d&&l(d.proxiedTarget)}}/*!
8
+ * pinia v2.1.7
9
+ * (c) 2023 Eduardo San Martin Morote
10
+ * @license MIT
11
+ */let le;const se=n=>le=n,at=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();function Z(n){return n&&typeof n=="object"&&Object.prototype.toString.call(n)==="[object Object]"&&typeof n.toJSON!="function"}var U;(function(n){n.direct="direct",n.patchObject="patch object",n.patchFunction="patch function"})(U||(U={}));const me=typeof window<"u",ue=(process.env.NODE_ENV!=="production"||!1)&&process.env.NODE_ENV!=="test"&&me,it=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:typeof globalThis=="object"?globalThis:{HTMLElement:null};function Bn(n,{autoBom:l=!1}={}){return l&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function ke(n,l,e){const o=new XMLHttpRequest;o.open("GET",n),o.responseType="blob",o.onload=function(){ut(o.response,l,e)},o.onerror=function(){console.error("could not download file")},o.send()}function lt(n){const l=new XMLHttpRequest;l.open("HEAD",n,!1);try{l.send()}catch{}return l.status>=200&&l.status<=299}function he(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{const e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(e)}}const ve=typeof navigator=="object"?navigator:{userAgent:""},st=/Macintosh/.test(ve.userAgent)&&/AppleWebKit/.test(ve.userAgent)&&!/Safari/.test(ve.userAgent),ut=me?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!st?Fn:"msSaveOrOpenBlob"in ve?jn:Hn:()=>{};function Fn(n,l="download",e){const o=document.createElement("a");o.download=l,o.rel="noopener",typeof n=="string"?(o.href=n,o.origin!==location.origin?lt(o.href)?ke(n,l,e):(o.target="_blank",he(o)):he(o)):(o.href=URL.createObjectURL(n),setTimeout(function(){URL.revokeObjectURL(o.href)},4e4),setTimeout(function(){he(o)},0))}function jn(n,l="download",e){if(typeof n=="string")if(lt(n))ke(n,l,e);else{const o=document.createElement("a");o.href=n,o.target="_blank",setTimeout(function(){he(o)})}else navigator.msSaveOrOpenBlob(Bn(n,e),l)}function Hn(n,l,e,o){if(o=o||open("","_blank"),o&&(o.document.title=o.document.body.innerText="downloading..."),typeof n=="string")return ke(n,l,e);const r=n.type==="application/octet-stream",s=/constructor/i.test(String(it.HTMLElement))||"safari"in it,d=/CriOS\/[\d]+/.test(navigator.userAgent);if((d||r&&s||st)&&typeof FileReader<"u"){const u=new FileReader;u.onloadend=function(){let p=u.result;if(typeof p!="string")throw o=null,new Error("Wrong reader.result type");p=d?p:p.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=p:location.assign(p),o=null},u.readAsDataURL(n)}else{const u=URL.createObjectURL(n);o?o.location.assign(u):location.href=u,o=null,setTimeout(function(){URL.revokeObjectURL(u)},4e4)}}function N(n,l){const e="🍍 "+n;typeof __VUE_DEVTOOLS_TOAST__=="function"?__VUE_DEVTOOLS_TOAST__(e,l):l==="error"?console.error(e):l==="warn"?console.warn(e):console.log(e)}function Ie(n){return"_a"in n&&"install"in n}function ct(){if(!("clipboard"in navigator))return N("Your browser doesn't support the Clipboard API","error"),!0}function dt(n){return n instanceof Error&&n.message.toLowerCase().includes("document is not focused")?(N('You need to activate the "Emulate a focused page" setting in the "Rendering" panel of devtools.',"warn"),!0):!1}async function Un(n){if(!ct())try{await navigator.clipboard.writeText(JSON.stringify(n.state.value)),N("Global state copied to clipboard.")}catch(l){if(dt(l))return;N("Failed to serialize the state. Check the console for more details.","error"),console.error(l)}}async function Gn(n){if(!ct())try{ft(n,JSON.parse(await navigator.clipboard.readText())),N("Global state pasted from clipboard.")}catch(l){if(dt(l))return;N("Failed to deserialize the state from clipboard. Check the console for more details.","error"),console.error(l)}}async function zn(n){try{ut(new Blob([JSON.stringify(n.state.value)],{type:"text/plain;charset=utf-8"}),"pinia-state.json")}catch(l){N("Failed to export the state as JSON. Check the console for more details.","error"),console.error(l)}}let z;function Wn(){z||(z=document.createElement("input"),z.type="file",z.accept=".json");function n(){return new Promise((l,e)=>{z.onchange=async()=>{const o=z.files;if(!o)return l(null);const r=o.item(0);return l(r?{text:await r.text(),file:r}:null)},z.oncancel=()=>l(null),z.onerror=e,z.click()})}return n}async function qn(n){try{const e=await Wn()();if(!e)return;const{text:o,file:r}=e;ft(n,JSON.parse(o)),N(`Global state imported from "${r.name}".`)}catch(l){N("Failed to import the state from JSON. Check the console for more details.","error"),console.error(l)}}function ft(n,l){for(const e in l){const o=n.state.value[e];o?Object.assign(o,l[e]):n.state.value[e]=l[e]}}function H(n){return{_custom:{display:n}}}const pt="🍍 Pinia (root)",Ce="_root";function Xn(n){return Ie(n)?{id:Ce,label:pt}:{id:n.$id,label:n.$id}}function Yn(n){if(Ie(n)){const e=Array.from(n._s.keys()),o=n._s;return{state:e.map(s=>({editable:!0,key:s,value:n.state.value[s]})),getters:e.filter(s=>o.get(s)._getters).map(s=>{const d=o.get(s);return{editable:!1,key:s,value:d._getters.reduce((u,p)=>(u[p]=d[p],u),{})}})}}const l={state:Object.keys(n.$state).map(e=>({editable:!0,key:e,value:n.$state[e]}))};return n._getters&&n._getters.length&&(l.getters=n._getters.map(e=>({editable:!1,key:e,value:n[e]}))),n._customProperties.size&&(l.customProperties=Array.from(n._customProperties).map(e=>({editable:!0,key:e,value:n[e]}))),l}function Qn(n){return n?Array.isArray(n)?n.reduce((l,e)=>(l.keys.push(e.key),l.operations.push(e.type),l.oldValue[e.key]=e.oldValue,l.newValue[e.key]=e.newValue,l),{oldValue:{},keys:[],operations:[],newValue:{}}):{operation:H(n.type),key:H(n.key),oldValue:n.oldValue,newValue:n.newValue}:{}}function Zn(n){switch(n){case U.direct:return"mutation";case U.patchFunction:return"$patch";case U.patchObject:return"$patch";default:return"unknown"}}let ee=!0;const ge=[],K="pinia:mutations",D="pinia",{assign:Kn}=Object,be=n=>"🍍 "+n;function Jn(n,l){rt({id:"dev.esm.pinia",label:"Pinia 🍍",logo:"https://pinia.vuejs.org/logo.svg",packageName:"pinia",homepage:"https://pinia.vuejs.org",componentStateTypes:ge,app:n},e=>{typeof e.now!="function"&&N("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."),e.addTimelineLayer({id:K,label:"Pinia 🍍",color:15064968}),e.addInspector({id:D,label:"Pinia 🍍",icon:"storage",treeFilterPlaceholder:"Search stores",actions:[{icon:"content_copy",action:()=>{Un(l)},tooltip:"Serialize and copy the state"},{icon:"content_paste",action:async()=>{await Gn(l),e.sendInspectorTree(D),e.sendInspectorState(D)},tooltip:"Replace the state with the content of your clipboard"},{icon:"save",action:()=>{zn(l)},tooltip:"Save the state as a JSON file"},{icon:"folder_open",action:async()=>{await qn(l),e.sendInspectorTree(D),e.sendInspectorState(D)},tooltip:"Import the state from a JSON file"}],nodeActions:[{icon:"restore",tooltip:'Reset the state (with "$reset")',action:o=>{const r=l._s.get(o);r?typeof r.$reset!="function"?N(`Cannot reset "${o}" store because it doesn't have a "$reset" method implemented.`,"warn"):(r.$reset(),N(`Store "${o}" reset.`)):N(`Cannot reset "${o}" store because it wasn't found.`,"warn")}}]}),e.on.inspectComponent((o,r)=>{const s=o.componentInstance&&o.componentInstance.proxy;if(s&&s._pStores){const d=o.componentInstance.proxy._pStores;Object.values(d).forEach(u=>{o.instanceData.state.push({type:be(u.$id),key:"state",editable:!0,value:u._isOptionsAPI?{_custom:{value:i.toRaw(u.$state),actions:[{icon:"restore",tooltip:"Reset the state of this store",action:()=>u.$reset()}]}}:Object.keys(u.$state).reduce((p,_)=>(p[_]=u.$state[_],p),{})}),u._getters&&u._getters.length&&o.instanceData.state.push({type:be(u.$id),key:"getters",editable:!1,value:u._getters.reduce((p,_)=>{try{p[_]=u[_]}catch(g){p[_]=g}return p},{})})})}}),e.on.getInspectorTree(o=>{if(o.app===n&&o.inspectorId===D){let r=[l];r=r.concat(Array.from(l._s.values())),o.rootNodes=(o.filter?r.filter(s=>"$id"in s?s.$id.toLowerCase().includes(o.filter.toLowerCase()):pt.toLowerCase().includes(o.filter.toLowerCase())):r).map(Xn)}}),e.on.getInspectorState(o=>{if(o.app===n&&o.inspectorId===D){const r=o.nodeId===Ce?l:l._s.get(o.nodeId);if(!r)return;r&&(o.state=Yn(r))}}),e.on.editInspectorState((o,r)=>{if(o.app===n&&o.inspectorId===D){const s=o.nodeId===Ce?l:l._s.get(o.nodeId);if(!s)return N(`store "${o.nodeId}" not found`,"error");const{path:d}=o;Ie(s)?d.unshift("state"):(d.length!==1||!s._customProperties.has(d[0])||d[0]in s.$state)&&d.unshift("$state"),ee=!1,o.set(s,d,o.state.value),ee=!0}}),e.on.editComponentState(o=>{if(o.type.startsWith("🍍")){const r=o.type.replace(/^🍍\s*/,""),s=l._s.get(r);if(!s)return N(`store "${r}" not found`,"error");const{path:d}=o;if(d[0]!=="state")return N(`Invalid path for store "${r}":
12
+ ${d}
13
+ Only state can be modified.`);d[0]="$state",ee=!1,o.set(s,d,o.state.value),ee=!0}})})}function eo(n,l){ge.includes(be(l.$id))||ge.push(be(l.$id)),rt({id:"dev.esm.pinia",label:"Pinia 🍍",logo:"https://pinia.vuejs.org/logo.svg",packageName:"pinia",homepage:"https://pinia.vuejs.org",componentStateTypes:ge,app:n,settings:{logStoreChanges:{label:"Notify about new/deleted stores",type:"boolean",defaultValue:!0}}},e=>{const o=typeof e.now=="function"?e.now.bind(e):Date.now;l.$onAction(({after:d,onError:u,name:p,args:_})=>{const g=_t++;e.addTimelineEvent({layerId:K,event:{time:o(),title:"🛫 "+p,subtitle:"start",data:{store:H(l.$id),action:H(p),args:_},groupId:g}}),d(t=>{W=void 0,e.addTimelineEvent({layerId:K,event:{time:o(),title:"🛬 "+p,subtitle:"end",data:{store:H(l.$id),action:H(p),args:_,result:t},groupId:g}})}),u(t=>{W=void 0,e.addTimelineEvent({layerId:K,event:{time:o(),logType:"error",title:"💥 "+p,subtitle:"end",data:{store:H(l.$id),action:H(p),args:_,error:t},groupId:g}})})},!0),l._customProperties.forEach(d=>{i.watch(()=>i.unref(l[d]),(u,p)=>{e.notifyComponentUpdate(),e.sendInspectorState(D),ee&&e.addTimelineEvent({layerId:K,event:{time:o(),title:"Change",subtitle:d,data:{newValue:u,oldValue:p},groupId:W}})},{deep:!0})}),l.$subscribe(({events:d,type:u},p)=>{if(e.notifyComponentUpdate(),e.sendInspectorState(D),!ee)return;const _={time:o(),title:Zn(u),data:Kn({store:H(l.$id)},Qn(d)),groupId:W};u===U.patchFunction?_.subtitle="⤵️":u===U.patchObject?_.subtitle="🧩":d&&!Array.isArray(d)&&(_.subtitle=d.type),d&&(_.data["rawEvent(s)"]={_custom:{display:"DebuggerEvent",type:"object",tooltip:"raw DebuggerEvent[]",value:d}}),e.addTimelineEvent({layerId:K,event:_})},{detached:!0,flush:"sync"});const r=l._hotUpdate;l._hotUpdate=i.markRaw(d=>{r(d),e.addTimelineEvent({layerId:K,event:{time:o(),title:"🔥 "+l.$id,subtitle:"HMR update",data:{store:H(l.$id),info:H("HMR update")}}}),e.notifyComponentUpdate(),e.sendInspectorTree(D),e.sendInspectorState(D)});const{$dispose:s}=l;l.$dispose=()=>{s(),e.notifyComponentUpdate(),e.sendInspectorTree(D),e.sendInspectorState(D),e.getSettings().logStoreChanges&&N(`Disposed "${l.$id}" store 🗑`)},e.notifyComponentUpdate(),e.sendInspectorTree(D),e.sendInspectorState(D),e.getSettings().logStoreChanges&&N(`"${l.$id}" store installed 🆕`)})}let _t=0,W;function mt(n,l,e){const o=l.reduce((r,s)=>(r[s]=i.toRaw(n)[s],r),{});for(const r in o)n[r]=function(){const s=_t,d=e?new Proxy(n,{get(...p){return W=s,Reflect.get(...p)},set(...p){return W=s,Reflect.set(...p)}}):n;W=s;const u=o[r].apply(d,arguments);return W=void 0,u}}function to({app:n,store:l,options:e}){if(l.$id.startsWith("__hot:"))return;l._isOptionsAPI=!!e.state,mt(l,Object.keys(e.actions),l._isOptionsAPI);const o=l._hotUpdate;i.toRaw(l)._hotUpdate=function(r){o.apply(this,arguments),mt(l,Object.keys(r._hmrPayload.actions),!!l._isOptionsAPI)},eo(n,l)}function no(){const n=i.effectScope(!0),l=n.run(()=>i.ref({}));let e=[],o=[];const r=i.markRaw({install(s){se(r),r._a=s,s.provide(at,r),s.config.globalProperties.$pinia=r,ue&&Jn(s,r),o.forEach(d=>e.push(d)),o=[]},use(s){return!this._a&&!nt?o.push(s):e.push(s),this},_p:e,_a:null,_e:n,_s:new Map,state:l});return ue&&typeof Proxy<"u"&&r.use(to),r}function ht(n,l){for(const e in l){const o=l[e];if(!(e in n))continue;const r=n[e];Z(r)&&Z(o)&&!i.isRef(o)&&!i.isReactive(o)?n[e]=ht(r,o):n[e]=o}return n}const vt=()=>{};function gt(n,l,e,o=vt){n.push(l);const r=()=>{const s=n.indexOf(l);s>-1&&(n.splice(s,1),o())};return!e&&i.getCurrentScope()&&i.onScopeDispose(r),r}function te(n,...l){n.slice().forEach(e=>{e(...l)})}const oo=n=>n();function Pe(n,l){n instanceof Map&&l instanceof Map&&l.forEach((e,o)=>n.set(o,e)),n instanceof Set&&l instanceof Set&&l.forEach(n.add,n);for(const e in l){if(!l.hasOwnProperty(e))continue;const o=l[e],r=n[e];Z(r)&&Z(o)&&n.hasOwnProperty(e)&&!i.isRef(o)&&!i.isReactive(o)?n[e]=Pe(r,o):n[e]=o}return n}const ro=process.env.NODE_ENV!=="production"?Symbol("pinia:skipHydration"):Symbol();function ao(n){return!Z(n)||!n.hasOwnProperty(ro)}const{assign:B}=Object;function bt(n){return!!(i.isRef(n)&&n.effect)}function yt(n,l,e,o){const{state:r,actions:s,getters:d}=l,u=e.state.value[n];let p;function _(){!u&&(process.env.NODE_ENV==="production"||!o)&&(e.state.value[n]=r?r():{});const g=process.env.NODE_ENV!=="production"&&o?i.toRefs(i.ref(r?r():{}).value):i.toRefs(e.state.value[n]);return B(g,s,Object.keys(d||{}).reduce((t,a)=>(process.env.NODE_ENV!=="production"&&a in g&&console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${a}" in store "${n}".`),t[a]=i.markRaw(i.computed(()=>{se(e);const c=e._s.get(n);return d[a].call(c,c)})),t),{}))}return p=Ve(n,_,l,e,o,!0),p}function Ve(n,l,e={},o,r,s){let d;const u=B({actions:{}},e);if(process.env.NODE_ENV!=="production"&&!o._e.active)throw new Error("Pinia destroyed");const p={deep:!0};process.env.NODE_ENV!=="production"&&!nt&&(p.onTrigger=b=>{_?c=b:_==!1&&!S._hotUpdating&&(Array.isArray(c)?c.push(b):console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."))});let _,g,t=[],a=[],c;const f=o.state.value[n];!s&&!f&&(process.env.NODE_ENV==="production"||!r)&&(o.state.value[n]={});const h=i.ref({});let v;function m(b){let y;_=g=!1,process.env.NODE_ENV!=="production"&&(c=[]),typeof b=="function"?(b(o.state.value[n]),y={type:U.patchFunction,storeId:n,events:c}):(Pe(o.state.value[n],b),y={type:U.patchObject,payload:b,storeId:n,events:c});const T=v=Symbol();i.nextTick().then(()=>{v===T&&(_=!0)}),g=!0,te(t,y,o.state.value[n])}const w=s?function(){const{state:y}=e,T=y?y():{};this.$patch(k=>{B(k,T)})}:process.env.NODE_ENV!=="production"?()=>{throw new Error(`🍍: Store "${n}" is built using the setup syntax and does not implement $reset().`)}:vt;function O(){d.stop(),t=[],a=[],o._s.delete(n)}function I(b,y){return function(){se(o);const T=Array.from(arguments),k=[],P=[];function $(R){k.push(R)}function F(R){P.push(R)}te(a,{args:T,name:b,store:S,after:$,onError:F});let j;try{j=y.apply(this&&this.$id===n?this:S,T)}catch(R){throw te(P,R),R}return j instanceof Promise?j.then(R=>(te(k,R),R)).catch(R=>(te(P,R),Promise.reject(R))):(te(k,j),j)}}const x=i.markRaw({actions:{},getters:{},state:[],hotState:h}),C={_p:o,$id:n,$onAction:gt.bind(null,a),$patch:m,$reset:w,$subscribe(b,y={}){const T=gt(t,b,y.detached,()=>k()),k=d.run(()=>i.watch(()=>o.state.value[n],P=>{(y.flush==="sync"?g:_)&&b({storeId:n,type:U.direct,events:c},P)},B({},p,y)));return T},$dispose:O},S=i.reactive(process.env.NODE_ENV!=="production"||ue?B({_hmrPayload:x,_customProperties:i.markRaw(new Set)},C):C);o._s.set(n,S);const A=(o._a&&o._a.runWithContext||oo)(()=>o._e.run(()=>(d=i.effectScope()).run(l)));for(const b in A){const y=A[b];if(i.isRef(y)&&!bt(y)||i.isReactive(y))process.env.NODE_ENV!=="production"&&r?_e(h.value,b,i.toRef(A,b)):s||(f&&ao(y)&&(i.isRef(y)?y.value=f[b]:Pe(y,f[b])),o.state.value[n][b]=y),process.env.NODE_ENV!=="production"&&x.state.push(b);else if(typeof y=="function"){const T=process.env.NODE_ENV!=="production"&&r?y:I(b,y);A[b]=T,process.env.NODE_ENV!=="production"&&(x.actions[b]=y),u.actions[b]=y}else process.env.NODE_ENV!=="production"&&bt(y)&&(x.getters[b]=s?e.getters[b]:y,me&&(A._getters||(A._getters=i.markRaw([]))).push(b))}if(B(S,A),B(i.toRaw(S),A),Object.defineProperty(S,"$state",{get:()=>process.env.NODE_ENV!=="production"&&r?h.value:o.state.value[n],set:b=>{if(process.env.NODE_ENV!=="production"&&r)throw new Error("cannot set hotState");m(y=>{B(y,b)})}}),process.env.NODE_ENV!=="production"&&(S._hotUpdate=i.markRaw(b=>{S._hotUpdating=!0,b._hmrPayload.state.forEach(y=>{if(y in S.$state){const T=b.$state[y],k=S.$state[y];typeof T=="object"&&Z(T)&&Z(k)?ht(T,k):b.$state[y]=k}_e(S,y,i.toRef(b.$state,y))}),Object.keys(S.$state).forEach(y=>{y in b.$state||Ae(S,y)}),_=!1,g=!1,o.state.value[n]=i.toRef(b._hmrPayload,"hotState"),g=!0,i.nextTick().then(()=>{_=!0});for(const y in b._hmrPayload.actions){const T=b[y];_e(S,y,I(y,T))}for(const y in b._hmrPayload.getters){const T=b._hmrPayload.getters[y],k=s?i.computed(()=>(se(o),T.call(S,S))):T;_e(S,y,k)}Object.keys(S._hmrPayload.getters).forEach(y=>{y in b._hmrPayload.getters||Ae(S,y)}),Object.keys(S._hmrPayload.actions).forEach(y=>{y in b._hmrPayload.actions||Ae(S,y)}),S._hmrPayload=b._hmrPayload,S._getters=b._getters,S._hotUpdating=!1})),ue){const b={writable:!0,configurable:!0,enumerable:!1};["_p","_hmrPayload","_getters","_customProperties"].forEach(y=>{Object.defineProperty(S,y,B({value:S[y]},b))})}return o._p.forEach(b=>{if(ue){const y=d.run(()=>b({store:S,app:o._a,pinia:o,options:u}));Object.keys(y||{}).forEach(T=>S._customProperties.add(T)),B(S,y)}else B(S,d.run(()=>b({store:S,app:o._a,pinia:o,options:u})))}),process.env.NODE_ENV!=="production"&&S.$state&&typeof S.$state=="object"&&typeof S.$state.constructor=="function"&&!S.$state.constructor.toString().includes("[native code]")&&console.warn(`[🍍]: The "state" must be a plain object. It cannot be
14
+ state: () => new MyClass()
15
+ Found in store "${S.$id}".`),f&&s&&e.hydrate&&e.hydrate(S.$state,f),_=!0,g=!0,S}function $e(n,l,e){let o,r;const s=typeof l=="function";if(typeof n=="string")o=n,r=s?e:l;else if(r=n,o=n.id,process.env.NODE_ENV!=="production"&&typeof o!="string")throw new Error('[🍍]: "defineStore()" must be passed a store id as its first argument.');function d(u,p){const _=i.hasInjectionContext();if(u=(process.env.NODE_ENV==="test"&&le&&le._testing?null:u)||(_?i.inject(at,null):null),u&&se(u),process.env.NODE_ENV!=="production"&&!le)throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
16
+ See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
17
+ This will fail in production.`);u=le,u._s.has(o)||(s?Ve(o,l,r,u):yt(o,r,u),process.env.NODE_ENV!=="production"&&(d._pinia=u));const g=u._s.get(o);if(process.env.NODE_ENV!=="production"&&p){const t="__hot:"+o,a=s?Ve(t,l,r,u,!0):yt(t,B({},r),u,!0);p._hotUpdate(a),delete u.state.value[t],u._s.delete(t)}if(process.env.NODE_ENV!=="production"&&me){const t=i.getCurrentInstance();if(t&&t.proxy&&!p){const a=t.proxy,c="_pStores"in a?a._pStores:a._pStores={};c[o]=g}}return g}return d.$id=o,d}const Ne=$e("language",()=>{const n=i.ref("auto"),l=i.ref("en"),e=i.ref({src:[],target:[]}),o=i.computed(()=>e.value.src[n.value]),r=i.computed(()=>e.value.target[l.value]);function s(p,_){n.value=p==null?void 0:p.src,l.value=p==null?void 0:p.target,e.value=_}function d(){if(!e.value.src[l.value]||!e.value.target[n.value])return;const p=n.value;n.value=l.value,l.value=p}function u(p){return e.value.src[p]||e.value.target[p]}return{languages:e,src:n,target:l,srcLabel:o,targetLabel:r,init:s,swap:d,getLabel:u}}),io={key:0,class:"flex flex-row"},lo={__name:"Selects",setup(n){const l=Ne();function e(){l.swap()}return(o,r)=>i.unref(l).languages?(i.openBlock(),i.createElementBlock("div",io,[i.createVNode(tt,{modelValue:i.unref(l).src,"onUpdate:modelValue":r[0]||(r[0]=s=>i.unref(l).src=s),languages:i.unref(l).languages.src,class:"grow"},null,8,["modelValue","languages"]),i.createVNode(Pn,{isBidirect:i.unref(l).src!=="auto",class:"grow-0",onSwap:e},null,8,["isBidirect"]),i.createVNode(tt,{modelValue:i.unref(l).target,"onUpdate:modelValue":r[1]||(r[1]=s=>i.unref(l).target=s),languages:i.unref(l).languages.target,class:"grow"},null,8,["modelValue","languages"])])):i.createCommentVNode("",!0)}},so={INPUT_MAX_LENGTH:5e3,INPUT_DEBOUNCE:500},ye=(n,l)=>{const e=n.__vccOpts||n;for(const[o,r]of l)e[o]=r;return e},uo={},co={class:"mr-2 loading loading-dots loading-xs"};function fo(n,l){return i.openBlock(),i.createElementBlock("span",co)}const po=ye(uo,[["render",fo]]);function _o(n,{volume:l=1,playbackRate:e=1,soundEnabled:o=!0,interrupt:r=!1,autoplay:s=!1,onload:d,...u}={}){const p=i.ref(null),_=i.ref(!1),g=i.ref(null),t=i.ref(null);function a(){var m;typeof d=="function"&&d.call(this),g.value=(g.value||((m=t.value)==null?void 0:m.duration())||0)*1e3,s===!0&&(_.value=!0)}return i.onMounted(async()=>{const m=await Promise.resolve().then(()=>pr);p.value=m.default.Howl,t.value=new p.value({src:i.unref(n),volume:i.unref(l),rate:i.unref(e),onload:a,...u})}),i.watch(()=>[n],()=>{p.value&&p.value&&t&&t.value&&(t.value=new p.value({src:i.unref(n),volume:i.unref(l),rate:i.unref(e),onload:a,...u}))}),i.watch(()=>[i.unref(l),i.unref(e)],()=>{t.value&&(t.value.volume(i.unref(l)),t.value.rate(i.unref(e)))}),{play:m=>{typeof m>"u"&&(m={}),!(!t.value||!o&&!m.forceSoundEnabled)&&(r&&t.value.stop(),m.playbackRate&&t.value.rate(m.playbackRate),t.value.play(m.id),t.value.once("end",()=>{t.value&&t.value&&!t.value.playing()&&(_.value=!1)}),_.value=!0)},sound:t,isPlaying:_,duration:g,pause:m=>{t.value&&(t.value.pause(typeof m=="number"?m:void 0),_.value=!1)},stop:m=>{t.value&&(t.value.stop(typeof m=="number"?m:void 0),_.value=!1)}}}const mo={class:"swap"},ho=i.createElementVNode("svg",{class:"swap-off fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[i.createElementVNode("path",{d:"M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z"})],-1),vo=i.createElementVNode("svg",{class:"swap-on fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z","clip-rule":"evenodd"})],-1),go={__name:"SpeakBtn",props:{url:{type:String,default:""}},setup(n){const l=n,{play:e,stop:o,isPlaying:r}=_o(l.url),s=i.ref(!1);i.watch(()=>r.value,u=>{s.value=u});function d(){if(r.value){o();return}e()}return(u,p)=>(i.openBlock(),i.createElementBlock("button",{class:"btn btn-xs btn-ghost btn-circle",onClick:i.withModifiers(d,["prevent"])},[i.createElementVNode("label",mo,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":p[0]||(p[0]=_=>s.value=_),type:"checkbox"},null,512),[[i.vModelCheckbox,s.value]]),ho,vo])]))}},bo={},yo=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-5 h-5"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})],-1)];function wo(n,l){return i.openBlock(),i.createElementBlock("button",{class:"btn btn-xs btn-ghost btn-circle p-0",onClick:l[0]||(l[0]=(...e)=>n.onClick&&n.onClick(...e))},yo)}const xo=ye(bo,[["render",wo]]),So={class:"flex flex-row rounded-t-lg bg-white border border-b-0 px-1 pr-1 pt-1 gap-1 items-center"},Eo={class:"text-sm italic"},To={key:0},Ao=i.createElementVNode("div",{class:"flex-grow"}," ",-1),wt={__name:"TranslationBtnGroup",props:{loading:{type:Boolean,default:!1},src:{type:String,default:""},srcLabel:{type:String,default:""},tts:{type:String,default:""},phonetic:{type:String,default:""},isClearBtn:{type:Boolean,default:!1}},emits:["clear"],setup(n,{emit:l}){const e=n,o=l;return(r,s)=>(i.openBlock(),i.createElementBlock("div",So,[e.tts?(i.openBlock(),i.createBlock(go,{key:0,url:e.tts},null,8,["url"])):i.createCommentVNode("",!0),i.createElementVNode("div",Eo,[i.createTextVNode(i.toDisplayString(n.srcLabel)+" ",1),n.phonetic?(i.openBlock(),i.createElementBlock("span",To,"― "+i.toDisplayString(e.phonetic),1)):i.createCommentVNode("",!0)]),Ao,e.loading?(i.openBlock(),i.createBlock(po,{key:1})):i.createCommentVNode("",!0),e.src&&e.isClearBtn?(i.openBlock(),i.createBlock(xo,{key:2,onClick:s[0]||(s[0]=d=>o("clear"))})):i.createCommentVNode("",!0)]))}},ne=$e("translation",()=>{const n=i.ref(null),l=i.ref(null),e=i.ref({src:null,target:null}),o=i.ref(null),r=i.ref([]),s=i.ref([]),d=i.ref([]),u=i.ref({src:null,target:null}),p=Ne(),_=i.computed(()=>p.getLabel(n.value)),g=i.computed(()=>p.getLabel(l.value));function t(c){n.value=c.src,l.value=c.target,e.value=c.phonetic,o.value=c.result,r.value=c.dictionary,s.value=c.definitions,d.value=c.examples,u.value=c.tts}function a(){n.value=null,l.value=null,e.value={src:null,target:null},o.value=null,r.value=[],s.value=[],d.value=[],u.value={src:null,target:null}}return{src:n,srcLabel:_,target:l,targetLabel:g,phonetic:e,result:o,dictionary:r,definitions:s,examples:d,tts:u,init:t,reset:a}});function Oo(n){return i.getCurrentScope()?(i.onScopeDispose(n),!0):!1}function we(n){return typeof n=="function"?n():i.unref(n)}const ko=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const xt=()=>{};function Io(n,l){function e(...o){return new Promise((r,s)=>{Promise.resolve(n(()=>l.apply(this,o),{fn:l,thisArg:this,args:o})).then(r).catch(s)})}return e}function Co(n,l={}){let e,o,r=xt;const s=u=>{clearTimeout(u),r(),r=xt};return u=>{const p=we(n),_=we(l.maxWait);return e&&s(e),p<=0||_!==void 0&&_<=0?(o&&(s(o),o=null),Promise.resolve(u())):new Promise((g,t)=>{r=l.rejectOnCancel?t:g,_&&!o&&(o=setTimeout(()=>{e&&s(e),o=null,g(u())},_)),e=setTimeout(()=>{o&&s(o),o=null,g(u())},p)})}}function Po(n,l=200,e={}){return Io(Co(l,e),n)}function St(n){var l;const e=we(n);return(l=e==null?void 0:e.$el)!=null?l:e}const Vo=ko?window:void 0;function $o(){const n=i.ref(!1),l=i.getCurrentInstance();return l&&i.onMounted(()=>{n.value=!0},l),n}function No(n){const l=$o();return i.computed(()=>(l.value,!!n()))}function Ro(n,l,e={}){const{window:o=Vo,...r}=e;let s;const d=No(()=>o&&"ResizeObserver"in o),u=()=>{s&&(s.disconnect(),s=void 0)},p=i.computed(()=>Array.isArray(n)?n.map(t=>St(t)):[St(n)]),_=i.watch(p,t=>{if(u(),d.value&&o){s=new ResizeObserver(l);for(const a of t)a&&s.observe(a,r)}},{immediate:!0,flush:"post"}),g=()=>{u(),_()};return Oo(g),{isSupported:d,stop:g}}function Et(n){var l;const e=i.ref(n==null?void 0:n.element),o=i.ref(n==null?void 0:n.input),r=(l=n==null?void 0:n.styleProp)!=null?l:"height",s=i.ref(1);function d(){var u;if(!e.value)return;let p="";e.value.style[r]="1px",s.value=(u=e.value)==null?void 0:u.scrollHeight,n!=null&&n.styleTarget?we(n.styleTarget).style[r]=`${s.value}px`:p=`${s.value}px`,e.value.style[r]=p}return i.watch([o,e],()=>i.nextTick(d),{immediate:!0}),i.watch(s,()=>{var u;return(u=n==null?void 0:n.onResize)==null?void 0:u.call(n)}),Ro(e,()=>d()),n!=null&&n.watch&&i.watch(n.watch,d,{immediate:!0,deep:!0}),{textarea:e,input:o,triggerResize:d}}const Mo=ye({__name:"Input",props:{text:{type:String,default:""}},emits:["change","clear"],setup(n,{emit:l}){const e=ne(),o=n,r=i.ref(o.text),s=i.computed(()=>e.src),d=i.computed(()=>e.srcLabel),u=i.computed(()=>{var f;return(f=e.phonetic)==null?void 0:f.src}),p=i.computed(()=>{var f;return(f=e.tts)==null?void 0:f.src}),{textarea:_}=Et({input:r,styleProp:"minHeight"}),g=l,t=Po(()=>{g("change",r.value)},so.INPUT_DEBOUNCE);function a(){if(!r.value){c();return}t()}function c(){g("clear"),r.value="",_.value.focus()}return(f,h)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(wt,{src:s.value,srcLabel:d.value,tts:p.value,phonetic:u.value,isClearBtn:!0,onClear:c},null,8,["src","srcLabel","tts","phonetic"]),i.withDirectives(i.createElementVNode("textarea",{ref_key:"textarea",ref:_,"onUpdate:modelValue":h[0]||(h[0]=v=>r.value=v),class:"w-full border border-t-0 rounded-b-lg outline-none outline-0 p-3 pt-0",autofocus:"",rows:"2",onInput:a},null,544),[[i.vModelText,r.value,void 0,{trim:!0}]])],64))}},[["__scopeId","data-v-601b7a18"]]),Tt=$e("loader",()=>({loading:i.ref(!1)})),Do=ye({__name:"Result",setup(n){const l=ne(),e=i.computed(()=>l.result),o=i.computed(()=>l.target),r=i.computed(()=>l.targetLabel),s=i.computed(()=>{var g;return(g=l.phonetic)==null?void 0:g.target}),d=i.computed(()=>{var g;return(g=l.tts)==null?void 0:g.target}),u=Tt(),{textarea:p,input:_}=Et({input:e,styleProp:"minHeight"});return(g,t)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(wt,{loading:i.unref(u).loading,src:o.value,srcLabel:r.value,tts:d.value,phonetic:s.value},null,8,["loading","src","srcLabel","tts","phonetic"]),i.withDirectives(i.createElementVNode("textarea",{ref_key:"textarea",ref:p,"onUpdate:modelValue":t[0]||(t[0]=a=>i.isRef(_)?_.value=a:null),class:"w-full border border-t-0 rounded-b-lg outline-none outline-0 p-3 pt-0",readonly:"",rows:"2",spellcheck:"false"},null,512),[[i.vModelText,i.unref(_)]])],64))}},[["__scopeId","data-v-6c3a2370"]]),Lo={class:"card border bg-white rounded-lg"},Bo={class:"card-body p-4"},Fo=i.createElementVNode("h2",{class:"card-title"},"Translations",-1),jo={class:"capitalize font-bold"},Ho={class:"list-none list-inside"},Uo=["onClick"],Go={class:"italic"},zo={__name:"Dictionary",setup(n){const l=ne(),e=i.computed(()=>l.dictionary);return(o,r)=>(i.openBlock(),i.createElementBlock("div",Lo,[i.createElementVNode("div",Bo,[Fo,i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.value,(s,d)=>(i.openBlock(),i.createElementBlock("li",{key:`${s.pos}-${d}`,class:"mb-3"},[i.createElementVNode("h5",jo,i.toDisplayString(s.pos),1),i.createElementVNode("ul",Ho,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.items,(u,p)=>(i.openBlock(),i.createElementBlock("li",{key:`${u.word}-${p}`},[i.createElementVNode("span",{class:"badge badge-neutral text-white cursor-pointer",onClick:_=>o.translate(u.word)},i.toDisplayString(u.word),9,Uo),i.createElementVNode("small",Go," ― "+i.toDisplayString(u.reverse_translation.join(", ")),1)]))),128))])]))),128))])])]))}},Wo={class:"card border bg-white rounded-lg"},qo={class:"card-body p-4"},Xo=i.createElementVNode("h2",{class:"card-title font-bold"},"Definitions",-1),Yo={class:"capitalize font-bold mb-0"},Qo={class:"list-decimal list-outside ml-5"},Zo=i.createElementVNode("br",null,null,-1),Ko={key:0,class:"italic"},Jo={__name:"Definition",setup(n){const l=ne(),e=i.computed(()=>l.definitions);return(o,r)=>(i.openBlock(),i.createElementBlock("div",Wo,[i.createElementVNode("div",qo,[Xo,i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.value,(s,d)=>(i.openBlock(),i.createElementBlock("li",{key:`${s.pos}-${d}`,class:"mb-3"},[i.createElementVNode("h5",Yo,i.toDisplayString(s.pos),1),i.createElementVNode("ul",Qo,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.items,(u,p)=>(i.openBlock(),i.createElementBlock("li",{key:`${u.gloss}-${p}`,class:"mb-1"},[i.createElementVNode("span",null,i.toDisplayString(u.gloss),1),Zo,u.example?(i.openBlock(),i.createElementBlock("small",Ko,'"'+i.toDisplayString(u.example)+'"',1)):i.createCommentVNode("",!0)]))),128))])]))),128))])])]))}},er={class:"card border bg-white rounded-lg"},tr={class:"card-body p-4"},nr=i.createElementVNode("h2",{class:"card-title font-bold"},"Examples",-1),or={class:"list-disc list-outside ml-5"},rr=["innerHTML"],ar={__name:"Example",setup(n){const l=ne(),e=i.computed(()=>l.examples);return(o,r)=>(i.openBlock(),i.createElementBlock("div",er,[i.createElementVNode("div",tr,[nr,i.createElementVNode("ul",or,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.value,(s,d)=>(i.openBlock(),i.createElementBlock("li",{key:`${s.definition_id}-${d}`,innerHTML:s},null,8,rr))),128))])])]))}},ir={class:"p-2 bg-neutral-100"},lr={class:"mt-2 grid grid-cols-1 md:grid-cols-2 gap-3"},sr={class:"w-full"},ur={class:"w-full"},cr={key:0,class:"mt-3 grid grid-cols-1 md:grid-cols-3 gap-3"},dr={__name:"Popup",props:{opt:{type:Object,default:null},languages:{type:Object,default:null},translation:{type:Object,default:null}},emits:["opt","translate"],setup(n,{emit:l}){var a;const e=no(),o=ne(e),r=Ne(e),s=Tt(e),d=n,u=l,p=i.ref((a=d.translation)==null?void 0:a.text);i.watch(()=>d.translation,c=>{s.loading=!1,o.init(c)},{immediate:!0}),i.watch([()=>d.opt,()=>d.languages],([c,f])=>{r.init(c,f)}),i.watch([()=>r.src,()=>r.target],([c,f])=>{u("opt",{src:c,target:f}),p.value&&t()}),i.onMounted(()=>{r.init(d.opt,d.languages)});function _(){p.value="",o.reset()}function g(c){c&&(p.value=c,t())}function t(){s.loading=!0,u("translate",{src:r.src,target:r.target,text:p.value})}return(c,f)=>(i.openBlock(),i.createElementBlock("div",ir,[i.createVNode(lo),i.createElementVNode("div",lr,[i.createElementVNode("div",sr,[i.createVNode(Mo,{text:p.value,onChange:g,onClear:_},null,8,["text"])]),i.createElementVNode("div",ur,[i.createVNode(Do)])]),d.translation?(i.openBlock(),i.createElementBlock("div",cr,[i.createVNode(zo),i.createVNode(Jo),i.createVNode(ar)])):i.createCommentVNode("",!0)]))}};var ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Re={};/*!
18
+ * howler.js v2.2.4
19
+ * howlerjs.com
20
+ *
21
+ * (c) 2013-2020, James Simpson of GoldFire Studios
22
+ * goldfirestudios.com
23
+ *
24
+ * MIT License
25
+ */(function(n){(function(){var l=function(){this.init()};l.prototype={init:function(){var t=this||e;return t._counter=1e3,t._html5AudioPool=[],t.html5PoolSize=10,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator=typeof window<"u"&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.autoUnlock=!0,t._setup(),t},volume:function(t){var a=this||e;if(t=parseFloat(t),a.ctx||g(),typeof t<"u"&&t>=0&&t<=1){if(a._volume=t,a._muted)return a;a.usingWebAudio&&a.masterGain.gain.setValueAtTime(t,e.ctx.currentTime);for(var c=0;c<a._howls.length;c++)if(!a._howls[c]._webAudio)for(var f=a._howls[c]._getSoundIds(),h=0;h<f.length;h++){var v=a._howls[c]._soundById(f[h]);v&&v._node&&(v._node.volume=v._volume*t)}return a}return a._volume},mute:function(t){var a=this||e;a.ctx||g(),a._muted=t,a.usingWebAudio&&a.masterGain.gain.setValueAtTime(t?0:a._volume,e.ctx.currentTime);for(var c=0;c<a._howls.length;c++)if(!a._howls[c]._webAudio)for(var f=a._howls[c]._getSoundIds(),h=0;h<f.length;h++){var v=a._howls[c]._soundById(f[h]);v&&v._node&&(v._node.muted=t?!0:v._muted)}return a},stop:function(){for(var t=this||e,a=0;a<t._howls.length;a++)t._howls[a].stop();return t},unload:function(){for(var t=this||e,a=t._howls.length-1;a>=0;a--)t._howls[a].unload();return t.usingWebAudio&&t.ctx&&typeof t.ctx.close<"u"&&(t.ctx.close(),t.ctx=null,g()),t},codecs:function(t){return(this||e)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||e;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if(typeof Audio<"u")try{var a=new Audio;typeof a.oncanplaythrough>"u"&&(t._canPlayEvent="canplay")}catch{t.noAudio=!0}else t.noAudio=!0;try{var a=new Audio;a.muted&&(t.noAudio=!0)}catch{}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||e,a=null;try{a=typeof Audio<"u"?new Audio:null}catch{return t}if(!a||typeof a.canPlayType!="function")return t;var c=a.canPlayType("audio/mpeg;").replace(/^no$/,""),f=t._navigator?t._navigator.userAgent:"",h=f.match(/OPR\/(\d+)/g),v=h&&parseInt(h[0].split("/")[1],10)<33,m=f.indexOf("Safari")!==-1&&f.indexOf("Chrome")===-1,w=f.match(/Version\/(.*?) /),O=m&&w&&parseInt(w[1],10)<15;return t._codecs={mp3:!!(!v&&(c||a.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!c,opus:!!a.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(a.canPlayType('audio/wav; codecs="1"')||a.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!a.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!a.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(a.canPlayType("audio/x-m4b;")||a.canPlayType("audio/m4b;")||a.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(a.canPlayType("audio/x-mp4;")||a.canPlayType("audio/mp4;")||a.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!O&&a.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!O&&a.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!a.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(a.canPlayType("audio/x-flac;")||a.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||e;if(!(t._audioUnlocked||!t.ctx)){t._audioUnlocked=!1,t.autoUnlock=!1,!t._mobileUnloaded&&t.ctx.sampleRate!==44100&&(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var a=function(c){for(;t._html5AudioPool.length<t.html5PoolSize;)try{var f=new Audio;f._unlocked=!0,t._releaseHtml5Audio(f)}catch{t.noAudio=!0;break}for(var h=0;h<t._howls.length;h++)if(!t._howls[h]._webAudio)for(var v=t._howls[h]._getSoundIds(),m=0;m<v.length;m++){var w=t._howls[h]._soundById(v[m]);w&&w._node&&!w._node._unlocked&&(w._node._unlocked=!0,w._node.load())}t._autoResume();var O=t.ctx.createBufferSource();O.buffer=t._scratchBuffer,O.connect(t.ctx.destination),typeof O.start>"u"?O.noteOn(0):O.start(0),typeof t.ctx.resume=="function"&&t.ctx.resume(),O.onended=function(){O.disconnect(0),t._audioUnlocked=!0,document.removeEventListener("touchstart",a,!0),document.removeEventListener("touchend",a,!0),document.removeEventListener("click",a,!0),document.removeEventListener("keydown",a,!0);for(var I=0;I<t._howls.length;I++)t._howls[I]._emit("unlock")}};return document.addEventListener("touchstart",a,!0),document.addEventListener("touchend",a,!0),document.addEventListener("click",a,!0),document.addEventListener("keydown",a,!0),t}},_obtainHtml5Audio:function(){var t=this||e;if(t._html5AudioPool.length)return t._html5AudioPool.pop();var a=new Audio().play();return a&&typeof Promise<"u"&&(a instanceof Promise||typeof a.then=="function")&&a.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(t){var a=this||e;return t._unlocked&&a._html5AudioPool.push(t),a},_autoSuspend:function(){var t=this;if(!(!t.autoSuspend||!t.ctx||typeof t.ctx.suspend>"u"||!e.usingWebAudio)){for(var a=0;a<t._howls.length;a++)if(t._howls[a]._webAudio){for(var c=0;c<t._howls[a]._sounds.length;c++)if(!t._howls[a]._sounds[c]._paused)return t}return t._suspendTimer&&clearTimeout(t._suspendTimer),t._suspendTimer=setTimeout(function(){if(t.autoSuspend){t._suspendTimer=null,t.state="suspending";var f=function(){t.state="suspended",t._resumeAfterSuspend&&(delete t._resumeAfterSuspend,t._autoResume())};t.ctx.suspend().then(f,f)}},3e4),t}},_autoResume:function(){var t=this;if(!(!t.ctx||typeof t.ctx.resume>"u"||!e.usingWebAudio))return t.state==="running"&&t.ctx.state!=="interrupted"&&t._suspendTimer?(clearTimeout(t._suspendTimer),t._suspendTimer=null):t.state==="suspended"||t.state==="running"&&t.ctx.state==="interrupted"?(t.ctx.resume().then(function(){t.state="running";for(var a=0;a<t._howls.length;a++)t._howls[a]._emit("resume")}),t._suspendTimer&&(clearTimeout(t._suspendTimer),t._suspendTimer=null)):t.state==="suspending"&&(t._resumeAfterSuspend=!0),t}};var e=new l,o=function(t){var a=this;if(!t.src||t.src.length===0){console.error("An array of source files must be passed with any new Howl.");return}a.init(t)};o.prototype={init:function(t){var a=this;return e.ctx||g(),a._autoplay=t.autoplay||!1,a._format=typeof t.format!="string"?t.format:[t.format],a._html5=t.html5||!1,a._muted=t.mute||!1,a._loop=t.loop||!1,a._pool=t.pool||5,a._preload=typeof t.preload=="boolean"||t.preload==="metadata"?t.preload:!0,a._rate=t.rate||1,a._sprite=t.sprite||{},a._src=typeof t.src!="string"?t.src:[t.src],a._volume=t.volume!==void 0?t.volume:1,a._xhr={method:t.xhr&&t.xhr.method?t.xhr.method:"GET",headers:t.xhr&&t.xhr.headers?t.xhr.headers:null,withCredentials:t.xhr&&t.xhr.withCredentials?t.xhr.withCredentials:!1},a._duration=0,a._state="unloaded",a._sounds=[],a._endTimers={},a._queue=[],a._playLock=!1,a._onend=t.onend?[{fn:t.onend}]:[],a._onfade=t.onfade?[{fn:t.onfade}]:[],a._onload=t.onload?[{fn:t.onload}]:[],a._onloaderror=t.onloaderror?[{fn:t.onloaderror}]:[],a._onplayerror=t.onplayerror?[{fn:t.onplayerror}]:[],a._onpause=t.onpause?[{fn:t.onpause}]:[],a._onplay=t.onplay?[{fn:t.onplay}]:[],a._onstop=t.onstop?[{fn:t.onstop}]:[],a._onmute=t.onmute?[{fn:t.onmute}]:[],a._onvolume=t.onvolume?[{fn:t.onvolume}]:[],a._onrate=t.onrate?[{fn:t.onrate}]:[],a._onseek=t.onseek?[{fn:t.onseek}]:[],a._onunlock=t.onunlock?[{fn:t.onunlock}]:[],a._onresume=[],a._webAudio=e.usingWebAudio&&!a._html5,typeof e.ctx<"u"&&e.ctx&&e.autoUnlock&&e._unlockAudio(),e._howls.push(a),a._autoplay&&a._queue.push({event:"play",action:function(){a.play()}}),a._preload&&a._preload!=="none"&&a.load(),a},load:function(){var t=this,a=null;if(e.noAudio){t._emit("loaderror",null,"No audio support.");return}typeof t._src=="string"&&(t._src=[t._src]);for(var c=0;c<t._src.length;c++){var f,h;if(t._format&&t._format[c])f=t._format[c];else{if(h=t._src[c],typeof h!="string"){t._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}f=/^data:audio\/([^;,]+);/i.exec(h),f||(f=/\.([^.]+)$/.exec(h.split("?",1)[0])),f&&(f=f[1].toLowerCase())}if(f||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),f&&e.codecs(f)){a=t._src[c];break}}if(!a){t._emit("loaderror",null,"No codec support for selected audio sources.");return}return t._src=a,t._state="loading",window.location.protocol==="https:"&&a.slice(0,5)==="http:"&&(t._html5=!0,t._webAudio=!1),new r(t),t._webAudio&&d(t),t},play:function(t,a){var c=this,f=null;if(typeof t=="number")f=t,t=null;else{if(typeof t=="string"&&c._state==="loaded"&&!c._sprite[t])return null;if(typeof t>"u"&&(t="__default",!c._playLock)){for(var h=0,v=0;v<c._sounds.length;v++)c._sounds[v]._paused&&!c._sounds[v]._ended&&(h++,f=c._sounds[v]._id);h===1?t=null:f=null}}var m=f?c._soundById(f):c._inactiveSound();if(!m)return null;if(f&&!t&&(t=m._sprite||"__default"),c._state!=="loaded"){m._sprite=t,m._ended=!1;var w=m._id;return c._queue.push({event:"play",action:function(){c.play(w)}}),w}if(f&&!m._paused)return a||c._loadQueue("play"),m._id;c._webAudio&&e._autoResume();var O=Math.max(0,m._seek>0?m._seek:c._sprite[t][0]/1e3),I=Math.max(0,(c._sprite[t][0]+c._sprite[t][1])/1e3-O),x=I*1e3/Math.abs(m._rate),C=c._sprite[t][0]/1e3,S=(c._sprite[t][0]+c._sprite[t][1])/1e3;m._sprite=t,m._ended=!1;var E=function(){m._paused=!1,m._seek=O,m._start=C,m._stop=S,m._loop=!!(m._loop||c._sprite[t][2])};if(O>=S){c._ended(m);return}var A=m._node;if(c._webAudio){var b=function(){c._playLock=!1,E(),c._refreshBuffer(m);var P=m._muted||c._muted?0:m._volume;A.gain.setValueAtTime(P,e.ctx.currentTime),m._playStart=e.ctx.currentTime,typeof A.bufferSource.start>"u"?m._loop?A.bufferSource.noteGrainOn(0,O,86400):A.bufferSource.noteGrainOn(0,O,I):m._loop?A.bufferSource.start(0,O,86400):A.bufferSource.start(0,O,I),x!==1/0&&(c._endTimers[m._id]=setTimeout(c._ended.bind(c,m),x)),a||setTimeout(function(){c._emit("play",m._id),c._loadQueue()},0)};e.state==="running"&&e.ctx.state!=="interrupted"?b():(c._playLock=!0,c.once("resume",b),c._clearTimer(m._id))}else{var y=function(){A.currentTime=O,A.muted=m._muted||c._muted||e._muted||A.muted,A.volume=m._volume*e.volume(),A.playbackRate=m._rate;try{var P=A.play();if(P&&typeof Promise<"u"&&(P instanceof Promise||typeof P.then=="function")?(c._playLock=!0,E(),P.then(function(){c._playLock=!1,A._unlocked=!0,a?c._loadQueue():c._emit("play",m._id)}).catch(function(){c._playLock=!1,c._emit("playerror",m._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),m._ended=!0,m._paused=!0})):a||(c._playLock=!1,E(),c._emit("play",m._id)),A.playbackRate=m._rate,A.paused){c._emit("playerror",m._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}t!=="__default"||m._loop?c._endTimers[m._id]=setTimeout(c._ended.bind(c,m),x):(c._endTimers[m._id]=function(){c._ended(m),A.removeEventListener("ended",c._endTimers[m._id],!1)},A.addEventListener("ended",c._endTimers[m._id],!1))}catch($){c._emit("playerror",m._id,$)}};A.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(A.src=c._src,A.load());var T=window&&window.ejecta||!A.readyState&&e._navigator.isCocoonJS;if(A.readyState>=3||T)y();else{c._playLock=!0,c._state="loading";var k=function(){c._state="loaded",y(),A.removeEventListener(e._canPlayEvent,k,!1)};A.addEventListener(e._canPlayEvent,k,!1),c._clearTimer(m._id)}}return m._id},pause:function(t){var a=this;if(a._state!=="loaded"||a._playLock)return a._queue.push({event:"pause",action:function(){a.pause(t)}}),a;for(var c=a._getSoundIds(t),f=0;f<c.length;f++){a._clearTimer(c[f]);var h=a._soundById(c[f]);if(h&&!h._paused&&(h._seek=a.seek(c[f]),h._rateSeek=0,h._paused=!0,a._stopFade(c[f]),h._node))if(a._webAudio){if(!h._node.bufferSource)continue;typeof h._node.bufferSource.stop>"u"?h._node.bufferSource.noteOff(0):h._node.bufferSource.stop(0),a._cleanBuffer(h._node)}else(!isNaN(h._node.duration)||h._node.duration===1/0)&&h._node.pause();arguments[1]||a._emit("pause",h?h._id:null)}return a},stop:function(t,a){var c=this;if(c._state!=="loaded"||c._playLock)return c._queue.push({event:"stop",action:function(){c.stop(t)}}),c;for(var f=c._getSoundIds(t),h=0;h<f.length;h++){c._clearTimer(f[h]);var v=c._soundById(f[h]);v&&(v._seek=v._start||0,v._rateSeek=0,v._paused=!0,v._ended=!0,c._stopFade(f[h]),v._node&&(c._webAudio?v._node.bufferSource&&(typeof v._node.bufferSource.stop>"u"?v._node.bufferSource.noteOff(0):v._node.bufferSource.stop(0),c._cleanBuffer(v._node)):(!isNaN(v._node.duration)||v._node.duration===1/0)&&(v._node.currentTime=v._start||0,v._node.pause(),v._node.duration===1/0&&c._clearSound(v._node))),a||c._emit("stop",v._id))}return c},mute:function(t,a){var c=this;if(c._state!=="loaded"||c._playLock)return c._queue.push({event:"mute",action:function(){c.mute(t,a)}}),c;if(typeof a>"u")if(typeof t=="boolean")c._muted=t;else return c._muted;for(var f=c._getSoundIds(a),h=0;h<f.length;h++){var v=c._soundById(f[h]);v&&(v._muted=t,v._interval&&c._stopFade(v._id),c._webAudio&&v._node?v._node.gain.setValueAtTime(t?0:v._volume,e.ctx.currentTime):v._node&&(v._node.muted=e._muted?!0:t),c._emit("mute",v._id))}return c},volume:function(){var t=this,a=arguments,c,f;if(a.length===0)return t._volume;if(a.length===1||a.length===2&&typeof a[1]>"u"){var h=t._getSoundIds(),v=h.indexOf(a[0]);v>=0?f=parseInt(a[0],10):c=parseFloat(a[0])}else a.length>=2&&(c=parseFloat(a[0]),f=parseInt(a[1],10));var m;if(typeof c<"u"&&c>=0&&c<=1){if(t._state!=="loaded"||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,a)}}),t;typeof f>"u"&&(t._volume=c),f=t._getSoundIds(f);for(var w=0;w<f.length;w++)m=t._soundById(f[w]),m&&(m._volume=c,a[2]||t._stopFade(f[w]),t._webAudio&&m._node&&!m._muted?m._node.gain.setValueAtTime(c,e.ctx.currentTime):m._node&&!m._muted&&(m._node.volume=c*e.volume()),t._emit("volume",m._id))}else return m=f?t._soundById(f):t._sounds[0],m?m._volume:0;return t},fade:function(t,a,c,f){var h=this;if(h._state!=="loaded"||h._playLock)return h._queue.push({event:"fade",action:function(){h.fade(t,a,c,f)}}),h;t=Math.min(Math.max(0,parseFloat(t)),1),a=Math.min(Math.max(0,parseFloat(a)),1),c=parseFloat(c),h.volume(t,f);for(var v=h._getSoundIds(f),m=0;m<v.length;m++){var w=h._soundById(v[m]);if(w){if(f||h._stopFade(v[m]),h._webAudio&&!w._muted){var O=e.ctx.currentTime,I=O+c/1e3;w._volume=t,w._node.gain.setValueAtTime(t,O),w._node.gain.linearRampToValueAtTime(a,I)}h._startFadeInterval(w,t,a,c,v[m],typeof f>"u")}}return h},_startFadeInterval:function(t,a,c,f,h,v){var m=this,w=a,O=c-a,I=Math.abs(O/.01),x=Math.max(4,I>0?f/I:f),C=Date.now();t._fadeTo=c,t._interval=setInterval(function(){var S=(Date.now()-C)/f;C=Date.now(),w+=O*S,w=Math.round(w*100)/100,O<0?w=Math.max(c,w):w=Math.min(c,w),m._webAudio?t._volume=w:m.volume(w,t._id,!0),v&&(m._volume=w),(c<a&&w<=c||c>a&&w>=c)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,m.volume(c,t._id),m._emit("fade",t._id))},x)},_stopFade:function(t){var a=this,c=a._soundById(t);return c&&c._interval&&(a._webAudio&&c._node.gain.cancelScheduledValues(e.ctx.currentTime),clearInterval(c._interval),c._interval=null,a.volume(c._fadeTo,t),c._fadeTo=null,a._emit("fade",t)),a},loop:function(){var t=this,a=arguments,c,f,h;if(a.length===0)return t._loop;if(a.length===1)if(typeof a[0]=="boolean")c=a[0],t._loop=c;else return h=t._soundById(parseInt(a[0],10)),h?h._loop:!1;else a.length===2&&(c=a[0],f=parseInt(a[1],10));for(var v=t._getSoundIds(f),m=0;m<v.length;m++)h=t._soundById(v[m]),h&&(h._loop=c,t._webAudio&&h._node&&h._node.bufferSource&&(h._node.bufferSource.loop=c,c&&(h._node.bufferSource.loopStart=h._start||0,h._node.bufferSource.loopEnd=h._stop,t.playing(v[m])&&(t.pause(v[m],!0),t.play(v[m],!0)))));return t},rate:function(){var t=this,a=arguments,c,f;if(a.length===0)f=t._sounds[0]._id;else if(a.length===1){var h=t._getSoundIds(),v=h.indexOf(a[0]);v>=0?f=parseInt(a[0],10):c=parseFloat(a[0])}else a.length===2&&(c=parseFloat(a[0]),f=parseInt(a[1],10));var m;if(typeof c=="number"){if(t._state!=="loaded"||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,a)}}),t;typeof f>"u"&&(t._rate=c),f=t._getSoundIds(f);for(var w=0;w<f.length;w++)if(m=t._soundById(f[w]),m){t.playing(f[w])&&(m._rateSeek=t.seek(f[w]),m._playStart=t._webAudio?e.ctx.currentTime:m._playStart),m._rate=c,t._webAudio&&m._node&&m._node.bufferSource?m._node.bufferSource.playbackRate.setValueAtTime(c,e.ctx.currentTime):m._node&&(m._node.playbackRate=c);var O=t.seek(f[w]),I=(t._sprite[m._sprite][0]+t._sprite[m._sprite][1])/1e3-O,x=I*1e3/Math.abs(m._rate);(t._endTimers[f[w]]||!m._paused)&&(t._clearTimer(f[w]),t._endTimers[f[w]]=setTimeout(t._ended.bind(t,m),x)),t._emit("rate",m._id)}}else return m=t._soundById(f),m?m._rate:t._rate;return t},seek:function(){var t=this,a=arguments,c,f;if(a.length===0)t._sounds.length&&(f=t._sounds[0]._id);else if(a.length===1){var h=t._getSoundIds(),v=h.indexOf(a[0]);v>=0?f=parseInt(a[0],10):t._sounds.length&&(f=t._sounds[0]._id,c=parseFloat(a[0]))}else a.length===2&&(c=parseFloat(a[0]),f=parseInt(a[1],10));if(typeof f>"u")return 0;if(typeof c=="number"&&(t._state!=="loaded"||t._playLock))return t._queue.push({event:"seek",action:function(){t.seek.apply(t,a)}}),t;var m=t._soundById(f);if(m)if(typeof c=="number"&&c>=0){var w=t.playing(f);w&&t.pause(f,!0),m._seek=c,m._ended=!1,t._clearTimer(f),!t._webAudio&&m._node&&!isNaN(m._node.duration)&&(m._node.currentTime=c);var O=function(){w&&t.play(f,!0),t._emit("seek",f)};if(w&&!t._webAudio){var I=function(){t._playLock?setTimeout(I,0):O()};setTimeout(I,0)}else O()}else if(t._webAudio){var x=t.playing(f)?e.ctx.currentTime-m._playStart:0,C=m._rateSeek?m._rateSeek-m._seek:0;return m._seek+(C+x*Math.abs(m._rate))}else return m._node.currentTime;return t},playing:function(t){var a=this;if(typeof t=="number"){var c=a._soundById(t);return c?!c._paused:!1}for(var f=0;f<a._sounds.length;f++)if(!a._sounds[f]._paused)return!0;return!1},duration:function(t){var a=this,c=a._duration,f=a._soundById(t);return f&&(c=a._sprite[f._sprite][1]/1e3),c},state:function(){return this._state},unload:function(){for(var t=this,a=t._sounds,c=0;c<a.length;c++)a[c]._paused||t.stop(a[c]._id),t._webAudio||(t._clearSound(a[c]._node),a[c]._node.removeEventListener("error",a[c]._errorFn,!1),a[c]._node.removeEventListener(e._canPlayEvent,a[c]._loadFn,!1),a[c]._node.removeEventListener("ended",a[c]._endFn,!1),e._releaseHtml5Audio(a[c]._node)),delete a[c]._node,t._clearTimer(a[c]._id);var f=e._howls.indexOf(t);f>=0&&e._howls.splice(f,1);var h=!0;for(c=0;c<e._howls.length;c++)if(e._howls[c]._src===t._src||t._src.indexOf(e._howls[c]._src)>=0){h=!1;break}return s&&h&&delete s[t._src],e.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,a,c,f){var h=this,v=h["_on"+t];return typeof a=="function"&&v.push(f?{id:c,fn:a,once:f}:{id:c,fn:a}),h},off:function(t,a,c){var f=this,h=f["_on"+t],v=0;if(typeof a=="number"&&(c=a,a=null),a||c)for(v=0;v<h.length;v++){var m=c===h[v].id;if(a===h[v].fn&&m||!a&&m){h.splice(v,1);break}}else if(t)f["_on"+t]=[];else{var w=Object.keys(f);for(v=0;v<w.length;v++)w[v].indexOf("_on")===0&&Array.isArray(f[w[v]])&&(f[w[v]]=[])}return f},once:function(t,a,c){var f=this;return f.on(t,a,c,1),f},_emit:function(t,a,c){for(var f=this,h=f["_on"+t],v=h.length-1;v>=0;v--)(!h[v].id||h[v].id===a||t==="load")&&(setTimeout((function(m){m.call(this,a,c)}).bind(f,h[v].fn),0),h[v].once&&f.off(t,h[v].fn,h[v].id));return f._loadQueue(t),f},_loadQueue:function(t){var a=this;if(a._queue.length>0){var c=a._queue[0];c.event===t&&(a._queue.shift(),a._loadQueue()),t||c.action()}return a},_ended:function(t){var a=this,c=t._sprite;if(!a._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime<t._stop)return setTimeout(a._ended.bind(a,t),100),a;var f=!!(t._loop||a._sprite[c][2]);if(a._emit("end",t._id),!a._webAudio&&f&&a.stop(t._id,!0).play(t._id),a._webAudio&&f){a._emit("play",t._id),t._seek=t._start||0,t._rateSeek=0,t._playStart=e.ctx.currentTime;var h=(t._stop-t._start)*1e3/Math.abs(t._rate);a._endTimers[t._id]=setTimeout(a._ended.bind(a,t),h)}return a._webAudio&&!f&&(t._paused=!0,t._ended=!0,t._seek=t._start||0,t._rateSeek=0,a._clearTimer(t._id),a._cleanBuffer(t._node),e._autoSuspend()),!a._webAudio&&!f&&a.stop(t._id,!0),a},_clearTimer:function(t){var a=this;if(a._endTimers[t]){if(typeof a._endTimers[t]!="function")clearTimeout(a._endTimers[t]);else{var c=a._soundById(t);c&&c._node&&c._node.removeEventListener("ended",a._endTimers[t],!1)}delete a._endTimers[t]}return a},_soundById:function(t){for(var a=this,c=0;c<a._sounds.length;c++)if(t===a._sounds[c]._id)return a._sounds[c];return null},_inactiveSound:function(){var t=this;t._drain();for(var a=0;a<t._sounds.length;a++)if(t._sounds[a]._ended)return t._sounds[a].reset();return new r(t)},_drain:function(){var t=this,a=t._pool,c=0,f=0;if(!(t._sounds.length<a)){for(f=0;f<t._sounds.length;f++)t._sounds[f]._ended&&c++;for(f=t._sounds.length-1;f>=0;f--){if(c<=a)return;t._sounds[f]._ended&&(t._webAudio&&t._sounds[f]._node&&t._sounds[f]._node.disconnect(0),t._sounds.splice(f,1),c--)}}},_getSoundIds:function(t){var a=this;if(typeof t>"u"){for(var c=[],f=0;f<a._sounds.length;f++)c.push(a._sounds[f]._id);return c}else return[t]},_refreshBuffer:function(t){var a=this;return t._node.bufferSource=e.ctx.createBufferSource(),t._node.bufferSource.buffer=s[a._src],t._panner?t._node.bufferSource.connect(t._panner):t._node.bufferSource.connect(t._node),t._node.bufferSource.loop=t._loop,t._loop&&(t._node.bufferSource.loopStart=t._start||0,t._node.bufferSource.loopEnd=t._stop||0),t._node.bufferSource.playbackRate.setValueAtTime(t._rate,e.ctx.currentTime),a},_cleanBuffer:function(t){var a=this,c=e._navigator&&e._navigator.vendor.indexOf("Apple")>=0;if(!t.bufferSource)return a;if(e._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),c))try{t.bufferSource.buffer=e._scratchBuffer}catch{}return t.bufferSource=null,a},_clearSound:function(t){var a=/MSIE |Trident\//.test(e._navigator&&e._navigator.userAgent);a||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var r=function(t){this._parent=t,this.init()};r.prototype={init:function(){var t=this,a=t._parent;return t._muted=a._muted,t._loop=a._loop,t._volume=a._volume,t._rate=a._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++e._counter,a._sounds.push(t),t.create(),t},create:function(){var t=this,a=t._parent,c=e._muted||t._muted||t._parent._muted?0:t._volume;return a._webAudio?(t._node=typeof e.ctx.createGain>"u"?e.ctx.createGainNode():e.ctx.createGain(),t._node.gain.setValueAtTime(c,e.ctx.currentTime),t._node.paused=!0,t._node.connect(e.masterGain)):e.noAudio||(t._node=e._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(e._canPlayEvent,t._loadFn,!1),t._endFn=t._endListener.bind(t),t._node.addEventListener("ended",t._endFn,!1),t._node.src=a._src,t._node.preload=a._preload===!0?"auto":a._preload,t._node.volume=c*e.volume(),t._node.load()),t},reset:function(){var t=this,a=t._parent;return t._muted=a._muted,t._loop=a._loop,t._volume=a._volume,t._rate=a._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++e._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this,a=t._parent;a._duration=Math.ceil(t._node.duration*10)/10,Object.keys(a._sprite).length===0&&(a._sprite={__default:[0,a._duration*1e3]}),a._state!=="loaded"&&(a._state="loaded",a._emit("load"),a._loadQueue()),t._node.removeEventListener(e._canPlayEvent,t._loadFn,!1)},_endListener:function(){var t=this,a=t._parent;a._duration===1/0&&(a._duration=Math.ceil(t._node.duration*10)/10,a._sprite.__default[1]===1/0&&(a._sprite.__default[1]=a._duration*1e3),a._ended(t)),t._node.removeEventListener("ended",t._endFn,!1)}};var s={},d=function(t){var a=t._src;if(s[a]){t._duration=s[a].duration,_(t);return}if(/^data:[^;]+;base64,/.test(a)){for(var c=atob(a.split(",")[1]),f=new Uint8Array(c.length),h=0;h<c.length;++h)f[h]=c.charCodeAt(h);p(f.buffer,t)}else{var v=new XMLHttpRequest;v.open(t._xhr.method,a,!0),v.withCredentials=t._xhr.withCredentials,v.responseType="arraybuffer",t._xhr.headers&&Object.keys(t._xhr.headers).forEach(function(m){v.setRequestHeader(m,t._xhr.headers[m])}),v.onload=function(){var m=(v.status+"")[0];if(m!=="0"&&m!=="2"&&m!=="3"){t._emit("loaderror",null,"Failed loading audio file with status: "+v.status+".");return}p(v.response,t)},v.onerror=function(){t._webAudio&&(t._html5=!0,t._webAudio=!1,t._sounds=[],delete s[a],t.load())},u(v)}},u=function(t){try{t.send()}catch{t.onerror()}},p=function(t,a){var c=function(){a._emit("loaderror",null,"Decoding audio data failed.")},f=function(h){h&&a._sounds.length>0?(s[a._src]=h,_(a,h)):c()};typeof Promise<"u"&&e.ctx.decodeAudioData.length===1?e.ctx.decodeAudioData(t).then(f).catch(c):e.ctx.decodeAudioData(t,f,c)},_=function(t,a){a&&!t._duration&&(t._duration=a.duration),Object.keys(t._sprite).length===0&&(t._sprite={__default:[0,t._duration*1e3]}),t._state!=="loaded"&&(t._state="loaded",t._emit("load"),t._loadQueue())},g=function(){if(e.usingWebAudio){try{typeof AudioContext<"u"?e.ctx=new AudioContext:typeof webkitAudioContext<"u"?e.ctx=new webkitAudioContext:e.usingWebAudio=!1}catch{e.usingWebAudio=!1}e.ctx||(e.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(e._navigator&&e._navigator.platform),a=e._navigator&&e._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),c=a?parseInt(a[1],10):null;if(t&&c&&c<9){var f=/safari/.test(e._navigator&&e._navigator.userAgent.toLowerCase());e._navigator&&!f&&(e.usingWebAudio=!1)}e.usingWebAudio&&(e.masterGain=typeof e.ctx.createGain>"u"?e.ctx.createGainNode():e.ctx.createGain(),e.masterGain.gain.setValueAtTime(e._muted?0:e._volume,e.ctx.currentTime),e.masterGain.connect(e.ctx.destination)),e._setup()}};n.Howler=e,n.Howl=o,typeof ce<"u"?(ce.HowlerGlobal=l,ce.Howler=e,ce.Howl=o,ce.Sound=r):typeof window<"u"&&(window.HowlerGlobal=l,window.Howler=e,window.Howl=o,window.Sound=r)})();/*!
26
+ * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
27
+ *
28
+ * howler.js v2.2.4
29
+ * howlerjs.com
30
+ *
31
+ * (c) 2013-2020, James Simpson of GoldFire Studios
32
+ * goldfirestudios.com
33
+ *
34
+ * MIT License
35
+ */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var o=this;if(!o.ctx||!o.ctx.listener)return o;for(var r=o._howls.length-1;r>=0;r--)o._howls[r].stereo(e);return o},HowlerGlobal.prototype.pos=function(e,o,r){var s=this;if(!s.ctx||!s.ctx.listener)return s;if(o=typeof o!="number"?s._pos[1]:o,r=typeof r!="number"?s._pos[2]:r,typeof e=="number")s._pos=[e,o,r],typeof s.ctx.listener.positionX<"u"?(s.ctx.listener.positionX.setTargetAtTime(s._pos[0],Howler.ctx.currentTime,.1),s.ctx.listener.positionY.setTargetAtTime(s._pos[1],Howler.ctx.currentTime,.1),s.ctx.listener.positionZ.setTargetAtTime(s._pos[2],Howler.ctx.currentTime,.1)):s.ctx.listener.setPosition(s._pos[0],s._pos[1],s._pos[2]);else return s._pos;return s},HowlerGlobal.prototype.orientation=function(e,o,r,s,d,u){var p=this;if(!p.ctx||!p.ctx.listener)return p;var _=p._orientation;if(o=typeof o!="number"?_[1]:o,r=typeof r!="number"?_[2]:r,s=typeof s!="number"?_[3]:s,d=typeof d!="number"?_[4]:d,u=typeof u!="number"?_[5]:u,typeof e=="number")p._orientation=[e,o,r,s,d,u],typeof p.ctx.listener.forwardX<"u"?(p.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),p.ctx.listener.forwardY.setTargetAtTime(o,Howler.ctx.currentTime,.1),p.ctx.listener.forwardZ.setTargetAtTime(r,Howler.ctx.currentTime,.1),p.ctx.listener.upX.setTargetAtTime(s,Howler.ctx.currentTime,.1),p.ctx.listener.upY.setTargetAtTime(d,Howler.ctx.currentTime,.1),p.ctx.listener.upZ.setTargetAtTime(u,Howler.ctx.currentTime,.1)):p.ctx.listener.setOrientation(e,o,r,s,d,u);else return _;return p},Howl.prototype.init=function(e){return function(o){var r=this;return r._orientation=o.orientation||[1,0,0],r._stereo=o.stereo||null,r._pos=o.pos||null,r._pannerAttr={coneInnerAngle:typeof o.coneInnerAngle<"u"?o.coneInnerAngle:360,coneOuterAngle:typeof o.coneOuterAngle<"u"?o.coneOuterAngle:360,coneOuterGain:typeof o.coneOuterGain<"u"?o.coneOuterGain:0,distanceModel:typeof o.distanceModel<"u"?o.distanceModel:"inverse",maxDistance:typeof o.maxDistance<"u"?o.maxDistance:1e4,panningModel:typeof o.panningModel<"u"?o.panningModel:"HRTF",refDistance:typeof o.refDistance<"u"?o.refDistance:1,rolloffFactor:typeof o.rolloffFactor<"u"?o.rolloffFactor:1},r._onstereo=o.onstereo?[{fn:o.onstereo}]:[],r._onpos=o.onpos?[{fn:o.onpos}]:[],r._onorientation=o.onorientation?[{fn:o.onorientation}]:[],e.call(this,o)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,o){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"stereo",action:function(){r.stereo(e,o)}}),r;var s=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof o>"u")if(typeof e=="number")r._stereo=e,r._pos=[e,0,0];else return r._stereo;for(var d=r._getSoundIds(o),u=0;u<d.length;u++){var p=r._soundById(d[u]);if(p)if(typeof e=="number")p._stereo=e,p._pos=[e,0,0],p._node&&(p._pannerAttr.panningModel="equalpower",(!p._panner||!p._panner.pan)&&l(p,s),s==="spatial"?typeof p._panner.positionX<"u"?(p._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),p._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),p._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):p._panner.setPosition(e,0,0):p._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),r._emit("stereo",p._id);else return p._stereo}return r},Howl.prototype.pos=function(e,o,r,s){var d=this;if(!d._webAudio)return d;if(d._state!=="loaded")return d._queue.push({event:"pos",action:function(){d.pos(e,o,r,s)}}),d;if(o=typeof o!="number"?0:o,r=typeof r!="number"?-.5:r,typeof s>"u")if(typeof e=="number")d._pos=[e,o,r];else return d._pos;for(var u=d._getSoundIds(s),p=0;p<u.length;p++){var _=d._soundById(u[p]);if(_)if(typeof e=="number")_._pos=[e,o,r],_._node&&((!_._panner||_._panner.pan)&&l(_,"spatial"),typeof _._panner.positionX<"u"?(_._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),_._panner.positionY.setValueAtTime(o,Howler.ctx.currentTime),_._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):_._panner.setPosition(e,o,r)),d._emit("pos",_._id);else return _._pos}return d},Howl.prototype.orientation=function(e,o,r,s){var d=this;if(!d._webAudio)return d;if(d._state!=="loaded")return d._queue.push({event:"orientation",action:function(){d.orientation(e,o,r,s)}}),d;if(o=typeof o!="number"?d._orientation[1]:o,r=typeof r!="number"?d._orientation[2]:r,typeof s>"u")if(typeof e=="number")d._orientation=[e,o,r];else return d._orientation;for(var u=d._getSoundIds(s),p=0;p<u.length;p++){var _=d._soundById(u[p]);if(_)if(typeof e=="number")_._orientation=[e,o,r],_._node&&(_._panner||(_._pos||(_._pos=d._pos||[0,0,-.5]),l(_,"spatial")),typeof _._panner.orientationX<"u"?(_._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),_._panner.orientationY.setValueAtTime(o,Howler.ctx.currentTime),_._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):_._panner.setOrientation(e,o,r)),d._emit("orientation",_._id);else return _._orientation}return d},Howl.prototype.pannerAttr=function(){var e=this,o=arguments,r,s,d;if(!e._webAudio)return e;if(o.length===0)return e._pannerAttr;if(o.length===1)if(typeof o[0]=="object")r=o[0],typeof s>"u"&&(r.pannerAttr||(r.pannerAttr={coneInnerAngle:r.coneInnerAngle,coneOuterAngle:r.coneOuterAngle,coneOuterGain:r.coneOuterGain,distanceModel:r.distanceModel,maxDistance:r.maxDistance,refDistance:r.refDistance,rolloffFactor:r.rolloffFactor,panningModel:r.panningModel}),e._pannerAttr={coneInnerAngle:typeof r.pannerAttr.coneInnerAngle<"u"?r.pannerAttr.coneInnerAngle:e._coneInnerAngle,coneOuterAngle:typeof r.pannerAttr.coneOuterAngle<"u"?r.pannerAttr.coneOuterAngle:e._coneOuterAngle,coneOuterGain:typeof r.pannerAttr.coneOuterGain<"u"?r.pannerAttr.coneOuterGain:e._coneOuterGain,distanceModel:typeof r.pannerAttr.distanceModel<"u"?r.pannerAttr.distanceModel:e._distanceModel,maxDistance:typeof r.pannerAttr.maxDistance<"u"?r.pannerAttr.maxDistance:e._maxDistance,refDistance:typeof r.pannerAttr.refDistance<"u"?r.pannerAttr.refDistance:e._refDistance,rolloffFactor:typeof r.pannerAttr.rolloffFactor<"u"?r.pannerAttr.rolloffFactor:e._rolloffFactor,panningModel:typeof r.pannerAttr.panningModel<"u"?r.pannerAttr.panningModel:e._panningModel});else return d=e._soundById(parseInt(o[0],10)),d?d._pannerAttr:e._pannerAttr;else o.length===2&&(r=o[0],s=parseInt(o[1],10));for(var u=e._getSoundIds(s),p=0;p<u.length;p++)if(d=e._soundById(u[p]),d){var _=d._pannerAttr;_={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:_.coneInnerAngle,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:_.coneOuterAngle,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:_.coneOuterGain,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:_.distanceModel,maxDistance:typeof r.maxDistance<"u"?r.maxDistance:_.maxDistance,refDistance:typeof r.refDistance<"u"?r.refDistance:_.refDistance,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:_.rolloffFactor,panningModel:typeof r.panningModel<"u"?r.panningModel:_.panningModel};var g=d._panner;g||(d._pos||(d._pos=e._pos||[0,0,-.5]),l(d,"spatial"),g=d._panner),g.coneInnerAngle=_.coneInnerAngle,g.coneOuterAngle=_.coneOuterAngle,g.coneOuterGain=_.coneOuterGain,g.distanceModel=_.distanceModel,g.maxDistance=_.maxDistance,g.refDistance=_.refDistance,g.rolloffFactor=_.rolloffFactor,g.panningModel=_.panningModel}return e},Sound.prototype.init=function(e){return function(){var o=this,r=o._parent;o._orientation=r._orientation,o._stereo=r._stereo,o._pos=r._pos,o._pannerAttr=r._pannerAttr,e.call(this),o._stereo?r.stereo(o._stereo):o._pos&&r.pos(o._pos[0],o._pos[1],o._pos[2],o._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var o=this,r=o._parent;return o._orientation=r._orientation,o._stereo=r._stereo,o._pos=r._pos,o._pannerAttr=r._pannerAttr,o._stereo?r.stereo(o._stereo):o._pos?r.pos(o._pos[0],o._pos[1],o._pos[2],o._id):o._panner&&(o._panner.disconnect(0),o._panner=void 0,r._refreshBuffer(o)),e.call(this)}}(Sound.prototype.reset);var l=function(e,o){o=o||"spatial",o==="spatial"?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,typeof e._panner.positionX<"u"?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),typeof e._panner.orientationX<"u"?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}})()})(Re);const pr=At({__proto__:null,default:fr(Re)},[Re]);q.default=dr,Object.defineProperties(q,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,29 +1,42 @@
1
1
  {
2
- "name": "@ddict/popup",
3
- "version": "1.0.5",
4
- "files": [
5
- "dist"
6
- ],
7
- "main": "./dist/popup.umd.js",
8
- "module": "./dist/popup.es.js",
9
- "license": "UNLICENSED",
10
- "scripts": {
11
- "lint": "eslint src",
12
- "dev": "vite",
13
- "build": "vite build",
14
- "preview": "vite preview"
15
- },
16
- "dependencies": {
17
- "daisyui": "^1.25.4",
18
- "vue": "^3.2.25"
19
- },
20
- "devDependencies": {
21
- "@vitejs/plugin-vue": "^2.0.0",
22
- "autoprefixer": "^10.4.2",
23
- "eslint": "^8.6.0",
24
- "eslint-plugin-vue": "^8.2.0",
25
- "postcss": "^8.4.6",
26
- "tailwindcss": "^3.0.19",
27
- "vite": "^2.7.2"
28
- }
2
+ "name": "@ddict/popup",
3
+ "version": "1.0.7",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "main": "./dist/popup.umd.js",
9
+ "module": "./dist/popup.es.js",
10
+ "license": "UNLICENSED",
11
+ "scripts": {
12
+ "dev": "vite",
13
+ "build": "vite build",
14
+ "preview": "vite preview",
15
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",
16
+ "format": "prettier --write src/",
17
+ "format-check": "prettier --check src/"
18
+ },
19
+ "dependencies": {
20
+ "@headlessui/vue": "^1.7.22",
21
+ "@heroicons/vue": "^2.1.5",
22
+ "@vueuse/core": "^10.11.0",
23
+ "@vueuse/sound": "^2.0.1",
24
+ "daisyui": "^4.12.10",
25
+ "pinia": "^2.1.7",
26
+ "vue": "^3.4.31",
27
+ "vue-router": "^4.4.0"
28
+ },
29
+ "devDependencies": {
30
+ "@rushstack/eslint-patch": "^1.10.3",
31
+ "@vitejs/plugin-vue": "^5.0.5",
32
+ "@vue/eslint-config-prettier": "^9.0.0",
33
+ "autoprefixer": "^10.4.19",
34
+ "eslint": "^8.57.0",
35
+ "eslint-plugin-vue": "^9.27.0",
36
+ "eslint-plugin-vuetify": "^2.4.0",
37
+ "postcss": "^8.4.39",
38
+ "prettier": "^3.3.3",
39
+ "tailwindcss": "^3.4.4",
40
+ "vite": "^5.3.3"
41
+ }
29
42
  }