Files
dotfiles/qbit/vuetorrent/public/assets/TorrentDetail-CKmHZcwa.js
2024-07-06 03:48:00 -04:00

10 lines
219 KiB
JavaScript

const __vite__fileDeps=["./browserAll-Cn_0a7k3.js","./webworkerAll-L7cTVnAp.js","./colorToUniform-rMRo2qOn.js","./CanvasPool-D00IADyo.js","./getBatchSamplersUniformGroup-B1Z3BKU1.js","./ColoredChip.vue_vue_type_script_setup_true_lang-CBDbhtDT.js","./index-C0tfT_Qc.js","./vue-CfSjRv-x.js","./vuetify-PctCzU6r.js","./index-DrdRrMdo.css","./MixedButton.vue_vue_type_script_setup_true_lang-Br4NUWtV.js","./FileIcon-DH65fwz5.js","./MoveTorrentFileDialog.vue_vue_type_script_setup_true_lang-C8uA-x2z.js","./WebGPURenderer-I-StTdCm.js","./SharedSystems-Bg8GzrJB.js","./WebGLRenderer-CaSwjYL2.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
import{b as ae,_ as kn,a as Pn,__tla as __tla_0}from"./ColoredChip.vue_vue_type_script_setup_true_lang-CBDbhtDT.js";import{_ as Tn,__tla as __tla_1}from"./MixedButton.vue_vue_type_script_setup_true_lang-Br4NUWtV.js";import{b as Ue,m as ee,k as lt,g as ce,b8 as At,aZ as dr,b6 as In,X as Gt,ae as hs,e as ns,b9 as En,i as Qt,af as Rn,r as q,Z as Oe,$ as ri,ba as Bt,p as J,a8 as re,B as se,z as ie,aX as Dn,C as Bn,q as Ee,s as Jt,a4 as Bs,b3 as Zt,bb as fr,y as Fn,bc as os,o as pr,bd as _s,E as mr,b0 as $n,aV as Vn,aW as Gn,b4 as wi,be as Nn,V as Fs,bf as Ln,bg as Un,h as st,H as On,a5 as zn,aY as $s,c as Re,aU as Hn,ab as Yn,a7 as Xn,S as Wn,bh as qn,bi as gs,ag as _r,f as Vs,j as Gs,ad as Ci,w as Ai,a3 as jn,d as Kn,G as Zn,aK as Qn,U as Jn,W as to,aL as ne,__tla as __tla_2}from"./index-C0tfT_Qc.js";import{j as ct,E as me,c as j,H as I,Q as G,U as B,M as Ns,I as V,J as x,K as L,L as T,N as _t,u as S,_ as De,n as g,W as gr,$ as dt,f as ht,w as ze,Y as us,v as ni,P as eo,x as yr,a3 as Si,V as bt,F as ft,R as xr,B as oi,s as Mi,T as br,Z as ki,d as so,aa as io,ab as ro,q as Ls,G as vr,r as no,O as oo,S as ao,a as lo}from"./vue-CfSjRv-x.js";import{g as ho}from"./FileIcon-DH65fwz5.js";import{u as wr,a as uo}from"./vuetify-PctCzU6r.js";import{_ as co,__tla as __tla_3}from"./MoveTorrentFileDialog.vue_vue_type_script_setup_true_lang-C8uA-x2z.js";let fe,an,mt,pt,Nt,Y,Li,xa,ks,xt,Fr,et,tt,H,ol,xl,ut,Ae,ot,Tl,Ze,Ws,ke,ur,al,ll,ui,he,Lt,yn,Ji,ls,qo,bn,_u,Ml,Ne,Fa,Tt,Qi,fn,rn,Yr,Ft,W,Ba,Wo,mu,Il,wl,Mt,oa,Dr,Dt,at,Be,Rt,Va,el,zi;let __tla=Promise.all([(()=>{try{return __tla_0}catch{}})(),(()=>{try{return __tla_1}catch{}})(),(()=>{try{return __tla_2}catch{}})(),(()=>{try{return __tla_3}catch{}})()]).then(async()=>{var 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 fo={class:"d-flex"},po={class:"d-flex flex-column overflow-hidden text-no-wrap mr-3"},mo={class:"text-grey"},_o={class:"d-flex align-center"},Pi="#ffe476",go=ct({__name:"ContentNode",props:{node:{},openedItems:{}},emits:["setFilePrio","onRightClick"],setup(i,{emit:t}){const e=i,s=t,{t:r}=me(),{mobile:n}=wr(),o=Ue(),a=ee(),l=j(()=>{if(e.node.fullName==="")return 0;const _=e.node.fullName.split("/").length,f=n.value?12:24;return _*f});function u(_,f){if(f.type==="file")return;_.stopPropagation();const v=e.openedItems.indexOf(f.fullName);v===-1?e.openedItems.push(f.fullName):e.openedItems.splice(v,1)}async function h(_){_.priority===At.DO_NOT_DOWNLOAD?s("setFilePrio",_.childrenIds,At.NORMAL):s("setFilePrio",_.childrenIds,At.DO_NOT_DOWNLOAD)}function c(_,f){In(_)?o.internalSelection.has(f.fullName)?o.internalSelection.delete(f.fullName):o.internalSelection.add(f.fullName):o.internalSelection=new Set([f.fullName])}function d(_){return _.priority===At.DO_NOT_DOWNLOAD?"grey":_.progress===1?"green":""}function m(_){const[f,v]=_.deepCount,y=[];return f>1&&y.push(r("torrentDetail.content.folderInfo",f-1)),v>0&&y.push(r("torrentDetail.content.fileInfo",v)),y.join(", ")}function p(_){const f=[Gt(_.size,a.useBinarySize)];return _.type==="folder"&&f.push(m(_)),f.join(" | ")}return(_,f)=>(I(),G("div",{class:De(["d-flex flex-column py-2 pr-3",_.node.isSelected(S(o).internalSelection)?"selected":""]),style:gr(`padding-left: ${l.value}px`),onClick:f[2]||(f[2]=Ns(v=>c(v,_.node),["stop"])),onContextmenu:f[3]||(f[3]=v=>_.$emit("onRightClick",v,_.node))},[B("div",fo,[B("div",{class:"d-flex align-center",onClick:f[0]||(f[0]=Ns(v=>h(_.node),["stop"]))},[_.node.wanted===null?(I(),V(lt,{key:0,color:d(_.node),icon:"mdi-checkbox-intermediate-variant"},null,8,["color"])):_.node.wanted?(I(),V(lt,{key:1,color:d(_.node),icon:"mdi-checkbox-marked"},null,8,["color"])):(I(),V(lt,{key:2,color:d(_.node),icon:"mdi-checkbox-blank-outline"},null,8,["color"]))]),B("div",{class:"d-flex align-center spacer",onClick:f[1]||(f[1]=v=>u(v,_.node))},[_.node.type==="folder"?(I(),V(lt,{key:0},{default:x(()=>[L(T(_.openedItems.includes(_.node.fullName)?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:1})):_t("",!0),_.node.fullName===""?(I(),V(lt,{key:1,icon:"mdi-file-tree"})):_.node.type==="file"?(I(),V(lt,{key:2,icon:S(ho)(_.node.name)},null,8,["icon"])):_.openedItems.includes(_.node.fullName)?(I(),V(lt,{key:3,icon:"mdi-folder-open",color:Pi})):(I(),V(lt,{key:4,icon:"mdi-folder",color:Pi}))]),B("div",po,[B("div",{class:De(`text-${d(_.node)}`)},T(_.node.name),3),B("div",mo,T(p(_.node)),1)]),g(ce),B("div",_o,[_.node.priority===S(At).MAXIMAL?(I(),V(lt,{key:0,color:"error"},{default:x(()=>[L("mdi-arrow-up")]),_:1})):_.node.priority===S(At).HIGH?(I(),V(lt,{key:1,color:"warning"},{default:x(()=>[L("mdi-arrow-top-right")]),_:1})):_.node.priority===S(At).NORMAL?(I(),V(lt,{key:2},{default:x(()=>[L("mdi-minus")]),_:1})):_.node.priority===S(At).MIXED?(I(),V(lt,{key:3},{default:x(()=>[L("mdi-tilde")]),_:1})):_.node.priority===S(At).DO_NOT_DOWNLOAD?(I(),V(lt,{key:4,color:"grey"},{default:x(()=>[L("mdi-cancel")]),_:1})):_t("",!0)])]),g(dr,{"model-value":_.node.progress,max:1,color:d(_.node),rounded:"sm"},null,8,["model-value","color"])],38))}}),yo=hs(go,[["__scopeId","data-v-47f1c669"]]),xo={class:"mt-2 mx-3 d-flex flex-gap align-center"},bo=ct({__name:"Content",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,{height:e}=wr(),s=Ue(),{rightClickProperties:r,filenameFilter:n,openedItems:o,flatTree:a,internalSelection:l,timerForcedPause:u,isTimerActive:h}=dt(s),c=j(()=>e.value-48*2-64-12*2-56-8);async function d(y,b){r.value.isVisible&&(r.value.isVisible=!1,await yr()),Object.assign(r.value,{isVisible:!0,offset:[y.pageX,y.pageY],hash:t.torrent.hash}),l.value.size<=1&&(l.value=new Set([b.fullName]))}const m=ht();function p(y,b){m.value=setTimeout(()=>{d(y,b)},500)}function _(){clearTimeout(m.value)}ze(()=>t.isActive,y=>{y&&!u.value?s.resumeTimer():s.pauseTimer()}),us(()=>{t.isActive&&s.resumeTimer()}),ni(()=>{s.$reset()});function f(){u.value=!0,s.pauseTimer()}function v(){u.value=!1,s.resumeTimer()}return(y,b)=>(I(),V(Qt,null,{default:x(()=>[B("div",xo,[g(ns,{modelValue:S(n),"onUpdate:modelValue":b[0]||(b[0]=w=>eo(n)?n.value=w:null),"hide-details":"",clearable:"",placeholder:y.$t("torrentDetail.content.filter_placeholder")},null,8,["modelValue","placeholder"]),g(Tn,{icon:S(h)?"mdi-timer-pause":"mdi-timer-play",position:"left",color:"primary",text:S(h)?y.$t("common.pause"):y.$t("common.resume"),onClick:b[1]||(b[1]=w=>S(h)?f():v())},null,8,["icon","text"])]),g(En,{id:"tree-root",items:S(a),height:c.value,"item-height":"68",class:"pa-2"},{default:x(({item:w})=>[g(yo,{"opened-items":S(o),node:w,onSetFilePrio:b[2]||(b[2]=(A,R)=>S(s).setFilePriority(A,R)),onTouchcancel:_,onTouchend:_,onTouchmove:_,onTouchstart:A=>p(A.touches.item(0),w),onOnRightClick:b[3]||(b[3]=(A,R)=>d(A,R))},null,8,["opened-items","node","onTouchstart"])]),_:1},8,["items","height"])]),_:1}))}}),vo={},wo={class:"pl-4"},Co={class:"pr-4"};function Ao(i,t){return I(),V(q,{cols:"12",sm:"6",lg:"3"},{default:x(()=>[g(Rn,{rounded:"xl",class:"d-flex align-center py-2 border"},{default:x(()=>[B("div",wo,[Si(i.$slots,"title")]),g(ce),B("div",Co,[Si(i.$slots,"text")])]),_:3})]),_:3})}const St=hs(vo,[["render",Ao]]),So=ct({__name:"PanelBoolean",props:{torrent:{}},setup(i){const t=i,e=Oe(),s=ri(),{properties:r}=dt(Bt()),n=j({get:()=>t.torrent.auto_tmm,set:h=>e.toggleAutoTmm([t.torrent.hash],h)}),o=j({get:()=>t.torrent.f_l_piece_prio,set:()=>e.toggleFLPiecePrio([t.torrent.hash])}),a=j({get:()=>t.torrent.forced,set:h=>{h?s.forceResumeTorrents([t.torrent.hash]):s.resumeTorrents([t.torrent.hash])}}),l=j({get:()=>t.torrent.seq_dl,set:()=>e.toggleSeqDl([t.torrent.hash])}),u=j({get:()=>t.torrent.super_seeding,set:h=>e.setSuperSeeding([t.torrent.hash],h)});return(h,c)=>(I(),V(ie,{title:h.$t("torrentDetail.info.boolean_values")},{default:x(()=>[g(se,null,{default:x(()=>[g(J,null,{default:x(()=>[g(St,null,{title:x(()=>[g(re,{modelValue:n.value,"onUpdate:modelValue":c[0]||(c[0]=d=>n.value=d),"hide-details":"",density:"compact",label:h.$t("torrent.properties.auto_tmm")},null,8,["modelValue","label"])]),_:1}),g(St,null,{title:x(()=>[g(re,{modelValue:o.value,"onUpdate:modelValue":c[1]||(c[1]=d=>o.value=d),"hide-details":"",density:"compact",label:h.$t("torrent.properties.f_l_piece_prio")},null,8,["modelValue","label"])]),_:1}),g(St,null,{title:x(()=>[g(re,{modelValue:a.value,"onUpdate:modelValue":c[2]||(c[2]=d=>a.value=d),"hide-details":"",density:"compact",label:h.$t("torrent.properties.forced")},null,8,["modelValue","label"])]),_:1}),g(St,null,{title:x(()=>[g(re,{modelValue:l.value,"onUpdate:modelValue":c[3]||(c[3]=d=>l.value=d),"hide-details":"",density:"compact",label:h.$t("torrent.properties.seq_dl")},null,8,["modelValue","label"])]),_:1}),g(St,null,{title:x(()=>[g(re,{modelValue:u.value,"onUpdate:modelValue":c[4]||(c[4]=d=>u.value=d),"hide-details":"",density:"compact",label:h.$t("torrent.properties.super_seeding")},null,8,["modelValue","label"])]),_:1}),g(St,null,{title:x(()=>[g(re,{disabled:"","model-value":S(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"]))}}),Mo=ct({__name:"PanelData",props:{torrent:{}},setup(i){const t=i,{properties:e}=dt(Bt()),{useBinarySize:s}=dt(ee()),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)=>(I(),V(ie,{title:n.$t("torrentDetail.info.data_values")},{default:x(()=>[g(se,null,{default:x(()=>[g(J,null,{default:x(()=>[(I(),G(ft,null,bt(r,a=>g(St,null,{title:x(()=>[L(T(n.$t(`torrent.properties.${a.title}`)),1)]),text:x(()=>[L(T(S(Gt)(a.getter(),S(s))),1)]),_:2},1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),ko=ct({__name:"PanelDatetime",props:{torrent:{}},setup(i){const t=i,{properties:e}=dt(Bt()),{dateFormat:s}=dt(ee()),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)=>(I(),V(ie,{title:n.$t("torrentDetail.info.datetime_values")},{default:x(()=>[g(se,null,{default:x(()=>[g(J,null,{default:x(()=>[(I(),G(ft,null,bt(r,a=>g(St,null,xr({title:x(()=>[L(T(n.$t(`torrent.properties.${a.title}`)),1)]),_:2},[a.getter()>0?{name:"text",fn:x(()=>[L(T(S(Dn)(a.getter(),S(s))),1)]),key:"0"}:{name:"text",fn:x(()=>[L(T(n.$t("common.NA")),1)]),key:"1"}]),1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),Po=ct({__name:"PanelDuration",props:{torrent:{}},setup(i){const t=i,{properties:e}=dt(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)=>(I(),V(ie,{title:r.$t("torrentDetail.info.duration_values")},{default:x(()=>[g(se,null,{default:x(()=>[g(J,null,{default:x(()=>[(I(),G(ft,null,bt(s,o=>g(St,null,xr({title:x(()=>[L(T(r.$t(`torrent.properties.${o.title}`)),1)]),_:2},[o.getter()>0?{name:"text",fn:x(()=>[L(T(S(Bn).duration(o.getter(),o.unit).humanize()),1)]),key:"0"}:{name:"text",fn:x(()=>[L(T(r.$t("common.NA")),1)]),key:"1"}]),1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),To={key:0,class:"d-flex flex-gap-row-small flex-gap-column"},Io=ct({__name:"PanelLongText",props:{torrent:{}},setup(i){const t=i,{properties:e}=dt(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)=>(I(),V(ie,{title:r.$t("torrentDetail.info.long_text_values")},{default:x(()=>[g(se,null,{default:x(()=>[g(Ee,null,{default:x(()=>[(I(),G(ft,null,bt(s,o=>g(Jt,{title:r.$t(`torrent.properties.${o.title}`)},{default:x(()=>[g(Bs,null,{default:x(()=>[L(T(o.getter()||r.$t("common.none")),1)]),_:2},1024)]),_:2},1032,["title"])),64)),g(Jt,{title:r.$t("torrent.properties.tags")},{default:x(()=>[r.torrent.tags?.length?(I(),G("div",To,[(I(!0),G(ft,null,bt(r.torrent.tags,o=>(I(),V(ae,{defaultColor:"tag",value:o},null,8,["value"]))),256))])):(I(),V(Bs,{key:1},{default:x(()=>[L(T(r.$t("torrent.properties.empty_tags")),1)]),_:1}))]),_:1},8,["title"])]),_:1})]),_:1})]),_:1},8,["title"]))}}),Eo=ct({__name:"PanelSpeed",props:{torrent:{}},setup(i){const t=i,{properties:e}=dt(Bt()),{useBitSpeed:s}=dt(ee()),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)=>(I(),V(ie,{title:n.$t("torrentDetail.info.speed_values")},{default:x(()=>[g(se,null,{default:x(()=>[g(J,null,{default:x(()=>[(I(),G(ft,null,bt(r,a=>g(St,null,{title:x(()=>[L(T(n.$t(`torrent.properties.${a.title}`)),1)]),text:x(()=>[L(T(S(Zt)(a.getter(),S(s))),1)]),_:2},1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),Ro=ct({__name:"PanelText",props:{torrent:{}},setup(i){const t=i,{t:e}=me(),{properties:s}=dt(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:()=>e(`torrent.state.${fr(t.torrent.state)}`)},{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)=>(I(),V(ie,{title:n.$t("torrentDetail.info.text_values")},{default:x(()=>[g(se,null,{default:x(()=>[g(J,null,{default:x(()=>[(I(),G(ft,null,bt(r,a=>g(St,null,{title:x(()=>[L(T(n.$t(`torrent.properties.${a.title}`)),1)]),text:x(()=>[L(T(a.getter()),1)]),_:2},1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),Do=ct({__name:"Info",props:{torrent:{},isActive:{type:Boolean}},setup(i){return(t,e)=>(I(),V(Ee,null,{default:x(()=>[g(Jt,null,{default:x(()=>[g(Fn,null,{default:x(()=>[g(ko,{torrent:t.torrent},null,8,["torrent"]),g(Po,{torrent:t.torrent},null,8,["torrent"]),g(So,{torrent:t.torrent},null,8,["torrent"]),g(Mo,{torrent:t.torrent},null,8,["torrent"]),g(Eo,{torrent:t.torrent},null,8,["torrent"]),g(Ro,{torrent:t.torrent},null,8,["torrent"]),g(Io,{torrent:t.torrent},null,8,["torrent"])]),_:1})]),_:1})]),_:1}))}}),Bo=class Us{constructor(t,e){this.low=t,this.high=e}clone(){return new Us(this.low,this.high)}get max(){return this.clone()}less_than(t){return this.low<t.low||this.low===t.low&&this.high<t.high}equal_to(t){return this.low===t.low&&this.high===t.high}intersect(t){return!this.not_intersect(t)}not_intersect(t){return this.high<t.low||t.high<this.low}merge(t){return new Us(this.low===void 0?t.low:this.low<t.low?this.low:t.low,this.high===void 0?t.high:this.high>t.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 t<e}},nt=0,z=1;let Yt=class{constructor(t=void 0,e=void 0,s=null,r=null,n=null,o=z){if(this.left=s,this.right=r,this.parent=n,this.color=o,this.item={key:t,value:e},t&&t instanceof Array&&t.length===2&&!Number.isNaN(t[0])&&!Number.isNaN(t[1])){let[a,l]=t;a>l&&([a,l]=[l,a]),this.item.key=new Bo(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===z}_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.value<t.item.value}less_than(t){return this.item.value===this.item.key&&t.item.value===t.item.key?this.item.key.less_than(t.item.key):this.item.key.less_than(t.item.key)||this.item.key.equal_to(t.item.key)&&this._value_less_than(t)}_value_equal(t){return this.item.value&&t.item.value&&this.item.value.equal_to?this.item.value.equal_to(t.item.value):this.item.value===t.item.value}equal_to(t){return this.item.value===this.item.key&&t.item.value===t.item.key?this.item.key.equal_to(t.item.key):this.item.key.equal_to(t.item.key)&&this._value_equal(t)}intersect(t){return this.item.key.intersect(t.item.key)}copy_data(t){this.item.key=t.item.key,this.item.value=t.item.value}update_max(){if(this.max=this.item.key?this.item.key.max:void 0,this.right&&this.right.max){const t=this.item.key.constructor.comparable_max;this.max=t(this.max,this.right.max)}if(this.left&&this.left.max){const t=this.item.key.constructor.comparable_max;this.max=t(this.max,this.left.max)}}not_intersect_left_subtree(t){const e=this.item.key.constructor.comparable_less_than;let s=this.left.max.high!==void 0?this.left.max.high:this.left.max;return e(s,t.item.key.low)}not_intersect_right_subtree(t){const e=this.item.key.constructor.comparable_less_than;let s=this.right.max.low!==void 0?this.right.max.low:this.right.item.key.low;return e(t.item.key.high,s)}};class ai{constructor(){this.root=null,this.nil_node=new Yt}get size(){let t=0;return this.tree_walk(this.root,()=>t++),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,nt);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 ai;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===nt;)e.parent===e.parent.parent.left?(s=e.parent.parent.right,s.color===nt?(e.parent.color=z,s.color=z,e.parent.parent.color=nt,e=e.parent.parent):(e===e.parent.right&&(e=e.parent,this.rotate_left(e)),e.parent.color=z,e.parent.parent.color=nt,this.rotate_right(e.parent.parent))):(s=e.parent.parent.left,s.color===nt?(e.parent.color=z,s.color=z,e.parent.parent.color=nt,e=e.parent.parent):(e===e.parent.left&&(e=e.parent,this.rotate_right(e)),e.parent.color=z,e.parent.parent.color=nt,this.rotate_left(e.parent.parent)));this.root.color=z}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===z&&this.delete_fixup(s)}delete_fixup(t){let e=t,s;for(;e!==this.root&&e.parent!=null&&e.color===z;)e===e.parent.left?(s=e.parent.right,s.color===nt&&(s.color=z,e.parent.color=nt,this.rotate_left(e.parent),s=e.parent.right),s.left.color===z&&s.right.color===z?(s.color=nt,e=e.parent):(s.right.color===z&&(s.color=nt,s.left.color=z,this.rotate_right(s),s=e.parent.right),s.color=e.parent.color,e.parent.color=z,s.right.color=z,this.rotate_left(e.parent),e=this.root)):(s=e.parent.left,s.color===nt&&(s.color=z,e.parent.color=nt,this.rotate_right(e.parent),s=e.parent.left),s.left.color===z&&s.right.color===z?(s.color=nt,e=e.parent):(s.left.color===z&&(s.color=nt,s.right.color=z,this.rotate_left(s),s=e.parent.left),s.color=e.parent.color,e.parent.color=z,s.left.color=z,this.rotate_right(e.parent),e=this.root));e.color=z}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===nt&&(e.left.color===z&&e.right.color===z||(t=!1))}),t}testBlackHeightProperty(t){let e=0,s=0,r=0;if(t.color===z&&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}}Y=(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.ShapeBuilder="shape-builder",i))(Y||{});let Os,We,Fo,$o;Os=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};We=(i,t)=>Os(i).priority??t;Tt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Os).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Os).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)=>We(o.value,e)-We(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)=>We(n,e)-We(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};Fo={extension:{type:Y.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await os(()=>import("./browserAll-Cn_0a7k3.js").then(async m=>{await m.__tla;return m}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url)}};$o={extension:{type:Y.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await os(()=>import("./webworkerAll-L7cTVnAp.js").then(async m=>{await m.__tla;return m}),__vite__mapDeps([1,2,3,4,5,6,7,8,9,10,11,12]),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 Cr={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,d){if(typeof h!="function")throw new TypeError("The listener must be a function");var m=new r(h,c||l,d),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 d=0,m=c.length,p=new Array(m);d<m;d++)p[d]=c[d].fn;return p},a.prototype.listenerCount=function(u){var h=e?e+u:u,c=this._events[h];return c?c.fn?1:c.length:0},a.prototype.emit=function(u,h,c,d,m,p){var _=e?e+u:u;if(!this._events[_])return!1;var f=this._events[_],v=arguments.length,y,b;if(f.fn){switch(f.once&&this.removeListener(u,f.fn,void 0,!0),v){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,h),!0;case 3:return f.fn.call(f.context,h,c),!0;case 4:return f.fn.call(f.context,h,c,d),!0;case 5:return f.fn.call(f.context,h,c,d,m),!0;case 6:return f.fn.call(f.context,h,c,d,m,p),!0}for(b=1,y=new Array(v-1);b<v;b++)y[b-1]=arguments[b];f.fn.apply(f.context,y)}else{var w=f.length,A;for(b=0;b<w;b++)switch(f[b].once&&this.removeListener(u,f[b].fn,void 0,!0),v){case 1:f[b].fn.call(f[b].context);break;case 2:f[b].fn.call(f[b].context,h);break;case 3:f[b].fn.call(f[b].context,h,c);break;case 4:f[b].fn.call(f[b].context,h,c,d);break;default:if(!y)for(A=1,y=new Array(v-1);A<v;A++)y[A-1]=arguments[A];f[b].fn.apply(f[b].context,y)}}return!0},a.prototype.on=function(u,h,c){return n(this,u,h,c,!1)},a.prototype.once=function(u,h,c){return n(this,u,h,c,!0)},a.prototype.removeListener=function(u,h,c,d){var m=e?e+u:u;if(!this._events[m])return this;if(!h)return o(this,m),this;var p=this._events[m];if(p.fn)p.fn===h&&(!d||p.once)&&(!c||p.context===c)&&o(this,m);else{for(var _=0,f=[],v=p.length;_<v;_++)(p[_].fn!==h||d&&!p[_].once||c&&p[_].context!==c)&&f.push(p[_]);f.length?this._events[m]=f.length===1?f[0]:f:o(this,m)}return this},a.prototype.removeAllListeners=function(u){var h;return u?(h=e?e+u:u,this._events[h]&&o(this,h)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,i.exports=a})(Cr);var Vo=Cr.exports;let Go,No,Lo;Lt=oi(Vo);Go=Math.PI*2;No=180/Math.PI;Lo=Math.PI/180;ut=class{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new ut(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return ys.x=0,ys.y=0,ys}};const ys=new ut;H=class{constructor(t=1,e=0,s=0,r=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,r,n,o){return this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new ut;const s=t.x,r=t.y;return e.x=this.a*s+this.c*r+this.tx,e.y=this.b*s+this.d*r+this.ty,e}applyInverse(t,e){e=e||new ut;const s=this.a,r=this.b,n=this.c,o=this.d,a=this.tx,l=this.ty,u=1/(s*o+n*-r),h=t.x,c=t.y;return e.x=o*u*h+-n*u*c+(l*n-a*o)*u,e.y=s*u*c+-r*u*h+(-l*s+a*r)*u,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*s,this.b=r*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=o*e-this.ty*s,this.ty=o*s+this.ty*e,this}append(t){const e=this.a,s=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}appendFrom(t,e){const s=t.a,r=t.b,n=t.c,o=t.d,a=t.tx,l=t.ty,u=e.a,h=e.b,c=e.c,d=e.d;return this.a=s*u+r*c,this.b=s*h+r*d,this.c=n*u+o*c,this.d=n*h+o*d,this.tx=a*u+l*c+e.tx,this.ty=a*h+l*d+e.ty,this}setTransform(t,e,s,r,n,o,a,l,u){return this.a=Math.cos(a+u)*n,this.b=Math.sin(a+u)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(s*this.a+r*this.c),this.ty=e-(s*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,r=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,r=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-r,n),l=Math.atan2(s,e),u=Math.abs(a+l);return u<1e-5||Math.abs(Go-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(o.x*e+o.y*r),t.position.y=this.ty+(o.x*s+o.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,r=this.d,n=this.tx,o=t*r-e*s;return this.a=r/o,this.b=-e/o,this.c=-s/o,this.d=t/o,this.tx=(s*this.ty-r*n)/o,this.ty=-(t*this.ty-e*n)/o,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new H;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return Oo.identity()}static get shared(){return Uo.identity()}};const Uo=new H,Oo=new H,Wt=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],qt=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],jt=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Kt=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],zs=[],Ar=[],qe=Math.sign;function zo(){for(let i=0;i<16;i++){const t=[];zs.push(t);for(let e=0;e<16;e++){const s=qe(Wt[i]*Wt[e]+jt[i]*qt[e]),r=qe(qt[i]*Wt[e]+Kt[i]*qt[e]),n=qe(Wt[i]*jt[e]+jt[i]*Kt[e]),o=qe(qt[i]*jt[e]+Kt[i]*Kt[e]);for(let a=0;a<16;a++)if(Wt[a]===s&&qt[a]===r&&jt[a]===n&&Kt[a]===o){t.push(a);break}}}for(let i=0;i<16;i++){const t=new H;t.set(Wt[i],qt[i],jt[i],Kt[i],0,0),Ar.push(t)}}zo();const K={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>Wt[i],uY:i=>qt[i],vX:i=>jt[i],vY:i=>Kt[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>zs[i][t],sub:(i,t)=>zs[i][K.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?K.S:K.N:Math.abs(t)*2<=Math.abs(i)?i>0?K.E:K.W:t>0?i>0?K.SE:K.SW:i>0?K.NE:K.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=Ar[K.inv(t)];r.tx=e,r.ty=s,i.append(r)}},je=[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.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,s){const{width:r,height:n}=this;if(r<=0||n<=0)return!1;const o=this.x,a=this.y,l=o-s/2,u=o+r+s/2,h=a-s/2,c=a+n+s/2,d=o+s/2,m=o+r-s/2,p=a+s/2,_=a+n-s/2;return t>=l&&t<=u&&e>=h&&e<=c&&!(t>d&&t<m&&e>p&&e<_)}intersects(t,e){if(!e){const C=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=C)return!1;const P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}const s=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=s||o<=n)return!1;const a=je[0].set(t.left,t.top),l=je[1].set(t.left,t.bottom),u=je[2].set(t.right,t.top),h=je[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 d=c*(l.y-a.y),m=c*(a.x-l.x),p=d*s+m*n,_=d*r+m*n,f=d*s+m*o,v=d*r+m*o;if(Math.max(p,_,f,v)<=d*a.x+m*a.y||Math.min(p,_,f,v)>=d*h.x+m*h.y)return!1;const y=c*(a.y-u.y),b=c*(u.x-a.x),w=y*s+b*n,A=y*r+b*n,R=y*s+b*o,E=y*r+b*o;return!(Math.max(w,A,R,E)<=y*a.x+b*a.y||Math.min(w,A,R,E)>=y*h.x+b*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 xs={default:-1};at=function(i="default"){return xs[i]===void 0&&(xs[i]=-1),++xs[i]};let Ti;Ti={};tt="8.0.0";et=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 Sr=()=>{};mu=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 Ho(i){const t={};for(const e in i)i[e]!==void 0&&(t[e]=i[e]);return t}const Ei=Object.create(null);function Yo(i){const t=Ei[i];return t===void 0&&(Ei[i]=at("resource")),t}const Mr=class kr extends Lt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...kr.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){et(tt,"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=Yo(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Mr.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Xo=Mr;const Pr=class Tr extends Lt{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={...Tr.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 Xo(Ho(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")}};Pr.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};Ft=Pr;class li extends Ft{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}}li.extension=Y.TextureSource;const Ri=new H;Wo=class{constructor(t,e){this.mapCoord=new H,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;r<t.length;r+=2){const n=t[r],o=t[r+1];e[r]=n*s.a+o*s.c+s.tx,e[r+1]=n*s.b+o*s.d+s.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const s=t.orig,r=t.trim;r&&(Ri.set(s.width/r.width,0,0,s.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(Ri));const n=t.source,o=this.uClampFrame,a=this.clampMargin/n._resolution,l=this.clampOffset;return o[0]=(t.frame.x+a+l)/n.width,o[1]=(t.frame.y+a+l)/n.height,o[2]=(t.frame.x+t.frame.width-a+l)/n.width,o[3]=(t.frame.y+t.frame.height-a+l)/n.height,this.uClampOffset[0]=l/n.pixelWidth,this.uClampOffset[1]=l/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}};W=class extends Lt{constructor({source:t,label:e,frame:s,orig:r,trim:n,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:u}={}){if(super(),this.uid=at("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new ot,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new Ft,this.noFrame=!s,s)this.frame.copyFrom(s);else{const{width:h,height:c}=this._source;this.frame.width=h,this.frame.height=c}this.orig=r||this.frame,this.trim=n,this.rotate=l??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=u||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Wo(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:s,height:r}=this._source,n=e.x/s,o=e.y/r,a=e.width/s,l=e.height/r;let u=this.rotate;if(u){const h=a/2,c=l/2,d=n+h,m=o+c;u=K.add(u,K.NW),t.x0=d+h*K.uX(u),t.y0=m+c*K.uY(u),u=K.add(u,2),t.x1=d+h*K.uX(u),t.y1=m+c*K.uY(u),u=K.add(u,2),t.x2=d+h*K.uX(u),t.y2=m+c*K.uY(u),u=K.add(u,2),t.x3=d+h*K.uX(u),t.y3=m+c*K.uY(u)}else t.x0=n,t.y0=o,t.x1=n+a,t.y1=o,t.x2=n+a,t.y2=o+l,t.x3=n,t.y3=o+l}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return et(tt,"Texture.baseTexture is now Texture.source"),this._source}};W.EMPTY=new W({label:"EMPTY",source:new Ft({label:"EMPTY"})});W.EMPTY.destroy=Sr;W.WHITE=new W({source:new li({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});W.WHITE.destroy=Sr;qo=function(i,t,e,s){const{width:r,height:n}=e.orig,o=e.trim;if(o){const a=o.width,l=o.height;i.minX=o.x-t._x*r-s,i.maxX=i.minX+a,i.minY=o.y-t._y*n-s,i.maxY=i.minY+l}else i.minX=-t._x*r-s,i.maxX=i.minX+r,i.minY=-t._y*n-s,i.maxY=i.minY+n};var jo={grad:.9,turn:360,rad:360/(2*Math.PI)},It=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},rt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},vt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Ir=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Di=function(i){return{r:vt(i.r,0,255),g:vt(i.g,0,255),b:vt(i.b,0,255),a:vt(i.a)}},bs=function(i){return{r:rt(i.r),g:rt(i.g),b:rt(i.b),a:rt(i.a,3)}},Ko=/^#([0-9a-f]{3,8})$/i,Ke=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Er=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}},Rr=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:Ir(i.h),s:vt(i.s,0,100),l:vt(i.l,0,100),a:vt(i.a)}},Fi=function(i){return{h:rt(i.h),s:rt(i.s),l:rt(i.l),a:rt(i.a,3)}},$i=function(i){return Rr((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},Pe=function(i){return{h:(t=Er(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},Zo=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qo=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jo=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ta=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Hs={string:[[function(i){var t=Ko.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?rt(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?rt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Jo.exec(i)||ta.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Di({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=Zo.exec(i)||Qo.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)*(jo[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return $i(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)?Di({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 $i(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:Ir(a.h),s:vt(a.s,0,100),v:vt(a.v,0,100),a:vt(a.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return Rr(o)},"hsv"]]},Vi=function(i,t){for(var e=0;e<t.length;e++){var s=t[e][0](i);if(s)return[s,t[e][1]]}return[null,void 0]},ea=function(i){return typeof i=="string"?Vi(i.trim(),Hs.string):typeof i=="object"&&i!==null?Vi(i,Hs.object):[null,void 0]},vs=function(i,t){var e=Pe(i);return{h:e.h,s:vt(e.s+100*t,0,100),l:e.l,a:e.a}},ws=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},Gi=function(i,t){var e=Pe(i);return{h:e.h,s:e.s,l:vt(e.l+100*t,0,100),a:e.a}},Ys=function(){function i(t){this.parsed=ea(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return rt(ws(this.rgba),2)},i.prototype.isDark=function(){return ws(this.rgba)<.5},i.prototype.isLight=function(){return ws(this.rgba)>=.5},i.prototype.toHex=function(){return t=bs(this.rgba),e=t.r,s=t.g,r=t.b,o=(n=t.a)<1?Ke(rt(255*n)):"","#"+Ke(e)+Ke(s)+Ke(r)+o;var t,e,s,r,n,o},i.prototype.toRgb=function(){return bs(this.rgba)},i.prototype.toRgbString=function(){return t=bs(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(Pe(this.rgba))},i.prototype.toHslString=function(){return t=Fi(Pe(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=Er(this.rgba),{h:rt(t.h),s:rt(t.s),v:rt(t.v),a:rt(t.a,3)};var t},i.prototype.invert=function(){return kt({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),kt(vs(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),kt(vs(this.rgba,-t))},i.prototype.grayscale=function(){return kt(vs(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),kt(Gi(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),kt(Gi(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"?kt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):rt(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=Pe(this.rgba);return typeof t=="number"?kt({h:t,s:e.s,l:e.l,a:e.a}):rt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===kt(t).toHex()},i}(),kt=function(i){return i instanceof Ys?i:new Ys(i)},Ni=[],sa=function(i){i.forEach(function(t){Ni.indexOf(t)<0&&(t(Ys,Hs),Ni.push(t))})};function ia(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,d="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));_<c&&(c=_,d=p)}return d}},t.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new i(l).toRgb():null},"name"])}sa([ia]);const de=class Se{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof Se)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._normalize(t),this._value=this._cloneSource(t))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((n,o)=>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]=Se._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=Se.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=kt(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 Se||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}};de.shared=new de;de._temp=new de;de.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;xt=de;const ra={cullArea:null,cullable:!1,cullableChildren:!0};class hi{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?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 na{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 hi(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}}Mt=new na;oa=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;r<n;++r)i[r]=i[r+e];i.length=n};const aa={allowChildren:!0,removeChildren(i=0,t){const e=t??this.children.length,s=e-i,r=[];if(s>0&&s<=e){for(let o=e-1;o>=i;o--){const a=this.children[o];a&&(r.push(a),a.parent=null)}oa(this.children,i,e);const n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(r);for(let o=0;o<r.length;++o)this.emit("childRemoved",r[o],this,o),r[o].emit("removed",this);return r}else if(s===0&&this.children.length===0)return r;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){const t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=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||et(tt,"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 r=i.parent.children.indexOf(i);if(i.parent===this&&r===t)return i;r!==-1&&i.parent.children.splice(r,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i.didViewUpdate=!1,i._updateFlags=15;const s=this.renderGroup||this.parentRenderGroup;return s&&s.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;const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0),this._didChangeId++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;const e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);const s=this.worldTransform.clone();return s.invert(),e.prepend(s),i.setFromMatrix(e),i}};Li=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}};class la{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;e<this._tests.length;e++){const s=this._tests[e];if(s.test(t))return Mt.get(s.maskClass,t)}return t}returnMaskEffect(t){Mt.return(t)}}const Xs=new la;Tt.handleByList(Y.MaskEffect,Xs._effectClasses);const ha={_maskEffect:null,_filterEffect:null,effects:[],addEffect(i){if(this.effects.indexOf(i)!==-1)return;this.effects.push(i),this.effects.sort((s,r)=>s.priority-r.priority);const e=this.renderGroup||this.parentRenderGroup;e&&(e.structureDidChange=!0),this._updateIsSimple()},removeEffect(i){const t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(i){const t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),Xs.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=Xs.getMaskEffect(i),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);const t=this._filterEffect||(this._filterEffect=new Li);i=i;const e=i?.length>0,s=t.filters?.length>0,r=e!==s;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),r&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Li),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}},ua={label:null,get name(){return et(tt,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){et(tt,"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;s<e.length;s++){const r=e[s];if(r.label===i||i instanceof RegExp&&i.test(r.label))return r}if(t)for(let s=0;s<e.length;s++){const n=e[s].getChildByLabel(i,!0);if(n)return n}return null},getChildrenByLabel(i,t=!1,e=[]){const s=this.children;for(let r=0;r<s.length;r++){const n=s[r];(n.label===i||i instanceof RegExp&&i.test(n.label))&&e.push(n)}if(t)for(let r=0;r<s.length;r++)s[r].getChildrenByLabel(i,!0,e);return e}},Ui=new H;Dt=class{constructor(t=1/0,e=1/0,s=-1/0,r=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Ui,this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}isEmpty(){return this.minX>this.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=Ui,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 d=this.minX,m=this.minY,p=this.maxX,_=this.maxY,f=o*t+l*e+h,v=a*t+u*e+c;f<d&&(d=f),v<m&&(m=v),f>p&&(p=f),v>_&&(_=v),f=o*s+l*e+h,v=a*s+u*e+c,f<d&&(d=f),v<m&&(m=v),f>p&&(p=f),v>_&&(_=v),f=o*t+l*r+h,v=a*t+u*r+c,f<d&&(d=f),v<m&&(m=v),f>p&&(p=f),v>_&&(_=v),f=o*s+l*r+h,v=a*s+u*r+c,f<d&&(d=f),v<m&&(m=v),f>p&&(p=f),v>_&&(_=v),this.minX=d,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.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,s=this.minY,r=this.maxX,n=this.maxY,{a:o,b:a,c:l,d:u,tx:h,ty:c}=t;let d=o*e+l*s+h,m=a*e+u*s+c;this.minX=d,this.minY=m,this.maxX=d,this.maxY=m,d=o*r+l*s+h,m=a*r+u*s+c,this.minX=d<this.minX?d:this.minX,this.minY=m<this.minY?m:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=m>this.maxY?m:this.maxY,d=o*e+l*n+h,m=a*e+u*n+c,this.minX=d<this.minX?d:this.minX,this.minY=m<this.minY?m:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=m>this.maxY?m:this.maxY,d=o*r+l*n+h,m=a*r+u*n+c,this.minX=d<this.minX?d:this.minX,this.minY=m<this.minY?m:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=m>this.maxY?m:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,s,r){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<s&&(this.minY=s),this.maxY>r&&(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 Dt(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,d=r.d,m=r.tx,p=r.ty;for(let _=e;_<s;_+=2){const f=t[_],v=t[_+1],y=u*f+c*v+m,b=h*f+d*v+p;n=y<n?y:n,o=b<o?b:o,a=y>a?y:a,l=b>l?b: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 hi(H);fe=new hi(Dt);Dr=function(i,t,e){e.clear();let s,r;return i.parent?t?s=i.parent.worldTransform:(r=Et.get().identity(),s=as(i,r)):s=H.IDENTITY,Br(i,e,s,t),r&&Et.return(r),e.isValid||e.set(0,0,0,0),e};function Br(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=fe.get().clear()),i.boundsArea)t.addRect(i.boundsArea,r);else{i.addBounds&&(t.matrix=r,i.addBounds(t));for(let a=0;a<i.children.length;a++)Br(i.children[a],t,r,s)}if(o){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);n.addBounds(t,H.IDENTITY),fe.return(t)}s||Et.return(r)}function as(i,t){const e=i.parent;return e&&(as(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}let Cs=0;const Oi=500;Rt=function(...i){Cs!==Oi&&(Cs++,Cs===Oi?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))};Fr=function(i,t,e){return t.clear(),e||(e=H.IDENTITY),$r(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t};function $r(i,t,e,s,r){let n;if(r)n=Et.get(),n=e.copyTo(n);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();const l=i.localTransform;n=Et.get(),n.appendFrom(l,e)}const o=t,a=!!i.effects.length;if(a&&(t=fe.get().clear()),i.boundsArea)t.addRect(i.boundsArea,n);else{i.renderPipeId&&(t.matrix=n,i.addBounds(t));const l=i.children;for(let u=0;u<l.length;u++)$r(l[u],t,n,s,!1)}if(a){for(let l=0;l<i.effects.length;l++)i.effects[l].addLocalBounds?.(t,s);o.addBounds(t,H.IDENTITY),fe.return(t)}Et.return(n)}function Vr(i,t){const e=i.children;for(let s=0;s<e.length;s++){const r=e[s],n=(r.uid&255)<<24|r._didChangeId&16777215;t.data[t.index]!==n&&(t.data[t.index]=n,t.didChange=!0),t.index++,r.children.length&&Vr(r,t)}return t.didChange}const ca=new H,da={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e},_setHeight(i,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Dt});const i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didChangeId>>12&&(i.didChange=!0,i.data[0]=this._didChangeId>>12),Vr(this,i),i.didChange&&Fr(this,i.localBounds,ca),i.localBounds},getBounds(i,t){return Dr(this,i,t||new Dt)}},fa={_onRender:null,set onRender(i){const t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}},pa={_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.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(ma))}};function ma(i,t){return i._zIndex-t._zIndex}const _a={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=as(this,new H);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=as(this,new H);return r.append(this.localTransform),r.applyInverse(i,e)}return this.worldTransform.applyInverse(i,e)}};class Gr{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 ga{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new H,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 Gr,this._onRenderContainers=[]}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let s=0;s<e.length;s++)this.addChild(e[s])}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const e=t.children;for(let s=0;s<e.length;s++)this.addChild(e[s])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}const e=t.children;for(let s=0;s<e.length;s++)this.removeChild(e[s])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}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}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;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender()}destroy(){this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let s=0;s<e.length;s++)this._getChildren(e[s],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const s=t.children;for(let r=0;r<s.length;r++)this._getChildren(s[r],e);return e}}function ya(i,t,e={}){for(const s in t)!e[s]&&t[s]!==void 0&&(i[s]=t[s])}let As,Ss,Ms;As=new yt(null);Ss=new yt(null);Ms=new yt(null,1,1);zi=1;xa=2;ks=4;pt=class extends Lt{constructor(t={}){super(),this.uid=at("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new H,this.relativeGroupTransform=new H,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new yt(this,0,0),this._scale=Ms,this._pivot=Ss,this._skew=As,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didChangeId=0,this._didLocalTransformChangeId=-1,ya(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),this.effects=[],t.parent?.addChild(this)}static mixin(t){Object.defineProperties(pt.prototype,Object.getOwnPropertyDescriptors(t))}addChild(...t){if(this.allowChildren||et(tt,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let r=0;r<t.length;r++)this.addChild(t[r]);return t[0]}const e=t[0];if(e.parent===this)return this.children.splice(this.children.indexOf(e),1),this.children.push(e),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),e;e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e.didViewUpdate=!1,e._updateFlags=15;const s=this.renderGroup||this.parentRenderGroup;return s&&s.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didChangeId+=4096,e._zIndex!==0&&e.depthOfChildModified(),e}removeChild(...t){if(t.length>1){for(let r=0;r<t.length;r++)this.removeChild(t[r]);return t[0]}const e=t[0],s=this.children.indexOf(e);return s>-1&&(this._didChangeId+=4096,this.children.splice(s,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parent=null,this.emit("childRemoved",e,this,s),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didChangeId++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=Mt.get(ga,this),this.groupTransform=H.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),Mt.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new H),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*No}set angle(t){this.rotation=t*Lo}get pivot(){return this._pivot===Ss&&(this._pivot=new yt(this,0,0)),this._pivot}set pivot(t){this._pivot===Ss&&(this._pivot=new yt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===As&&(this._skew=new yt(this,0,0)),this._skew}set skew(t){this._skew===As&&(this._skew=new yt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Ms&&(this._scale=new yt(this,1,1)),this._scale}set scale(t){this._scale===Ms&&(this._scale=new yt(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const s=this.getLocalBounds();let r,n;typeof t!="object"?(r=t,n=e??t):(r=t.width,n=t.height??t.width),r!==void 0&&this._setWidth(r,s.width),n!==void 0&&this._setHeight(n,s.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){if((this._didLocalTransformChangeId&15)===this._didChangeId)return;this._didLocalTransformChangeId=this._didChangeId;const t=this.localTransform,e=this._scale,s=this._pivot,r=this._position,n=e._x,o=e._y,a=s._x,l=s._y;t.a=this._cx*n,t.b=this._sx*n,t.c=this._cy*o,t.d=this._sy*o,t.tx=r._x-(a*t.a+l*t.c),t.ty=r._y-(a*t.b+l*t.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=zi,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const s=xt.shared.setValue(t??16777215).toBgrNumber();s!==this.localColor&&(this.localColor=s,this._updateFlags|=zi,this._onUpdate())}get tint(){const t=this.localColor;return((t&255)<<16)+(t&65280)+(t>>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=xa,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.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ks,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.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ks,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|=ks,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;const e=this.removeChildren(0,this.children.length);if(this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.children)for(let r=0;r<e.length;++r)e[r].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};pt.mixin(aa);pt.mixin(_a);pt.mixin(fa);pt.mixin(da);pt.mixin(ha);pt.mixin(ua);pt.mixin(pa);pt.mixin(ra);Be=class extends pt{constructor(t=W.EMPTY){t instanceof W&&(t={texture:t});const{texture:e=W.EMPTY,anchor:s,roundPixels:r,width:n,height:o,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._didSpriteUpdate=!1,this._bounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._boundsDirty=!0,this._sourceBoundsDirty=!0,this._roundPixels=0,this._anchor=new yt({_onUpdate:()=>{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 W?new Be(t):new Be(W.from(t,e))}set texture(t){t||(t=W.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._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),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(){if(this._didChangeId+=4096,this._didSpriteUpdate=!0,this._sourceBoundsDirty=this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_updateBounds(){qo(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),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}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 ba=new Dt;function Nr(i,t,e){const s=ba;i.measurable=!0,Dr(i,e,s),t.addBoundsMask(s),i.measurable=!1}function Lr(i,t,e){const s=fe.get();i.measurable=!0;const r=Et.get().identity(),n=Ur(i,e,r);Fr(i,s,n),i.measurable=!1,t.addBoundsMask(s),Et.return(r),fe.return(s)}function Ur(i,t,e){return i?(i!==t&&(Ur(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(Rt("Mask bounds, renderable is not inside the root container"),e)}class Or{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){Nr(this.mask,t,e)}addLocalBounds(t,e){Lr(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}}Or.extension=Y.MaskEffect;class zr{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"}}zr.extension=Y.MaskEffect;class Hr{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){Nr(this.mask,t,e)}addLocalBounds(t,e){Lr(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof pt}}Hr.extension=Y.MaskEffect;const va={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 Hi=va;Nt={get(){return Hi},set(i){Hi=i}};Yr=class extends Ft{constructor(t){t.resource||(t.resource=Nt.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}};Yr.extension=Y.TextureSource;ui=class extends Ft{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){const e=Nt.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0),t.resource=e,Rt("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}};ui.extension=Y.TextureSource;Ws=(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))(Ws||{});class Ps{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 Xr=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 Ps(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=Ws.NORMAL){return this._addListener(new Ps(t,e,s))}addOnce(t,e,s=Ws.NORMAL){return this._addListener(new Ps(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<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*gt.targetFPMS;const s=this._head;let r=s.next;for(;r;)r=r.emit(this);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),s=Math.min(Math.max(0,e)/1e3,gt.targetFPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!gt._shared){const t=gt._shared=new gt;t.autoStart=!0,t._protected=!0}return gt._shared}static get system(){if(!gt._system){const t=gt._system=new gt;t.autoStart=!0,t._protected=!0}return gt._system}};Xr.targetFPMS=.06;let Ts;Ze=Xr;async function wa(){return Ts??(Ts=(async()=>{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"})()),Ts}const cs=class Wr extends Ft{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Wr.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=Ze.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 wa(),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&&(Ze.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||(Ze.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ze.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}};cs.extension=Y.TextureSource;cs.defaultOptions={...Ft.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};cs.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Ca=cs;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||Rt(`[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<this.parsers.length;l++){const u=this.parsers[l];if(u.test(e)){r=u.getCacheableAssets(s,e);break}}const n=new Map(Object.entries(r||{}));r||s.forEach(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&&Rt("[Cache] already has key:",l),this._cache.set(l,n.get(l))})}remove(t){if(!this._cacheMap.has(t)){Rt(`[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 qs;he=new Aa;qs=[];Tt.handleByList(Y.TextureSource,qs);function qr(i={}){const t=i&&i.resource,e=t?i.resource:i,s=t?i:{resource:i};for(let r=0;r<qs.length;r++){const n=qs[r];if(n.test(e))return new n(s)}throw new Error(`Could not find a source type for resource: ${s.resource}`)}function Sa(i={},t=!1){const e=i&&i.resource,s=e?i.resource:i,r=e?i:{resource:i};if(!t&&he.has(s))return he.get(s);const n=new W({source:qr(r)});return n.on("destroy",()=>{he.has(s)&&he.remove(s)}),t||he.set(s,n),n}function Ma(i,t=!1){return typeof i=="string"?he.get(i):i instanceof Ft?new W({source:i}):Sa(i,t)}W.from=Ma;Ft.from=qr;Tt.add(Or,zr,Hr,Ca,ui,Yr,li);var jr=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(jr||{});function Ct(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function be(i){return i.split("?")[0].split("#")[0]}function ka(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pa(i,t,e){return i.replace(new RegExp(ka(t),"g"),e)}function Ta(i,t){let e="",s=0,r=-1,n=0,o=-1;for(let a=0;a<=i.length;++a){if(a<i.length)o=i.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){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}}}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}const Fe={toPosix(i){return Pa(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){Ct(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(Ct(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=be(this.toPosix(t??Nt.get().getBaseUrl())),r=be(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(Ct(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=Ta(i),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return Ct(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){const s=i[e];if(Ct(s),s.length>0)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(Ct(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){Ct(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){Ct(i),t&&Ct(t),i=be(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){Ct(i),i=be(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){Ct(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=be(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 Kr(i,t,e,s,r){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?Kr(i.replace(s[e],a),t,e+1,s,r):r.push(i.replace(s[e],a))}}function Ia(i){const t=/\{(.*?)\}/g,e=i.match(t),s=[];if(e){const r=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");r.push(o)}),Kr(i,r,0,e,s)}else s.push(i);return s}const Yi=i=>!Array.isArray(i);class Zr{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&&Rt("[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)&&Rt(`[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"?Ia(m):Array.isArray(m)?m:[m]),c=this.getAlias(n);Array.isArray(c)?c.forEach(s):s(c);const d=[];h.forEach(m=>{m.forEach(p=>{let _={};if(typeof p!="object"){_.src=p;for(let f=0;f<this._parsers.length;f++){const v=this._parsers[f];if(v.test(p)){_=v.parse(p);break}}}else a=p.data??a,l=p.format??l,u=p.loadParser??u,_={..._,...p};if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:c,data:a,format:l,loadParser:u}),d.push(_)})}),c.forEach(m=>{this._assetMap[m]=d})})}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;e<t.length;e++){const s=t[0],r=this._preferredOrder.find(n=>n.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??Ea(t.src),t}}Zr.RETINA_PREFIX=/@([0-9\.]+)x/;function Ea(i){return i.split(".").pop().split("?").shift().split("#").shift()}const Xi=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i},Qr=class Me{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof W?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<=Me.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Me.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const r=this._frameKeys[e],n=this._frames[r],o=n.frame;if(o){let a=null,l=null;const u=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,h=new ot(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);n.rotated?a=new ot(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new ot(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(l=new ot(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[r]=new W({source:this.textureSource,frame:a,orig:h,trim:l,rotate:n.rotated?2:0,defaultAnchor:n.anchor,defaultBorders:n.borders,label:r.toString()})}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const r=t[e][s];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Me.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Me.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(const e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Qr.BATCH_SIZE=1e3;let Wi=Qr;const Ra=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Jr(i,t,e){const s={};if(i.forEach(r=>{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=Jr([`${r}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(s,a)})}return s}const Da={extension:Y.Asset,cache:{test:i=>i instanceof Wi,getCacheableAssets:(i,t)=>Jr(i,t,!1)},resolver:{extension:{type:Y.ResolveParser,name:"resolveSpritesheet"},test:i=>{const e=i.split("?")[0].split("."),s=e.pop(),r=e.pop();return s==="json"&&Ra.includes(r)},parse:i=>{const t=i.split(".");return{resolution:parseFloat(Zr.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:Y.LoadParser,priority:jr.Normal,name:"spritesheetLoader"},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 W)o=s;else{const u=Xi(n+(r??i.meta.image),t.src);o=(await e.load([u]))[u]}const a=new Wi(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 d=n+c;t.data?.ignoreMultiPack||(d=Xi(d,t.src),u.push(e.load({src:d,data:{ignoreMultiPack:!0}})))}const h=await Promise.all(u);a.linkedSheets=h,h.forEach(c=>{c.linkedSheets=[a].concat(a.linkedSheets.filter(d=>d!==c))})}return a},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}};Tt.add(Da);let Qe;Ba=function(){return(!Qe||Qe?.isContextLost())&&(Qe=Nt.get().createCanvas().getContext("webgl",{})),Qe};Fa=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 js=[];Tt.handleByNamedList(Y.Environment,js);async function $a(i){if(!i)for(let t=0;t<js.length;t++){const e=js[t];if(e.value.test()){await e.value.load();return}}}let ve;Va=function(){if(typeof ve=="boolean")return ve;try{ve=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ve=!1}return ve};var ci={exports:{}};ci.exports=ds;ci.exports.default=ds;function ds(i,t,e){e=e||2;var s=t&&t.length,r=s?t[0]*e:i.length,n=tn(i,0,r,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,l,u,h,c,d,m;if(s&&(n=Oa(i,t,n,e)),i.length>80*e){a=u=i[0],l=h=i[1];for(var p=e;p<r;p+=e)c=i[p],d=i[p+1],c<a&&(a=c),d<l&&(l=d),c>u&&(u=c),d>h&&(h=d);m=Math.max(u-a,h-l),m=m!==0?32767/m:0}return $e(n,o,e,a,l,m,0),o}function tn(i,t,e,s,r){var n,o;if(r===Qs(i,t,e,s)>0)for(n=t;n<e;n+=s)o=qi(n,i[n],i[n+1],o);else for(n=e-s;n>=t;n-=s)o=qi(n,i[n],i[n+1],o);return o&&fs(o,o.next)&&(Ge(o),o=o.next),o}function te(i,t){if(!i)return i;t||(t=i);var e=i,s;do if(s=!1,!e.steiner&&(fs(e,e.next)||Z(e.prev,e,e.next)===0)){if(Ge(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function $e(i,t,e,s,r,n,o){if(i){!o&&n&&Wa(i,s,r,n);for(var a=i,l,u;i.prev!==i.next;){if(l=i.prev,u=i.next,n?Na(i,s,r,n):Ga(i)){t.push(l.i/e|0),t.push(i.i/e|0),t.push(u.i/e|0),Ge(i),i=u.next,a=u.next;continue}if(i=u,i===a){o?o===1?(i=La(te(i),t,e),$e(i,t,e,s,r,n,2)):o===2&&Ua(i,t,e,s,r,n):$e(te(i),t,e,s,r,n,1);break}}}}function Ga(i){var t=i.prev,e=i,s=i.next;if(Z(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=r<n?r<o?r:o:n<o?n:o,c=a<l?a<u?a:u:l<u?l:u,d=r>n?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<=d&&p.y>=c&&p.y<=m&&ue(r,a,n,l,o,u,p.x,p.y)&&Z(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Na(i,t,e,s){var r=i.prev,n=i,o=i.next;if(Z(r,n,o)>=0)return!1;for(var a=r.x,l=n.x,u=o.x,h=r.y,c=n.y,d=o.y,m=a<l?a<u?a:u:l<u?l:u,p=h<c?h<d?h:d:c<d?c:d,_=a>l?a>u?a:u:l>u?l:u,f=h>c?h>d?h:d:c>d?c:d,v=Ks(m,p,t,e,s),y=Ks(_,f,t,e,s),b=i.prevZ,w=i.nextZ;b&&b.z>=v&&w&&w.z<=y;){if(b.x>=m&&b.x<=_&&b.y>=p&&b.y<=f&&b!==r&&b!==o&&ue(a,h,l,c,u,d,b.x,b.y)&&Z(b.prev,b,b.next)>=0||(b=b.prevZ,w.x>=m&&w.x<=_&&w.y>=p&&w.y<=f&&w!==r&&w!==o&&ue(a,h,l,c,u,d,w.x,w.y)&&Z(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;b&&b.z>=v;){if(b.x>=m&&b.x<=_&&b.y>=p&&b.y<=f&&b!==r&&b!==o&&ue(a,h,l,c,u,d,b.x,b.y)&&Z(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=y;){if(w.x>=m&&w.x<=_&&w.y>=p&&w.y<=f&&w!==r&&w!==o&&ue(a,h,l,c,u,d,w.x,w.y)&&Z(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function La(i,t,e){var s=i;do{var r=s.prev,n=s.next.next;!fs(r,n)&&en(r,s,s.next,n)&&Ve(r,n)&&Ve(n,r)&&(t.push(r.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),Ge(s),Ge(s.next),s=i=n),s=s.next}while(s!==i);return te(s)}function Ua(i,t,e,s,r,n){var o=i;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Ka(o,a)){var l=sn(o,a);o=te(o,o.next),l=te(l,l.next),$e(o,t,e,s,r,n,0),$e(l,t,e,s,r,n,0);return}a=a.next}o=o.next}while(o!==i)}function Oa(i,t,e,s){var r=[],n,o,a,l,u;for(n=0,o=t.length;n<o;n++)a=t[n]*s,l=n<o-1?t[n+1]*s:i.length,u=tn(i,a,l,s,!1),u===u.next&&(u.steiner=!0),r.push(ja(u));for(r.sort(za),n=0;n<r.length;n++)e=Ha(r[n],e);return e}function za(i,t){return i.x-t.x}function Ha(i,t){var e=Ya(i,t);if(!e)return t;var s=sn(e,i);return te(s,s.next),te(e,e.next)}function Ya(i,t){var e=t,s=i.x,r=i.y,n=-1/0,o;do{if(r<=e.y&&r>=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.next.x?e:e.next,a===s))return o}e=e.next}while(e!==t);if(!o)return null;var l=o,u=o.x,h=o.y,c=1/0,d;e=o;do s>=e.x&&e.x>=u&&s!==e.x&&ue(r<h?s:n,r,u,h,r<h?n:s,r,e.x,e.y)&&(d=Math.abs(r-e.y)/(s-e.x),Ve(e,i)&&(d<c||d===c&&(e.x>o.x||e.x===o.x&&Xa(o,e)))&&(o=e,c=d)),e=e.next;while(e!==l);return o}function Xa(i,t){return Z(i.prev,i,t.prev)<0&&Z(t.next,i,i.next)<0}function Wa(i,t,e,s){var r=i;do r.z===0&&(r.z=Ks(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,qa(r)}function qa(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;t<u&&(a++,s=s.nextZ,!!s);t++);for(l=u;a>0||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 Ks(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 ja(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function ue(i,t,e,s,r,n,o,a){return(r-o)*(t-a)>=(i-o)*(n-a)&&(i-o)*(s-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(r-o)*(s-a)}function Ka(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!Za(i,t)&&(Ve(i,t)&&Ve(t,i)&&Qa(i,t)&&(Z(i.prev,i,t.prev)||Z(i,t.prev,t))||fs(i,t)&&Z(i.prev,i,i.next)>0&&Z(t.prev,t,t.next)>0)}function Z(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function fs(i,t){return i.x===t.x&&i.y===t.y}function en(i,t,e,s){var r=ts(Z(i,t,e)),n=ts(Z(i,t,s)),o=ts(Z(e,s,i)),a=ts(Z(e,s,t));return!!(r!==n&&o!==a||r===0&&Je(i,e,t)||n===0&&Je(i,s,t)||o===0&&Je(e,i,s)||a===0&&Je(e,t,s))}function Je(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 ts(i){return i>0?1:i<0?-1:0}function Za(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&&en(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function Ve(i,t){return Z(i.prev,i,i.next)<0?Z(i,t,i.next)>=0&&Z(i,i.prev,t)>=0:Z(i,t,i.prev)<0||Z(i,i.next,t)<0}function Qa(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 sn(i,t){var e=new Zs(i.i,i.x,i.y),s=new Zs(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 qi(i,t,e,s){var r=new Zs(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 Ge(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 Zs(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}ds.deviation=function(i,t,e,s){var r=t&&t.length,n=r?t[0]*e:i.length,o=Math.abs(Qs(i,0,n,e));if(r)for(var a=0,l=t.length;a<l;a++){var u=t[a]*e,h=a<l-1?t[a+1]*e:i.length;o-=Math.abs(Qs(i,u,h,e))}var c=0;for(a=0;a<s.length;a+=3){var d=s[a]*e,m=s[a+1]*e,p=s[a+2]*e;c+=Math.abs((i[d]-i[p])*(i[m+1]-i[d+1])-(i[d]-i[m])*(i[p+1]-i[d+1]))}return o===0&&c===0?0:Math.abs((c-o)/o)};function Qs(i,t,e,s){for(var r=0,n=t,o=e-s;n<e;n+=s)r+=(i[o]-i[n])*(i[n+1]+i[o+1]),o=n;return r}ds.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},s=0,r=0;r<i.length;r++){for(var n=0;n<i[r].length;n++)for(var o=0;o<t;o++)e.vertices.push(i[r][n][o]);r>0&&(s+=i[r-1].length,e.holes.push(s))}return e};var Ja=ci.exports;const tl=oi(Ja);rn=(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))(rn||{});el=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,d=h.length;c<d;c++)h[c][u](t,e,s,r,n,o,a,l);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}};const sl=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],nn=class on extends Lt{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const e=[...sl,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await $a(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const s in this._systemsHash)t={...this._systemsHash[s].constructor.defaultOptions,...t};t={...on.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let s=0;s<this.runners.init.items.length;s++)await this.runners.init.items[s].init(t);this._initOptions=t}render(t,e){let s=t;if(s instanceof pt&&(s={container:s},e&&(et(tt,"passing a second argument is deprecated, please use render options instead"),s.target=e.renderTexture)),s.target||(s.target=this.view.renderTarget),s.target===this.view.renderTarget&&(this._lastObjectRendered=s.container,s.clearColor=this.background.colorRgba),s.clearColor){const r=Array.isArray(s.clearColor)&&s.clearColor.length===4;s.clearColor=r?s.clearColor:xt.shared.setValue(s.clearColor).toArray()}s.transform||(s.container.updateLocalTransform(),s.transform=s.container.localTransform),this.runners.prerender.emit(s),this.runners.renderStart.emit(s),this.runners.render.emit(s),this.runners.renderEnd.emit(s),this.runners.postrender.emit(s)}resize(t,e,s){this.view.resize(t,e,s),this.emit("resize",this.view.screen.width,this.view.screen.height)}clear(t={}){const e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=rn.ALL);const{clear:s,clearColor:r,target:n}=t;xt.shared.setValue(r??this.background.colorRgba),e.renderTarget.clear(n,s,xt.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new el(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(!Va())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}};nn.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let es;an=nn;function il(i){return es!==void 0||(es=(()=>{const t={stencil:!0,failIfMajorPerformanceCaveat:i??an.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Nt.get().getWebGLRenderingContext())return!1;let s=Nt.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}})()),es}let ss;async function rl(i={}){return ss!==void 0||(ss=await (async()=>{if(!Nt.get().getNavigator().gpu)return!1;try{return await (await navigator.gpu.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),ss}const ji=["webgl","webgpu","canvas"];async function nl(i){let t=[];i.preference?(t.push(i.preference),ji.forEach(n=>{n!==i.preference&&t.push(n)})):t=ji.slice();let e,s={};for(let n=0;n<t.length;n++){const o=t[n];if(o==="webgpu"&&await rl()){const{WebGPURenderer:a}=await os(async()=>{const{WebGPURenderer:l}=await import("./WebGPURenderer-I-StTdCm.js").then(async m=>{await m.__tla;return m});return{WebGPURenderer:l}},__vite__mapDeps([13,2,14,3,5,6,7,8,9,10,11,12]),import.meta.url);e=a,s={...i,...i.webgpu};break}else if(o==="webgl"&&il(i.failIfMajorPerformanceCaveat??an.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:a}=await os(async()=>{const{WebGLRenderer:l}=await import("./WebGLRenderer-CaSwjYL2.js").then(async m=>{await m.__tla;return m});return{WebGLRenderer:l}},__vite__mapDeps([15,2,4,14,5,6,7,8,9,10,11,12]),import.meta.url);e=a,s={...i,...i.webgl};break}else if(o==="canvas")throw s={...i},new Error("CanvasRenderer is not yet implemented")}if(delete s.webgpu,delete s.webgl,!e)throw new Error("No available renderer for the current environment");const r=new e;return await r.init(s),r}class ln{static init(){globalThis.__PIXI_APP_INIT__?.(this)}static destroy(){}}ln.extension=Y.Application;ol=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer)}destroy(){this._renderer=null}};ol.extension={type:[Y.WebGLSystem,Y.WebGPUSystem],name:"initHook",priority:-10};const hn=class Js{constructor(...t){this.stage=new pt,t[0]!==void 0&&et(tt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await nl(t),Js._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return et(tt,"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=Js._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}};hn._plugins=[];let un=hn;Tt.handleByList(Y.Application,un._plugins);Tt.add(ln);const cn=class ti{constructor(t,e,s,r){this.uid=at("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=e,this.x1=s,this.y1=r}addColorStop(t,e){return this.gradientStops.push({offset:t,color:xt.shared.setValue(e).toHex()}),this._styleKey=null,this}buildLinearGradient(){const t=ti.defaultTextureSize,{gradientStops:e}=this,s=Nt.get().createCanvas();s.width=t,s.height=t;const r=s.getContext("2d"),n=r.createLinearGradient(0,0,ti.defaultTextureSize,1);for(let _=0;_<e.length;_++){const f=e[_];n.addColorStop(f.offset,f.color)}r.fillStyle=n,r.fillRect(0,0,t,t),this.texture=new W({source:new ui({resource:s,addressModeU:"clamp-to-edge",addressModeV:"repeat"})});const{x0:o,y0:a,x1:l,y1:u}=this,h=new H,c=l-o,d=u-a,m=Math.sqrt(c*c+d*d),p=Math.atan2(d,c);h.translate(-o,-a),h.scale(1/t,1/t),h.rotate(-p),h.scale(256/m,1),this.transform=h,this._styleKey=null}get styleKey(){if(this._styleKey)return this._styleKey;const t=this.gradientStops.map(r=>`${r.offset}-${r.color}`).join("-"),e=this.texture.uid,s=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${e}-${s}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}};cn.defaultTextureSize=256;al=cn;const Ki={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};ll=class{constructor(t,e){this.uid=at("fillPattern"),this.transform=new H,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Ki[e].addressModeU,t.source.style.addressModeV=Ki[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}};var hl=cl,Is={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},ul=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function cl(i){var t=[];return i.replace(ul,function(e,s,r){var n=s.toLowerCase();for(r=fl(r),n=="m"&&r.length>2&&(t.push([s].concat(r.splice(0,2))),n="l",s=s=="m"?"l":"L");;){if(r.length==Is[n])return r.unshift(s),t.push(r);if(r.length<Is[n])throw new Error("malformed path data");t.push([s].concat(r.splice(0,Is[n])))}}),t}var dl=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function fl(i){var t=i.match(dl);return t?t.map(Number):[]}const pl=oi(hl);function ml(i,t){const e=pl(i),s=[];let r=null,n=0,o=0;for(let a=0;a<e.length;a++){const l=e[a],u=l[0],h=l;switch(u){case"M":n=h[1],o=h[2],t.moveTo(n,o);break;case"m":n+=h[1],o+=h[2],t.moveTo(n,o);break;case"H":n=h[1],t.lineTo(n,o);break;case"h":n+=h[1],t.lineTo(n,o);break;case"V":o=h[1],t.lineTo(n,o);break;case"v":o+=h[1],t.lineTo(n,o);break;case"L":n=h[1],o=h[2],t.lineTo(n,o);break;case"l":n+=h[1],o+=h[2],t.lineTo(n,o);break;case"C":n=h[5],o=h[6],t.bezierCurveTo(h[1],h[2],h[3],h[4],n,o);break;case"c":t.bezierCurveTo(n+h[1],o+h[2],n+h[3],o+h[4],n+h[5],o+h[6]),n+=h[5],o+=h[6];break;case"S":n=h[3],o=h[4],t.bezierCurveToShort(h[1],h[2],n,o);break;case"s":t.bezierCurveToShort(n+h[1],o+h[2],n+h[3],o+h[4]),n+=h[3],o+=h[4];break;case"Q":n=h[3],o=h[4],t.quadraticCurveTo(h[1],h[2],n,o);break;case"q":t.quadraticCurveTo(n+h[1],o+h[2],n+h[3],o+h[4]),n+=h[3],o+=h[4];break;case"T":n=h[1],o=h[2],t.quadraticCurveToShort(n,o);break;case"t":n+=h[1],o+=h[2],t.quadraticCurveToShort(n,o);break;case"A":n=h[6],o=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],n,o);break;case"a":n+=h[6],o+=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],n,o);break;case"Z":case"z":t.closePath(),s.length>0&&(r=s.pop(),r?(n=r.startX,o=r.startY):(n=0,o=0)),r=null;break;default:Rt(`Unknown SVG path command: ${u}`)}u!=="Z"&&u!=="z"&&r===null&&(r={startX:n,startY:o},s.push(r))}return t}class di{constructor(t=0,e=0,s=0){this.type="circle",this.x=t,this.y=e,this.radius=s}clone(){return new di(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 l<o+a&&l>o-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 fi{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 fi(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,d=e-this.y,m=c*c/(a*a)+d*d/(l*l),p=c*c/(u*u)+d*d/(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 _l(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 d=-1;c!==0&&(d=h/c);let m,p;d<0?(m=e,p=s):d>1?(m=r,p=n):(m=e+d*l,p=s+d*u);const _=i-m,f=t-p;return _*_+f*f}class Te{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;r<n;r++)s.push(e[r].x,e[r].y);e=s}this.points=e,this.closePath=!0}clone(){const t=this.points.slice(),e=new Te(t);return e.closePath=this.closePath,e}contains(t,e){let s=!1;const r=this.points.length/2;for(let n=0,o=r-1;n<r;o=n++){const a=this.points[n*2],l=this.points[n*2+1],u=this.points[o*2],h=this.points[o*2+1];l>e!=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;l<a;l+=2){const u=o[l],h=o[l+1],c=o[(l+2)%o.length],d=o[(l+3)%o.length];if(_l(t,e,u,h,c,d)<=n)return!0}return!1}getBounds(t){t=t||new ot;const e=this.points;let s=1/0,r=-1/0,n=1/0,o=-1/0;for(let a=0,l=e.length;a<l;a+=2){const u=e[a],h=e[a+1];s=u<s?u:s,r=u>r?u:r,n=h<n?h:n,o=h>o?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 is=(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 pi{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 pi(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,d=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+d?!0:t<h&&e<c&&is(t,e,h,c,l,u)||t>p-l&&e<c&&is(t,e,p-l,c,l,u)||t>p-l&&e>_-l&&is(t,e,p-l,_-l,l,u)||t<h&&e>_-l&&is(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}]`}}mt=(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))(mt||{});Ne=class extends Lt{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&mt.STATIC)}set static(t){t?this.descriptor.usage|=mt.STATIC:this.descriptor.usage&=~mt.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.byteLength<r.byteLength?s&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=at("resource"),this.emit("change",this));return}s&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}};function dn(i,t){if(!(i instanceof Ne)){let e=t?mt.INDEX:mt.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=mt.INDEX|mt.COPY_DST):(i=new Float32Array(i),e=mt.VERTEX|mt.COPY_DST)),i=new Ne({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}function gl(i,t,e){const s=i.getAttribute(t);if(!s)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const r=s.buffer.data;let n=1/0,o=1/0,a=-1/0,l=-1/0;const u=r.BYTES_PER_ELEMENT,h=(s.offset||0)/u,c=(s.stride||2*4)/u;for(let d=h;d<r.length;d+=c){const m=r[d],p=r[d+1];m>a&&(a=m),p>l&&(l=p),m<n&&(n=m),p<o&&(o=p)}return e.minX=n,e.minY=o,e.maxX=a,e.maxY=l,e}function yl(i){return(i instanceof Ne||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=dn(i.buffer,!1),i}xl=class extends Lt{constructor(t){const{attributes:e,indexBuffer:s,topology:r}=t;super(),this.uid=at("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Dt,this._boundsDirty=!0,this.attributes=e,this.buffers=[],this.instanceCount=t.instanceCount||1;for(const n in e){const o=e[n]=yl(e[n]);this.buffers.indexOf(o.buffer)===-1&&(this.buffers.push(o.buffer),o.buffer.on("update",this.onBufferUpdate,this),o.buffer.on("change",this.onBufferUpdate,this))}s&&(this.indexBuffer=dn(s,!0),this.buffers.push(this.indexBuffer)),this.topology=r||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,gl(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}};const bl=new Float32Array(1),vl=new Uint32Array(1);wl=class extends xl{constructor(){const e=new Ne({data:bl,label:"attribute-batch-buffer",usage:mt.VERTEX|mt.COPY_DST,shrinkToFit:!1}),s=new Ne({data:vl,label:"index-batch-buffer",usage:mt.INDEX|mt.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})}};const Cl=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
`);function Al(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Sl(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const s=Cl.replace(/%forloop%/gi,Al(i));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}let oe=null;fn=function(){if(oe)return oe;const i=Ba();return oe=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),oe=Sl(oe,i),oe};const pn={};Ml=function(i,t){let e=0;for(let s=0;s<t;s++)e=e*31+i[s].uid>>>0;return pn[e]||kl(i,e)};let Es=0;function kl(i,t){const e={};let s=0;Es||(Es=fn());for(let n=0;n<Es;n++){const o=n<i.length?i[n]:W.EMPTY.source;e[s++]=o.source,e[s++]=o.style}const r=new Fa(e);return pn[t]=r,r}class Zi{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}Qi=function(i,t){const e=i.byteLength/8|0,s=new Float64Array(i,0,e);new Float64Array(t,0,e).set(s);const n=i.byteLength-e*8;if(n>0){const o=new Uint8Array(i,e*8,n);new Uint8Array(t,e*8,n).set(o)}};const Pl={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};Tl=(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))(Tl||{});Ji=function(i,t){return t.alphaMode==="no-premultiply-alpha"&&Pl[i]||i};class tr{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}class er{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}}let we=0;const mn=class _n{constructor(t={}){this.uid=at("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._vertexSize=6,this._elements=[],this._batchPool=[],this._batchPoolIndex=0,this._textureBatchPool=[],this._textureBatchPoolIndex=0,t={..._n.defaultOptions,...t};const{vertexSize:e,indexSize:s}=t;this.attributeBuffer=new Zi(e*this._vertexSize*4),this.indexBuffer=new Uint16Array(s),this._maxTextures=fn()}begin(){this.batchIndex=0,this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0,this._batchPoolIndex=0,this._textureBatchPoolIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t.indexStart=this.indexSize,t.location=this.attributeSize,t.batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.vertexSize*this._vertexSize}checkAndUpdateTexture(t,e){const s=t.batch.textures.ids[e._source.uid];return!s&&s!==0?!1:(t.textureId=s,t.texture=e,!0)}updateElement(t){this.dirty=!0,t.packAttributes(this.attributeBuffer.float32View,this.attributeBuffer.uint32View,t.location,t.textureId)}break(t){const e=this._elements;let s=this._textureBatchPool[this._textureBatchPoolIndex++]||new tr;if(s.clear(),!e[this.elementStart])return;const r=e[this.elementStart];let n=Ji(r.blendMode,r.texture._source);this.attributeSize*4>this.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",d=this._batchPool[this._batchPoolIndex++]||new er;const m=this._maxTextures;for(let p=this.elementStart;p<this.elementSize;++p){const _=e[p];e[p]=null;const v=_.texture._source,y=Ji(_.blendMode,v),b=n!==y;if(v._batchTick===we&&!b){_.textureId=v._textureBindLocation,u+=_.indexSize,_.packAttributes(o,a,_.location,_.textureId),_.packIndex(l,_.indexStart,_.location/this._vertexSize),_.batch=d;continue}v._batchTick=we,(s.count>=m||b)&&(this._finishBatch(d,h,u-h,s,n,t,c),c="renderBatch",h=u,n=y,s=this._textureBatchPool[this._textureBatchPoolIndex++]||new tr,s.clear(),d=this._batchPool[this._batchPoolIndex++]||new er,++we),_.textureId=v._textureBindLocation=s.count,s.ids[v.uid]=s.count,s.textures[s.count++]=v,_.batch=d,u+=_.indexSize,_.packAttributes(o,a,_.location,_.textureId),_.packIndex(l,_.indexStart,_.location/this._vertexSize)}s.count>0&&(this._finishBatch(d,h,u-h,s,n,t,c),h=u,++we),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,++we,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 Zi(e);Qi(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<e.length;n++)r[n]=e[n];else Qi(e.buffer,r.buffer);this.indexBuffer=r}destroy(){for(let t=0;t<this.batches.length;t++)this.batches[t].destroy();this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t].batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};mn.defaultOptions={vertexSize:4,indexSize:6};Il=mn;function El(i,t,e,s,r,n,o,a=null){let l=0;e*=t,r*=n;const u=a.a,h=a.b,c=a.c,d=a.d,m=a.tx,p=a.ty;for(;l<o;){const _=i[e],f=i[e+1];s[r]=u*_+c*f+m,s[r+1]=h*_+d*f+p,r+=n,e+=t,l++}}function Rl(i,t,e,s){let r=0;for(t*=e;r<s;)i[t]=0,i[t+1]=0,t+=e,r++}function gn(i,t,e,s,r){const n=t.a,o=t.b,a=t.c,l=t.d,u=t.tx,h=t.ty;e=e||0,s=s||2,r=r||i.length/s-e;let c=e*s;for(let d=0;d<r;d++){const m=i[c],p=i[c+1];i[c]=n*m+a*p+u,i[c+1]=o*m+l*p+h,c+=s}}function Dl(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;const e=i>>16&255,s=i>>8&255,r=i&255,n=t>>16&255,o=t>>8&255,a=t&255,l=e*n/255,u=s*o/255,h=r*a/255;return(l<<16)+(u<<8)+h}yn=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<this.indexSize;n++)t[e++]=r[n+this.indexOffset]+s-this.vertexOffset}packAttributes(t,e,s,r){const n=this.geometryData,o=this.renderable,a=n.vertices,l=n.uvs,u=this.vertexOffset*2,h=(this.vertexOffset+this.vertexSize)*2,c=this.color,d=c>>16|c&65280|(c&255)<<16;if(this.applyTransform){const m=Dl(d,o.groupColor)+(this.alpha*o.groupAlpha*255<<24),p=o.groupTransform,_=r<<16|this.roundPixels&65535,f=p.a,v=p.b,y=p.c,b=p.d,w=p.tx,A=p.ty;for(let R=u;R<h;R+=2){const E=a[R],C=a[R+1];t[s]=f*E+y*C+w,t[s+1]=v*E+b*C+A,t[s+2]=l[R],t[s+3]=l[R+1],e[s+4]=m,e[s+5]=_,s+=6}}else{const m=d+(this.alpha*255<<24);for(let p=u;p<h;p+=2)t[s]=a[p],t[s+1]=a[p+1],t[s+2]=l[p],t[s+3]=l[p+1],e[s+4]=m,e[s+5]=r<<16,s+=6}}get vertSize(){return this.vertexSize}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.vertexOffset=this.vertexOffset,t.vertexSize=this.vertexSize,t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData}reset(){this.applyTransform=!0}};const Le={extension:{type:Y.ShapeBuilder,name:"circle"},build(i,t){let e,s,r,n,o,a;if(i.type==="circle"){const w=i;e=w.x,s=w.y,o=a=w.radius,r=n=0}else if(i.type==="ellipse"){const w=i;e=w.x,s=w.y,o=w.halfWidth,a=w.halfHeight,r=n=0}else{const w=i,A=w.width/2,R=w.height/2;e=w.x+A,s=w.y+R,o=a=Math.max(0,Math.min(w.radius,Math.min(A,R))),r=A-o,n=R-a}if(!(o>=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,d=c,m=u,p=r+o,_=n,f=e+p,v=e-p,y=s+_;if(t[h++]=f,t[h++]=y,t[--c]=y,t[--c]=v,n){const w=s-_;t[d++]=v,t[d++]=w,t[--m]=w,t[--m]=f}for(let w=1;w<l;w++){const A=Math.PI/2*(w/l),R=r+Math.cos(A)*o,E=n+Math.sin(A)*a,C=e+R,k=e-R,P=s+E,D=s-E;t[h++]=C,t[h++]=P,t[--c]=P,t[--c]=k,t[d++]=k,t[d++]=D,t[--m]=D,t[--m]=C}p=r,_=n+a,f=e+p,v=e-p,y=s+_;const b=s-_;return t[h++]=f,t[h++]=y,t[--m]=b,t[--m]=f,r&&(t[h++]=v,t[h++]=y,t[--m]=b,t[--m]=v),t},triangulate(i,t,e,s,r,n){if(i.length===0)return;let o=0,a=0;for(let h=0;h<i.length;h+=2)o+=i[h],a+=i[h+1];o/=i.length/2,a/=i.length/2;let l=s;t[l*e]=o,t[l*e+1]=a;const u=l++;for(let h=0;h<i.length;h+=2)t[l*e]=i[h],t[l*e+1]=i[h+1],h>0&&(r[n++]=l,r[n++]=u,r[n++]=l-1),l++;r[n++]=u+1,r[n++]=u,r[n++]=l-1}},Bl={...Le,extension:{...Le.extension,name:"ellipse"}},Fl={...Le,extension:{...Le.extension,name:"roundedRectangle"}},$l=1e-4,sr=1e-4;function Vl(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];s<t;s+=2){const o=i[s],a=i[s+1];e+=(o-r)*(a+n),r=o,n=a}return e<0?-1:1}function ir(i,t,e,s,r,n,o,a){const l=i-e*r,u=t-s*r,h=i+e*n,c=t+s*n;let d,m;o?(d=s,m=-e):(d=-s,m=e);const p=l+d,_=u+m,f=h+d,v=c+m;return a.push(p,_),a.push(f,v),2}function Xt(i,t,e,s,r,n,o,a){const l=e-i,u=s-t;let h=Math.atan2(l,u),c=Math.atan2(r-i,n-t);a&&h<c?h+=Math.PI*2:!a&&h>c&&(c+=Math.PI*2);let d=h;const m=c-h,p=Math.abs(m),_=Math.sqrt(l*l+u*u),f=(15*p*Math.sqrt(_)/Math.PI>>0)+1,v=m/f;if(d+=v,a){o.push(i,t),o.push(e,s);for(let y=1,b=d;y<f;y++,b+=v)o.push(i,t),o.push(i+Math.sin(b)*_,t+Math.cos(b)*_);o.push(i,t),o.push(r,n)}else{o.push(e,s),o.push(i,t);for(let y=1,b=d;y<f;y++,b+=v)o.push(i+Math.sin(b)*_,t+Math.cos(b)*_),o.push(i,t);o.push(r,n),o.push(i,t)}return f*2}function Gl(i,t,e,s,r,n,o,a,l){const u=$l;if(i.length===0)return;const h=t;let c=h.alignment;if(t.alignment!==.5){let X=Vl(i);c=(c-.5)*X+.5}const d=new ut(i[0],i[1]),m=new ut(i[i.length-2],i[i.length-1]),p=s,_=Math.abs(d.x-m.x)<u&&Math.abs(d.y-m.y)<u;if(p){i=i.slice(),_&&(i.pop(),i.pop(),m.set(i[i.length-2],i[i.length-1]));const X=(d.x+m.x)*.5,$t=(m.y+d.y)*.5;i.unshift(X,$t),i.push(X,$t)}const f=r,v=i.length/2;let y=i.length;const b=f.length/2,w=h.width/2,A=w*w,R=h.miterLimit*h.miterLimit;let E=i[0],C=i[1],k=i[2],P=i[3],D=0,U=0,M=-(C-P),F=E-k,O=0,Q=0,wt=Math.sqrt(M*M+F*F);M/=wt,F/=wt,M*=w,F*=w;const gi=c,$=(1-gi)*2,N=gi*2;p||(h.cap==="round"?y+=Xt(E-M*($-N)*.5,C-F*($-N)*.5,E-M*$,C-F*$,E+M*N,C+F*N,f,!0)+2:h.cap==="square"&&(y+=ir(E,C,M,F,$,N,!0,f))),f.push(E-M*$,C-F*$),f.push(E+M*N,C+F*N);for(let X=1;X<v-1;++X){E=i[(X-1)*2],C=i[(X-1)*2+1],k=i[X*2],P=i[X*2+1],D=i[(X+1)*2],U=i[(X+1)*2+1],M=-(C-P),F=E-k,wt=Math.sqrt(M*M+F*F),M/=wt,F/=wt,M*=w,F*=w,O=-(P-U),Q=k-D,wt=Math.sqrt(O*O+Q*Q),O/=wt,Q/=wt,O*=w,Q*=w;const $t=k-E,_e=C-P,ge=k-D,ye=U-P,yi=$t*ge+_e*ye,He=_e*ge-ye*$t,xe=He<0;if(Math.abs(He)<.001*Math.abs(yi)){f.push(k-M*$,P-F*$),f.push(k+M*N,P+F*N),yi>=0&&(h.join==="round"?y+=Xt(k,P,k-M*$,P-F*$,k-O*$,P-Q*$,f,!1)+4:y+=2,f.push(k-O*N,P-Q*N),f.push(k+O*$,P+Q*$));continue}const xi=(-M+E)*(-F+P)-(-M+k)*(-F+C),bi=(-O+D)*(-Q+P)-(-O+k)*(-Q+U),Ye=($t*bi-ge*xi)/He,Xe=(ye*xi-_e*bi)/He,ms=(Ye-k)*(Ye-k)+(Xe-P)*(Xe-P),Ut=k+(Ye-k)*$,Ot=P+(Xe-P)*$,zt=k-(Ye-k)*N,Ht=P-(Xe-P)*N,Sn=Math.min($t*$t+_e*_e,ge*ge+ye*ye),vi=xe?$:N,Mn=Sn+vi*vi*A;ms<=Mn?h.join==="bevel"||ms/A>R?(xe?(f.push(Ut,Ot),f.push(k+M*N,P+F*N),f.push(Ut,Ot),f.push(k+O*N,P+Q*N)):(f.push(k-M*$,P-F*$),f.push(zt,Ht),f.push(k-O*$,P-Q*$),f.push(zt,Ht)),y+=2):h.join==="round"?xe?(f.push(Ut,Ot),f.push(k+M*N,P+F*N),y+=Xt(k,P,k+M*N,P+F*N,k+O*N,P+Q*N,f,!0)+4,f.push(Ut,Ot),f.push(k+O*N,P+Q*N)):(f.push(k-M*$,P-F*$),f.push(zt,Ht),y+=Xt(k,P,k-M*$,P-F*$,k-O*$,P-Q*$,f,!1)+4,f.push(k-O*$,P-Q*$),f.push(zt,Ht)):(f.push(Ut,Ot),f.push(zt,Ht)):(f.push(k-M*$,P-F*$),f.push(k+M*N,P+F*N),h.join==="round"?xe?y+=Xt(k,P,k+M*N,P+F*N,k+O*N,P+Q*N,f,!0)+2:y+=Xt(k,P,k-M*$,P-F*$,k-O*$,P-Q*$,f,!1)+2:h.join==="miter"&&ms/A<=R&&(xe?(f.push(zt,Ht),f.push(zt,Ht)):(f.push(Ut,Ot),f.push(Ut,Ot)),y+=2),f.push(k-O*$,P-Q*$),f.push(k+O*N,P+Q*N),y+=2)}E=i[(v-2)*2],C=i[(v-2)*2+1],k=i[(v-1)*2],P=i[(v-1)*2+1],M=-(C-P),F=E-k,wt=Math.sqrt(M*M+F*F),M/=wt,F/=wt,M*=w,F*=w,f.push(k-M*$,P-F*$),f.push(k+M*N,P+F*N),p||(h.cap==="round"?y+=Xt(k-M*($-N)*.5,P-F*($-N)*.5,k-M*$,P-F*$,k+M*N,P+F*N,f,!1)+2:h.cap==="square"&&(y+=ir(k,P,M,F,$,N,!1,f)));const An=sr*sr;for(let X=b;X<y+b-2;++X)E=f[X*2],C=f[X*2+1],k=f[(X+1)*2],P=f[(X+1)*2+1],D=f[(X+2)*2],U=f[(X+2)*2+1],!(Math.abs(E*(P-U)+k*(U-C)+D*(C-P))<An)&&a.push(X,X+1,X+2)}function xn(i,t,e,s,r,n,o){const a=tl(i,t,2);if(!a)return;for(let u=0;u<a.length;u+=3)n[o++]=a[u]+r,n[o++]=a[u+1]+r,n[o++]=a[u+2]+r;let l=r*s;for(let u=0;u<i.length;u+=2)e[l]=i[u],e[l+1]=i[u+1],l+=s}const Nl=[],Ll={extension:{type:Y.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,s,r,n){xn(i,Nl,t,e,s,r,n)}},Ul={extension:{type:Y.ShapeBuilder,name:"rectangle"},build(i,t){const e=i,s=e.x,r=e.y,n=e.width,o=e.height;return n>=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}},Ol={extension:{type:Y.ShapeBuilder,name:"triangle"},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}},ps={};Tt.handleByMap(Y.ShapeBuilder,ps);Tt.add(Ul,Ll,Ol,Le,Bl,Fl);const zl=new ot;function Hl(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<i.instructions.length;r++){const n=i.instructions[r];if(n.action==="texture")Yl(n.data,s,e);else if(n.action==="fill"||n.action==="stroke"){const o=n.action==="stroke",a=n.data.path.shapePath,l=n.data.style,u=n.data.hole;o&&u&&rr(u.shapePath,l,null,!0,s,e),rr(a,l,u,o,s,e)}}}function Yl(i,t,e){const{vertices:s,uvs:r,indices:n}=e,o=n.length,a=s.length/2,l=[],u=ps.rectangle,h=zl,c=i.image;h.x=i.dx,h.y=i.dy,h.width=i.dw,h.height=i.dh;const d=i.transform;u.build(h,l),d&&gn(l,d),u.triangulate(l,s,2,a,n,o);const m=c.uvs;r.push(m.x0,m.y0,m.x1,m.y1,m.x3,m.y3,m.x2,m.y2);const p=Mt.get(yn);p.indexOffset=o,p.indexSize=n.length-o,p.vertexOffset=a,p.vertexSize=s.length/2-a,p.color=i.style,p.alpha=i.alpha,p.texture=c,p.geometryData=e,t.push(p)}function rr(i,t,e,s,r,n){const{vertices:o,uvs:a,indices:l}=n,u=i.shapePrimitives.length-1;i.shapePrimitives.forEach(({shape:h,transform:c},d)=>{const m=l.length,p=o.length/2,_=[],f=ps[h.type];if(f.build(h,_),c&&gn(_,c),s){const w=h.closePath??!0;Gl(_,t,!1,w,o,2,p,l)}else if(e&&u===d){u!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");const w=[],A=_.slice();Xl(e.shapePath).forEach(E=>{w.push(A.length/2),A.push(...E)}),xn(A,w,o,2,p,l,m)}else f.triangulate(_,o,2,p,l,m);const v=a.length/2,y=t.texture;if(y!==W.WHITE){const w=t.matrix;w&&(c&&w.append(c.clone().invert()),El(o,2,p,a,v,2,o.length/2-p,w))}else Rl(a,v,2,o.length/2-p);const b=Mt.get(yn);b.indexOffset=m,b.indexSize=l.length-m,b.vertexOffset=p,b.vertexSize=o.length/2-p,b.color=t.color,b.alpha=t.alpha,b.texture=y,b.geometryData=n,r.push(b)})}function Xl(i){if(!i)return[];const t=i.shapePrimitives,e=[];for(let s=0;s<t.length;s++){const r=t[s].shape,n=[];ps[r.type].build(r,n),e.push(n)}return e}class Wl{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}}class ql{constructor(){this.geometry=new wl,this.instructions=new Gr}init(){this.instructions.reset()}}const mi=class ei{constructor(){this._activeBatchers=[],this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null)}init(t){ei.defaultOptions.bezierSmoothness=t?.bezierSmoothness??ei.defaultOptions.bezierSmoothness}prerender(){this._returnActiveBatchers()}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),Hl(t,e);const s=t.batchMode;t.customShader||s==="no-batch"?e.isBatchable=!1:s==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_returnActiveBatchers(){for(let t=0;t<this._activeBatchers.length;t++)Mt.return(this._activeBatchers[t]);this._activeBatchers.length=0}_initContextRenderData(t){const e=Mt.get(ql),{batches:s,geometryData:r}=this._gpuContextHash[t.uid],n=r.vertices.length,o=r.indices.length;for(let h=0;h<s.length;h++)s[h].applyTransform=!1;const a=Mt.get(Il);this._activeBatchers.push(a),a.ensureAttributeBuffer(n),a.ensureIndexBuffer(o),a.begin();for(let h=0;h<s.length;h++){const c=s[h];a.add(c)}a.finish(e.instructions);const l=e.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);const u=a.batches;for(let h=0;h<u.length;h++){const c=u[h];c.bindGroup=Ml(c.textures.textures,c.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){const e=new Wl;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){const e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(Mt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(s=>{Mt.return(s)})}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};mi.extension={type:[Y.WebGLSystem,Y.WebGPUSystem,Y.CanvasSystem],name:"graphicsContext"};mi.defaultOptions={bezierSmoothness:.5};bn=mi;const jl=8,rs=11920929e-14,Kl=1;function vn(i,t,e,s,r,n,o,a,l,u){const c=Math.min(.99,Math.max(0,u??bn.defaultOptions.bezierSmoothness));let d=(Kl-c)/1;return d*=d,Zl(t,e,s,r,n,o,a,l,i,d),i}function Zl(i,t,e,s,r,n,o,a,l,u){si(i,t,e,s,r,n,o,a,l,u,0),l.push(o,a)}function si(i,t,e,s,r,n,o,a,l,u,h){if(h>jl)return;const c=(i+e)/2,d=(t+s)/2,m=(e+r)/2,p=(s+n)/2,_=(r+o)/2,f=(n+a)/2,v=(c+m)/2,y=(d+p)/2,b=(m+_)/2,w=(p+f)/2,A=(v+b)/2,R=(y+w)/2;if(h>0){let E=o-i,C=a-t;const k=Math.abs((e-o)*C-(s-a)*E),P=Math.abs((r-o)*C-(n-a)*E);if(k>rs&&P>rs){if((k+P)*(k+P)<=u*(E*E+C*C)){l.push(A,R);return}}else if(k>rs){if(k*k<=u*(E*E+C*C)){l.push(A,R);return}}else if(P>rs){if(P*P<=u*(E*E+C*C)){l.push(A,R);return}}else if(E=A-(i+o)/2,C=R-(t+a)/2,E*E+C*C<=u){l.push(A,R);return}}si(i,t,c,d,v,y,A,R,l,u,h+1),si(A,R,b,w,_,f,o,a,l,u,h+1)}const Ql=8,Jl=11920929e-14,th=1;function eh(i,t,e,s,r,n,o,a){const u=Math.min(.99,Math.max(0,a??bn.defaultOptions.bezierSmoothness));let h=(th-u)/1;return h*=h,sh(t,e,s,r,n,o,i,h),i}function sh(i,t,e,s,r,n,o,a){ii(o,i,t,e,s,r,n,a,0),o.push(r,n)}function ii(i,t,e,s,r,n,o,a,l){if(l>Ql)return;const u=(t+s)/2,h=(e+r)/2,c=(s+n)/2,d=(r+o)/2,m=(u+c)/2,p=(h+d)/2;let _=n-t,f=o-e;const v=Math.abs((s-n)*f-(r-o)*_);if(v>Jl){if(v*v<=a*(_*_+f*f)){i.push(m,p);return}}else if(_=m-(t+n)/2,f=p-(e+o)/2,_*_+f*f<=a){i.push(m,p);return}ii(i,t,e,u,h,m,p,a,l+1),ii(i,m,p,c,d,n,o,a,l+1)}function wn(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;c<a+1;c++){const d=Math.cos(h),m=Math.sin(h),p=t+d*s,_=e+m*s;i.push(p,_),h+=u}}function ih(i,t,e,s,r,n){const o=i[i.length-2],l=i[i.length-1]-e,u=o-t,h=r-e,c=s-t,d=Math.abs(l*c-u*h);if(d<1e-8||n===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}const m=l*l+u*u,p=h*h+c*c,_=l*h+u*c,f=n*Math.sqrt(m)/d,v=n*Math.sqrt(p)/d,y=f*_/m,b=v*_/p,w=f*c+v*u,A=f*h+v*l,R=u*(v+y),E=l*(v+y),C=c*(f+b),k=h*(f+b),P=Math.atan2(E-A,R-w),D=Math.atan2(k-A,C-w);wn(i,w+t,A+e,n,P,D,u*h>c*l)}const Ie=Math.PI*2,Rs={centerX:0,centerY:0,ang1:0,ang2:0},Ds=({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 rh(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 nr=(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)},nh=(i,t,e,s,r,n,o,a,l,u,h,c,d)=>{const m=Math.pow(r,2),p=Math.pow(n,2),_=Math.pow(h,2),f=Math.pow(c,2);let v=m*p-m*f-p*_;v<0&&(v=0),v/=m*f+p*_,v=Math.sqrt(v)*(o===a?-1:1);const y=v*r/n*c,b=v*-n/r*h,w=u*y-l*b+(i+e)/2,A=l*y+u*b+(t+s)/2,R=(h-y)/r,E=(c-b)/n,C=(-h-y)/r,k=(-c-b)/n,P=nr(1,0,R,E);let D=nr(R,E,C,k);a===0&&D>0&&(D-=Ie),a===1&&D<0&&(D+=Ie),d.centerX=w,d.centerY=A,d.ang1=P,d.ang2=D};function oh(i,t,e,s,r,n,o,a=0,l=0,u=0){if(n===0||o===0)return;const h=Math.sin(a*Ie/360),c=Math.cos(a*Ie/360),d=c*(t-s)/2+h*(e-r)/2,m=-h*(t-s)/2+c*(e-r)/2;if(d===0&&m===0)return;n=Math.abs(n),o=Math.abs(o);const p=Math.pow(d,2)/Math.pow(n,2)+Math.pow(m,2)/Math.pow(o,2);p>1&&(n*=Math.sqrt(p),o*=Math.sqrt(p)),nh(t,e,s,r,n,o,l,u,h,c,d,m,Rs);let{ang1:_,ang2:f}=Rs;const{centerX:v,centerY:y}=Rs;let b=Math.abs(f)/(Ie/4);Math.abs(1-b)<1e-7&&(b=1);const w=Math.max(Math.ceil(b),1);f/=w;let A=i[i.length-2],R=i[i.length-1];const E={x:0,y:0};for(let C=0;C<w;C++){const k=rh(_,f),{x:P,y:D}=Ds(k[0],n,o,c,h,v,y,E),{x:U,y:M}=Ds(k[1],n,o,c,h,v,y,E),{x:F,y:O}=Ds(k[2],n,o,c,h,v,y,E);vn(i,A,R,P,D,U,M,F,O),A=F,R=O,_+=f}}function ah(i,t,e){const s=(o,a)=>{const l=a.x-o.x,u=a.y-o.y,h=Math.sqrt(l*l+u*u),c=l/h,d=u/h;return{len:h,nx:c,ny:d}},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;o<t.length;o++){const a=t[o%t.length],l=a.radius??e;if(l<=0){r(o,a),n=a;continue}const u=t[(o+1)%t.length],h=s(a,n),c=s(a,u);if(h.len<1e-4||c.len<1e-4){r(o,a),n=a;continue}let d=Math.asin(h.nx*c.ny-h.ny*c.nx),m=1,p=!1;h.nx*c.nx-h.ny*-c.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,m=-1,p=!0):d>0&&(m=-1,p=!0);const _=d/2;let f,v=Math.abs(Math.cos(_)*l/Math.sin(_));v>Math.min(h.len/2,c.len/2)?(v=Math.min(h.len/2,c.len/2),f=Math.abs(v*Math.sin(_)/Math.cos(_))):f=l;const y=a.x+c.nx*v+-c.ny*f*m,b=a.y+c.ny*v+c.nx*f*m,w=Math.atan2(h.ny,h.nx)+Math.PI/2*m,A=Math.atan2(c.ny,c.nx)-Math.PI/2*m;o===0&&i.moveTo(y+Math.cos(w)*f,b+Math.sin(w)*f),i.arc(y,b,f,w,A,p),n=a}}function lh(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<o;a++){const l=t[(a+1)%o],u=l.radius??e;if(u<=0){a===0?i.moveTo(l.x,l.y):i.lineTo(l.x,l.y);continue}const h=t[a],c=t[(a+2)%o],d=r(h,l);let m;if(d<1e-4)m=l;else{const f=Math.min(d/2,u);m=n(l,h,f/d)}const p=r(c,l);let _;if(p<1e-4)_=l;else{const f=Math.min(p/2,u);_=n(l,c,f/p)}a===0?i.moveTo(m.x,m.y):i.lineTo(m.x,m.y),i.quadraticCurveTo(l.x,l.y,_.x,_.y,s)}}const hh=new ot;class uh{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Dt,this._graphicsPath2D=t}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const s=this._currentPoly.points,r=s[s.length-2],n=s[s.length-1];return(r!==t||n!==e)&&s.push(t,e),this}arc(t,e,s,r,n,o){this._ensurePoly(!1);const a=this._currentPoly.points;return wn(a,t,e,s,r,n,o),this}arcTo(t,e,s,r,n){this._ensurePoly();const o=this._currentPoly.points;return ih(o,t,e,s,r,n),this}arcToSvg(t,e,s,r,n,o,a){const l=this._currentPoly.points;return oh(l,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,o,a){this._ensurePoly();const l=this._currentPoly;return vn(this._currentPoly.points,l.lastX,l.lastY,t,e,s,r,n,o,a),this}quadraticCurveTo(t,e,s,r,n){this._ensurePoly();const o=this._currentPoly;return eh(this._currentPoly.points,o.lastX,o.lastY,t,e,s,r,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));for(let s=0;s<t.instructions.length;s++){const r=t.instructions[s];this[r.action](...r.data)}return this}finish(t=!1){this.endPoly(t)}rect(t,e,s,r,n){return this.drawShape(new ot(t,e,s,r),n),this}circle(t,e,s,r){return this.drawShape(new di(t,e,s),r),this}poly(t,e,s){const r=new Te(t);return r.closePath=e,this.drawShape(r,s),this}regularPoly(t,e,s,r,n=0,o){r=Math.max(r|0,3);const a=-1*Math.PI/2+n,l=Math.PI*2/r,u=[];for(let h=0;h<r;h++){const c=h*l+a;u.push(t+s*Math.cos(c),e+s*Math.sin(c))}return this.poly(u,!0,o),this}roundPoly(t,e,s,r,n,o=0,a){if(r=Math.max(r|0,3),n<=0)return this.regularPoly(t,e,s,r,o);const l=s*Math.sin(Math.PI/r)-.001;n=Math.min(n,l);const u=-1*Math.PI/2+o,h=Math.PI*2/r,c=(r-2)*Math.PI/r/2;for(let d=0;d<r;d++){const m=d*h+u,p=t+s*Math.cos(m),_=e+s*Math.sin(m),f=m+Math.PI+c,v=m-Math.PI-c,y=p+n*Math.cos(f),b=_+n*Math.sin(f),w=p+n*Math.cos(v),A=_+n*Math.sin(v);d===0?this.moveTo(y,b):this.lineTo(y,b),this.quadraticCurveTo(p,_,w,A,a)}return this.closePath()}roundShape(t,e,s=!1,r){return t.length<3?this:(s?lh(this,t,e,r):ah(this,t,e),this.closePath())}filletRect(t,e,s,r,n){if(n===0)return this.rect(t,e,s,r);const o=Math.min(s,r)/2,a=Math.min(o,Math.max(-o,n)),l=t+s,u=e+r,h=a<0?-a:0,c=Math.abs(a);return this.moveTo(t,e+c).arcTo(t+h,e+h,t+c,e,c).lineTo(l-c,e).arcTo(l-h,e+h,l,e+c,c).lineTo(l,u-c).arcTo(l-h,u-h,t+s-c,u,c).lineTo(t+c,u).arcTo(t+h,u-h,t,u-c,c).closePath()}chamferRect(t,e,s,r,n,o){if(n<=0)return this.rect(t,e,s,r);const a=Math.min(n,Math.min(s,r)/2),l=t+s,u=e+r,h=[t+a,e,l-a,e,l,e+a,l,u-a,l-a,u,t+a,u,t,u-a,t,e+a];for(let c=h.length-1;c>=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 fi(t,e,s,r),n),this}roundRect(t,e,s,r,n,o){return this.drawShape(new pi(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 Te,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 Te,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;e<t.instructions.length;e++){const s=t.instructions[e];this[s.action](...s.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let s=0;s<e.length;s++){const r=e[s],n=r.shape.getBounds(hh);r.transform?t.addRect(n,r.transform):t.addRect(n)}return t}}class pe{constructor(t){this.instructions=[],this.uid=at("graphicsPath"),this._dirty=!0,typeof t=="string"?ml(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new uh(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,s,r,n){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(ut.shared);let l=0,u=0;if(!o||o.action!=="bezierCurveTo")l=a.x,u=a.y;else{l=o.data[2],u=o.data[3];const h=a.x,c=a.y;l=h+(h-l),u=c+(c-u)}return this.instructions.push({action:"bezierCurveTo",data:[l,u,t,e,s,r,n]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,s){const r=this.instructions[this.instructions.length-1],n=this.getLastPoint(ut.shared);let o=0,a=0;if(!r||r.action!=="quadraticCurveTo")o=n.x,a=n.y;else{o=r.data[0],a=r.data[1];const l=n.x,u=n.y;o=l+(l-o),a=u+(u-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,s]}),this._dirty=!0,this}rect(t,e,s,r,n){return this.instructions.push({action:"rect",data:[t,e,s,r,n]}),this._dirty=!0,this}circle(t,e,s,r){return this.instructions.push({action:"circle",data:[t,e,s,r]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,s,r,n,o,a){n=n||r/2;const l=-1*Math.PI/2+o,u=s*2,h=Math.PI*2/u,c=[];for(let d=0;d<u;d++){const m=d%2?n:r,p=d*h+l;c.push(t+m*Math.cos(p),e+m*Math.sin(p))}return this.poly(c,!0,a),this}clone(t=!1){const e=new pe;if(!t)e.instructions=this.instructions.slice();else for(let s=0;s<this.instructions.length;s++){const r=this.instructions[s];e.instructions.push({action:r.action,data:r.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,s=t.b,r=t.c,n=t.d,o=t.tx,a=t.ty;let l=0,u=0,h=0,c=0,d=0,m=0,p=0,_=0;for(let f=0;f<this.instructions.length;f++){const v=this.instructions[f],y=v.data;switch(v.action){case"moveTo":case"lineTo":l=y[0],u=y[1],y[0]=e*l+r*u+o,y[1]=s*l+n*u+a;break;case"bezierCurveTo":h=y[0],c=y[1],d=y[2],m=y[3],l=y[4],u=y[5],y[0]=e*h+r*c+o,y[1]=s*h+n*c+a,y[2]=e*d+r*m+o,y[3]=s*d+n*m+a,y[4]=e*l+r*u+o,y[5]=s*l+n*u+a;break;case"quadraticCurveTo":h=y[0],c=y[1],l=y[2],u=y[3],y[0]=e*h+r*c+o,y[1]=s*h+n*c+a,y[2]=e*l+r*u+o,y[3]=s*l+n*u+a;break;case"arcToSvg":l=y[5],u=y[6],p=y[0],_=y[1],y[0]=e*p+r*_,y[1]=s*p+n*_,y[5]=e*l+r*u+o,y[6]=s*l+n*u+a;break;case"circle":y[4]=Ce(y[3],t);break;case"rect":y[4]=Ce(y[4],t);break;case"ellipse":y[8]=Ce(y[8],t);break;case"roundRect":y[5]=Ce(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=Ce(y[2],t);break;default:Rt("unknown transform action",v.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,s=this.instructions[e];if(!s)return t.x=0,t.y=0,t;for(;s.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;s=this.instructions[e]}switch(s.action){case"moveTo":case"lineTo":t.x=s.data[0],t.y=s.data[1];break;case"quadraticCurveTo":t.x=s.data[2],t.y=s.data[3];break;case"bezierCurveTo":t.x=s.data[4],t.y=s.data[5];break;case"arc":case"arcToSvg":t.x=s.data[5],t.y=s.data[6];break;case"addPath":s.data[0].getLastPoint(t);break}return t}}function Ce(i,t){return i?i.prepend(t):t.clone()}function ch(i,t){if(typeof i=="string"){const s=document.createElement("div");s.innerHTML=i.trim(),i=s.querySelector("svg")}const e={context:t,path:new pe};return Cn(i,e,null,null),t}function Cn(i,t,e,s){const r=i.children,{fillStyle:n,strokeStyle:o}=dh(i);n&&e?e={...e,...n}:n&&(e=n),o&&s?s={...s,...o}:o&&(s=o),t.context.fillStyle=e,t.context.strokeStyle=s;let a,l,u,h,c,d,m,p,_,f,v,y,b,w,A,R,E;switch(i.nodeName.toLowerCase()){case"path":w=i.getAttribute("d"),A=new pe(w),t.context.path(A),e&&t.context.fill(),s&&t.context.stroke();break;case"circle":m=it(i,"cx",0),p=it(i,"cy",0),_=it(i,"r",0),t.context.ellipse(m,p,_,_),e&&t.context.fill(),s&&t.context.stroke();break;case"rect":a=it(i,"x",0),l=it(i,"y",0),R=it(i,"width",0),E=it(i,"height",0),f=it(i,"rx",0),v=it(i,"ry",0),f||v?t.context.roundRect(a,l,R,E,f||v):t.context.rect(a,l,R,E),e&&t.context.fill(),s&&t.context.stroke();break;case"ellipse":m=it(i,"cx",0),p=it(i,"cy",0),f=it(i,"rx",0),v=it(i,"ry",0),t.context.beginPath(),t.context.ellipse(m,p,f,v),e&&t.context.fill(),s&&t.context.stroke();break;case"line":u=it(i,"x1",0),h=it(i,"y1",0),c=it(i,"x2",0),d=it(i,"y2",0),t.context.beginPath(),t.context.moveTo(u,h),t.context.lineTo(c,d),s&&t.context.stroke();break;case"polygon":b=i.getAttribute("points"),y=b.match(/\d+/g).map(C=>parseInt(C,10)),t.context.poly(y,!0),e&&t.context.fill(),s&&t.context.stroke();break;case"polyline":b=i.getAttribute("points"),y=b.match(/\d+/g).map(C=>parseInt(C,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 C=0;C<r.length;C++)Cn(r[C],t,e,s)}function it(i,t,e){const s=i.getAttribute(t);return s?Number(s):e}function dh(i){const t=i.getAttribute("style"),e={},s={};let r=!1,n=!1;if(t){const o=t.split(";");for(let a=0;a<o.length;a++){const l=o[a],[u,h]=l.split(":");switch(u){case"stroke":h!=="none"&&(e.color=xt.shared.setValue(h).toNumber(),n=!0);break;case"stroke-width":e.width=Number(h);break;case"fill":h!=="none"&&(r=!0,s.color=xt.shared.setValue(h).toNumber());break;case"fill-opacity":s.alpha=Number(h);break;case"stroke-opacity":e.alpha=Number(h);break;case"opacity":s.alpha=Number(h),e.alpha=Number(h);break}}}else{const o=i.getAttribute("stroke");o&&o!=="none"&&(n=!0,e.color=xt.shared.setValue(o).toNumber(),e.width=it(i,"stroke-width",1));const a=i.getAttribute("fill");a&&a!=="none"&&(r=!0,s.color=xt.shared.setValue(a).toNumber())}return{strokeStyle:n?e:null,fillStyle:r?s:null}}function fh(i){return xt.isColorLike(i)}function or(i){return i instanceof ll}function ar(i){return i instanceof al}function ph(i,t,e){const s=xt.shared.setValue(t??0);return i.color=s.toNumber(),i.alpha=s.alpha===1?e.alpha:s.alpha,i.texture=W.WHITE,{...e,...i}}function lr(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function hr(i,t,e){return t.buildLinearGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function mh(i,t){const e={...t,...i};if(e.texture){if(e.texture!==W.WHITE){const n=e.matrix?.invert()||new H;n.scale(1/e.texture.frame.width,1/e.texture.frame.height),e.matrix=n}const r=e.texture.source.style;r.addressMode==="clamp-to-edge"&&(r.addressMode="repeat",r.update())}const s=xt.shared.setValue(e.color);return e.alpha*=s.alpha,e.color=s.toNumber(),e.matrix=e.matrix?e.matrix.clone():null,e}ke=function(i,t){if(i==null)return null;const e={},s=i;return fh(i)?ph(e,i,t):or(i)?lr(e,i,t):ar(i)?hr(e,i,t):s.fill&&or(s.fill)?lr(s,s.fill,t):s.fill&&ar(s.fill)?hr(s,s.fill,t):mh(s,t)};ur=function(i,t){const{width:e,alignment:s,miterLimit:r,cap:n,join:o,...a}=t,l=ke(i,a);return l?{width:e,alignment:s,miterLimit:r,cap:n,join:o,...l}:null};const _h=new ut,cr=new H,_i=class Pt extends Lt{constructor(){super(...arguments),this.uid=at("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new pe,this._transform=new H,this._fillStyle={...Pt.defaultFillStyle},this._strokeStyle={...Pt.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Dt,this._boundsDirty=!0}clone(){const t=new Pt;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=ke(t,Pt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=ur(t,Pt.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=ke(t,Pt.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=ke(t,Pt.defaultStrokeStyle),this}texture(t,e,s,r,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:s||0,dy:r||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?xt.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new pe,this}fill(t,e){let s;const r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="stroke"?s=r.data.path:s=this._activePath.clone(),s?(t!=null&&(e!==void 0&&typeof t=="number"&&(et(tt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=ke(t,Pt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:s}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(ut.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="fill"?e=s.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=ur(t,Pt.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],s=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(s);else{e.data.hole=s;break}}return this._initNextPathLocation(),this}arc(t,e,s,r,n,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,s,r,n,o),this}arcTo(t,e,s,r,n){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*s+o.c*r+o.tx,o.b*s+o.d*r+o.ty,n),this}arcToSvg(t,e,s,r,n,o,a){this._tick++;const l=this._transform;return this._activePath.arcToSvg(t,e,s,r,n,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(t,e,s,r,n,o,a){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*s+l.c*r+l.tx,l.b*s+l.d*r+l.ty,l.a*n+l.c*o+l.tx,l.b*n+l.d*o+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,s,r){return this._tick++,this._activePath.ellipse(t,e,s,r,this._transform.clone()),this}circle(t,e,s){return this._tick++,this._activePath.circle(t,e,s,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const s=this._transform;return this._activePath.lineTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty),this}moveTo(t,e){this._tick++;const s=this._transform,r=this._activePath.instructions,n=s.a*t+s.c*e+s.tx,o=s.b*t+s.d*e+s.ty;return r.length===1&&r[0].action==="moveTo"?(r[0].data[0]=n,r[0].data[1]=o,this):(this._activePath.moveTo(n,o),this)}quadraticCurveTo(t,e,s,r,n){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*s+o.c*r+o.tx,o.b*s+o.d*r+o.ty,n),this}rect(t,e,s,r){return this._tick++,this._activePath.rect(t,e,s,r,this._transform.clone()),this}roundRect(t,e,s,r,n){return this._tick++,this._activePath.roundRect(t,e,s,r,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,s,r,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,s,r,n,o),this}roundPoly(t,e,s,r,n,o){return this._tick++,this._activePath.roundPoly(t,e,s,r,n,o),this}roundShape(t,e,s,r){return this._tick++,this._activePath.roundShape(t,e,s,r),this}filletRect(t,e,s,r,n){return this._tick++,this._activePath.filletRect(t,e,s,r,n),this}chamferRect(t,e,s,r,n,o){return this._tick++,this._activePath.chamferRect(t,e,s,r,n,o),this}star(t,e,s,r,n=0,o=0){return this._tick++,this._activePath.star(t,e,s,r,n,o,this._transform.clone()),this}svg(t){return this._tick++,ch(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,s,r,n,o){return t instanceof H?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,s,r,n,o),this)}transform(t,e,s,r,n,o){return t instanceof H?(this._transform.append(t),this):(cr.set(t,e,s,r,n,o),this._transform.append(cr),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const s=this.instructions[e],r=s.action;if(r==="fill"){const n=s.data;t.addBounds(n.path.bounds)}else if(r==="texture"){const n=s.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(r==="stroke"){const n=s.data,o=n.style.width/2,a=n.path.bounds;t.addFrame(a.minX-o,a.minY-o,a.maxX+o,a.maxY+o)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let s=!1;for(let r=0;r<e.length;r++){const n=e[r],o=n.data,a=o.path;if(!n.action||!a)continue;const l=o.style,u=a.shapePath.shapePrimitives;for(let h=0;h<u.length;h++){const c=u[h].shape;if(!l||!c)continue;const d=u[h].transform,m=d?d.applyInverse(t,_h):t;n.action==="fill"?s=c.contains(m.x,m.y):s=c.strokeContains(m.x,m.y,l.width);const p=o.hole;if(p){const _=p.shapePath?.shapePrimitives;if(_)for(let f=0;f<_.length;f++)_[f].shape.contains(m.x,m.y)&&(s=!1)}if(s)return!0}}return s}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){const s=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(s),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(s)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};_i.defaultFillStyle={color:16777215,alpha:1,texture:W.WHITE,matrix:null,fill:null};_i.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:W.WHITE,matrix:null,fill:null};Ae=_i;ls=class extends pt{constructor(t){t instanceof Ae&&(t={context:t});const{context:e,roundPixels:s,...r}=t||{};super({label:"Graphics",...r}),this.canBundle=!0,this.renderPipeId="graphics",this._roundPixels=0,e?this._context=e:this._context=this._ownedContext=new Ae,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=s??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}onViewUpdate(){if(this._didChangeId+=4096,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new ls(this._context.clone()):(this._ownedContext=null,new ls(this._context))}lineStyle(t,e,s){et(tt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const r={};return t&&(r.width=t),e&&(r.color=e),s&&(r.alpha=s),this.context.strokeStyle=r,this}beginFill(t,e){et(tt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const s={};return t&&(s.color=t),e&&(s.alpha=e),this.context.fillStyle=s,this}endFill(){et(tt,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return(t.width!==Ae.defaultStrokeStyle.width||t.color!==Ae.defaultStrokeStyle.color||t.alpha!==Ae.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return et(tt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return et(tt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return et(tt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return et(tt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return et(tt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return et(tt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}};Tt.add(Fo,$o);let gh,yh,xh,bh,vh,wh,Ch,Ah,Sh,Mh,kh,Ph,Th,Ih,Eh,Rh,Dh,Bh,Fh,$h,Vh,Gh,Nh,Lh,Uh,Oh,zh,Hh,Yh,Xh,Wh,qh,jh,Kh,Zh,Qh,Jh,tu,eu,su,iu,ru,nu;gh=ct({__name:"PieceCanvas",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,e=uo(),{cachedFiles:s}=dt(Ue()),r=Oe(),{fileContentInterval:n}=dt(ee()),o=ht(),a=ht(!1),l=Mi(),u=Mi();async function h(){if(a.value||!o.value||!l.value)return;a.value=!0;const p=await r.fetchPieceState(t.torrent.hash),_=new ai;s.value.filter(b=>b.priority!==At.DO_NOT_DOWNLOAD).forEach(b=>_.insert(b.piece_range,b.name));const f=new ls;let v="",y=1;for(let b=0;b<p.length;++b){const w=p[b];let A="";if(w===_s.DOWNLOADING?A=e.current.value.colors["torrent-downloading"]:w===_s.DOWNLOADED?A=e.current.value.colors["torrent-ul_paused"]:w===_s.MISSING&&_.intersect_any([b,b])&&(A=e.current.value.colors["torrent-dl_paused"]),A===v){++y;continue}v!==""&&(f.rect((b-y)/p.length*o.value.width,0,y/p.length*o.value.width,o.value.height),f.fill(v)),y=1,v=A}v!==""&&(f.rect((p.length-y)/p.length*o.value.width,0,y/p.length*o.value.width,o.value.height),f.fill(v)),l.value.stage.addChild(f),u.value&&u.value.destroy(),u.value=f,a.value=!1}function c(){h().catch(()=>{})}const{pause:d,resume:m}=pr(c,n,{immediate:!1,immediateCallback:!0});return ze(()=>t.isActive,p=>{p?m():d()}),us(()=>{if(!o.value)return;const p=new un;p.init({antialias:!0,width:o.value?.width,height:o.value?.height,canvas:o.value}).then(()=>l.value=p).then(()=>t.isActive&&m())}),ni(()=>{l.value?.destroy({removeView:!1},{children:!0})}),(p,_)=>(I(),G("canvas",{ref_key:"canvas",ref:o,width:"4096",height:"20"},null,512))}});yh=hs(gh,[["__scopeId","data-v-2bc530c7"]]);xh=["href"];bh={key:1};vh={class:"my-1"};wh={class:"mr-2"};Ch={key:0};Ah={key:2};Sh={key:0};Mh={key:1};kh={key:2};Ph={key:0};Th={key:0,class:"d-flex flex-wrap flex-gap-row-small flex-gap-column"};Ih=ct({__name:"Overview",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,{t:e}=me(),{cachedFiles:s}=dt(Ue()),r=mr(),{properties:n}=dt(Bt()),o=ee(),a=j(()=>s.value.filter(C=>C.priority!==At.DO_NOT_DOWNLOAD)),l=j(()=>s.value.length),u=j(()=>a.value.length===1?a.value[0].name:""),h=j(()=>n.value?.comment??""),c=j(()=>n.value?.dl_speed_avg??0),d=j(()=>n.value?.piece_size??0),m=j(()=>n.value?.pieces_have??0),p=j(()=>n.value?.pieces_num??0),_=j(()=>n.value?.up_speed_avg??0),f=j(()=>$n(t.torrent.state)),v=j(()=>`${parseInt(Vn(d.value,!0))} ${Gn(d.value,!0)}`),y=j(()=>[wi.META_DOWNLOAD,wi.FORCED_META_DOWNLOAD].includes(t.torrent.state)),b=j(()=>o.enableRatioColors?Nn(t.torrent.ratio):"");async function w(){try{await navigator.clipboard.writeText(t.torrent.hash)}catch{ki.error(e("toast.copy.error"));return}ki.success(e("toast.copy.success"))}function A(C){r.createDialog(kn,{hashes:[t.torrent.hash],mode:C})}function R(){r.createDialog(co,{hash:t.torrent.hash,isFolder:!1,oldName:u.value})}function E(C){if(r.hasActiveDialog||!t.isActive)return!1;if(C.key==="d")return C.preventDefault(),A("dl"),!0;if(C.key==="s")return C.preventDefault(),A("save"),!0;if(C.key==="f"&&a.value.length===1)return C.preventDefault(),R(),!0;if(C.key==="Delete")return C.preventDefault(),r.createDialog(Hn,{hashes:[t.torrent.hash]}),!0}return us(()=>{document.addEventListener("keydown",E)}),br(async()=>{document.removeEventListener("keydown",E)}),(C,k)=>C.torrent?(I(),V(Qt,{key:0},{default:x(()=>[g(Fs,{class:"text-wrap"},{default:x(()=>[L(T(C.torrent.name),1)]),_:1}),g(On,null,{default:x(()=>[B("div",null,[(I(!0),G(ft,null,bt(S(Un)(h.value),P=>(I(),G("span",null,[S(Ln)(P)?(I(),G("a",{key:0,target:"_blank",href:P},T(P),9,xh)):(I(),G("span",bh,T(P),1))]))),256))]),B("div",vh,[B("span",wh,T(C.torrent.hash),1),g(st,{variant:"outlined",rounded:"",onClick:w},{default:x(()=>[L(T(C.$t("torrentDetail.overview.copy_hash")),1)]),_:1})])]),_:1}),g(Re,null,{default:x(()=>[g(J,null,{default:x(()=>[g(q,{cols:"12",md:"6"},{default:x(()=>[g(J,null,{default:x(()=>[g(q,{cols:"4"},{default:x(()=>[g(zn,{color:f.value,indeterminate:y.value,size:100,"model-value":C.torrent?.progress*100||0,width:15},{default:x(()=>[y.value?(I(),G("span",Ch,T(C.$t("torrentDetail.overview.fetchingMetadata")),1)):C.torrent.progress===1?(I(),V(lt,{key:1,icon:"mdi-check",size:"x-large"})):(I(),G("span",Ah,T(S($s)(C.torrent.progress)),1))]),_:1},8,["color","indeterminate","model-value"])]),_:1}),g(q,{cols:"8",class:"d-flex flex-column align-center justify-center"},{default:x(()=>[y.value?(I(),G("div",Sh,[B("span",null,T(C.$t("torrentDetail.overview.waitingForMetadata")),1)])):(I(),G("div",Mh,[g(yh,{torrent:C.torrent,isActive:C.isActive},null,8,["torrent","isActive"])])),p.value>0?(I(),G("div",kh,[B("span",null,T(S(e)("torrentDetail.overview.pieceCount",{owned:m.value,total:p.value,pieceSize:v.value})),1)])):_t("",!0),B("div",null,[g(lt,{icon:"mdi-arrow-down"}),L(" "+T(S(Zt)(C.torrent.dlspeed,S(o).useBitSpeed))+" ",1),g(lt,{icon:"mdi-arrow-up"}),L(" "+T(S(Zt)(C.torrent.upspeed,S(o).useBitSpeed)),1)])]),_:1})]),_:1}),g(J,null,{default:x(()=>[g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrent.properties.download_path"))+":",1),B("div",null,T(C.torrent.download_path),1),g(st,{icon:"mdi-pencil",color:"accent",size:"x-small",onClick:k[0]||(k[0]=P=>A("dl"))})]),_:1}),g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrentDetail.overview.fileCount"))+":",1),B("div",null,T(a.value.length)+" / "+T(l.value),1),a.value.length===1?(I(),G("div",Ph,T(u.value),1)):_t("",!0),a.value.length===1?(I(),V(st,{key:1,icon:"mdi-pencil",color:"accent",size:"x-small",onClick:R})):_t("",!0)]),_:1})]),_:1}),g(J,null,{default:x(()=>[g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrent.properties.save_path"))+":",1),B("div",null,T(C.torrent.savePath),1),g(st,{icon:"mdi-pencil",color:"accent",size:"x-small",onClick:k[1]||(k[1]=P=>A("save"))})]),_:1}),g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrent.properties.content_path"))+":",1),B("div",null,T(C.torrent.content_path),1)]),_:1})]),_:1})]),_:1}),g(q,{cols:"12",md:"6"},{default:x(()=>[g(J,null,{default:x(()=>[g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrent.properties.state"))+":",1),g(ae,{disabled:!0,"default-color":f.value,value:C.$t(`torrent.state.${S(fr)(C.torrent.state)}`)},null,8,["default-color","value"])]),_:1}),g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrent.properties.category"))+":",1),g(ae,{"default-color":"category",disabled:!C.torrent.category.length,"disabled-value":C.$t("navbar.side.filters.uncategorized"),value:C.torrent.category},null,8,["disabled","disabled-value","value"])]),_:1})]),_:1}),g(J,null,{default:x(()=>[g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrent.properties.tracker"))+":",1),g(ae,{disabled:!C.torrent.trackerDomain.length,"default-color":"tracker","disabled-value":C.$t("navbar.side.filters.untracked"),value:C.torrent.trackerDomain},null,8,["disabled","disabled-value","value"])]),_:1}),g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrent.properties.tags"))+":",1),C.torrent.tags.length?(I(),G("div",Th,[(I(!0),G(ft,null,bt(C.torrent.tags,P=>(I(),V(ae,{"default-color":"tag",value:P},null,8,["value"]))),256))])):(I(),V(ae,{key:1,disabled:!0,"default-color":"tag",value:C.$t("navbar.side.filters.untagged")},null,8,["value"]))]),_:1})]),_:1}),g(J,null,{default:x(()=>[g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrentDetail.overview.selectedFileSize"))+":",1),B("div",null,T(S(Gt)(C.torrent.size,S(o).useBinarySize))+" / "+T(S(Gt)(C.torrent.total_size,S(o).useBinarySize)),1)]),_:1}),g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrentDetail.overview.ratio"))+":",1),B("div",{class:De(b.value)},T(C.torrent.ratio),3)]),_:1})]),_:1}),g(J,null,{default:x(()=>[g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrentDetail.overview.downloaded"))+":",1),B("div",null,T(S(Gt)(C.torrent.downloaded,S(o).useBinarySize)),1)]),_:1}),g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrentDetail.overview.uploaded"))+":",1),B("div",null,T(S(Gt)(C.torrent.uploaded,S(o).useBinarySize)),1)]),_:1})]),_:1}),g(J,null,{default:x(()=>[g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrentDetail.overview.dlSpeedAverage"))+":",1),B("div",null,T(S(Zt)(c.value,S(o).useBitSpeed)),1)]),_:1}),g(q,{cols:"6"},{default:x(()=>[B("div",null,T(C.$t("torrentDetail.overview.upSpeedAverage"))+":",1),B("div",null,T(S(Zt)(_.value,S(o).useBitSpeed)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})):_t("",!0)}});Eh={class:"text-grey"};Rh={key:0};Dh={key:1};Bh={key:0};Fh={key:2,class:"text-grey"};$h=["title"];Vh=["alt","src","title"];Gh=["title"];Nh=["title"];Lh={key:1};Uh={class:"text-download"};Oh={class:"text-upload"};zh={class:"d-flex my-3 flex-gap align-center justify-center"};Hh=ct({__name:"Peers",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,{t:e}=me(),s=Oe(),r=Yn(),n=ee();function o(D,U){const M=D.ip.split(".").map(Number),F=U.ip.split(".").map(Number);for(let O=0;O<4;O++)if(M[O]!==F[O])return M[O]-F[O];return D.port-U.port}function a(D,U){return D.country&&!U.country?-1:!D.country&&U.country?1:D.country===U.country?o(D,U):D.country.localeCompare(U.country)}const l=so([{nowrap:!0,key:"actions",sortable:!1},{nowrap:!0,title:e("torrentDetail.peers.fields.country"),key:"country",sortRaw:a},{nowrap:!0,title:e("torrentDetail.peers.fields.host"),key:"host",sortRaw:o},{nowrap:!0,title:e("torrentDetail.peers.fields.progress"),key:"progress"},{nowrap:!0,title:e("torrentDetail.peers.fields.download"),key:"dl_speed"},{nowrap:!0,title:e("torrentDetail.peers.fields.upload"),key:"up_speed"},{nowrap:!0,title:e("torrentDetail.peers.fields.flags"),key:"flags"},{nowrap:!0,title:e("torrentDetail.peers.fields.client"),key:"client"},{nowrap:!0,title:e("torrentDetail.peers.fields.relevance"),key:"relevance"},{nowrap:!0,title:e("torrentDetail.peers.fields.files"),key:"files"}]),u=io([{key:"dl_speed",order:"desc"},{key:"up_speed",order:"desc"}]),h=ht(!1),c=ht(),d=ht(new Map),m=ht(!1),p=ht(""),_=ht(!1),f=ht(""),v=j(()=>Array.from(d.value.entries()).map(([D,U])=>({...U,host:D})));function y(D){Object.entries(D).forEach(([U,M])=>{const F=d.value.get(U);d.value.set(U,{...F,...M})})}function b(D){D.forEach(U=>d.value.delete(U))}async function w(){h.value=!0;const D=await s.syncTorrentPeers(t.torrent.hash,c.value);c.value=D.rid,m.value=D.show_flags??m.value,D.full_update?d.value=new Map(Object.entries(D.peers)):(D.peers_removed&&b(D.peers_removed),D.peers&&y(D.peers)),h.value=!1}async function A(){f.value.length&&(await s.addTorrentPeers(t.torrent.hash,f.value.split(`
`)),P(),R())}function R(){_.value=!1,f.value=""}async function E(D){await s.banPeers([D.host]),await r.fetchPreferences(),P()}const{isActive:C,pause:k,resume:P}=pr(w,2e3,{immediate:!0,immediateCallback:!0});return ze(()=>t.isActive,D=>{D?P():k()}),ro(()=>!_.value),(D,U)=>(I(),V(Qt,null,{default:x(()=>[d.value.size?(I(),V(Wn,{key:1,headers:S(l),items:v.value,"multi-sort":"","sort-by":S(u),search:p.value,"filter-keys":["host","client","files"],mobile:null},{top:x(()=>[g(ns,{modelValue:p.value,"onUpdate:modelValue":U[0]||(U[0]=M=>p.value=M),class:"ma-3",density:"compact",label:D.$t("common.search"),"prepend-inner-icon":"mdi-magnify",flat:"","hide-details":"","single-line":"",clearable:""},null,8,["modelValue","label"])]),"item.host":x(({item:M})=>[L(T(M.ip),1),B("span",Eh,":"+T(M.port),1)]),"item.client":x(({item:M})=>[M.connection?(I(),G("span",Rh,"["+T(M.connection)+"]\xa0",1)):_t("",!0),M.client?(I(),G("span",Dh,[L(T(M.client)+" ",1),M.peer_id_client?(I(),G("span",Bh,"("+T(M.peer_id_client)+")",1)):_t("",!0)])):(I(),G("span",Fh,"?????"))]),"item.actions":x(({item:M})=>[g(st,{color:"red",icon:"mdi-cancel",variant:"text",onClick:F=>E(M)},null,8,["onClick"])]),"item.country":x(({item:M})=>[m.value?(I(),G("div",{key:0,class:"cursor-help",title:M.country},[S(qn)?(I(),G("img",{key:0,alt:S(gs)(M.country_code).char,src:S(gs)(M.country_code).url,title:M.country,style:{"max-width":"32px"}},null,8,Vh)):(I(),G("span",{key:1,title:M.country},T(S(gs)(M.country_code).char),9,Gh))],8,$h)):_t("",!0)]),"item.flags":x(({item:M})=>[M.flags?(I(),G("div",{key:0,class:"cursor-help",title:M.flags_desc},T(M.flags),9,Nh)):(I(),G("div",Lh,T(D.$t("common.none")),1))]),"item.dl_speed":x(({item:M})=>[B("span",Uh,T(S(Zt)(M.dl_speed,S(n).useBitSpeed))+" ("+T(S(Gt)(M.downloaded,S(n).useBinarySize))+") ",1)]),"item.up_speed":x(({item:M})=>[B("span",Oh,T(S(Zt)(M.up_speed,S(n).useBitSpeed))+" ("+T(S(Gt)(M.uploaded,S(n).useBinarySize))+") ",1)]),"item.progress":x(({item:M})=>[g(dr,{"model-value":M.progress,max:1,height:20,rounded:"sm",style:{width:"8em"},color:M.progress===1?"torrent-ul_stalled":"torrent-downloading"},{default:x(()=>[L(T(S($s)(M.progress)),1)]),_:2},1032,["model-value","color"])]),"item.relevance":x(({item:M})=>[L(T(S($s)(M.relevance)),1)]),_:2},1032,["headers","items","sort-by","search"])):(I(),V(Xn,{key:0,title:D.$t("torrentDetail.peers.empty"),icon:"mdi-account-sync",color:"accent"},null,8,["title"])),B("div",zh,[S(C)?(I(),V(st,{key:0,"prepend-icon":"mdi-pause",color:"primary",text:D.$t("common.pause"),onClick:U[1]||(U[1]=M=>S(k)())},null,8,["text"])):(I(),V(st,{key:1,"prepend-icon":"mdi-play",color:"primary",text:D.$t("common.resume"),onClick:U[2]||(U[2]=M=>S(P)())},null,8,["text"])),g(Gs,{modelValue:_.value,"onUpdate:modelValue":U[4]||(U[4]=M=>_.value=M),"max-width":"750px"},{activator:x(({props:M})=>[g(st,Ls(M,{variant:"flat",text:S(e)("torrentDetail.peers.addPeers.title"),color:"accent"}),null,16,["text"])]),default:x(()=>[g(Qt,{title:D.$t("torrentDetail.peers.addPeers.title")},{default:x(()=>[g(Re,null,{default:x(()=>[g(_r,{modelValue:f.value,"onUpdate:modelValue":U[3]||(U[3]=M=>f.value=M),label:S(e)("torrentDetail.peers.addPeers.newPeers"),placeholder:S(e)("torrentDetail.peers.addPeers.newPeersPlaceholder"),hint:S(e)("torrentDetail.peers.addPeers.newPeersHint")},null,8,["modelValue","label","placeholder","hint"])]),_:1}),g(Vs,null,{default:x(()=>[g(ce),g(st,{color:"error",onClick:R},{default:x(()=>[L(T(S(e)("common.cancel")),1)]),_:1}),g(st,{color:"accent",onClick:A},{default:x(()=>[L(T(S(e)("common.ok")),1)]),_:1})]),_:1})]),_:1},8,["title"])]),_:1},8,["modelValue"])])]),_:1}))}});Yh=ct({__name:"TagsAndCategories",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,e=Oe(),s=ri();async function r(o){t.torrent.category===o?await s.setTorrentCategory([t.torrent.hash],""):await s.setTorrentCategory([t.torrent.hash],o)}async function n(o){t.torrent.tags?.includes(o)?await s.removeTorrentTags([t.torrent.hash],[o]):await s.addTorrentTags([t.torrent.hash],[o])}return vr(async()=>{await e.fetchCategories(),await e.fetchTags()}),(o,a)=>(I(),V(Qt,null,{default:x(()=>[g(Re,null,{default:x(()=>[g(J,null,{default:x(()=>[g(q,{cols:"12",md:"6"},{default:x(()=>[g(Ee,null,{default:x(()=>[g(Ci,null,{default:x(()=>[L(T(o.$t("torrentDetail.tagsAndCategories.tags")),1)]),_:1}),(I(!0),G(ft,null,bt(S(e).tags,l=>(I(),V(Jt,{variant:"text",color:"accent",title:l,active:o.torrent.tags?.includes(l),onClick:u=>n(l)},null,8,["title","active","onClick"]))),256))]),_:1})]),_:1}),g(q,{cols:"12",md:"6"},{default:x(()=>[g(Ee,null,{default:x(()=>[g(Ci,null,{default:x(()=>[L(T(o.$t("torrentDetail.tagsAndCategories.categories")),1)]),_:1}),(I(!0),G(ft,null,bt(S(e).categories,l=>(I(),V(Jt,{variant:"text",color:"accent",title:l.name,active:l.name===t.torrent.category,onClick:u=>r(l.name)},null,8,["title","active","onClick"]))),256))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))}});Xh={class:"d-flex"};Wh={key:0};qh={key:1};jh={key:2};Kh={key:3};Zh={key:0,class:"d-flex flex-column"};Qh={class:"text-h5"};Jh={class:"text-h5"};tu=ct({__name:"Trackers",props:{torrent:{},isActive:{type:Boolean}},setup(i){const t=i,{t:e}=me(),s=Oe();function r(A){switch(A){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(A){return typeof A=="number"?A===-1?"N/A":A.valueOf():!A||A.num_peers===-1||A?.num_seeds===-1||A?.num_leeches===-1?"N/A":e("torrentDetail.trackers.peersValue",{peers:A.num_peers,seeds:A.num_seeds,leeches:A.num_leeches})}const o=ht(!1),a=ht([]),l=ht(""),u=ht(null),h=ht(!1),c=[A=>!!A||e("torrentDetail.trackers.editTracker.newUrlRequired")],d=no({isVisible:!1,isFormValid:!1,oldUrl:"",newUrl:""});function m(A){d.isVisible=!0,d.oldUrl=A.url,d.newUrl=A.url,yr(()=>{document.getElementById("input")?.select()})}async function p(){o.value=!0,a.value=(await s.getTorrentTrackers(t.torrent.hash)).map(A=>({...A,isSelectable:A.tier!==-1})),o.value=!1}async function _(){l.value.length&&(await s.addTorrentTrackers(t.torrent.hash,l.value),await p(),f())}function f(){h.value=!1,l.value=""}async function v(){d.isFormValid&&(await s.editTorrentTracker(t.torrent.hash,d.oldUrl,d.newUrl),d.isVisible=!1,await p())}async function y(A){await s.removeTorrentTrackers(t.torrent.hash,[A.url]),await p()}async function b(){await s.reannounceTorrents([t.torrent.hash])}async function w(A){A??t.isActive?(await p(),u.value=setInterval(p,5e3)):(clearInterval(u.value),u.value=null)}return vr(w),br(()=>w(!1)),ze(()=>t.isActive,w),(A,R)=>(I(),V(Ee,null,{default:x(()=>[(I(!0),G(ft,null,bt(a.value,(E,C)=>(I(),G(ft,null,[C===3?(I(),V(Ai,{key:0,color:"white",thickness:"5"})):C>0?(I(),V(Ai,{key:1,class:"mx-5",color:"white"})):_t("",!0),g(Jt,null,{default:x(()=>[B("div",Xh,[B("div",{class:De(`tracker-${S(Vt)[E.status].toLowerCase()}`)},[g(jn,{class:"text-break text-wrap"},{default:x(()=>[L(T(E.url),1)]),_:2},1024),g(Bs,{class:"d-block"},{default:x(()=>[E.msg?(I(),G("div",Wh,T(E.msg),1)):(I(),G("div",qh,T(r(E.status)),1)),E.tier>=0?(I(),G("div",jh,T(S(e)("torrentDetail.trackers.tier",E.tier)),1)):_t("",!0),E.status!==S(Vt).NOT_WORKING?(I(),G("div",Kh,[B("div",null,T(n(E)),1),B("div",null,"Downloads: "+T(n(E.num_downloaded)),1)])):_t("",!0)]),_:2},1024)],2),g(ce),E.tier>=0?(I(),G("div",Zh,[g(Gs,{modelValue:d.isVisible,"onUpdate:modelValue":R[4]||(R[4]=k=>d.isVisible=k),"max-width":"750px"},{activator:x(({props:k})=>[g(st,Ls({ref_for:!0},k,{icon:"mdi-pencil",variant:"text",onClick:P=>m(E)}),null,16,["onClick"])]),default:x(()=>[g(Qt,null,{default:x(()=>[g(Fs,null,{default:x(()=>[B("span",Qh,T(S(e)("torrentDetail.trackers.editTracker.title")),1)]),_:1}),g(Re,null,{default:x(()=>[g(S(Kn),{modelValue:d.isFormValid,"onUpdate:modelValue":R[1]||(R[1]=k=>d.isFormValid=k),onSubmit:R[2]||(R[2]=Ns(()=>{},["prevent"]))},{default:x(()=>[g(S(ns),{"model-value":d.oldUrl,disabled:"",label:A.$t("torrentDetail.trackers.editTracker.oldUrl")},null,8,["model-value","label"]),g(S(ns),{modelValue:d.newUrl,"onUpdate:modelValue":R[0]||(R[0]=k=>d.newUrl=k),id:"input",rules:c,label:A.$t("torrentDetail.trackers.editTracker.newUrl"),autofocus:"",onKeydown:oo(v,["enter"])},null,8,["modelValue","label"])]),_:1},8,["modelValue"])]),_:1}),g(Vs,null,{default:x(()=>[g(ce),g(st,{color:"error",disabled:!d.isFormValid,onClick:R[3]||(R[3]=k=>d.isVisible=!1)},{default:x(()=>[L(T(S(e)("common.cancel")),1)]),_:1},8,["disabled"]),g(st,{color:"accent",onClick:v},{default:x(()=>[L(T(S(e)("common.ok")),1)]),_:1})]),_:1})]),_:1})]),_:2},1032,["modelValue"]),g(st,{color:"red",icon:"mdi-delete",variant:"text",onClick:k=>y(E)},null,8,["onClick"])])):_t("",!0)])]),_:2},1024)],64))),256)),g(Jt,null,{default:x(()=>[B("div",{class:De(["d-flex py-5",A.$vuetify.display.mobile?"flex-column flex-gap-row":"justify-space-evenly"])},[g(Gs,{modelValue:h.value,"onUpdate:modelValue":R[6]||(R[6]=E=>h.value=E),"max-width":"750px"},{activator:x(({props:E})=>[g(st,Ls(E,{variant:"flat",text:S(e)("torrentDetail.trackers.addTrackers.title"),color:"accent"}),null,16,["text"])]),default:x(()=>[g(Qt,null,{default:x(()=>[g(Fs,null,{default:x(()=>[B("span",Jh,T(S(e)("torrentDetail.trackers.addTrackers.title")),1)]),_:1}),g(Re,null,{default:x(()=>[g(Zn,null,{default:x(()=>[g(J,null,{default:x(()=>[g(q,{cols:"12"},{default:x(()=>[g(_r,{modelValue:l.value,"onUpdate:modelValue":R[5]||(R[5]=E=>l.value=E),label:S(e)("torrentDetail.trackers.addTrackers.newTrackers"),hint:S(e)("torrentDetail.trackers.addTrackers.newTrackersHint")},null,8,["modelValue","label","hint"])]),_:1})]),_:1})]),_:1})]),_:1}),g(Vs,null,{default:x(()=>[g(ce),g(st,{color:"error",onClick:f},{default:x(()=>[L(T(S(e)("common.cancel")),1)]),_:1}),g(st,{color:"accent",onClick:_},{default:x(()=>[L(T(S(e)("common.ok")),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),g(st,{variant:"flat",disabled:a.value.length===3,text:S(e)("torrentDetail.trackers.reannounce"),color:"primary",onClick:b},null,8,["disabled","text"])],2)]),_:1})]),_:1}))}});eu=hs(tu,[["__scopeId","data-v-12f0128d"]]);su={class:"pa-3 text-select"};iu={style:{"font-size":"1.6em !important"},class:"subtitle-1 ml-2"};ru={class:"d-flex justify-end"};nu=ct({__name:"TorrentDetail",setup(i){const t=ao(),{t:e}=me(),s=Ue(),r=mr(),n=ri(),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=ht("overview"),u=j(()=>t.currentRoute.value.params.hash),h=j(()=>n.getTorrentByHash(u.value)),c=()=>{t.push({name:"dashboard"})};function d(p){if(r.hasActiveDialog)return!1;p.key==="Escape"&&c()}function m(){const p=t.currentRoute.value.params.tab;p&&(l.value=p)}return lo(()=>{m()}),ze(h,()=>{o.fetchProperties(u.value)}),us(()=>{document.addEventListener("keydown",d),m(),o.fetchProperties(u.value),s.updateFileTree()}),ni(()=>{document.removeEventListener("keydown",d),o.$reset()}),(p,_)=>(I(),G(ft,null,[B("div",su,[g(J,{"no-gutters":"",align:"center",justify:"center"},{default:x(()=>[g(q,null,{default:x(()=>[B("h1",iu,T(S(e)("torrentDetail.title")),1)]),_:1}),g(q,null,{default:x(()=>[B("div",ru,[g(st,{icon:"mdi-close",variant:"plain",onClick:c})])]),_:1})]),_:1}),g(J,{class:"ma-0 pa-0"},{default:x(()=>[g(Jn,{modelValue:l.value,"onUpdate:modelValue":_[0]||(_[0]=f=>l.value=f),"bg-color":"primary",grow:"","show-arrows":""},{default:x(()=>[(I(),G(ft,null,bt(a,({text:f,value:v})=>g(to,{value:v,href:`#/torrent/${u.value}/${v}`,text:f},null,8,["value","href","text"])),64))]),_:1},8,["modelValue"])]),_:1}),h.value?(I(),V(Qn,{key:0,modelValue:l.value,"onUpdate:modelValue":_[1]||(_[1]=f=>l.value=f),touch:!1},{default:x(()=>[g(ne,{value:"overview"},{default:x(()=>[g(Ih,{torrent:h.value,"is-active":l.value==="overview"},null,8,["torrent","is-active"])]),_:1}),g(ne,{value:"info"},{default:x(()=>[g(Do,{torrent:h.value,"is-active":l.value==="info"},null,8,["torrent","is-active"])]),_:1}),g(ne,{value:"trackers"},{default:x(()=>[g(eu,{torrent:h.value,"is-active":l.value==="trackers"},null,8,["torrent","is-active"])]),_:1}),g(ne,{value:"peers"},{default:x(()=>[g(Hh,{torrent:h.value,"is-active":l.value==="peers"},null,8,["torrent","is-active"])]),_:1}),g(ne,{value:"content"},{default:x(()=>[g(S(bo),{torrent:h.value,"is-active":l.value==="content"},null,8,["torrent","is-active"])]),_:1}),g(ne,{value:"tagsAndCategories"},{default:x(()=>[g(Yh,{torrent:h.value,"is-active":l.value==="tagsAndCategories"},null,8,["torrent","is-active"])]),_:1})]),_:1},8,["modelValue"])):_t("",!0)]),B("div",{style:gr(`position: absolute; left: ${S(s).rightClickProperties.offset[0]}px; top: ${S(s).rightClickProperties.offset[1]}px;`)},[g(S(Pn),{modelValue:S(s).rightClickProperties.isVisible,"onUpdate:modelValue":_[2]||(_[2]=f=>S(s).rightClickProperties.isVisible=f),"menu-data":S(s).menuData},null,8,["modelValue","menu-data"])],4)],64))}});_u=Object.freeze(Object.defineProperty({__proto__:null,default:nu},Symbol.toStringTag,{value:"Module"}))});export{fe as $,an as A,mt as B,pt as C,Nt as D,Y as E,Li as F,xa as G,ks as H,xt as I,Fr as J,et as K,tt as L,H as M,ol as N,xl as O,ut as P,Ae as Q,ot as R,Tl as S,Ze as T,Ws as U,ke as V,ur as W,al as X,ll as Y,ui as Z,he as _,Lt as a,yn as a0,Ji as a1,ls as a2,qo as a3,bn as a4,_u as a5,Ml as b,Ne as c,Fa as d,Tt as e,Qi as f,fn as g,rn as h,Yr as i,Ft as j,W as k,Ba as l,Wo as m,mu as n,Il as o,wl as p,Mt as q,oa as r,Dr as s,Dt as t,at as u,Be as v,Rt as w,Va as x,el as y,zi as z,__tla};