function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = ["./browserAll-BT1z9cKE.js","./webworkerAll-DPPv9Ibl.js","./colorToUniform-Bf80N278.js","./CanvasPool-E3p4G6BL.js","./batchSamplersUniformGroup-CKEGmRNN.js","./MoveTorrentDialog.vue_vue_type_script_setup_true_lang-Cz5dpnUF.js","./index-CfNDsQKB.js","./vue--7UcA1iU.js","./vuetify-GhifFkZ7.js","./index-DG91Wfig.css","./FileIcon-DH65fwz5.js","./MoveTorrentFileDialog.vue_vue_type_script_setup_true_lang-BvP4_KF0.js","./WebGPURenderer-Du7v9tBH.js","./SharedSystems-DuYq6R0P.js","./WebGLRenderer-BJRUYaxc.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } import{a as _n,_ as gn,__tla as __tla_0}from"./MoveTorrentDialog.vue_vue_type_script_setup_true_lang-Cz5dpnUF.js";import{b as Le,E as _e,k as st,h as Kt,aY as At,aP as yn,aW as xn,X as Nt,C as te,f as Ds,aZ as bn,V as ce,am as vn,t as z,Z as Oe,$ as si,a_ as Bt,s as K,a1 as re,Q as ee,O as se,aN as wn,R as An,I as de,J as kt,a3 as is,aK as ae,aU as Zt,N as Cn,a$ as rs,m as or,c as ns,b0 as Sn,b1 as Mn,i as nt,p as Pn,b2 as kn,aO as Rs,b3 as Tn,d as De,aL as In,aM as En,b4 as wi,aJ as Dn,a4 as Rn,K as Bs,a2 as ar,b5 as Bn,b6 as ps,j as Fs,o as lr,ag as hr,g as Vs,b7 as Ai,ac as Ci,e as Fn,az as Vn,U as Nn,W as $n,aA as ne,__tla as __tla_1}from"./index-CfNDsQKB.js";import{g as ct,G as ge,c as W,I as k,W as G,X as I,N as Ns,J as $,K as x,L as V,M as S,O as ht,u as M,V as Re,m as g,Y as ur,a1 as mt,d as pt,Q as Gn,A as cr,a7 as Si,a0 as _t,F as lt,R as dr,D as ii,s as Mi,w as ls,x as ri,$ as hs,U as Pi,H as ni,n as $s,r as Ln,P as On,a as Un,q as zn,T as Yn}from"./vue--7UcA1iU.js";import{g as Hn}from"./FileIcon-DH65fwz5.js";import{u as fr,a as Xn}from"./vuetify-GhifFkZ7.js";import{_ as Wn,__tla as __tla_2}from"./MoveTorrentFileDialog.vue_vue_type_script_setup_true_lang-BvP4_KF0.js";let Gr,Zr,ft,dt,Qt,tt,zo,sa,Cs,xt,Mr,J,Q,tn,Ja,pe,ut,oe,ot,ol,je,Hs,Me,zl,Yl,hi,he,on,$t,Fe,Hi,as,Io,ln,Lh,Ge,ya,Wr,ie,Zi,il,Vr,Gt,O,Y,To,al,Gh,sl,St,Cr,Oo,Rt,Be,at,ba,Dt,$a,cl,Ui;let __tla=Promise.all([(()=>{try{return __tla_0}catch{}})(),(()=>{try{return __tla_1}catch{}})(),(()=>{try{return __tla_2}catch{}})()]).then(async()=>{var ss=(i=>(i[i.MISSING=0]="MISSING",i[i.DOWNLOADING=1]="DOWNLOADING",i[i.DOWNLOADED=2]="DOWNLOADED",i))(ss||{}),Vt=(i=>(i[i.DISABLED=0]="DISABLED",i[i.NOT_YET_CONTACTED=1]="NOT_YET_CONTACTED",i[i.WORKING=2]="WORKING",i[i.UPDATING=3]="UPDATING",i[i.NOT_WORKING=4]="NOT_WORKING",i))(Vt||{});const qn={class:"d-flex"},jn={class:"d-flex flex-column overflow-hidden text-no-wrap mr-3"},Zn={class:"text-grey"},Kn={class:"d-flex align-center"},ki="#ffe476",Qn=ct({__name:"ContentNode",props:{node:{},openedItems:{}},emits:["setFilePrio","onRightClick"],setup(i,{emit:t}){const e=i,s=t,{t:r}=ge(),{mobile:n}=fr(),o=Le(),a=_e(),l=W(()=>{if(e.node.fullName==="")return 0;const _=e.node.fullName.split("/").length,d=n.value?12:24;return _*d});function u(_,d){if(d.type==="file")return;_.stopPropagation();const b=e.openedItems.indexOf(d.fullName);b===-1?e.openedItems.push(d.fullName):e.openedItems.splice(b,1)}async function h(_){_.getPriority()===At.DO_NOT_DOWNLOAD?s("setFilePrio",_.getChildrenIds(),At.NORMAL):s("setFilePrio",_.getChildrenIds(),At.DO_NOT_DOWNLOAD)}function c(_,d){xn(_)?o.internalSelection.has(d.fullName)?o.internalSelection.delete(d.fullName):o.internalSelection.add(d.fullName):o.internalSelection=new Set([d.fullName])}function f(_){return _.getPriority()===At.DO_NOT_DOWNLOAD?"grey":_.getProgress()===1?"green":""}function m(_){const[d,b]=_.getDeepCount(),y=[];return d>1&&y.push(r("torrentDetail.content.folderInfo",d-1)),b>0&&y.push(r("torrentDetail.content.fileInfo",b)),y.join(", ")}function p(_){const d=[Nt(_.getSize(),a.useBinarySize)];return _.type==="folder"&&d.push(m(_)),d.join(" | ")}return(_,d)=>(k(),G("div",{class:Re(["d-flex flex-column py-2 pr-3",_.node.isSelected(M(o).internalSelection)?"selected":""]),style:ur(`padding-left: ${l.value}px`),onClick:d[2]||(d[2]=Ns(b=>c(b,_.node),["stop"])),onContextmenu:d[3]||(d[3]=b=>_.$emit("onRightClick",b,_.node))},[I("div",qn,[I("div",{class:"d-flex align-center",onClick:d[0]||(d[0]=Ns(b=>h(_.node),["stop"]))},[_.node.isWanted()===null?(k(),$(st,{key:0,color:f(_.node),icon:"mdi-checkbox-intermediate-variant"},null,8,["color"])):_.node.isWanted()?(k(),$(st,{key:1,color:f(_.node),icon:"mdi-checkbox-marked"},null,8,["color"])):(k(),$(st,{key:2,color:f(_.node),icon:"mdi-checkbox-blank-outline"},null,8,["color"]))]),I("div",{class:"d-flex align-center spacer",onClick:d[1]||(d[1]=b=>u(b,_.node))},[_.node.type==="folder"?(k(),$(st,{key:0},{default:x(()=>[V(S(_.openedItems.includes(_.node.fullName)?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:1})):ht("",!0),_.node.fullName===""?(k(),$(st,{key:1,icon:"mdi-file-tree"})):_.node.type==="file"?(k(),$(st,{key:2,icon:M(Hn)(_.node.name)},null,8,["icon"])):_.openedItems.includes(_.node.fullName)?(k(),$(st,{key:3,icon:"mdi-folder-open",color:ki})):(k(),$(st,{key:4,icon:"mdi-folder",color:ki}))]),I("div",jn,[I("div",{class:Re(`text-${f(_.node)}`)},S(_.node.name),3),I("div",Zn,S(p(_.node)),1)]),g(Kt),I("div",Kn,[_.node.getPriority()===M(At).MAXIMAL?(k(),$(st,{key:0,color:"error"},{default:x(()=>[V("mdi-arrow-up")]),_:1})):_.node.getPriority()===M(At).HIGH?(k(),$(st,{key:1,color:"warning"},{default:x(()=>[V("mdi-arrow-top-right")]),_:1})):_.node.getPriority()===M(At).NORMAL?(k(),$(st,{key:2},{default:x(()=>[V("mdi-minus")]),_:1})):_.node.getPriority()===M(At).MIXED?(k(),$(st,{key:3},{default:x(()=>[V("mdi-tilde")]),_:1})):_.node.getPriority()===M(At).DO_NOT_DOWNLOAD?(k(),$(st,{key:4,color:"grey"},{default:x(()=>[V("mdi-cancel")]),_:1})):ht("",!0)])]),g(yn,{"model-value":_.node.getProgress(),max:1,color:f(_.node),rounded:"sm"},null,8,["model-value","color"])],38))}}),Jn=te(Qn,[["__scopeId","data-v-68d0ffb7"]]),to=ct({__name:"Content",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,{height:e}=fr(),s=Le(),{rightClickProperties:r,filenameFilter:n,openedItems:o,flatTree:a,internalSelection:l}=mt(s),u=W(()=>e.value-48*2-64-12*2-56-8);async function h(p,_){r.value.isVisible&&(r.value.isVisible=!1,await cr()),Object.assign(r.value,{isVisible:!0,offset:[p.pageX,p.pageY],hash:t.torrent.hash}),l.value.size<=1&&(l.value=new Set([_.fullName]))}const c=pt();function f(p,_){c.value=setTimeout(()=>{h(p,_)},500)}function m(){clearTimeout(c.value)}return(p,_)=>(k(),$(ce,null,{default:x(()=>[g(Ds,{modelValue:M(n),"onUpdate:modelValue":_[0]||(_[0]=d=>Gn(n)?n.value=d:null),class:"mt-2 mx-3","hide-details":"",clearable:"",placeholder:p.$t("torrentDetail.content.filter_placeholder")},null,8,["modelValue","placeholder"]),g(bn,{id:"tree-root",items:M(a),height:u.value,"item-height":"68",class:"pa-2"},{default:x(({item:d})=>[g(Jn,{"opened-items":M(o),node:d,onSetFilePrio:_[1]||(_[1]=(b,y)=>M(s).setFilePriority(b,y)),onTouchcancel:m,onTouchend:m,onTouchmove:m,onTouchstart:b=>f(b.touches.item(0),d),onOnRightClick:_[2]||(_[2]=(b,y)=>h(b,y))},null,8,["opened-items","node","onTouchstart"])]),_:1},8,["items","height"])]),_:1}))}}),eo={},so={class:"pl-4"},io={class:"pr-4"};function ro(i,t){return k(),$(z,{cols:"12",sm:"6",lg:"3"},{default:x(()=>[g(vn,{rounded:"xl",class:"d-flex align-center py-2 border"},{default:x(()=>[I("div",so,[Si(i.$slots,"title")]),g(Kt),I("div",io,[Si(i.$slots,"text")])]),_:3})]),_:3})}const Ct=te(eo,[["render",ro]]),no=ct({__name:"PanelBoolean",props:{torrent:{}},setup(i){const t=i,e=Oe(),s=si(),{properties:r}=mt(Bt()),n=W({get:()=>t.torrent.auto_tmm,set:h=>e.toggleAutoTmm([t.torrent.hash],h)}),o=W({get:()=>t.torrent.f_l_piece_prio,set:()=>e.toggleFLPiecePrio([t.torrent.hash])}),a=W({get:()=>t.torrent.forced,set:h=>{h?s.forceResumeTorrents([t.torrent.hash]):s.resumeTorrents([t.torrent.hash])}}),l=W({get:()=>t.torrent.seq_dl,set:()=>e.toggleSeqDl([t.torrent.hash])}),u=W({get:()=>t.torrent.super_seeding,set:h=>e.setSuperSeeding([t.torrent.hash],h)});return(h,c)=>(k(),$(se,{title:h.$t("torrentDetail.info.boolean_values")},{default:x(()=>[g(ee,null,{default:x(()=>[g(K,null,{default:x(()=>[g(Ct,null,{title:x(()=>[g(re,{modelValue:n.value,"onUpdate:modelValue":c[0]||(c[0]=f=>n.value=f),"hide-details":"",density:"compact",label:h.$t("torrent.properties.auto_tmm")},null,8,["modelValue","label"])]),_:1}),g(Ct,null,{title:x(()=>[g(re,{modelValue:o.value,"onUpdate:modelValue":c[1]||(c[1]=f=>o.value=f),"hide-details":"",density:"compact",label:h.$t("torrent.properties.f_l_piece_prio")},null,8,["modelValue","label"])]),_:1}),g(Ct,null,{title:x(()=>[g(re,{modelValue:a.value,"onUpdate:modelValue":c[2]||(c[2]=f=>a.value=f),"hide-details":"",density:"compact",label:h.$t("torrent.properties.forced")},null,8,["modelValue","label"])]),_:1}),g(Ct,null,{title:x(()=>[g(re,{modelValue:l.value,"onUpdate:modelValue":c[3]||(c[3]=f=>l.value=f),"hide-details":"",density:"compact",label:h.$t("torrent.properties.seq_dl")},null,8,["modelValue","label"])]),_:1}),g(Ct,null,{title:x(()=>[g(re,{modelValue:u.value,"onUpdate:modelValue":c[4]||(c[4]=f=>u.value=f),"hide-details":"",density:"compact",label:h.$t("torrent.properties.super_seeding")},null,8,["modelValue","label"])]),_:1}),g(Ct,null,{title:x(()=>[g(re,{disabled:"","model-value":M(r)?.is_private,"hide-details":"",density:"compact",label:h.$t("torrent.properties.is_private")},null,8,["model-value","label"])]),_:1})]),_:1})]),_:1})]),_:1},8,["title"]))}}),oo=ct({__name:"PanelData",props:{torrent:{}},setup(i){const t=i,{properties:e}=mt(Bt()),{useBinarySize:s}=mt(_e()),r=[{title:"downloaded",getter:()=>t.torrent.downloaded},{title:"downloaded_session",getter:()=>t.torrent.downloaded_session},{title:"uploaded",getter:()=>t.torrent.uploaded},{title:"uploaded_session",getter:()=>t.torrent.uploaded_session},{title:"size",getter:()=>t.torrent.size},{title:"total_size",getter:()=>t.torrent.total_size},{title:"total_wasted",getter:()=>e.value?.total_wasted??0},{title:"amount_left",getter:()=>t.torrent.amount_left},{title:"global_volume",getter:()=>t.torrent.globalVolume}];return(n,o)=>(k(),$(se,{title:n.$t("torrentDetail.info.data_values")},{default:x(()=>[g(ee,null,{default:x(()=>[g(K,null,{default:x(()=>[(k(),G(lt,null,_t(r,a=>g(Ct,null,{title:x(()=>[V(S(n.$t(`torrent.properties.${a.title}`)),1)]),text:x(()=>[V(S(M(Nt)(a.getter(),M(s))),1)]),_:2},1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),ao=ct({__name:"PanelDatetime",props:{torrent:{}},setup(i){const t=i,{properties:e}=mt(Bt()),{dateFormat:s}=mt(_e()),r=[{title:"added_on",getter:()=>t.torrent.added_on},{title:"completed_on",getter:()=>t.torrent.completed_on},{title:"creation_date",getter:()=>e.value?.creation_date??0},{title:"last_activity",getter:()=>t.torrent.last_activity},{title:"seen_complete",getter:()=>t.torrent.seen_complete}];return(n,o)=>(k(),$(se,{title:n.$t("torrentDetail.info.datetime_values")},{default:x(()=>[g(ee,null,{default:x(()=>[g(K,null,{default:x(()=>[(k(),G(lt,null,_t(r,a=>g(Ct,null,dr({title:x(()=>[V(S(n.$t(`torrent.properties.${a.title}`)),1)]),_:2},[a.getter()>0?{name:"text",fn:x(()=>[V(S(M(wn)(a.getter(),M(s))),1)]),key:"0"}:{name:"text",fn:x(()=>[V(S(n.$t("common.NA")),1)]),key:"1"}]),1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),lo=ct({__name:"PanelDuration",props:{torrent:{}},setup(i){const t=i,{properties:e}=mt(Bt()),s=[{title:"seeding_time",unit:"s",getter:()=>t.torrent.seeding_time},{title:"seeding_time_limit",unit:"m",getter:()=>t.torrent.seeding_time_limit},{title:"inactive_seeding_time_limit",unit:"m",getter:()=>t.torrent.inactive_seeding_time_limit},{title:"time_active",unit:"s",getter:()=>t.torrent.time_active},{title:"reannounce",unit:"s",getter:()=>e.value?.reannounce??0}];return(r,n)=>(k(),$(se,{title:r.$t("torrentDetail.info.duration_values")},{default:x(()=>[g(ee,null,{default:x(()=>[g(K,null,{default:x(()=>[(k(),G(lt,null,_t(s,o=>g(Ct,null,dr({title:x(()=>[V(S(r.$t(`torrent.properties.${o.title}`)),1)]),_:2},[o.getter()>0?{name:"text",fn:x(()=>[V(S(M(An).duration(o.getter(),o.unit).humanize()),1)]),key:"0"}:{name:"text",fn:x(()=>[V(S(r.$t("common.NA")),1)]),key:"1"}]),1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),ho={key:0,class:"d-flex gap"},uo=ct({__name:"PanelLongText",props:{torrent:{}},setup(i){const t=i,{properties:e}=mt(Bt()),s=[{title:"content_path",getter:()=>t.torrent.content_path},{title:"download_path",getter:()=>t.torrent.download_path},{title:"hash",getter:()=>t.torrent.hash},{title:"infohash_v1",getter:()=>t.torrent.infohash_v1},{title:"infohash_v2",getter:()=>t.torrent.infohash_v2},{title:"magnet",getter:()=>t.torrent.magnet},{title:"name",getter:()=>t.torrent.name},{title:"save_path",getter:()=>t.torrent.savePath},{title:"tracker",getter:()=>t.torrent.tracker},{title:"comment",getter:()=>e.value?.comment??""},{title:"created_by",getter:()=>e.value?.created_by??""}];return(r,n)=>(k(),$(se,{title:r.$t("torrentDetail.info.long_text_values")},{default:x(()=>[g(ee,null,{default:x(()=>[g(de,null,{default:x(()=>[(k(),G(lt,null,_t(s,o=>g(kt,{title:r.$t(`torrent.properties.${o.title}`)},{default:x(()=>[g(is,null,{default:x(()=>[V(S(o.getter()),1)]),_:2},1024)]),_:2},1032,["title"])),64)),g(kt,{title:r.$t("torrent.properties.tags")},{default:x(()=>[r.torrent.tags?.length?(k(),G("div",ho,[(k(!0),G(lt,null,_t(r.torrent.tags,o=>(k(),$(ae,{variant:"flat",color:"tag"},{default:x(()=>[V(S(o),1)]),_:2},1024))),256))])):(k(),$(is,{key:1},{default:x(()=>[V(S(r.$t("torrent.properties.empty_tags")),1)]),_:1}))]),_:1},8,["title"])]),_:1})]),_:1})]),_:1},8,["title"]))}}),co=te(uo,[["__scopeId","data-v-074ad8b6"]]),fo=ct({__name:"PanelSpeed",props:{torrent:{}},setup(i){const t=i,{properties:e}=mt(Bt()),{useBitSpeed:s}=mt(_e()),r=[{title:"download_limit",getter:()=>t.torrent.dl_limit},{title:"download_speed",getter:()=>t.torrent.dlspeed},{title:"avg_download_speed",getter:()=>e.value?.dl_speed_avg??0},{title:"upload_limit",getter:()=>t.torrent.up_limit},{title:"upload_speed",getter:()=>t.torrent.upspeed},{title:"avg_upload_speed",getter:()=>e.value?.up_speed_avg??0},{title:"global_speed",getter:()=>t.torrent.globalSpeed}];return(n,o)=>(k(),$(se,{title:n.$t("torrentDetail.info.speed_values")},{default:x(()=>[g(ee,null,{default:x(()=>[g(K,null,{default:x(()=>[(k(),G(lt,null,_t(r,a=>g(Ct,null,{title:x(()=>[V(S(n.$t(`torrent.properties.${a.title}`)),1)]),text:x(()=>[V(S(M(Zt)(a.getter(),M(s))),1)]),_:2},1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),po=ct({__name:"PanelText",props:{torrent:{}},setup(i){const t=i,{t:e}=ge(),{properties:s}=mt(Bt()),r=[{title:"available_peers",getter:()=>t.torrent.available_peers},{title:"available_seeds",getter:()=>t.torrent.available_seeds},{title:"ratio",getter:()=>t.torrent.ratio},{title:"ratio_limit",getter:()=>t.torrent.ratio_limit},{title:"num_leechs",getter:()=>t.torrent.num_leechs},{title:"num_seeds",getter:()=>t.torrent.num_seeds},{title:"availability",getter:()=>t.torrent.availability},{title:"eta",getter:()=>t.torrent.eta},{title:"category",getter:()=>t.torrent.category||e("common.NA")},{title:"state",getter:()=>t.torrent.stateString},{title:"trackers_count",getter:()=>t.torrent.trackers_count},{title:"priority",getter:()=>t.torrent.priority},{title:"nb_connections",getter:()=>s.value?.nb_connections??0},{title:"nb_connections_limit",getter:()=>s.value?.nb_connections_limit??0}];return(n,o)=>(k(),$(se,{title:n.$t("torrentDetail.info.text_values")},{default:x(()=>[g(ee,null,{default:x(()=>[g(K,null,{default:x(()=>[(k(),G(lt,null,_t(r,a=>g(Ct,null,{title:x(()=>[V(S(n.$t(`torrent.properties.${a.title}`)),1)]),text:x(()=>[V(S(a.getter()),1)]),_:2},1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),mo=ct({__name:"Info",props:{torrent:{},isActive:{type:Boolean}},setup(i){return(t,e)=>(k(),$(de,null,{default:x(()=>[g(kt,null,{default:x(()=>[g(Cn,null,{default:x(()=>[g(ao,{torrent:t.torrent},null,8,["torrent"]),g(lo,{torrent:t.torrent},null,8,["torrent"]),g(no,{torrent:t.torrent},null,8,["torrent"]),g(oo,{torrent:t.torrent},null,8,["torrent"]),g(fo,{torrent:t.torrent},null,8,["torrent"]),g(po,{torrent:t.torrent},null,8,["torrent"]),g(co,{torrent:t.torrent},null,8,["torrent"])]),_:1})]),_:1})]),_:1}))}}),_o=class Gs{constructor(t,e){this.low=t,this.high=e}clone(){return new Gs(this.low,this.high)}get max(){return this.clone()}less_than(t){return this.lowt.high?this.high:t.high)}output(){return[this.low,this.high]}static comparable_max(t,e){return t.merge(e)}static comparable_less_than(t,e){return tl&&([a,l]=[l,a]),this.item.key=new _o(a,l)}this.max=this.item.key?this.item.key.max:void 0}isNil(){return this.item.key===void 0&&this.item.value===void 0&&this.left===null&&this.right===null&&this.color===L}_value_less_than(t){return this.item.value&&t.item.value&&this.item.value.less_than?this.item.value.less_than(t.item.value):this.item.valuet++),t}get keys(){let t=[];return this.tree_walk(this.root,e=>t.push(e.item.key.output?e.item.key.output():e.item.key)),t}get values(){let t=[];return this.tree_walk(this.root,e=>t.push(e.item.value)),t}get items(){let t=[];return this.tree_walk(this.root,e=>t.push({key:e.item.key.output?e.item.key.output():e.item.key,value:e.item.value})),t}isEmpty(){return this.root==null||this.root===this.nil_node}clear(){this.root=null}insert(t,e=t){if(t===void 0)return;let s=new Yt(t,e,this.nil_node,this.nil_node,null,rt);return this.tree_insert(s),this.recalc_max(s),s}exist(t,e=t){let s=new Yt(t,e);return!!this.tree_search(this.root,s)}remove(t,e=t){let s=new Yt(t,e),r=this.tree_search(this.root,s);return r&&this.tree_delete(r),r}search(t,e=(s,r)=>s===r?r.output():s){let s=new Yt(t),r=[];return this.tree_search_interval(this.root,s,r),r.map(n=>e(n.item.value,n.item.key))}intersect_any(t){let e=new Yt(t);return this.tree_find_any_interval(this.root,e)}forEach(t){this.tree_walk(this.root,e=>t(e.item.key,e.item.value))}map(t){const e=new oi;return this.tree_walk(this.root,s=>e.insert(s.item.key,t(s.item.value,s.item.key))),e}*iterate(t,e=(s,r)=>s===r?r.output():s){let s;for(t?s=this.tree_search_nearest_forward(this.root,new Yt(t)):this.root&&(s=this.local_minimum(this.root));s;)yield e(s.item.value,s.item.key),s=this.tree_successor(s)}recalc_max(t){let e=t;for(;e.parent!=null;)e.parent.update_max(),e=e.parent}tree_insert(t){let e=this.root,s=null;if(this.root==null||this.root===this.nil_node)this.root=t;else{for(;e!==this.nil_node;)s=e,t.less_than(e)?e=e.left:e=e.right;t.parent=s,t.less_than(s)?s.left=t:s.right=t}this.insert_fixup(t)}insert_fixup(t){let e,s;for(e=t;e!==this.root&&e.parent.color===rt;)e.parent===e.parent.parent.left?(s=e.parent.parent.right,s.color===rt?(e.parent.color=L,s.color=L,e.parent.parent.color=rt,e=e.parent.parent):(e===e.parent.right&&(e=e.parent,this.rotate_left(e)),e.parent.color=L,e.parent.parent.color=rt,this.rotate_right(e.parent.parent))):(s=e.parent.parent.left,s.color===rt?(e.parent.color=L,s.color=L,e.parent.parent.color=rt,e=e.parent.parent):(e===e.parent.left&&(e=e.parent,this.rotate_right(e)),e.parent.color=L,e.parent.parent.color=rt,this.rotate_left(e.parent.parent)));this.root.color=L}tree_delete(t){let e,s;t.left===this.nil_node||t.right===this.nil_node?e=t:e=this.tree_successor(t),e.left!==this.nil_node?s=e.left:s=e.right,s.parent=e.parent,e===this.root?this.root=s:(e===e.parent.left?e.parent.left=s:e.parent.right=s,e.parent.update_max()),this.recalc_max(s),e!==t&&(t.copy_data(e),t.update_max(),this.recalc_max(t)),e.color===L&&this.delete_fixup(s)}delete_fixup(t){let e=t,s;for(;e!==this.root&&e.parent!=null&&e.color===L;)e===e.parent.left?(s=e.parent.right,s.color===rt&&(s.color=L,e.parent.color=rt,this.rotate_left(e.parent),s=e.parent.right),s.left.color===L&&s.right.color===L?(s.color=rt,e=e.parent):(s.right.color===L&&(s.color=rt,s.left.color=L,this.rotate_right(s),s=e.parent.right),s.color=e.parent.color,e.parent.color=L,s.right.color=L,this.rotate_left(e.parent),e=this.root)):(s=e.parent.left,s.color===rt&&(s.color=L,e.parent.color=rt,this.rotate_right(e.parent),s=e.parent.left),s.left.color===L&&s.right.color===L?(s.color=rt,e=e.parent):(s.left.color===L&&(s.color=rt,s.right.color=L,this.rotate_left(s),s=e.parent.left),s.color=e.parent.color,e.parent.color=L,s.left.color=L,this.rotate_right(e.parent),e=this.root));e.color=L}tree_search(t,e){if(!(t==null||t===this.nil_node))return e.equal_to(t)?t:e.less_than(t)?this.tree_search(t.left,e):this.tree_search(t.right,e)}tree_search_nearest_forward(t,e){let s,r=t;for(;r&&r!==this.nil_node;)r.less_than(e)?r.intersect(e)?(s=r,r=r.left):r=r.right:((!s||r.less_than(s))&&(s=r),r=r.left);return s||null}tree_search_interval(t,e,s){t!=null&&t!==this.nil_node&&(t.left!==this.nil_node&&!t.not_intersect_left_subtree(e)&&this.tree_search_interval(t.left,e,s),t.intersect(e)&&s.push(t),t.right!==this.nil_node&&!t.not_intersect_right_subtree(e)&&this.tree_search_interval(t.right,e,s))}tree_find_any_interval(t,e){let s=!1;return t!=null&&t!==this.nil_node&&(t.left!==this.nil_node&&!t.not_intersect_left_subtree(e)&&(s=this.tree_find_any_interval(t.left,e)),s||(s=t.intersect(e)),!s&&t.right!==this.nil_node&&!t.not_intersect_right_subtree(e)&&(s=this.tree_find_any_interval(t.right,e))),s}local_minimum(t){let e=t;for(;e.left!=null&&e.left!==this.nil_node;)e=e.left;return e}local_maximum(t){let e=t;for(;e.right!=null&&e.right!==this.nil_node;)e=e.right;return e}tree_successor(t){let e,s,r;if(t.right!==this.nil_node)e=this.local_minimum(t.right);else{for(s=t,r=t.parent;r!=null&&r.right===s;)s=r,r=r.parent;e=r}return e}rotate_left(t){let e=t.right;t.right=e.left,e.left!==this.nil_node&&(e.left.parent=t),e.parent=t.parent,t===this.root?this.root=e:t===t.parent.left?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e,t!=null&&t!==this.nil_node&&t.update_max(),e=t.parent,e!=null&&e!==this.nil_node&&e.update_max()}rotate_right(t){let e=t.left;t.left=e.right,e.right!==this.nil_node&&(e.right.parent=t),e.parent=t.parent,t===this.root?this.root=e:t===t.parent.left?t.parent.left=e:t.parent.right=e,e.right=t,t.parent=e,t!==null&&t!==this.nil_node&&t.update_max(),e=t.parent,e!=null&&e!==this.nil_node&&e.update_max()}tree_walk(t,e){t!=null&&t!==this.nil_node&&(this.tree_walk(t.left,e),e(t),this.tree_walk(t.right,e))}testRedBlackProperty(){let t=!0;return this.tree_walk(this.root,function(e){e.color===rt&&(e.left.color===L&&e.right.color===L||(t=!1))}),t}testBlackHeightProperty(t){let e=0,s=0,r=0;if(t.color===L&&e++,t.left!==this.nil_node?s=this.testBlackHeightProperty(t.left):s=1,t.right!==this.nil_node?r=this.testBlackHeightProperty(t.right):r=1,s!==r)throw new Error("Red-black height property violated");return e+=s,e}}tt=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i))(tt||{});let Ls,He,go,yo;Ls=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i};He=(i,t)=>Ls(i).priority??t;ie={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Ls).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Ls).forEach(t=>{t.type.forEach(e=>{const s=this._addHandlers,r=this._queue;s[e]?s[e]?.(t):(r[e]=r[e]||[],r[e]?.push(t))})}),this},handle(i,t,e){const s=this._addHandlers,r=this._removeHandlers;if(s[i]||r[i])throw new Error(`Extension type ${i} already has a handler`);s[i]=t,r[i]=e;const n=this._queue;return n[i]&&(n[i]?.forEach(o=>t(o)),delete n[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(i,t,e=-1){return this.handle(i,s=>{t.findIndex(n=>n.name===s.name)>=0||(t.push({name:s.name,value:s.ref}),t.sort((n,o)=>He(o.value,e)-He(n.value,e)))},s=>{const r=t.findIndex(n=>n.name===s.name);r!==-1&&t.splice(r,1)})},handleByList(i,t,e=-1){return this.handle(i,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((r,n)=>He(n,e)-He(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};go={extension:{type:tt.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await rs(()=>import("./browserAll-BT1z9cKE.js").then(async m=>{await m.__tla;return m}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url)}};yo={extension:{type:tt.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await rs(()=>import("./webworkerAll-DPPv9Ibl.js").then(async m=>{await m.__tla;return m}),__vite__mapDeps([1,2,3,4,5,6,7,8,9,10,11]),import.meta.url)}};class yt{constructor(t,e,s){this._x=e||0,this._y=s||0,this._observer=t}clone(t){return new yt(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}var pr={exports:{}};(function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(l,u,h){this.fn=l,this.context=u,this.once=h||!1}function n(l,u,h,c,f){if(typeof h!="function")throw new TypeError("The listener must be a function");var m=new r(h,c||l,f),p=e?e+u:u;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],m]:l._events[p].push(m):(l._events[p]=m,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new s:delete l._events[u]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],h,c;if(this._eventsCount===0)return u;for(c in h=this._events)t.call(h,c)&&u.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},a.prototype.listeners=function(u){var h=e?e+u:u,c=this._events[h];if(!c)return[];if(c.fn)return[c.fn];for(var f=0,m=c.length,p=new Array(m);fXt[i],uY:i=>Wt[i],vX:i=>qt[i],vY:i=>jt[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Os[i][t],sub:(i,t)=>Os[i][X.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?X.S:X.N:Math.abs(t)*2<=Math.abs(i)?i>0?X.E:X.W:t>0?i>0?X.SE:X.SW:i>0?X.NE:X.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=mr[X.inv(t)];r.tx=e,r.ty=s,i.append(r)}},We=[new ut,new ut,new ut,new ut];ot=class{constructor(t=0,e=0,s=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new ot(0,0,0,0)}clone(){return new ot(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&e=l&&t<=u&&e>=h&&e<=c&&!(t>f&&tp&&e<_)}intersects(t,e){if(!e){const D=this.xt.right?t.right:this.right)<=D)return!1;const T=this.yt.bottom?t.bottom:this.bottom)>T}const s=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=s||o<=n)return!1;const a=We[0].set(t.left,t.top),l=We[1].set(t.left,t.bottom),u=We[2].set(t.right,t.top),h=We[3].set(t.right,t.bottom);if(u.x<=a.x||l.y<=a.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(l,l),e.apply(u,u),e.apply(h,h),Math.max(a.x,l.x,u.x,h.x)<=s||Math.min(a.x,l.x,u.x,h.x)>=r||Math.max(a.y,l.y,u.y,h.y)<=n||Math.min(a.y,l.y,u.y,h.y)>=o))return!1;const f=c*(l.y-a.y),m=c*(a.x-l.x),p=f*s+m*n,_=f*r+m*n,d=f*s+m*o,b=f*r+m*o;if(Math.max(p,_,d,b)<=f*a.x+m*a.y||Math.min(p,_,d,b)>=f*h.x+m*h.y)return!1;const y=c*(a.y-u.y),w=c*(u.x-a.x),A=y*s+w*n,P=y*r+w*n,E=y*s+w*o,v=y*r+w*o;return!(Math.max(A,P,E,v)<=y*a.x+w*a.y||Math.min(A,P,E,v)>=y*h.x+w*h.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=r,this.height=n-r,this}getBounds(t){return t=t||new ot,t.copyFrom(this),t}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}};const _s={default:-1};at=function(i="default"){return _s[i]===void 0&&(_s[i]=-1),++_s[i]};let Ti;Ti={};Q="8.0.0";J=function(i,t,e=3){if(Ti[t])return;let s=new Error().stack;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${i}`):(s=s.split(` `).splice(e).join(` `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} Deprecated since v${i}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${i}`),console.warn(s))),Ti[t]=!0};const _r=()=>{};Gh=function(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1};function Ii(i){return!(i&i-1)&&!!i}function Mo(i){const t={};for(const e in i)i[e]!==void 0&&(t[e]=i[e]);return t}const Ei=Object.create(null);function Po(i){const t=Ei[i];return t===void 0&&(Ei[i]=at("resource")),t}const gr=class yr extends $t{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...yr.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){J(Q,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Po(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};gr.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let ko=gr;const xr=class br extends $t{constructor(t={}){super(),this.options=t,this.uid=at("textureSource"),this._resourceType="textureSource",this._resourceId=at("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...br.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new ko(Mo(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=at("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,s){s=s||this._resolution,t=t||this.width,e=e||this.height;const r=Math.round(t*s),n=Math.round(e*s);return this.width=r/s,this.height=n/s,this._resolution=s,this.pixelWidth===r&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=n,this.emit("resize",this),this._resourceId=at("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Ii(this.pixelWidth)&&Ii(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};xr.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};Gt=xr;class ai extends Gt{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let s=t.format;s||(e instanceof Float32Array?s="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?s="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?s="rgba16uint":(e instanceof Int8Array,s="bgra8unorm")),super({...t,resource:e,format:s}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}ai.extension=tt.TextureSource;const Di=new O;To=class{constructor(t,e){this.mapCoord=new O,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);const s=this.mapCoord;for(let r=0;r0:typeof i=="number"},it=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},bt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},vr=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Ri=function(i){return{r:bt(i.r,0,255),g:bt(i.g,0,255),b:bt(i.b,0,255),a:bt(i.a)}},gs=function(i){return{r:it(i.r),g:it(i.g),b:it(i.b),a:it(i.a,3)}},Do=/^#([0-9a-f]{3,8})$/i,qe=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},wr=function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=Math.max(t,e,s),o=n-Math.min(t,e,s),a=o?n===t?(e-s)/o:n===e?2+(s-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:r}},Ar=function(i){var t=i.h,e=i.s,s=i.v,r=i.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),o=s*(1-e),a=s*(1-(t-n)*e),l=s*(1-(1-t+n)*e),u=n%6;return{r:255*[s,a,o,o,l,s][u],g:255*[l,s,s,a,o,o][u],b:255*[o,o,l,s,s,a][u],a:r}},Bi=function(i){return{h:vr(i.h),s:bt(i.s,0,100),l:bt(i.l,0,100),a:bt(i.a)}},Fi=function(i){return{h:it(i.h),s:it(i.s),l:it(i.l),a:it(i.a,3)}},Vi=function(i){return Ar((e=(t=i).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},Te=function(i){return{h:(t=wr(i)).h,s:(r=(200-(e=t.s))*(s=t.v)/100)>0&&r<200?e*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,s,r},Ro=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bo=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fo=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Vo=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Us={string:[[function(i){var t=Do.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?it(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?it(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Fo.exec(i)||Vo.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Ri({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=Ro.exec(i)||Bo.exec(i);if(!t)return null;var e,s,r=Bi({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Eo[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Vi(r)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=r===void 0?1:r;return It(t)&&It(e)&&It(s)?Ri({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(i){var t=i.h,e=i.s,s=i.l,r=i.a,n=r===void 0?1:r;if(!It(t)||!It(e)||!It(s))return null;var o=Bi({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Vi(o)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!It(t)||!It(e)||!It(s))return null;var o=function(a){return{h:vr(a.h),s:bt(a.s,0,100),v:bt(a.v,0,100),a:bt(a.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return Ar(o)},"hsv"]]},Ni=function(i,t){for(var e=0;e=.5},i.prototype.toHex=function(){return t=gs(this.rgba),e=t.r,s=t.g,r=t.b,o=(n=t.a)<1?qe(it(255*n)):"","#"+qe(e)+qe(s)+qe(r)+o;var t,e,s,r,n,o},i.prototype.toRgb=function(){return gs(this.rgba)},i.prototype.toRgbString=function(){return t=gs(this.rgba),e=t.r,s=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+r+", "+n+")":"rgb("+e+", "+s+", "+r+")";var t,e,s,r,n},i.prototype.toHsl=function(){return Fi(Te(this.rgba))},i.prototype.toHslString=function(){return t=Fi(Te(this.rgba)),e=t.h,s=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+r+"%, "+n+")":"hsl("+e+", "+s+"%, "+r+"%)";var t,e,s,r,n},i.prototype.toHsv=function(){return t=wr(this.rgba),{h:it(t.h),s:it(t.s),v:it(t.v),a:it(t.a,3)};var t},i.prototype.invert=function(){return Mt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),Mt(ys(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Mt(ys(this.rgba,-t))},i.prototype.grayscale=function(){return Mt(ys(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Mt($i(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Mt($i(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?Mt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):it(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=Te(this.rgba);return typeof t=="number"?Mt({h:t,s:e.s,l:e.l,a:e.a}):it(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Mt(t).toHex()},i}(),Mt=function(i){return i instanceof zs?i:new zs(i)},Gi=[],$o=function(i){i.forEach(function(t){Gi.indexOf(t)<0&&(t(zs,Us),Gi.push(t))})};function Go(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in e)s[e[r]]=r;var n={};i.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,u=s[this.toHex()];if(u)return u;if(o?.closest){var h=this.toRgb(),c=1/0,f="black";if(!n.length)for(var m in e)n[m]=new i(e[m]).toRgb();for(var p in e){var _=(a=h,l=n[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));_n===e[o]);if(t!==null&&e!==null){const n=Object.keys(t),o=Object.keys(e);return n.length!==o.length?!1:n.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,r]=this._components;return{r:t,g:e,b:s,a:r}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,r]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb,t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;const[e,s,r,n]=this._components;return t[0]=e,t[1]=s,t[2]=r,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;const[e,s,r]=this._components;return t[0]=e,t[1]=s,t[2]=r,t}toNumber(){return this._int}toBgrNumber(){const[t,e,s]=this.toUint8RgbArray();return(s<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,r,n]=Pe._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=r,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,s,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,s=(o>>8&255)/255,r=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,r,n=255]=t,e/=255,s/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=Pe.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Mt(t);o.isValid()&&({r:e,g:s,b:r,a:n}=o.rgba,e/=255,s/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=r,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),s)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Pe||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};fe.shared=new fe;fe._temp=new fe;fe.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;xt=fe;const Lo={cullArea:null,cullable:!1,cullableChildren:!0};Oo=function(i,t,e){const s=i.length;let r;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(r=t;r0&&s<=e){for(let n=e-1;n>=i;n--){const o=this.children[n];o&&(this.renderGroup&&this.renderGroup.removeChild(o),r.push(o),o.parent=null)}Oo(this.children,i,e);for(let n=0;n=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t)},getChildIndex(i){const t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||J(Q,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){const s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}return t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i.didViewUpdate=!1,i._updateFlags=15,this.renderGroup&&this.renderGroup.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;const e=this.getChildIndex(i),s=this.getChildIndex(t);this.children[e]=t,this.children[s]=i},removeFromParent(){this.parent?.removeChild(this)}};zo=class{constructor(t){this.pipe="filter",this.priority=1,this.filters=t?.filters,this.filterArea=t?.filterArea}destroy(){for(let t=0;t0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}}class Yo{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new li(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const s=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[s]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}}St=new Yo;class Ho{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;ee.priority-s.priority),this.renderGroup&&(this.renderGroup.structureDidChange=!0),this._updateIsSimple())},removeEffect(i){const t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),!this.isRenderGroupRoot&&this.renderGroup&&(this.renderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(i){if(this._mask||(this._mask={mask:null,effect:null}),this._mask.mask===i||(this._mask.effect&&(this.removeEffect(this._mask.effect),Ys.returnMaskEffect(this._mask.effect),this._mask.effect=null),this._mask.mask=i,i==null))return;const t=Ys.getMaskEffect(i);this._mask.effect=t,this.addEffect(t)},get mask(){return this._mask?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]),i=i,this._filters||(this._filters={filters:null,effect:null,filterArea:null});const t=i?.length>0,e=this._filters.effect&&!t||!this._filters.effect&&t;if(i=Array.isArray(i)?i.slice(0):i,this._filters.filters=Object.freeze(i),e)if(t){const s=St.get(zo);this._filters.effect=s,this.addEffect(s)}else{const s=this._filters.effect;this.removeEffect(s),s.filterArea=null,s.filters=null,this._filters.effect=null,St.return(s)}t&&(this._filters.effect.filters=i,this._filters.effect.filterArea=this.filterArea)},get filters(){return this._filters?.filters},set filterArea(i){this._filters||(this._filters={filters:null,effect:null,filterArea:null}),this._filters.filterArea=i},get filterArea(){return this._filters?.filterArea}},Wo={label:null,get name(){return J(Q,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){J(Q,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){const e=this.children;for(let s=0;sthis.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new ot);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Li,this}set(t,e,s,r){this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}addFrame(t,e,s,r,n){n||(n=this.matrix);const o=n.a,a=n.b,l=n.c,u=n.d,h=n.tx,c=n.ty;let f=this.minX,m=this.minY,p=this.maxX,_=this.maxY,d=o*t+l*e+h,b=a*t+u*e+c;dp&&(p=d),b>_&&(_=b),d=o*s+l*e+h,b=a*s+u*e+c,dp&&(p=d),b>_&&(_=b),d=o*t+l*r+h,b=a*t+u*r+c,dp&&(p=d),b>_&&(_=b),d=o*s+l*r+h,b=a*s+u*r+c,dp&&(p=d),b>_&&(_=b),this.minX=f,this.minY=m,this.maxX=p,this.maxY=_}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxXthis.maxX?f:this.maxX,this.maxY=m>this.maxY?m:this.maxY,f=o*e+l*n+h,m=a*e+u*n+c,this.minX=fthis.maxX?f:this.maxX,this.maxY=m>this.maxY?m:this.maxY,f=o*r+l*n+h,m=a*r+u*n+c,this.minX=fthis.maxX?f:this.maxX,this.maxY=m>this.maxY?m:this.maxY}fit(t){return this.minXt.right&&(this.maxX=t.right),this.minYt.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,s,r){return this.minXe&&(this.maxX=e),this.minYr&&(this.maxY=r),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new Rt(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,s,r){let n=this.minX,o=this.minY,a=this.maxX,l=this.maxY;r||(r=this.matrix);const u=r.a,h=r.b,c=r.c,f=r.d,m=r.tx,p=r.ty;for(let _=e;_a?y:a,l=w>l?w:l}this.minX=n,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}};let Et;Et=new li(O);pe=new li(Rt);Cr=function(i,t,e){e.clear();let s,r;return i.parent?t?s=i.parent.worldTransform:(r=Et.get().identity(),s=os(i,r)):s=O.IDENTITY,Sr(i,e,s,t),r&&Et.return(r),e.isValid||e.set(0,0,0,0),e};function Sr(i,t,e,s){if(!i.visible||!i.measurable)return;let r;s?r=i.worldTransform:(i.updateLocalTransform(),r=Et.get(),r.appendFrom(i.localTransform,e));const n=t,o=!!i.effects.length;if(o&&(t=pe.get().clear()),i.boundsArea)t.addRect(i.boundsArea,r);else{i.addBounds&&(t.matrix=r,i.addBounds(t));for(let a=0;a>12&&(i.didChange=!0,i.data[0]=this._didChangeId>>12),kr(this,i),i.didChange&&Mr(this,i.localBounds,qo),i.localBounds},getBounds(i,t){return Cr(this,i,t||new Rt)}},Zo={_onRender:null,set onRender(i){const t=this.renderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}},Ko={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.renderGroup&&!this.isRenderGroupRoot&&(this.renderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(Qo))}};function Qo(i,t){return i._zIndex-t._zIndex}const Jo={getGlobalPosition(i=new ut,t=!1){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=!1){if(!e){this.updateLocalTransform();const s=os(this,new O);return s.append(this.localTransform),s.apply(i,t)}return this.worldTransform.apply(i,t)},toLocal(i,t,e,s){if(t&&(i=t.toGlobal(i,e,s)),!s){this.updateLocalTransform();const r=os(this,new O);return r.append(this.localTransform),r.applyInverse(i,e)}return this.worldTransform.applyInverse(i,e)}};class Tr{constructor(){this.uid=at("instructionSet"),this.instructions=[],this.instructionSize=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}class ta{constructor(t){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this._children=[],this.worldTransform=new O,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Tr,this._onRenderContainers=[],this.root=t,this.addChild(t)}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.onChildUpdate(t.root),this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){t.root.didChange&&this._removeChildFromUpdate(t.root);const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t!==this.root&&(this._children.push(t),t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t._onRender&&this.addOnRender(t)),t.renderGroup){if(t.renderGroup.root===t){this.addRenderGroupChild(t.renderGroup);return}}else t.renderGroup=this,t.didChange=!0;const e=t.children;t.isRenderGroupRoot||this.onChildUpdate(t);for(let s=0;s-1&&this._children.splice(e,1)}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(t.didViewUpdate=!1,this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t))}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}_removeChildFromUpdate(t){const e=this.childrenToUpdate[t.relativeRenderGroupDepth];if(!e)return;const s=e.list.indexOf(t);s>-1&&e.list.splice(s,1),e.index--}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(){for(let t=0;tthis.addChild(e)),this.effects=[],t.parent?.addChild(this)}static mixin(t){Object.defineProperties(dt.prototype,Object.getOwnPropertyDescriptors(t))}addChild(...t){if(this.allowChildren||J(Q,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s1){for(let r=0;r-1&&(this.children.splice(s,1),this.renderGroup&&this.renderGroup.removeChild(e),e.parent=null,this.emit("childRemoved",e,this,s),e.emit("removed",this)),e}_onUpdate(t){if(t&&t===this._skew&&this._updateSkew(),this._didChangeId++,!this.didChange)if(this.didChange=!0,this.isRenderGroupRoot){const e=this.renderGroup.renderGroupParent;e&&e.onChildUpdate(this)}else this.renderGroup&&this.renderGroup.onChildUpdate(this)}set isRenderGroup(t){if(this.isRenderGroupRoot&&t===!1)throw new Error("[Pixi] cannot undo a render group just yet");t&&this.enableRenderGroup()}get isRenderGroup(){return this.isRenderGroupRoot}enableRenderGroup(){if(this.renderGroup&&this.renderGroup.root===this)return;this.isRenderGroupRoot=!0;const t=this.renderGroup;if(t&&t.removeChild(this),this.renderGroup=new ta(this),t){for(let e=0;e>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.renderGroup&&!this.isRenderGroupRoot&&(this.renderGroup.structureDidChange=!0),this._updateFlags|=sa,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?1:0;(this.localDisplayStatus&2)>>1!==e&&(this.renderGroup&&!this.isRenderGroupRoot&&(this.renderGroup.structureDidChange=!0),this._updateFlags|=Cs,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?1:0;(this.localDisplayStatus&4)>>2!==e&&(this.renderGroup&&!this.isRenderGroupRoot&&(this.renderGroup.structureDidChange=!0),this._updateFlags|=Cs,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Cs,this.localDisplayStatus^=1,this.renderGroup&&!this.isRenderGroupRoot&&(this.renderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0,this.removeFromParent(),this.parent=null,this._mask=null,this._filters=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners();const e=typeof t=="boolean"?t:t?.children,s=this.removeChildren(0,this.children.length);if(e)for(let r=0;r{this.onViewUpdate()}}),s?this.anchor=s:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=r??!1,n&&(this.width=n),o&&(this.height=o)}static from(t,e=!1){return t instanceof Y?new Be(t):new Be(Y.from(t,e))}set texture(t){t||(t=Y.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(t){const e=this.sourceBounds;return t.x>=e.maxX&&t.x<=e.minX&&t.y>=e.maxY&&t.y<=e.minY}addBounds(t){const e=this._texture.trim?this.sourceBounds:this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}onViewUpdate(){this._didChangeId+=4096,this._didSpriteUpdate=!0,this._sourceBoundsDirty=this._boundsDirty=!0,!this.didViewUpdate&&(this.didViewUpdate=!0,this.renderGroup&&this.renderGroup.onChildViewUpdate(this))}_updateBounds(){Io(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){const t=this._anchor,e=this._texture,s=this._sourceBounds,{width:r,height:n}=e.orig;s.maxX=-t._x*r,s.minX=s.maxX+r,s.maxY=-t._y*n,s.minY=s.maxY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){const s=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(s)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width)}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){let s,r;typeof t!="object"?(s=t,r=e??t):(s=t.width,r=t.height??t.width),s!==void 0&&this._setWidth(s,this._texture.orig.width),r!==void 0&&this._setHeight(r,this._texture.orig.height)}};const ia=new Rt;function Ir(i,t,e){const s=ia;i.measurable=!0,Cr(i,e,s),t.addBoundsMask(s),i.measurable=!1}function Er(i,t,e){const s=pe.get();i.measurable=!0;const r=Et.get().identity(),n=Dr(i,e,r);Mr(i,s,n),i.measurable=!1,t.addBoundsMask(s),Et.return(r),pe.return(s)}function Dr(i,t,e){return i?(i!==t&&(Dr(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(Dt("Mask bounds, renderable is not inside the root container"),e)}class Rr{constructor(t){this.priority=0,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Be),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){Ir(this.mask,t,e)}addLocalBounds(t,e){Er(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof Be}}Rr.extension=tt.MaskEffect;class Br{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}Br.extension=tt.MaskEffect;class Fr{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){Ir(this.mask,t,e)}addLocalBounds(t,e){Er(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof dt}}Fr.extension=tt.MaskEffect;const ra={createCanvas:(i,t)=>{const e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};let zi=ra;Qt={get(){return zi},set(i){zi=i}};Vr=class extends Gt{constructor(t){t.resource||(t.resource=Qt.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity;const e=t.resource;(this.pixelWidth!==e.width||this.pixelWidth!==e.height)&&this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,s=this._resolution){const r=super.resize(t,e,s);return r&&this.resizeCanvas(),r}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}};Vr.extension=tt.TextureSource;hi=class extends Gt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){const e=Qt.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0),t.resource=e,Dt("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap}};hi.extension=tt.TextureSource;Hs=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Hs||{});class Ss{constructor(t,e=null,s=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=s,this._once=r}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Nr=class gt{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Ss(null,null,1/0),this.deltaMS=1/gt.targetFPMS,this.elapsedMS=1/gt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=Hs.NORMAL){return this._addListener(new Ss(t,e,s))}addOnce(t,e,s=Hs.NORMAL){return this._addListener(new Ss(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n{const t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(s),t.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Ms}const us=class $r extends Gt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...$r.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=je.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await na(),this._load=new Promise((s,r)=>{this.isValid?s(this):(this._resolve=s,this._reject=r,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(je.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(je.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(je.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||globalThis.VideoFrame&&t instanceof VideoFrame}};us.extension=tt.TextureSource;us.defaultOptions={...Gt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};us.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let oa=us;const le=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(s=>typeof s=="string"||e?t(s):s):i);class aa{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||Dt(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=le(t);let r;for(let l=0;l{n.set(l,e)});const o=[...n.keys()],a={cacheKeys:o,keys:s};s.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const u=r?r[l]:e;this._cache.has(l)&&this._cache.get(l)!==u&&Dt("[Cache] already has key:",l),this._cache.set(l,n.get(l))})}remove(t){if(!this._cacheMap.has(t)){Dt(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}let Xs;he=new aa;Xs=[];ie.handleByList(tt.TextureSource,Xs);function la(i={}){const t=i&&i.resource,e=t?i.resource:i,s=t?i:{resource:i};for(let r=0;r{he.has(s)&&he.remove(s)}),t||he.set(s,n),n}function ua(i,t=!1){return typeof i=="string"?he.get(i):i instanceof Gt?new Y({source:i}):ha(i,t)}Y.from=ua;ie.add(Rr,Br,Fr,oa,hi,Vr,ai);Gr=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Gr||{});function wt(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function we(i){return i.split("?")[0].split("#")[0]}function ca(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function da(i,t,e){return i.replace(new RegExp(ca(t),"g"),e)}function fa(i,t){let e="",s=0,r=-1,n=0,o=-1;for(let a=0;a<=i.length;++a){if(a2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",s=0):(e=e.slice(0,l),s=e.length-1-e.lastIndexOf("/")),r=a,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,a)}`:e=i.slice(r+1,a),s=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}Fe={toPosix(i){return da(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){wt(i),i=this.toPosix(i);const t=/^file:\/\/\//.exec(i);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(wt(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=we(this.toPosix(t??Qt.get().getBaseUrl())),r=we(this.toPosix(e??this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?Fe.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(wt(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="";const e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));const s=i.endsWith("/");return i=fa(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return wt(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e0)if(t===void 0)t=s;else{const r=i[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(wt(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0);const e=t===47;let s=-1,r=!0;const n=this.getProtocol(i),o=i;i=i.slice(n.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!r){s=a;break}}else r=!1;return s===-1?e?"/":this.isUrl(o)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){wt(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){const e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){wt(i),t&&wt(t),i=we(this.toPosix(i));let e=0,s=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let o=t.length-1,a=-1;for(n=i.length-1;n>=0;--n){const l=i.charCodeAt(n);if(l===47){if(!r){e=n+1;break}}else a===-1&&(r=!1,a=n+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(s=n):(o=-1,s=a))}return e===s?s=a:s===-1&&(s=i.length),i.slice(e,s)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!r){e=n+1;break}}else s===-1&&(r=!1,s=n+1);return s===-1?"":i.slice(e,s)},extname(i){wt(i),i=we(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let o=i.length-1;o>=0;--o){const a=i.charCodeAt(o);if(a===47){if(!r){e=o+1;break}continue}s===-1&&(r=!1,s=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":i.slice(t,s)},parse(i){wt(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=we(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let n=-1,o=0,a=-1,l=!0,u=i.length-1,h=0;for(;u>=r;--u){if(e=i.charCodeAt(u),e===47){if(!l){o=u+1;break}continue}a===-1&&(l=!1,a=u+1),e===46?n===-1?n=u:h!==1&&(h=1):n!==-1&&(h=-1)}return n===-1||a===-1||h===0||h===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&s?t.base=t.name=i.slice(1,a):t.base=t.name=i.slice(o,a)):(o===0&&s?(t.name=i.slice(1,n),t.base=i.slice(1,a)):(t.name=i.slice(o,n),t.base=i.slice(o,a)),t.ext=i.slice(n,a)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function Lr(i,t,e,s,r){const n=t[e];for(let o=0;o{const o=n.substring(1,n.length-1).split(",");r.push(o)}),Lr(i,r,0,e,s)}else s.push(i);return s}const Yi=i=>!Array.isArray(i);class Or{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}getAlias(t){const{alias:e,src:s}=t;return le(e||s,n=>typeof n=="string"?n:Array.isArray(n)?n.map(o=>o?.src??o):n?.src?n.src:n,!0)}addManifest(t){this._manifest&&Dt("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];let r=e;Array.isArray(e)||(r=Object.entries(e).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:{alias:n,...o})),r.forEach(n=>{const o=n.src,a=n.alias;let l;if(typeof a=="string"){const u=this._createBundleAssetId(t,a);s.push(u),l=[a,u]}else{const u=a.map(h=>this._createBundleAssetId(t,h));s.push(...u),l=[...a,...u]}this.add({...n,alias:l,src:o})}),this._bundles[t]=s}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let s;s=n=>{this.hasKey(n)&&Dt(`[Resolver] already has key: ${n} overwriting`)},le(e).forEach(n=>{const{src:o}=n;let{data:a,format:l,loadParser:u}=n;const h=le(o).map(m=>typeof m=="string"?pa(m):Array.isArray(m)?m:[m]),c=this.getAlias(n);Array.isArray(c)?c.forEach(s):s(c);const f=[];h.forEach(m=>{m.forEach(p=>{let _={};if(typeof p!="object"){_.src=p;for(let d=0;d{this._assetMap[m]=f})})}resolveBundle(t){const e=Yi(t);t=le(t);const s={};return t.forEach(r=>{const n=this._bundles[r];if(n){const o=this.resolve(n),a={};for(const l in o){const u=o[l];a[this._extractAssetIdFromBundle(r,l)]=u}s[r]=a}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const r in e)s[r]=e[r].src;return s}return e.src}resolve(t){const e=Yi(t);t=le(t);const s={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const o=this._getPreferredOrder(n);o?.priority.forEach(a=>{o.params[a].forEach(l=>{const u=n.filter(h=>h[a]?h[a]===l:!1);u.length&&(n=u)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});s[r]=this._resolverHash[r]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(s.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:s,data:r,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=Fe.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??t.format??ma(t.src),t}}Or.RETINA_PREFIX=/@([0-9\.]+)x/;function ma(i){return i.split(".").pop().split("?").shift().split("#").shift()}let Ur;Hi=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};Ur=class ke{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof Y?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;const s=parseFloat(e.meta.scale);s?(this.resolution=s,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=ke.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=ke.BATCH_SIZE;for(;e-t{this._batchIndex*ke.BATCH_SIZE{s[r]=t}),Object.keys(t.textures).forEach(r=>{s[r]=t.textures[r]}),!e){const r=Fe.dirname(i[0]);t.linkedSheets.forEach((n,o)=>{const a=zr([`${r}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(s,a)})}return s}const ga={extension:tt.Asset,cache:{test:i=>i instanceof Xi,getCacheableAssets:(i,t)=>zr(i,t,!1)},resolver:{test:i=>{const e=i.split("?")[0].split("."),s=e.pop(),r=e.pop();return s==="json"&&_a.includes(r)},parse:i=>{const t=i.split(".");return{resolution:parseFloat(Or.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:tt.LoadParser,priority:Gr.Normal},async testParse(i,t){return Fe.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){const{texture:s,imageFilename:r}=t?.data??{};let n=Fe.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let o;if(s instanceof Y)o=s;else{const u=Hi(n+(r??i.meta.image),t.src);o=(await e.load([u]))[u]}const a=new Xi(o.source,i);await a.parse();const l=i?.meta?.related_multi_packs;if(Array.isArray(l)){const u=[];for(const c of l){if(typeof c!="string")continue;let f=n+c;t.data?.ignoreMultiPack||(f=Hi(f,t.src),u.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const h=await Promise.all(u);a.linkedSheets=h,h.forEach(c=>{c.linkedSheets=[a].concat(a.linkedSheets.filter(f=>f!==c))})}return a},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}};ie.add(ga);ya=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const s in t){const r=t[s];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const s in this.resources)t[e++]=this.resources[s]._resourceId;this._key=t.join("|")}setResource(t,e){const s=this.resources[e];t!==s&&(s&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){const e=this.resources;for(const s in e)e[s]._touched=t}destroy(){const t=this.resources;for(const e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const s in e)e[s]===t&&(e[s]=null)}else this._updateKey()}};const Ws=[];ie.handleByNamedList(tt.Environment,Ws);async function xa(i){if(i)for(let t=0;t80*e){a=u=i[0],l=h=i[1];for(var p=e;pu&&(u=c),f>h&&(h=f);m=Math.max(u-a,h-l),m=m!==0?32767/m:0}return Ve(n,o,e,a,l,m,0),o}function Yr(i,t,e,s,r){var n,o;if(r===Zs(i,t,e,s)>0)for(n=t;n=t;n-=s)o=Wi(n,i[n],i[n+1],o);return o&&ds(o,o.next)&&($e(o),o=o.next),o}function Jt(i,t){if(!i)return i;t||(t=i);var e=i,s;do if(s=!1,!e.steiner&&(ds(e,e.next)||q(e.prev,e,e.next)===0)){if($e(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function Ve(i,t,e,s,r,n,o){if(i){!o&&n&&Ia(i,s,r,n);for(var a=i,l,u;i.prev!==i.next;){if(l=i.prev,u=i.next,n?wa(i,s,r,n):va(i)){t.push(l.i/e|0),t.push(i.i/e|0),t.push(u.i/e|0),$e(i),i=u.next,a=u.next;continue}if(i=u,i===a){o?o===1?(i=Aa(Jt(i),t,e),Ve(i,t,e,s,r,n,2)):o===2&&Ca(i,t,e,s,r,n):Ve(Jt(i),t,e,s,r,n,1);break}}}}function va(i){var t=i.prev,e=i,s=i.next;if(q(t,e,s)>=0)return!1;for(var r=t.x,n=e.x,o=s.x,a=t.y,l=e.y,u=s.y,h=rn?r>o?r:o:n>o?n:o,m=a>l?a>u?a:u:l>u?l:u,p=s.next;p!==t;){if(p.x>=h&&p.x<=f&&p.y>=c&&p.y<=m&&ue(r,a,n,l,o,u,p.x,p.y)&&q(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function wa(i,t,e,s){var r=i.prev,n=i,o=i.next;if(q(r,n,o)>=0)return!1;for(var a=r.x,l=n.x,u=o.x,h=r.y,c=n.y,f=o.y,m=al?a>u?a:u:l>u?l:u,d=h>c?h>f?h:f:c>f?c:f,b=qs(m,p,t,e,s),y=qs(_,d,t,e,s),w=i.prevZ,A=i.nextZ;w&&w.z>=b&&A&&A.z<=y;){if(w.x>=m&&w.x<=_&&w.y>=p&&w.y<=d&&w!==r&&w!==o&&ue(a,h,l,c,u,f,w.x,w.y)&&q(w.prev,w,w.next)>=0||(w=w.prevZ,A.x>=m&&A.x<=_&&A.y>=p&&A.y<=d&&A!==r&&A!==o&&ue(a,h,l,c,u,f,A.x,A.y)&&q(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;w&&w.z>=b;){if(w.x>=m&&w.x<=_&&w.y>=p&&w.y<=d&&w!==r&&w!==o&&ue(a,h,l,c,u,f,w.x,w.y)&&q(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;A&&A.z<=y;){if(A.x>=m&&A.x<=_&&A.y>=p&&A.y<=d&&A!==r&&A!==o&&ue(a,h,l,c,u,f,A.x,A.y)&&q(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function Aa(i,t,e){var s=i;do{var r=s.prev,n=s.next.next;!ds(r,n)&&Hr(r,s,s.next,n)&&Ne(r,n)&&Ne(n,r)&&(t.push(r.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),$e(s),$e(s.next),s=i=n),s=s.next}while(s!==i);return Jt(s)}function Ca(i,t,e,s,r,n){var o=i;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Ra(o,a)){var l=Xr(o,a);o=Jt(o,o.next),l=Jt(l,l.next),Ve(o,t,e,s,r,n,0),Ve(l,t,e,s,r,n,0);return}a=a.next}o=o.next}while(o!==i)}function Sa(i,t,e,s){var r=[],n,o,a,l,u;for(n=0,o=t.length;n=e.next.y&&e.next.y!==e.y){var a=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=s&&a>n&&(n=a,o=e.x=e.x&&e.x>=u&&s!==e.x&&ue(ro.x||e.x===o.x&&Ta(o,e)))&&(o=e,c=f)),e=e.next;while(e!==l);return o}function Ta(i,t){return q(i.prev,i,t.prev)<0&&q(t.next,i,i.next)<0}function Ia(i,t,e,s){var r=i;do r.z===0&&(r.z=qs(r.x,r.y,t,e,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,Ea(r)}function Ea(i){var t,e,s,r,n,o,a,l,u=1;do{for(e=i,i=null,n=null,o=0;e;){for(o++,s=e,a=0,t=0;t0||l>0&&s;)a!==0&&(l===0||!s||e.z<=s.z)?(r=e,e=e.nextZ,a--):(r=s,s=s.nextZ,l--),n?n.nextZ=r:i=r,r.prevZ=n,n=r;e=s}n.nextZ=null,u*=2}while(o>1);return i}function qs(i,t,e,s,r){return i=(i-e)*r|0,t=(t-s)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function Da(i){var t=i,e=i;do(t.x=(i-o)*(n-a)&&(i-o)*(s-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(r-o)*(s-a)}function Ra(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!Ba(i,t)&&(Ne(i,t)&&Ne(t,i)&&Fa(i,t)&&(q(i.prev,i,t.prev)||q(i,t.prev,t))||ds(i,t)&&q(i.prev,i,i.next)>0&&q(t.prev,t,t.next)>0)}function q(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function ds(i,t){return i.x===t.x&&i.y===t.y}function Hr(i,t,e,s){var r=Ke(q(i,t,e)),n=Ke(q(i,t,s)),o=Ke(q(e,s,i)),a=Ke(q(e,s,t));return!!(r!==n&&o!==a||r===0&&Ze(i,e,t)||n===0&&Ze(i,s,t)||o===0&&Ze(e,i,s)||a===0&&Ze(e,t,s))}function Ze(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Ke(i){return i>0?1:i<0?-1:0}function Ba(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Hr(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function Ne(i,t){return q(i.prev,i,i.next)<0?q(i,t,i.next)>=0&&q(i,i.prev,t)>=0:q(i,t,i.prev)<0||q(i,i.next,t)<0}function Fa(i,t){var e=i,s=!1,r=(i.x+t.x)/2,n=(i.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==i);return s}function Xr(i,t){var e=new js(i.i,i.x,i.y),s=new js(t.i,t.x,t.y),r=i.next,n=t.prev;return i.next=t,t.prev=i,e.next=r,r.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function Wi(i,t,e,s){var r=new js(i,t,e);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function $e(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function js(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}cs.deviation=function(i,t,e,s){var r=t&&t.length,n=r?t[0]*e:i.length,o=Math.abs(Zs(i,0,n,e));if(r)for(var a=0,l=t.length;a0&&(s+=i[r-1].length,e.holes.push(s))}return e};var Va=ui.exports;const Na=ii(Va);Wr=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(Wr||{});$a=class{constructor(t){this.items=[],this._name=t}emit(t,e,s,r,n,o,a,l){const{name:u,items:h}=this;for(let c=0,f=h.length;c{this.runners[e]=new $a(e)})}_addSystems(t){let e;for(e in t){const s=t[e];this._addSystem(s.value,s.name)}}_addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const r in this.runners)this.runners[r].add(s);return this}_addPipes(t,e){const s=e.reduce((r,n)=>(r[n.name]=n.value,r),{});t.forEach(r=>{const n=r.value,o=r.name,a=s[o];this.renderPipes[o]=new n(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!ba())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}};qr.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let Qe;Zr=qr;function La(i){return Qe!==void 0||(Qe=(()=>{const t={stencil:!0,failIfMajorPerformanceCaveat:i??Zr.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Qt.get().getWebGLRenderingContext())return!1;let s=Qt.get().createCanvas().getContext("webgl",t);const r=!!s?.getContextAttributes()?.stencil;if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,r}catch{return!1}})()),Qe}let Je;async function Oa(i={}){return Je!==void 0||(Je=await (async()=>{if(!Qt.get().getNavigator().gpu)return!1;try{return await (await navigator.gpu.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Je}const qi=["webgl","webgpu","canvas"];async function Ua(i){let t=[];i.preference?(t.push(i.preference),qi.forEach(n=>{n!==i.preference&&t.push(n)})):t=qi.slice();let e;await xa(i.manageImports??!0);let s={};for(let n=0;nimport("./WebGPURenderer-Du7v9tBH.js").then(async m=>{await m.__tla;return m}),__vite__mapDeps([12,2,13,3,5,6,7,8,9,10,11]),import.meta.url);e=a,s={...i,...i.webgpu};break}else if(o==="webgl"&&La(i.failIfMajorPerformanceCaveat??Zr.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:a}=await rs(()=>import("./WebGLRenderer-BJRUYaxc.js").then(async m=>{await m.__tla;return m}),__vite__mapDeps([14,2,4,13,5,6,7,8,9,10,11]),import.meta.url);e=a,s={...i,...i.webgl};break}else if(o==="canvas"){s={...i};break}}delete s.webgpu,delete s.webgl;const r=new e;return await r.init(s),r}const Kr=class Ks{constructor(...t){this.stage=new dt,t[0]!==void 0&&J(Q,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await Ua(t),Ks._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return J(Q,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){const s=Ks._plugins.slice(0);s.reverse(),s.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Kr._plugins=[];let Qr=Kr;ie.handleByList(tt.Application,Qr._plugins);var za=Ha,Ps={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},Ya=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function Ha(i){var t=[];return i.replace(Ya,function(e,s,r){var n=s.toLowerCase();for(r=Wa(r),n=="m"&&r.length>2&&(t.push([s].concat(r.splice(0,2))),n="l",s=s=="m"?"l":"L");;){if(r.length==Ps[n])return r.unshift(s),t.push(r);if(r.length0&&(r=s.pop(),r?(n=r.startX,o=r.startY):(n=0,o=0)),r=null;break;default:Dt(`Unknown SVG path command: ${u}`)}u!=="Z"&&u!=="z"&&r===null&&(r={startX:n,startY:o},s.push(r))}return t}class ci{constructor(t=0,e=0,s=0){this.type="circle",this.x=t,this.y=e,this.radius=s}clone(){return new ci(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=s}strokeContains(t,e,s){if(this.radius===0)return!1;const r=this.x-t,n=this.y-e,o=this.radius,a=s/2,l=Math.sqrt(r*r+n*n);return lo-a}getBounds(t){return t=t||new ot,t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class di{constructor(t=0,e=0,s=0,r=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=s,this.halfHeight=r}clone(){return new di(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let s=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return s*=s,r*=r,s+r<=1}strokeContains(t,e,s){const{halfWidth:r,halfHeight:n}=this;if(r<=0||n<=0)return!1;const o=s/2,a=r-o,l=n-o,u=r+o,h=n+o,c=t-this.x,f=e-this.y,m=c*c/(a*a)+f*f/(l*l),p=c*c/(u*u)+f*f/(h*h);return m>1&&p<=1}getBounds(){return new ot(this.x-this.halfWidth,this.y-this.halfHeight,this.halfWidth*2,this.halfHeight*2)}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function Za(i,t,e,s,r,n){const o=i-e,a=t-s,l=r-e,u=n-s,h=o*l+a*u,c=l*l+u*u;let f=-1;c!==0&&(f=h/c);let m,p;f<0?(m=e,p=s):f>1?(m=r,p=n):(m=e+f*l,p=s+f*u);const _=i-m,d=t-p;return _*_+d*d}class Ie{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let r=0,n=e.length;re!=h>e&&t<(u-a)*((e-l)/(h-l))+a&&(s=!s)}return s}strokeContains(t,e,s){const r=s/2,n=r*r,{points:o}=this,a=o.length-(this.closePath?0:2);for(let l=0;lr?u:r,n=ho?h:o}return t.x=s,t.width=r-s,t.y=n,t.height=o-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}const ts=(i,t,e,s,r,n)=>{const o=i-e,a=t-s,l=Math.sqrt(o*o+a*a);return l>=r-n&&l<=r+n};class fi{constructor(t=0,e=0,s=0,r=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=s,this.height=r,this.radius=n}getBounds(t){return t=t||new ot,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new fi(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let r=t-(this.x+s),n=e-(this.y+s);const o=s*s;if(r*r+n*n<=o||(r=t-(this.x+this.width-s),r*r+n*n<=o)||(n=e-(this.y+this.height-s),r*r+n*n<=o)||(r=t-(this.x+s),r*r+n*n<=o))return!0}return!1}strokeContains(t,e,s){const{x:r,y:n,width:o,height:a,radius:l}=this,u=s/2,h=r+l,c=n+l,f=o-l*2,m=a-l*2,p=r+o,_=n+a;return(t>=r-u&&t<=r+u||t>=p-u&&t<=p+u)&&e>=c&&e<=c+m||(e>=n-u&&e<=n+u||e>=_-u&&e<=_+u)&&t>=h&&t<=h+f?!0:tp-l&&ep-l&&e>_-l&&ts(t,e,p-l,_-l,l,u)||t_-l&&ts(t,e,h,_-l,l,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}ft=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(ft||{});Ge=class extends $t{constructor(t){let{data:e,size:s}=t;const{usage:r,label:n,shrinkToFit:o}=t;super(),this.uid=at("buffer"),this._resourceType="buffer",this._resourceId=at("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,s=s??e?.byteLength;const a=!!e;this.descriptor={size:s,usage:r,mappedAtCreation:a,label:n},this.shrinkToFit=o??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get static(){return!!(this.descriptor.usage&ft.STATIC)}set static(t){t?this.descriptor.usage|=ft.STATIC:this.descriptor.usage&=~ft.STATIC}setDataWithSize(t,e,s){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){s&&this.emit("update",this);return}const r=this._data;if(this._data=t,r.length!==t.length){!this.shrinkToFit&&t.byteLengtha&&(a=m),p>l&&(l=p),me.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}};const tl=new Float32Array(1),el=new Uint32Array(1);sl=class extends Ja{constructor(){const e=new Ge({data:tl,label:"attribute-batch-buffer",usage:ft.VERTEX|ft.COPY_DST,shrinkToFit:!1}),s=new Ge({data:el,label:"index-batch-buffer",usage:ft.INDEX|ft.COPY_DST,shrinkToFit:!1}),r=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:r,offset:0,location:1},aUV:{buffer:e,format:"float32x2",stride:r,offset:2*4,location:3},aColor:{buffer:e,format:"unorm8x4",stride:r,offset:4*4,location:0},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:r,offset:5*4,location:2}},indexBuffer:s})}};let en;tn=16;en={};il=function(i,t){let e=0;for(let s=0;s>>0;return en[e]||rl(i,e)};function rl(i,t){const e={};let s=0;for(let n=0;n0){const o=new Uint8Array(i,e*8,n);new Uint8Array(t,e*8,n).set(o)}};const nl={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};ol=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=3]="RENDERING_MASK_REMOVE",i[i.NONE=4]="NONE",i))(ol||{});function Ki(i,t){return t.alphaMode==="no-premultiply-alpha"&&nl[i]||i}class Qi{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;tthis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const o=this.attributeBuffer.float32View,a=this.attributeBuffer.uint32View,l=this.indexBuffer;let u=this._batchIndexSize,h=this._batchIndexStart,c="startBatch",f=this._batchPool[this._batchPoolIndex++]||new Ji;for(let m=this.elementStart;m=tn||y)&&(this._finishBatch(f,h,u-h,s,n,t,c),c="renderBatch",h=u,n=b,s=this._textureBatchPool[this._textureBatchPoolIndex++]||new Qi,s.clear(),f=this._batchPool[this._batchPoolIndex++]||new Ji,++Ce),p.textureId=d._textureBindLocation=s.count,s.ids[d.uid]=s.count,s.textures[s.count++]=d,p.batch=f,u+=p.indexSize,p.packAttributes(o,a,p.location,p.textureId),p.packIndex(l,p.indexStart,p.location/this._vertexSize)}s.count>0&&(this._finishBatch(f,h,u-h,s,n,t,c),h=u,++Ce),this.elementStart=this.elementSize,this._batchIndexStart=h,this._batchIndexSize=u}_finishBatch(t,e,s,r,n,o,a){t.gpuBindGroup=null,t.action=a,t.batcher=this,t.textures=r,t.blendMode=n,t.start=e,t.size=s,++Ce,o.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),s=new ji(e);Zi(this.attributeBuffer.rawBinaryData,s.rawBinaryData),this.attributeBuffer=s}_resizeIndexBuffer(t){const e=this.indexBuffer;let s=Math.max(t,e.length*1.5);s+=s%2;const r=s>65535?new Uint32Array(s):new Uint16Array(s);if(r.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n>16&255,r=i>>8&255,n=i&255,o=t>>16&255,a=t>>8&255,l=t&255,u=s+(o-s)*e,h=r+(a-r)*e,c=n+(l-n)*e;return(u<<16)+(h<<8)+c}const ks=16777215;cl=function(i,t){return i===ks||t===ks?i+t-ks:ul(i,t,.5)};on=class{constructor(){this.batcher=null,this.batch=null,this.applyTransform=!0,this.roundPixels=0}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}packIndex(t,e,s){const r=this.geometryData.indices;for(let n=0;n>16|c&65280|(c&255)<<16;if(this.applyTransform){const m=cl(f,o.groupColor)+(this.alpha*o.groupAlpha*255<<24),p=o.groupTransform,_=r<<16|this.roundPixels&65535,d=p.a,b=p.b,y=p.c,w=p.d,A=p.tx,P=p.ty;for(let E=u;E=0&&a>=0&&r>=0&&n>=0))return t;const l=Math.ceil(2.3*Math.sqrt(o+a)),u=l*8+(r?4:0)+(n?4:0);if(u===0)return t;if(l===0)return t[0]=t[6]=e+r,t[1]=t[3]=s+n,t[2]=t[4]=e-r,t[5]=t[7]=s-n,t;let h=0,c=l*4+(r?2:0)+2,f=c,m=u,p=r+o,_=n,d=e+p,b=e-p,y=s+_;if(t[h++]=d,t[h++]=y,t[--c]=y,t[--c]=b,n){const A=s-_;t[f++]=b,t[f++]=A,t[--m]=A,t[--m]=d}for(let A=1;A0&&(r[n++]=l,r[n++]=u,r[n++]=l-1),l++;r[n++]=u+1,r[n++]=u,r[n++]=l-1}},dl=1e-4,tr=1e-4;function fl(i){const t=i.length;if(t<6)return 1;let e=0;for(let s=0,r=i[t-2],n=i[t-1];sc&&(c+=Math.PI*2);let f=h;const m=c-h,p=Math.abs(m),_=Math.sqrt(l*l+u*u),d=(15*p*Math.sqrt(_)/Math.PI>>0)+1,b=m/d;if(f+=b,a){o.push(i,t),o.push(e,s);for(let y=1,w=f;y=0&&(h.join==="round"?y+=Ht(C,T,C-F*R,T-B*R,C-H*R,T-Z*R,d,!1)+4:y+=2,d.push(C-H*N,T-Z*N),d.push(C+H*R,T+Z*R));continue}const xi=(-F+v)*(-B+T)-(-F+C)*(-B+D),bi=(-H+j)*(-Z+T)-(-H+C)*(-Z+Tt),ze=(Ft*bi-xe*xi)/Ue,Ye=(be*xi-ye*bi)/Ue,fs=(ze-C)*(ze-C)+(Ye-T)*(Ye-T),Lt=C+(ze-C)*R,Ot=T+(Ye-T)*R,Ut=C-(ze-C)*N,zt=T-(Ye-T)*N,pn=Math.min(Ft*Ft+ye*ye,xe*xe+be*be),vi=ve?R:N,mn=pn+vi*vi*P;fs<=mn?h.join==="bevel"||fs/P>E?(ve?(d.push(Lt,Ot),d.push(C+F*N,T+B*N),d.push(Lt,Ot),d.push(C+H*N,T+Z*N)):(d.push(C-F*R,T-B*R),d.push(Ut,zt),d.push(C-H*R,T-Z*R),d.push(Ut,zt)),y+=2):h.join==="round"?ve?(d.push(Lt,Ot),d.push(C+F*N,T+B*N),y+=Ht(C,T,C+F*N,T+B*N,C+H*N,T+Z*N,d,!0)+4,d.push(Lt,Ot),d.push(C+H*N,T+Z*N)):(d.push(C-F*R,T-B*R),d.push(Ut,zt),y+=Ht(C,T,C-F*R,T-B*R,C-H*R,T-Z*R,d,!1)+4,d.push(C-H*R,T-Z*R),d.push(Ut,zt)):(d.push(Lt,Ot),d.push(Ut,zt)):(d.push(C-F*R,T-B*R),d.push(C+F*N,T+B*N),h.join==="round"?ve?y+=Ht(C,T,C+F*N,T+B*N,C+H*N,T+Z*N,d,!0)+2:y+=Ht(C,T,C-F*R,T-B*R,C-H*R,T-Z*R,d,!1)+2:h.join==="miter"&&fs/P<=E&&(ve?(d.push(Ut,zt),d.push(Ut,zt)):(d.push(Lt,Ot),d.push(Lt,Ot)),y+=2),d.push(C-H*R,T-Z*R),d.push(C+H*N,T+Z*N),y+=2)}v=i[(b-2)*2],D=i[(b-2)*2+1],C=i[(b-1)*2],T=i[(b-1)*2+1],F=-(D-T),B=v-C,vt=Math.sqrt(F*F+B*B),F/=vt,B/=vt,F*=A,B*=A,d.push(C-F*R,T-B*R),d.push(C+F*N,T+B*N),p||(h.cap==="round"?y+=Ht(C-F*(R-N)*.5,T-B*(R-N)*.5,C-F*R,T-B*R,C+F*N,T+B*N,d,!1)+2:h.cap==="square"&&(y+=er(C,T,F,B,R,N,!1,d)));const fn=tr*tr;for(let U=w;U=0&&o>=0&&(t[0]=s,t[1]=r,t[2]=s+n,t[3]=r,t[4]=s+n,t[5]=r+o,t[6]=s,t[7]=r+o),t},triangulate(i,t,e,s,r,n){let o=0;s*=e,t[s+o]=i[0],t[s+o+1]=i[1],o+=e,t[s+o]=i[2],t[s+o+1]=i[3],o+=e,t[s+o]=i[6],t[s+o+1]=i[7],o+=e,t[s+o]=i[4],t[s+o+1]=i[5],o+=e;const a=s/e;r[n++]=a,r[n++]=a+1,r[n++]=a+2,r[n++]=a+1,r[n++]=a+3,r[n++]=a+2}},yl={build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,s,r,n){let o=0;s*=e,t[s+o]=i[0],t[s+o+1]=i[1],o+=e,t[s+o]=i[2],t[s+o+1]=i[3],o+=e,t[s+o]=i[4],t[s+o+1]=i[5];const a=s/e;r[n++]=a,r[n++]=a+1,r[n++]=a+2}},pi={rectangle:gl,polygon:_l,triangle:yl,circle:Ts,ellipse:Ts,roundedRectangle:Ts},xl=new ot;function bl(i,t){const{geometryData:e,batches:s}=t;s.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let r=0;r{const m=l.length,p=o.length/2,_=[],d=pi[h.type];if(d.build(h,_),c&&nn(_,c),s){const A=h.closePath??!0;pl(_,t,!1,A,o,2,p,l)}else if(e&&u===f){u!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");const A=[],P=_.slice();wl(e.shapePath).forEach(v=>{A.push(P.length/2),P.push(...v)}),an(P,A,o,2,p,l,m)}else d.triangulate(_,o,2,p,l,m);const b=a.length/2,y=t.texture;if(y!==Y.WHITE){const A=t.matrix;c&&A.append(c.clone().invert()),ll(o,2,p,a,b,2,o.length/2-p,A)}else hl(a,b,2,o.length/2-p);const w=St.get(on);w.indexOffset=m,w.indexSize=l.length-m,w.vertexOffset=p,w.vertexSize=o.length/2-p,w.color=t.color,w.alpha=t.alpha,w.texture=y,w.geometryData=n,r.push(w)})}function wl(i){if(!i)return[];const t=i.shapePrimitives,e=[];for(let s=0;s{St.return(s)})}destroy(){for(const t of this._needsContextNeedsRebuild)this._gpuContextHash[t.uid]&&this.onGraphicsContextDestroy(t);this._needsContextNeedsRebuild.length=0}};mi.extension={type:[tt.WebGLSystem,tt.WebGPUSystem,tt.CanvasSystem],name:"graphicsContext"};mi.defaultOptions={bezierSmoothness:.5};ln=mi;const Sl=8,es=11920929e-14,Ml=1;function hn(i,t,e,s,r,n,o,a,l,u){const c=Math.min(.99,Math.max(0,u??ln.defaultOptions.bezierSmoothness));let f=(Ml-c)/1;return f*=f,Pl(t,e,s,r,n,o,a,l,i,f),i}function Pl(i,t,e,s,r,n,o,a,l,u){Js(i,t,e,s,r,n,o,a,l,u,0),l.push(o,a)}function Js(i,t,e,s,r,n,o,a,l,u,h){if(h>Sl)return;const c=(i+e)/2,f=(t+s)/2,m=(e+r)/2,p=(s+n)/2,_=(r+o)/2,d=(n+a)/2,b=(c+m)/2,y=(f+p)/2,w=(m+_)/2,A=(p+d)/2,P=(b+w)/2,E=(y+A)/2;if(h>0){let v=o-i,D=a-t;const C=Math.abs((e-o)*D-(s-a)*v),T=Math.abs((r-o)*D-(n-a)*v);if(C>es&&T>es){if((C+T)*(C+T)<=u*(v*v+D*D)){l.push(P,E);return}}else if(C>es){if(C*C<=u*(v*v+D*D)){l.push(P,E);return}}else if(T>es){if(T*T<=u*(v*v+D*D)){l.push(P,E);return}}else if(v=P-(i+o)/2,D=E-(t+a)/2,v*v+D*D<=u){l.push(P,E);return}}Js(i,t,c,f,b,y,P,E,l,u,h+1),Js(P,E,w,A,_,d,o,a,l,u,h+1)}const kl=8,Tl=11920929e-14,Il=1;function El(i,t,e,s,r,n,o,a){const u=Math.min(.99,Math.max(0,a??ln.defaultOptions.bezierSmoothness));let h=(Il-u)/1;return h*=h,Dl(t,e,s,r,n,o,i,h),i}function Dl(i,t,e,s,r,n,o,a){ti(o,i,t,e,s,r,n,a,0),o.push(r,n)}function ti(i,t,e,s,r,n,o,a,l){if(l>kl)return;const u=(t+s)/2,h=(e+r)/2,c=(s+n)/2,f=(r+o)/2,m=(u+c)/2,p=(h+f)/2;let _=n-t,d=o-e;const b=Math.abs((s-n)*d-(r-o)*_);if(b>Tl){if(b*b<=a*(_*_+d*d)){i.push(m,p);return}}else if(_=m-(t+n)/2,d=p-(e+o)/2,_*_+d*d<=a){i.push(m,p);return}ti(i,t,e,u,h,m,p,a,l+1),ti(i,m,p,c,f,n,o,a,l+1)}function un(i,t,e,s,r,n,o,a){let l=Math.abs(r-n);(!o&&r>n||o&&n>r)&&(l=2*Math.PI-l),a=a||Math.max(6,Math.floor(6*Math.pow(s,1/3)*(l/Math.PI))),a=Math.max(a,3);let u=l/a,h=r;u*=o?-1:1;for(let c=0;cc*l)}const Ee=Math.PI*2,Is={centerX:0,centerY:0,ang1:0,ang2:0},Es=({x:i,y:t},e,s,r,n,o,a,l)=>{i*=e,t*=s;const u=r*i-n*t,h=n*i+r*t;return l.x=u+o,l.y=h+a,l};function Bl(i,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),s=t===1.5707963267948966?.551915024494:e,r=Math.cos(i),n=Math.sin(i),o=Math.cos(i+t),a=Math.sin(i+t);return[{x:r-n*s,y:n+r*s},{x:o+a*s,y:a-o*s},{x:o,y:a}]}const ir=(i,t,e,s)=>{const r=i*s-t*e<0?-1:1;let n=i*e+t*s;return n>1&&(n=1),n<-1&&(n=-1),r*Math.acos(n)},Fl=(i,t,e,s,r,n,o,a,l,u,h,c,f)=>{const m=Math.pow(r,2),p=Math.pow(n,2),_=Math.pow(h,2),d=Math.pow(c,2);let b=m*p-m*d-p*_;b<0&&(b=0),b/=m*d+p*_,b=Math.sqrt(b)*(o===a?-1:1);const y=b*r/n*c,w=b*-n/r*h,A=u*y-l*w+(i+e)/2,P=l*y+u*w+(t+s)/2,E=(h-y)/r,v=(c-w)/n,D=(-h-y)/r,C=(-c-w)/n,T=ir(1,0,E,v);let j=ir(E,v,D,C);a===0&&j>0&&(j-=Ee),a===1&&j<0&&(j+=Ee),f.centerX=A,f.centerY=P,f.ang1=T,f.ang2=j};function Vl(i,t,e,s,r,n,o,a=0,l=0,u=0){if(n===0||o===0)return;const h=Math.sin(a*Ee/360),c=Math.cos(a*Ee/360),f=c*(t-s)/2+h*(e-r)/2,m=-h*(t-s)/2+c*(e-r)/2;if(f===0&&m===0)return;n=Math.abs(n),o=Math.abs(o);const p=Math.pow(f,2)/Math.pow(n,2)+Math.pow(m,2)/Math.pow(o,2);p>1&&(n*=Math.sqrt(p),o*=Math.sqrt(p)),Fl(t,e,s,r,n,o,l,u,h,c,f,m,Is);let{ang1:_,ang2:d}=Is;const{centerX:b,centerY:y}=Is;let w=Math.abs(d)/(Ee/4);Math.abs(1-w)<1e-7&&(w=1);const A=Math.max(Math.ceil(w),1);d/=A;let P=i[i.length-2],E=i[i.length-1];const v={x:0,y:0};for(let D=0;D{const l=a.x-o.x,u=a.y-o.y,h=Math.sqrt(l*l+u*u),c=l/h,f=u/h;return{len:h,nx:c,ny:f}},r=(o,a)=>{o===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)};let n=t[t.length-1];for(let o=0;o0&&(m=-1,p=!0);const _=f/2;let d,b=Math.abs(Math.cos(_)*l/Math.sin(_));b>Math.min(h.len/2,c.len/2)?(b=Math.min(h.len/2,c.len/2),d=Math.abs(b*Math.sin(_)/Math.cos(_))):d=l;const y=a.x+c.nx*b+-c.ny*d*m,w=a.y+c.ny*b+c.nx*d*m,A=Math.atan2(h.ny,h.nx)+Math.PI/2*m,P=Math.atan2(c.ny,c.nx)-Math.PI/2*m;o===0&&i.moveTo(y+Math.cos(A)*d,w+Math.sin(A)*d),i.arc(y,w,d,A,P,p),n=a}}function $l(i,t,e,s){const r=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),n=(a,l,u)=>({x:a.x+(l.x-a.x)*u,y:a.y+(l.y-a.y)*u}),o=t.length;for(let a=0;a=2;c-=2)h[c]===h[c-2]&&h[c-1]===h[c-3]&&h.splice(c-1,2);return this.poly(h,!0,o)}ellipse(t,e,s,r,n){return this.drawShape(new di(t,e,s,r),n),this}roundRect(t,e,s,r,n,o){return this.drawShape(new fi(t,e,s,r,n),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let s=this._currentPoly;return s&&this.endPoly(),s=new Ie,s.points.push(t,e),this._currentPoly=s,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Ie,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let s=e.shape.x,r=e.shape.y;if(!e.transform.isIdentity()){const n=e.transform,o=s;s=n.a*s+n.c*r+n.tx,r=n.b*o+n.d*r+n.ty}this._currentPoly.points.push(s,r)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;eparseInt(D,10)),t.context.poly(y,!0),e&&t.context.fill(),s&&t.context.stroke();break;case"polyline":w=i.getAttribute("points"),y=w.match(/\d+/g).map(D=>parseInt(D,10)),t.context.poly(y,!1),s&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}for(let D=0;Dd.priority!==At.DO_NOT_DOWNLOAD).forEach(d=>f.insert(d.piece_range,d.name));const m=new as;let p="",_=1;for(let d=0;d{t.isActive&&u()}),ri(()=>{n.value&&(o.value=new Promise(async h=>{const c=new Qr;await c.init({antialias:!0,width:n.value?.width,height:n.value?.height,canvas:n.value}),h(c)}),s.value&&u())}),hs(async()=>{if(!o.value)return;(await o.value).destroy({removeView:!1},{children:!0})}),(h,c)=>(k(),G("canvas",{ref_key:"canvas",ref:n,width:"4096",height:"20"},null,512))}});Wl=te(Xl,[["__scopeId","data-v-212dd1f4"]]);ql=["href"];jl={key:1};Zl={class:"my-1"};Kl={class:"mr-2"};Ql={key:0};Jl={key:2};th={key:0};eh={key:1};sh={key:2};ih={key:0};rh=ct({__name:"Overview",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,{t:e}=ge(),{cachedFiles:s}=mt(Le()),r=or(),{properties:n}=mt(Bt()),o=_e(),a=W(()=>s.value.filter(v=>v.priority!==At.DO_NOT_DOWNLOAD)),l=W(()=>s.value.length),u=W(()=>a.value.length===1?a.value[0].name:""),h=W(()=>n.value?.comment??""),c=W(()=>n.value?.dl_speed_avg??0),f=W(()=>n.value?.piece_size??0),m=W(()=>n.value?.pieces_have??0),p=W(()=>n.value?.pieces_num??0),_=W(()=>n.value?.up_speed_avg??0),d=W(()=>`torrent-${t.torrent.state}`),b=W(()=>`${parseInt(In(f.value,!0))} ${En(f.value,!0)}`),y=W(()=>[wi.META_DL,wi.FORCED_META_DL].includes(t.torrent.state));async function w(){try{await navigator.clipboard.writeText(t.torrent.hash)}catch{Pi.error(e("toast.copy.error"));return}Pi.success(e("toast.copy.success"))}function A(v){r.createDialog(_n,{hashes:[t.torrent.hash],mode:v})}function P(){r.createDialog(Wn,{hash:t.torrent.hash,isFolder:!1,oldName:u.value})}function E(v){if(r.hasActiveDialog||!t.isActive)return!1;if(v.key==="d")return v.preventDefault(),A("dl"),!0;if(v.key==="s")return v.preventDefault(),A("save"),!0;if(v.key==="f"&&a.value.length===1)return v.preventDefault(),P(),!0;if(v.key==="Delete")return v.preventDefault(),r.createDialog(Dn,{hashes:[t.torrent.hash]}),!0}return ri(()=>{document.addEventListener("keydown",E)}),hs(async()=>{document.removeEventListener("keydown",E)}),(v,D)=>v.torrent?(k(),$(ce,{key:0},{default:x(()=>[g(ns,{class:"text-wrap"},{default:x(()=>[V(S(v.torrent.name),1)]),_:1}),g(Pn,null,{default:x(()=>[I("div",null,[(k(!0),G(lt,null,_t(M(Mn)(h.value),C=>(k(),G("span",null,[M(Sn)(C)?(k(),G("a",{key:0,target:"_blank",href:C},S(C),9,ql)):(k(),G("span",jl,S(C),1))]))),256))]),I("div",Zl,[I("span",Kl,S(v.torrent.hash),1),g(nt,{variant:"outlined",rounded:"",onClick:w},{default:x(()=>[V(S(v.$t("torrentDetail.overview.copy_hash")),1)]),_:1})])]),_:1}),g(De,null,{default:x(()=>[g(K,null,{default:x(()=>[g(z,{cols:"12",md:"6"},{default:x(()=>[g(K,null,{default:x(()=>[g(z,{cols:"4"},{default:x(()=>[g(kn,{color:d.value,indeterminate:y.value,size:100,"model-value":v.torrent?.progress*100||0,width:15},{default:x(()=>[y.value?(k(),G("span",Ql,S(v.$t("torrentDetail.overview.fetchingMetadata")),1)):v.torrent.progress===1?(k(),$(st,{key:1,icon:"mdi-check",size:"x-large"})):(k(),G("span",Jl,S(M(Rs)(v.torrent.progress)),1))]),_:1},8,["color","indeterminate","model-value"])]),_:1}),g(z,{cols:"8",class:"d-flex flex-column align-center justify-center"},{default:x(()=>[y.value?(k(),G("div",th,[I("span",null,S(v.$t("torrentDetail.overview.waitingForMetadata")),1)])):(k(),G("div",eh,[g(Wl,{torrent:v.torrent,isActive:v.isActive},null,8,["torrent","isActive"])])),p.value>0?(k(),G("div",sh,[I("span",null,S(M(e)("torrentDetail.overview.pieceCount",{owned:m.value,total:p.value,pieceSize:b.value})),1)])):ht("",!0),I("div",null,[g(st,{icon:"mdi-arrow-down"}),V(" "+S(M(Zt)(v.torrent.dlspeed,M(o).useBitSpeed))+" ",1),g(st,{icon:"mdi-arrow-up"}),V(" "+S(M(Zt)(v.torrent.upspeed,M(o).useBitSpeed)),1)])]),_:1})]),_:1}),g(K,null,{default:x(()=>[g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrent.properties.download_path"))+":",1),I("div",null,S(v.torrent.download_path),1),g(nt,{icon:"mdi-pencil",color:"accent",size:"x-small",onClick:D[0]||(D[0]=C=>A("dl"))})]),_:1}),g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrentDetail.overview.fileCount"))+":",1),I("div",null,S(a.value.length)+" / "+S(l.value),1),a.value.length===1?(k(),G("div",ih,S(u.value),1)):ht("",!0),a.value.length===1?(k(),$(nt,{key:1,icon:"mdi-pencil",color:"accent",size:"x-small",onClick:P})):ht("",!0)]),_:1})]),_:1}),g(K,null,{default:x(()=>[g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrent.properties.save_path"))+":",1),I("div",null,S(v.torrent.savePath),1),g(nt,{icon:"mdi-pencil",color:"accent",size:"x-small",onClick:D[1]||(D[1]=C=>A("save"))})]),_:1}),g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrent.properties.content_path"))+":",1),I("div",null,S(v.torrent.content_path),1)]),_:1})]),_:1})]),_:1}),g(z,{cols:"12",md:"6"},{default:x(()=>[g(K,null,{default:x(()=>[g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrent.properties.state"))+":",1),g(ae,{variant:"flat",color:d.value},{default:x(()=>[V(S(v.$t(`torrent.state.${v.torrent.state}`)),1)]),_:1},8,["color"])]),_:1}),g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrent.properties.category"))+":",1),g(ae,{variant:"flat",color:"category"},{default:x(()=>[V(S(v.torrent.category.length?v.torrent.category:v.$t("navbar.side.filters.uncategorized")),1)]),_:1})]),_:1})]),_:1}),g(K,null,{default:x(()=>[g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrent.properties.tracker"))+":",1),g(ae,{variant:"flat",color:"tracker"},{default:x(()=>[V(S(v.torrent.tracker?M(Tn)(v.torrent.tracker):v.$t("navbar.side.filters.untracked")),1)]),_:1})]),_:1}),g(z,{cols:"6",class:"d-flex flex-wrap chipgap"},{default:x(()=>[I("div",null,S(v.$t("torrent.properties.tags"))+":",1),v.torrent.tags?(k(!0),G(lt,{key:0},_t(v.torrent.tags,C=>(k(),$(ae,{key:C,variant:"flat",color:"tag"},{default:x(()=>[V(S(C),1)]),_:2},1024))),128)):ht("",!0),!v.torrent.tags||v.torrent.tags.length===0?(k(),$(ae,{key:1,variant:"flat",color:"tag"},{default:x(()=>[V(S(v.$t("navbar.side.filters.untagged")),1)]),_:1})):ht("",!0)]),_:1})]),_:1}),g(K,null,{default:x(()=>[g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrentDetail.overview.selectedFileSize"))+":",1),I("div",null,S(M(Nt)(v.torrent.size,M(o).useBinarySize))+" / "+S(M(Nt)(v.torrent.total_size,M(o).useBinarySize)),1)]),_:1}),g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrentDetail.overview.ratio"))+":",1),I("div",null,S(v.torrent.ratio),1)]),_:1})]),_:1}),g(K,null,{default:x(()=>[g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrentDetail.overview.downloaded"))+":",1),I("div",null,S(M(Nt)(v.torrent.downloaded,M(o).useBinarySize)),1)]),_:1}),g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrentDetail.overview.uploaded"))+":",1),I("div",null,S(M(Nt)(v.torrent.uploaded,M(o).useBinarySize)),1)]),_:1})]),_:1}),g(K,null,{default:x(()=>[g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrentDetail.overview.dlSpeedAverage"))+":",1),I("div",null,S(M(Zt)(c.value,M(o).useBitSpeed)),1)]),_:1}),g(z,{cols:"6"},{default:x(()=>[I("div",null,S(v.$t("torrentDetail.overview.upSpeedAverage"))+":",1),I("div",null,S(M(Zt)(_.value,M(o).useBitSpeed)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})):ht("",!0)}});nh=te(rh,[["__scopeId","data-v-e0346fb1"]]);oh={class:"d-flex"};ah={key:0};lh=["alt","src","title"];hh=["title"];uh={class:"text-subtitle-2 text-grey"};ch=["title"];dh={class:"d-flex flex-column"};fh={class:"text-h5"};ph=ct({__name:"Peers",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,{t:e}=ge(),s=Oe(),r=Rn(),n=_e(),o=pt(!1),a=pt([]),l=pt(""),u=pt(null),h=pt(!1);async function c(){o.value=!0,a.value=Object.entries((await s.getTorrentPeers(t.torrent.hash)).peers).map(([d,b])=>({...b,host:d})),o.value=!1}async function f(){l.value.length&&(await s.addTorrentPeers(t.torrent.hash,l.value.split(` `)),await c(),m())}function m(){h.value=!1,l.value=""}async function p(d){await s.banPeers([d.host]),await r.fetchPreferences(),await c()}async function _(d){d??t.isActive?(await c(),u.value=setInterval(c,5e3)):(clearInterval(u.value),u.value=null)}return ni(_),hs(()=>_(!1)),ls(()=>t.isActive,_),(d,b)=>(k(),$(de,null,{default:x(()=>[(k(!0),G(lt,null,_t(a.value,(y,w)=>(k(),G(lt,null,[w>0?(k(),$(Bs,{key:0,color:"white"})):ht("",!0),g(kt,null,{default:x(()=>[I("div",oh,[I("div",null,[g(ar,{class:"wrap-anywhere",style:{"white-space":"unset"}},{default:x(()=>[y.country_code?(k(),G("span",ah,[M(Bn)?(k(),G("img",{key:0,alt:M(ps)(y.country_code).char,src:M(ps)(y.country_code).url,title:y.country,style:{"max-width":"32px"}},null,8,lh)):(k(),G("span",{key:1,title:y.country},S(M(ps)(y.country_code).char),9,hh))])):ht("",!0),I("span",null,S(y.ip),1),I("span",uh," :"+S(y.port),1)]),_:2},1024),g(is,{class:"d-block"},{default:x(()=>[I("div",null,[V(" Flags: "),I("span",{class:"cursor-help",title:y.flags_desc},S(y.flags),9,ch)]),I("div",null,"Progress: "+S(M(Rs)(y.progress)),1),I("div",null,[g(st,{icon:"mdi-arrow-down",color:"download"}),V(" "+S(M(Zt)(y.dl_speed,M(n).useBitSpeed))+" ",1),g(st,{icon:"mdi-arrow-up",color:"upload"}),V(" "+S(M(Zt)(y.up_speed,M(n).useBitSpeed)),1)]),I("div",null,S(M(Nt)(y.downloaded,M(n).useBinarySize))+" | "+S(M(Nt)(y.uploaded,M(n).useBinarySize)),1),I("div",null,"Relevance: "+S(M(Rs)(y.relevance)),1)]),_:2},1024)]),g(Kt),I("div",dh,[g(nt,{color:"red",icon:"mdi-cancel",variant:"text",onClick:A=>p(y)},null,8,["onClick"])])])]),_:2},1024)],64))),256)),a.value.length===0?(k(),$(kt,{key:0},{default:x(()=>[V(S(d.$t("torrentDetail.peers.emptyList")),1)]),_:1})):ht("",!0),g(kt,null,{default:x(()=>[I("div",{class:Re(["d-flex gap py-5",d.$vuetify.display.mobile?"flex-column":"justify-space-evenly"])},[g(Fs,{modelValue:h.value,"onUpdate:modelValue":b[1]||(b[1]=y=>h.value=y),"max-width":"750px"},{activator:x(({props:y})=>[g(nt,$s(y,{variant:"flat",text:M(e)("torrentDetail.peers.addPeers.title"),color:"accent"}),null,16,["text"])]),default:x(()=>[g(ce,null,{default:x(()=>[g(ns,null,{default:x(()=>[I("span",fh,S(M(e)("torrentDetail.peers.addPeers.title")),1)]),_:1}),g(De,null,{default:x(()=>[g(lr,null,{default:x(()=>[g(K,null,{default:x(()=>[g(z,{cols:"12"},{default:x(()=>[g(hr,{modelValue:l.value,"onUpdate:modelValue":b[0]||(b[0]=y=>l.value=y),label:M(e)("torrentDetail.peers.addPeers.newPeers"),placeholder:M(e)("torrentDetail.peers.addPeers.newPeersPlaceholder"),hint:M(e)("torrentDetail.peers.addPeers.newPeersHint")},null,8,["modelValue","label","placeholder","hint"])]),_:1})]),_:1})]),_:1})]),_:1}),g(Vs,null,{default:x(()=>[g(Kt),g(nt,{color:"error",onClick:m},{default:x(()=>[V(S(M(e)("common.cancel")),1)]),_:1}),g(nt,{color:"accent",onClick:f},{default:x(()=>[V(S(M(e)("common.ok")),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])],2)]),_:1})]),_:1}))}});mh=te(ph,[["__scopeId","data-v-ceb5c391"]]);_h=ct({__name:"TagsAndCategories",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,e=Oe(),s=si(),r=W(()=>e.categories.map(l=>l.name).indexOf(t.torrent.category)),n=W(()=>e.tags.filter(l=>t.torrent.tags?.includes(l)));async function o(l){t.torrent.category===l?await s.setTorrentCategory([t.torrent.hash],""):await s.setTorrentCategory([t.torrent.hash],l)}async function a(l){t.torrent.tags?.includes(l)?await s.removeTorrentTags([t.torrent.hash],[l]):await s.addTorrentTags([t.torrent.hash],[l])}return ni(async()=>{await e.fetchCategories(),await e.fetchTags()}),(l,u)=>(k(),$(ce,null,{default:x(()=>[g(De,null,{default:x(()=>[g(K,null,{default:x(()=>[g(z,{cols:"12",md:"6"},{default:x(()=>[g(Ai,{"model-value":n.value,multiple:""},{default:x(()=>[g(de,null,{default:x(()=>[g(Ci,null,{default:x(()=>[V(S(l.$t("torrentDetail.tagsAndCategories.tags")),1)]),_:1}),(k(!0),G(lt,null,_t(M(e).tags,h=>(k(),$(kt,{title:h,variant:l.torrent.tags?.includes(h)?"tonal":void 0,"base-color":l.torrent.tags?.includes(h)?"accent":void 0,onClick:c=>a(h)},null,8,["title","variant","base-color","onClick"]))),256))]),_:1})]),_:1},8,["model-value"])]),_:1}),g(z,{cols:"12",md:"6"},{default:x(()=>[g(Ai,{"model-value":r.value},{default:x(()=>[g(de,null,{default:x(()=>[g(Ci,null,{default:x(()=>[V(S(l.$t("torrentDetail.tagsAndCategories.categories")),1)]),_:1}),(k(!0),G(lt,null,_t(M(e).categories,h=>(k(),$(kt,{title:h.name,variant:h.name===t.torrent.category?"tonal":void 0,"base-color":h.name===t.torrent.category?"accent":void 0,onClick:c=>o(h.name)},null,8,["title","variant","base-color","onClick"]))),256))]),_:1})]),_:1},8,["model-value"])]),_:1})]),_:1})]),_:1})]),_:1}))}});gh={class:"d-flex"};yh={key:0};xh={key:1};bh={key:2};vh={key:3};wh={key:0,class:"d-flex flex-column"};Ah={class:"text-h5"};Ch={class:"text-h5"};Sh=ct({__name:"Trackers",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,{t:e}=ge(),s=Oe();function r(P){switch(P){case Vt.DISABLED:return e("constants.trackerStatus.disabled");case Vt.NOT_YET_CONTACTED:return e("constants.trackerStatus.not_yet_contacted");case Vt.WORKING:return e("constants.trackerStatus.working");case Vt.UPDATING:return e("constants.trackerStatus.updating");case Vt.NOT_WORKING:return e("constants.trackerStatus.not_working");default:return""}}function n(P){return typeof P=="number"?P===-1?"N/A":P.valueOf():!P||P.num_peers===-1||P?.num_seeds===-1||P?.num_leeches===-1?"N/A":e("torrentDetail.trackers.peersValue",{peers:P.num_peers,seeds:P.num_seeds,leeches:P.num_leeches})}const o=pt(!1),a=pt([]),l=pt(""),u=pt(null),h=pt(!1),c=[P=>!!P||e("torrentDetail.trackers.editTracker.newUrlRequired")],f=Ln({isVisible:!1,isFormValid:!1,oldUrl:"",newUrl:""});function m(P){f.isVisible=!0,f.oldUrl=P.url,f.newUrl=P.url,cr(()=>{document.getElementById("input")?.select()})}async function p(){o.value=!0,a.value=(await s.getTorrentTrackers(t.torrent.hash)).map(P=>({...P,isSelectable:P.tier!==-1})),o.value=!1}async function _(){l.value.length&&(await s.addTorrentTrackers(t.torrent.hash,l.value),await p(),d())}function d(){h.value=!1,l.value=""}async function b(){f.isFormValid&&(await s.editTorrentTracker(t.torrent.hash,f.oldUrl,f.newUrl),f.isVisible=!1,await p())}async function y(P){await s.removeTorrentTrackers(t.torrent.hash,[P.url]),await p()}async function w(){await s.reannounceTorrents([t.torrent.hash])}async function A(P){P??t.isActive?(await p(),u.value=setInterval(p,5e3)):(clearInterval(u.value),u.value=null)}return ni(A),hs(()=>A(!1)),ls(()=>t.isActive,A),(P,E)=>(k(),$(de,null,{default:x(()=>[(k(!0),G(lt,null,_t(a.value,(v,D)=>(k(),G(lt,null,[D===3?(k(),$(Bs,{key:0,color:"white",thickness:"5"})):D>0?(k(),$(Bs,{key:1,class:"mx-5",color:"white"})):ht("",!0),g(kt,null,{default:x(()=>[I("div",gh,[I("div",{class:Re(`tracker-${M(Vt)[v.status].toLowerCase()}`)},[g(ar,{class:"text-break text-wrap"},{default:x(()=>[V(S(v.url),1)]),_:2},1024),g(is,{class:"d-block"},{default:x(()=>[v.msg?(k(),G("div",yh,S(v.msg),1)):(k(),G("div",xh,S(r(v.status)),1)),v.tier>=0?(k(),G("div",bh,S(M(e)("torrentDetail.trackers.tier",v.tier)),1)):ht("",!0),v.status!==M(Vt).NOT_WORKING?(k(),G("div",vh,[I("div",null,S(n(v)),1),I("div",null,"Downloads: "+S(n(v.num_downloaded)),1)])):ht("",!0)]),_:2},1024)],2),g(Kt),v.tier>=0?(k(),G("div",wh,[g(Fs,{modelValue:f.isVisible,"onUpdate:modelValue":E[4]||(E[4]=C=>f.isVisible=C),"max-width":"750px"},{activator:x(({props:C})=>[g(nt,$s(C,{icon:"mdi-pencil",variant:"text",onClick:T=>m(v)}),null,16,["onClick"])]),default:x(()=>[g(ce,null,{default:x(()=>[g(ns,null,{default:x(()=>[I("span",Ah,S(M(e)("torrentDetail.trackers.editTracker.title")),1)]),_:1}),g(De,null,{default:x(()=>[g(M(Fn),{modelValue:f.isFormValid,"onUpdate:modelValue":E[1]||(E[1]=C=>f.isFormValid=C),onSubmit:E[2]||(E[2]=Ns(()=>{},["prevent"]))},{default:x(()=>[g(M(Ds),{"model-value":f.oldUrl,disabled:"",label:P.$t("torrentDetail.trackers.editTracker.oldUrl")},null,8,["model-value","label"]),g(M(Ds),{modelValue:f.newUrl,"onUpdate:modelValue":E[0]||(E[0]=C=>f.newUrl=C),id:"input",rules:c,label:P.$t("torrentDetail.trackers.editTracker.newUrl"),autofocus:"",onKeydown:On(b,["enter"])},null,8,["modelValue","label"])]),_:1},8,["modelValue"])]),_:1}),g(Vs,null,{default:x(()=>[g(Kt),g(nt,{color:"error",disabled:!f.isFormValid,onClick:E[3]||(E[3]=C=>f.isVisible=!1)},{default:x(()=>[V(S(M(e)("common.cancel")),1)]),_:1},8,["disabled"]),g(nt,{color:"accent",onClick:b},{default:x(()=>[V(S(M(e)("common.ok")),1)]),_:1})]),_:1})]),_:1})]),_:2},1032,["modelValue"]),g(nt,{color:"red",icon:"mdi-delete",variant:"text",onClick:C=>y(v)},null,8,["onClick"])])):ht("",!0)])]),_:2},1024)],64))),256)),g(kt,null,{default:x(()=>[I("div",{class:Re(["d-flex gap py-5",P.$vuetify.display.mobile?"flex-column":"justify-space-evenly"])},[g(Fs,{modelValue:h.value,"onUpdate:modelValue":E[6]||(E[6]=v=>h.value=v),"max-width":"750px"},{activator:x(({props:v})=>[g(nt,$s(v,{variant:"flat",text:M(e)("torrentDetail.trackers.addTrackers.title"),color:"accent"}),null,16,["text"])]),default:x(()=>[g(ce,null,{default:x(()=>[g(ns,null,{default:x(()=>[I("span",Ch,S(M(e)("torrentDetail.trackers.addTrackers.title")),1)]),_:1}),g(De,null,{default:x(()=>[g(lr,null,{default:x(()=>[g(K,null,{default:x(()=>[g(z,{cols:"12"},{default:x(()=>[g(hr,{modelValue:l.value,"onUpdate:modelValue":E[5]||(E[5]=v=>l.value=v),label:M(e)("torrentDetail.trackers.addTrackers.newTrackers"),hint:M(e)("torrentDetail.trackers.addTrackers.newTrackersHint")},null,8,["modelValue","label","hint"])]),_:1})]),_:1})]),_:1})]),_:1}),g(Vs,null,{default:x(()=>[g(Kt),g(nt,{color:"error",onClick:d},{default:x(()=>[V(S(M(e)("common.cancel")),1)]),_:1}),g(nt,{color:"accent",onClick:_},{default:x(()=>[V(S(M(e)("common.ok")),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),g(nt,{variant:"flat",disabled:a.value.length===3,text:M(e)("torrentDetail.trackers.reannounce"),color:"primary",onClick:w},null,8,["disabled","text"])],2)]),_:1})]),_:1}))}});Mh=te(Sh,[["__scopeId","data-v-ed947913"]]);Ph={class:"pa-3 text-select"};kh={style:{"font-size":"1.6em !important"},class:"subtitle-1 ml-2"};Th={class:"d-flex justify-end"};Ih=ct({__name:"TorrentDetail",setup(i){const t=Yn(),{t:e}=ge(),s=Le(),r=or(),n=si(),o=Bt(),a=[{text:e("torrentDetail.tabs.overview"),value:"overview"},{text:e("torrentDetail.tabs.info"),value:"info"},{text:e("torrentDetail.tabs.trackers"),value:"trackers"},{text:e("torrentDetail.tabs.peers"),value:"peers"},{text:e("torrentDetail.tabs.content"),value:"content"},{text:e("torrentDetail.tabs.tagsAndCategories"),value:"tagsAndCategories"}],l=pt("overview"),u=W(()=>t.currentRoute.value.params.hash),h=W(()=>n.getTorrentByHash(u.value)),c=()=>{t.push({name:"dashboard"})};function f(p){if(r.hasActiveDialog)return!1;p.key==="Escape"&&c()}function m(){const p=t.currentRoute.value.params.tab;p&&(l.value=p)}return Un(()=>{m()}),ls(h,()=>{o.fetchProperties(u.value)}),ri(()=>{document.addEventListener("keydown",f),m(),o.fetchProperties(u.value),s.resumeTimer()}),zn(()=>{document.removeEventListener("keydown",f),o.$reset(),s.$reset()}),(p,_)=>(k(),G(lt,null,[I("div",Ph,[g(K,{"no-gutters":"",align:"center",justify:"center"},{default:x(()=>[g(z,null,{default:x(()=>[I("h1",kh,S(M(e)("torrentDetail.title")),1)]),_:1}),g(z,null,{default:x(()=>[I("div",Th,[g(nt,{icon:"mdi-close",variant:"plain",onClick:c})])]),_:1})]),_:1}),g(K,{class:"ma-0 pa-0"},{default:x(()=>[g(Nn,{modelValue:l.value,"onUpdate:modelValue":_[0]||(_[0]=d=>l.value=d),"bg-color":"primary",grow:"","show-arrows":""},{default:x(()=>[(k(),G(lt,null,_t(a,({text:d,value:b})=>g($n,{value:b,href:`#/torrent/${u.value}/${b}`,text:d},null,8,["value","href","text"])),64))]),_:1},8,["modelValue"])]),_:1}),h.value?(k(),$(Vn,{key:0,modelValue:l.value,"onUpdate:modelValue":_[1]||(_[1]=d=>l.value=d),touch:!1},{default:x(()=>[g(ne,{value:"overview"},{default:x(()=>[g(nh,{torrent:h.value,"is-active":l.value==="overview"},null,8,["torrent","is-active"])]),_:1}),g(ne,{value:"info"},{default:x(()=>[g(mo,{torrent:h.value,"is-active":l.value==="info"},null,8,["torrent","is-active"])]),_:1}),g(ne,{value:"trackers"},{default:x(()=>[g(Mh,{torrent:h.value,"is-active":l.value==="trackers"},null,8,["torrent","is-active"])]),_:1}),g(ne,{value:"peers"},{default:x(()=>[g(mh,{torrent:h.value,"is-active":l.value==="peers"},null,8,["torrent","is-active"])]),_:1}),g(ne,{value:"content"},{default:x(()=>[g(M(to),{torrent:h.value,"is-active":l.value==="content"},null,8,["torrent","is-active"])]),_:1}),g(ne,{value:"tagsAndCategories"},{default:x(()=>[g(_h,{torrent:h.value,"is-active":l.value==="tagsAndCategories"},null,8,["torrent","is-active"])]),_:1})]),_:1},8,["modelValue"])):ht("",!0)]),I("div",{style:ur(`position: absolute; left: ${M(s).rightClickProperties.offset[0]}px; top: ${M(s).rightClickProperties.offset[1]}px;`)},[g(M(gn),{modelValue:M(s).rightClickProperties.isVisible,"onUpdate:modelValue":_[2]||(_[2]=d=>M(s).rightClickProperties.isVisible=d),"menu-data":M(s).menuData},null,8,["modelValue","menu-data"])],4)],64))}});Lh=Object.freeze(Object.defineProperty({__proto__:null,default:Ih},Symbol.toStringTag,{value:"Module"}))});export{Gr as $,Zr as A,ft as B,dt as C,Qt as D,tt as E,zo as F,sa as G,Cs as H,xt as I,Mr as J,J as K,Q as L,tn as M,Ja as N,pe as O,ut as P,oe as Q,ot as R,ol as S,je as T,Hs as U,Me as V,zl as W,Yl as X,hi as Y,he as Z,on as _,$t as a,Fe as a0,Hi as a1,as as a2,Io as a3,ln as a4,Lh as a5,Ge as b,ya as c,Wr as d,ie as e,Zi as f,il as g,Vr as h,Gt as i,O as j,Y as k,To as l,al as m,Gh as n,sl as o,St as p,Cr as q,Oo as r,Rt as s,Be as t,at as u,ba as v,Dt as w,$a as x,cl as y,Ui as z,__tla};