archgine 1.0.70 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4010,7 +4010,7 @@ Fu.__DOMHandler = Eu;
|
|
|
4010
4010
|
Fu.normalizeLineEndings = Le;
|
|
4011
4011
|
Fu.DOMParser = Ie;
|
|
4012
4012
|
var gr = Fu.DOMParser;
|
|
4013
|
-
const Er = "1.0.
|
|
4013
|
+
const Er = "1.0.71";
|
|
4014
4014
|
function vr() {
|
|
4015
4015
|
return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
|
|
4016
4016
|
}
|
package/lib/index.mjs
CHANGED
|
@@ -4010,7 +4010,7 @@ ou.__DOMHandler = Ra;
|
|
|
4010
4010
|
ou.normalizeLineEndings = Cd;
|
|
4011
4011
|
ou.DOMParser = Dd;
|
|
4012
4012
|
var Yx = ou.DOMParser;
|
|
4013
|
-
const Xx = "1.0.
|
|
4013
|
+
const Xx = "1.0.71";
|
|
4014
4014
|
function Zx() {
|
|
4015
4015
|
return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
|
|
4016
4016
|
}
|
|
@@ -12156,7 +12156,7 @@ class Ah extends CE {
|
|
|
12156
12156
|
appendStyles() {
|
|
12157
12157
|
var e;
|
|
12158
12158
|
let t = (e = this.svg) == null ? void 0 : e.querySelector("style");
|
|
12159
|
-
t && (t.appendChild(document.createTextNode(`.default { stroke: ${this.params.defaultStroke}; fill: ${this.params.defaultFill}; }`)), t.appendChild(document.createTextNode(`.info { stroke: ${this.params.infoStroke}; fill: ${this.params.infoFill}; }`)), t.appendChild(document.createTextNode(`.primary { stroke: ${this.params.primaryStroke}; fill: ${this.params.primaryFill}; }`)), t.appendChild(document.createTextNode(`.success { stroke: ${this.params.successStroke}; fill: ${this.params.successFill}; }`)), t.appendChild(document.createTextNode(`.warning { stroke: ${this.params.warningStroke}; fill: ${this.params.warningFill}; }`)), t.appendChild(document.createTextNode(`.danger { stroke: ${this.params.dangerStroke}; fill: ${this.params.dangerFill}; }`)), t.appendChild(document.createTextNode(`.active { stroke: ${this.params.activeStroke}; fill: ${this.params.activeFill}; }`)));
|
|
12159
|
+
t && (t.appendChild(document.createTextNode(`.default { stroke: ${this.params.defaultStroke}; fill: ${this.params.defaultFill}; }`)), t.appendChild(document.createTextNode(`.info { stroke: ${this.params.infoStroke}; fill: ${this.params.infoFill}; }`)), t.appendChild(document.createTextNode(`.primary { stroke: ${this.params.primaryStroke}; fill: ${this.params.primaryFill}; }`)), t.appendChild(document.createTextNode(`.success { stroke: ${this.params.successStroke}; fill: ${this.params.successFill}; }`)), t.appendChild(document.createTextNode(`.warning { stroke: ${this.params.warningStroke}; fill: ${this.params.warningFill}; }`)), t.appendChild(document.createTextNode(`.danger { stroke: ${this.params.dangerStroke}; fill: ${this.params.dangerFill}; }`)), t.appendChild(document.createTextNode(`.active { stroke: ${this.params.activeStroke}; fill: ${this.params.activeFill}; }`)), t.appendChild(document.createTextNode(`text { font-family: ${this.params.fontFamily || "simhei"}; }`)));
|
|
12160
12160
|
}
|
|
12161
12161
|
getLayers(t = 2) {
|
|
12162
12162
|
return this.svg ? this.chef.getLayers(t) : [];
|
|
@@ -12226,7 +12226,7 @@ class Ah extends CE {
|
|
|
12226
12226
|
const i = Nt.keys(e);
|
|
12227
12227
|
let a;
|
|
12228
12228
|
for (let o = 0, l = i.length; o < l; o++)
|
|
12229
|
-
a = e[i[o]],
|
|
12229
|
+
a = e[i[o]], a && (a.hasAttribute(t) && a.removeAttribute(t), t === "stroke" && a.removeAttribute("stroke-width"));
|
|
12230
12230
|
this.clearLegendBy(t);
|
|
12231
12231
|
}
|
|
12232
12232
|
clearFillOrStrokeByIds(t, e = "fill") {
|
|
@@ -12238,7 +12238,7 @@ class Ah extends CE {
|
|
|
12238
12238
|
t != null && t.length && !t.includes(a[l]) || (o = i[a[l]], !(!o || !o.hasAttribute(e)) && (o.removeAttribute(e), e === "stroke" && o.removeAttribute("stroke-width")));
|
|
12239
12239
|
this.clearLegendBy(e);
|
|
12240
12240
|
}
|
|
12241
|
-
setFillOrStrokeByIds(t, e, i = "fill", a = "
|
|
12241
|
+
setFillOrStrokeByIds(t, e, i = "fill", a = "7em") {
|
|
12242
12242
|
const o = this.getAssetsByType(this.assetType);
|
|
12243
12243
|
if (!o) return;
|
|
12244
12244
|
const l = Nt.keys(o);
|
package/lib/index.umd.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),r.entityMap=r.HTML_ENTITIES})(pc);var Su={},zs=di.NAMESPACE,Ou=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,dc=new RegExp("[\\-\\.0-9"+Ou.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),gc=new RegExp("^"+Ou.source+dc.source+"*(?::"+Ou.source+dc.source+"*)?$"),$s=0,zi=1,Jn=2,Gs=3,ts=4,es=5,Ys=6,Qa=7;function rs(r,t){this.message=r,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,rs)}rs.prototype=new Error,rs.prototype.name=rs.name;function yc(){}yc.prototype={parse:function(r,t,e){var i=this.domBuilder;i.startDocument(),xc(t,t={}),Wg(r,t,e,i,this.errorHandler),i.endDocument()}};function Wg(r,t,e,i,a){function o(O){if(O>65535){O-=65536;var vt=55296+(O>>10),Bt=56320+(O&1023);return String.fromCharCode(vt,Bt)}else return String.fromCharCode(O)}function l(O){var vt=O.slice(1,-1);return Object.hasOwnProperty.call(e,vt)?e[vt]:vt.charAt(0)==="#"?o(parseInt(vt.substr(1).replace("x","0x"))):(a.error("entity not found:"+O),O)}function c(O){if(O>L){var vt=r.substring(L,O).replace(/&#?\w+;/g,l);_&&f(L),i.characters(vt,0,O-L),L=O}}function f(O,vt){for(;O>=g&&(vt=E.exec(r));)d=vt.index,g=d+vt[0].length,_.lineNumber++;_.columnNumber=O-d+1}for(var d=0,g=0,E=/.*(?:\r\n?|\n)|.*$/g,_=i.locator,C=[{currentNSMap:t}],R={},L=0;;){try{var N=r.indexOf("<",L);if(N<0){if(!r.substr(L).match(/^\s*$/)){var I=i.doc,W=I.createTextNode(r.substr(L));I.appendChild(W),i.currentElement=W}return}switch(N>L&&c(N),r.charAt(N+1)){case"/":var J=r.indexOf(">",N+3),G=r.substring(N+2,J).replace(/[ \t\n\r]+$/g,""),b=C.pop();J<0?(G=r.substring(N+2).replace(/[\s<].*/,""),a.error("end tag name: "+G+" is not complete:"+b.tagName),J=N+1+G.length):G.match(/\s</)&&(G=G.replace(/[\s<].*/,""),a.error("end tag name: "+G+" maybe not complete"),J=N+1+G.length);var F=b.localNSMap,q=b.tagName==G,K=q||b.tagName&&b.tagName.toLowerCase()==G.toLowerCase();if(K){if(i.endElement(b.uri,b.localName,G),F)for(var tt in F)Object.prototype.hasOwnProperty.call(F,tt)&&i.endPrefixMapping(tt);q||a.fatalError("end tag name: "+G+" is not match the current start tagName:"+b.tagName)}else C.push(b);J++;break;case"?":_&&f(N),J=Yg(r,N,i);break;case"!":_&&f(N),J=Gg(r,N,i,a);break;default:_&&f(N);var Z=new Ec,rt=C[C.length-1].currentNSMap,J=Vg(r,N,Z,rt,l,a),st=Z.length;if(!Z.closed&&$g(r,J,Z.tagName,R)&&(Z.closed=!0,e.nbsp||a.warning("unclosed xml attribute")),_&&st){for(var ct=mc(_,{}),ft=0;ft<st;ft++){var pt=Z[ft];f(pt.offset),pt.locator=mc(_,{})}i.locator=ct,vc(Z,i,rt)&&C.push(Z),i.locator=_}else vc(Z,i,rt)&&C.push(Z);zs.isHTML(Z.uri)&&!Z.closed?J=zg(r,J,Z.tagName,l,i):J++}}catch(O){if(O instanceof rs)throw O;a.error("element parse error: "+O),J=-1}J>L?L=J:c(Math.max(N,L)+1)}}function mc(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function Vg(r,t,e,i,a,o){function l(_,C,R){e.attributeNames.hasOwnProperty(_)&&o.fatalError("Attribute "+_+" redefined"),e.addValue(_,C.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,a),R)}for(var c,f,d=++t,g=$s;;){var E=r.charAt(d);switch(E){case"=":if(g===zi)c=r.slice(t,d),g=Gs;else if(g===Jn)g=Gs;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(g===Gs||g===zi)if(g===zi&&(o.warning('attribute value must after "="'),c=r.slice(t,d)),t=d+1,d=r.indexOf(E,t),d>0)f=r.slice(t,d),l(c,f,t-1),g=es;else throw new Error("attribute value no end '"+E+"' match");else if(g==ts)f=r.slice(t,d),l(c,f,t),o.warning('attribute "'+c+'" missed start quot('+E+")!!"),t=d+1,g=es;else throw new Error('attribute value must after "="');break;case"/":switch(g){case $s:e.setTagName(r.slice(t,d));case es:case Ys:case Qa:g=Qa,e.closed=!0;case ts:case zi:break;case Jn:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),g==$s&&e.setTagName(r.slice(t,d)),d;case">":switch(g){case $s:e.setTagName(r.slice(t,d));case es:case Ys:case Qa:break;case ts:case zi:f=r.slice(t,d),f.slice(-1)==="/"&&(e.closed=!0,f=f.slice(0,-1));case Jn:g===Jn&&(f=c),g==ts?(o.warning('attribute "'+f+'" missed quot(")!'),l(c,f,t)):((!zs.isHTML(i[""])||!f.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+f+'" missed value!! "'+f+'" instead!!'),l(f,f,t));break;case Gs:throw new Error("attribute value missed!!")}return d;case"":E=" ";default:if(E<=" ")switch(g){case $s:e.setTagName(r.slice(t,d)),g=Ys;break;case zi:c=r.slice(t,d),g=Jn;break;case ts:var f=r.slice(t,d);o.warning('attribute "'+f+'" missed quot(")!!'),l(c,f,t);case es:g=Ys;break}else switch(g){case Jn:e.tagName,(!zs.isHTML(i[""])||!c.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=d,g=zi;break;case es:o.warning('attribute space is required"'+c+'"!!');case Ys:g=zi,t=d;break;case Gs:g=ts,t=d;break;case Qa:throw new Error("elements closed character '/' and '>' must be connected to")}}d++}}function vc(r,t,e){for(var i=r.tagName,a=null,E=r.length;E--;){var o=r[E],l=o.qName,c=o.value,_=l.indexOf(":");if(_>0)var f=o.prefix=l.slice(0,_),d=l.slice(_+1),g=f==="xmlns"&&d;else d=l,f=null,g=l==="xmlns"&&"";o.localName=d,g!==!1&&(a==null&&(a={},xc(e,e={})),e[g]=a[g]=c,o.uri=zs.XMLNS,t.startPrefixMapping(g,c))}for(var E=r.length;E--;){o=r[E];var f=o.prefix;f&&(f==="xml"&&(o.uri=zs.XML),f!=="xmlns"&&(o.uri=e[f||""]))}var _=i.indexOf(":");_>0?(f=r.prefix=i.slice(0,_),d=r.localName=i.slice(_+1)):(f=null,d=r.localName=i);var C=r.uri=e[f||""];if(t.startElement(C,d,i,r),r.closed){if(t.endElement(C,d,i),a)for(f in a)Object.prototype.hasOwnProperty.call(a,f)&&t.endPrefixMapping(f)}else return r.currentNSMap=e,r.localNSMap=a,!0}function zg(r,t,e,i,a){if(/^(?:script|textarea)$/i.test(e)){var o=r.indexOf("</"+e+">",t),l=r.substring(t+1,o);if(/[&<]/.test(l))return/^script$/i.test(e)?(a.characters(l,0,l.length),o):(l=l.replace(/&#?\w+;/g,i),a.characters(l,0,l.length),o)}return t+1}function $g(r,t,e,i){var a=i[e];return a==null&&(a=r.lastIndexOf("</"+e+">"),a<t&&(a=r.lastIndexOf("</"+e)),i[e]=a),a<t}function xc(r,t){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}function Gg(r,t,e,i){var a=r.charAt(t+2);switch(a){case"-":if(r.charAt(t+3)==="-"){var o=r.indexOf("-->",t+4);return o>t?(e.comment(r,t+4,o-t-4),o+3):(i.error("Unclosed comment"),-1)}else return-1;default:if(r.substr(t+3,6)=="CDATA["){var o=r.indexOf("]]>",t+9);return e.startCDATA(),e.characters(r,t+9,o-t-9),e.endCDATA(),o+3}var l=Xg(r,t),c=l.length;if(c>1&&/!doctype/i.test(l[0][0])){var f=l[1][0],d=!1,g=!1;c>3&&(/^public$/i.test(l[2][0])?(d=l[3][0],g=c>4&&l[4][0]):/^system$/i.test(l[2][0])&&(g=l[3][0]));var E=l[c-1];return e.startDTD(f,d,g),e.endDTD(),E.index+E[0].length}}return-1}function Yg(r,t,e){var i=r.indexOf("?>",t);if(i){var a=r.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return a?(a[0].length,e.processingInstruction(a[1],a[2]),i+2):-1}return-1}function Ec(){this.attributeNames={}}Ec.prototype={setTagName:function(r){if(!gc.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!gc.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:t,offset:e}},length:0,getLocalName:function(r){return this[r].localName},getLocator:function(r){return this[r].locator},getQName:function(r){return this[r].qName},getURI:function(r){return this[r].uri},getValue:function(r){return this[r].value}};function Xg(r,t){var e,i=[],a=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(a.lastIndex=t,a.exec(r);e=a.exec(r);)if(i.push(e),e[1])return i}Su.XMLReader=yc,Su.ParseError=rs;var Zg=di,Qg=Vi,Ac=pc,wc=Su,Kg=Qg.DOMImplementation,bc=Zg.NAMESPACE,jg=wc.ParseError,Jg=wc.XMLReader;function Tc(r){return r.replace(/\r[\n\u0085]/g,`
|
|
3
3
|
`).replace(/[\r\u0085\u2028]/g,`
|
|
4
4
|
`)}function _c(r){this.options=r||{locator:{}}}_c.prototype.parseFromString=function(r,t){var e=this.options,i=new Jg,a=e.domBuilder||new Xs,o=e.errorHandler,l=e.locator,c=e.xmlns||{},f=/\/x?html?$/.test(t),d=f?Ac.HTML_ENTITIES:Ac.XML_ENTITIES;l&&a.setDocumentLocator(l),i.errorHandler=t0(o,a,l),i.domBuilder=e.domBuilder||a,f&&(c[""]=bc.HTML),c.xml=c.xml||bc.XML;var g=e.normalizeLineEndings||Tc;return r&&typeof r=="string"?i.parse(g(r),c,d):i.errorHandler.error("invalid doc source"),a.doc};function t0(r,t,e){if(!r){if(t instanceof Xs)return t;r=t}var i={},a=r instanceof Function;e=e||{};function o(l){var c=r[l];!c&&a&&(c=r.length==2?function(f){r(l,f)}:r),i[l]=c&&function(f){c("[xmldom "+l+"] "+f+Lu(e))}||function(){}}return o("warning"),o("error"),o("fatalError"),i}function Xs(){this.cdata=!1}function is(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}Xs.prototype={startDocument:function(){this.doc=new Kg().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(r,t,e,i){var a=this.doc,o=a.createElementNS(r,e||t),l=i.length;Ka(this,o),this.currentElement=o,this.locator&&is(this.locator,o);for(var c=0;c<l;c++){var r=i.getURI(c),f=i.getValue(c),e=i.getQName(c),d=a.createAttributeNS(r,e);this.locator&&is(i.getLocator(c),d),d.value=d.nodeValue=f,o.setAttributeNode(d)}},endElement:function(r,t,e){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(r,t){},endPrefixMapping:function(r){},processingInstruction:function(r,t){var e=this.doc.createProcessingInstruction(r,t);this.locator&&is(this.locator,e),Ka(this,e)},ignorableWhitespace:function(r,t,e){},characters:function(r,t,e){if(r=Cc.apply(this,arguments),r){if(this.cdata)var i=this.doc.createCDATASection(r);else var i=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(r)&&this.doc.appendChild(i),this.locator&&is(this.locator,i)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){(this.locator=r)&&(r.lineNumber=0)},comment:function(r,t,e){r=Cc.apply(this,arguments);var i=this.doc.createComment(r);this.locator&&is(this.locator,i),Ka(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,t,e){var i=this.doc.implementation;if(i&&i.createDocumentType){var a=i.createDocumentType(r,t,e);this.locator&&is(this.locator,a),Ka(this,a),this.doc.doctype=a}},warning:function(r){console.warn("[xmldom warning] "+r,Lu(this.locator))},error:function(r){console.error("[xmldom error] "+r,Lu(this.locator))},fatalError:function(r){throw new jg(r,this.locator)}};function Lu(r){if(r)return`
|
|
5
|
-
@`+(r.systemId||"")+"#[line:"+r.lineNumber+",col:"+r.columnNumber+"]"}function Cc(r,t,e){return typeof r=="string"?r.substr(t,e):r.length>=t+e||t?new java.lang.String(r,t,e)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){Xs.prototype[r]=function(){return null}});function Ka(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}Za.__DOMHandler=Xs,Za.normalizeLineEndings=Tc,Za.DOMParser=_c;var e0=Za.DOMParser;const r0="1.0.70";function i0(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const ns=typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{document:void 0,tinyEngine:void 0};ns.Path2D||bg(ns),ns.DOMParser||(ns.DOMParser=e0);const kt={window:ns,version:r0,isBrowser:i0(),dpr:typeof window<"u"&&window.devicePixelRatio||1,document:ns.document,time:0,deltaTime:0,config:Zn},Zs=(r,t,e)=>Math.max(t,Math.min(e,r)),Dc=(r,t=1e-6)=>Math.abs(r)<t?0:r<0?-1:1,n0=r=>r*(Math.PI/180),s0=(r,t)=>(r%t+t)%t,Nu=(r,t,e)=>(1-e)*r+e*t,a0=r=>{let t=r*(180/Math.PI);return t<0&&(t+=360),t>360&&(t-=360),t},$t={transparent:"rgba(1, 1, 1, 0)",green:"#45b787",darkGreen:"#314a43",blue:"#6e9bc5",darkBlue:"#2775b6",red:"#F26666",darkRed:"#D95970",brown:"#ECD2B9",darkBrown:"#BF9D8A",yellow:"#ECDEC0",darkYellow:"#D0AC57",lightGray:"#e0e0e0",gray:"#beb6b6",darkGray:"#918883",white:"#F2F2F2",darkWhite:"#ececec",lightBlack:"#2E3032",black:"#182327",blackAlpha5:"rgba(0, 0, 0, 0.5)"},o0={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ir={h:0,s:0,l:0},ja={h:0,s:0,l:0};function Mu(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}const u0=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$|rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)|rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[\d.]+\s*\)/;class Wt{isColor=!0;r=1;g=1;b=1;a=1;constructor(t,e,i,a){return e===void 0&&i===void 0?this.set(t):this.setRGBA(t,e,i,a)}static isColor(t){return typeof t=="string"?u0.test(t):typeof t=="number"?t>=0&&t<=16777215:!1}static getRandomStyle(){return vi.random().getStyle()}static getDarken(t,e=.8){return vi.set(t).getHSL(Ja),vi.setHSL(Ja.h,Ja.s,Ja.l*e).getStyle()}static getLighten(t,e=1.2){return this.getDarken(t,e)}static getContrast(t){return vi.set(t),vi.getContrastString()}static getArray(t){return vi.set(t).toArray()}static getComplementary(t){return vi.set(t),vi.getComplementaryString()}static getMoreTransparent(t,e){return vi.set(t).setA(e).getStyle()}set(t){return t&&t.isColor?this.copy(t):typeof t=="number"?this.setHex(t):typeof t=="string"&&this.setStyle(t),this}random(){return this.setHex(Math.floor(Math.random()*(1<<24)))}setScalar(t){return this.r=t,this.g=t,this.b=t,this.a=1,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,this.a=1,this}setR(t){return this.r=t,this}setG(t){return this.g=t,this}setB(t){return this.b=t,this}setA(t){return this.a=t,this}setRGB(t,e,i){return this.setRGBA(t,e,i,this.a)}setRGBA(t,e,i,a=1){return this.r=t,this.g=e,this.b=i,this.a=a,this}setHSL(t,e,i,a=1){if(t=s0(t,1),e=Zs(e,0,1),i=Zs(i,0,1),e===0)this.r=this.g=this.b=i;else{const o=i<=.5?i*(1+e):i+e-i*e,l=2*i-o;this.r=Mu(l,o,t+1/3),this.g=Mu(l,o,t),this.b=Mu(l,o,t-1/3)}return this.a=a,this}setStyle(t){let e;if(e=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let i;const a=e[1],o=e[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,this.a=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,this.a=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const l=parseFloat(i[1])/360,c=parseInt(i[2],10)/100,f=parseInt(i[3],10)/100,d=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0);return this.setHSL(l,c,f,d)}break}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=e[1],a=i.length;if(a===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this.a=1,this;if(a===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this.a=1,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=o0[t.toLowerCase()];return e!==void 0?this.setHex(e):console.warn("Color: Unknown color "+t),this}clone(){return new Wt(this.r,this.g,this.b,this.a)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}getRGB(t=new Wt){return t.setRGB(this.r,this.g,this.b)}getRGBByBg(t=new Wt){const e=this.a,i=e*this.r+(1-e)*t.r,a=e*this.g+(1-e)*t.g,o=e*this.b+(1-e)*t.b;return new Wt(i,a,o)}getHex(){return Zs(this.r*255,0,255)<<16^Zs(this.g*255,0,255)<<8^Zs(this.b*255,0,255)<<0}getHSL(t){const e=this.r,i=this.g,a=this.b,o=Math.max(e,i,a),l=Math.min(e,i,a);let c=0,f;const d=(l+o)/2;if(l===o)c=0,f=0;else{const g=o-l;switch(f=d<=.5?g/(o+l):g/(2-o-l),o){case e:c=(i-a)/g+(i<a?6:0);break;case i:c=(a-e)/g+2;break;case a:c=(e-i)/g+4;break}c/=6}return t.h=c,t.s=f,t.l=d,t}getStyle(){return this.a===1?`rgb(${this.r*255|0},${this.g*255|0},${this.b*255|0})`:`rgba(${this.r*255|0},${this.g*255|0},${this.b*255|0},${this.a||1})`}getHexString(){return"#"+("000000"+this.getHex().toString(16)).slice(-6)}getBrightness(){let t=(this.r*255*299+this.g*255*587+this.b*255*144)/1e3;return t+=(255-t)*(255-this.a*255)/255,t}getContrastString(){return this.getBrightness()>125?"#2f2f2f":"#f2f2f2"}getComplementary(t=new Wt){const e=this.toArray(),i=[0,0,0,1];for(let a=0;a<e.length;a++)if(a<3)i[a]=1-e[a];else if(a===3)e[a]>1||e[a]<=0?i[a]=1:i[a]=Math.max(Math.min(parseFloat(e[a].toFixed(2)),1),0);else continue;return t.setRGBA(i[0],i[1],i[2],parseFloat(i[3].toFixed(2)))}getComplementaryString(){return this.getComplementary().getStyle()}getLightenOrDarken(t){if(typeof t>"u"||t>=1)return this.getHexString();const e=this.getRGBByBg(),i=e.r*t+(1-t),a=e.g*t+(1-t),o=e.b*t+(1-t);return new Wt(i,a,o).getHexString()}getNormalized(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.a,1),0).toFixed(2))]}getNormalized3(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2))]}offsetHSL(t,e,i){return this.getHSL(Ir),Ir.h+=t,Ir.s+=e,Ir.l+=i,this.setHSL(Ir.h,Ir.s,Ir.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Ir),t.getHSL(ja);const i=Nu(Ir.h,ja.h,e),a=Nu(Ir.s,ja.s,e),o=Nu(Ir.l,ja.l,e);return this.setHSL(i,a,o),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this.a=t[e+3],this}toArray(t=[0,0,0,0],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),t.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const vi=new Wt,Ja={h:0,s:0,l:0};class P{isVector2=!0;x=0;y=0;z;constructor(t=0,e=0,i){this.x=t,this.y=e,this.z=i||0}static isZero(t){return t.x===0&&t.y===0}static isEmpty(t){return!Number.isFinite(t.x)&&!Number.isFinite(t.y)}static equals(t,e,i=!0){return i?t.x===e.x&&t.y===e.y:Math.abs(t.x-e.x)<Number.EPSILON&&Math.abs(t.y-e.y)<Number.EPSILON}static getInt32Array(t,e=2){const i=new ArrayBuffer(t.length*e*4),a=new Int32Array(i);for(let o=0,l=t.length;o<l;o++)a[o*2]=t[o].x,a[o*2+1]=t[o].y;return a}static getFloat64Array(t,e=2){const i=new ArrayBuffer(t.length*e*8),a=new Float64Array(i);for(let o=0,l=t.length;o<l;o++)a[o*2]=t[o].x,a[o*2+1]=t[o].y;return a}static getVectors(t){const e=[];for(let i=0,a=t.length;i<a;i++)e.push(new P(t[i].x,t[i].y));return e}static getStrings(t){const e=[];if(!t||!t.length)return"";for(let i=0,a=t.length;i<a;i++)e.push(P.getString(t[i]));return e.join(",")}static getString(t){return`${t.x},${t.y}`}static getLength(t){return Math.sqrt(t.x*t.x+t.y*t.y)}static getDistance(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static sub(t,e){return new P().subVectors(t,e)}static isPointOnSegment(t,e,i){return Dc(this.sub(t,i).cross(this.sub(e,i)))===0&&Dc(this.sub(t,i).dot(this.sub(e,i)))<=0}static angle(t,e,i){return i?Math.atan2(t.y-e.y,t.x-e.x):a0(Math.atan2(t.y-e.y,t.x-e.x))}static getSamplingPoints(t,e=100){let i=this.getClothoidPoints(t,e),a=0;for(let o=0,l=i.length;o<l;o++){let c=Math.max(0,o-1);o>0?a+=this.getDistance(i[c],i[c+1]):a=0,i[o].l=Math.round(a);let f=this.angle(i[c+1],i[c]);i[o].a=Math.round(f*100)/100}return i}static getClothoidPoints(t,e=100){let i=[],a=t.concat([]);if(!a||a.length<2)return i;a.length===2?(a.push(a[1]),a.unshift(a[0])):a.length===3&&a.splice(2,0,a[1]);for(let o=0;o<a.length-3;o+=3){let l=new P(a[o].x,a[o].y),c=new P(a[o+1].x,a[o+1].y),f=new P(a[o+2].x,a[o+2].y),d=new P(a[o+3].x,a[o+3].y),g=0;g+=l.distanceTo(c),g+=c.distanceTo(f),g+=f.distanceTo(d);let E=Math.min(.5,1/(g/e));for(let _=E;_<1;_+=E){let C=3*(c.x-l.x),R=3*(f.x-c.x)-C,L=d.x-l.x-C-R,N=3*(c.y-l.y),I=3*(f.y-c.y)-N,W=d.y-l.y-N-I,G=L*Math.pow(_,3)+R*Math.pow(_,2)+C*_+l.x,b=W*Math.pow(_,3)+I*Math.pow(_,2)+N*_+l.y;i.push({x:Math.round(G),y:Math.round(b),a:0,l:0})}}return i.unshift({x:a[0].x,y:a[0].y,a:0,l:0}),i.push({x:a[a.length-1].x,y:a[a.length-1].y,a:0,l:0}),i}static getClothoidLength(t){let e=0;if(t.length>2)for(let i=0;i<t.length;i++){let a=Math.max(0,i-1);i>0&&(e+=this.getDistance(t[a],t[a+1]))}return e}static getCircleCenterByChord(t,e,i,a=!0,o=new P){const l=this.getDistance(t,e);if(l===0)return o.x=1/0,o.y=1/0,o;Bu.set((t.x+e.x)/2,(t.y+e.y)/2);const c=Math.sqrt(i*i-l*l/4),f=a?-1:1;return o.x=Bu.x+f*c*(e.y-t.y)/l,o.y=Bu.y-f*c*(e.x-t.x)/l,o}static isPointInCircle(t,e,i){return this.getDistance(i,t)<e}static isPointInConvexHull(t,e){let i=!1;const a=e.length;for(let o=0,l=a-1;o<a;l=o++){const c=e[o],f=e[l];if(Math.min(c.x,f.x)<=t.x&&t.x<=Math.max(c.x,f.x)&&Math.min(c.y,f.y)<=t.y&&t.y<=Math.max(c.y,f.y)){const d=(f.x-c.x)*(t.y-c.y)-(f.y-c.y)*(t.x-c.x);if(Math.abs(d)<1e-12)return!0}c.y>t.y!=f.y>t.y&&t.x<(f.x-c.x)*(t.y-c.y)/(f.y-c.y)+c.x&&(i=!i)}return i}static isPointInPolygonByRay(t,e){let i=0;const a=new P().copy(t),o=new P,l=new P;for(let c=0;c<e.length;c++){c===e.length-1?(o.copy(e[c]),l.copy(e[0])):(o.copy(e[c]),l.copy(e[c+1]));let f=[o.y,l.y].sort((d,g)=>d-g);f[0]<a.y&&f[1]>a.y&&(o.x<a.x||l.x<a.x)&&i++}return i%2===1}static getIntersectionOfSegments(t,e,i,a,o=!1,l=new P){const c=(a.y-i.y)*(e.x-t.x)-(a.x-i.x)*(e.y-t.y);if(c===0)return l.makeEmpty();const f=(a.x-i.x)*(t.y-i.y)-(a.y-i.y)*(t.x-i.x),d=(e.x-t.x)*(t.y-i.y)-(e.y-t.y)*(t.x-i.x),g=f/c,E=d/c;return o&&(g<0||g>1||E<0||E>1)?l.makeEmpty():(l.x=t.x+g*(e.x-t.x),l.y=t.y+g*(e.y-t.y),l)}static getConvexHullByGrahamScan(t,e=!1,i=[]){if(!t||!t.length)return i;const a=t.length;let o=0;for(let f=0;f<a;f++)t[f].x<t[o].x&&(o=f);let l=o,c;do{i.push(t[l]),c=(l+1)%a;for(let f=0;f<a;f++)this.whichSideOfSegment(t[l],t[f],t[c])>0&&(c=f);l=c}while(l!==o);return e&&i.push(t[o]),i}static whichSideOfSegment(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}static getPointsWithMatrix3(t,e){const i=[];if(!t)return i;for(let a=0,o=t.length;a<o;a++)i.push({x:e.elements[0]*t[a].x+e.elements[3]*t[a].y+e.elements[6],y:e.elements[1]*t[a].x+e.elements[4]*t[a].y+e.elements[7]});return i}static getPointsApplyMatrix3(t,e=[]){for(let i=0,a=e.length;i<a;i++){const o=t.elements[0]*e[i].x+t.elements[3]*e[i].y+t.elements[6],l=t.elements[1]*e[i].x+t.elements[4]*e[i].y+t.elements[7];e[i].x=o,e[i].y=l}return e}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(t){const e=this.x,i=this.y,a=t.elements;return this.x=a[0]*e+a[3]*i+a[6],this.y=a[1]*e+a[4]*i+a[7],this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clone(){return new P(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}cross(t){return this.x*t.y-this.y*t.x}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}dot(t){return this.x*t.x+this.y*t.y}equals(t,e=!0){return e?t.x===this.x&&t.y===this.y:Math.abs(t.x-this.x)<Number.EPSILON&&Math.abs(t.y-this.y)<Number.EPSILON}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}floorToZero(){return this.roundToZero()}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+t)}}identity(){return this.set(0,0)}isEmpty(){return!Number.isFinite(this.x)&&!Number.isFinite(this.y)}isZero(){return this.x===0&&this.y===0}length(){return Math.sqrt(this.dot(this))}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}maxXY(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}minXY(t,e){return this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t,e){return this.x*=t,this.y*=e||t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(t){return this.applyMatrix3(t.matrixWorldInverse).applyMatrix3(t.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(t){const e=Math.cos(t),i=Math.sin(t),a=this.x,o=this.y;return this.x=a*e-o*i,this.y=a*i+o*e,this}rotateAround(t,e){const i=Math.cos(e),a=Math.sin(e),o=this.x-t.x,l=this.y-t.y;return this.x=o*i-l*a+t.x,this.y=o*a+l*i+t.y,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}set(t,e){return this.x=t,this.y=e,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("out of range: "+t)}return this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*3)}setLength(t){return this.normalize().multiplyScalar(t)}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(t,e=!1){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}}const Bu=new P,l0=Object.freeze(Object.defineProperty({__proto__:null,default:P},Symbol.toStringTag,{value:"Module"}));var to={exports:{}};/**
|
|
5
|
+
@`+(r.systemId||"")+"#[line:"+r.lineNumber+",col:"+r.columnNumber+"]"}function Cc(r,t,e){return typeof r=="string"?r.substr(t,e):r.length>=t+e||t?new java.lang.String(r,t,e)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){Xs.prototype[r]=function(){return null}});function Ka(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}Za.__DOMHandler=Xs,Za.normalizeLineEndings=Tc,Za.DOMParser=_c;var e0=Za.DOMParser;const r0="1.0.71";function i0(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const ns=typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{document:void 0,tinyEngine:void 0};ns.Path2D||bg(ns),ns.DOMParser||(ns.DOMParser=e0);const kt={window:ns,version:r0,isBrowser:i0(),dpr:typeof window<"u"&&window.devicePixelRatio||1,document:ns.document,time:0,deltaTime:0,config:Zn},Zs=(r,t,e)=>Math.max(t,Math.min(e,r)),Dc=(r,t=1e-6)=>Math.abs(r)<t?0:r<0?-1:1,n0=r=>r*(Math.PI/180),s0=(r,t)=>(r%t+t)%t,Nu=(r,t,e)=>(1-e)*r+e*t,a0=r=>{let t=r*(180/Math.PI);return t<0&&(t+=360),t>360&&(t-=360),t},$t={transparent:"rgba(1, 1, 1, 0)",green:"#45b787",darkGreen:"#314a43",blue:"#6e9bc5",darkBlue:"#2775b6",red:"#F26666",darkRed:"#D95970",brown:"#ECD2B9",darkBrown:"#BF9D8A",yellow:"#ECDEC0",darkYellow:"#D0AC57",lightGray:"#e0e0e0",gray:"#beb6b6",darkGray:"#918883",white:"#F2F2F2",darkWhite:"#ececec",lightBlack:"#2E3032",black:"#182327",blackAlpha5:"rgba(0, 0, 0, 0.5)"},o0={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ir={h:0,s:0,l:0},ja={h:0,s:0,l:0};function Mu(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}const u0=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$|rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)|rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[\d.]+\s*\)/;class Wt{isColor=!0;r=1;g=1;b=1;a=1;constructor(t,e,i,a){return e===void 0&&i===void 0?this.set(t):this.setRGBA(t,e,i,a)}static isColor(t){return typeof t=="string"?u0.test(t):typeof t=="number"?t>=0&&t<=16777215:!1}static getRandomStyle(){return vi.random().getStyle()}static getDarken(t,e=.8){return vi.set(t).getHSL(Ja),vi.setHSL(Ja.h,Ja.s,Ja.l*e).getStyle()}static getLighten(t,e=1.2){return this.getDarken(t,e)}static getContrast(t){return vi.set(t),vi.getContrastString()}static getArray(t){return vi.set(t).toArray()}static getComplementary(t){return vi.set(t),vi.getComplementaryString()}static getMoreTransparent(t,e){return vi.set(t).setA(e).getStyle()}set(t){return t&&t.isColor?this.copy(t):typeof t=="number"?this.setHex(t):typeof t=="string"&&this.setStyle(t),this}random(){return this.setHex(Math.floor(Math.random()*(1<<24)))}setScalar(t){return this.r=t,this.g=t,this.b=t,this.a=1,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,this.a=1,this}setR(t){return this.r=t,this}setG(t){return this.g=t,this}setB(t){return this.b=t,this}setA(t){return this.a=t,this}setRGB(t,e,i){return this.setRGBA(t,e,i,this.a)}setRGBA(t,e,i,a=1){return this.r=t,this.g=e,this.b=i,this.a=a,this}setHSL(t,e,i,a=1){if(t=s0(t,1),e=Zs(e,0,1),i=Zs(i,0,1),e===0)this.r=this.g=this.b=i;else{const o=i<=.5?i*(1+e):i+e-i*e,l=2*i-o;this.r=Mu(l,o,t+1/3),this.g=Mu(l,o,t),this.b=Mu(l,o,t-1/3)}return this.a=a,this}setStyle(t){let e;if(e=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let i;const a=e[1],o=e[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,this.a=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,this.a=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const l=parseFloat(i[1])/360,c=parseInt(i[2],10)/100,f=parseInt(i[3],10)/100,d=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0);return this.setHSL(l,c,f,d)}break}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=e[1],a=i.length;if(a===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this.a=1,this;if(a===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this.a=1,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=o0[t.toLowerCase()];return e!==void 0?this.setHex(e):console.warn("Color: Unknown color "+t),this}clone(){return new Wt(this.r,this.g,this.b,this.a)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}getRGB(t=new Wt){return t.setRGB(this.r,this.g,this.b)}getRGBByBg(t=new Wt){const e=this.a,i=e*this.r+(1-e)*t.r,a=e*this.g+(1-e)*t.g,o=e*this.b+(1-e)*t.b;return new Wt(i,a,o)}getHex(){return Zs(this.r*255,0,255)<<16^Zs(this.g*255,0,255)<<8^Zs(this.b*255,0,255)<<0}getHSL(t){const e=this.r,i=this.g,a=this.b,o=Math.max(e,i,a),l=Math.min(e,i,a);let c=0,f;const d=(l+o)/2;if(l===o)c=0,f=0;else{const g=o-l;switch(f=d<=.5?g/(o+l):g/(2-o-l),o){case e:c=(i-a)/g+(i<a?6:0);break;case i:c=(a-e)/g+2;break;case a:c=(e-i)/g+4;break}c/=6}return t.h=c,t.s=f,t.l=d,t}getStyle(){return this.a===1?`rgb(${this.r*255|0},${this.g*255|0},${this.b*255|0})`:`rgba(${this.r*255|0},${this.g*255|0},${this.b*255|0},${this.a||1})`}getHexString(){return"#"+("000000"+this.getHex().toString(16)).slice(-6)}getBrightness(){let t=(this.r*255*299+this.g*255*587+this.b*255*144)/1e3;return t+=(255-t)*(255-this.a*255)/255,t}getContrastString(){return this.getBrightness()>125?"#2f2f2f":"#f2f2f2"}getComplementary(t=new Wt){const e=this.toArray(),i=[0,0,0,1];for(let a=0;a<e.length;a++)if(a<3)i[a]=1-e[a];else if(a===3)e[a]>1||e[a]<=0?i[a]=1:i[a]=Math.max(Math.min(parseFloat(e[a].toFixed(2)),1),0);else continue;return t.setRGBA(i[0],i[1],i[2],parseFloat(i[3].toFixed(2)))}getComplementaryString(){return this.getComplementary().getStyle()}getLightenOrDarken(t){if(typeof t>"u"||t>=1)return this.getHexString();const e=this.getRGBByBg(),i=e.r*t+(1-t),a=e.g*t+(1-t),o=e.b*t+(1-t);return new Wt(i,a,o).getHexString()}getNormalized(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.a,1),0).toFixed(2))]}getNormalized3(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2))]}offsetHSL(t,e,i){return this.getHSL(Ir),Ir.h+=t,Ir.s+=e,Ir.l+=i,this.setHSL(Ir.h,Ir.s,Ir.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Ir),t.getHSL(ja);const i=Nu(Ir.h,ja.h,e),a=Nu(Ir.s,ja.s,e),o=Nu(Ir.l,ja.l,e);return this.setHSL(i,a,o),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this.a=t[e+3],this}toArray(t=[0,0,0,0],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),t.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const vi=new Wt,Ja={h:0,s:0,l:0};class P{isVector2=!0;x=0;y=0;z;constructor(t=0,e=0,i){this.x=t,this.y=e,this.z=i||0}static isZero(t){return t.x===0&&t.y===0}static isEmpty(t){return!Number.isFinite(t.x)&&!Number.isFinite(t.y)}static equals(t,e,i=!0){return i?t.x===e.x&&t.y===e.y:Math.abs(t.x-e.x)<Number.EPSILON&&Math.abs(t.y-e.y)<Number.EPSILON}static getInt32Array(t,e=2){const i=new ArrayBuffer(t.length*e*4),a=new Int32Array(i);for(let o=0,l=t.length;o<l;o++)a[o*2]=t[o].x,a[o*2+1]=t[o].y;return a}static getFloat64Array(t,e=2){const i=new ArrayBuffer(t.length*e*8),a=new Float64Array(i);for(let o=0,l=t.length;o<l;o++)a[o*2]=t[o].x,a[o*2+1]=t[o].y;return a}static getVectors(t){const e=[];for(let i=0,a=t.length;i<a;i++)e.push(new P(t[i].x,t[i].y));return e}static getStrings(t){const e=[];if(!t||!t.length)return"";for(let i=0,a=t.length;i<a;i++)e.push(P.getString(t[i]));return e.join(",")}static getString(t){return`${t.x},${t.y}`}static getLength(t){return Math.sqrt(t.x*t.x+t.y*t.y)}static getDistance(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static sub(t,e){return new P().subVectors(t,e)}static isPointOnSegment(t,e,i){return Dc(this.sub(t,i).cross(this.sub(e,i)))===0&&Dc(this.sub(t,i).dot(this.sub(e,i)))<=0}static angle(t,e,i){return i?Math.atan2(t.y-e.y,t.x-e.x):a0(Math.atan2(t.y-e.y,t.x-e.x))}static getSamplingPoints(t,e=100){let i=this.getClothoidPoints(t,e),a=0;for(let o=0,l=i.length;o<l;o++){let c=Math.max(0,o-1);o>0?a+=this.getDistance(i[c],i[c+1]):a=0,i[o].l=Math.round(a);let f=this.angle(i[c+1],i[c]);i[o].a=Math.round(f*100)/100}return i}static getClothoidPoints(t,e=100){let i=[],a=t.concat([]);if(!a||a.length<2)return i;a.length===2?(a.push(a[1]),a.unshift(a[0])):a.length===3&&a.splice(2,0,a[1]);for(let o=0;o<a.length-3;o+=3){let l=new P(a[o].x,a[o].y),c=new P(a[o+1].x,a[o+1].y),f=new P(a[o+2].x,a[o+2].y),d=new P(a[o+3].x,a[o+3].y),g=0;g+=l.distanceTo(c),g+=c.distanceTo(f),g+=f.distanceTo(d);let E=Math.min(.5,1/(g/e));for(let _=E;_<1;_+=E){let C=3*(c.x-l.x),R=3*(f.x-c.x)-C,L=d.x-l.x-C-R,N=3*(c.y-l.y),I=3*(f.y-c.y)-N,W=d.y-l.y-N-I,G=L*Math.pow(_,3)+R*Math.pow(_,2)+C*_+l.x,b=W*Math.pow(_,3)+I*Math.pow(_,2)+N*_+l.y;i.push({x:Math.round(G),y:Math.round(b),a:0,l:0})}}return i.unshift({x:a[0].x,y:a[0].y,a:0,l:0}),i.push({x:a[a.length-1].x,y:a[a.length-1].y,a:0,l:0}),i}static getClothoidLength(t){let e=0;if(t.length>2)for(let i=0;i<t.length;i++){let a=Math.max(0,i-1);i>0&&(e+=this.getDistance(t[a],t[a+1]))}return e}static getCircleCenterByChord(t,e,i,a=!0,o=new P){const l=this.getDistance(t,e);if(l===0)return o.x=1/0,o.y=1/0,o;Bu.set((t.x+e.x)/2,(t.y+e.y)/2);const c=Math.sqrt(i*i-l*l/4),f=a?-1:1;return o.x=Bu.x+f*c*(e.y-t.y)/l,o.y=Bu.y-f*c*(e.x-t.x)/l,o}static isPointInCircle(t,e,i){return this.getDistance(i,t)<e}static isPointInConvexHull(t,e){let i=!1;const a=e.length;for(let o=0,l=a-1;o<a;l=o++){const c=e[o],f=e[l];if(Math.min(c.x,f.x)<=t.x&&t.x<=Math.max(c.x,f.x)&&Math.min(c.y,f.y)<=t.y&&t.y<=Math.max(c.y,f.y)){const d=(f.x-c.x)*(t.y-c.y)-(f.y-c.y)*(t.x-c.x);if(Math.abs(d)<1e-12)return!0}c.y>t.y!=f.y>t.y&&t.x<(f.x-c.x)*(t.y-c.y)/(f.y-c.y)+c.x&&(i=!i)}return i}static isPointInPolygonByRay(t,e){let i=0;const a=new P().copy(t),o=new P,l=new P;for(let c=0;c<e.length;c++){c===e.length-1?(o.copy(e[c]),l.copy(e[0])):(o.copy(e[c]),l.copy(e[c+1]));let f=[o.y,l.y].sort((d,g)=>d-g);f[0]<a.y&&f[1]>a.y&&(o.x<a.x||l.x<a.x)&&i++}return i%2===1}static getIntersectionOfSegments(t,e,i,a,o=!1,l=new P){const c=(a.y-i.y)*(e.x-t.x)-(a.x-i.x)*(e.y-t.y);if(c===0)return l.makeEmpty();const f=(a.x-i.x)*(t.y-i.y)-(a.y-i.y)*(t.x-i.x),d=(e.x-t.x)*(t.y-i.y)-(e.y-t.y)*(t.x-i.x),g=f/c,E=d/c;return o&&(g<0||g>1||E<0||E>1)?l.makeEmpty():(l.x=t.x+g*(e.x-t.x),l.y=t.y+g*(e.y-t.y),l)}static getConvexHullByGrahamScan(t,e=!1,i=[]){if(!t||!t.length)return i;const a=t.length;let o=0;for(let f=0;f<a;f++)t[f].x<t[o].x&&(o=f);let l=o,c;do{i.push(t[l]),c=(l+1)%a;for(let f=0;f<a;f++)this.whichSideOfSegment(t[l],t[f],t[c])>0&&(c=f);l=c}while(l!==o);return e&&i.push(t[o]),i}static whichSideOfSegment(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}static getPointsWithMatrix3(t,e){const i=[];if(!t)return i;for(let a=0,o=t.length;a<o;a++)i.push({x:e.elements[0]*t[a].x+e.elements[3]*t[a].y+e.elements[6],y:e.elements[1]*t[a].x+e.elements[4]*t[a].y+e.elements[7]});return i}static getPointsApplyMatrix3(t,e=[]){for(let i=0,a=e.length;i<a;i++){const o=t.elements[0]*e[i].x+t.elements[3]*e[i].y+t.elements[6],l=t.elements[1]*e[i].x+t.elements[4]*e[i].y+t.elements[7];e[i].x=o,e[i].y=l}return e}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(t){const e=this.x,i=this.y,a=t.elements;return this.x=a[0]*e+a[3]*i+a[6],this.y=a[1]*e+a[4]*i+a[7],this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clone(){return new P(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}cross(t){return this.x*t.y-this.y*t.x}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}dot(t){return this.x*t.x+this.y*t.y}equals(t,e=!0){return e?t.x===this.x&&t.y===this.y:Math.abs(t.x-this.x)<Number.EPSILON&&Math.abs(t.y-this.y)<Number.EPSILON}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}floorToZero(){return this.roundToZero()}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+t)}}identity(){return this.set(0,0)}isEmpty(){return!Number.isFinite(this.x)&&!Number.isFinite(this.y)}isZero(){return this.x===0&&this.y===0}length(){return Math.sqrt(this.dot(this))}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}maxXY(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}minXY(t,e){return this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t,e){return this.x*=t,this.y*=e||t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(t){return this.applyMatrix3(t.matrixWorldInverse).applyMatrix3(t.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(t){const e=Math.cos(t),i=Math.sin(t),a=this.x,o=this.y;return this.x=a*e-o*i,this.y=a*i+o*e,this}rotateAround(t,e){const i=Math.cos(e),a=Math.sin(e),o=this.x-t.x,l=this.y-t.y;return this.x=o*i-l*a+t.x,this.y=o*a+l*i+t.y,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}set(t,e){return this.x=t,this.y=e,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("out of range: "+t)}return this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*3)}setLength(t){return this.normalize().multiplyScalar(t)}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(t,e=!1){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}}const Bu=new P,l0=Object.freeze(Object.defineProperty({__proto__:null,default:P},Symbol.toStringTag,{value:"Module"}));var to={exports:{}};/**
|
|
6
6
|
* @license
|
|
7
7
|
* Lodash <https://lodash.com/>
|
|
8
8
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
@@ -31,7 +31,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
31
31
|
}`;var At=xg(function(){return Mt(v,nt+"return "+$).apply(e,A)});if(At.source=$,bh(At))throw At;return At}function tb(n){return It(n).toLowerCase()}function eb(n){return It(n).toUpperCase()}function rb(n,s,u){if(n=It(n),n&&(u||s===e))return Sp(n);if(!n||!(s=pr(s)))return n;var h=Gr(n),p=Gr(s),v=Op(h,p),A=Lp(h,p)+1;return xn(h,v,A).join("")}function ib(n,s,u){if(n=It(n),n&&(u||s===e))return n.slice(0,Mp(n)+1);if(!n||!(s=pr(s)))return n;var h=Gr(n),p=Lp(h,Gr(s))+1;return xn(h,0,p).join("")}function nb(n,s,u){if(n=It(n),n&&(u||s===e))return n.replace(Aa,"");if(!n||!(s=pr(s)))return n;var h=Gr(n),p=Op(h,Gr(s));return xn(h,p).join("")}function sb(n,s){var u=rt,h=J;if(Kt(s)){var p="separator"in s?s.separator:p;u="length"in s?mt(s.length):u,h="omission"in s?pr(s.omission):h}n=It(n);var v=n.length;if(_s(n)){var A=Gr(n);v=A.length}if(u>=v)return n;var T=u-Cs(h);if(T<1)return h;var S=A?xn(A,0,T).join(""):n.slice(0,T);if(p===e)return S+h;if(A&&(T+=S.length-T),Th(p)){if(n.slice(T).search(p)){var V,z=S;for(p.global||(p=Ul(p.source,It(ba.exec(p))+"g")),p.lastIndex=0;V=p.exec(z);)var $=V.index;S=S.slice(0,$===e?T:$)}}else if(n.indexOf(pr(p),T)!=T){var Q=S.lastIndexOf(p);Q>-1&&(S=S.slice(0,Q))}return S+h}function ab(n){return n=It(n),n&&lr.test(n)?n.replace(wr,Rv):n}var ob=Bs(function(n,s,u){return n+(u?" ":"")+s.toUpperCase()}),Dh=Ed("toUpperCase");function vg(n,s,u){return n=It(n),s=u?e:s,s===e?Lv(n)?kv(n):Av(n):n.match(s)||[]}var xg=wt(function(n,s){try{return cr(n,e,s)}catch(u){return bh(u)?u:new gt(u)}}),ub=ki(function(n,s){return Cr(s,function(u){u=pi(u),Pi(n,u,Ah(n[u],n))}),n});function lb(n){var s=n==null?0:n.length,u=ut();return n=s?Yt(n,function(h){if(typeof h[1]!="function")throw new Dr(l);return[u(h[0]),h[1]]}):[],wt(function(h){for(var p=-1;++p<s;){var v=n[p];if(cr(v[0],this,h))return cr(v[1],this,h)}})}function hb(n){return R1(Or(n,E))}function Sh(n){return function(){return n}}function cb(n,s){return n==null||n!==n?s:n}var fb=wd(),pb=wd(!0);function ir(n){return n}function Oh(n){return jp(typeof n=="function"?n:Or(n,E))}function db(n){return td(Or(n,E))}function gb(n,s){return ed(n,Or(s,E))}var yb=wt(function(n,s){return function(u){return Pa(u,n,s)}}),mb=wt(function(n,s){return function(u){return Pa(n,u,s)}});function Lh(n,s,u){var h=Ae(s),p=Zo(s,h);u==null&&!(Kt(s)&&(p.length||!h.length))&&(u=s,s=n,n=this,p=Zo(s,Ae(s)));var v=!(Kt(u)&&"chain"in u)||!!u.chain,A=Ui(n);return Cr(p,function(T){var S=s[T];n[T]=S,A&&(n.prototype[T]=function(){var V=this.__chain__;if(v||V){var z=n(this.__wrapped__),$=z.__actions__=tr(this.__actions__);return $.push({func:S,args:arguments,thisArg:n}),z.__chain__=V,z}return S.apply(n,pn([this.value()],arguments))})}),n}function vb(){return Te._===this&&(Te._=zv),this}function Nh(){}function xb(n){return n=mt(n),wt(function(s){return rd(s,n)})}var Eb=uh(Yt),Ab=uh(bp),wb=uh(Bl);function Eg(n){return gh(n)?Il(pi(n)):j1(n)}function bb(n){return function(s){return n==null?e:$n(n,s)}}var Tb=Td(),_b=Td(!0);function Mh(){return[]}function Bh(){return!1}function Cb(){return{}}function Db(){return""}function Sb(){return!0}function Ob(n,s){if(n=mt(n),n<1||n>Bt)return[];var u=ue,h=Be(n,ue);s=ut(s),n-=ue;for(var p=Fl(h,s);++u<n;)s(u);return p}function Lb(n){return yt(n)?Yt(n,pi):dr(n)?[n]:tr(Ud(It(n)))}function Nb(n){var s=++Wv;return It(n)+s}var Mb=eu(function(n,s){return n+s},0),Bb=lh("ceil"),Ib=eu(function(n,s){return n/s},1),Rb=lh("floor");function Pb(n){return n&&n.length?Xo(n,ir,Xl):e}function Fb(n,s){return n&&n.length?Xo(n,ut(s,2),Xl):e}function kb(n){return Cp(n,ir)}function Hb(n,s){return Cp(n,ut(s,2))}function Ub(n){return n&&n.length?Xo(n,ir,jl):e}function qb(n,s){return n&&n.length?Xo(n,ut(s,2),jl):e}var Wb=eu(function(n,s){return n*s},1),Vb=lh("round"),zb=eu(function(n,s){return n-s},0);function $b(n){return n&&n.length?Pl(n,ir):0}function Gb(n,s){return n&&n.length?Pl(n,ut(s,2)):0}return m.after=dA,m.ary=Kd,m.assign=ew,m.assignIn=cg,m.assignInWith=du,m.assignWith=rw,m.at=iw,m.before=jd,m.bind=Ah,m.bindAll=ub,m.bindKey=Jd,m.castArray=CA,m.chain=Xd,m.chunk=Rx,m.compact=Px,m.concat=Fx,m.cond=lb,m.conforms=hb,m.constant=Sh,m.countBy=$E,m.create=nw,m.curry=tg,m.curryRight=eg,m.debounce=rg,m.defaults=sw,m.defaultsDeep=aw,m.defer=gA,m.delay=yA,m.difference=kx,m.differenceBy=Hx,m.differenceWith=Ux,m.drop=qx,m.dropRight=Wx,m.dropRightWhile=Vx,m.dropWhile=zx,m.fill=$x,m.filter=YE,m.flatMap=QE,m.flatMapDeep=KE,m.flatMapDepth=jE,m.flatten=zd,m.flattenDeep=Gx,m.flattenDepth=Yx,m.flip=mA,m.flow=fb,m.flowRight=pb,m.fromPairs=Xx,m.functions=pw,m.functionsIn=dw,m.groupBy=JE,m.initial=Qx,m.intersection=Kx,m.intersectionBy=jx,m.intersectionWith=Jx,m.invert=yw,m.invertBy=mw,m.invokeMap=eA,m.iteratee=Oh,m.keyBy=rA,m.keys=Ae,m.keysIn=rr,m.map=uu,m.mapKeys=xw,m.mapValues=Ew,m.matches=db,m.matchesProperty=gb,m.memoize=hu,m.merge=Aw,m.mergeWith=fg,m.method=yb,m.methodOf=mb,m.mixin=Lh,m.negate=cu,m.nthArg=xb,m.omit=ww,m.omitBy=bw,m.once=vA,m.orderBy=iA,m.over=Eb,m.overArgs=xA,m.overEvery=Ab,m.overSome=wb,m.partial=wh,m.partialRight=ig,m.partition=nA,m.pick=Tw,m.pickBy=pg,m.property=Eg,m.propertyOf=bb,m.pull=iE,m.pullAll=Gd,m.pullAllBy=nE,m.pullAllWith=sE,m.pullAt=aE,m.range=Tb,m.rangeRight=_b,m.rearg=EA,m.reject=oA,m.remove=oE,m.rest=AA,m.reverse=xh,m.sampleSize=lA,m.set=Cw,m.setWith=Dw,m.shuffle=hA,m.slice=uE,m.sortBy=pA,m.sortedUniq=gE,m.sortedUniqBy=yE,m.split=Qw,m.spread=wA,m.tail=mE,m.take=vE,m.takeRight=xE,m.takeRightWhile=EE,m.takeWhile=AE,m.tap=PE,m.throttle=bA,m.thru=ou,m.toArray=ug,m.toPairs=dg,m.toPairsIn=gg,m.toPath=Lb,m.toPlainObject=hg,m.transform=Sw,m.unary=TA,m.union=wE,m.unionBy=bE,m.unionWith=TE,m.uniq=_E,m.uniqBy=CE,m.uniqWith=DE,m.unset=Ow,m.unzip=Eh,m.unzipWith=Yd,m.update=Lw,m.updateWith=Nw,m.values=Ps,m.valuesIn=Mw,m.without=SE,m.words=vg,m.wrap=_A,m.xor=OE,m.xorBy=LE,m.xorWith=NE,m.zip=ME,m.zipObject=BE,m.zipObjectDeep=IE,m.zipWith=RE,m.entries=dg,m.entriesIn=gg,m.extend=cg,m.extendWith=du,Lh(m,m),m.add=Mb,m.attempt=xg,m.camelCase=Pw,m.capitalize=yg,m.ceil=Bb,m.clamp=Bw,m.clone=DA,m.cloneDeep=OA,m.cloneDeepWith=LA,m.cloneWith=SA,m.conformsTo=NA,m.deburr=mg,m.defaultTo=cb,m.divide=Ib,m.endsWith=Fw,m.eq=Xr,m.escape=kw,m.escapeRegExp=Hw,m.every=GE,m.find=XE,m.findIndex=Wd,m.findKey=ow,m.findLast=ZE,m.findLastIndex=Vd,m.findLastKey=uw,m.floor=Rb,m.forEach=Zd,m.forEachRight=Qd,m.forIn=lw,m.forInRight=hw,m.forOwn=cw,m.forOwnRight=fw,m.get=_h,m.gt=MA,m.gte=BA,m.has=gw,m.hasIn=Ch,m.head=$d,m.identity=ir,m.includes=tA,m.indexOf=Zx,m.inRange=Iw,m.invoke=vw,m.isArguments=Xn,m.isArray=yt,m.isArrayBuffer=IA,m.isArrayLike=er,m.isArrayLikeObject=ie,m.isBoolean=RA,m.isBuffer=En,m.isDate=PA,m.isElement=FA,m.isEmpty=kA,m.isEqual=HA,m.isEqualWith=UA,m.isError=bh,m.isFinite=qA,m.isFunction=Ui,m.isInteger=ng,m.isLength=fu,m.isMap=sg,m.isMatch=WA,m.isMatchWith=VA,m.isNaN=zA,m.isNative=$A,m.isNil=YA,m.isNull=GA,m.isNumber=ag,m.isObject=Kt,m.isObjectLike=te,m.isPlainObject=Wa,m.isRegExp=Th,m.isSafeInteger=XA,m.isSet=og,m.isString=pu,m.isSymbol=dr,m.isTypedArray=Rs,m.isUndefined=ZA,m.isWeakMap=QA,m.isWeakSet=KA,m.join=tE,m.kebabCase=Uw,m.last=Nr,m.lastIndexOf=eE,m.lowerCase=qw,m.lowerFirst=Ww,m.lt=jA,m.lte=JA,m.max=Pb,m.maxBy=Fb,m.mean=kb,m.meanBy=Hb,m.min=Ub,m.minBy=qb,m.stubArray=Mh,m.stubFalse=Bh,m.stubObject=Cb,m.stubString=Db,m.stubTrue=Sb,m.multiply=Wb,m.nth=rE,m.noConflict=vb,m.noop=Nh,m.now=lu,m.pad=Vw,m.padEnd=zw,m.padStart=$w,m.parseInt=Gw,m.random=Rw,m.reduce=sA,m.reduceRight=aA,m.repeat=Yw,m.replace=Xw,m.result=_w,m.round=Vb,m.runInContext=D,m.sample=uA,m.size=cA,m.snakeCase=Zw,m.some=fA,m.sortedIndex=lE,m.sortedIndexBy=hE,m.sortedIndexOf=cE,m.sortedLastIndex=fE,m.sortedLastIndexBy=pE,m.sortedLastIndexOf=dE,m.startCase=Kw,m.startsWith=jw,m.subtract=zb,m.sum=$b,m.sumBy=Gb,m.template=Jw,m.times=Ob,m.toFinite=qi,m.toInteger=mt,m.toLength=lg,m.toLower=tb,m.toNumber=Mr,m.toSafeInteger=tw,m.toString=It,m.toUpper=eb,m.trim=rb,m.trimEnd=ib,m.trimStart=nb,m.truncate=sb,m.unescape=ab,m.uniqueId=Nb,m.upperCase=ob,m.upperFirst=Dh,m.each=Zd,m.eachRight=Qd,m.first=$d,Lh(m,function(){var n={};return ci(m,function(s,u){Pt.call(m.prototype,u)||(n[u]=s)}),n}(),{chain:!1}),m.VERSION=i,Cr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){m[n].placeholder=m}),Cr(["drop","take"],function(n,s){Tt.prototype[n]=function(u){u=u===e?1:ge(mt(u),0);var h=this.__filtered__&&!s?new Tt(this):this.clone();return h.__filtered__?h.__takeCount__=Be(u,h.__takeCount__):h.__views__.push({size:Be(u,ue),type:n+(h.__dir__<0?"Right":"")}),h},Tt.prototype[n+"Right"]=function(u){return this.reverse()[n](u).reverse()}}),Cr(["filter","map","takeWhile"],function(n,s){var u=s+1,h=u==ft||u==O;Tt.prototype[n]=function(p){var v=this.clone();return v.__iteratees__.push({iteratee:ut(p,3),type:u}),v.__filtered__=v.__filtered__||h,v}}),Cr(["head","last"],function(n,s){var u="take"+(s?"Right":"");Tt.prototype[n]=function(){return this[u](1).value()[0]}}),Cr(["initial","tail"],function(n,s){var u="drop"+(s?"":"Right");Tt.prototype[n]=function(){return this.__filtered__?new Tt(this):this[u](1)}}),Tt.prototype.compact=function(){return this.filter(ir)},Tt.prototype.find=function(n){return this.filter(n).head()},Tt.prototype.findLast=function(n){return this.reverse().find(n)},Tt.prototype.invokeMap=wt(function(n,s){return typeof n=="function"?new Tt(this):this.map(function(u){return Pa(u,n,s)})}),Tt.prototype.reject=function(n){return this.filter(cu(ut(n)))},Tt.prototype.slice=function(n,s){n=mt(n);var u=this;return u.__filtered__&&(n>0||s<0)?new Tt(u):(n<0?u=u.takeRight(-n):n&&(u=u.drop(n)),s!==e&&(s=mt(s),u=s<0?u.dropRight(-s):u.take(s-n)),u)},Tt.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Tt.prototype.toArray=function(){return this.take(ue)},ci(Tt.prototype,function(n,s){var u=/^(?:filter|find|map|reject)|While$/.test(s),h=/^(?:head|last)$/.test(s),p=m[h?"take"+(s=="last"?"Right":""):s],v=h||/^find/.test(s);p&&(m.prototype[s]=function(){var A=this.__wrapped__,T=h?[1]:arguments,S=A instanceof Tt,V=T[0],z=S||yt(A),$=function(bt){var Dt=p.apply(m,pn([bt],T));return h&&Q?Dt[0]:Dt};z&&u&&typeof V=="function"&&V.length!=1&&(S=z=!1);var Q=this.__chain__,nt=!!this.__actions__.length,lt=v&&!Q,At=S&&!nt;if(!v&&z){A=At?A:new Tt(this);var ht=n.apply(A,T);return ht.__actions__.push({func:ou,args:[$],thisArg:e}),new Sr(ht,Q)}return lt&&At?n.apply(this,T):(ht=this.thru($),lt?h?ht.value()[0]:ht.value():ht)})}),Cr(["pop","push","shift","sort","splice","unshift"],function(n){var s=Bo[n],u=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",h=/^(?:pop|shift)$/.test(n);m.prototype[n]=function(){var p=arguments;if(h&&!this.__chain__){var v=this.value();return s.apply(yt(v)?v:[],p)}return this[u](function(A){return s.apply(yt(A)?A:[],p)})}}),ci(Tt.prototype,function(n,s){var u=m[s];if(u){var h=u.name+"";Pt.call(Ls,h)||(Ls[h]=[]),Ls[h].push({name:s,func:u})}}),Ls[tu(e,I).name]=[{name:"wrapper",func:e}],Tt.prototype.clone=a1,Tt.prototype.reverse=o1,Tt.prototype.value=u1,m.prototype.at=FE,m.prototype.chain=kE,m.prototype.commit=HE,m.prototype.next=UE,m.prototype.plant=WE,m.prototype.reverse=VE,m.prototype.toJSON=m.prototype.valueOf=m.prototype.value=zE,m.prototype.first=m.prototype.head,Oa&&(m.prototype[Oa]=qE),m},Ds=Hv();Un?((Un.exports=Ds)._=Ds,Ol._=Ds):Te._=Ds}).call(ks)}(to,to.exports);var h0=to.exports;const Nt=Fh(h0);class _t{isBox2=!0;min;max;constructor(t=new P(1/0,1/0),e=new P(-1/0,-1/0)){this.min=t,this.max=e}applyMatrix3(t){return this.isEmpty()?this:(Qs[0].set(this.min.x,this.min.y).applyMatrix3(t),Qs[1].set(this.min.x,this.max.y).applyMatrix3(t),Qs[3].set(this.max.x,this.max.y).applyMatrix3(t),Qs[2].set(this.max.x,this.min.y).applyMatrix3(t),this.setFromPoints(Qs),this)}clone(){return new _t().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}ceil(){return this.min.ceilToZero(),this.max.ceilToZero(),this}distanceToPoint(t){return ze.copy(t).clamp(this.min,this.max).sub(t).length()}expandByXY(t,e){return this.min.minXY(t,e),this.max.maxXY(t,e),this}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByPoints(t){if(!t||!t.length)return this;for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){return t.updateWorldMatrix(!1,!1),t.geometry.boundingBox!==void 0?((!t.geometry.boundingBox||t.geometry.boundingBox.isEmpty())&&t.computeBoundingBox(),ss.copy(t.geometry.boundingBox),ss.applyMatrix3(t.matrixWorld),this.union(ss)):t.geometry.points&&t.geometry.points.length&&(ss.setFromPoints(t.geometry.points),ss.applyMatrix3(t.matrixWorld),this.union(ss)),this}expandByBox(t){this.expandByPoint(t.min),this.expandByPoint(t.max)}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}floor(){return this.min.floorToZero(),this.max.floorToZero(),this}getCenter(t=new P){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t=new P){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}getPoints(t=[]){return t.length=0,t[0]={x:this.min.x,y:this.min.y},t[1]={x:this.min.x,y:this.max.y},t[2]={x:this.max.x,y:this.max.y},t[3]={x:this.max.x,y:this.min.y},t}getArea(){return this.getSize(ze),ze.x*ze.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}intersectsBox(t){return t?!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y):!1}intersectsObject(t){return!t||!t.geometry?!1:this.intersectsBox(t.geometry.boundingBox)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}round(){return this.min.roundToZero(),this.max.roundToZero(),this}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(ze.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=ze.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromProjectionMatrix(t){return this.min.set(t.elements[6],t.elements[7]),this.max.set(t.elements[6],t.elements[7]),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}setFromMinMaxString(t,e=" "){if(this.makeEmpty(),!(t!=null&&t.length))return this;let i=t.split(e),a=Nt.map(i,o=>parseFloat(o));for(let o=0,l=a.length;o<l;o+=2)this.expandByPoint(ze.fromArray(a,o));return this}translate(t){return this.min.add(t),this.max.add(t),this}toString(){return`{"min":${this.min.toString()},"max":${this.max.toString()}}`}fromString(t){return t?(this.copy(JSON.parse(t)),this):this}union(t){return t.validate()?(this.min.min(t.min),this.max.max(t.max),this):this}validate(){return this.min.validate()&&this.max.validate()}unproject(t){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}centralArrange(t=1,e=20,i=10){const a=e+i;this.getCenter(ze),this.getSize(jr),jr.subScalar(e);const o=Math.floor(jr.x/a),l=Math.ceil(t/o),c=o*a,f=l*a;if(jr.x<a||jr.y<a||c>=jr.x||f>=jr.y)return ze.clone();let g=[],E=0,_=0;for(let C=0;C<t;C++){const R=o>t?t*a:c,L=ze.x-R/2+_*a+a/2,N=ze.y-f/2+E*a+a/2;g.push(new P(L,N)),_++,_>=o&&(_=0,E++)}return g}flipY(){return ze.copy(this.min).multiplyScalar(1,-1),jr.copy(this.max).multiplyScalar(1,-1),this.min.set(ze.x,jr.y),this.max.set(jr.x,ze.y),this}}const ss=new _t,Qs=[new P,new P,new P,new P],ze=new P,jr=new P,c0=Object.freeze(Object.defineProperty({__proto__:null,default:_t},Symbol.toStringTag,{value:"Module"})),f0=kt.window.requestAnimationFrame,Ks=kt.window.performance?()=>kt.window.performance.now():()=>new Date().getTime(),Sc=f0;class Ft{static idCounter=0;static children=[];static isRunning=!1;static actived=!1;static duration=0;static lastTime=Ks();static messages=[];static maxLetters=20;id=Ft.idCounter++;timers=new Map;timersDuration=new Map;counters=new Map;countersAmount=new Map;out=[];constructor(){}static active(t){t?Ft.actived=!0:Ft.actived=!1,Ft.duration=t||0}static add(t){this.children.push(t),this.handleStart()}static remove(t){for(let e=0,i=Ft.children.length;e<i;e++)if(Ft.children[e].id===t.id){this.children.splice(e,1);break}}static handleStart(){this.isRunning||(this.isRunning=!0,Sc(this.runLoop))}static runLoop(){Ft.children.length?(Ft.runFrames(),Sc(Ft.runLoop)):Ft.isRunning=!1}static runFrames(){let t,e=Ks();if(!(e-Ft.lastTime<Ft.duration)){Ft.lastTime=e;for(let i=0,a=this.children.length;i<a;i++)t=this.children[i],t.calculateTimers(),t.calculateCounters(),Ft.messages=Ft.messages.concat(t.out),t.out.length=0;if(Ft.messages.length){if(Ft.actived){let i=[];i.push(p0),i.push(d0),i.push(g0),this.messages.forEach(a=>i.push(A0(a,this.maxLetters))),i.push(y0),console.log(i.join(`
|
|
32
32
|
`))}Ft.messages.length=0}}}destroy(){Ft.remove(this)}addTimer(t,e=Ks(),i=Ks()-(this.timersDuration.get(t)||Ks())){this.addTimerDuration(t,i),this.timersDuration.set(t,e)}addTimerDuration(t,e){var i;this.timers.has(t)||this.timers.set(t,[]),(i=this.timers.get(t))==null||i.push(e)}calculateTimers(){this.timers.forEach((t,e)=>{!t||!t.length||(this.out.push(this.calculateDurations(e,t)),t.length=0)})}addCounterAmount(t,e){var i;this.counters.has(t)||this.counters.set(t,[]),(i=this.counters.get(t))==null||i.push(e)}calculateCounters(){this.counters.forEach((t,e)=>{!t||!t.length||(this.out.push(this.calculateAmounts(e,t)),t.length=0)})}start(){return this.stop(),Ft.add(this),this}stop(){return Ft.remove(this),this}calculateDurations(t,e){const i={name:t,avg:0,min:0,max:0,stdDev:0,count:0,FPS:0};if(!e||!e.length)return i;const a=e.length,{min:o,max:l,avg:c}=this.minMaxAvg(e),f=parseFloat(this.stdDev(e,c).toFixed(2));return{name:t,avg:this.fd(c),min:this.fd(o),max:this.fd(l),stdDev:f,count:a,FPS:Math.ceil(a/Ft.duration*1e3)}}calculateAmounts(t,e){const i={name:t,avg:0,min:0,max:0,stdDev:0,count:0,FPS:0};if(!e||!e.length)return i;const a=e.length,{min:o,max:l,avg:c}=this.minMaxAvg(e),f=this.stdDev(e,c);return{name:t,avg:c,min:o,max:l,stdDev:f,count:a,FPS:Math.ceil(a/Ft.duration*1e3)}}minMaxAvg(t){let e=t[0],i=t[0],a=t.length,o=0;for(let c=0;c<t.length;c++){const f=t[c];o+=f,f<e&&(e=f),f>i&&(i=f)}const l=o/a;return{min:this.fx(e),max:this.fx(i),avg:this.fx(l)}}stdDev(t,e){let i=0;for(let o=0;o<t.length;o++){const l=t[o];i+=(l-e)*(l-e)}const a=t.length;return this.fx(Math.sqrt(i/a))}fd(t){return t>1e3?(t/1e3).toFixed(1)+"s":t.toFixed(1)+"ms"}fx(t,e=1){return e===1?Math.round(t*10)/10:e===2?Math.round(t*100)/100:e===3?Math.round(t*1e3)/1e3:t}}const eo=20,ro=["avg","min","max","stdDev","count","FPS"],Jr=v0(ro,1),p0=m0(ro,eo),d0=x0(ro,eo),g0=E0(ro,eo),y0=w0(eo);function m0(r,t=20){let e="┌";e+="─".repeat(t),e+="┬";for(let i=0,a=r.length;i<a;i++)e+="─".repeat(Jr),i<a-1?e+="┬":e+="┐";return e}function v0(r,t=0){let e=0;for(let i=0,a=r.length;i<a;i++)e=Math.max(e,r[i].length);return e+t}function x0(r,t=20){let e="│";e+=" ".repeat(t),e+="│";for(let i=0,a=r.length;i<a;i++)e+=" ".repeat(Math.max(Jr-r[i].length-1,0)),e+=r[i],e+=" │";return e}function E0(r,t=20){let e="├";e+="─".repeat(t),e+="┼";for(let i=0,a=r.length;i<a;i++)e+="─".repeat(Jr),i<a-1?e+="┴":e+="┘";return e}function A0(r,t=20){let e="│";e+=" ".repeat(Math.max(t-r.name.length,0)),e+=r.name,e+="│";const i=typeof r.avg=="string"?Jr-r.avg.length:Jr-r.avg.toString().length;return e+=" ".repeat(Math.max(i,0)),e+=r.avg+" ",e+=" ".repeat(Math.max(Jr-r.min.toString().length,0)),e+=r.min+" ",e+=" ".repeat(Math.max(Jr-r.max.toString().length,0)),e+=r.max+" ",e+=" ".repeat(Math.max(Jr-r.stdDev.toString().length,0)),e+=r.stdDev+" ",e+=" ".repeat(Math.max(Jr-r.count.toString().length,0)),e+=r.count+" ",e+=" ".repeat(Math.max(Jr-r.FPS.toString().length,0)),e+=r.FPS,e}function w0(r=20){let t="└";for(let e=0;e<r;e++)t+="─";return t+="┘",t}var $e=(r=>(r.GROS="gros",r.RM="rm",r.WS="ws",r.SU="su",r.EQ="eq",r.FN="fn",r.GL="gl",r.IP="ip",r))($e||{}),js=(r=>(r.BACKGROUND="background",r.ASSETS="assets",r.ANNOTATIONS="annotations",r.TEXT="text",r.ASSET_LABELS="asset-labels",r.LABELS="labels",r))(js||{});const as="ae",Oc="-",Iu="rm-assets",b0="rm-labels",Lc="ws-assets",Nc="ws-labels";function os(r){return r+Oc+js.ASSETS}function Js(r){return r+Oc+js.LABELS}const Mc={rm:["su-assets","su-labels","eq-assets","eq-labels","fn-assets","fn-labels"],ws:["su-assets","su-labels","eq-assets","eq-labels","fn-assets","fn-labels"],su:[Iu,b0,Lc,Nc,"eq-assets","eq-labels","fn-assets","fn-labels"],eq:[Lc,Nc,"su-assets","su-labels","fn-assets","fn-labels"]};class Ge{_listeners=new Map;destroy(){this._listeners.clear()}addEventListener(t,e){let i=this._listeners.get(t);i||(i=[],this._listeners.set(t,i)),i.includes(e)||i.push(e)}addEventListeners(t,e){const i=t.split(","),a=i.length;for(let o=0;o<a;o++)this.addEventListener(i[o].trim(),e)}isListening(t){var e;return this._listeners.has(t)&&!!((e=this._listeners.get(t))!=null&&e.length)}hasEventListener(t,e){var i;return this._listeners.size===0?!1:this._listeners.has(t)&&!!((i=this._listeners.get(t))!=null&&i.includes(e))}removeEventListener(t,e){const i=this._listeners.get(t);if(i){const a=i.indexOf(e);a>-1&&i.splice(a,1)}}dispatchEvent(t){const e=this._listeners.get(t.type);if(e){t.target=this;const i=e.slice(0);for(let a=0,o=i.length;a<o;a++)i[a].call(this,t);t.target=void 0}}dispatchEventAsync(t){const e=this._listeners.get(t.type);e&&setTimeout(()=>{for(const i of e)i.call(this,t)})}}function Ru(r,t="http://www.w3.org/2000/svg"){var e,i;return(i=(e=kt.window)==null?void 0:e.document)==null?void 0:i.createElementNS(t,r)}async function Pu(r=2e3){return new Promise(t=>setTimeout(t,(Math.random()+.5)*r))}function Bc(r,t=[]){var e,i;return!r||!r.value||(t.push(r.value),(e=r.children)!=null&&e.length&&((i=r.children)==null||i.forEach(a=>Bc(a,t)))),t}function Ic(r){if(!r)return"inches";let t=r.querySelector("#defaultView"),e=t==null?void 0:t.getAttribute("units");return e||"inches"}function T0(r){if(!r)return 1;let t=Ic(r),e=1;switch(t){case"mm":e=500/39.3701;break;case"cm":e=50/39.3701;break;case"Metres":e=.5/39.3701;break;case"m":e=.5/39.3701;break;default:e=1}return e}function _0(r,t=new _t){if(!r)return t;let e=r.split(" "),i=Nt.map(e,a=>parseFloat(a));return(i==null?void 0:i.length)!==4||(t.min.set(i[0],i[1]),t.max.set(i[0]+i[2],i[1]+i[3])),t}function C0(r=new _t){let t="";const e=[];return e.push(r.min.x),e.push(r.min.y),e.push(Math.abs(r.max.x-r.min.x)),e.push(Math.abs(r.max.y-r.min.y)),t=e.join(" "),t}function Rc(r){var t;if((t=r==null?void 0:r.children)!=null&&t.length){for(let e=0,i=r.children.length;e<i;e++)if(r.children[e].nodeName==="g")return r.children[e]}}const D0=new Ft().start();class S0 extends Ge{isSvgRenderer=!0;id;params;container=kt.window.document.getElementsByTagName("body")[0];cameraVersion=-1;viewAreaLimit=-1;constructor(t){super(),this.id="SvgRenderer@"+Date.now(),this.params=t,kt.config=t,this.initSvg(),Ft.active(this.params.monitorDuration)}destroy(){Ft.active(0)}initSvg(){if(this.params.containerId&&(this.container=kt.window.document.getElementById(this.params.containerId)),this.container||(this.container=kt.window.document.getElementsByTagName("body")[0]),!this.params.width||!this.params.height){const t=this.container.getBoundingClientRect();this.params.width=t.width,this.params.height=t.height}this.container.style.overflow="hidden",this.container.style.transform="translateZ(0)",this.setSize(this.params.width,this.params.height)}resize(){var d,g;const t=((d=this.container)==null?void 0:d.parentElement)||document.body,e=t.getBoundingClientRect();if(!e)return;const i=window.getComputedStyle(t),a=e.width-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight),o=e.height-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom),l=(g=this.container)==null?void 0:g.getBoundingClientRect();if(!l)return;const c=a-l.left+e.left,f=o-l.top+e.top;this.setSize(c,f)}setSize(t,e){this.container.style.width=t+"px",this.container.style.height=e+"px",this.params.width=t,this.params.height=e,this.params.camera||(this.params.camera={}),this.params.camera.width=this.params.width,this.params.camera.height=this.params.height,this.params.aspect=this.params.width/this.params.height,this.params.camera.aspect=this.params.aspect,this.params.camera.left=this.params.width*-.5,this.params.camera.right=this.params.width*.5,this.params.camera.top=this.params.height*.5,this.params.camera.bottom=this.params.height*-.5}getSize(t){return t.set(this.params.width,this.params.height)}clean(){}async render(t,e){var a;if(!t||!e||this.cameraVersion===(e==null?void 0:e.version))return;e.updateMatrixWorld(),Fc.set(0,0).unproject(e),kc.set(this.params.width,this.params.height).unproject(e),Pc.setFromPoints([Fc,kc]);let i=C0(Pc);(a=t.svg)==null||a.setAttribute("viewBox",i),this.cameraVersion=e.version||-1,D0.addTimer("render cycle")}autoClear;getRenderTarget(){}setRenderTarget(t){}renderTexture(t,e){}}const Pc=new _t,Fc=new P,kc=new P;class se{isMatrix3=!0;elements=[1,0,0,0,1,0,0,0,1];constructor(){}static equals(t,e,i=1e-6){if(t.elements.length!=e.elements.length)return!1;for(let a=0,o=t.elements.length;a<o;a++){const l=t.elements[a]-e.elements[a];if(Math.abs(l)>i)return!1}return!0}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}clone(){return new se().fromArray(this.elements)}compose(t,e,i){const a=Math.sin(e.x),o=Math.cos(e.x);return this.set(i.x*o,i.y*a*-1,t.x,i.x*a,i.y*o,t.y,0,0,1)}composeWithCenter(t,e,i,a){return Rr.identity(),io.makeTranslation(t.x,t.y),ta.makeRotation(e.x),wn.makeScale(i.x,i.y),we.copy(a).applyMatrix3(wn),Rr.multiply(Fu.makeTranslation(-we.x,-we.y)).multiply(io).multiply(Fu.makeTranslation(we.x,we.y)).multiply(ta).multiply(Fu.makeTranslation(-we.x,-we.y)).multiply(wn),this.copy(Rr)}decompose(t,e,i){const a=Rr.copy(this).elements,o=Math.sqrt(a[0]*a[0]+a[3]*a[3]),l=Math.sqrt(a[1]*a[1]+a[4]*a[4]),c=a[0]*a[4]-a[3]*a[1];a[0]||a[3]?i.set(o,c/o):a[1]||a[4]?i.set(c/l,l):i.set(0,0);let f=0;a[0]||a[3]?f=a[3]>0?-Math.acos(a[0]/o):Math.acos(a[0]/o):a[1]||a[4]?f=Math.PI/2-(a[4]>0?Math.acos(-a[1]/l):-Math.acos(a[1]/l)):f=0,f!==0&&i.y<0&&(f*=-1),e.set(f,f),t.set(a[6],a[7])}compose2(t,e,i){return this.identity().translate(t.x,t.y).rotate(e.x).scale(i.x,i.y),this}decompose2(t,e,i){const a=this.clone();a.scale(-1,1);const o=a.elements[0],l=a.elements[1],c=a.elements[3],f=a.elements[4];let d=0,g=0,E=0;if(o!==0||c!==0){const _=Math.hypot(o,c);d=_,g=(o*f-l*c)/_;const C=Math.acos(o/_);E=c>0?-C:C}else if(l!==0||f!==0){const _=Math.hypot(l,f);d=(o*f-l*c)/_,g=_;const C=Math.acos(l/_);E=Math.PI/2+(f>0?-C:C)}else d=0,g=0,E=0;d=-d,t.x=a.elements[6],t.y=a.elements[7],e.x=e.y=E/Math.PI/180,i.x=d,i.y=g}composeSvgTransform(t=0,e=0,i,a=!1){if(!i&&!t&&!e)return this;this.identity(),Rr.identity();let o=i==null?void 0:i.split(") ").map(l=>l.trim()+")").filter(l=>l!==")");return o||(o=[]),(t||e)&&o.push(`translate(${t},${e})`),o.forEach(l=>{const c=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(l),f=/rotate\(\s*(-?\d*\.?\d+)(?:[ ,](-?\d*\.?\d+)(?:[ ,](-?\d*\.?\d+))?)?\s*\)/.exec(l),d=/translate\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(l);if(c){const g=Number(c[1])||1,E=Number(c[2])||g;Rr.multiply(wn.makeScale(g,E))}else if(f){const g=n0(Number(f[1])||0);Number(f[2])||Number(f[3])?(De.set(Number(f[2]||"0"),Number(f[3]||"0")),Rr.multiply(ta.makeRotationByPoint(g,De))):Rr.multiply(ta.makeRotation(g))}else d&&Rr.multiply(io.makeTranslation(Number(d[1])||0,Number(d[2])||0))}),this.copy(Rr),a&&this.premultiply(wn.makeScale(1,-1)),this}decomposeSvgMatrix(t,e,i){const a=Rr.copy(this).elements;De.set(a[0],a[1]),we.set(a[3],a[4]);let o=De.length();De.normalize();let l=De.dot(we);Hc.copy(De).multiplyScalar(-l),we.add(Hc);const c=we.length()||0;we.normalize(),De.x*we.y<we.x*De.y&&(De.x=-De.x,De.y=-De.y,o=-o,l=-l);const f=o?Math.atan2(De.y,De.x):Math.atan2(-De.x,we.y);t.set(a[6],a[7]),e.set(f,f),i.set(o,c)}determinant(){const t=this.elements,e=t[0],i=t[3],a=t[6],o=t[1],l=t[4],c=t[7],f=t[2],d=t[5],g=t[8];return e*l*g-e*d*c-o*i*g+o*d*a+f*i*c-f*l*a}equals(t,e=0){const i=this.elements,a=t.elements;for(let o=0;o<9;o++)if(Math.abs(i[o]-a[o])>e)return!1;return!0}extractBasis2(t,e){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),this}flipY(){return this.multiply(wn.makeScale(1,-1))}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}getComponents(t=[1,0,0,1,0,0]){return t[0]=this.elements[0],t[1]=this.elements[1],t[2]=this.elements[3],t[3]=this.elements[4],t[4]=this.elements[6],t[5]=this.elements[7],t}getNormalMatrix(t){return this.setFromMatrix(t).invert().transpose()}getRotation(t){let e=this.elements;const i=Math.sqrt(e[0]*e[0]+e[3]*e[3]),a=Math.sqrt(e[1]*e[1]+e[4]*e[4]);let o=0;e[0]||e[3]?o=e[3]>0?-Math.acos(e[0]/i):Math.acos(e[0]/i):e[1]||e[4]?o=Math.PI/2-(e[4]>0?Math.acos(-e[1]/a):-Math.acos(e[1]/a)):o=0,this.getScale(we),o!==0&&we.x<0&&(o*=-1),t.set(o,o)}getScale(t){let e=this.elements,i=Math.sqrt(e[0]*e[0]+e[1]*e[1]),a=Math.sqrt(e[3]*e[3]+e[4]*e[4]),o=e[0]*e[4]-e[3]*e[1];e[0]||e[1]?t.set(o/a,a):e[3]||e[4]?t.set(i,o/i):t.set(0,0)}getTransition(t){t.set(this.elements[6],this.elements[7])}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}hasChange(){for(let t=0,e=this.elements.length;t<e;t++)if(Math.abs(this.elements[t]-O0[t])>Number.EPSILON)return!0;return!1}invert(){const t=this.elements,e=t[0],i=t[1],a=t[2],o=t[3],l=t[4],c=t[5],f=t[6],d=t[7],g=t[8],E=g*l-c*d,_=c*f-g*o,C=d*o-l*f,R=e*E+i*_+a*C;if(R===0)return this.set(0,0,0,0,0,0,0,0,0);const L=1/R;return t[0]=E*L,t[1]=(a*d-g*i)*L,t[2]=(c*i-a*l)*L,t[3]=_*L,t[4]=(g*e-a*f)*L,t[5]=(a*o-c*e)*L,t[6]=C*L,t[7]=(i*f-d*e)*L,t[8]=(l*e-i*o)*L,this}lookAt(t,e,i){return this.identity().rotate(e.angle()-t.angle()+i.angle())}makeProjection(t,e,i,a,o,l){const c=o/(e-t),f=l/(i-a),d=o/2-(e+t)*c,g=l/2+(i+a)*f;return this.elements[0]=c,this.elements[3]=0,this.elements[6]=d,this.elements[1]=0,this.elements[4]=-f,this.elements[7]=g,this.elements[2]=0,this.elements[5]=0,this.elements[8]=1,this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeRotationByPoint(t,e){const i=Math.cos(t),a=Math.sin(t),o=-e.x*i+e.y*a+e.x,l=-e.x*a-e.y*i+e.y;return this.set(i,-a,o,a,i,l,0,0,1),this}makeRotationFromQuaternion(t){return this.compose(L0,t,N0)}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}multiply(t){return this.multiplyMatrices(this,t)}multiplyMatrices(t,e){const i=t.elements,a=e.elements,o=this.elements,l=i[0],c=i[3],f=i[6],d=i[1],g=i[4],E=i[7],_=i[2],C=i[5],R=i[8],L=a[0],N=a[3],I=a[6],W=a[1],G=a[4],b=a[7],F=a[2],q=a[5],K=a[8];return o[0]=l*L+c*W+f*F,o[3]=l*N+c*G+f*q,o[6]=l*I+c*b+f*K,o[1]=d*L+g*W+E*F,o[4]=d*N+g*G+E*q,o[7]=d*I+g*b+E*K,o[2]=_*L+C*W+R*F,o[5]=_*N+C*G+R*q,o[8]=_*I+C*b+R*K,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}premultiply(t){return this.multiplyMatrices(t,this)}rotate(t){return this.premultiply(ta.makeRotation(-t))}scale(t,e){return this.premultiply(wn.makeScale(t,e))}set(t,e,i,a,o,l,c,f,d){return this.elements[0]=t,this.elements[3]=e,this.elements[6]=i,this.elements[1]=a,this.elements[4]=o,this.elements[7]=l,this.elements[2]=c,this.elements[5]=f,this.elements[8]=d,this}setFromDomMatrix(t){return typeof t.m11<"u"&&typeof t.m21<"u"&&typeof t.m41<"u"&&typeof t.m12<"u"&&typeof t.m22<"u"&&typeof t.m42<"u"&&typeof t.m14<"u"&&typeof t.m24<"u"&&typeof t.m44<"u"?this.set(t.m11,t.m21,t.m41,t.m12,t.m22,t.m42,t.m14,t.m24,t.m44):typeof t.a<"u"&&typeof t.b<"u"&&typeof t.c<"u"&&typeof t.d<"u"&&typeof t.e<"u"&&typeof t.f<"u"&&this.set(t.a,t.c,t.e,t.b,t.d,t.f,0,0,1),this}setFromMatrix(t){const e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this}setUvTransform(t,e,i,a,o,l,c){const f=Math.cos(o),d=Math.sin(o);return this.set(i*f,i*d,-i*(f*l+d*c)+l+t,-a*d,a*f,-a*(-d*l+f*c)+c+e,0,0,1),this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}toString(){return`[${this.elements[0]},${this.elements[1]}, ${this.elements[3]},${this.elements[4]}, ${this.elements[6]},${this.elements[7]}]`}translate(t,e){return this.premultiply(io.makeTranslation(t,e))}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}}const O0=[1,0,0,0,1,0,0,0,1],De=new P,we=new P,Hc=new P,Rr=new se,io=new se,ta=new se,wn=new se,Fu=new se,L0=new P(0,0,0),N0=new P(1,1,1),Se=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Uc=()=>{const r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Se[r&255]+Se[r>>8&255]+Se[r>>16&255]+Se[r>>24&255]+"-"+Se[t&255]+Se[t>>8&255]+"-"+Se[t>>16&15|64]+Se[t>>24&255]+"-"+Se[e&63|128]+Se[e>>8&255]+"-"+Se[e>>16&255]+Se[e>>24&255]+Se[i&255]+Se[i>>8&255]+Se[i>>16&255]+Se[i>>24&255]).toLowerCase()};class qc extends Ge{isObject2=!0;id=M0++;uuid=Uc();name;type="Object2";featureKey="Object2_"+this.id;parent;children=[];up=new P(0,1);position=new P;rotation=new P;scaled=new P(1,1);flipY=!1;selectable=!1;matrix=new se;matrixWorld=new se;matrixWorldInverse=new se;modelViewMatrix=new se;normalMatrix=new se;fixed=!1;dynamically=!1;matrixAutoUpdate=!1;matrixWorldNeedsUpdate=!1;matrixWorldAutoUpdate=!1;composeNode=!1;isInComposeNode=!1;alignCenter=!1;boundingBox=new _t;boundingBoxWorld=new _t;boundingBoxNeedsUpdate=!1;centerPoint=new P;visible=!0;castShadow=!1;receiveShadow=!1;renderOrder=0;animations=[];finalSize;userData={};DefaultUp=new P(0,1);_autoSort=!0;constructor(t={}){super(),t.name!==void 0?this.name=t.name:this.name="Object2",t.flipY!==void 0&&(this.flipY=t.flipY),t.selectable!==void 0&&(this.selectable=t.selectable),t.finalSize!==void 0&&(this.finalSize=t.finalSize),this.setAttrs(t)}_version=0;get version(){return this._version}set version(t){this._version=t}set needsUpdate(t){t&&this._version++}destroy(){super.destroy(),this.clear(),this.removeFromParent(),this.dispatchEvent(Uu)}setPosition(t){return this.position.set(t.x,t.y),this}translate(t,e){this.position.x+=t,this.position.y+=e}setScale(t,e){return this.scaled.set(t,e),this}setRotationFromMatrix(t){t.decompose(ra,this.rotation,Hu)}setRotation(t){return this.rotation.set(t,t),this}rotate(t){this.rotation.x+=t}scale(t,e){e?(this.scaled.x*=t,this.scaled.y*=e):this.scaled.multiplyScalar(t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix3(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix3(ti.copy(this.matrixWorld).invert())}lookAt(t){Wc.copy(t),this.updateWorldMatrix(!0,!1),this.matrixWorld.getTransition(ra),ti.lookAt(ra,Wc,B0),ti.getRotation(bn),this.rotation.set(bn.x,bn.x),this.parent&&(this.parent.matrixWorld.getRotation(bn),this.rotate(bn.x))}applyMatrix3(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.rotation,this.scaled)}updateMatrix(){ku.copy(this.scaled),this.flipY&&(ku.y*=-1),this.matrix.compose(this.position,this.rotation,ku),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent?this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldInverse.copy(this.matrixWorld).invert(),this.matrixWorldNeedsUpdate=!1,t=!0,this.boundingBoxNeedsUpdate=!0);const e=this.children;for(let i=0,a=e.length;i<a;i++)e[i].updateMatrixWorld(t);this.boundingBoxNeedsUpdate&&(this.updateBoundingBox(),this.boundingBoxNeedsUpdate=!1)}updateWorldMatrix(t=!1,e=!1){const i=this.parent;if(t&&i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent?this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldInverse.copy(this.matrixWorld).invert(),e){const a=this.children;for(let o=0,l=a.length;o<l;o++)a[o].updateWorldMatrix(!1,!0)}}updateModelViewMatrix(t){ti.copy(this.matrixWorld),t&&this.fixed?this.modelViewMatrix.copy(t.projectionMatrix):t?this.modelViewMatrix.multiplyMatrices(t.viewMatrix,ti):this.modelViewMatrix.copy(ti);for(let e=0,i=this.children.length;e<i;e++)this.children[e].updateModelViewMatrix(t)}computeBoundingBox(){this.boundingBox.makeEmpty(),this.centerPoint.set(0,0);for(let t=0,e=this.children.length;t<e;t++)this.children[t].updateMatrixWorld(),ea.copy(this.children[t].computeBoundingBox()),ea.applyMatrix3(ti.copy(this.children[t].matrixWorld)),this.boundingBox.union(ea);return this.boundingBox.applyMatrix3(this.matrixWorldInverse),this.boundingBox}updateBoundingBox(){this.boundingBox.isEmpty()||this.boundingBoxWorld.copy(this.boundingBox).applyMatrix3(this.matrixWorld)}setAttrs(t){if(!t)return this;for(const e in t)if(!(e==="children"||t[e]===void 0)){if(e==="userData"&&t[e]){Object.keys(t[e]).forEach(i=>this.userData[i]=t[e][i]);continue}this.userData[e]=t[e]}return this}add(t){return!t||!t.isObject2||t===this?this:(t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.isInComposeNode=this.composeNode||this.isInComposeNode,t.selectable&&t.parent.setSelectable(t.selectable),this._autoSort&&this.children.sort((e,i)=>e.renderOrder-i.renderOrder),t.dispatchEvent(I0),this.matrixAutoUpdate||(this.matrixWorldNeedsUpdate=!0),this)}adds(t){if(!t||!t.length)return this;this._autoSort=!1;for(let e=0,i=t.length;e<i;e++)e===t.length-1&&(this._autoSort=!0),this.add(t[e]);return this}remove(t){const e=this.children.indexOf(t);return e!==-1&&(t.parent=void 0,this.children.splice(e,1),t.dispatchEvent(Uu)),this}removes(t){for(let e=0,i=t.length;e<i;e++)this.remove(t[e]);return this}removeFromParent(){const t=this.parent;return t&&t.remove(this),this.parent=void 0,this}moveToLast(){const t=this.parent;t&&(this.removeFromParent(),t.add(this))}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=void 0,e.destroy(),e.dispatchEvent(Uu)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),ti.copy(this.matrixWorld).invert(),t.parent&&(t.parent.updateWorldMatrix(!0,!1),ti.multiply(t.parent.matrixWorld)),t.applyMatrix3(ti),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,a=this.children.length;i<a;i++){const l=this.children[i].getObjectByProperty(t,e);if(l!==void 0)return l}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(t,bn,Hu),t}getWorldRotation(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ra,t,Hu),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ra,bn,t),t}getWorldDirection(t){return this.updateWorldMatrix(!0,!1),t.set(this.matrixWorld.elements[6],this.matrixWorld.elements[7]).normalize()}traverse(t){t(this);const e=this.children;for(let i=0,a=e.length;i<a;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible)return;t(this);const e=this.children;for(let i=0,a=e.length;i<a;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e&&(t(e),e.traverseAncestors(t))}onBeforeRender(t,e,i,a){}render(t){}onAfterRender(t,e,i){}setSelectable(t){this.selectable=t,this.parent&&this.parent.setSelectable(t)}raycast(t,e=[]){}getByRange(t,e=!1,i=[]){if(ea.copy(t),ea.containsBox(this.boundingBoxWorld)&&i.push(this),!e||this.composeNode)return i;for(let a=0,o=this.children.length;a<o;a++)this.children[a].getByRange(t,e,i);return i}clone(t=!0,e=!1){const i=this.constructor;return new i(this.userData).copy(this,t,e)}copy(t,e=!0,i=!1){if(this.name=t.name,this.type=t.type,this.featureKey=t.featureKey,this._version=0,this.parent=t.parent,this.up.copy(t.up),this.position.copy(t.position),this.rotation.copy(t.rotation),this.scaled.copy(t.scaled),this.flipY=t.flipY,this.selectable=t.selectable,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.modelViewMatrix.copy(t.modelViewMatrix),this.normalMatrix.copy(t.normalMatrix),this.fixed=t.fixed,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.composeNode=t.composeNode,this.alignCenter=t.alignCenter,this.boundingBox.copy(t.boundingBox),this.boundingBoxWorld.copy(t.boundingBoxWorld),this.boundingBoxNeedsUpdate=t.boundingBoxNeedsUpdate,this.centerPoint.copy(t.centerPoint),this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e)for(let a=0;a<t.children.length;a++){const o=t.children[a];this.add(o.clone(e,i))}return this}}let M0=0;const ku=new P,ti=new se,Wc=new P,ea=new _t,ra=new P,Hu=new P,bn=new P,B0=new P(0,1),I0={type:"added"},Uu={type:"removed"};class R0 extends qc{name="Scene";type="Scene";isScene=!0;view;background;featureKey="Scene_"+this.id;matrixAutoUpdate=!1;constructor(){super()}destroy(){super.destroy(),this.boundingBox.makeEmpty()}setup(t){this.view=t}render(t){var e;this.visible&&((e=this.children)==null||e.forEach(function(i){i.isShape&&i.render(t)}))}getIntersectObjects(t,e=$e.RM,i=[]){throw new Error("must be implemented in derived")}}class P0{isLoading=!1;itemsLoaded=0;itemsTotal=0;urlModifier;handlers=[];onStart;onLoad;onProgress;onError;constructor(t,e,i){this.onLoad=t,this.onProgress=e,this.onError=i}itemStart(t){this.itemsTotal++,this.isLoading||this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(t){this.onError!==void 0&&this.onError(t)}resolveURL(t){return this.urlModifier!==void 0?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,i=this.handlers.length;e<i;e+=2){const a=this.handlers[e],o=this.handlers[e+1];if(a.global&&(a.lastIndex=0),a.test(t))return o}return null}}const Vc={enabled:!1,files:{},add:function(r,t){this.enabled&&(this.files[r]=t)},get:function(r){if(this.enabled)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}},F0=new P0;class zc{manager;crossOrigin="anonymous";withCredentials=!1;path="";resourcePath="";requestHeader={};constructor(t=F0){this.manager=t}loadAsync(t,e){const i=this;return new Promise(function(a,o){i.load(t,a,e,o)})}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const xi={};class k0 extends Error{response;constructor(t,e){super(t),this.response=e}}class H0 extends zc{mimeType;responseType;constructor(t){super(t)}load(t,e,i,a){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const o=Vc.get(t);if(o!==void 0)return this.manager.itemStart(t),setTimeout(()=>{e&&e(o),this.manager.itemEnd(t)},0),o;if(xi[t]!==void 0){xi[t].push({onLoad:e,onProgress:i,onError:a});return}xi[t]=[],xi[t].push({onLoad:e,onProgress:i,onError:a});const l=new kt.window.Request(t,{headers:new kt.window.Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),c=this.mimeType,f=this.responseType;fetch(l).then(d=>{if(d.status===200||d.status===0){if(d.status===0&&console.warn("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||d.body===void 0||d.body.getReader===void 0)return d;const g=xi[t],E=d.body.getReader(),_=d.headers.get("Content-Length")||d.headers.get("X-File-Size"),C=_?parseInt(_):0,R=C!==0;let L=0;const N=new ReadableStream({start(I){W();function W(){E.read().then(({done:G,value:b})=>{if(G)I.close();else{L+=b.byteLength;const F=new ProgressEvent("progress",{lengthComputable:R,loaded:L,total:C});for(let q=0,K=g.length;q<K;q++){const tt=g[q];tt.onProgress&&tt.onProgress(F)}I.enqueue(b),W()}})}}});return new Response(N)}else throw new k0(`fetch for "${d.url}" responded with ${d.status}: ${d.statusText}`,d)}).then(d=>{switch(f){case"arraybuffer":return d.arrayBuffer();case"blob":return d.blob();case"document":return d.text().then(g=>new DOMParser().parseFromString(g,c));case"json":return d.json();default:if(c===void 0)return d.text();{const E=/charset="?([^;"\s]*)"?/i.exec(c),_=E&&E[1]?E[1].toLowerCase():void 0,C=new TextDecoder(_);return d.arrayBuffer().then(R=>C.decode(R))}}}).then(d=>{Vc.add(t,d);const g=xi[t];delete xi[t];for(let E=0,_=g.length;E<_;E++){const C=g[E];C.onLoad&&C.onLoad(d)}}).catch(d=>{const g=xi[t];if(g===void 0)throw this.manager.itemError(t),d;delete xi[t];for(let E=0,_=g.length;E<_;E++){const C=g[E];C.onError&&C.onError(d)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setMimeType(t){return this.mimeType=t,this}setResponseType(t){return this.responseType=t,this}}class $c extends zc{constructor(t){super(t)}load(t,e,i,a){const o=this,l=new H0(o.manager);l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(t,function(c){try{e&&e(c)}catch(f){a?a(f):console.error(f),o.manager.itemError(t)}},i,a)}}function no(r,t,e){if(!r)return e;let i=e;if(typeof r.getAttribute=="function"?i=r==null?void 0:r.getAttribute(t):Object.hasOwnProperty.call(r,"attributes")&&(i=r.attributes[t]),!i)return e;if(typeof e<"u"){if(typeof e=="string")return i;if(typeof e=="number")return Number(i)}return i}function U0(r,t,e,i,a,o,l,c,f){let d=f*(Math.PI/180),g=Math.cos(d)*(r-e)/2+Math.sin(d)*(t-i)/2,E=-1*Math.sin(d)*(r-e)/2+Math.cos(d)*(t-i)/2,_=g*g/(l*l)+E*E/(c*c);_>1&&(l*=Math.sqrt(_),c*=Math.sqrt(_));let C=Math.sqrt((l*l*(c*c)-l*l*(E*E)-c*c*(g*g))/(l*l*(E*E)+c*c*(g*g)));a===o&&(C*=-1),isNaN(C)&&(C=0);let R=C*l*E/c,L=C*-c*g/l,N=(r+e)/2+Math.cos(d)*R-Math.sin(d)*L,I=(t+i)/2+Math.sin(d)*R+Math.cos(d)*L,W=function(Z){return Math.sqrt(Z[0]*Z[0]+Z[1]*Z[1])},G=function(Z,rt){return(Z[0]*rt[0]+Z[1]*rt[1])/(W(Z)*W(rt))},b=function(Z,rt){return(Z[0]*rt[1]<Z[1]*rt[0]?-1:1)*Math.acos(G(Z,rt))},F=b([1,0],[(g-R)/l,(E-L)/c]),q=[(g-R)/l,(E-L)/c],K=[(-1*g-R)/l,(-1*E-L)/c],tt=b(q,K);return G(q,K)<=-1&&(tt=Math.PI),G(q,K)>=1&&(tt=0),o===0&&tt>0&&(tt=tt-2*Math.PI),o===1&&tt<0&&(tt=tt+2*Math.PI),[N,I,l,c,F,tt,d,o]}const ae=" ";function q0(r){let t="";Array.isArray(r)||(r=[r]);for(let e=0;e<r.length;e++){const i=r[e];if(i.type===H.CLOSE_PATH)t+="z";else if(i.type===H.HORIZ_LINE_TO)t+=(i.relative?"h":"H")+i.x;else if(i.type===H.VERT_LINE_TO)t+=(i.relative?"v":"V")+i.y;else if(i.type===H.MOVE_TO)t+=(i.relative?"m":"M")+i.x+ae+i.y;else if(i.type===H.LINE_TO)t+=(i.relative?"l":"L")+i.x+ae+i.y;else if(i.type===H.CURVE_TO)t+=(i.relative?"c":"C")+i.x1+ae+i.y1+ae+i.x2+ae+i.y2+ae+i.x+ae+i.y;else if(i.type===H.SMOOTH_CURVE_TO)t+=(i.relative?"s":"S")+i.x2+ae+i.y2+ae+i.x+ae+i.y;else if(i.type===H.QUAD_TO)t+=(i.relative?"q":"Q")+i.x1+ae+i.y1+ae+i.x+ae+i.y;else if(i.type===H.SMOOTH_QUAD_TO)t+=(i.relative?"t":"T")+i.x+ae+i.y;else if(i.type===H.ARC)t+=(i.relative?"a":"A")+i.rX+ae+i.rY+ae+i.xRot+ae+ +i.lArcFlag+ae+ +i.sweepFlag+ae+i.x+ae+i.y;else throw new Error(`Unexpected command type "${i==null?void 0:i.type}" at index ${e}.`)}return t}function qu([r,t],e){return[r*Math.cos(e)-t*Math.sin(e),r*Math.sin(e)+t*Math.cos(e)]}function Pr(...r){for(let t=0;t<r.length;t++)if(typeof r[t]!="number")throw new Error(`assertNumbers arguments[${t}] is not a number. ${typeof r[t]} == typeof ${r[t]}`);return!0}const $i=Math.PI;function Wu(r,t,e){r.lArcFlag=r.lArcFlag===0?0:1,r.sweepFlag=r.sweepFlag===0?0:1;let{rX:i,rY:a}=r;const{x:o,y:l}=r;i=Math.abs(r.rX),a=Math.abs(r.rY);const[c,f]=qu([(t-o)/2,(e-l)/2],-r.xRot/180*$i),d=Math.pow(c,2)/Math.pow(i,2)+Math.pow(f,2)/Math.pow(a,2);1<d&&(i*=Math.sqrt(d),a*=Math.sqrt(d)),r.rX=i,r.rY=a;const g=Math.pow(i,2)*Math.pow(f,2)+Math.pow(a,2)*Math.pow(c,2),E=(r.lArcFlag!==r.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(i,2)*Math.pow(a,2)-g)/g)),_=i*f/a*E,C=-a*c/i*E,R=qu([_,C],r.xRot/180*$i);r.cX=R[0]+(t+o)/2,r.cY=R[1]+(e+l)/2,r.phi1=Math.atan2((f-C)/a,(c-_)/i),r.phi2=Math.atan2((-f-C)/a,(-c-_)/i),r.sweepFlag===0&&r.phi2>r.phi1&&(r.phi2-=2*$i),r.sweepFlag===1&&r.phi2<r.phi1&&(r.phi2+=2*$i),r.phi1*=180/$i,r.phi2*=180/$i}function Gc(r,t,e){Pr(r,t,e);const i=r*r+t*t-e*e;if(0>i)return[];if(i===0)return[[r*e/(r*r+t*t),t*e/(r*r+t*t)]];const a=Math.sqrt(i);return[[(r*e+t*a)/(r*r+t*t),(t*e-r*a)/(r*r+t*t)],[(r*e-t*a)/(r*r+t*t),(t*e+r*a)/(r*r+t*t)]]}const Ei=Math.PI/180;function Yc(r,t,e){return(1-e)*r+e*t}function Xc(r,t,e,i){return r+Math.cos(i/180*$i)*t+Math.sin(i/180*$i)*e}function Zc(r,t,e,i){const o=t-r,l=e-t,c=i-e,f=3*o+3*c-6*l,d=(l-o)*6,g=3*o;return Math.abs(f)<1e-6?[-g/d]:W0(d/f,g/f,1e-6)}function Qc(r,t,e,i,a){const o=1-a,l=o*o*o,c=3*o*o*a,f=3*o*a*a,d=a*a*a;return r*l+t*c+e*f+i*d}function W0(r,t,e=1e-6){const i=r*r/4-t;if(i<-e)return[];if(i<=e)return[-r/2];const a=Math.sqrt(i);return[-(r/2)-a,-(r/2)+a]}function V0(r,t,e){r.cX||Wu(r,t,e);const i=Math.min(r.phi1,r.phi2),a=Math.max(r.phi1,r.phi2),o=a-i,l=Math.ceil(o/90),c=new Array(l);let f=t,d=e;for(let g=0;g<l;g++){const E=Yc(r.phi1,r.phi2,g/l),_=Yc(r.phi1,r.phi2,(g+1)/l),C=_-E,R=4/3*Math.tan(C*Ei/4),[L,N]=[Math.cos(E*Ei)-R*Math.sin(E*Ei),Math.sin(E*Ei)+R*Math.cos(E*Ei)],[I,W]=[Math.cos(_*Ei),Math.sin(_*Ei)],[G,b]=[I+R*Math.sin(_*Ei),W-R*Math.cos(_*Ei)],F={relative:r.relative,type:H.CURVE_TO},q=(K,tt)=>{const[Z,rt]=qu([K*r.rX,tt*r.rY],r.xRot);return[r.cX+Z,r.cY+rt]};[F.x1,F.y1]=q(L,N),[F.x2,F.y2]=q(G,b),[F.x,F.y]=q(I,W),r.relative&&(F.x1-=f,F.y1-=d,F.x2-=f,F.y2-=d,F.x-=f,F.y-=d),[f,d]=[F.x,F.y],c[g]=F}return c}function z0(r=1e13){Pr(r);function t(e){return Math.round(e*r)/r}return function(i){return"x1"in i&&typeof i.x1<"u"&&(i.x1=t(i.x1)),"y1"in i&&typeof i.y1<"u"&&(i.y1=t(i.y1)),"x2"in i&&typeof i.x2<"u"&&(i.x2=t(i.x2)),"y2"in i&&typeof i.y2<"u"&&(i.y2=t(i.y2)),"x"in i&&typeof i.x<"u"&&(i.x=t(i.x)),"y"in i&&typeof i.y<"u"&&(i.y=t(i.y)),"rX"in i&&typeof i.rX<"u"&&(i.rX=t(i.rX)),"rY"in i&&typeof i.rY<"u"&&(i.rY=t(i.rY)),i}}function Kc(){return Fr((r,t,e)=>(r.relative&&(typeof r.x1<"u"&&(r.x1+=t),typeof r.y1<"u"&&(r.y1+=e),typeof r.x2<"u"&&(r.x2+=t),typeof r.y2<"u"&&(r.y2+=e),typeof r.x<"u"&&(r.x+=t),typeof r.y<"u"&&(r.y+=e),r.relative=!1),r))}function $0(){return Fr((r,t,e)=>(r.relative||(typeof r.x1<"u"&&(r.x1-=t),typeof r.y1<"u"&&(r.y1-=e),typeof r.x2<"u"&&(r.x2-=t),typeof r.y2<"u"&&(r.y2-=e),typeof r.x<"u"&&(r.x-=t),typeof r.y<"u"&&(r.y-=e),r.relative=!0),r))}function G0(r=!0,t=!0,e=!0){return Fr((i,a,o,l,c)=>{if(isNaN(l)&&!(i.type&H.MOVE_TO))throw new Error("path must start with moveto");return t&&i.type&H.HORIZ_LINE_TO&&(i.type=H.LINE_TO,i.y=i.relative?0:o),e&&i.type&H.VERT_LINE_TO&&(i.type=H.LINE_TO,i.x=i.relative?0:a),r&&i.type&H.CLOSE_PATH&&(i.type=H.LINE_TO,i.x=i.relative?l-a:l,i.y=i.relative?c-o:c),i.type&H.ARC&&(i.rX===0||i.rY===0)&&(i.type=H.LINE_TO,delete i.rX,delete i.rY,delete i.xRot,delete i.lArcFlag,delete i.sweepFlag),i})}function jc(){let r=NaN,t=NaN,e=NaN,i=NaN;return Fr((a,o,l)=>(a.type&H.SMOOTH_CURVE_TO&&(a.type=H.CURVE_TO,r=isNaN(r)?o:r,t=isNaN(t)?l:t,a.x1=a.relative?o-r:2*o-r,a.y1=a.relative?l-t:2*l-t),a.type&H.CURVE_TO?(r=a.relative?o+a.x2:a.x2,t=a.relative?l+a.y2:a.y2):(r=NaN,t=NaN),a.type&H.SMOOTH_QUAD_TO&&(a.type=H.QUAD_TO,e=isNaN(e)?o:e,i=isNaN(i)?l:i,a.x1=a.relative?o-e:2*o-e,a.y1=a.relative?l-i:2*l-i),a.type&H.QUAD_TO?(e=a.relative?o+a.x1:a.x1,i=a.relative?l+a.y1:a.y1):(e=NaN,i=NaN),a))}function Jc(){let r=NaN,t=NaN;return Fr((e,i,a)=>{if(e.type&H.SMOOTH_QUAD_TO&&(e.type=H.QUAD_TO,r=isNaN(r)?i:r,t=isNaN(t)?a:t,e.x1=e.relative?i-r:2*i-r,e.y1=e.relative?a-t:2*a-t),e.type&H.QUAD_TO){r=e.relative?i+e.x1:e.x1,t=e.relative?a+e.y1:e.y1;const o=e.x1,l=e.y1;e.type=H.CURVE_TO,e.x1=((e.relative?0:i)+o*2)/3,e.y1=((e.relative?0:a)+l*2)/3,e.x2=(e.x+o*2)/3,e.y2=(e.y+l*2)/3}else r=NaN,t=NaN;return e})}function Fr(r){let t=0,e=0,i=NaN,a=NaN;return function(l){if(isNaN(i)&&!(l.type&H.MOVE_TO))throw new Error("path must start with moveto");const c=r(l,t,e,i,a);return l.type&H.CLOSE_PATH&&(t=i,e=a),"x"in l&&typeof l.x<"u"&&(t=l.relative?t+l.x:l.x),"y"in l&&typeof l.y<"u"&&(e=l.relative?e+l.y:l.y),l.type&H.MOVE_TO&&(i=t,a=e),c}}function Y0(r=0){Pr(r);let t=NaN,e=NaN,i=NaN,a=NaN;return Fr((o,l,c,f,d)=>{const g=Math.abs;let E=!1,_=0,C=0;if(o.type&H.SMOOTH_CURVE_TO&&(_=isNaN(t)?0:l-t,C=isNaN(e)?0:c-e),o.type&(H.CURVE_TO|H.SMOOTH_CURVE_TO)?(t=o.relative?l+o.x2:o.x2,e=o.relative?c+o.y2:o.y2):(t=NaN,e=NaN),o.type&H.SMOOTH_QUAD_TO?(i=isNaN(i)?l:2*l-i,a=isNaN(a)?c:2*c-a):o.type&H.QUAD_TO?(i=o.relative?l+o.x1:o.x1,a=o.relative?c+o.y1:o.y2):(i=NaN,a=NaN),o.type&H.LINE_COMMANDS||o.type&H.ARC&&(o.rX===0||o.rY===0||!o.lArcFlag)||o.type&H.CURVE_TO||o.type&H.SMOOTH_CURVE_TO||o.type&H.QUAD_TO||o.type&H.SMOOTH_QUAD_TO){const R=typeof o.x>"u"?0:o.relative?o.x:o.x-l,L=typeof o.y>"u"?0:o.relative?o.y:o.y-c;_=isNaN(i)?typeof o.x1>"u"?_:o.relative?o.x:o.x1-l:i-l,C=isNaN(a)?typeof o.y1>"u"?C:o.relative?o.y:o.y1-c:a-c;const N=typeof o.x2>"u"?0:o.relative?o.x:o.x2-l,I=typeof o.y2>"u"?0:o.relative?o.y:o.y2-c;g(R)<=r&&g(L)<=r&&g(_)<=r&&g(C)<=r&&g(N)<=r&&g(I)<=r&&(E=!0)}return o.type&H.CLOSE_PATH&&g(l-f)<=r&&g(c-d)<=r&&(E=!0),E?[]:o})}function Gi(r,t,e,i,a,o){return Pr(r,t,e,i,a,o),Fr((l,c,f,d)=>{const g=l.x1,E=l.x2,_=l.relative&&!isNaN(d),C=typeof l.x<"u"?l.x:_?0:c,R=typeof l.y<"u"?l.y:_?0:f;l.type&H.HORIZ_LINE_TO&&t!==0&&(l.type=H.LINE_TO,l.y=l.relative?0:f),l.type&H.VERT_LINE_TO&&e!==0&&(l.type=H.LINE_TO,l.x=l.relative?0:c),typeof l.x<"u"&&(l.x=l.x*r+R*e+(_?0:a)),typeof l.y<"u"&&(l.y=C*t+l.y*i+(_?0:o)),typeof l.x1<"u"&&(l.x1=l.x1*r+l.y1*e+(_?0:a)),typeof l.y1<"u"&&(l.y1=g*t+l.y1*i+(_?0:o)),typeof l.x2<"u"&&(l.x2=l.x2*r+l.y2*e+(_?0:a)),typeof l.y2<"u"&&(l.y2=E*t+l.y2*i+(_?0:o));function L(I){return I*I}const N=r*i-t*e;if(typeof l.xRot<"u"&&(r!==1||t!==0||e!==0||i!==1))if(N===0)delete l.rX,delete l.rY,delete l.xRot,delete l.lArcFlag,delete l.sweepFlag,l.type=H.LINE_TO;else{const I=l.xRot*Math.PI/180,W=Math.sin(I),G=Math.cos(I),b=1/L(l.rX),F=1/L(l.rY),q=L(G)*b+L(W)*F,K=2*W*G*(b-F),tt=L(W)*b+L(G)*F,Z=q*i*i-K*t*i+tt*t*t,rt=K*(r*i+t*e)-2*(q*e*i+tt*r*t),J=q*e*e-K*r*e+tt*r*r,st=(Math.atan2(rt,Z-J)+Math.PI)%Math.PI/2,ct=Math.sin(st),ft=Math.cos(st);l.rX=Math.abs(N)/Math.sqrt(Z*L(ft)+rt*ct*ft+J*L(ct)),l.rY=Math.abs(N)/Math.sqrt(Z*L(ct)-rt*ct*ft+J*L(ft)),l.xRot=st*180/Math.PI}return typeof l.sweepFlag<"u"&&0>N&&(l.sweepFlag=+!l.sweepFlag),l})}function X0(r,t=0,e=0){Pr(r,t,e);const i=Math.sin(r),a=Math.cos(r);return Gi(a,i,-i,a,t-t*a+e*i,e-t*i-e*a)}function Z0(r,t=0){return Pr(r,t),Gi(1,0,0,1,r,t)}function Q0(r,t=r){return Pr(r,t),Gi(r,0,0,t,0,0)}function K0(r){return Pr(r),Gi(1,0,Math.atan(r),1,0,0)}function j0(r){return Pr(r),Gi(1,Math.atan(r),0,1,0,0)}function J0(r=0){return Pr(r),Gi(-1,0,0,1,r,0)}function t2(r=0){return Pr(r),Gi(1,0,0,-1,0,r)}function e2(){return Fr((r,t,e)=>H.ARC===r.type?V0(r,r.relative?0:t,r.relative?0:e):r)}function r2(){return Fr((r,t,e)=>(r.relative&&(t=0,e=0),H.ARC===r.type&&Wu(r,t,e),r))}function tf(){return r=>({...r})}function i2(){const r=tf(),t=Kc(),e=Jc(),i=jc(),a=Fr((o,l,c)=>{const f=i(e(t(r(o))));function d(E){E>a.maxX&&(a.maxX=E),E<a.minX&&(a.minX=E)}function g(E){E>a.maxY&&(a.maxY=E),E<a.minY&&(a.minY=E)}if(f.type&H.DRAWING_COMMANDS&&(d(l),g(c)),f.type&H.HORIZ_LINE_TO&&d(f.x),f.type&H.VERT_LINE_TO&&g(f.y),f.type&H.LINE_TO&&(d(f.x),g(f.y)),f.type&H.CURVE_TO){d(f.x),g(f.y);const E=Zc(l,f.x1,f.x2,f.x);for(const C of E)0<C&&1>C&&d(Qc(l,f.x1,f.x2,f.x,C));const _=Zc(c,f.y1,f.y2,f.y);for(const C of _)0<C&&1>C&&g(Qc(c,f.y1,f.y2,f.y,C))}if(f.type&H.ARC){d(f.x),g(f.y),Wu(f,l,c);const E=f.xRot/180*Math.PI,_=Math.cos(E)*f.rX,C=Math.sin(E)*f.rX,R=-Math.sin(E)*f.rY,L=Math.cos(E)*f.rY,[N,I]=f.phi1<f.phi2?[f.phi1,f.phi2]:-180>f.phi2?[f.phi2+360,f.phi1+360]:[f.phi2,f.phi1],W=([F,q])=>{const tt=Math.atan2(q,F)*180/Math.PI;return tt<N?tt+360:tt},G=Gc(R,-_,0).map(W);for(const F of G)F>N&&F<I&&d(Xc(f.cX,_,R,F));const b=Gc(L,-C,0).map(W);for(const F of b)F>N&&F<I&&g(Xc(f.cY,C,L,F))}return o});return a.minX=1/0,a.maxX=-1/0,a.minY=1/0,a.maxY=-1/0,a}const me={ROUND:z0,TO_ABS:Kc,TO_REL:$0,NORMALIZE_HVZ:G0,NORMALIZE_ST:jc,QT_TO_C:Jc,INFO:Fr,SANITIZE:Y0,MATRIX:Gi,ROTATE:X0,TRANSLATE:Z0,SCALE:Q0,SKEW_X:K0,SKEW_Y:j0,X_AXIS_SYMMETRY:J0,Y_AXIS_SYMMETRY:t2,A_TO_C:e2,ANNOTATE_ARCS:r2,CLONE:tf,CALCULATE_BOUNDS:i2};let ef=class{round(t){return this.transform(me.ROUND(t))}toAbs(){return this.transform(me.TO_ABS())}toRel(){return this.transform(me.TO_REL())}normalizeHVZ(t,e,i){return this.transform(me.NORMALIZE_HVZ(t,e,i))}normalizeST(){return this.transform(me.NORMALIZE_ST())}qtToC(){return this.transform(me.QT_TO_C())}aToC(){return this.transform(me.A_TO_C())}sanitize(t){return this.transform(me.SANITIZE(t))}translate(t,e){return this.transform(me.TRANSLATE(t,e))}scale(t,e){return this.transform(me.SCALE(t,e))}rotate(t,e,i){return this.transform(me.ROTATE(t,e,i))}matrix(t,e,i,a,o,l){return this.transform(me.MATRIX(t,e,i,a,o,l))}skewX(t){return this.transform(me.SKEW_X(t))}skewY(t){return this.transform(me.SKEW_Y(t))}xSymmetry(t){return this.transform(me.X_AXIS_SYMMETRY(t))}ySymmetry(t){return this.transform(me.Y_AXIS_SYMMETRY(t))}annotateArcs(){return this.transform(me.ANNOTATE_ARCS())}};const n2=r=>r===" "||r===" "||r==="\r"||r===`
|
|
33
33
|
`,rf=r=>48<=r.charCodeAt(0)&&r.charCodeAt(0)<=57;let s2=class extends ef{curNumber="";curCommandType=-1;curCommandRelative=!1;canParseCommandOrComma=!0;curNumberHasExp=!1;curNumberHasExpDigits=!1;curNumberHasDecimal=!1;curArgs=[];constructor(){super()}finish(t=[]){if(this.parse(" ",t),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return t}parse(t,e=[]){const i=a=>{e.push(a),this.curArgs.length=0,this.canParseCommandOrComma=!0};for(let a=0;a<t.length;a++){const o=t[a],l=this.curCommandType===H.ARC&&(this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber.length===1&&(this.curNumber==="0"||this.curNumber==="1"),c=rf(o)&&(this.curNumber==="0"&&o==="0"||l);if(rf(o)&&!c){this.curNumber+=o,this.curNumberHasExpDigits=this.curNumberHasExp;continue}if(o==="e"||o==="E"){this.curNumber+=o,this.curNumberHasExp=!0;continue}if((o==="-"||o==="+")&&this.curNumberHasExp&&!this.curNumberHasExpDigits){this.curNumber+=o;continue}if(o==="."&&!this.curNumberHasExp&&!this.curNumberHasDecimal&&!l){this.curNumber+=o,this.curNumberHasDecimal=!0;continue}if(this.curNumber&&this.curCommandType!==-1){const f=Number(this.curNumber);if(isNaN(f))throw new SyntaxError(`Invalid number ending at ${a}`);if(this.curCommandType===H.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>f)throw new SyntaxError(`Expected positive number, got "${f}" at index "${a}"`)}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError(`Expected a flag, got "${this.curNumber}" at index "${a}"`)}this.curArgs.push(f),this.curArgs.length===a2[this.curCommandType]&&(H.HORIZ_LINE_TO===this.curCommandType?i({type:H.HORIZ_LINE_TO,relative:this.curCommandRelative,x:f}):H.VERT_LINE_TO===this.curCommandType?i({type:H.VERT_LINE_TO,relative:this.curCommandRelative,y:f}):this.curCommandType===H.MOVE_TO||this.curCommandType===H.LINE_TO||this.curCommandType===H.SMOOTH_QUAD_TO?(i({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),H.MOVE_TO===this.curCommandType&&(this.curCommandType=H.LINE_TO)):this.curCommandType===H.CURVE_TO?i({type:H.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===H.SMOOTH_CURVE_TO?i({type:H.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===H.QUAD_TO?i({type:H.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===H.ARC&&i({type:H.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!n2(o)){if(o===","&&this.canParseCommandOrComma){this.canParseCommandOrComma=!1;continue}if(o==="+"||o==="-"||o==="."){this.curNumber=o,this.curNumberHasDecimal=o===".";continue}if(c){this.curNumber=o,this.curNumberHasDecimal=!1;continue}if(this.curArgs.length!==0)throw new SyntaxError(`Unterminated command at index ${a}.`);if(!this.canParseCommandOrComma)throw new SyntaxError(`Unexpected character "${o}" at index ${a}. Command cannot follow comma`);if(this.canParseCommandOrComma=!1,o==="z"||o==="Z"){e.push({type:H.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1;continue}else if(o==="h"||o==="H")this.curCommandType=H.HORIZ_LINE_TO,this.curCommandRelative=o==="h";else if(o==="v"||o==="V")this.curCommandType=H.VERT_LINE_TO,this.curCommandRelative=o==="v";else if(o==="m"||o==="M")this.curCommandType=H.MOVE_TO,this.curCommandRelative=o==="m";else if(o==="l"||o==="L")this.curCommandType=H.LINE_TO,this.curCommandRelative=o==="l";else if(o==="c"||o==="C")this.curCommandType=H.CURVE_TO,this.curCommandRelative=o==="c";else if(o==="s"||o==="S")this.curCommandType=H.SMOOTH_CURVE_TO,this.curCommandRelative=o==="s";else if(o==="q"||o==="Q")this.curCommandType=H.QUAD_TO,this.curCommandRelative=o==="q";else if(o==="t"||o==="T")this.curCommandType=H.SMOOTH_QUAD_TO,this.curCommandRelative=o==="t";else if(o==="a"||o==="A")this.curCommandType=H.ARC,this.curCommandRelative=o==="a";else throw new SyntaxError(`Unexpected character "${o}" at index ${a}.`)}}return e}transform(t){return Object.create(this,{parse:{value(i,a=[]){const o=Object.getPrototypeOf(this).parse.call(this,i);for(const l of o){const c=t(l);Array.isArray(c)?a.push(...c):a.push(c)}return a}}})}},H=class nr extends ef{commands;constructor(t){super(),typeof t=="string"?this.commands=nr.parse(t):this.commands=t}encode(){return nr.encode(this.commands)}getBounds(){const t=me.CALCULATE_BOUNDS();return this.transform(t),t}transform(t){const e=[];for(const i of this.commands){const a=t(i);Array.isArray(a)?e.push(...a):e.push(a)}return this.commands=e,this}static encode(t){return q0(t)}static parse(t){const e=new s2,i=[];return e.parse(t,i),e.finish(i),i}static CLOSE_PATH=1;static MOVE_TO=2;static HORIZ_LINE_TO=4;static VERT_LINE_TO=8;static LINE_TO=16;static CURVE_TO=32;static SMOOTH_CURVE_TO=64;static QUAD_TO=128;static SMOOTH_QUAD_TO=256;static ARC=512;static LINE_COMMANDS=nr.LINE_TO|nr.HORIZ_LINE_TO|nr.VERT_LINE_TO;static DRAWING_COMMANDS=nr.HORIZ_LINE_TO|nr.VERT_LINE_TO|nr.LINE_TO|nr.CURVE_TO|nr.SMOOTH_CURVE_TO|nr.QUAD_TO|nr.SMOOTH_QUAD_TO|nr.ARC};const a2={[H.MOVE_TO]:2,[H.LINE_TO]:2,[H.HORIZ_LINE_TO]:1,[H.VERT_LINE_TO]:1,[H.CLOSE_PATH]:0,[H.QUAD_TO]:4,[H.SMOOTH_QUAD_TO]:2,[H.CURVE_TO]:6,[H.SMOOTH_CURVE_TO]:4,[H.ARC]:7},oe=" ";function o2(r){let t="";Array.isArray(r)||(r=[r]);for(let e=0;e<r.length;e++){const i=r[e];if(i.type===X.CLOSE_PATH)t+="z";else if(i.type===X.HORIZ_LINE_TO)t+=(i.relative?"h":"H")+i.x;else if(i.type===X.VERT_LINE_TO)t+=(i.relative?"v":"V")+i.y;else if(i.type===X.MOVE_TO)t+=(i.relative?"m":"M")+i.x+oe+i.y;else if(i.type===X.LINE_TO)t+=(i.relative?"l":"L")+i.x+oe+i.y;else if(i.type===X.CURVE_TO)t+=(i.relative?"c":"C")+i.x1+oe+i.y1+oe+i.x2+oe+i.y2+oe+i.x+oe+i.y;else if(i.type===X.SMOOTH_CURVE_TO)t+=(i.relative?"s":"S")+i.x2+oe+i.y2+oe+i.x+oe+i.y;else if(i.type===X.QUAD_TO)t+=(i.relative?"q":"Q")+i.x1+oe+i.y1+oe+i.x+oe+i.y;else if(i.type===X.SMOOTH_QUAD_TO)t+=(i.relative?"t":"T")+i.x+oe+i.y;else if(i.type===X.ARC)t+=(i.relative?"a":"A")+i.rX+oe+i.rY+oe+i.xRot+oe+ +i.lArcFlag+oe+ +i.sweepFlag+oe+i.x+oe+i.y;else throw new Error(`Unexpected command type "${i==null?void 0:i.type}" at index ${e}.`)}return t}class nf{round(t){return this.transform(fe.ROUND(t))}toAbs(){return this.transform(fe.TO_ABS())}toRel(){return this.transform(fe.TO_REL())}normalizeHVZ(t,e,i){return this.transform(fe.NORMALIZE_HVZ(t,e,i))}normalizeST(){return this.transform(fe.NORMALIZE_ST())}qtToC(){return this.transform(fe.QT_TO_C())}aToC(){return this.transform(fe.A_TO_C())}sanitize(t){return this.transform(fe.SANITIZE(t))}translate(t,e){return this.transform(fe.TRANSLATE(t,e))}scale(t,e){return this.transform(fe.SCALE(t,e))}rotate(t,e,i){return this.transform(fe.ROTATE(t,e,i))}matrix(t,e,i,a,o,l){return this.transform(fe.MATRIX(t,e,i,a,o,l))}skewX(t){return this.transform(fe.SKEW_X(t))}skewY(t){return this.transform(fe.SKEW_Y(t))}xSymmetry(t){return this.transform(fe.X_AXIS_SYMMETRY(t))}ySymmetry(t){return this.transform(fe.Y_AXIS_SYMMETRY(t))}annotateArcs(){return this.transform(fe.ANNOTATE_ARCS())}}const u2=r=>r===" "||r===" "||r==="\r"||r===`
|
|
34
|
-
`,sf=r=>48<=r.charCodeAt(0)&&r.charCodeAt(0)<=57;class l2 extends nf{constructor(){super(),this.curNumber="",this.curCommandType=-1,this.curCommandRelative=!1,this.canParseCommandOrComma=!0,this.curNumberHasExp=!1,this.curNumberHasExpDigits=!1,this.curNumberHasDecimal=!1,this.curArgs=[]}finish(t=[]){if(this.parse(" ",t),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return t}parse(t,e=[]){const i=a=>{e.push(a),this.curArgs.length=0,this.canParseCommandOrComma=!0};for(let a=0;a<t.length;a++){const o=t[a],l=this.curCommandType===X.ARC&&(this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber.length===1&&(this.curNumber==="0"||this.curNumber==="1"),c=sf(o)&&(this.curNumber==="0"&&o==="0"||l);if(sf(o)&&!c){this.curNumber+=o,this.curNumberHasExpDigits=this.curNumberHasExp;continue}if(o==="e"||o==="E"){this.curNumber+=o,this.curNumberHasExp=!0;continue}if((o==="-"||o==="+")&&this.curNumberHasExp&&!this.curNumberHasExpDigits){this.curNumber+=o;continue}if(o==="."&&!this.curNumberHasExp&&!this.curNumberHasDecimal&&!l){this.curNumber+=o,this.curNumberHasDecimal=!0;continue}if(this.curNumber&&this.curCommandType!==-1){const f=Number(this.curNumber);if(isNaN(f))throw new SyntaxError(`Invalid number ending at ${a}`);if(this.curCommandType===X.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>f)throw new SyntaxError(`Expected positive number, got "${f}" at index "${a}"`)}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError(`Expected a flag, got "${this.curNumber}" at index "${a}"`)}this.curArgs.push(f),this.curArgs.length===h2[this.curCommandType]&&(X.HORIZ_LINE_TO===this.curCommandType?i({type:X.HORIZ_LINE_TO,relative:this.curCommandRelative,x:f}):X.VERT_LINE_TO===this.curCommandType?i({type:X.VERT_LINE_TO,relative:this.curCommandRelative,y:f}):this.curCommandType===X.MOVE_TO||this.curCommandType===X.LINE_TO||this.curCommandType===X.SMOOTH_QUAD_TO?(i({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),X.MOVE_TO===this.curCommandType&&(this.curCommandType=X.LINE_TO)):this.curCommandType===X.CURVE_TO?i({type:X.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===X.SMOOTH_CURVE_TO?i({type:X.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===X.QUAD_TO?i({type:X.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===X.ARC&&i({type:X.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!u2(o)){if(o===","&&this.canParseCommandOrComma){this.canParseCommandOrComma=!1;continue}if(o==="+"||o==="-"||o==="."){this.curNumber=o,this.curNumberHasDecimal=o===".";continue}if(c){this.curNumber=o,this.curNumberHasDecimal=!1;continue}if(this.curArgs.length!==0)throw new SyntaxError(`Unterminated command at index ${a}.`);if(!this.canParseCommandOrComma)throw new SyntaxError(`Unexpected character "${o}" at index ${a}. Command cannot follow comma`);if(this.canParseCommandOrComma=!1,o==="z"||o==="Z"){e.push({type:X.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1;continue}else if(o==="h"||o==="H")this.curCommandType=X.HORIZ_LINE_TO,this.curCommandRelative=o==="h";else if(o==="v"||o==="V")this.curCommandType=X.VERT_LINE_TO,this.curCommandRelative=o==="v";else if(o==="m"||o==="M")this.curCommandType=X.MOVE_TO,this.curCommandRelative=o==="m";else if(o==="l"||o==="L")this.curCommandType=X.LINE_TO,this.curCommandRelative=o==="l";else if(o==="c"||o==="C")this.curCommandType=X.CURVE_TO,this.curCommandRelative=o==="c";else if(o==="s"||o==="S")this.curCommandType=X.SMOOTH_CURVE_TO,this.curCommandRelative=o==="s";else if(o==="q"||o==="Q")this.curCommandType=X.QUAD_TO,this.curCommandRelative=o==="q";else if(o==="t"||o==="T")this.curCommandType=X.SMOOTH_QUAD_TO,this.curCommandRelative=o==="t";else if(o==="a"||o==="A")this.curCommandType=X.ARC,this.curCommandRelative=o==="a";else throw new SyntaxError(`Unexpected character "${o}" at index ${a}.`)}}return e}transform(t){return Object.create(this,{parse:{value(i,a=[]){const o=Object.getPrototypeOf(this).parse.call(this,i);for(const l of o){const c=t(l);Array.isArray(c)?a.push(...c):a.push(c)}return a}}})}}const Ht=class Ht extends nf{constructor(t){super(),typeof t=="string"?this.commands=Ht.parse(t):this.commands=t}encode(){return Ht.encode(this.commands)}getBounds(){const t=fe.CALCULATE_BOUNDS();return this.transform(t),t}transform(t){const e=[];for(const i of this.commands){const a=t(i);Array.isArray(a)?e.push(...a):e.push(a)}return this.commands=e,this}static encode(t){return o2(t)}static parse(t){const e=new l2,i=[];return e.parse(t,i),e.finish(i),i}};Ht.CLOSE_PATH=1,Ht.MOVE_TO=2,Ht.HORIZ_LINE_TO=4,Ht.VERT_LINE_TO=8,Ht.LINE_TO=16,Ht.CURVE_TO=32,Ht.SMOOTH_CURVE_TO=64,Ht.QUAD_TO=128,Ht.SMOOTH_QUAD_TO=256,Ht.ARC=512,Ht.LINE_COMMANDS=Ht.LINE_TO|Ht.HORIZ_LINE_TO|Ht.VERT_LINE_TO,Ht.DRAWING_COMMANDS=Ht.HORIZ_LINE_TO|Ht.VERT_LINE_TO|Ht.LINE_TO|Ht.CURVE_TO|Ht.SMOOTH_CURVE_TO|Ht.QUAD_TO|Ht.SMOOTH_QUAD_TO|Ht.ARC;let X=Ht;const h2={[X.MOVE_TO]:2,[X.LINE_TO]:2,[X.HORIZ_LINE_TO]:1,[X.VERT_LINE_TO]:1,[X.CLOSE_PATH]:0,[X.QUAD_TO]:4,[X.SMOOTH_QUAD_TO]:2,[X.CURVE_TO]:6,[X.SMOOTH_CURVE_TO]:4,[X.ARC]:7};function Vu([r,t],e){return[r*Math.cos(e)-t*Math.sin(e),r*Math.sin(e)+t*Math.cos(e)]}function kr(...r){for(let t=0;t<r.length;t++)if(typeof r[t]!="number")throw new Error(`assertNumbers arguments[${t}] is not a number. ${typeof r[t]} == typeof ${r[t]}`);return!0}const Yi=Math.PI;function zu(r,t,e){r.lArcFlag=r.lArcFlag===0?0:1,r.sweepFlag=r.sweepFlag===0?0:1;let{rX:i,rY:a}=r;const{x:o,y:l}=r;i=Math.abs(r.rX),a=Math.abs(r.rY);const[c,f]=Vu([(t-o)/2,(e-l)/2],-r.xRot/180*Yi),d=Math.pow(c,2)/Math.pow(i,2)+Math.pow(f,2)/Math.pow(a,2);1<d&&(i*=Math.sqrt(d),a*=Math.sqrt(d)),r.rX=i,r.rY=a;const g=Math.pow(i,2)*Math.pow(f,2)+Math.pow(a,2)*Math.pow(c,2),E=(r.lArcFlag!==r.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(i,2)*Math.pow(a,2)-g)/g)),_=i*f/a*E,C=-a*c/i*E,R=Vu([_,C],r.xRot/180*Yi);r.cX=R[0]+(t+o)/2,r.cY=R[1]+(e+l)/2,r.phi1=Math.atan2((f-C)/a,(c-_)/i),r.phi2=Math.atan2((-f-C)/a,(-c-_)/i),r.sweepFlag===0&&r.phi2>r.phi1&&(r.phi2-=2*Yi),r.sweepFlag===1&&r.phi2<r.phi1&&(r.phi2+=2*Yi),r.phi1*=180/Yi,r.phi2*=180/Yi}function af(r,t,e){kr(r,t,e);const i=r*r+t*t-e*e;if(0>i)return[];if(i===0)return[[r*e/(r*r+t*t),t*e/(r*r+t*t)]];const a=Math.sqrt(i);return[[(r*e+t*a)/(r*r+t*t),(t*e-r*a)/(r*r+t*t)],[(r*e-t*a)/(r*r+t*t),(t*e+r*a)/(r*r+t*t)]]}const Ai=Math.PI/180;function of(r,t,e){return(1-e)*r+e*t}function uf(r,t,e,i){return r+Math.cos(i/180*Yi)*t+Math.sin(i/180*Yi)*e}function lf(r,t,e,i){const o=t-r,l=e-t,c=i-e,f=3*o+3*c-6*l,d=(l-o)*6,g=3*o;return Math.abs(f)<1e-6?[-g/d]:c2(d/f,g/f,1e-6)}function hf(r,t,e,i,a){const o=1-a,l=o*o*o,c=3*o*o*a,f=3*o*a*a,d=a*a*a;return r*l+t*c+e*f+i*d}function c2(r,t,e=1e-6){const i=r*r/4-t;if(i<-e)return[];if(i<=e)return[-r/2];const a=Math.sqrt(i);return[-(r/2)-a,-(r/2)+a]}function f2(r,t,e){r.cX||zu(r,t,e);const i=Math.min(r.phi1,r.phi2),a=Math.max(r.phi1,r.phi2),o=a-i,l=Math.ceil(o/90),c=new Array(l);let f=t,d=e;for(let g=0;g<l;g++){const E=of(r.phi1,r.phi2,g/l),_=of(r.phi1,r.phi2,(g+1)/l),C=_-E,R=4/3*Math.tan(C*Ai/4),[L,N]=[Math.cos(E*Ai)-R*Math.sin(E*Ai),Math.sin(E*Ai)+R*Math.cos(E*Ai)],[I,W]=[Math.cos(_*Ai),Math.sin(_*Ai)],[G,b]=[I+R*Math.sin(_*Ai),W-R*Math.cos(_*Ai)],F={relative:r.relative,type:X.CURVE_TO},q=(K,tt)=>{const[Z,rt]=Vu([K*r.rX,tt*r.rY],r.xRot);return[r.cX+Z,r.cY+rt]};[F.x1,F.y1]=q(L,N),[F.x2,F.y2]=q(G,b),[F.x,F.y]=q(I,W),r.relative&&(F.x1-=f,F.y1-=d,F.x2-=f,F.y2-=d,F.x-=f,F.y-=d),[f,d]=[F.x,F.y],c[g]=F}return c}function p2(r=1e13){kr(r);function t(e){return Math.round(e*r)/r}return function(i){return"x1"in i&&typeof i.x1<"u"&&(i.x1=t(i.x1)),"y1"in i&&typeof i.y1<"u"&&(i.y1=t(i.y1)),"x2"in i&&typeof i.x2<"u"&&(i.x2=t(i.x2)),"y2"in i&&typeof i.y2<"u"&&(i.y2=t(i.y2)),"x"in i&&typeof i.x<"u"&&(i.x=t(i.x)),"y"in i&&typeof i.y<"u"&&(i.y=t(i.y)),"rX"in i&&typeof i.rX<"u"&&(i.rX=t(i.rX)),"rY"in i&&typeof i.rY<"u"&&(i.rY=t(i.rY)),i}}function cf(){return Hr((r,t,e)=>(r.relative&&(typeof r.x1<"u"&&(r.x1+=t),typeof r.y1<"u"&&(r.y1+=e),typeof r.x2<"u"&&(r.x2+=t),typeof r.y2<"u"&&(r.y2+=e),typeof r.x<"u"&&(r.x+=t),typeof r.y<"u"&&(r.y+=e),r.relative=!1),r))}function d2(){return Hr((r,t,e)=>(r.relative||(typeof r.x1<"u"&&(r.x1-=t),typeof r.y1<"u"&&(r.y1-=e),typeof r.x2<"u"&&(r.x2-=t),typeof r.y2<"u"&&(r.y2-=e),typeof r.x<"u"&&(r.x-=t),typeof r.y<"u"&&(r.y-=e),r.relative=!0),r))}function g2(r=!0,t=!0,e=!0){return Hr((i,a,o,l,c)=>{if(isNaN(l)&&!(i.type&X.MOVE_TO))throw new Error("path must start with moveto");return t&&i.type&X.HORIZ_LINE_TO&&(i.type=X.LINE_TO,i.y=i.relative?0:o),e&&i.type&X.VERT_LINE_TO&&(i.type=X.LINE_TO,i.x=i.relative?0:a),r&&i.type&X.CLOSE_PATH&&(i.type=X.LINE_TO,i.x=i.relative?l-a:l,i.y=i.relative?c-o:c),i.type&X.ARC&&(i.rX===0||i.rY===0)&&(i.type=X.LINE_TO,delete i.rX,delete i.rY,delete i.xRot,delete i.lArcFlag,delete i.sweepFlag),i})}function ff(){let r=NaN,t=NaN,e=NaN,i=NaN;return Hr((a,o,l)=>(a.type&X.SMOOTH_CURVE_TO&&(a.type=X.CURVE_TO,r=isNaN(r)?o:r,t=isNaN(t)?l:t,a.x1=a.relative?o-r:2*o-r,a.y1=a.relative?l-t:2*l-t),a.type&X.CURVE_TO?(r=a.relative?o+a.x2:a.x2,t=a.relative?l+a.y2:a.y2):(r=NaN,t=NaN),a.type&X.SMOOTH_QUAD_TO&&(a.type=X.QUAD_TO,e=isNaN(e)?o:e,i=isNaN(i)?l:i,a.x1=a.relative?o-e:2*o-e,a.y1=a.relative?l-i:2*l-i),a.type&X.QUAD_TO?(e=a.relative?o+a.x1:a.x1,i=a.relative?l+a.y1:a.y1):(e=NaN,i=NaN),a))}function pf(){let r=NaN,t=NaN;return Hr((e,i,a)=>{if(e.type&X.SMOOTH_QUAD_TO&&(e.type=X.QUAD_TO,r=isNaN(r)?i:r,t=isNaN(t)?a:t,e.x1=e.relative?i-r:2*i-r,e.y1=e.relative?a-t:2*a-t),e.type&X.QUAD_TO){r=e.relative?i+e.x1:e.x1,t=e.relative?a+e.y1:e.y1;const o=e.x1,l=e.y1;e.type=X.CURVE_TO,e.x1=((e.relative?0:i)+o*2)/3,e.y1=((e.relative?0:a)+l*2)/3,e.x2=(e.x+o*2)/3,e.y2=(e.y+l*2)/3}else r=NaN,t=NaN;return e})}function Hr(r){let t=0,e=0,i=NaN,a=NaN;return function(l){if(isNaN(i)&&!(l.type&X.MOVE_TO))throw new Error("path must start with moveto");const c=r(l,t,e,i,a);return l.type&X.CLOSE_PATH&&(t=i,e=a),"x"in l&&typeof l.x<"u"&&(t=l.relative?t+l.x:l.x),"y"in l&&typeof l.y<"u"&&(e=l.relative?e+l.y:l.y),l.type&X.MOVE_TO&&(i=t,a=e),c}}function y2(r=0){kr(r);let t=NaN,e=NaN,i=NaN,a=NaN;return Hr((o,l,c,f,d)=>{const g=Math.abs;let E=!1,_=0,C=0;if(o.type&X.SMOOTH_CURVE_TO&&(_=isNaN(t)?0:l-t,C=isNaN(e)?0:c-e),o.type&(X.CURVE_TO|X.SMOOTH_CURVE_TO)?(t=o.relative?l+o.x2:o.x2,e=o.relative?c+o.y2:o.y2):(t=NaN,e=NaN),o.type&X.SMOOTH_QUAD_TO?(i=isNaN(i)?l:2*l-i,a=isNaN(a)?c:2*c-a):o.type&X.QUAD_TO?(i=o.relative?l+o.x1:o.x1,a=o.relative?c+o.y1:o.y2):(i=NaN,a=NaN),o.type&X.LINE_COMMANDS||o.type&X.ARC&&(o.rX===0||o.rY===0||!o.lArcFlag)||o.type&X.CURVE_TO||o.type&X.SMOOTH_CURVE_TO||o.type&X.QUAD_TO||o.type&X.SMOOTH_QUAD_TO){const R=typeof o.x>"u"?0:o.relative?o.x:o.x-l,L=typeof o.y>"u"?0:o.relative?o.y:o.y-c;_=isNaN(i)?typeof o.x1>"u"?_:o.relative?o.x:o.x1-l:i-l,C=isNaN(a)?typeof o.y1>"u"?C:o.relative?o.y:o.y1-c:a-c;const N=typeof o.x2>"u"?0:o.relative?o.x:o.x2-l,I=typeof o.y2>"u"?0:o.relative?o.y:o.y2-c;g(R)<=r&&g(L)<=r&&g(_)<=r&&g(C)<=r&&g(N)<=r&&g(I)<=r&&(E=!0)}return o.type&X.CLOSE_PATH&&g(l-f)<=r&&g(c-d)<=r&&(E=!0),E?[]:o})}function Xi(r,t,e,i,a,o){return kr(r,t,e,i,a,o),Hr((l,c,f,d)=>{const g=l.x1,E=l.x2,_=l.relative&&!isNaN(d),C=typeof l.x<"u"?l.x:_?0:c,R=typeof l.y<"u"?l.y:_?0:f;l.type&X.HORIZ_LINE_TO&&t!==0&&(l.type=X.LINE_TO,l.y=l.relative?0:f),l.type&X.VERT_LINE_TO&&e!==0&&(l.type=X.LINE_TO,l.x=l.relative?0:c),typeof l.x<"u"&&(l.x=l.x*r+R*e+(_?0:a)),typeof l.y<"u"&&(l.y=C*t+l.y*i+(_?0:o)),typeof l.x1<"u"&&(l.x1=l.x1*r+l.y1*e+(_?0:a)),typeof l.y1<"u"&&(l.y1=g*t+l.y1*i+(_?0:o)),typeof l.x2<"u"&&(l.x2=l.x2*r+l.y2*e+(_?0:a)),typeof l.y2<"u"&&(l.y2=E*t+l.y2*i+(_?0:o));function L(I){return I*I}const N=r*i-t*e;if(typeof l.xRot<"u"&&(r!==1||t!==0||e!==0||i!==1))if(N===0)delete l.rX,delete l.rY,delete l.xRot,delete l.lArcFlag,delete l.sweepFlag,l.type=X.LINE_TO;else{const I=l.xRot*Math.PI/180,W=Math.sin(I),G=Math.cos(I),b=1/L(l.rX),F=1/L(l.rY),q=L(G)*b+L(W)*F,K=2*W*G*(b-F),tt=L(W)*b+L(G)*F,Z=q*i*i-K*t*i+tt*t*t,rt=K*(r*i+t*e)-2*(q*e*i+tt*r*t),J=q*e*e-K*r*e+tt*r*r,st=(Math.atan2(rt,Z-J)+Math.PI)%Math.PI/2,ct=Math.sin(st),ft=Math.cos(st);l.rX=Math.abs(N)/Math.sqrt(Z*L(ft)+rt*ct*ft+J*L(ct)),l.rY=Math.abs(N)/Math.sqrt(Z*L(ct)-rt*ct*ft+J*L(ft)),l.xRot=st*180/Math.PI}return typeof l.sweepFlag<"u"&&0>N&&(l.sweepFlag=+!l.sweepFlag),l})}function m2(r,t=0,e=0){kr(r,t,e);const i=Math.sin(r),a=Math.cos(r);return Xi(a,i,-i,a,t-t*a+e*i,e-t*i-e*a)}function v2(r,t=0){return kr(r,t),Xi(1,0,0,1,r,t)}function x2(r,t=r){return kr(r,t),Xi(r,0,0,t,0,0)}function E2(r){return kr(r),Xi(1,0,Math.atan(r),1,0,0)}function A2(r){return kr(r),Xi(1,Math.atan(r),0,1,0,0)}function w2(r=0){return kr(r),Xi(-1,0,0,1,r,0)}function b2(r=0){return kr(r),Xi(1,0,0,-1,0,r)}function T2(){return Hr((r,t,e)=>X.ARC===r.type?f2(r,r.relative?0:t,r.relative?0:e):r)}function _2(){return Hr((r,t,e)=>(r.relative&&(t=0,e=0),X.ARC===r.type&&zu(r,t,e),r))}function df(){return r=>({...r})}function C2(){const r=df(),t=cf(),e=pf(),i=ff(),a=Hr((o,l,c)=>{const f=i(e(t(r(o))));function d(E){E>a.maxX&&(a.maxX=E),E<a.minX&&(a.minX=E)}function g(E){E>a.maxY&&(a.maxY=E),E<a.minY&&(a.minY=E)}if(f.type&X.DRAWING_COMMANDS&&(d(l),g(c)),f.type&X.HORIZ_LINE_TO&&d(f.x),f.type&X.VERT_LINE_TO&&g(f.y),f.type&X.LINE_TO&&(d(f.x),g(f.y)),f.type&X.CURVE_TO){d(f.x),g(f.y);const E=lf(l,f.x1,f.x2,f.x);for(const C of E)0<C&&1>C&&d(hf(l,f.x1,f.x2,f.x,C));const _=lf(c,f.y1,f.y2,f.y);for(const C of _)0<C&&1>C&&g(hf(c,f.y1,f.y2,f.y,C))}if(f.type&X.ARC){d(f.x),g(f.y),zu(f,l,c);const E=f.xRot/180*Math.PI,_=Math.cos(E)*f.rX,C=Math.sin(E)*f.rX,R=-Math.sin(E)*f.rY,L=Math.cos(E)*f.rY,[N,I]=f.phi1<f.phi2?[f.phi1,f.phi2]:-180>f.phi2?[f.phi2+360,f.phi1+360]:[f.phi2,f.phi1],W=([F,q])=>{const tt=Math.atan2(q,F)*180/Math.PI;return tt<N?tt+360:tt},G=af(R,-_,0).map(W);for(const F of G)F>N&&F<I&&d(uf(f.cX,_,R,F));const b=af(L,-C,0).map(W);for(const F of b)F>N&&F<I&&g(uf(f.cY,C,L,F))}return o});return a.minX=1/0,a.maxX=-1/0,a.minY=1/0,a.maxY=-1/0,a}const fe={ROUND:p2,TO_ABS:cf,TO_REL:d2,NORMALIZE_HVZ:g2,NORMALIZE_ST:ff,QT_TO_C:pf,INFO:Hr,SANITIZE:y2,MATRIX:Xi,ROTATE:m2,TRANSLATE:v2,SCALE:x2,SKEW_X:E2,SKEW_Y:A2,X_AXIS_SYMMETRY:w2,Y_AXIS_SYMMETRY:b2,A_TO_C:T2,ANNOTATE_ARCS:_2,CLONE:df,CALCULATE_BOUNDS:C2};class wi{static cached=new Map;static cachedCanvas=new Map;static destroy(){this.cached.clear(),this.cachedCanvas.clear()}static createCanvas(t){var a;if(!((a=kt.window)!=null&&a.document))throw new Error("environment not support");let e;t.containerId&&(e=kt.window.document.getElementById(t.containerId)),e||(e=kt.window.document.getElementsByTagName("body")[0]);let i;if(t.canvasId&&(i=kt.window.document.getElementById(t.canvasId)||void 0),t.width||(t.width=(e==null?void 0:e.offsetWidth)||100),t.height||(t.height=(e==null?void 0:e.offsetHeight)||100),t.dpr||(t.dpr=kt.dpr),i)this.resizeCanvas(i,t.width,t.height,t.dpr);else{if(i=this.createHtmlCanvas(t.width,t.height,t.dpr),!i)throw new Error("error environment");t.canvasId&&i.setAttribute("id",t.canvasId),e==null||e.appendChild(i)}return i.style.background=t.background||"transparent",i}static getContext2D(t,e={}){const i={alpha:!0,willReadFrequently:!!e.willReadFrequently},a=t.getContext("2d",i);if(!a)throw new Error("getContext2D error");return a.scale(e.dpr||1,e.dpr||1),a}static resizeCanvas(t,e,i,a=1){t instanceof OffscreenCanvas?(t.width=e,t.height=i):t instanceof HTMLCanvasElement&&(t.setAttribute("width",(e*a).toString()),t.setAttribute("height",(i*a).toString()),t.style.width=e+"px",t.style.height=i+"px",t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.imageRendering="pixelated",t.style.transform="translateZ(0)")}static async getImageBitmapByCanvasAsync(t){if(t)return t instanceof OffscreenCanvas?t.transferToImageBitmap():t instanceof HTMLCanvasElement?await createImageBitmap(t):void 0}static get(t,e,i,a=1){let o=this.cached.get(t);return o||(o=this.create(e,i,a),this.set(t,o)),this.resizeCanvas(o,e,i,a),o}static set(t,e){if(!t||!e)throw new Error("error input");return this.cached.set(t,e)}static remove(t){this.cached.has(t)&&this.cached.delete(t)}static create(t,e,i=1){var a;if((a=kt.window)!=null&&a.OffscreenCanvas)return new OffscreenCanvas(t,e);throw new Error("environment does not support")}static createHtmlCanvas(t,e,i=1){if(!kt.window.document)throw new Error("environment does not support");const a=kt.window.document.createElement("canvas");return this.resizeCanvas(a,t,e,i),a}static measureText(t,e,i=new P){if(!t)throw new Error("input error");const o=this.get("measureText",1,1).getContext("2d");if(!o)throw new Error("bufferCtx not found");e.render(o);const l=o.measureText(t);if(!l)throw new Error("measureText error");const c=l.actualBoundingBoxRight+l.actualBoundingBoxLeft,f=l.actualBoundingBoxAscent+l.actualBoundingBoxDescent;return i.set(c,f),i}}let D2=0;class so extends H{name="Geo2";id=++D2;params;viewMatrix=new se;boundingBox=new _t;flipY=!1;renderPath;constructor(t={}){var e;super(t.commands),typeof t.flipY<"u"&&(this.flipY=!!t.flipY),this.params=t,(e=this.commands)!=null&&e.length&&this.toAbs(),t.flipY&&this.matrix(1,0,0,-1,0,0)}_version=0;get version(){return this._version}set version(t){this._version=t}set needsUpdate(t){t&&this._version++}setFromPoints(t){return t!=null&&t.length?(this.params.points=t,this.recomputePath(),this):this}recomputePath(){throw new Error("must be implemented in derived")}computeBoundingBox(){var t;this.boundingBox.makeEmpty(),dt.identity();for(let e=0,i=((t=this.commands)==null?void 0:t.length)||0;e<i;e++){const a=this.commands[e];switch(a.type){case H.MOVE_TO:this.boundingBox.expandByXY(a.x,a.y),dt.set(a.x,a.y);break;case H.LINE_TO:this.boundingBox.expandByXY(a.x,a.y),dt.set(a.x,a.y);break;case H.ARC:typeof a.xRot>"u"?(this.boundingBox.expandByXY(a.x,a.y),Ur.set(a.x,a.y).addScalar(-a.rX),this.boundingBox.expandByPoint(Ur),Ur.set(a.x,a.y).addScalar(a.rX),this.boundingBox.expandByPoint(Ur)):this.boundingBox.expandByXY(a.x,a.y),dt.set(a.x,a.y);break;case H.HORIZ_LINE_TO:this.boundingBox.expandByXY(a.x,dt.y),dt.set(a.x,dt.y);break;case H.VERT_LINE_TO:this.boundingBox.expandByXY(dt.x,a.y),dt.set(dt.x,a.y);break;case H.QUAD_TO:this.boundingBox.expandByXY(a.x,a.y),dt.set(a.x,a.y);break}}return this.boundingBox}render(t,e){if(this.renderPath=new Path2D,!(!t||!(e!=null&&e.length))){dt.identity();for(let i=0,a=(e==null?void 0:e.length)||0;i<a;i++){const o=e[i];switch(o.type){case H.MOVE_TO:this.renderPath.moveTo(o.x,o.y),dt.set(o.x,o.y);break;case H.LINE_TO:this.renderPath.lineTo(o.x,o.y),dt.set(o.x,o.y);break;case H.ARC:this.renderPath.arc(o.x,o.y,o.rX,o.phi1||0,o.phi2||Math.PI*2,o.sweepFlag!==1),dt.set(o.x,o.y);break;case H.HORIZ_LINE_TO:this.renderPath.lineTo(o.x,dt.y),dt.set(o.x,dt.y);break;case H.VERT_LINE_TO:this.renderPath.lineTo(dt.x,o.y),dt.set(dt.x,o.y);break;case H.CURVE_TO:dt.set(o.x,o.y);break;case H.SMOOTH_CURVE_TO:dt.set(o.x,o.y);break;case H.QUAD_TO:dt.set(o.x,o.y);break;case H.SMOOTH_QUAD_TO:dt.set(o.x,o.y);break}}}}applyMatrix(t){return this.needsUpdate=!0,this.matrix(t.elements[0],t.elements[1],t.elements[3],t.elements[4],t.elements[6],t.elements[7]),this}getRenderCommands(t){var o;const e=[];for(let l=0,c=((o=this.commands)==null?void 0:o.length)||0;l<c;l++)e.push(Object.assign({},this.commands[l]));if(!t)return e;dt.identity();const i=fe.MATRIX(t.elements[0],t.elements[1],t.elements[3],t.elements[4],t.elements[6],t.elements[7]),a=[];for(let l=0,c=e.length;l<c;l++){const f=e[l],d=i(f);if(d.type===H.ARC&&typeof d.xRot<"u"){const g=U0(dt.x,dt.y,d.x,d.y,d.lArcFlag,d.sweepFlag,d.rX,d.rY,0);dt.set(d.x,d.y),d.x=g[0],d.y=g[1],d.rX=g[2]>g[3]?g[2]:g[3],d.phi1=g[4],d.phi2=g[4]+g[5],d.sweepFlag=g[7],d.phi2===0&&(d.phi2=d.phi1>0?1e-6:-1e-6)}else if(d.type===H.ARC){if(dt.set(d.x,d.y),t.getScale(Ur),d.rX=d.rY*Math.abs(Ur.x),d.phi1!==0||d.phi2!==Math.PI*2){t.getRotation(Ur),d.phi1+=Ur.x,d.phi2+=Ur.x;const g=a[a.length-1];g.x=(g.x||0)+Math.cos(Ur.x)*d.rX*2,g.y=(g.y||0)+Math.sin(Ur.x)*d.rX*2}}else dt.set(d.x||dt.x,d.y||dt.y);Array.isArray(d)?a.push(...d):a.push(d)}return a}copy(t){return this.commands=Nt.cloneDeep(t.commands),this.version=0,this}clone(){const t=this.constructor;return new t(this.params).copy(this)}getConvexHull(){var e,i;const t=[];if(!((e=this.commands)!=null&&e.length))return t;for(let a=0,o=((i=this.commands)==null?void 0:i.length)||0;a<o;a++){const l=this.commands[a];switch(l.type){case H.MOVE_TO:t.push({x:l.x,y:l.y}),dt.set(l.x,l.y);break;case H.LINE_TO:t.push({x:l.x,y:l.y}),dt.set(l.x,l.y);break;case H.ARC:t.push({x:l.x,y:l.y}),dt.set(l.x,l.y);break;case H.HORIZ_LINE_TO:t.push({x:l.x,y:dt.y}),dt.set(l.x,dt.y);break;case H.VERT_LINE_TO:t.push({x:dt.x,y:l.y}),dt.set(dt.x,l.y);break;case H.CURVE_TO:case H.SMOOTH_CURVE_TO:t.push({x:l.x,y:l.y}),dt.set(l.x,l.y);break;case H.QUAD_TO:case H.SMOOTH_QUAD_TO:t.push({x:l.x,y:l.y}),dt.set(l.x,l.y);break}}return t}isPointInBoundingBox(t){return this.boundingBox?this.boundingBox.containsPoint(t):!1}isPointInPath(t){if(this.renderPath){Zi.save(),Zi.beginPath(),Zi.lineWidth=5,Zi.stroke(this.renderPath),Zi.fill(this.renderPath),Zi.closePath();const e=Zi.isPointInPath(this.renderPath,t.x,t.y);return Zi.restore(),e}return!1}}const dt=new P,Ur=new P,Zi=wi.get("RAY_CASTER",10,10).getContext("2d");class S2 extends so{isCircle=!0;radius=1;start=0;end=Math.PI*2;constructor(t={}){t.commands||(t.commands=[]),super(t),typeof t.radius<"u"&&(this.radius=t.radius),typeof t.start<"u"&&(this.start=t.start),typeof t.end<"u"&&(this.end=t.end),this.recomputePath()}recomputePath(){var i,a,o;if(!((a=(i=this.params)==null?void 0:i.points)!=null&&a.length))return this;const t=this.params.points,e=[];for(let l=0,c=t.length;l<c;l++)e.push({type:H.MOVE_TO,x:t[l].x>0?t[l].x+this.radius:t[l].x-this.radius,y:t[l].y*(this.params.flipY?-1:1),relative:!1}),e.push({type:H.ARC,rX:this.radius,rY:this.radius,xRot:void 0,lArcFlag:0,sweepFlag:((o=this.params)==null?void 0:o.sweepFlag)||1,phi1:this.start,phi2:this.end,x:t[l].x,y:t[l].y*(this.params.flipY?-1:1),relative:!1});return this.commands=e,this}}class O2{params;static splitLimit=100;constructor(t={}){this.params=t}destroy(){}static getInstanceByElement(t,e=!1){if(!t)return;let i;switch(t.nodeName){case"path":i=this.getInstanceByPath(t,e);break;case"circle":i=this.getInstanceByCircle(t,e);break}return i||console.error(`unsupported: ${t}`),i}static getInstanceByPath(t,e=!1){if(!t)return;const i=no(t,"d");if(!i)return;const a=i.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,""),o=a.match(/([Mm][^Mm]*)/g);if(!o||o.length<=this.splitLimit)try{return new so({commands:a,flipY:e})}catch(c){console.error(`getInstanceByPath error: ${c}: ${a}`);return}const l=[];for(let c=0,f=o.length;c<f;c+=this.splitLimit){const g=o.slice(c,c+this.splitLimit).join(" ");try{l.push(new so({commands:g,flipY:e}))}catch(E){console.error(`getInstanceByPath error: ${E}`)}}return l}static getInstanceByCircle(t,e=!1){if(!t||t.nodeName!=="circle")return;gf.set(no(t,"cx",0),no(t,"cy",0));const i=no(t,"r",0);return new S2({points:[gf.clone()],radius:i,flipY:e})}static getInstance(t,e=!1){if(t)return new so({commands:t,flipY:e})}}const gf=new P;class L2{svg;offset=new P;svgRoot;layers=[];elementsMap={};boundingBoxMap={};boundingBox=new _t;svgSkeletons=[];data;_exceptTypes=["view"];_exceptIds=["viewer","mirror"];_lvi=0;bindSvg(t){return this.svg=t,this.svgRoot=Rc(this.svg),this.layers=this.getLayers(2),this.getElementsMap(this.svg,this.elementsMap),this}getLayers(t){var e;if(!this.svg)throw new Error("please bind svg first");return t===2&&((e=this.layers)!=null&&e.length)?this.layers:(this.layers=this._getSvgLayer(this.svg,t),this.layers)}_getSvgLayer(t,e=0,i=0,a=[]){var c;let o,l=t.id;if(this._exceptTypes.includes(t.tagName)||t.tagName==="defs")return this._lvi--,a;if(e&&this._lvi>e)return a;l&&!this._exceptIds.includes(l)&&(o={value:l,label:l,children:[]},a.push(o)),this._lvi++;for(let f=0,d=t.children.length;f<d;f++)o?this._getSvgLayer(t.children[f],e,this._lvi,o.children):this._getSvgLayer(t.children[f],e,this._lvi,a);return((c=o==null?void 0:o.children)==null?void 0:c.length)===0&&delete o.children,this._lvi=i,a}getElementsMap(t,e={}){return this.traverseSvg(t,i=>{i!==t&&i.id&&(e[i.id]=i)}),e}computeBoundingBoxMap(){var e;if(Object.keys(this.boundingBoxMap).length)return this.boundingBoxMap;let t=(e=this.svg)==null?void 0:e.getBoundingClientRect();return t&&this.offset.set(t.left,t.top),this.traverseSvg(this.svg,i=>{if(!i.id)return;if(i.tagName==="use"){const l=this.getUseSymbolId(i);if(!l)return;const c=this.boundingBoxMap[l];if(c&&!c.isEmpty()){bi.set(Number(i.getAttribute("x")||"0"),Number(i.getAttribute("y")||"0")),ao.composeSvgTransform(bi.x,bi.y,i.getAttribute("transform"));const g=new _t().copy(c).applyMatrix3(ao);this.boundingBoxMap[i.id]=g;return}const f=this.getUseElementBoundingBoxWithSymbol(i);if(!f)return;this.boundingBoxMap[l]=f,bi.set(Number(i.getAttribute("x")||"0"),Number(i.getAttribute("y")||"0")),ao.composeSvgTransform(bi.x,bi.y,i.getAttribute("transform"));const d=new _t().copy(f).applyMatrix3(ao);this.boundingBoxMap[i.id]=d,this.boundingBox.expandByBox(d);return}if(typeof i.getBBox!="function")return;const a=i.getBBox();if((!a.width||!a.height)&&i.tagName==="path"){const l=O2.getInstanceByPath(i);if(!Array.isArray(l)){const c=l==null?void 0:l.computeBoundingBox();if(!c||c.isEmpty())return;c.getSize(bi),a.x=c.min.x,a.y=c.max.y,a.width=bi.x,a.height=bi.y}}if(!a.width||!a.height)return;const o=new _t(new P(a.x,a.y),new P(a.x+a.width,a.y+a.height));this.boundingBoxMap[i.id]=o.round(),this.boundingBox.expandByBox(o)}),this.boundingBoxMap}getLayerVisible(t){var i;const e=this.getElementById(t);if(e)return((i=e.style)==null?void 0:i.display)!=="none"}updateLayersVisibility(t,e=!1,i=!0){if(!this.elementsMap)throw new Error("please bind svg first");i&&this._updateAllLayersVisibility(!e),t!=null&&t.length||(t=["background"]);for(let a=0,o=t.length;a<o;a++){const l=this.getElementById(t[a]);l&&this._updateLayersVisibility(l,e,!0,!0)}}_updateAllLayersVisibility(t=!1){Object.values(this.elementsMap).forEach(e=>{e.tagName==="svg"||e.tagName==="symbol"||!e.getAttribute("id")||(e.style.display=t?"block":"none")})}_updateLayersVisibility(t,e=!1,i=!1,a=!1){var o,l;if(!(!t||t.tagName==="svg"||!t.getAttribute("id"))){if(t.style.display=e?"block":"none",i&&e){let c=t.parentElement;for(;c&&c.tagName!=="svg";)c.style.display=e?"block":"none",c=c.parentElement}if(a&&((o=t.children)==null?void 0:o.length)>0)for(let c=0,f=(l=t.children)==null?void 0:l.length;c<f;c++)this._updateLayersVisibility(t.children[c],e,!1,!0)}}updateVisibilityByAssetType(t,e=!1,i){i||(i=Mc[t]),this.updateLayersVisibility(i,!e)}updateVisibilityByAssetTypes(t,e=!1,i){if(Array.isArray(t)||(t=[t]),!!(t!=null&&t.length))for(let a=0,o=t.length;a<o;a++)this.updateVisibilityByAssetType(t[a],e,i)}getElementById(t){if(!this.elementsMap)throw new Error("please bind svg first");return this.elementsMap[t]}getElementBoundingBox(t){return this.boundingBoxMap[t]}findSkeletonByPath(t=[]){let e=0,i;const a=Object.keys(this.elementsMap);for(let o=0,l=a.length;o<l;o++){const c=this.elementsMap[a[o]];if(!c)continue;const f=c.getAttribute("d");f&&(f.length<e||(e=f.length,i=c.id?c:c.parent))}return i&&t.push(i),t}setTextInChildren2(t,e){var a;let i;((a=t==null?void 0:t.children)==null?void 0:a.length)<2?(i=Ru("text"),i.setAttribute("dy","1em"),t.appendChild(i)):i=t.children[t.children.length-1],i.innerHTML=e}traverseSvg(t,e){var i;if(!this._exceptTypes.includes(t.tagName)&&!(t.tagName!=="svg"&&t.tagName!=="defs"&&!t.id)&&!(t.tagName==="g"&&((i=t.children)==null?void 0:i.length)===0)){this._exceptIds.includes(t.id)||e(t);for(let a=0,o=t.children.length;a<o;a++)this.traverseSvg(t.children[a],e)}}traverseSvgTLayers(t,e){var i;if(Array.isArray(t)){for(let a=0,o=t.length;a<o;a++)this.traverseSvgTLayers(t[a],e);return}if(e(t),!!((i=t.children)!=null&&i.length))for(let a=0,o=t.children.length;a<o;a++)this.traverseSvgTLayers(t.children[a],e)}getLabelElementsByType(t,e={}){const i=this.getElementById(Js(t));return i&&this.getElementsMap(i,e),e}getLabelElementById(t,e="rm"){if(!t)return;const i=this.getElementById(t);if(!i)return;let a=i.getAttribute("aid");return a||(a="l-"+e+"-"+t),this.getElementById(a)}setLabelsById(t,e,i="rm"){var l,c;const a=this.getLabelElementById(t,i);if(!a)return;const o=((l=a.children)==null?void 0:l.length)||0;for(let f=0,d=((e==null?void 0:e.length)||0)-(o-1);f<d;f++){const g=Ru("text");g.setAttribute("x","0"),g.setAttribute("y",o+f+"em"),a.appendChild(g)}for(let f=1,d=(c=a.children)==null?void 0:c.length;f<d;f++)a.children[f].textContent=e&&f<=e.length?e[f-1]:""}clearAssetLabelsByType(t="rm"){var a;const e=this.getLabelElementsByType(t),i=Nt.keys(e);for(let o=0,l=i.length;o<l;o++){const c=e[i[o]];for(let f=1,d=((a=c.children)==null?void 0:a.length)||0;f<d;f++)c.children[f].textContent=""}}getUseSymbolId(t){var e;if(!(!t||t.tagName!=="use"))return(e=t.getAttribute("xlink:href"))==null?void 0:e.substring(1)}getUseSymbol(t){if(!t||t.tagName!=="use")return;const e=this.getUseSymbolId(t);if(e)return this.getElementById(e)}setElementState2selected(t,e=!1){var a;if(!t)return;if(t.tagName==="use"){const o=this._getSymbolBox(t);if(!o)return;e?(a=t.parentNode)==null||a.insertBefore(o,t):t.parentNode&&t.parentNode.contains(o)&&t.parentNode.removeChild(o);return}let i=t.getAttribute("class");i||(i=""),e?i="danger":i=Nt.replace(i,"danger","").trim(),t.setAttribute("class",i)}_getSymbolBox(t){if(!t)return;const e=t.id+"-boundingBox";let i=this.getElementById(e);if(i)return i;const a=this.getUseSymbol(t);if(!a)return;let o=this.getElementBoundingBox(t.id);if(!o||o.isEmpty())return;i=document.createElementNS("http://www.w3.org/2000/svg","rect"),i.setAttribute("id",e),i.setAttribute("class","danger"),i.setAttribute("x",o.min.x.toString()),i.setAttribute("y",o.min.y.toString());const l=new P;return o.getSize(l),i.setAttribute("width",l.x.toString()),i.setAttribute("height",l.y.toString()),a.getAttribute("transform")&&i.setAttribute("transform",a.getAttribute("transform")||""),a.getAttribute("style")&&i.setAttribute("style",a.getAttribute("style")||""),this.elementsMap[e]=i,i}getUseElementBoundingBoxWithSymbol(t){var f;if(!t)return;const e=(f=t.getAttribute("xlink:href"))==null?void 0:f.substring(1);if(!e)return;let i=this.getElementById(e);if(!i)return;const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.style.position="absolute",a.style.top="-9999px",a.style.left="-9999px";let o;if(Nt.lowerCase(i.tagName)==="symbol"){o=document.createElementNS("http://www.w3.org/2000/svg","g");for(let d=0,g=i.childNodes.length;d<g;d++){const E=i.childNodes[d].cloneNode(!0);o.appendChild(E)}}else o=i.cloneNode(!0);a.appendChild(o),o.setAttribute("style","stroke: #333333;"),document.body.appendChild(a);const l=a.getBBox();if(document.body.removeChild(a),!l)return;const c=new _t;return c.set(new P(l.x,l.y),new P(l.x+l.width,l.y+l.height)),c}fontZoom(t,e=1){const i=this.getElementById(t);if(!i)return;let a=i.getAttribute("font-size");a||(a="12");const o=/(\d+)([a-zA-Z%]+)/.exec(a),l=o&&(o==null?void 0:o.length)>2?o[2]:"";let c=Math.round(parseFloat(a)*e*100)/100;i.setAttribute("font-size",c+l)}getCentroid(t,e=new P){const i=t.getAttribute("insX"),a=t.getAttribute("insY");return i||a?e.set(Number(i||"0"),Number(a||"0")):this.getCentroidByDom(t,e)}getCentroidByDom(t,e=new P){const i=Number(t.getAttribute("x")||"0"),a=Number(t.getAttribute("y")||"0"),o=t.getBBox();let l=1,c=1,f=t.getAttribute("transform");if(!f)return e.set(i,a);const d=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(f);if(typeof d>"u"||d==null){const g=t.transform.baseVal;if(f&&g.numberOfItems>0){let E=g.getItem(0);E&&E.type===SVGTransform.SVG_TRANSFORM_SCALE&&(l=E.matrix.a!==0?E.matrix.a:1,c=E.matrix.d!==0?E.matrix.d:l)}else return e.set((o.x+o.width/2)*l,(o.y+o.height/2)*c)}else l=d[1]&&Number(d[1])>0?Number(d[1]):1,c=d[2]&&Number(d[2])>0?Number(d[2]):l;return i&&a?e.set(i*l,a*c):e.set((o.x+o.width/2)*l,(o.y+o.height/2)*c),e}_lastLinked=[];linkAssetsByTree(t,e){if(t||(t=$e.RM),this.clearLinkedLines(t),!e||!e.value)return;const i=this.getLinesByTree(e);this.drawLinkedLines(t,i)}clearLinkedLines(t){var a;const e=os(t);if(this.getElementById(e)){for(let o=((a=this._lastLinked)==null?void 0:a.length)-1;o>=0;o--){const l=this._lastLinked[o];l.parentNode&&l.parentNode.removeChild(l),this._lastLinked.splice(o,1)}this._lastLinked.length=0}}drawLinkedLines(t,e){var o;if(!(e!=null&&e.length))return;const i=os(t),a=this.getElementById(i);if(a)for(let l=0,c=e.length;l<c;l++){const f=e[l][0],d=e[l][((o=e[l])==null?void 0:o.length)-1],g=Ru("line");g.setAttribute("x1",f.x.toString()),g.setAttribute("y1",f.y.toString()),g.setAttribute("x2",d.x.toString()),g.setAttribute("y2",d.y.toString()),g.setAttribute("class","danger"),g.setAttribute("style","stroke-width: 2;"),a.appendChild(g),this._lastLinked.push(g)}}getLinesByTree(t,e=[]){var o;if(!(t!=null&&t.value))return e;const i=this.getElementBoundingBox(t.value);if(!i)return e;const a=i.getCenter();return(o=t.children)==null||o.forEach(l=>{var d;const c=this.getElementBoundingBox(l==null?void 0:l.value);if(!c)return;const f=c.getCenter();e.push([a,f]),(d=l.children)!=null&&d.length&&this.getLinesByTree(l,e)}),e}}const bi=new P,ao=new se;class N2{name="SvgPainter";params;chef;constructor(t={},e){this.params=t,this.chef=e}drawSocialDistanceCircles(t,e="http://www.w3.org/2000/svg"){var C,R,L;if(!t)return;const i=T0(t),a=Ic(t),o=2*i,l=(R=(C=this.params.socialDistance)==null?void 0:C.colors)!=null&&R.length?(L=this.params.socialDistance)==null?void 0:L.colors:[$t.green,$t.red],c=this.getRadius(a),f=t.querySelector(`#${Iu}`),d=f==null?void 0:f.querySelectorAll("path");if(!f||!(d!=null&&d.length))return;let g,E;const _=new Array;for(let N=0,I=(d==null?void 0:d.length)||0;N<I;N++){if(g=d[N],E=g.getAttribute("id"),!E)continue;const W=this.chef.getElementBoundingBox(E);if(!W)continue;const G=new P;W.getCenter(G),_.push({id:E,cp:G})}for(let N=0,I=_.length;N<I;N++){_[N].color=l[0];for(let W=0,G=I;W<G;W++)_[N]!==_[W]&&P.getDistance(_[N].cp,_[W].cp)<c*2&&(_[N].color=l[1])}for(let N=0,I=_.length;N<I;N++){let W=this.createCircle(_[N],c,o,e);f.appendChild(W)}}clearSocialDistanceCircles(t){if(!t)return;const e=t.querySelector(`#${Iu}`),i=e==null?void 0:e.querySelectorAll("circle");if(!(!e||!(i!=null&&i.length)))for(let a=0,o=(i==null?void 0:i.length)||0;a<o;a++){const l=i[a].getAttribute("id");l&&(l==null?void 0:l.indexOf("_circle"))>-1&&e.removeChild(i[a])}}getRadius(t){var i,a,o;let e=((a=(i=this.params)==null?void 0:i.socialDistance)==null?void 0:a.radius)||3;return((o=this.params)==null?void 0:o.displayUnits)==="imperial"?t==="Metres"||t==="m"?e/=3.28084:t==="cm"?e=e/3.28084*100:t==="mm"?e=e/3.28084*1e3:(t==="INCH"||t==="inches")&&(e*=12):t==="INCH"||t==="inches"?e=e*3.28084*12:t==="cm"?e*=100:t==="mm"&&(e*=1e3),e}createCircle(t,e,i,a){const o=document.createElementNS(a,"circle");return o.setAttributeNS(null,"id",t.id+"_circle"),o.setAttributeNS(null,"cx",t.cp.x),o.setAttributeNS(null,"cy",t.cp.y),o.setAttributeNS(null,"r",String(e)),o.setAttributeNS(null,"style",`pointer-events:none;fill-opacity:0.1;stroke:${t.color};stroke-width:${i}px;`),o}}const M2=function(r){return(r||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};function oo(r,t){if(!r||!t)return!1;if(t.indexOf(" ")!==-1)throw new Error("className should not contain space.");return r.classList?r.classList.contains(t):(" "+r.className+" ").indexOf(" "+t+" ")>-1}function ia(r,t){if(!r)return;let e=r.className;const i=(t||"").split(" ");for(let a=0,o=i.length;a<o;a++){const l=i[a];l&&(r.classList?r.classList.add(l):oo(r,l)||(e+=" "+l))}r.classList||(r.className=e)}function na(r,t){if(!r||!t)return;const e=t.split(" ");let i=" "+r.className+" ";for(let a=0,o=e.length;a<o;a++){const l=e[a];l&&(r.classList?r.classList.remove(l):oo(r,l)&&(i=i.replace(" "+l+" "," ")))}r.classList||(r.className=M2(i))}class $u extends R0{isSvgScene=!0;name="SvgScene";dynamically=!0;params;socialDistanceEnable=!1;container;svg;svgStr="";svgRoot;viewBox=new _t;chef;defaultLayers=[];skeletonLayers=[];currentLayers=[];assetType;assetsMap={};legend=[];selectedList=[];painter;_lastHighlightType="";_lastHighlightIds=[];clickSvgElementHandler=this.handleClickSvgElement.bind(this);constructor(t={}){super(),this.params=t,this.assetType=t.assetType||$e.RM,this.params.socialDistanceEnable&&(this.socialDistanceEnable=!0),this.container=this.params.containerId?document.getElementById(this.params.containerId):kt.window.document.getElementsByTagName("body")[0],this.chef=new L2,this.painter=new N2(t,this.chef)}get isMounted(){var t;return((t=this.container.querySelectorAll("svg"))==null?void 0:t.length)>0}destroy(){var t;super.destroy(),this.unmount(),(t=this.camera)==null||t.destroy()}mount(){this.svg&&(this.container.contains(this.svg)||this.container.appendChild(this.svg),this.chef.computeBoundingBoxMap())}unmount(){this.svg&&this.svg.parentNode&&this.container.contains(this.svg)&&this.container.removeChild(this.svg)}computeBoundingBox(){return this.boundingBox.makeEmpty(),!this.chef||!this.svg?this.boundingBox:(this.chef.computeBoundingBoxMap(),this.boundingBox.copy(this.chef.boundingBox),console.warn("svgScene.computeBoundingBox: ",this.chef.boundingBox.toString()),this.boundingBox)}async load(t){return new $c().loadAsync(t)}bind(t){if(this.svgStr=t,this.svg=new DOMParser().parseFromString(t,"image/svg+xml").documentElement,!this.svg)throw new Error("svg load failed");let e=this.svg.getAttribute("viewBox");return e?(_0(e,this.viewBox),this.chef.bindSvg(this.svg),this.svgRoot=Rc(this.svg),this.svg.setAttribute("viewBox",`0 0 ${this.params.width} ${this.params.height}`),this.svg.setAttribute("style","transform: translateZ(0);"),this.appendStyles(),console.log(this.name,"viewBox -> ",e,this.viewBox.toString()),this.setAssetsMap(this.assetType,this.assetsMap),!0):!1}appendStyles(){var e;let t=(e=this.svg)==null?void 0:e.querySelector("style");t&&(t.appendChild(document.createTextNode(`.default { stroke: ${this.params.defaultStroke}; fill: ${this.params.defaultFill}; }`)),t.appendChild(document.createTextNode(`.info { stroke: ${this.params.infoStroke}; fill: ${this.params.infoFill}; }`)),t.appendChild(document.createTextNode(`.primary { stroke: ${this.params.primaryStroke}; fill: ${this.params.primaryFill}; }`)),t.appendChild(document.createTextNode(`.success { stroke: ${this.params.successStroke}; fill: ${this.params.successFill}; }`)),t.appendChild(document.createTextNode(`.warning { stroke: ${this.params.warningStroke}; fill: ${this.params.warningFill}; }`)),t.appendChild(document.createTextNode(`.danger { stroke: ${this.params.dangerStroke}; fill: ${this.params.dangerFill}; }`)),t.appendChild(document.createTextNode(`.active { stroke: ${this.params.activeStroke}; fill: ${this.params.activeFill}; }`)))}getLayers(t=2){return this.svg?this.chef.getLayers(t):[]}setDefaultLayers(t){t!=null&&t.length&&(this.defaultLayers=t)}setSkeletonLayers(t){t!=null&&t.length&&(this.skeletonLayers=t)}setCurrentLayers(t){t!=null&&t.length&&(this.currentLayers=t)}showDefaultLayers(t,e=!1){this.setDefaultLayers(t),this.chef.updateLayersVisibility(t,e)}getLayerVisible(t){return this.chef.getLayerVisible(t)}updateLayersVisibility(t,e=!1,i=!0){this.chef.updateLayersVisibility(t,e,i)}setAssetType(t,e){this.assetsMap={},this.assetType=t,this.setAssetsMap(this.assetType,this.assetsMap),e||(e=[os(t)],t!==$e.RM&&e.unshift(os($e.RM))),this.setDefaultLayers(e),this.updateLayersVisibility(this.defaultLayers,!0)}isBelongsToAssetType(t,e){e||(e=this.assetType);const i=this.getAssetsByType(e);return i?!!(i!=null&&i.hasOwnProperty(t)):!1}setAssetsMap(t,e={}){const i=this.chef.getElementById(os(t));if(!i)return e;e[t]=this.chef.getElementsMap(i);const a=Js(t),o=this.chef.getElementById(a);if(!o)return e;const l=this.chef.getElementsMap(o),c=Nt.keys(l);if(!(c!=null&&c.length))return e;if(Nt.startsWith(c[0],`l-${t}-`)){const f=`l-${t}-`.length;for(let d=0,g=c.length;d<g;d++){const E=c[d].slice(f);l[E]=l[c[d]],delete l[c[d]]}}return e[a]=l,e}getAssetsByType(t){return this.assetsMap.hasOwnProperty(t)||this.setAssetsMap(t,this.assetsMap),this.assetsMap[t]}getElementById(t){if(!t)return;const e=this.getAssetsByType(this.assetType);if(!(!e||!Object.hasOwnProperty.call(e,t)))return e[t]}getAssetIdsByType(t){const e=this.getAssetsByType(t),i=[];return e?Nt.keys(e):i}clearFillOrStroke(t="fill"){const e=this.getAssetsByType(this.assetType);if(!e)return;const i=Nt.keys(e);let a;for(let o=0,l=i.length;o<l;o++)a=e[i[o]],!(!a||!a.hasAttribute(t))&&(a.removeAttribute(t),t==="stroke"&&a.removeAttribute("stroke-width"));this.clearLegendBy(t)}clearFillOrStrokeByIds(t,e="fill"){const i=this.getAssetsByType(this.assetType);if(!i)return;const a=Nt.keys(i);let o;for(let l=0,c=a.length;l<c;l++)t!=null&&t.length&&!t.includes(a[l])||(o=i[a[l]],!(!o||!o.hasAttribute(e))&&(o.removeAttribute(e),e==="stroke"&&o.removeAttribute("stroke-width")));this.clearLegendBy(e)}setFillOrStrokeByIds(t,e,i="fill",a="7"){const o=this.getAssetsByType(this.assetType);if(!o)return;const l=Nt.keys(o);let c;for(let f=0,d=l.length;f<d;f++)t.includes(l[f])&&(c=o[l[f]],c&&(c.setAttribute(i,e),i==="stroke"&&c.setAttribute("stroke-width",a),this.addLegend(i,e,l[f])))}addLegend(t,e,i){let a=this.legend.find(o=>o.color===e);a||(a={type:t,color:e,ids:[]},this.legend.push(a)),a.ids.push(i)}clearLegendBy(t){var e;t||(this.legend.length=0);for(let i=((e=this.legend)==null?void 0:e.length)-1;i>=0;i--)this.legend[i].type===t&&this.legend.splice(i,i)}getLegend(){return this.legend}showSkeleton(){var t;(t=this.skeletonLayers)!=null&&t.length&&(this.chef.updateLayersVisibility(this.defaultLayers,!1),this.chef.updateLayersVisibility(this.skeletonLayers,!0))}hideSkeleton(){var t;(t=this.skeletonLayers)!=null&&t.length&&(this.chef.updateLayersVisibility(this.skeletonLayers,!1),this.chef.updateLayersVisibility(this.defaultLayers,!0))}setAssetLabels(t,e){this.chef.setLabelsById(t,e,this.assetType)}getAssetLabelsMap(t){var a,o;if(!t)return;const e=Js(t);let i=this.getAssetsByType(e);if(!i||!((a=Object.keys(i))!=null&&a.length)){let l=this.chef.getElementById(e);if(l||(l=this.chef.getElementById(t+"-txt-label")),!l)return;i=this.chef.getElementsMap(l),this.assetsMap[e]=i}if(!(!i||!((o=Object.keys(i))!=null&&o.length)))return i}getAssetLabelById(t,e){var l,c;const i=this.getAssetLabelsMap(t);if(!i)return;let a=i[e];if(a&&((l=a==null?void 0:a.childNodes)!=null&&l.length))return a.childNodes[0].textContent||"";const o="l-"+t+"-"+e;if(a=i[o],a&&((c=a==null?void 0:a.children)!=null&&c.length))return a.children[0].textContent||""}clearAssetLabels(){this.chef.clearAssetLabelsByType(this.assetType)}bindAssetsEvents(t){var a;const e=(a=this.svg)==null?void 0:a.querySelector("#"+t);if(!e)return;e.querySelectorAll("[id]").forEach(o=>{o instanceof SVGElement&&o.addEventListener("click",this.clickSvgElementHandler)})}handleClickSvgElement(t){var e;typeof t.preventDefault=="function"&&t.preventDefault(),console.warn("svgScene.handleClickSvgElement: ",(e=t==null?void 0:t.target)==null?void 0:e.id,t==null?void 0:t.target),this.dispatchEvent({type:"click",data:t})}socialDistanceEnableChanged(t){this.socialDistanceEnable=!!t,t?this.painter.drawSocialDistanceCircles(this.svg):this.painter.clearSocialDistanceCircles(this.svg)}highlightAssets(t,e){var a;this.resetHighlightAssets(t);const i=this.getAssetsByType(t);!i||!((a=Object.keys(i))!=null&&a.length)||(this._lastHighlightType=t,this._lastHighlightIds=Array.isArray(e)?e:[e],this._lastHighlightIds.forEach(o=>{o&&i[o]&&ia(i[o],"active")}))}resetHighlightAssets(t){var i;const e=this.getAssetsByType(t||this._lastHighlightType);!e||!((i=Object.keys(e))!=null&&i.length)||(this._lastHighlightIds.forEach(a=>{a&&e[a]&&na(e[a],"active")}),this._lastHighlightIds.length=0)}getIntersectObjects(t,e=$e.RM,i=[]){i.length=0;const a=[],o=this.getAssetsByType(e);if(!o)return i;const l=Nt.keys(o);for(let f=0,d=l.length;f<d;f++){const g=this.chef.getElementBoundingBox(o[l[f]].id);g&&g.containsPoint(t.worldCoords)&&a.push(o[l[f]])}const c=Nt.sortBy(a,f=>{var d;return(d=this.chef.getElementBoundingBox(f.id))==null?void 0:d.getArea()});return i.push(...c),i}clearSelected(){var t,e;if((t=this.selectedList)!=null&&t.length)for(let i=((e=this.selectedList)==null?void 0:e.length)-1;i>=0;i--){let a=this.selectedList[i];this.selectedList.splice(i,1),this.chef.setElementState2selected(a,!1)}}clearSelectedById(t){var i,a;let e=(i=this.selectedList)==null?void 0:i.findIndex(o=>o.getAttribute("id")===t);e>-1&&(this.chef.setElementState2selected(this.selectedList[e],!1),(a=this.selectedList)==null||a.splice(e||0,1))}selectByIds(t,e=!1){Array.isArray(t)||(t=[t]),e||this.clearSelected();const i=Nt.uniq(Nt.map(this.selectedList,o=>o.getAttribute("id")||"")),a=this.getAssetsByType(this.assetType);if(a){for(let o=t.length-1;o>=0;o--)i.includes(t[o])?(this.clearSelectedById(t[o]),t.splice(o,1)):Object.hasOwnProperty.call(a,t[o])&&this.selectedList.push(a[t[o]]);this.selectedList.forEach(o=>{this.chef.setElementState2selected(o,!0)})}}getSelectedIds(){var e;if(!((e=this.selectedList)!=null&&e.length))return;const t=[];for(let i=0,a=this.selectedList.length;i<a;i++)this.selectedList[i].id&&t.push(this.selectedList[i].id);return t}getSelectedBoundingBox(){var e;const t=new _t;return(e=this.selectedList)!=null&&e.length?(this.selectedList.forEach(i=>{const a=this.chef.boundingBoxMap[i.id];a&&t.expandByBox(a)}),t):t.copy(this.boundingBox)}getElementsByBox(t){const e=[],i=Object.keys(this.chef.boundingBoxMap),a=this.getAssetsByType(this.assetType);if(!a)return e;for(let o=0,l=i.length;o<l;o++)if(a.hasOwnProperty(i[o])&&!(i[o].indexOf("-assets")>-1)&&t.intersectsBox(this.chef.boundingBoxMap[i[o]])){const c=a[i[o]];c&&e.push(c)}return e}getBoundingBoxByIds(t){var i,a;if(!t||Array.isArray(t)&&!t.length)return;Array.isArray(t)||(t=[t]);const e=new _t;for(let o=0,l=t==null?void 0:t.length;o<l;o++)(a=(i=this.chef)==null?void 0:i.boundingBoxMap)!=null&&a.hasOwnProperty(t[o])&&e.expandByBox(this.chef.boundingBoxMap[t[o]]);return e}getBoundingBoxById(t){if(this.chef.boundingBoxMap.hasOwnProperty(t))return new _t().copy(this.chef.boundingBoxMap[t])}_lastLinkedIds=[];linkAssetsByTree(t){this.chef.linkAssetsByTree(this.assetType,t);const e=this.chef.getElementById(js.ASSET_LABELS);e&&(e.style.display="block");const i=Js(this.assetType),a=this.chef.getElementById(i);a&&(a.style.display="block");const o=this.assetsMap[i];o&&(this._lastLinkedIds.forEach(l=>{o[l]&&(o[l].style.display="none")}),this._lastLinkedIds=Bc(t),this._lastLinkedIds.forEach(l=>{o[l]&&(o[l].style.display="block")}))}onBeforeRender(){}fullscreen(t=1e3,e=!1){}update(){}}class B2 extends $u{name="SvgLoadingScene";constructor(t){super(t),this.bind(`<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-200 -200 500 500">
|
|
34
|
+
`,sf=r=>48<=r.charCodeAt(0)&&r.charCodeAt(0)<=57;class l2 extends nf{constructor(){super(),this.curNumber="",this.curCommandType=-1,this.curCommandRelative=!1,this.canParseCommandOrComma=!0,this.curNumberHasExp=!1,this.curNumberHasExpDigits=!1,this.curNumberHasDecimal=!1,this.curArgs=[]}finish(t=[]){if(this.parse(" ",t),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return t}parse(t,e=[]){const i=a=>{e.push(a),this.curArgs.length=0,this.canParseCommandOrComma=!0};for(let a=0;a<t.length;a++){const o=t[a],l=this.curCommandType===X.ARC&&(this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber.length===1&&(this.curNumber==="0"||this.curNumber==="1"),c=sf(o)&&(this.curNumber==="0"&&o==="0"||l);if(sf(o)&&!c){this.curNumber+=o,this.curNumberHasExpDigits=this.curNumberHasExp;continue}if(o==="e"||o==="E"){this.curNumber+=o,this.curNumberHasExp=!0;continue}if((o==="-"||o==="+")&&this.curNumberHasExp&&!this.curNumberHasExpDigits){this.curNumber+=o;continue}if(o==="."&&!this.curNumberHasExp&&!this.curNumberHasDecimal&&!l){this.curNumber+=o,this.curNumberHasDecimal=!0;continue}if(this.curNumber&&this.curCommandType!==-1){const f=Number(this.curNumber);if(isNaN(f))throw new SyntaxError(`Invalid number ending at ${a}`);if(this.curCommandType===X.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>f)throw new SyntaxError(`Expected positive number, got "${f}" at index "${a}"`)}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError(`Expected a flag, got "${this.curNumber}" at index "${a}"`)}this.curArgs.push(f),this.curArgs.length===h2[this.curCommandType]&&(X.HORIZ_LINE_TO===this.curCommandType?i({type:X.HORIZ_LINE_TO,relative:this.curCommandRelative,x:f}):X.VERT_LINE_TO===this.curCommandType?i({type:X.VERT_LINE_TO,relative:this.curCommandRelative,y:f}):this.curCommandType===X.MOVE_TO||this.curCommandType===X.LINE_TO||this.curCommandType===X.SMOOTH_QUAD_TO?(i({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),X.MOVE_TO===this.curCommandType&&(this.curCommandType=X.LINE_TO)):this.curCommandType===X.CURVE_TO?i({type:X.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===X.SMOOTH_CURVE_TO?i({type:X.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===X.QUAD_TO?i({type:X.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===X.ARC&&i({type:X.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!u2(o)){if(o===","&&this.canParseCommandOrComma){this.canParseCommandOrComma=!1;continue}if(o==="+"||o==="-"||o==="."){this.curNumber=o,this.curNumberHasDecimal=o===".";continue}if(c){this.curNumber=o,this.curNumberHasDecimal=!1;continue}if(this.curArgs.length!==0)throw new SyntaxError(`Unterminated command at index ${a}.`);if(!this.canParseCommandOrComma)throw new SyntaxError(`Unexpected character "${o}" at index ${a}. Command cannot follow comma`);if(this.canParseCommandOrComma=!1,o==="z"||o==="Z"){e.push({type:X.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1;continue}else if(o==="h"||o==="H")this.curCommandType=X.HORIZ_LINE_TO,this.curCommandRelative=o==="h";else if(o==="v"||o==="V")this.curCommandType=X.VERT_LINE_TO,this.curCommandRelative=o==="v";else if(o==="m"||o==="M")this.curCommandType=X.MOVE_TO,this.curCommandRelative=o==="m";else if(o==="l"||o==="L")this.curCommandType=X.LINE_TO,this.curCommandRelative=o==="l";else if(o==="c"||o==="C")this.curCommandType=X.CURVE_TO,this.curCommandRelative=o==="c";else if(o==="s"||o==="S")this.curCommandType=X.SMOOTH_CURVE_TO,this.curCommandRelative=o==="s";else if(o==="q"||o==="Q")this.curCommandType=X.QUAD_TO,this.curCommandRelative=o==="q";else if(o==="t"||o==="T")this.curCommandType=X.SMOOTH_QUAD_TO,this.curCommandRelative=o==="t";else if(o==="a"||o==="A")this.curCommandType=X.ARC,this.curCommandRelative=o==="a";else throw new SyntaxError(`Unexpected character "${o}" at index ${a}.`)}}return e}transform(t){return Object.create(this,{parse:{value(i,a=[]){const o=Object.getPrototypeOf(this).parse.call(this,i);for(const l of o){const c=t(l);Array.isArray(c)?a.push(...c):a.push(c)}return a}}})}}const Ht=class Ht extends nf{constructor(t){super(),typeof t=="string"?this.commands=Ht.parse(t):this.commands=t}encode(){return Ht.encode(this.commands)}getBounds(){const t=fe.CALCULATE_BOUNDS();return this.transform(t),t}transform(t){const e=[];for(const i of this.commands){const a=t(i);Array.isArray(a)?e.push(...a):e.push(a)}return this.commands=e,this}static encode(t){return o2(t)}static parse(t){const e=new l2,i=[];return e.parse(t,i),e.finish(i),i}};Ht.CLOSE_PATH=1,Ht.MOVE_TO=2,Ht.HORIZ_LINE_TO=4,Ht.VERT_LINE_TO=8,Ht.LINE_TO=16,Ht.CURVE_TO=32,Ht.SMOOTH_CURVE_TO=64,Ht.QUAD_TO=128,Ht.SMOOTH_QUAD_TO=256,Ht.ARC=512,Ht.LINE_COMMANDS=Ht.LINE_TO|Ht.HORIZ_LINE_TO|Ht.VERT_LINE_TO,Ht.DRAWING_COMMANDS=Ht.HORIZ_LINE_TO|Ht.VERT_LINE_TO|Ht.LINE_TO|Ht.CURVE_TO|Ht.SMOOTH_CURVE_TO|Ht.QUAD_TO|Ht.SMOOTH_QUAD_TO|Ht.ARC;let X=Ht;const h2={[X.MOVE_TO]:2,[X.LINE_TO]:2,[X.HORIZ_LINE_TO]:1,[X.VERT_LINE_TO]:1,[X.CLOSE_PATH]:0,[X.QUAD_TO]:4,[X.SMOOTH_QUAD_TO]:2,[X.CURVE_TO]:6,[X.SMOOTH_CURVE_TO]:4,[X.ARC]:7};function Vu([r,t],e){return[r*Math.cos(e)-t*Math.sin(e),r*Math.sin(e)+t*Math.cos(e)]}function kr(...r){for(let t=0;t<r.length;t++)if(typeof r[t]!="number")throw new Error(`assertNumbers arguments[${t}] is not a number. ${typeof r[t]} == typeof ${r[t]}`);return!0}const Yi=Math.PI;function zu(r,t,e){r.lArcFlag=r.lArcFlag===0?0:1,r.sweepFlag=r.sweepFlag===0?0:1;let{rX:i,rY:a}=r;const{x:o,y:l}=r;i=Math.abs(r.rX),a=Math.abs(r.rY);const[c,f]=Vu([(t-o)/2,(e-l)/2],-r.xRot/180*Yi),d=Math.pow(c,2)/Math.pow(i,2)+Math.pow(f,2)/Math.pow(a,2);1<d&&(i*=Math.sqrt(d),a*=Math.sqrt(d)),r.rX=i,r.rY=a;const g=Math.pow(i,2)*Math.pow(f,2)+Math.pow(a,2)*Math.pow(c,2),E=(r.lArcFlag!==r.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(i,2)*Math.pow(a,2)-g)/g)),_=i*f/a*E,C=-a*c/i*E,R=Vu([_,C],r.xRot/180*Yi);r.cX=R[0]+(t+o)/2,r.cY=R[1]+(e+l)/2,r.phi1=Math.atan2((f-C)/a,(c-_)/i),r.phi2=Math.atan2((-f-C)/a,(-c-_)/i),r.sweepFlag===0&&r.phi2>r.phi1&&(r.phi2-=2*Yi),r.sweepFlag===1&&r.phi2<r.phi1&&(r.phi2+=2*Yi),r.phi1*=180/Yi,r.phi2*=180/Yi}function af(r,t,e){kr(r,t,e);const i=r*r+t*t-e*e;if(0>i)return[];if(i===0)return[[r*e/(r*r+t*t),t*e/(r*r+t*t)]];const a=Math.sqrt(i);return[[(r*e+t*a)/(r*r+t*t),(t*e-r*a)/(r*r+t*t)],[(r*e-t*a)/(r*r+t*t),(t*e+r*a)/(r*r+t*t)]]}const Ai=Math.PI/180;function of(r,t,e){return(1-e)*r+e*t}function uf(r,t,e,i){return r+Math.cos(i/180*Yi)*t+Math.sin(i/180*Yi)*e}function lf(r,t,e,i){const o=t-r,l=e-t,c=i-e,f=3*o+3*c-6*l,d=(l-o)*6,g=3*o;return Math.abs(f)<1e-6?[-g/d]:c2(d/f,g/f,1e-6)}function hf(r,t,e,i,a){const o=1-a,l=o*o*o,c=3*o*o*a,f=3*o*a*a,d=a*a*a;return r*l+t*c+e*f+i*d}function c2(r,t,e=1e-6){const i=r*r/4-t;if(i<-e)return[];if(i<=e)return[-r/2];const a=Math.sqrt(i);return[-(r/2)-a,-(r/2)+a]}function f2(r,t,e){r.cX||zu(r,t,e);const i=Math.min(r.phi1,r.phi2),a=Math.max(r.phi1,r.phi2),o=a-i,l=Math.ceil(o/90),c=new Array(l);let f=t,d=e;for(let g=0;g<l;g++){const E=of(r.phi1,r.phi2,g/l),_=of(r.phi1,r.phi2,(g+1)/l),C=_-E,R=4/3*Math.tan(C*Ai/4),[L,N]=[Math.cos(E*Ai)-R*Math.sin(E*Ai),Math.sin(E*Ai)+R*Math.cos(E*Ai)],[I,W]=[Math.cos(_*Ai),Math.sin(_*Ai)],[G,b]=[I+R*Math.sin(_*Ai),W-R*Math.cos(_*Ai)],F={relative:r.relative,type:X.CURVE_TO},q=(K,tt)=>{const[Z,rt]=Vu([K*r.rX,tt*r.rY],r.xRot);return[r.cX+Z,r.cY+rt]};[F.x1,F.y1]=q(L,N),[F.x2,F.y2]=q(G,b),[F.x,F.y]=q(I,W),r.relative&&(F.x1-=f,F.y1-=d,F.x2-=f,F.y2-=d,F.x-=f,F.y-=d),[f,d]=[F.x,F.y],c[g]=F}return c}function p2(r=1e13){kr(r);function t(e){return Math.round(e*r)/r}return function(i){return"x1"in i&&typeof i.x1<"u"&&(i.x1=t(i.x1)),"y1"in i&&typeof i.y1<"u"&&(i.y1=t(i.y1)),"x2"in i&&typeof i.x2<"u"&&(i.x2=t(i.x2)),"y2"in i&&typeof i.y2<"u"&&(i.y2=t(i.y2)),"x"in i&&typeof i.x<"u"&&(i.x=t(i.x)),"y"in i&&typeof i.y<"u"&&(i.y=t(i.y)),"rX"in i&&typeof i.rX<"u"&&(i.rX=t(i.rX)),"rY"in i&&typeof i.rY<"u"&&(i.rY=t(i.rY)),i}}function cf(){return Hr((r,t,e)=>(r.relative&&(typeof r.x1<"u"&&(r.x1+=t),typeof r.y1<"u"&&(r.y1+=e),typeof r.x2<"u"&&(r.x2+=t),typeof r.y2<"u"&&(r.y2+=e),typeof r.x<"u"&&(r.x+=t),typeof r.y<"u"&&(r.y+=e),r.relative=!1),r))}function d2(){return Hr((r,t,e)=>(r.relative||(typeof r.x1<"u"&&(r.x1-=t),typeof r.y1<"u"&&(r.y1-=e),typeof r.x2<"u"&&(r.x2-=t),typeof r.y2<"u"&&(r.y2-=e),typeof r.x<"u"&&(r.x-=t),typeof r.y<"u"&&(r.y-=e),r.relative=!0),r))}function g2(r=!0,t=!0,e=!0){return Hr((i,a,o,l,c)=>{if(isNaN(l)&&!(i.type&X.MOVE_TO))throw new Error("path must start with moveto");return t&&i.type&X.HORIZ_LINE_TO&&(i.type=X.LINE_TO,i.y=i.relative?0:o),e&&i.type&X.VERT_LINE_TO&&(i.type=X.LINE_TO,i.x=i.relative?0:a),r&&i.type&X.CLOSE_PATH&&(i.type=X.LINE_TO,i.x=i.relative?l-a:l,i.y=i.relative?c-o:c),i.type&X.ARC&&(i.rX===0||i.rY===0)&&(i.type=X.LINE_TO,delete i.rX,delete i.rY,delete i.xRot,delete i.lArcFlag,delete i.sweepFlag),i})}function ff(){let r=NaN,t=NaN,e=NaN,i=NaN;return Hr((a,o,l)=>(a.type&X.SMOOTH_CURVE_TO&&(a.type=X.CURVE_TO,r=isNaN(r)?o:r,t=isNaN(t)?l:t,a.x1=a.relative?o-r:2*o-r,a.y1=a.relative?l-t:2*l-t),a.type&X.CURVE_TO?(r=a.relative?o+a.x2:a.x2,t=a.relative?l+a.y2:a.y2):(r=NaN,t=NaN),a.type&X.SMOOTH_QUAD_TO&&(a.type=X.QUAD_TO,e=isNaN(e)?o:e,i=isNaN(i)?l:i,a.x1=a.relative?o-e:2*o-e,a.y1=a.relative?l-i:2*l-i),a.type&X.QUAD_TO?(e=a.relative?o+a.x1:a.x1,i=a.relative?l+a.y1:a.y1):(e=NaN,i=NaN),a))}function pf(){let r=NaN,t=NaN;return Hr((e,i,a)=>{if(e.type&X.SMOOTH_QUAD_TO&&(e.type=X.QUAD_TO,r=isNaN(r)?i:r,t=isNaN(t)?a:t,e.x1=e.relative?i-r:2*i-r,e.y1=e.relative?a-t:2*a-t),e.type&X.QUAD_TO){r=e.relative?i+e.x1:e.x1,t=e.relative?a+e.y1:e.y1;const o=e.x1,l=e.y1;e.type=X.CURVE_TO,e.x1=((e.relative?0:i)+o*2)/3,e.y1=((e.relative?0:a)+l*2)/3,e.x2=(e.x+o*2)/3,e.y2=(e.y+l*2)/3}else r=NaN,t=NaN;return e})}function Hr(r){let t=0,e=0,i=NaN,a=NaN;return function(l){if(isNaN(i)&&!(l.type&X.MOVE_TO))throw new Error("path must start with moveto");const c=r(l,t,e,i,a);return l.type&X.CLOSE_PATH&&(t=i,e=a),"x"in l&&typeof l.x<"u"&&(t=l.relative?t+l.x:l.x),"y"in l&&typeof l.y<"u"&&(e=l.relative?e+l.y:l.y),l.type&X.MOVE_TO&&(i=t,a=e),c}}function y2(r=0){kr(r);let t=NaN,e=NaN,i=NaN,a=NaN;return Hr((o,l,c,f,d)=>{const g=Math.abs;let E=!1,_=0,C=0;if(o.type&X.SMOOTH_CURVE_TO&&(_=isNaN(t)?0:l-t,C=isNaN(e)?0:c-e),o.type&(X.CURVE_TO|X.SMOOTH_CURVE_TO)?(t=o.relative?l+o.x2:o.x2,e=o.relative?c+o.y2:o.y2):(t=NaN,e=NaN),o.type&X.SMOOTH_QUAD_TO?(i=isNaN(i)?l:2*l-i,a=isNaN(a)?c:2*c-a):o.type&X.QUAD_TO?(i=o.relative?l+o.x1:o.x1,a=o.relative?c+o.y1:o.y2):(i=NaN,a=NaN),o.type&X.LINE_COMMANDS||o.type&X.ARC&&(o.rX===0||o.rY===0||!o.lArcFlag)||o.type&X.CURVE_TO||o.type&X.SMOOTH_CURVE_TO||o.type&X.QUAD_TO||o.type&X.SMOOTH_QUAD_TO){const R=typeof o.x>"u"?0:o.relative?o.x:o.x-l,L=typeof o.y>"u"?0:o.relative?o.y:o.y-c;_=isNaN(i)?typeof o.x1>"u"?_:o.relative?o.x:o.x1-l:i-l,C=isNaN(a)?typeof o.y1>"u"?C:o.relative?o.y:o.y1-c:a-c;const N=typeof o.x2>"u"?0:o.relative?o.x:o.x2-l,I=typeof o.y2>"u"?0:o.relative?o.y:o.y2-c;g(R)<=r&&g(L)<=r&&g(_)<=r&&g(C)<=r&&g(N)<=r&&g(I)<=r&&(E=!0)}return o.type&X.CLOSE_PATH&&g(l-f)<=r&&g(c-d)<=r&&(E=!0),E?[]:o})}function Xi(r,t,e,i,a,o){return kr(r,t,e,i,a,o),Hr((l,c,f,d)=>{const g=l.x1,E=l.x2,_=l.relative&&!isNaN(d),C=typeof l.x<"u"?l.x:_?0:c,R=typeof l.y<"u"?l.y:_?0:f;l.type&X.HORIZ_LINE_TO&&t!==0&&(l.type=X.LINE_TO,l.y=l.relative?0:f),l.type&X.VERT_LINE_TO&&e!==0&&(l.type=X.LINE_TO,l.x=l.relative?0:c),typeof l.x<"u"&&(l.x=l.x*r+R*e+(_?0:a)),typeof l.y<"u"&&(l.y=C*t+l.y*i+(_?0:o)),typeof l.x1<"u"&&(l.x1=l.x1*r+l.y1*e+(_?0:a)),typeof l.y1<"u"&&(l.y1=g*t+l.y1*i+(_?0:o)),typeof l.x2<"u"&&(l.x2=l.x2*r+l.y2*e+(_?0:a)),typeof l.y2<"u"&&(l.y2=E*t+l.y2*i+(_?0:o));function L(I){return I*I}const N=r*i-t*e;if(typeof l.xRot<"u"&&(r!==1||t!==0||e!==0||i!==1))if(N===0)delete l.rX,delete l.rY,delete l.xRot,delete l.lArcFlag,delete l.sweepFlag,l.type=X.LINE_TO;else{const I=l.xRot*Math.PI/180,W=Math.sin(I),G=Math.cos(I),b=1/L(l.rX),F=1/L(l.rY),q=L(G)*b+L(W)*F,K=2*W*G*(b-F),tt=L(W)*b+L(G)*F,Z=q*i*i-K*t*i+tt*t*t,rt=K*(r*i+t*e)-2*(q*e*i+tt*r*t),J=q*e*e-K*r*e+tt*r*r,st=(Math.atan2(rt,Z-J)+Math.PI)%Math.PI/2,ct=Math.sin(st),ft=Math.cos(st);l.rX=Math.abs(N)/Math.sqrt(Z*L(ft)+rt*ct*ft+J*L(ct)),l.rY=Math.abs(N)/Math.sqrt(Z*L(ct)-rt*ct*ft+J*L(ft)),l.xRot=st*180/Math.PI}return typeof l.sweepFlag<"u"&&0>N&&(l.sweepFlag=+!l.sweepFlag),l})}function m2(r,t=0,e=0){kr(r,t,e);const i=Math.sin(r),a=Math.cos(r);return Xi(a,i,-i,a,t-t*a+e*i,e-t*i-e*a)}function v2(r,t=0){return kr(r,t),Xi(1,0,0,1,r,t)}function x2(r,t=r){return kr(r,t),Xi(r,0,0,t,0,0)}function E2(r){return kr(r),Xi(1,0,Math.atan(r),1,0,0)}function A2(r){return kr(r),Xi(1,Math.atan(r),0,1,0,0)}function w2(r=0){return kr(r),Xi(-1,0,0,1,r,0)}function b2(r=0){return kr(r),Xi(1,0,0,-1,0,r)}function T2(){return Hr((r,t,e)=>X.ARC===r.type?f2(r,r.relative?0:t,r.relative?0:e):r)}function _2(){return Hr((r,t,e)=>(r.relative&&(t=0,e=0),X.ARC===r.type&&zu(r,t,e),r))}function df(){return r=>({...r})}function C2(){const r=df(),t=cf(),e=pf(),i=ff(),a=Hr((o,l,c)=>{const f=i(e(t(r(o))));function d(E){E>a.maxX&&(a.maxX=E),E<a.minX&&(a.minX=E)}function g(E){E>a.maxY&&(a.maxY=E),E<a.minY&&(a.minY=E)}if(f.type&X.DRAWING_COMMANDS&&(d(l),g(c)),f.type&X.HORIZ_LINE_TO&&d(f.x),f.type&X.VERT_LINE_TO&&g(f.y),f.type&X.LINE_TO&&(d(f.x),g(f.y)),f.type&X.CURVE_TO){d(f.x),g(f.y);const E=lf(l,f.x1,f.x2,f.x);for(const C of E)0<C&&1>C&&d(hf(l,f.x1,f.x2,f.x,C));const _=lf(c,f.y1,f.y2,f.y);for(const C of _)0<C&&1>C&&g(hf(c,f.y1,f.y2,f.y,C))}if(f.type&X.ARC){d(f.x),g(f.y),zu(f,l,c);const E=f.xRot/180*Math.PI,_=Math.cos(E)*f.rX,C=Math.sin(E)*f.rX,R=-Math.sin(E)*f.rY,L=Math.cos(E)*f.rY,[N,I]=f.phi1<f.phi2?[f.phi1,f.phi2]:-180>f.phi2?[f.phi2+360,f.phi1+360]:[f.phi2,f.phi1],W=([F,q])=>{const tt=Math.atan2(q,F)*180/Math.PI;return tt<N?tt+360:tt},G=af(R,-_,0).map(W);for(const F of G)F>N&&F<I&&d(uf(f.cX,_,R,F));const b=af(L,-C,0).map(W);for(const F of b)F>N&&F<I&&g(uf(f.cY,C,L,F))}return o});return a.minX=1/0,a.maxX=-1/0,a.minY=1/0,a.maxY=-1/0,a}const fe={ROUND:p2,TO_ABS:cf,TO_REL:d2,NORMALIZE_HVZ:g2,NORMALIZE_ST:ff,QT_TO_C:pf,INFO:Hr,SANITIZE:y2,MATRIX:Xi,ROTATE:m2,TRANSLATE:v2,SCALE:x2,SKEW_X:E2,SKEW_Y:A2,X_AXIS_SYMMETRY:w2,Y_AXIS_SYMMETRY:b2,A_TO_C:T2,ANNOTATE_ARCS:_2,CLONE:df,CALCULATE_BOUNDS:C2};class wi{static cached=new Map;static cachedCanvas=new Map;static destroy(){this.cached.clear(),this.cachedCanvas.clear()}static createCanvas(t){var a;if(!((a=kt.window)!=null&&a.document))throw new Error("environment not support");let e;t.containerId&&(e=kt.window.document.getElementById(t.containerId)),e||(e=kt.window.document.getElementsByTagName("body")[0]);let i;if(t.canvasId&&(i=kt.window.document.getElementById(t.canvasId)||void 0),t.width||(t.width=(e==null?void 0:e.offsetWidth)||100),t.height||(t.height=(e==null?void 0:e.offsetHeight)||100),t.dpr||(t.dpr=kt.dpr),i)this.resizeCanvas(i,t.width,t.height,t.dpr);else{if(i=this.createHtmlCanvas(t.width,t.height,t.dpr),!i)throw new Error("error environment");t.canvasId&&i.setAttribute("id",t.canvasId),e==null||e.appendChild(i)}return i.style.background=t.background||"transparent",i}static getContext2D(t,e={}){const i={alpha:!0,willReadFrequently:!!e.willReadFrequently},a=t.getContext("2d",i);if(!a)throw new Error("getContext2D error");return a.scale(e.dpr||1,e.dpr||1),a}static resizeCanvas(t,e,i,a=1){t instanceof OffscreenCanvas?(t.width=e,t.height=i):t instanceof HTMLCanvasElement&&(t.setAttribute("width",(e*a).toString()),t.setAttribute("height",(i*a).toString()),t.style.width=e+"px",t.style.height=i+"px",t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.imageRendering="pixelated",t.style.transform="translateZ(0)")}static async getImageBitmapByCanvasAsync(t){if(t)return t instanceof OffscreenCanvas?t.transferToImageBitmap():t instanceof HTMLCanvasElement?await createImageBitmap(t):void 0}static get(t,e,i,a=1){let o=this.cached.get(t);return o||(o=this.create(e,i,a),this.set(t,o)),this.resizeCanvas(o,e,i,a),o}static set(t,e){if(!t||!e)throw new Error("error input");return this.cached.set(t,e)}static remove(t){this.cached.has(t)&&this.cached.delete(t)}static create(t,e,i=1){var a;if((a=kt.window)!=null&&a.OffscreenCanvas)return new OffscreenCanvas(t,e);throw new Error("environment does not support")}static createHtmlCanvas(t,e,i=1){if(!kt.window.document)throw new Error("environment does not support");const a=kt.window.document.createElement("canvas");return this.resizeCanvas(a,t,e,i),a}static measureText(t,e,i=new P){if(!t)throw new Error("input error");const o=this.get("measureText",1,1).getContext("2d");if(!o)throw new Error("bufferCtx not found");e.render(o);const l=o.measureText(t);if(!l)throw new Error("measureText error");const c=l.actualBoundingBoxRight+l.actualBoundingBoxLeft,f=l.actualBoundingBoxAscent+l.actualBoundingBoxDescent;return i.set(c,f),i}}let D2=0;class so extends H{name="Geo2";id=++D2;params;viewMatrix=new se;boundingBox=new _t;flipY=!1;renderPath;constructor(t={}){var e;super(t.commands),typeof t.flipY<"u"&&(this.flipY=!!t.flipY),this.params=t,(e=this.commands)!=null&&e.length&&this.toAbs(),t.flipY&&this.matrix(1,0,0,-1,0,0)}_version=0;get version(){return this._version}set version(t){this._version=t}set needsUpdate(t){t&&this._version++}setFromPoints(t){return t!=null&&t.length?(this.params.points=t,this.recomputePath(),this):this}recomputePath(){throw new Error("must be implemented in derived")}computeBoundingBox(){var t;this.boundingBox.makeEmpty(),dt.identity();for(let e=0,i=((t=this.commands)==null?void 0:t.length)||0;e<i;e++){const a=this.commands[e];switch(a.type){case H.MOVE_TO:this.boundingBox.expandByXY(a.x,a.y),dt.set(a.x,a.y);break;case H.LINE_TO:this.boundingBox.expandByXY(a.x,a.y),dt.set(a.x,a.y);break;case H.ARC:typeof a.xRot>"u"?(this.boundingBox.expandByXY(a.x,a.y),Ur.set(a.x,a.y).addScalar(-a.rX),this.boundingBox.expandByPoint(Ur),Ur.set(a.x,a.y).addScalar(a.rX),this.boundingBox.expandByPoint(Ur)):this.boundingBox.expandByXY(a.x,a.y),dt.set(a.x,a.y);break;case H.HORIZ_LINE_TO:this.boundingBox.expandByXY(a.x,dt.y),dt.set(a.x,dt.y);break;case H.VERT_LINE_TO:this.boundingBox.expandByXY(dt.x,a.y),dt.set(dt.x,a.y);break;case H.QUAD_TO:this.boundingBox.expandByXY(a.x,a.y),dt.set(a.x,a.y);break}}return this.boundingBox}render(t,e){if(this.renderPath=new Path2D,!(!t||!(e!=null&&e.length))){dt.identity();for(let i=0,a=(e==null?void 0:e.length)||0;i<a;i++){const o=e[i];switch(o.type){case H.MOVE_TO:this.renderPath.moveTo(o.x,o.y),dt.set(o.x,o.y);break;case H.LINE_TO:this.renderPath.lineTo(o.x,o.y),dt.set(o.x,o.y);break;case H.ARC:this.renderPath.arc(o.x,o.y,o.rX,o.phi1||0,o.phi2||Math.PI*2,o.sweepFlag!==1),dt.set(o.x,o.y);break;case H.HORIZ_LINE_TO:this.renderPath.lineTo(o.x,dt.y),dt.set(o.x,dt.y);break;case H.VERT_LINE_TO:this.renderPath.lineTo(dt.x,o.y),dt.set(dt.x,o.y);break;case H.CURVE_TO:dt.set(o.x,o.y);break;case H.SMOOTH_CURVE_TO:dt.set(o.x,o.y);break;case H.QUAD_TO:dt.set(o.x,o.y);break;case H.SMOOTH_QUAD_TO:dt.set(o.x,o.y);break}}}}applyMatrix(t){return this.needsUpdate=!0,this.matrix(t.elements[0],t.elements[1],t.elements[3],t.elements[4],t.elements[6],t.elements[7]),this}getRenderCommands(t){var o;const e=[];for(let l=0,c=((o=this.commands)==null?void 0:o.length)||0;l<c;l++)e.push(Object.assign({},this.commands[l]));if(!t)return e;dt.identity();const i=fe.MATRIX(t.elements[0],t.elements[1],t.elements[3],t.elements[4],t.elements[6],t.elements[7]),a=[];for(let l=0,c=e.length;l<c;l++){const f=e[l],d=i(f);if(d.type===H.ARC&&typeof d.xRot<"u"){const g=U0(dt.x,dt.y,d.x,d.y,d.lArcFlag,d.sweepFlag,d.rX,d.rY,0);dt.set(d.x,d.y),d.x=g[0],d.y=g[1],d.rX=g[2]>g[3]?g[2]:g[3],d.phi1=g[4],d.phi2=g[4]+g[5],d.sweepFlag=g[7],d.phi2===0&&(d.phi2=d.phi1>0?1e-6:-1e-6)}else if(d.type===H.ARC){if(dt.set(d.x,d.y),t.getScale(Ur),d.rX=d.rY*Math.abs(Ur.x),d.phi1!==0||d.phi2!==Math.PI*2){t.getRotation(Ur),d.phi1+=Ur.x,d.phi2+=Ur.x;const g=a[a.length-1];g.x=(g.x||0)+Math.cos(Ur.x)*d.rX*2,g.y=(g.y||0)+Math.sin(Ur.x)*d.rX*2}}else dt.set(d.x||dt.x,d.y||dt.y);Array.isArray(d)?a.push(...d):a.push(d)}return a}copy(t){return this.commands=Nt.cloneDeep(t.commands),this.version=0,this}clone(){const t=this.constructor;return new t(this.params).copy(this)}getConvexHull(){var e,i;const t=[];if(!((e=this.commands)!=null&&e.length))return t;for(let a=0,o=((i=this.commands)==null?void 0:i.length)||0;a<o;a++){const l=this.commands[a];switch(l.type){case H.MOVE_TO:t.push({x:l.x,y:l.y}),dt.set(l.x,l.y);break;case H.LINE_TO:t.push({x:l.x,y:l.y}),dt.set(l.x,l.y);break;case H.ARC:t.push({x:l.x,y:l.y}),dt.set(l.x,l.y);break;case H.HORIZ_LINE_TO:t.push({x:l.x,y:dt.y}),dt.set(l.x,dt.y);break;case H.VERT_LINE_TO:t.push({x:dt.x,y:l.y}),dt.set(dt.x,l.y);break;case H.CURVE_TO:case H.SMOOTH_CURVE_TO:t.push({x:l.x,y:l.y}),dt.set(l.x,l.y);break;case H.QUAD_TO:case H.SMOOTH_QUAD_TO:t.push({x:l.x,y:l.y}),dt.set(l.x,l.y);break}}return t}isPointInBoundingBox(t){return this.boundingBox?this.boundingBox.containsPoint(t):!1}isPointInPath(t){if(this.renderPath){Zi.save(),Zi.beginPath(),Zi.lineWidth=5,Zi.stroke(this.renderPath),Zi.fill(this.renderPath),Zi.closePath();const e=Zi.isPointInPath(this.renderPath,t.x,t.y);return Zi.restore(),e}return!1}}const dt=new P,Ur=new P,Zi=wi.get("RAY_CASTER",10,10).getContext("2d");class S2 extends so{isCircle=!0;radius=1;start=0;end=Math.PI*2;constructor(t={}){t.commands||(t.commands=[]),super(t),typeof t.radius<"u"&&(this.radius=t.radius),typeof t.start<"u"&&(this.start=t.start),typeof t.end<"u"&&(this.end=t.end),this.recomputePath()}recomputePath(){var i,a,o;if(!((a=(i=this.params)==null?void 0:i.points)!=null&&a.length))return this;const t=this.params.points,e=[];for(let l=0,c=t.length;l<c;l++)e.push({type:H.MOVE_TO,x:t[l].x>0?t[l].x+this.radius:t[l].x-this.radius,y:t[l].y*(this.params.flipY?-1:1),relative:!1}),e.push({type:H.ARC,rX:this.radius,rY:this.radius,xRot:void 0,lArcFlag:0,sweepFlag:((o=this.params)==null?void 0:o.sweepFlag)||1,phi1:this.start,phi2:this.end,x:t[l].x,y:t[l].y*(this.params.flipY?-1:1),relative:!1});return this.commands=e,this}}class O2{params;static splitLimit=100;constructor(t={}){this.params=t}destroy(){}static getInstanceByElement(t,e=!1){if(!t)return;let i;switch(t.nodeName){case"path":i=this.getInstanceByPath(t,e);break;case"circle":i=this.getInstanceByCircle(t,e);break}return i||console.error(`unsupported: ${t}`),i}static getInstanceByPath(t,e=!1){if(!t)return;const i=no(t,"d");if(!i)return;const a=i.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,""),o=a.match(/([Mm][^Mm]*)/g);if(!o||o.length<=this.splitLimit)try{return new so({commands:a,flipY:e})}catch(c){console.error(`getInstanceByPath error: ${c}: ${a}`);return}const l=[];for(let c=0,f=o.length;c<f;c+=this.splitLimit){const g=o.slice(c,c+this.splitLimit).join(" ");try{l.push(new so({commands:g,flipY:e}))}catch(E){console.error(`getInstanceByPath error: ${E}`)}}return l}static getInstanceByCircle(t,e=!1){if(!t||t.nodeName!=="circle")return;gf.set(no(t,"cx",0),no(t,"cy",0));const i=no(t,"r",0);return new S2({points:[gf.clone()],radius:i,flipY:e})}static getInstance(t,e=!1){if(t)return new so({commands:t,flipY:e})}}const gf=new P;class L2{svg;offset=new P;svgRoot;layers=[];elementsMap={};boundingBoxMap={};boundingBox=new _t;svgSkeletons=[];data;_exceptTypes=["view"];_exceptIds=["viewer","mirror"];_lvi=0;bindSvg(t){return this.svg=t,this.svgRoot=Rc(this.svg),this.layers=this.getLayers(2),this.getElementsMap(this.svg,this.elementsMap),this}getLayers(t){var e;if(!this.svg)throw new Error("please bind svg first");return t===2&&((e=this.layers)!=null&&e.length)?this.layers:(this.layers=this._getSvgLayer(this.svg,t),this.layers)}_getSvgLayer(t,e=0,i=0,a=[]){var c;let o,l=t.id;if(this._exceptTypes.includes(t.tagName)||t.tagName==="defs")return this._lvi--,a;if(e&&this._lvi>e)return a;l&&!this._exceptIds.includes(l)&&(o={value:l,label:l,children:[]},a.push(o)),this._lvi++;for(let f=0,d=t.children.length;f<d;f++)o?this._getSvgLayer(t.children[f],e,this._lvi,o.children):this._getSvgLayer(t.children[f],e,this._lvi,a);return((c=o==null?void 0:o.children)==null?void 0:c.length)===0&&delete o.children,this._lvi=i,a}getElementsMap(t,e={}){return this.traverseSvg(t,i=>{i!==t&&i.id&&(e[i.id]=i)}),e}computeBoundingBoxMap(){var e;if(Object.keys(this.boundingBoxMap).length)return this.boundingBoxMap;let t=(e=this.svg)==null?void 0:e.getBoundingClientRect();return t&&this.offset.set(t.left,t.top),this.traverseSvg(this.svg,i=>{if(!i.id)return;if(i.tagName==="use"){const l=this.getUseSymbolId(i);if(!l)return;const c=this.boundingBoxMap[l];if(c&&!c.isEmpty()){bi.set(Number(i.getAttribute("x")||"0"),Number(i.getAttribute("y")||"0")),ao.composeSvgTransform(bi.x,bi.y,i.getAttribute("transform"));const g=new _t().copy(c).applyMatrix3(ao);this.boundingBoxMap[i.id]=g;return}const f=this.getUseElementBoundingBoxWithSymbol(i);if(!f)return;this.boundingBoxMap[l]=f,bi.set(Number(i.getAttribute("x")||"0"),Number(i.getAttribute("y")||"0")),ao.composeSvgTransform(bi.x,bi.y,i.getAttribute("transform"));const d=new _t().copy(f).applyMatrix3(ao);this.boundingBoxMap[i.id]=d,this.boundingBox.expandByBox(d);return}if(typeof i.getBBox!="function")return;const a=i.getBBox();if((!a.width||!a.height)&&i.tagName==="path"){const l=O2.getInstanceByPath(i);if(!Array.isArray(l)){const c=l==null?void 0:l.computeBoundingBox();if(!c||c.isEmpty())return;c.getSize(bi),a.x=c.min.x,a.y=c.max.y,a.width=bi.x,a.height=bi.y}}if(!a.width||!a.height)return;const o=new _t(new P(a.x,a.y),new P(a.x+a.width,a.y+a.height));this.boundingBoxMap[i.id]=o.round(),this.boundingBox.expandByBox(o)}),this.boundingBoxMap}getLayerVisible(t){var i;const e=this.getElementById(t);if(e)return((i=e.style)==null?void 0:i.display)!=="none"}updateLayersVisibility(t,e=!1,i=!0){if(!this.elementsMap)throw new Error("please bind svg first");i&&this._updateAllLayersVisibility(!e),t!=null&&t.length||(t=["background"]);for(let a=0,o=t.length;a<o;a++){const l=this.getElementById(t[a]);l&&this._updateLayersVisibility(l,e,!0,!0)}}_updateAllLayersVisibility(t=!1){Object.values(this.elementsMap).forEach(e=>{e.tagName==="svg"||e.tagName==="symbol"||!e.getAttribute("id")||(e.style.display=t?"block":"none")})}_updateLayersVisibility(t,e=!1,i=!1,a=!1){var o,l;if(!(!t||t.tagName==="svg"||!t.getAttribute("id"))){if(t.style.display=e?"block":"none",i&&e){let c=t.parentElement;for(;c&&c.tagName!=="svg";)c.style.display=e?"block":"none",c=c.parentElement}if(a&&((o=t.children)==null?void 0:o.length)>0)for(let c=0,f=(l=t.children)==null?void 0:l.length;c<f;c++)this._updateLayersVisibility(t.children[c],e,!1,!0)}}updateVisibilityByAssetType(t,e=!1,i){i||(i=Mc[t]),this.updateLayersVisibility(i,!e)}updateVisibilityByAssetTypes(t,e=!1,i){if(Array.isArray(t)||(t=[t]),!!(t!=null&&t.length))for(let a=0,o=t.length;a<o;a++)this.updateVisibilityByAssetType(t[a],e,i)}getElementById(t){if(!this.elementsMap)throw new Error("please bind svg first");return this.elementsMap[t]}getElementBoundingBox(t){return this.boundingBoxMap[t]}findSkeletonByPath(t=[]){let e=0,i;const a=Object.keys(this.elementsMap);for(let o=0,l=a.length;o<l;o++){const c=this.elementsMap[a[o]];if(!c)continue;const f=c.getAttribute("d");f&&(f.length<e||(e=f.length,i=c.id?c:c.parent))}return i&&t.push(i),t}setTextInChildren2(t,e){var a;let i;((a=t==null?void 0:t.children)==null?void 0:a.length)<2?(i=Ru("text"),i.setAttribute("dy","1em"),t.appendChild(i)):i=t.children[t.children.length-1],i.innerHTML=e}traverseSvg(t,e){var i;if(!this._exceptTypes.includes(t.tagName)&&!(t.tagName!=="svg"&&t.tagName!=="defs"&&!t.id)&&!(t.tagName==="g"&&((i=t.children)==null?void 0:i.length)===0)){this._exceptIds.includes(t.id)||e(t);for(let a=0,o=t.children.length;a<o;a++)this.traverseSvg(t.children[a],e)}}traverseSvgTLayers(t,e){var i;if(Array.isArray(t)){for(let a=0,o=t.length;a<o;a++)this.traverseSvgTLayers(t[a],e);return}if(e(t),!!((i=t.children)!=null&&i.length))for(let a=0,o=t.children.length;a<o;a++)this.traverseSvgTLayers(t.children[a],e)}getLabelElementsByType(t,e={}){const i=this.getElementById(Js(t));return i&&this.getElementsMap(i,e),e}getLabelElementById(t,e="rm"){if(!t)return;const i=this.getElementById(t);if(!i)return;let a=i.getAttribute("aid");return a||(a="l-"+e+"-"+t),this.getElementById(a)}setLabelsById(t,e,i="rm"){var l,c;const a=this.getLabelElementById(t,i);if(!a)return;const o=((l=a.children)==null?void 0:l.length)||0;for(let f=0,d=((e==null?void 0:e.length)||0)-(o-1);f<d;f++){const g=Ru("text");g.setAttribute("x","0"),g.setAttribute("y",o+f+"em"),a.appendChild(g)}for(let f=1,d=(c=a.children)==null?void 0:c.length;f<d;f++)a.children[f].textContent=e&&f<=e.length?e[f-1]:""}clearAssetLabelsByType(t="rm"){var a;const e=this.getLabelElementsByType(t),i=Nt.keys(e);for(let o=0,l=i.length;o<l;o++){const c=e[i[o]];for(let f=1,d=((a=c.children)==null?void 0:a.length)||0;f<d;f++)c.children[f].textContent=""}}getUseSymbolId(t){var e;if(!(!t||t.tagName!=="use"))return(e=t.getAttribute("xlink:href"))==null?void 0:e.substring(1)}getUseSymbol(t){if(!t||t.tagName!=="use")return;const e=this.getUseSymbolId(t);if(e)return this.getElementById(e)}setElementState2selected(t,e=!1){var a;if(!t)return;if(t.tagName==="use"){const o=this._getSymbolBox(t);if(!o)return;e?(a=t.parentNode)==null||a.insertBefore(o,t):t.parentNode&&t.parentNode.contains(o)&&t.parentNode.removeChild(o);return}let i=t.getAttribute("class");i||(i=""),e?i="danger":i=Nt.replace(i,"danger","").trim(),t.setAttribute("class",i)}_getSymbolBox(t){if(!t)return;const e=t.id+"-boundingBox";let i=this.getElementById(e);if(i)return i;const a=this.getUseSymbol(t);if(!a)return;let o=this.getElementBoundingBox(t.id);if(!o||o.isEmpty())return;i=document.createElementNS("http://www.w3.org/2000/svg","rect"),i.setAttribute("id",e),i.setAttribute("class","danger"),i.setAttribute("x",o.min.x.toString()),i.setAttribute("y",o.min.y.toString());const l=new P;return o.getSize(l),i.setAttribute("width",l.x.toString()),i.setAttribute("height",l.y.toString()),a.getAttribute("transform")&&i.setAttribute("transform",a.getAttribute("transform")||""),a.getAttribute("style")&&i.setAttribute("style",a.getAttribute("style")||""),this.elementsMap[e]=i,i}getUseElementBoundingBoxWithSymbol(t){var f;if(!t)return;const e=(f=t.getAttribute("xlink:href"))==null?void 0:f.substring(1);if(!e)return;let i=this.getElementById(e);if(!i)return;const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.style.position="absolute",a.style.top="-9999px",a.style.left="-9999px";let o;if(Nt.lowerCase(i.tagName)==="symbol"){o=document.createElementNS("http://www.w3.org/2000/svg","g");for(let d=0,g=i.childNodes.length;d<g;d++){const E=i.childNodes[d].cloneNode(!0);o.appendChild(E)}}else o=i.cloneNode(!0);a.appendChild(o),o.setAttribute("style","stroke: #333333;"),document.body.appendChild(a);const l=a.getBBox();if(document.body.removeChild(a),!l)return;const c=new _t;return c.set(new P(l.x,l.y),new P(l.x+l.width,l.y+l.height)),c}fontZoom(t,e=1){const i=this.getElementById(t);if(!i)return;let a=i.getAttribute("font-size");a||(a="12");const o=/(\d+)([a-zA-Z%]+)/.exec(a),l=o&&(o==null?void 0:o.length)>2?o[2]:"";let c=Math.round(parseFloat(a)*e*100)/100;i.setAttribute("font-size",c+l)}getCentroid(t,e=new P){const i=t.getAttribute("insX"),a=t.getAttribute("insY");return i||a?e.set(Number(i||"0"),Number(a||"0")):this.getCentroidByDom(t,e)}getCentroidByDom(t,e=new P){const i=Number(t.getAttribute("x")||"0"),a=Number(t.getAttribute("y")||"0"),o=t.getBBox();let l=1,c=1,f=t.getAttribute("transform");if(!f)return e.set(i,a);const d=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(f);if(typeof d>"u"||d==null){const g=t.transform.baseVal;if(f&&g.numberOfItems>0){let E=g.getItem(0);E&&E.type===SVGTransform.SVG_TRANSFORM_SCALE&&(l=E.matrix.a!==0?E.matrix.a:1,c=E.matrix.d!==0?E.matrix.d:l)}else return e.set((o.x+o.width/2)*l,(o.y+o.height/2)*c)}else l=d[1]&&Number(d[1])>0?Number(d[1]):1,c=d[2]&&Number(d[2])>0?Number(d[2]):l;return i&&a?e.set(i*l,a*c):e.set((o.x+o.width/2)*l,(o.y+o.height/2)*c),e}_lastLinked=[];linkAssetsByTree(t,e){if(t||(t=$e.RM),this.clearLinkedLines(t),!e||!e.value)return;const i=this.getLinesByTree(e);this.drawLinkedLines(t,i)}clearLinkedLines(t){var a;const e=os(t);if(this.getElementById(e)){for(let o=((a=this._lastLinked)==null?void 0:a.length)-1;o>=0;o--){const l=this._lastLinked[o];l.parentNode&&l.parentNode.removeChild(l),this._lastLinked.splice(o,1)}this._lastLinked.length=0}}drawLinkedLines(t,e){var o;if(!(e!=null&&e.length))return;const i=os(t),a=this.getElementById(i);if(a)for(let l=0,c=e.length;l<c;l++){const f=e[l][0],d=e[l][((o=e[l])==null?void 0:o.length)-1],g=Ru("line");g.setAttribute("x1",f.x.toString()),g.setAttribute("y1",f.y.toString()),g.setAttribute("x2",d.x.toString()),g.setAttribute("y2",d.y.toString()),g.setAttribute("class","danger"),g.setAttribute("style","stroke-width: 2;"),a.appendChild(g),this._lastLinked.push(g)}}getLinesByTree(t,e=[]){var o;if(!(t!=null&&t.value))return e;const i=this.getElementBoundingBox(t.value);if(!i)return e;const a=i.getCenter();return(o=t.children)==null||o.forEach(l=>{var d;const c=this.getElementBoundingBox(l==null?void 0:l.value);if(!c)return;const f=c.getCenter();e.push([a,f]),(d=l.children)!=null&&d.length&&this.getLinesByTree(l,e)}),e}}const bi=new P,ao=new se;class N2{name="SvgPainter";params;chef;constructor(t={},e){this.params=t,this.chef=e}drawSocialDistanceCircles(t,e="http://www.w3.org/2000/svg"){var C,R,L;if(!t)return;const i=T0(t),a=Ic(t),o=2*i,l=(R=(C=this.params.socialDistance)==null?void 0:C.colors)!=null&&R.length?(L=this.params.socialDistance)==null?void 0:L.colors:[$t.green,$t.red],c=this.getRadius(a),f=t.querySelector(`#${Iu}`),d=f==null?void 0:f.querySelectorAll("path");if(!f||!(d!=null&&d.length))return;let g,E;const _=new Array;for(let N=0,I=(d==null?void 0:d.length)||0;N<I;N++){if(g=d[N],E=g.getAttribute("id"),!E)continue;const W=this.chef.getElementBoundingBox(E);if(!W)continue;const G=new P;W.getCenter(G),_.push({id:E,cp:G})}for(let N=0,I=_.length;N<I;N++){_[N].color=l[0];for(let W=0,G=I;W<G;W++)_[N]!==_[W]&&P.getDistance(_[N].cp,_[W].cp)<c*2&&(_[N].color=l[1])}for(let N=0,I=_.length;N<I;N++){let W=this.createCircle(_[N],c,o,e);f.appendChild(W)}}clearSocialDistanceCircles(t){if(!t)return;const e=t.querySelector(`#${Iu}`),i=e==null?void 0:e.querySelectorAll("circle");if(!(!e||!(i!=null&&i.length)))for(let a=0,o=(i==null?void 0:i.length)||0;a<o;a++){const l=i[a].getAttribute("id");l&&(l==null?void 0:l.indexOf("_circle"))>-1&&e.removeChild(i[a])}}getRadius(t){var i,a,o;let e=((a=(i=this.params)==null?void 0:i.socialDistance)==null?void 0:a.radius)||3;return((o=this.params)==null?void 0:o.displayUnits)==="imperial"?t==="Metres"||t==="m"?e/=3.28084:t==="cm"?e=e/3.28084*100:t==="mm"?e=e/3.28084*1e3:(t==="INCH"||t==="inches")&&(e*=12):t==="INCH"||t==="inches"?e=e*3.28084*12:t==="cm"?e*=100:t==="mm"&&(e*=1e3),e}createCircle(t,e,i,a){const o=document.createElementNS(a,"circle");return o.setAttributeNS(null,"id",t.id+"_circle"),o.setAttributeNS(null,"cx",t.cp.x),o.setAttributeNS(null,"cy",t.cp.y),o.setAttributeNS(null,"r",String(e)),o.setAttributeNS(null,"style",`pointer-events:none;fill-opacity:0.1;stroke:${t.color};stroke-width:${i}px;`),o}}const M2=function(r){return(r||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};function oo(r,t){if(!r||!t)return!1;if(t.indexOf(" ")!==-1)throw new Error("className should not contain space.");return r.classList?r.classList.contains(t):(" "+r.className+" ").indexOf(" "+t+" ")>-1}function ia(r,t){if(!r)return;let e=r.className;const i=(t||"").split(" ");for(let a=0,o=i.length;a<o;a++){const l=i[a];l&&(r.classList?r.classList.add(l):oo(r,l)||(e+=" "+l))}r.classList||(r.className=e)}function na(r,t){if(!r||!t)return;const e=t.split(" ");let i=" "+r.className+" ";for(let a=0,o=e.length;a<o;a++){const l=e[a];l&&(r.classList?r.classList.remove(l):oo(r,l)&&(i=i.replace(" "+l+" "," ")))}r.classList||(r.className=M2(i))}class $u extends R0{isSvgScene=!0;name="SvgScene";dynamically=!0;params;socialDistanceEnable=!1;container;svg;svgStr="";svgRoot;viewBox=new _t;chef;defaultLayers=[];skeletonLayers=[];currentLayers=[];assetType;assetsMap={};legend=[];selectedList=[];painter;_lastHighlightType="";_lastHighlightIds=[];clickSvgElementHandler=this.handleClickSvgElement.bind(this);constructor(t={}){super(),this.params=t,this.assetType=t.assetType||$e.RM,this.params.socialDistanceEnable&&(this.socialDistanceEnable=!0),this.container=this.params.containerId?document.getElementById(this.params.containerId):kt.window.document.getElementsByTagName("body")[0],this.chef=new L2,this.painter=new N2(t,this.chef)}get isMounted(){var t;return((t=this.container.querySelectorAll("svg"))==null?void 0:t.length)>0}destroy(){var t;super.destroy(),this.unmount(),(t=this.camera)==null||t.destroy()}mount(){this.svg&&(this.container.contains(this.svg)||this.container.appendChild(this.svg),this.chef.computeBoundingBoxMap())}unmount(){this.svg&&this.svg.parentNode&&this.container.contains(this.svg)&&this.container.removeChild(this.svg)}computeBoundingBox(){return this.boundingBox.makeEmpty(),!this.chef||!this.svg?this.boundingBox:(this.chef.computeBoundingBoxMap(),this.boundingBox.copy(this.chef.boundingBox),console.warn("svgScene.computeBoundingBox: ",this.chef.boundingBox.toString()),this.boundingBox)}async load(t){return new $c().loadAsync(t)}bind(t){if(this.svgStr=t,this.svg=new DOMParser().parseFromString(t,"image/svg+xml").documentElement,!this.svg)throw new Error("svg load failed");let e=this.svg.getAttribute("viewBox");return e?(_0(e,this.viewBox),this.chef.bindSvg(this.svg),this.svgRoot=Rc(this.svg),this.svg.setAttribute("viewBox",`0 0 ${this.params.width} ${this.params.height}`),this.svg.setAttribute("style","transform: translateZ(0);"),this.appendStyles(),console.log(this.name,"viewBox -> ",e,this.viewBox.toString()),this.setAssetsMap(this.assetType,this.assetsMap),!0):!1}appendStyles(){var e;let t=(e=this.svg)==null?void 0:e.querySelector("style");t&&(t.appendChild(document.createTextNode(`.default { stroke: ${this.params.defaultStroke}; fill: ${this.params.defaultFill}; }`)),t.appendChild(document.createTextNode(`.info { stroke: ${this.params.infoStroke}; fill: ${this.params.infoFill}; }`)),t.appendChild(document.createTextNode(`.primary { stroke: ${this.params.primaryStroke}; fill: ${this.params.primaryFill}; }`)),t.appendChild(document.createTextNode(`.success { stroke: ${this.params.successStroke}; fill: ${this.params.successFill}; }`)),t.appendChild(document.createTextNode(`.warning { stroke: ${this.params.warningStroke}; fill: ${this.params.warningFill}; }`)),t.appendChild(document.createTextNode(`.danger { stroke: ${this.params.dangerStroke}; fill: ${this.params.dangerFill}; }`)),t.appendChild(document.createTextNode(`.active { stroke: ${this.params.activeStroke}; fill: ${this.params.activeFill}; }`)),t.appendChild(document.createTextNode(`text { font-family: ${this.params.fontFamily||"simhei"}; }`)))}getLayers(t=2){return this.svg?this.chef.getLayers(t):[]}setDefaultLayers(t){t!=null&&t.length&&(this.defaultLayers=t)}setSkeletonLayers(t){t!=null&&t.length&&(this.skeletonLayers=t)}setCurrentLayers(t){t!=null&&t.length&&(this.currentLayers=t)}showDefaultLayers(t,e=!1){this.setDefaultLayers(t),this.chef.updateLayersVisibility(t,e)}getLayerVisible(t){return this.chef.getLayerVisible(t)}updateLayersVisibility(t,e=!1,i=!0){this.chef.updateLayersVisibility(t,e,i)}setAssetType(t,e){this.assetsMap={},this.assetType=t,this.setAssetsMap(this.assetType,this.assetsMap),e||(e=[os(t)],t!==$e.RM&&e.unshift(os($e.RM))),this.setDefaultLayers(e),this.updateLayersVisibility(this.defaultLayers,!0)}isBelongsToAssetType(t,e){e||(e=this.assetType);const i=this.getAssetsByType(e);return i?!!(i!=null&&i.hasOwnProperty(t)):!1}setAssetsMap(t,e={}){const i=this.chef.getElementById(os(t));if(!i)return e;e[t]=this.chef.getElementsMap(i);const a=Js(t),o=this.chef.getElementById(a);if(!o)return e;const l=this.chef.getElementsMap(o),c=Nt.keys(l);if(!(c!=null&&c.length))return e;if(Nt.startsWith(c[0],`l-${t}-`)){const f=`l-${t}-`.length;for(let d=0,g=c.length;d<g;d++){const E=c[d].slice(f);l[E]=l[c[d]],delete l[c[d]]}}return e[a]=l,e}getAssetsByType(t){return this.assetsMap.hasOwnProperty(t)||this.setAssetsMap(t,this.assetsMap),this.assetsMap[t]}getElementById(t){if(!t)return;const e=this.getAssetsByType(this.assetType);if(!(!e||!Object.hasOwnProperty.call(e,t)))return e[t]}getAssetIdsByType(t){const e=this.getAssetsByType(t),i=[];return e?Nt.keys(e):i}clearFillOrStroke(t="fill"){const e=this.getAssetsByType(this.assetType);if(!e)return;const i=Nt.keys(e);let a;for(let o=0,l=i.length;o<l;o++)a=e[i[o]],a&&(a.hasAttribute(t)&&a.removeAttribute(t),t==="stroke"&&a.removeAttribute("stroke-width"));this.clearLegendBy(t)}clearFillOrStrokeByIds(t,e="fill"){const i=this.getAssetsByType(this.assetType);if(!i)return;const a=Nt.keys(i);let o;for(let l=0,c=a.length;l<c;l++)t!=null&&t.length&&!t.includes(a[l])||(o=i[a[l]],!(!o||!o.hasAttribute(e))&&(o.removeAttribute(e),e==="stroke"&&o.removeAttribute("stroke-width")));this.clearLegendBy(e)}setFillOrStrokeByIds(t,e,i="fill",a="7em"){const o=this.getAssetsByType(this.assetType);if(!o)return;const l=Nt.keys(o);let c;for(let f=0,d=l.length;f<d;f++)t.includes(l[f])&&(c=o[l[f]],c&&(c.setAttribute(i,e),i==="stroke"&&c.setAttribute("stroke-width",a),this.addLegend(i,e,l[f])))}addLegend(t,e,i){let a=this.legend.find(o=>o.color===e);a||(a={type:t,color:e,ids:[]},this.legend.push(a)),a.ids.push(i)}clearLegendBy(t){var e;t||(this.legend.length=0);for(let i=((e=this.legend)==null?void 0:e.length)-1;i>=0;i--)this.legend[i].type===t&&this.legend.splice(i,i)}getLegend(){return this.legend}showSkeleton(){var t;(t=this.skeletonLayers)!=null&&t.length&&(this.chef.updateLayersVisibility(this.defaultLayers,!1),this.chef.updateLayersVisibility(this.skeletonLayers,!0))}hideSkeleton(){var t;(t=this.skeletonLayers)!=null&&t.length&&(this.chef.updateLayersVisibility(this.skeletonLayers,!1),this.chef.updateLayersVisibility(this.defaultLayers,!0))}setAssetLabels(t,e){this.chef.setLabelsById(t,e,this.assetType)}getAssetLabelsMap(t){var a,o;if(!t)return;const e=Js(t);let i=this.getAssetsByType(e);if(!i||!((a=Object.keys(i))!=null&&a.length)){let l=this.chef.getElementById(e);if(l||(l=this.chef.getElementById(t+"-txt-label")),!l)return;i=this.chef.getElementsMap(l),this.assetsMap[e]=i}if(!(!i||!((o=Object.keys(i))!=null&&o.length)))return i}getAssetLabelById(t,e){var l,c;const i=this.getAssetLabelsMap(t);if(!i)return;let a=i[e];if(a&&((l=a==null?void 0:a.childNodes)!=null&&l.length))return a.childNodes[0].textContent||"";const o="l-"+t+"-"+e;if(a=i[o],a&&((c=a==null?void 0:a.children)!=null&&c.length))return a.children[0].textContent||""}clearAssetLabels(){this.chef.clearAssetLabelsByType(this.assetType)}bindAssetsEvents(t){var a;const e=(a=this.svg)==null?void 0:a.querySelector("#"+t);if(!e)return;e.querySelectorAll("[id]").forEach(o=>{o instanceof SVGElement&&o.addEventListener("click",this.clickSvgElementHandler)})}handleClickSvgElement(t){var e;typeof t.preventDefault=="function"&&t.preventDefault(),console.warn("svgScene.handleClickSvgElement: ",(e=t==null?void 0:t.target)==null?void 0:e.id,t==null?void 0:t.target),this.dispatchEvent({type:"click",data:t})}socialDistanceEnableChanged(t){this.socialDistanceEnable=!!t,t?this.painter.drawSocialDistanceCircles(this.svg):this.painter.clearSocialDistanceCircles(this.svg)}highlightAssets(t,e){var a;this.resetHighlightAssets(t);const i=this.getAssetsByType(t);!i||!((a=Object.keys(i))!=null&&a.length)||(this._lastHighlightType=t,this._lastHighlightIds=Array.isArray(e)?e:[e],this._lastHighlightIds.forEach(o=>{o&&i[o]&&ia(i[o],"active")}))}resetHighlightAssets(t){var i;const e=this.getAssetsByType(t||this._lastHighlightType);!e||!((i=Object.keys(e))!=null&&i.length)||(this._lastHighlightIds.forEach(a=>{a&&e[a]&&na(e[a],"active")}),this._lastHighlightIds.length=0)}getIntersectObjects(t,e=$e.RM,i=[]){i.length=0;const a=[],o=this.getAssetsByType(e);if(!o)return i;const l=Nt.keys(o);for(let f=0,d=l.length;f<d;f++){const g=this.chef.getElementBoundingBox(o[l[f]].id);g&&g.containsPoint(t.worldCoords)&&a.push(o[l[f]])}const c=Nt.sortBy(a,f=>{var d;return(d=this.chef.getElementBoundingBox(f.id))==null?void 0:d.getArea()});return i.push(...c),i}clearSelected(){var t,e;if((t=this.selectedList)!=null&&t.length)for(let i=((e=this.selectedList)==null?void 0:e.length)-1;i>=0;i--){let a=this.selectedList[i];this.selectedList.splice(i,1),this.chef.setElementState2selected(a,!1)}}clearSelectedById(t){var i,a;let e=(i=this.selectedList)==null?void 0:i.findIndex(o=>o.getAttribute("id")===t);e>-1&&(this.chef.setElementState2selected(this.selectedList[e],!1),(a=this.selectedList)==null||a.splice(e||0,1))}selectByIds(t,e=!1){Array.isArray(t)||(t=[t]),e||this.clearSelected();const i=Nt.uniq(Nt.map(this.selectedList,o=>o.getAttribute("id")||"")),a=this.getAssetsByType(this.assetType);if(a){for(let o=t.length-1;o>=0;o--)i.includes(t[o])?(this.clearSelectedById(t[o]),t.splice(o,1)):Object.hasOwnProperty.call(a,t[o])&&this.selectedList.push(a[t[o]]);this.selectedList.forEach(o=>{this.chef.setElementState2selected(o,!0)})}}getSelectedIds(){var e;if(!((e=this.selectedList)!=null&&e.length))return;const t=[];for(let i=0,a=this.selectedList.length;i<a;i++)this.selectedList[i].id&&t.push(this.selectedList[i].id);return t}getSelectedBoundingBox(){var e;const t=new _t;return(e=this.selectedList)!=null&&e.length?(this.selectedList.forEach(i=>{const a=this.chef.boundingBoxMap[i.id];a&&t.expandByBox(a)}),t):t.copy(this.boundingBox)}getElementsByBox(t){const e=[],i=Object.keys(this.chef.boundingBoxMap),a=this.getAssetsByType(this.assetType);if(!a)return e;for(let o=0,l=i.length;o<l;o++)if(a.hasOwnProperty(i[o])&&!(i[o].indexOf("-assets")>-1)&&t.intersectsBox(this.chef.boundingBoxMap[i[o]])){const c=a[i[o]];c&&e.push(c)}return e}getBoundingBoxByIds(t){var i,a;if(!t||Array.isArray(t)&&!t.length)return;Array.isArray(t)||(t=[t]);const e=new _t;for(let o=0,l=t==null?void 0:t.length;o<l;o++)(a=(i=this.chef)==null?void 0:i.boundingBoxMap)!=null&&a.hasOwnProperty(t[o])&&e.expandByBox(this.chef.boundingBoxMap[t[o]]);return e}getBoundingBoxById(t){if(this.chef.boundingBoxMap.hasOwnProperty(t))return new _t().copy(this.chef.boundingBoxMap[t])}_lastLinkedIds=[];linkAssetsByTree(t){this.chef.linkAssetsByTree(this.assetType,t);const e=this.chef.getElementById(js.ASSET_LABELS);e&&(e.style.display="block");const i=Js(this.assetType),a=this.chef.getElementById(i);a&&(a.style.display="block");const o=this.assetsMap[i];o&&(this._lastLinkedIds.forEach(l=>{o[l]&&(o[l].style.display="none")}),this._lastLinkedIds=Bc(t),this._lastLinkedIds.forEach(l=>{o[l]&&(o[l].style.display="block")}))}onBeforeRender(){}fullscreen(t=1e3,e=!1){}update(){}}class B2 extends $u{name="SvgLoadingScene";constructor(t){super(t),this.bind(`<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-200 -200 500 500">
|
|
35
35
|
<view id="defaultView" viewBox="-200 -200 500 500" />
|
|
36
36
|
<style>
|
|
37
37
|
/*#svg-loading-fast circle {animation: svg-loading-fast 2s ease infinite;}*/
|
package/lib/renderer.worker.js
CHANGED
|
@@ -4035,7 +4035,7 @@ var Gw = Vx((La) => {
|
|
|
4035
4035
|
Pa.normalizeLineEndings = Od;
|
|
4036
4036
|
Pa.DOMParser = Md;
|
|
4037
4037
|
var T_ = Pa.DOMParser;
|
|
4038
|
-
const C_ = "1.0.
|
|
4038
|
+
const C_ = "1.0.71";
|
|
4039
4039
|
function S_() {
|
|
4040
4040
|
return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
|
|
4041
4041
|
}
|