archgine 1.0.76 → 1.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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:"‌"}),i.entityMap=i.HTML_ENTITIES})(Dc);var Vu={},ta=Ei.NAMESPACE,Wu=/[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]/,Sc=new RegExp("[\\-\\.0-9"+Wu.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Oc=new RegExp("^"+Wu.source+Sc.source+"*(?::"+Wu.source+Sc.source+"*)?$"),ea=0,Xi=1,is=2,ra=3,ns=4,ss=5,ia=6,oo=7;function as(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,as)}as.prototype=new Error,as.prototype.name=as.name;function Mc(){}Mc.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),Bc(e,e={}),e0(i,e,t,r,this.errorHandler),r.endDocument()}};function e0(i,e,t,r,s){function o(B){if(B>65535){B-=65536;var xt=55296+(B>>10),kt=56320+(B&1023);return String.fromCharCode(xt,kt)}else return String.fromCharCode(B)}function u(B){var xt=B.slice(1,-1);return Object.hasOwnProperty.call(t,xt)?t[xt]:xt.charAt(0)==="#"?o(parseInt(xt.substr(1).replace("x","0x"))):(s.error("entity not found:"+B),B)}function h(B){if(B>O){var xt=i.substring(O,B).replace(/&#?\w+;/g,u);T&&c(O),r.characters(xt,0,B-O),O=B}}function c(B,xt){for(;B>=p&&(xt=A.exec(i));)y=xt.index,p=y+xt[0].length,T.lineNumber++;T.columnNumber=B-y+1}for(var y=0,p=0,A=/.*(?:\r\n?|\n)|.*$/g,T=r.locator,C=[{currentNSMap:e}],N={},O=0;;){try{var L=i.indexOf("<",O);if(L<0){if(!i.substr(O).match(/^\s*$/)){var P=r.doc,W=P.createTextNode(i.substr(O));P.appendChild(W),r.currentElement=W}return}switch(L>O&&h(L),i.charAt(L+1)){case"/":var rt=i.indexOf(">",L+3),V=i.substring(L+2,rt).replace(/[ \t\n\r]+$/g,""),b=C.pop();rt<0?(V=i.substring(L+2).replace(/[\s<].*/,""),s.error("end tag name: "+V+" is not complete:"+b.tagName),rt=L+1+V.length):V.match(/\s</)&&(V=V.replace(/[\s<].*/,""),s.error("end tag name: "+V+" maybe not complete"),rt=L+1+V.length);var Y=b.localNSMap,z=b.tagName==V,j=z||b.tagName&&b.tagName.toLowerCase()==V.toLowerCase();if(j){if(r.endElement(b.uri,b.localName,V),Y)for(var tt in Y)Object.prototype.hasOwnProperty.call(Y,tt)&&r.endPrefixMapping(tt);z||s.fatalError("end tag name: "+V+" is not match the current start tagName:"+b.tagName)}else C.push(b);rt++;break;case"?":T&&c(L),rt=a0(i,L,r);break;case"!":T&&c(L),rt=s0(i,L,r,s);break;default:T&&c(L);var Q=new Ic,K=C[C.length-1].currentNSMap,rt=r0(i,L,Q,K,u,s),at=Q.length;if(!Q.closed&&n0(i,rt,Q.tagName,N)&&(Q.closed=!0,t.nbsp||s.warning("unclosed xml attribute")),T&&at){for(var ct=Lc(T,{}),pt=0;pt<at;pt++){var dt=Q[pt];c(dt.offset),dt.locator=Lc(T,{})}r.locator=ct,Nc(Q,r,K)&&C.push(Q),r.locator=T}else Nc(Q,r,K)&&C.push(Q);ta.isHTML(Q.uri)&&!Q.closed?rt=i0(i,rt,Q.tagName,u,r):rt++}}catch(B){if(B instanceof as)throw B;s.error("element parse error: "+B),rt=-1}rt>O?O=rt:h(Math.max(L,O)+1)}}function Lc(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function r0(i,e,t,r,s,o){function u(T,C,N){t.attributeNames.hasOwnProperty(T)&&o.fatalError("Attribute "+T+" redefined"),t.addValue(T,C.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),N)}for(var h,c,y=++e,p=ea;;){var A=i.charAt(y);switch(A){case"=":if(p===Xi)h=i.slice(e,y),p=ra;else if(p===is)p=ra;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(p===ra||p===Xi)if(p===Xi&&(o.warning('attribute value must after "="'),h=i.slice(e,y)),e=y+1,y=i.indexOf(A,e),y>0)c=i.slice(e,y),u(h,c,e-1),p=ss;else throw new Error("attribute value no end '"+A+"' match");else if(p==ns)c=i.slice(e,y),u(h,c,e),o.warning('attribute "'+h+'" missed start quot('+A+")!!"),e=y+1,p=ss;else throw new Error('attribute value must after "="');break;case"/":switch(p){case ea:t.setTagName(i.slice(e,y));case ss:case ia:case oo:p=oo,t.closed=!0;case ns:case Xi:break;case is:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),p==ea&&t.setTagName(i.slice(e,y)),y;case">":switch(p){case ea:t.setTagName(i.slice(e,y));case ss:case ia:case oo:break;case ns:case Xi:c=i.slice(e,y),c.slice(-1)==="/"&&(t.closed=!0,c=c.slice(0,-1));case is:p===is&&(c=h),p==ns?(o.warning('attribute "'+c+'" missed quot(")!'),u(h,c,e)):((!ta.isHTML(r[""])||!c.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),u(c,c,e));break;case ra:throw new Error("attribute value missed!!")}return y;case"€":A=" ";default:if(A<=" ")switch(p){case ea:t.setTagName(i.slice(e,y)),p=ia;break;case Xi:h=i.slice(e,y),p=is;break;case ns:var c=i.slice(e,y);o.warning('attribute "'+c+'" missed quot(")!!'),u(h,c,e);case ss:p=ia;break}else switch(p){case is:t.tagName,(!ta.isHTML(r[""])||!h.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+h+'" missed value!! "'+h+'" instead2!!'),u(h,h,e),e=y,p=Xi;break;case ss:o.warning('attribute space is required"'+h+'"!!');case ia:p=Xi,e=y;break;case ra:p=ns,e=y;break;case oo:throw new Error("elements closed character '/' and '>' must be connected to")}}y++}}function Nc(i,e,t){for(var r=i.tagName,s=null,A=i.length;A--;){var o=i[A],u=o.qName,h=o.value,T=u.indexOf(":");if(T>0)var c=o.prefix=u.slice(0,T),y=u.slice(T+1),p=c==="xmlns"&&y;else y=u,c=null,p=u==="xmlns"&&"";o.localName=y,p!==!1&&(s==null&&(s={},Bc(t,t={})),t[p]=s[p]=h,o.uri=ta.XMLNS,e.startPrefixMapping(p,h))}for(var A=i.length;A--;){o=i[A];var c=o.prefix;c&&(c==="xml"&&(o.uri=ta.XML),c!=="xmlns"&&(o.uri=t[c||""]))}var T=r.indexOf(":");T>0?(c=i.prefix=r.slice(0,T),y=i.localName=r.slice(T+1)):(c=null,y=i.localName=r);var C=i.uri=t[c||""];if(e.startElement(C,y,r,i),i.closed){if(e.endElement(C,y,r),s)for(c in s)Object.prototype.hasOwnProperty.call(s,c)&&e.endPrefixMapping(c)}else return i.currentNSMap=t,i.localNSMap=s,!0}function i0(i,e,t,r,s){if(/^(?:script|textarea)$/i.test(t)){var o=i.indexOf("</"+t+">",e),u=i.substring(e+1,o);if(/[&<]/.test(u))return/^script$/i.test(t)?(s.characters(u,0,u.length),o):(u=u.replace(/&#?\w+;/g,r),s.characters(u,0,u.length),o)}return e+1}function n0(i,e,t,r){var s=r[t];return s==null&&(s=i.lastIndexOf("</"+t+">"),s<e&&(s=i.lastIndexOf("</"+t)),r[t]=s),s<e}function Bc(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function s0(i,e,t,r){var s=i.charAt(e+2);switch(s){case"-":if(i.charAt(e+3)==="-"){var o=i.indexOf("-->",e+4);return o>e?(t.comment(i,e+4,o-e-4),o+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(i.substr(e+3,6)=="CDATA["){var o=i.indexOf("]]>",e+9);return t.startCDATA(),t.characters(i,e+9,o-e-9),t.endCDATA(),o+3}var u=o0(i,e),h=u.length;if(h>1&&/!doctype/i.test(u[0][0])){var c=u[1][0],y=!1,p=!1;h>3&&(/^public$/i.test(u[2][0])?(y=u[3][0],p=h>4&&u[4][0]):/^system$/i.test(u[2][0])&&(p=u[3][0]));var A=u[h-1];return t.startDTD(c,y,p),t.endDTD(),A.index+A[0].length}}return-1}function a0(i,e,t){var r=i.indexOf("?>",e);if(r){var s=i.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,t.processingInstruction(s[1],s[2]),r+2):-1}return-1}function Ic(){this.attributeNames={}}Ic.prototype={setTagName:function(i){if(!Oc.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!Oc.test(i))throw new Error("invalid attribute:"+i);this.attributeNames[i]=this.length,this[this.length++]={qName:i,value:e,offset:t}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};function o0(i,e){var t,r=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(s.lastIndex=e,s.exec(i);t=s.exec(i);)if(r.push(t),t[1])return r}Vu.XMLReader=Mc,Vu.ParseError=as;var u0=Ei,l0=Yi,Rc=Dc,Pc=Vu,h0=l0.DOMImplementation,Fc=u0.NAMESPACE,c0=Pc.ParseError,f0=Pc.XMLReader;function kc(i){return i.replace(/\r[\n\u0085]/g,`
3
3
  `).replace(/[\r\u0085\u2028]/g,`
4
4
  `)}function Hc(i){this.options=i||{locator:{}}}Hc.prototype.parseFromString=function(i,e){var t=this.options,r=new f0,s=t.domBuilder||new na,o=t.errorHandler,u=t.locator,h=t.xmlns||{},c=/\/x?html?$/.test(e),y=c?Rc.HTML_ENTITIES:Rc.XML_ENTITIES;u&&s.setDocumentLocator(u),r.errorHandler=p0(o,s,u),r.domBuilder=t.domBuilder||s,c&&(h[""]=Fc.HTML),h.xml=h.xml||Fc.XML;var p=t.normalizeLineEndings||kc;return i&&typeof i=="string"?r.parse(p(i),h,y):r.errorHandler.error("invalid doc source"),s.doc};function p0(i,e,t){if(!i){if(e instanceof na)return e;i=e}var r={},s=i instanceof Function;t=t||{};function o(u){var h=i[u];!h&&s&&(h=i.length==2?function(c){i(u,c)}:i),r[u]=h&&function(c){h("[xmldom "+u+"] "+c+zu(t))}||function(){}}return o("warning"),o("error"),o("fatalError"),r}function na(){this.cdata=!1}function os(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}na.prototype={startDocument:function(){this.doc=new h0().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(i,e,t,r){var s=this.doc,o=s.createElementNS(i,t||e),u=r.length;uo(this,o),this.currentElement=o,this.locator&&os(this.locator,o);for(var h=0;h<u;h++){var i=r.getURI(h),c=r.getValue(h),t=r.getQName(h),y=s.createAttributeNS(i,t);this.locator&&os(r.getLocator(h),y),y.value=y.nodeValue=c,o.setAttributeNode(y)}},endElement:function(i,e,t){var r=this.currentElement;r.tagName,this.currentElement=r.parentNode},startPrefixMapping:function(i,e){},endPrefixMapping:function(i){},processingInstruction:function(i,e){var t=this.doc.createProcessingInstruction(i,e);this.locator&&os(this.locator,t),uo(this,t)},ignorableWhitespace:function(i,e,t){},characters:function(i,e,t){if(i=Uc.apply(this,arguments),i){if(this.cdata)var r=this.doc.createCDATASection(i);else var r=this.doc.createTextNode(i);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(i)&&this.doc.appendChild(r),this.locator&&os(this.locator,r)}},skippedEntity:function(i){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(i){(this.locator=i)&&(i.lineNumber=0)},comment:function(i,e,t){i=Uc.apply(this,arguments);var r=this.doc.createComment(i);this.locator&&os(this.locator,r),uo(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(i,e,t){var r=this.doc.implementation;if(r&&r.createDocumentType){var s=r.createDocumentType(i,e,t);this.locator&&os(this.locator,s),uo(this,s),this.doc.doctype=s}},warning:function(i){console.warn("[xmldom warning] "+i,zu(this.locator))},error:function(i){console.error("[xmldom error] "+i,zu(this.locator))},fatalError:function(i){throw new c0(i,this.locator)}};function zu(i){if(i)return`
5
- @`+(i.systemId||"")+"#[line:"+i.lineNumber+",col:"+i.columnNumber+"]"}function Uc(i,e,t){return typeof i=="string"?i.substr(e,t):i.length>=e+t||e?new java.lang.String(i,e,t)+"":i}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(i){na.prototype[i]=function(){return null}});function uo(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}ao.__DOMHandler=na,ao.normalizeLineEndings=kc,ao.DOMParser=Hc;var d0=ao.DOMParser;const g0="1.0.76";function y0(){return typeof window!="undefined"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const us=typeof window!="undefined"?window:typeof WorkerGlobalScope!="undefined"?self:{document:void 0,tinyEngine:void 0};us.Path2D||Gs(us),us.DOMParser||(us.DOMParser=d0);const Vt={window:us,version:g0,isBrowser:y0(),dpr:typeof window!="undefined"&&window.devicePixelRatio||1,document:us.document,time:0,deltaTime:0,config:Gt},sa=(i,e,t)=>Math.max(e,Math.min(t,i)),qc=(i,e=1e-6)=>Math.abs(i)<e?0:i<0?-1:1,m0=i=>i*(Math.PI/180),v0=(i,e)=>(i%e+e)%e,$u=(i,e,t)=>(1-t)*i+t*e,x0=i=>{let e=i*(180/Math.PI);return e<0&&(e+=360),e>360&&(e-=360),e},Qt={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)"},E0={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},Ur={h:0,s:0,l:0},lo={h:0,s:0,l:0};function Gu(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}const A0=/^#([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 Yt{constructor(e,t,r,s){d(this,"isColor",!0);d(this,"r",1);d(this,"g",1);d(this,"b",1);d(this,"a",1);return t===void 0&&r===void 0?this.set(e):this.setRGBA(e,t,r,s)}static isColor(e){return typeof e=="string"?A0.test(e):typeof e=="number"?e>=0&&e<=16777215:!1}static getRandomStyle(){return Ti.random().getStyle()}static getDarken(e,t=.8){return Ti.set(e).getHSL(ho),Ti.setHSL(ho.h,ho.s,ho.l*t).getStyle()}static getLighten(e,t=1.2){return this.getDarken(e,t)}static getContrast(e){return Ti.set(e),Ti.getContrastString()}static getArray(e){return Ti.set(e).toArray()}static getComplementary(e){return Ti.set(e),Ti.getComplementaryString()}static getMoreTransparent(e,t){return Ti.set(e).setA(t).getStyle()}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}random(){return this.setHex(Math.floor(Math.random()*(1<<24)))}setScalar(e){return this.r=e,this.g=e,this.b=e,this.a=1,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this.a=1,this}setR(e){return this.r=e,this}setG(e){return this.g=e,this}setB(e){return this.b=e,this}setA(e){return this.a=e,this}setRGB(e,t,r){return this.setRGBA(e,t,r,this.a)}setRGBA(e,t,r,s=1){return this.r=e,this.g=t,this.b=r,this.a=s,this}setHSL(e,t,r,s=1){if(e=v0(e,1),t=sa(t,0,1),r=sa(r,0,1),t===0)this.r=this.g=this.b=r;else{const o=r<=.5?r*(1+t):r+t-r*t,u=2*r-o;this.r=Gu(u,o,e+1/3),this.g=Gu(u,o,e),this.b=Gu(u,o,e-1/3)}return this.a=s,this}setStyle(e){let t;if(t=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let r;const s=t[1],o=t[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,this.a=Math.max(Math.min(1,r[4]!==void 0?parseFloat(r[4]):1),0),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,this.a=Math.max(Math.min(1,r[4]!==void 0?parseFloat(r[4]):1),0),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const u=parseFloat(r[1])/360,h=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100,y=Math.max(Math.min(1,r[4]!==void 0?parseFloat(r[4]):1),0);return this.setHSL(u,h,c,y)}break}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=t[1],s=r.length;if(s===3)return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this.a=1,this;if(s===6)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this.a=1,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=E0[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("Color: Unknown color "+e),this}clone(){return new Yt(this.r,this.g,this.b,this.a)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}getRGB(e=new Yt){return e.setRGB(this.r,this.g,this.b)}getRGBByBg(e=new Yt){const t=this.a,r=t*this.r+(1-t)*e.r,s=t*this.g+(1-t)*e.g,o=t*this.b+(1-t)*e.b;return new Yt(r,s,o)}getHex(){return sa(this.r*255,0,255)<<16^sa(this.g*255,0,255)<<8^sa(this.b*255,0,255)<<0}getHSL(e){const t=this.r,r=this.g,s=this.b,o=Math.max(t,r,s),u=Math.min(t,r,s);let h=0,c;const y=(u+o)/2;if(u===o)h=0,c=0;else{const p=o-u;switch(c=y<=.5?p/(o+u):p/(2-o-u),o){case t:h=(r-s)/p+(r<s?6:0);break;case r:h=(s-t)/p+2;break;case s:h=(t-r)/p+4;break}h/=6}return e.h=h,e.s=c,e.l=y,e}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 e=(this.r*255*299+this.g*255*587+this.b*255*144)/1e3;return e+=(255-e)*(255-this.a*255)/255,e}getContrastString(){return this.getBrightness()>125?"#2f2f2f":"#f2f2f2"}getComplementary(e=new Yt){const t=this.toArray(),r=[0,0,0,1];for(let s=0;s<t.length;s++)if(s<3)r[s]=1-t[s];else if(s===3)t[s]>1||t[s]<=0?r[s]=1:r[s]=Math.max(Math.min(parseFloat(t[s].toFixed(2)),1),0);else continue;return e.setRGBA(r[0],r[1],r[2],parseFloat(r[3].toFixed(2)))}getComplementaryString(){return this.getComplementary().getStyle()}getLightenOrDarken(e){if(typeof e=="undefined"||e>=1)return this.getHexString();const t=this.getRGBByBg(),r=t.r*e+(1-e),s=t.g*e+(1-e),o=t.b*e+(1-e);return new Yt(r,s,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(e,t,r){return this.getHSL(Ur),Ur.h+=e,Ur.s+=t,Ur.l+=r,this.setHSL(Ur.h,Ur.s,Ur.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(Ur),e.getHSL(lo);const r=$u(Ur.h,lo.h,t),s=$u(Ur.s,lo.s,t),o=$u(Ur.l,lo.l,t);return this.setHSL(r,s,o),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this.a=e[t+3],this}toArray(e=[0,0,0,0],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),e.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 Ti=new Yt,ho={h:0,s:0,l:0};class k{constructor(e=0,t=0,r){d(this,"isVector2",!0);d(this,"x",0);d(this,"y",0);d(this,"z");this.x=e,this.y=t,this.z=r||0}static isZero(e){return e.x===0&&e.y===0}static isEmpty(e){return!Number.isFinite(e.x)&&!Number.isFinite(e.y)}static equals(e,t,r=!0){return r?e.x===t.x&&e.y===t.y:Math.abs(e.x-t.x)<Number.EPSILON&&Math.abs(e.y-t.y)<Number.EPSILON}static getInt32Array(e,t=2){const r=new ArrayBuffer(e.length*t*4),s=new Int32Array(r);for(let o=0,u=e.length;o<u;o++)s[o*2]=e[o].x,s[o*2+1]=e[o].y;return s}static getFloat64Array(e,t=2){const r=new ArrayBuffer(e.length*t*8),s=new Float64Array(r);for(let o=0,u=e.length;o<u;o++)s[o*2]=e[o].x,s[o*2+1]=e[o].y;return s}static getVectors(e){const t=[];for(let r=0,s=e.length;r<s;r++)t.push(new k(e[r].x,e[r].y));return t}static getStrings(e){const t=[];if(!e||!e.length)return"";for(let r=0,s=e.length;r<s;r++)t.push(k.getString(e[r]));return t.join(",")}static getString(e){return`${e.x},${e.y}`}static getLength(e){return Math.sqrt(e.x*e.x+e.y*e.y)}static getDistance(e,t){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}static dot(e,t){return e.x*t.x+e.y*t.y}static cross(e,t){return e.x*t.y-e.y*t.x}static sub(e,t){return new k().subVectors(e,t)}static isPointOnSegment(e,t,r){return qc(this.sub(e,r).cross(this.sub(t,r)))===0&&qc(this.sub(e,r).dot(this.sub(t,r)))<=0}static angle(e,t,r){return r?Math.atan2(e.y-t.y,e.x-t.x):x0(Math.atan2(e.y-t.y,e.x-t.x))}static getSamplingPoints(e,t=100){let r=this.getClothoidPoints(e,t),s=0;for(let o=0,u=r.length;o<u;o++){let h=Math.max(0,o-1);o>0?s+=this.getDistance(r[h],r[h+1]):s=0,r[o].l=Math.round(s);let c=this.angle(r[h+1],r[h]);r[o].a=Math.round(c*100)/100}return r}static getClothoidPoints(e,t=100){let r=[],s=e.concat([]);if(!s||s.length<2)return r;s.length===2?(s.push(s[1]),s.unshift(s[0])):s.length===3&&s.splice(2,0,s[1]);for(let o=0;o<s.length-3;o+=3){let u=new k(s[o].x,s[o].y),h=new k(s[o+1].x,s[o+1].y),c=new k(s[o+2].x,s[o+2].y),y=new k(s[o+3].x,s[o+3].y),p=0;p+=u.distanceTo(h),p+=h.distanceTo(c),p+=c.distanceTo(y);let A=Math.min(.5,1/(p/t));for(let T=A;T<1;T+=A){let C=3*(h.x-u.x),N=3*(c.x-h.x)-C,O=y.x-u.x-C-N,L=3*(h.y-u.y),P=3*(c.y-h.y)-L,W=y.y-u.y-L-P,V=O*Math.pow(T,3)+N*Math.pow(T,2)+C*T+u.x,b=W*Math.pow(T,3)+P*Math.pow(T,2)+L*T+u.y;r.push({x:Math.round(V),y:Math.round(b),a:0,l:0})}}return r.unshift({x:s[0].x,y:s[0].y,a:0,l:0}),r.push({x:s[s.length-1].x,y:s[s.length-1].y,a:0,l:0}),r}static getClothoidLength(e){let t=0;if(e.length>2)for(let r=0;r<e.length;r++){let s=Math.max(0,r-1);r>0&&(t+=this.getDistance(e[s],e[s+1]))}return t}static getCircleCenterByChord(e,t,r,s=!0,o=new k){const u=this.getDistance(e,t);if(u===0)return o.x=1/0,o.y=1/0,o;Yu.set((e.x+t.x)/2,(e.y+t.y)/2);const h=Math.sqrt(r*r-u*u/4),c=s?-1:1;return o.x=Yu.x+c*h*(t.y-e.y)/u,o.y=Yu.y-c*h*(t.x-e.x)/u,o}static isPointInCircle(e,t,r){return this.getDistance(r,e)<t}static isPointInConvexHull(e,t){let r=!1;const s=t.length;for(let o=0,u=s-1;o<s;u=o++){const h=t[o],c=t[u];if(Math.min(h.x,c.x)<=e.x&&e.x<=Math.max(h.x,c.x)&&Math.min(h.y,c.y)<=e.y&&e.y<=Math.max(h.y,c.y)){const y=(c.x-h.x)*(e.y-h.y)-(c.y-h.y)*(e.x-h.x);if(Math.abs(y)<1e-12)return!0}h.y>e.y!=c.y>e.y&&e.x<(c.x-h.x)*(e.y-h.y)/(c.y-h.y)+h.x&&(r=!r)}return r}static isPointInPolygonByRay(e,t){let r=0;const s=new k().copy(e),o=new k,u=new k;for(let h=0;h<t.length;h++){h===t.length-1?(o.copy(t[h]),u.copy(t[0])):(o.copy(t[h]),u.copy(t[h+1]));let c=[o.y,u.y].sort((y,p)=>y-p);c[0]<s.y&&c[1]>s.y&&(o.x<s.x||u.x<s.x)&&r++}return r%2===1}static getIntersectionOfSegments(e,t,r,s,o=!1,u=new k){const h=(s.y-r.y)*(t.x-e.x)-(s.x-r.x)*(t.y-e.y);if(h===0)return u.makeEmpty();const c=(s.x-r.x)*(e.y-r.y)-(s.y-r.y)*(e.x-r.x),y=(t.x-e.x)*(e.y-r.y)-(t.y-e.y)*(e.x-r.x),p=c/h,A=y/h;return o&&(p<0||p>1||A<0||A>1)?u.makeEmpty():(u.x=e.x+p*(t.x-e.x),u.y=e.y+p*(t.y-e.y),u)}static getConvexHullByGrahamScan(e,t=!1,r=[]){if(!e||!e.length)return r;const s=e.length;let o=0;for(let c=0;c<s;c++)e[c].x<e[o].x&&(o=c);let u=o,h;do{r.push(e[u]),h=(u+1)%s;for(let c=0;c<s;c++)this.whichSideOfSegment(e[u],e[c],e[h])>0&&(h=c);u=h}while(u!==o);return t&&r.push(e[o]),r}static whichSideOfSegment(e,t,r){return(t.x-e.x)*(r.y-e.y)-(r.x-e.x)*(t.y-e.y)}static getPointsWithMatrix3(e,t){const r=[];if(!e)return r;for(let s=0,o=e.length;s<o;s++)r.push({x:t.elements[0]*e[s].x+t.elements[3]*e[s].y+t.elements[6],y:t.elements[1]*e[s].x+t.elements[4]*e[s].y+t.elements[7]});return r}static getPointsApplyMatrix3(e,t=[]){for(let r=0,s=t.length;r<s;r++){const o=e.elements[0]*t[r].x+e.elements[3]*t[r].y+e.elements[6],u=e.elements[1]*t[r].x+e.elements[4]*t[r].y+e.elements[7];t[r].x=o,t[r].y=u}return t}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(e){const t=this.x,r=this.y,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6],this.y=s[1]*t+s[4]*r+s[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(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clone(){return new k(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}cross(e){return this.x*e.y-this.y*e.x}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}dot(e){return this.x*e.x+this.y*e.y}equals(e,t=!0){return t?e.x===this.x&&e.y===this.y:Math.abs(e.x-this.x)<Number.EPSILON&&Math.abs(e.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(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+e)}}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(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}maxXY(e,t){return this.x=Math.max(this.x,e),this.y=Math.max(this.y,t),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}minXY(e,t){return this.x=Math.min(this.x,e),this.y=Math.min(this.y,t),this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e,t){return this.x*=e,this.y*=t||e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(e){return this.applyMatrix3(e.matrixWorldInverse).applyMatrix3(e.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(e){const t=Math.cos(e),r=Math.sin(e),s=this.x,o=this.y;return this.x=s*t-o*r,this.y=s*r+o*t,this}rotateAround(e,t){const r=Math.cos(t),s=Math.sin(t),o=this.x-e.x,u=this.y-e.y;return this.x=o*r-u*s+e.x,this.y=o*s+u*r+e.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(e,t){return this.x=e,this.y=t,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("out of range: "+e)}return this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*3)}setLength(e){return this.normalize().multiplyScalar(e)}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(e,t=!1){return this.applyMatrix3(e.projectionMatrixInverse).applyMatrix3(e.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}}const Yu=new k,b0=Object.freeze(Object.defineProperty({__proto__:null,default:k},Symbol.toStringTag,{value:"Module"}));var co={exports:{}};/**
5
+ @`+(i.systemId||"")+"#[line:"+i.lineNumber+",col:"+i.columnNumber+"]"}function Uc(i,e,t){return typeof i=="string"?i.substr(e,t):i.length>=e+t||e?new java.lang.String(i,e,t)+"":i}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(i){na.prototype[i]=function(){return null}});function uo(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}ao.__DOMHandler=na,ao.normalizeLineEndings=kc,ao.DOMParser=Hc;var d0=ao.DOMParser;const g0="1.0.77";function y0(){return typeof window!="undefined"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const us=typeof window!="undefined"?window:typeof WorkerGlobalScope!="undefined"?self:{document:void 0,tinyEngine:void 0};us.Path2D||Gs(us),us.DOMParser||(us.DOMParser=d0);const Vt={window:us,version:g0,isBrowser:y0(),dpr:typeof window!="undefined"&&window.devicePixelRatio||1,document:us.document,time:0,deltaTime:0,config:Gt},sa=(i,e,t)=>Math.max(e,Math.min(t,i)),qc=(i,e=1e-6)=>Math.abs(i)<e?0:i<0?-1:1,m0=i=>i*(Math.PI/180),v0=(i,e)=>(i%e+e)%e,$u=(i,e,t)=>(1-t)*i+t*e,x0=i=>{let e=i*(180/Math.PI);return e<0&&(e+=360),e>360&&(e-=360),e},Qt={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)"},E0={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},Ur={h:0,s:0,l:0},lo={h:0,s:0,l:0};function Gu(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}const A0=/^#([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 Yt{constructor(e,t,r,s){d(this,"isColor",!0);d(this,"r",1);d(this,"g",1);d(this,"b",1);d(this,"a",1);return t===void 0&&r===void 0?this.set(e):this.setRGBA(e,t,r,s)}static isColor(e){return typeof e=="string"?A0.test(e):typeof e=="number"?e>=0&&e<=16777215:!1}static getRandomStyle(){return Ti.random().getStyle()}static getDarken(e,t=.8){return Ti.set(e).getHSL(ho),Ti.setHSL(ho.h,ho.s,ho.l*t).getStyle()}static getLighten(e,t=1.2){return this.getDarken(e,t)}static getContrast(e){return Ti.set(e),Ti.getContrastString()}static getArray(e){return Ti.set(e).toArray()}static getComplementary(e){return Ti.set(e),Ti.getComplementaryString()}static getMoreTransparent(e,t){return Ti.set(e).setA(t).getStyle()}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}random(){return this.setHex(Math.floor(Math.random()*(1<<24)))}setScalar(e){return this.r=e,this.g=e,this.b=e,this.a=1,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this.a=1,this}setR(e){return this.r=e,this}setG(e){return this.g=e,this}setB(e){return this.b=e,this}setA(e){return this.a=e,this}setRGB(e,t,r){return this.setRGBA(e,t,r,this.a)}setRGBA(e,t,r,s=1){return this.r=e,this.g=t,this.b=r,this.a=s,this}setHSL(e,t,r,s=1){if(e=v0(e,1),t=sa(t,0,1),r=sa(r,0,1),t===0)this.r=this.g=this.b=r;else{const o=r<=.5?r*(1+t):r+t-r*t,u=2*r-o;this.r=Gu(u,o,e+1/3),this.g=Gu(u,o,e),this.b=Gu(u,o,e-1/3)}return this.a=s,this}setStyle(e){let t;if(t=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let r;const s=t[1],o=t[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,this.a=Math.max(Math.min(1,r[4]!==void 0?parseFloat(r[4]):1),0),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,this.a=Math.max(Math.min(1,r[4]!==void 0?parseFloat(r[4]):1),0),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const u=parseFloat(r[1])/360,h=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100,y=Math.max(Math.min(1,r[4]!==void 0?parseFloat(r[4]):1),0);return this.setHSL(u,h,c,y)}break}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=t[1],s=r.length;if(s===3)return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this.a=1,this;if(s===6)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this.a=1,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=E0[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("Color: Unknown color "+e),this}clone(){return new Yt(this.r,this.g,this.b,this.a)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}getRGB(e=new Yt){return e.setRGB(this.r,this.g,this.b)}getRGBByBg(e=new Yt){const t=this.a,r=t*this.r+(1-t)*e.r,s=t*this.g+(1-t)*e.g,o=t*this.b+(1-t)*e.b;return new Yt(r,s,o)}getHex(){return sa(this.r*255,0,255)<<16^sa(this.g*255,0,255)<<8^sa(this.b*255,0,255)<<0}getHSL(e){const t=this.r,r=this.g,s=this.b,o=Math.max(t,r,s),u=Math.min(t,r,s);let h=0,c;const y=(u+o)/2;if(u===o)h=0,c=0;else{const p=o-u;switch(c=y<=.5?p/(o+u):p/(2-o-u),o){case t:h=(r-s)/p+(r<s?6:0);break;case r:h=(s-t)/p+2;break;case s:h=(t-r)/p+4;break}h/=6}return e.h=h,e.s=c,e.l=y,e}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 e=(this.r*255*299+this.g*255*587+this.b*255*144)/1e3;return e+=(255-e)*(255-this.a*255)/255,e}getContrastString(){return this.getBrightness()>125?"#2f2f2f":"#f2f2f2"}getComplementary(e=new Yt){const t=this.toArray(),r=[0,0,0,1];for(let s=0;s<t.length;s++)if(s<3)r[s]=1-t[s];else if(s===3)t[s]>1||t[s]<=0?r[s]=1:r[s]=Math.max(Math.min(parseFloat(t[s].toFixed(2)),1),0);else continue;return e.setRGBA(r[0],r[1],r[2],parseFloat(r[3].toFixed(2)))}getComplementaryString(){return this.getComplementary().getStyle()}getLightenOrDarken(e){if(typeof e=="undefined"||e>=1)return this.getHexString();const t=this.getRGBByBg(),r=t.r*e+(1-e),s=t.g*e+(1-e),o=t.b*e+(1-e);return new Yt(r,s,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(e,t,r){return this.getHSL(Ur),Ur.h+=e,Ur.s+=t,Ur.l+=r,this.setHSL(Ur.h,Ur.s,Ur.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(Ur),e.getHSL(lo);const r=$u(Ur.h,lo.h,t),s=$u(Ur.s,lo.s,t),o=$u(Ur.l,lo.l,t);return this.setHSL(r,s,o),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this.a=e[t+3],this}toArray(e=[0,0,0,0],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),e.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 Ti=new Yt,ho={h:0,s:0,l:0};class k{constructor(e=0,t=0,r){d(this,"isVector2",!0);d(this,"x",0);d(this,"y",0);d(this,"z");this.x=e,this.y=t,this.z=r||0}static isZero(e){return e.x===0&&e.y===0}static isEmpty(e){return!Number.isFinite(e.x)&&!Number.isFinite(e.y)}static equals(e,t,r=!0){return r?e.x===t.x&&e.y===t.y:Math.abs(e.x-t.x)<Number.EPSILON&&Math.abs(e.y-t.y)<Number.EPSILON}static getInt32Array(e,t=2){const r=new ArrayBuffer(e.length*t*4),s=new Int32Array(r);for(let o=0,u=e.length;o<u;o++)s[o*2]=e[o].x,s[o*2+1]=e[o].y;return s}static getFloat64Array(e,t=2){const r=new ArrayBuffer(e.length*t*8),s=new Float64Array(r);for(let o=0,u=e.length;o<u;o++)s[o*2]=e[o].x,s[o*2+1]=e[o].y;return s}static getVectors(e){const t=[];for(let r=0,s=e.length;r<s;r++)t.push(new k(e[r].x,e[r].y));return t}static getStrings(e){const t=[];if(!e||!e.length)return"";for(let r=0,s=e.length;r<s;r++)t.push(k.getString(e[r]));return t.join(",")}static getString(e){return`${e.x},${e.y}`}static getLength(e){return Math.sqrt(e.x*e.x+e.y*e.y)}static getDistance(e,t){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}static dot(e,t){return e.x*t.x+e.y*t.y}static cross(e,t){return e.x*t.y-e.y*t.x}static sub(e,t){return new k().subVectors(e,t)}static isPointOnSegment(e,t,r){return qc(this.sub(e,r).cross(this.sub(t,r)))===0&&qc(this.sub(e,r).dot(this.sub(t,r)))<=0}static angle(e,t,r){return r?Math.atan2(e.y-t.y,e.x-t.x):x0(Math.atan2(e.y-t.y,e.x-t.x))}static getSamplingPoints(e,t=100){let r=this.getClothoidPoints(e,t),s=0;for(let o=0,u=r.length;o<u;o++){let h=Math.max(0,o-1);o>0?s+=this.getDistance(r[h],r[h+1]):s=0,r[o].l=Math.round(s);let c=this.angle(r[h+1],r[h]);r[o].a=Math.round(c*100)/100}return r}static getClothoidPoints(e,t=100){let r=[],s=e.concat([]);if(!s||s.length<2)return r;s.length===2?(s.push(s[1]),s.unshift(s[0])):s.length===3&&s.splice(2,0,s[1]);for(let o=0;o<s.length-3;o+=3){let u=new k(s[o].x,s[o].y),h=new k(s[o+1].x,s[o+1].y),c=new k(s[o+2].x,s[o+2].y),y=new k(s[o+3].x,s[o+3].y),p=0;p+=u.distanceTo(h),p+=h.distanceTo(c),p+=c.distanceTo(y);let A=Math.min(.5,1/(p/t));for(let T=A;T<1;T+=A){let C=3*(h.x-u.x),N=3*(c.x-h.x)-C,O=y.x-u.x-C-N,L=3*(h.y-u.y),P=3*(c.y-h.y)-L,W=y.y-u.y-L-P,V=O*Math.pow(T,3)+N*Math.pow(T,2)+C*T+u.x,b=W*Math.pow(T,3)+P*Math.pow(T,2)+L*T+u.y;r.push({x:Math.round(V),y:Math.round(b),a:0,l:0})}}return r.unshift({x:s[0].x,y:s[0].y,a:0,l:0}),r.push({x:s[s.length-1].x,y:s[s.length-1].y,a:0,l:0}),r}static getClothoidLength(e){let t=0;if(e.length>2)for(let r=0;r<e.length;r++){let s=Math.max(0,r-1);r>0&&(t+=this.getDistance(e[s],e[s+1]))}return t}static getCircleCenterByChord(e,t,r,s=!0,o=new k){const u=this.getDistance(e,t);if(u===0)return o.x=1/0,o.y=1/0,o;Yu.set((e.x+t.x)/2,(e.y+t.y)/2);const h=Math.sqrt(r*r-u*u/4),c=s?-1:1;return o.x=Yu.x+c*h*(t.y-e.y)/u,o.y=Yu.y-c*h*(t.x-e.x)/u,o}static isPointInCircle(e,t,r){return this.getDistance(r,e)<t}static isPointInConvexHull(e,t){let r=!1;const s=t.length;for(let o=0,u=s-1;o<s;u=o++){const h=t[o],c=t[u];if(Math.min(h.x,c.x)<=e.x&&e.x<=Math.max(h.x,c.x)&&Math.min(h.y,c.y)<=e.y&&e.y<=Math.max(h.y,c.y)){const y=(c.x-h.x)*(e.y-h.y)-(c.y-h.y)*(e.x-h.x);if(Math.abs(y)<1e-12)return!0}h.y>e.y!=c.y>e.y&&e.x<(c.x-h.x)*(e.y-h.y)/(c.y-h.y)+h.x&&(r=!r)}return r}static isPointInPolygonByRay(e,t){let r=0;const s=new k().copy(e),o=new k,u=new k;for(let h=0;h<t.length;h++){h===t.length-1?(o.copy(t[h]),u.copy(t[0])):(o.copy(t[h]),u.copy(t[h+1]));let c=[o.y,u.y].sort((y,p)=>y-p);c[0]<s.y&&c[1]>s.y&&(o.x<s.x||u.x<s.x)&&r++}return r%2===1}static getIntersectionOfSegments(e,t,r,s,o=!1,u=new k){const h=(s.y-r.y)*(t.x-e.x)-(s.x-r.x)*(t.y-e.y);if(h===0)return u.makeEmpty();const c=(s.x-r.x)*(e.y-r.y)-(s.y-r.y)*(e.x-r.x),y=(t.x-e.x)*(e.y-r.y)-(t.y-e.y)*(e.x-r.x),p=c/h,A=y/h;return o&&(p<0||p>1||A<0||A>1)?u.makeEmpty():(u.x=e.x+p*(t.x-e.x),u.y=e.y+p*(t.y-e.y),u)}static getConvexHullByGrahamScan(e,t=!1,r=[]){if(!e||!e.length)return r;const s=e.length;let o=0;for(let c=0;c<s;c++)e[c].x<e[o].x&&(o=c);let u=o,h;do{r.push(e[u]),h=(u+1)%s;for(let c=0;c<s;c++)this.whichSideOfSegment(e[u],e[c],e[h])>0&&(h=c);u=h}while(u!==o);return t&&r.push(e[o]),r}static whichSideOfSegment(e,t,r){return(t.x-e.x)*(r.y-e.y)-(r.x-e.x)*(t.y-e.y)}static getPointsWithMatrix3(e,t){const r=[];if(!e)return r;for(let s=0,o=e.length;s<o;s++)r.push({x:t.elements[0]*e[s].x+t.elements[3]*e[s].y+t.elements[6],y:t.elements[1]*e[s].x+t.elements[4]*e[s].y+t.elements[7]});return r}static getPointsApplyMatrix3(e,t=[]){for(let r=0,s=t.length;r<s;r++){const o=e.elements[0]*t[r].x+e.elements[3]*t[r].y+e.elements[6],u=e.elements[1]*t[r].x+e.elements[4]*t[r].y+e.elements[7];t[r].x=o,t[r].y=u}return t}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(e){const t=this.x,r=this.y,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6],this.y=s[1]*t+s[4]*r+s[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(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clone(){return new k(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}cross(e){return this.x*e.y-this.y*e.x}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}dot(e){return this.x*e.x+this.y*e.y}equals(e,t=!0){return t?e.x===this.x&&e.y===this.y:Math.abs(e.x-this.x)<Number.EPSILON&&Math.abs(e.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(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+e)}}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(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}maxXY(e,t){return this.x=Math.max(this.x,e),this.y=Math.max(this.y,t),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}minXY(e,t){return this.x=Math.min(this.x,e),this.y=Math.min(this.y,t),this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e,t){return this.x*=e,this.y*=t||e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(e){return this.applyMatrix3(e.matrixWorldInverse).applyMatrix3(e.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(e){const t=Math.cos(e),r=Math.sin(e),s=this.x,o=this.y;return this.x=s*t-o*r,this.y=s*r+o*t,this}rotateAround(e,t){const r=Math.cos(t),s=Math.sin(t),o=this.x-e.x,u=this.y-e.y;return this.x=o*r-u*s+e.x,this.y=o*s+u*r+e.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(e,t){return this.x=e,this.y=t,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("out of range: "+e)}return this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*3)}setLength(e){return this.normalize().multiplyScalar(e)}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(e,t=!1){return this.applyMatrix3(e.projectionMatrixInverse).applyMatrix3(e.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}}const Yu=new k,b0=Object.freeze(Object.defineProperty({__proto__:null,default:k},Symbol.toStringTag,{value:"Module"}));var co={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 bt=Ig(function(){return Pt(x,st+"return "+X).apply(t,w)});if(bt.source=X,kh(bt))throw bt;return bt}function gw(n){return Ht(n).toLowerCase()}function yw(n){return Ht(n).toUpperCase()}function mw(n,a,l){if(n=Ht(n),n&&(l||a===t))return Wp(n);if(!n||!(a=xr(a)))return n;var f=jr(n),g=jr(a),x=zp(f,g),w=$p(f,g)+1;return bn(f,x,w).join("")}function vw(n,a,l){if(n=Ht(n),n&&(l||a===t))return n.slice(0,Yp(n)+1);if(!n||!(a=xr(a)))return n;var f=jr(n),g=$p(f,jr(a))+1;return bn(f,0,g).join("")}function xw(n,a,l){if(n=Ht(n),n&&(l||a===t))return n.replace(Na,"");if(!n||!(a=xr(a)))return n;var f=jr(n),g=zp(f,jr(a));return bn(f,g).join("")}function Ew(n,a){var l=K,f=rt;if(re(a)){var g="separator"in a?a.separator:g;l="length"in a?vt(a.length):l,f="omission"in a?xr(a.omission):f}n=Ht(n);var x=n.length;if(Ms(n)){var w=jr(n);x=w.length}if(l>=x)return n;var D=l-Ls(f);if(D<1)return f;var M=w?bn(w,0,D).join(""):n.slice(0,D);if(g===t)return M+f;if(w&&(D+=M.length-D),Hh(g)){if(n.slice(D).search(g)){var $,G=M;for(g.global||(g=eh(g.source,Ht(Ia.exec(g))+"g")),g.lastIndex=0;$=g.exec(G);)var X=$.index;M=M.slice(0,X===t?D:X)}}else if(n.indexOf(xr(g),D)!=D){var J=M.lastIndexOf(g);J>-1&&(M=M.slice(0,J))}return M+f}function Aw(n){return n=Ht(n),n&&gr.test(n)?n.replace(Sr,Qv):n}var bw=ks(function(n,a,l){return n+(l?" ":"")+a.toUpperCase()}),Vh=Rd("toUpperCase");function Bg(n,a,l){return n=Ht(n),a=l?t:a,a===t?$v(n)?Jv(n):Pv(n):n.match(a)||[]}var Ig=wt(function(n,a){try{return mr(n,t,a)}catch(l){return kh(l)?l:new gt(l)}}),ww=Vi(function(n,a){return Nr(a,function(l){l=xi(l),Ui(n,l,Ph(n[l],n))}),n});function Tw(n){var a=n==null?0:n.length,l=ut();return n=a?jt(n,function(f){if(typeof f[1]!="function")throw new Br(u);return[l(f[0]),f[1]]}):[],wt(function(f){for(var g=-1;++g<a;){var x=n[g];if(mr(x[0],this,f))return mr(x[1],this,f)}})}function _w(n){return Q1(Rr(n,A))}function Wh(n){return function(){return n}}function Cw(n,a){return n==null||n!==n?a:n}var Dw=Fd(),Sw=Fd(!0);function lr(n){return n}function zh(n){return pd(typeof n=="function"?n:Rr(n,A))}function Ow(n){return gd(Rr(n,A))}function Mw(n,a){return yd(n,Rr(a,A))}var Lw=wt(function(n,a){return function(l){return Ya(l,n,a)}}),Nw=wt(function(n,a){return function(l){return Ya(n,l,a)}});function $h(n,a,l){var f=Ce(a),g=lu(a,f);l==null&&!(re(a)&&(g.length||!f.length))&&(l=a,a=n,n=this,g=lu(a,Ce(a)));var x=!(re(l)&&"chain"in l)||!!l.chain,w=zi(n);return Nr(g,function(D){var M=a[D];n[D]=M,w&&(n.prototype[D]=function(){var $=this.__chain__;if(x||$){var G=n(this.__wrapped__),X=G.__actions__=ar(this.__actions__);return X.push({func:M,args:arguments,thisArg:n}),G.__chain__=$,G}return M.apply(n,yn([this.value()],arguments))})}),n}function Bw(){return Oe._===this&&(Oe._=s1),this}function Gh(){}function Iw(n){return n=vt(n),wt(function(a){return md(a,n)})}var Rw=wh(jt),Pw=wh(kp),Fw=wh(Xl);function Rg(n){return Mh(n)?Zl(xi(n)):px(n)}function kw(n){return function(a){return n==null?t:Qn(n,a)}}var Hw=Hd(),Uw=Hd(!0);function Yh(){return[]}function Xh(){return!1}function qw(){return{}}function Vw(){return""}function Ww(){return!0}function zw(n,a){if(n=vt(n),n<1||n>kt)return[];var l=ge,f=ke(n,ge);a=ut(a),n-=ge;for(var g=jl(f,a);++l<n;)a(l);return g}function $w(n){return mt(n)?jt(n,xi):Er(n)?[n]:ar(eg(Ht(n)))}function Gw(n){var a=++i1;return Ht(n)+a}var Yw=gu(function(n,a){return n+a},0),Xw=Th("ceil"),Zw=gu(function(n,a){return n/a},1),Qw=Th("floor");function Kw(n){return n&&n.length?uu(n,lr,lh):t}function jw(n,a){return n&&n.length?uu(n,ut(a,2),lh):t}function Jw(n){return qp(n,lr)}function tT(n,a){return qp(n,ut(a,2))}function eT(n){return n&&n.length?uu(n,lr,ph):t}function rT(n,a){return n&&n.length?uu(n,ut(a,2),ph):t}var iT=gu(function(n,a){return n*a},1),nT=Th("round"),sT=gu(function(n,a){return n-a},0);function aT(n){return n&&n.length?Kl(n,lr):0}function oT(n,a){return n&&n.length?Kl(n,ut(a,2)):0}return v.after=OA,v.ary=fg,v.assign=yb,v.assignIn=Cg,v.assignInWith=Su,v.assignWith=mb,v.at=vb,v.before=pg,v.bind=Ph,v.bindAll=ww,v.bindKey=dg,v.castArray=qA,v.chain=lg,v.chunk=Qx,v.compact=Kx,v.concat=jx,v.cond=Tw,v.conforms=_w,v.constant=Wh,v.countBy=aA,v.create=xb,v.curry=gg,v.curryRight=yg,v.debounce=mg,v.defaults=Eb,v.defaultsDeep=Ab,v.defer=MA,v.delay=LA,v.difference=Jx,v.differenceBy=tE,v.differenceWith=eE,v.drop=rE,v.dropRight=iE,v.dropRightWhile=nE,v.dropWhile=sE,v.fill=aE,v.filter=uA,v.flatMap=cA,v.flatMapDeep=fA,v.flatMapDepth=pA,v.flatten=sg,v.flattenDeep=oE,v.flattenDepth=uE,v.flip=NA,v.flow=Dw,v.flowRight=Sw,v.fromPairs=lE,v.functions=Sb,v.functionsIn=Ob,v.groupBy=dA,v.initial=cE,v.intersection=fE,v.intersectionBy=pE,v.intersectionWith=dE,v.invert=Lb,v.invertBy=Nb,v.invokeMap=yA,v.iteratee=zh,v.keyBy=mA,v.keys=Ce,v.keysIn=ur,v.map=bu,v.mapKeys=Ib,v.mapValues=Rb,v.matches=Ow,v.matchesProperty=Mw,v.memoize=Tu,v.merge=Pb,v.mergeWith=Dg,v.method=Lw,v.methodOf=Nw,v.mixin=$h,v.negate=_u,v.nthArg=Iw,v.omit=Fb,v.omitBy=kb,v.once=BA,v.orderBy=vA,v.over=Rw,v.overArgs=IA,v.overEvery=Pw,v.overSome=Fw,v.partial=Fh,v.partialRight=vg,v.partition=xA,v.pick=Hb,v.pickBy=Sg,v.property=Rg,v.propertyOf=kw,v.pull=vE,v.pullAll=og,v.pullAllBy=xE,v.pullAllWith=EE,v.pullAt=AE,v.range=Hw,v.rangeRight=Uw,v.rearg=RA,v.reject=bA,v.remove=bE,v.rest=PA,v.reverse=Ih,v.sampleSize=TA,v.set=qb,v.setWith=Vb,v.shuffle=_A,v.slice=wE,v.sortBy=SA,v.sortedUniq=ME,v.sortedUniqBy=LE,v.split=cw,v.spread=FA,v.tail=NE,v.take=BE,v.takeRight=IE,v.takeRightWhile=RE,v.takeWhile=PE,v.tap=KE,v.throttle=kA,v.thru=Au,v.toArray=wg,v.toPairs=Og,v.toPairsIn=Mg,v.toPath=$w,v.toPlainObject=_g,v.transform=Wb,v.unary=HA,v.union=FE,v.unionBy=kE,v.unionWith=HE,v.uniq=UE,v.uniqBy=qE,v.uniqWith=VE,v.unset=zb,v.unzip=Rh,v.unzipWith=ug,v.update=$b,v.updateWith=Gb,v.values=qs,v.valuesIn=Yb,v.without=WE,v.words=Bg,v.wrap=UA,v.xor=zE,v.xorBy=$E,v.xorWith=GE,v.zip=YE,v.zipObject=XE,v.zipObjectDeep=ZE,v.zipWith=QE,v.entries=Og,v.entriesIn=Mg,v.extend=Cg,v.extendWith=Su,$h(v,v),v.add=Yw,v.attempt=Ig,v.camelCase=Kb,v.capitalize=Lg,v.ceil=Xw,v.clamp=Xb,v.clone=VA,v.cloneDeep=zA,v.cloneDeepWith=$A,v.cloneWith=WA,v.conformsTo=GA,v.deburr=Ng,v.defaultTo=Cw,v.divide=Zw,v.endsWith=jb,v.eq=ti,v.escape=Jb,v.escapeRegExp=tw,v.every=oA,v.find=lA,v.findIndex=ig,v.findKey=bb,v.findLast=hA,v.findLastIndex=ng,v.findLastKey=wb,v.floor=Qw,v.forEach=hg,v.forEachRight=cg,v.forIn=Tb,v.forInRight=_b,v.forOwn=Cb,v.forOwnRight=Db,v.get=Uh,v.gt=YA,v.gte=XA,v.has=Mb,v.hasIn=qh,v.head=ag,v.identity=lr,v.includes=gA,v.indexOf=hE,v.inRange=Zb,v.invoke=Bb,v.isArguments=Jn,v.isArray=mt,v.isArrayBuffer=ZA,v.isArrayLike=or,v.isArrayLikeObject=ue,v.isBoolean=QA,v.isBuffer=wn,v.isDate=KA,v.isElement=jA,v.isEmpty=JA,v.isEqual=tb,v.isEqualWith=eb,v.isError=kh,v.isFinite=rb,v.isFunction=zi,v.isInteger=xg,v.isLength=Cu,v.isMap=Eg,v.isMatch=ib,v.isMatchWith=nb,v.isNaN=sb,v.isNative=ab,v.isNil=ub,v.isNull=ob,v.isNumber=Ag,v.isObject=re,v.isObjectLike=ne,v.isPlainObject=Ja,v.isRegExp=Hh,v.isSafeInteger=lb,v.isSet=bg,v.isString=Du,v.isSymbol=Er,v.isTypedArray=Us,v.isUndefined=hb,v.isWeakMap=cb,v.isWeakSet=fb,v.join=gE,v.kebabCase=ew,v.last=Fr,v.lastIndexOf=yE,v.lowerCase=rw,v.lowerFirst=iw,v.lt=pb,v.lte=db,v.max=Kw,v.maxBy=jw,v.mean=Jw,v.meanBy=tT,v.min=eT,v.minBy=rT,v.stubArray=Yh,v.stubFalse=Xh,v.stubObject=qw,v.stubString=Vw,v.stubTrue=Ww,v.multiply=iT,v.nth=mE,v.noConflict=Bw,v.noop=Gh,v.now=wu,v.pad=nw,v.padEnd=sw,v.padStart=aw,v.parseInt=ow,v.random=Qb,v.reduce=EA,v.reduceRight=AA,v.repeat=uw,v.replace=lw,v.result=Ub,v.round=nT,v.runInContext=S,v.sample=wA,v.size=CA,v.snakeCase=hw,v.some=DA,v.sortedIndex=TE,v.sortedIndexBy=_E,v.sortedIndexOf=CE,v.sortedLastIndex=DE,v.sortedLastIndexBy=SE,v.sortedLastIndexOf=OE,v.startCase=fw,v.startsWith=pw,v.subtract=sT,v.sum=aT,v.sumBy=oT,v.template=dw,v.times=zw,v.toFinite=$i,v.toInteger=vt,v.toLength=Tg,v.toLower=gw,v.toNumber=kr,v.toSafeInteger=gb,v.toString=Ht,v.toUpper=yw,v.trim=mw,v.trimEnd=vw,v.trimStart=xw,v.truncate=Ew,v.unescape=Aw,v.uniqueId=Gw,v.upperCase=bw,v.upperFirst=Vh,v.each=hg,v.eachRight=cg,v.first=ag,$h(v,function(){var n={};return mi(v,function(a,l){qt.call(v.prototype,l)||(n[l]=a)}),n}(),{chain:!1}),v.VERSION=r,Nr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){v[n].placeholder=v}),Nr(["drop","take"],function(n,a){St.prototype[n]=function(l){l=l===t?1:Ae(vt(l),0);var f=this.__filtered__&&!a?new St(this):this.clone();return f.__filtered__?f.__takeCount__=ke(l,f.__takeCount__):f.__views__.push({size:ke(l,ge),type:n+(f.__dir__<0?"Right":"")}),f},St.prototype[n+"Right"]=function(l){return this.reverse()[n](l).reverse()}}),Nr(["filter","map","takeWhile"],function(n,a){var l=a+1,f=l==pt||l==B;St.prototype[n]=function(g){var x=this.clone();return x.__iteratees__.push({iteratee:ut(g,3),type:l}),x.__filtered__=x.__filtered__||f,x}}),Nr(["head","last"],function(n,a){var l="take"+(a?"Right":"");St.prototype[n]=function(){return this[l](1).value()[0]}}),Nr(["initial","tail"],function(n,a){var l="drop"+(a?"":"Right");St.prototype[n]=function(){return this.__filtered__?new St(this):this[l](1)}}),St.prototype.compact=function(){return this.filter(lr)},St.prototype.find=function(n){return this.filter(n).head()},St.prototype.findLast=function(n){return this.reverse().find(n)},St.prototype.invokeMap=wt(function(n,a){return typeof n=="function"?new St(this):this.map(function(l){return Ya(l,n,a)})}),St.prototype.reject=function(n){return this.filter(_u(ut(n)))},St.prototype.slice=function(n,a){n=vt(n);var l=this;return l.__filtered__&&(n>0||a<0)?new St(l):(n<0?l=l.takeRight(-n):n&&(l=l.drop(n)),a!==t&&(a=vt(a),l=a<0?l.dropRight(-a):l.take(a-n)),l)},St.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},St.prototype.toArray=function(){return this.take(ge)},mi(St.prototype,function(n,a){var l=/^(?:filter|find|map|reject)|While$/.test(a),f=/^(?:head|last)$/.test(a),g=v[f?"take"+(a=="last"?"Right":""):a],x=f||/^find/.test(a);g&&(v.prototype[a]=function(){var w=this.__wrapped__,D=f?[1]:arguments,M=w instanceof St,$=D[0],G=M||mt(w),X=function(Ct){var Lt=g.apply(v,yn([Ct],D));return f&&J?Lt[0]:Lt};G&&l&&typeof $=="function"&&$.length!=1&&(M=G=!1);var J=this.__chain__,st=!!this.__actions__.length,lt=x&&!J,bt=M&&!st;if(!x&&G){w=bt?w:new St(this);var ht=n.apply(w,D);return ht.__actions__.push({func:Au,args:[X],thisArg:t}),new Ir(ht,J)}return lt&&bt?n.apply(this,D):(ht=this.thru(X),lt?f?ht.value()[0]:ht.value():ht)})}),Nr(["pop","push","shift","sort","splice","unshift"],function(n){var a=Yo[n],l=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",f=/^(?:pop|shift)$/.test(n);v.prototype[n]=function(){var g=arguments;if(f&&!this.__chain__){var x=this.value();return a.apply(mt(x)?x:[],g)}return this[l](function(w){return a.apply(mt(w)?w:[],g)})}}),mi(St.prototype,function(n,a){var l=v[a];if(l){var f=l.name+"";qt.call(Rs,f)||(Rs[f]=[]),Rs[f].push({name:a,func:l})}}),Rs[du(t,P).name]=[{name:"wrapper",func:t}],St.prototype.clone=A1,St.prototype.reverse=b1,St.prototype.value=w1,v.prototype.at=jE,v.prototype.chain=JE,v.prototype.commit=tA,v.prototype.next=eA,v.prototype.plant=iA,v.prototype.reverse=nA,v.prototype.toJSON=v.prototype.valueOf=v.prototype.value=sA,v.prototype.first=v.prototype.head,Ua&&(v.prototype[Ua]=rA),v},Ns=t1();$n?(($n.exports=Ns)._=Ns,zl._=Ns):Oe._=Ns}).call(Xs)}(co,co.exports);var w0=co.exports;const Rt=Kh(w0);class Ot{constructor(e=new k(1/0,1/0),t=new k(-1/0,-1/0)){d(this,"isBox2",!0);d(this,"min");d(this,"max");this.min=e,this.max=t}applyMatrix3(e){return this.isEmpty()?this:(aa[0].set(this.min.x,this.min.y).applyMatrix3(e),aa[1].set(this.min.x,this.max.y).applyMatrix3(e),aa[3].set(this.max.x,this.max.y).applyMatrix3(e),aa[2].set(this.max.x,this.min.y).applyMatrix3(e),this.setFromPoints(aa),this)}clone(){return new Ot().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}ceil(){return this.min.ceilToZero(),this.max.ceilToZero(),this}distanceToPoint(e){return Ze.copy(e).clamp(this.min,this.max).sub(e).length()}expandByXY(e,t){return this.min.minXY(e,t),this.max.maxXY(e,t),this}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByPoints(e){if(!e||!e.length)return this;for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){return e.updateWorldMatrix(!1,!1),e.geometry.boundingBox!==void 0?((!e.geometry.boundingBox||e.geometry.boundingBox.isEmpty())&&e.computeBoundingBox(),ls.copy(e.geometry.boundingBox),ls.applyMatrix3(e.matrixWorld),this.union(ls)):e.geometry.points&&e.geometry.points.length&&(ls.setFromPoints(e.geometry.points),ls.applyMatrix3(e.matrixWorld),this.union(ls)),this}expandByBox(e){this.expandByPoint(e.min),this.expandByPoint(e.max)}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}floor(){return this.min.floorToZero(),this.max.floorToZero(),this}getCenter(e=new k){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e=new k){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}getPoints(e=[]){return e.length=0,e[0]={x:this.min.x,y:this.min.y},e[1]={x:this.min.x,y:this.max.y},e[2]={x:this.max.x,y:this.max.y},e[3]={x:this.max.x,y:this.min.y},e}getArea(){return this.getSize(Ze),Ze.x*Ze.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.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(e){return e?!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y):!1}intersectsObject(e){return!e||!e.geometry?!1:this.intersectsBox(e.geometry.boundingBox)}intersect(e){return this.min.max(e.min),this.max.min(e.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(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t+=3)this.expandByPoint(Ze.fromArray(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const r=Ze.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromProjectionMatrix(e){return this.min.set(e.elements[6],e.elements[7]),this.max.set(e.elements[6],e.elements[7]),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}setFromMinMaxString(e,t=" "){if(this.makeEmpty(),!(e!=null&&e.length))return this;let r=e.split(t),s=Rt.map(r,o=>parseFloat(o));for(let o=0,u=s.length;o<u;o+=2)this.expandByPoint(Ze.fromArray(s,o));return this}translate(e){return this.min.add(e),this.max.add(e),this}toString(){return`{"min":${this.min.toString()},"max":${this.max.toString()}}`}fromString(e){return e?(this.copy(JSON.parse(e)),this):this}union(e){return e.validate()?(this.min.min(e.min),this.max.max(e.max),this):this}validate(){return this.min.validate()&&this.max.validate()}unproject(e){return this.applyMatrix3(e.projectionMatrixInverse).applyMatrix3(e.matrixWorld)}centralArrange(e=1,t=20,r=10){const s=t+r;this.getCenter(Ze),this.getSize(ni),ni.subScalar(t);const o=Math.floor(ni.x/s),u=Math.ceil(e/o),h=o*s,c=u*s;if(ni.x<s||ni.y<s||h>=ni.x||c>=ni.y)return Ze.clone();let p=[],A=0,T=0;for(let C=0;C<e;C++){const N=o>e?e*s:h,O=Ze.x-N/2+T*s+s/2,L=Ze.y-c/2+A*s+s/2;p.push(new k(O,L)),T++,T>=o&&(T=0,A++)}return p}flipY(){return Ze.copy(this.min).multiplyScalar(1,-1),ni.copy(this.max).multiplyScalar(1,-1),this.min.set(Ze.x,ni.y),this.max.set(ni.x,Ze.y),this}}const ls=new Ot,aa=[new k,new k,new k,new k],Ze=new k,ni=new k,T0=Object.freeze(Object.defineProperty({__proto__:null,default:Ot},Symbol.toStringTag,{value:"Module"})),_0=Vt.window.requestAnimationFrame,oa=Vt.window.performance?()=>Vt.window.performance.now():()=>new Date().getTime(),Vc=_0,Nt=class Nt{constructor(){d(this,"id",Nt.idCounter++);d(this,"timers",new Map);d(this,"timersDuration",new Map);d(this,"counters",new Map);d(this,"countersAmount",new Map);d(this,"out",[])}static active(e){e?Nt.actived=!0:Nt.actived=!1,Nt.duration=e||0}static add(e){this.children.push(e),this.handleStart()}static remove(e){for(let t=0,r=Nt.children.length;t<r;t++)if(Nt.children[t].id===e.id){this.children.splice(t,1);break}}static handleStart(){this.isRunning||(this.isRunning=!0,Vc(this.runLoop))}static runLoop(){Nt.children.length?(Nt.runFrames(),Vc(Nt.runLoop)):Nt.isRunning=!1}static runFrames(){let e,t=oa();if(!(t-Nt.lastTime<Nt.duration)){Nt.lastTime=t;for(let r=0,s=this.children.length;r<s;r++)e=this.children[r],e.calculateTimers(),e.calculateCounters(),Nt.messages=Nt.messages.concat(e.out),e.out.length=0;if(Nt.messages.length){if(Nt.actived){let r=[];r.push(C0),r.push(D0),r.push(S0),this.messages.forEach(s=>r.push(I0(s,this.maxLetters))),r.push(O0),console.log(r.join(`
32
32
  `))}Nt.messages.length=0}}}destroy(){Nt.remove(this)}addTimer(e,t=oa(),r=oa()-(this.timersDuration.get(e)||oa())){this.addTimerDuration(e,r),this.timersDuration.set(e,t)}addTimerDuration(e,t){var r;this.timers.has(e)||this.timers.set(e,[]),(r=this.timers.get(e))==null||r.push(t)}calculateTimers(){this.timers.forEach((e,t)=>{!e||!e.length||(this.out.push(this.calculateDurations(t,e)),e.length=0)})}addCounterAmount(e,t){var r;this.counters.has(e)||this.counters.set(e,[]),(r=this.counters.get(e))==null||r.push(t)}calculateCounters(){this.counters.forEach((e,t)=>{!e||!e.length||(this.out.push(this.calculateAmounts(t,e)),e.length=0)})}start(){return this.stop(),Nt.add(this),this}stop(){return Nt.remove(this),this}calculateDurations(e,t){const r={name:e,avg:0,min:0,max:0,stdDev:0,count:0,FPS:0};if(!t||!t.length)return r;const s=t.length,{min:o,max:u,avg:h}=this.minMaxAvg(t),c=parseFloat(this.stdDev(t,h).toFixed(2));return{name:e,avg:this.fd(h),min:this.fd(o),max:this.fd(u),stdDev:c,count:s,FPS:Math.ceil(s/Nt.duration*1e3)}}calculateAmounts(e,t){const r={name:e,avg:0,min:0,max:0,stdDev:0,count:0,FPS:0};if(!t||!t.length)return r;const s=t.length,{min:o,max:u,avg:h}=this.minMaxAvg(t),c=this.stdDev(t,h);return{name:e,avg:h,min:o,max:u,stdDev:c,count:s,FPS:Math.ceil(s/Nt.duration*1e3)}}minMaxAvg(e){let t=e[0],r=e[0],s=e.length,o=0;for(let h=0;h<e.length;h++){const c=e[h];o+=c,c<t&&(t=c),c>r&&(r=c)}const u=o/s;return{min:this.fx(t),max:this.fx(r),avg:this.fx(u)}}stdDev(e,t){let r=0;for(let o=0;o<e.length;o++){const u=e[o];r+=(u-t)*(u-t)}const s=e.length;return this.fx(Math.sqrt(r/s))}fd(e){return e>1e3?(e/1e3).toFixed(1)+"s":e.toFixed(1)+"ms"}fx(e,t=1){return t===1?Math.round(e*10)/10:t===2?Math.round(e*100)/100:t===3?Math.round(e*1e3)/1e3:e}};d(Nt,"idCounter",0),d(Nt,"children",[]),d(Nt,"isRunning",!1),d(Nt,"actived",!1),d(Nt,"duration",0),d(Nt,"lastTime",oa()),d(Nt,"messages",[]),d(Nt,"maxLetters",20);let hs=Nt;const fo=20,po=["avg","min","max","stdDev","count","FPS"],si=L0(po,1),C0=M0(po,fo),D0=N0(po,fo),S0=B0(po,fo),O0=R0(fo);function M0(i,e=20){let t="┌";t+="─".repeat(e),t+="┬";for(let r=0,s=i.length;r<s;r++)t+="─".repeat(si),r<s-1?t+="┬":t+="┐";return t}function L0(i,e=0){let t=0;for(let r=0,s=i.length;r<s;r++)t=Math.max(t,i[r].length);return t+e}function N0(i,e=20){let t="│";t+=" ".repeat(e),t+="│";for(let r=0,s=i.length;r<s;r++)t+=" ".repeat(Math.max(si-i[r].length-1,0)),t+=i[r],t+=" │";return t}function B0(i,e=20){let t="├";t+="─".repeat(e),t+="┼";for(let r=0,s=i.length;r<s;r++)t+="─".repeat(si),r<s-1?t+="┴":t+="┘";return t}function I0(i,e=20){let t="│";t+=" ".repeat(Math.max(e-i.name.length,0)),t+=i.name,t+="│";const r=typeof i.avg=="string"?si-i.avg.length:si-i.avg.toString().length;return t+=" ".repeat(Math.max(r,0)),t+=i.avg+" ",t+=" ".repeat(Math.max(si-i.min.toString().length,0)),t+=i.min+" ",t+=" ".repeat(Math.max(si-i.max.toString().length,0)),t+=i.max+" ",t+=" ".repeat(Math.max(si-i.stdDev.toString().length,0)),t+=i.stdDev+" ",t+=" ".repeat(Math.max(si-i.count.toString().length,0)),t+=i.count+" ",t+=" ".repeat(Math.max(si-i.FPS.toString().length,0)),t+=i.FPS,t}function R0(i=20){let e="└";for(let t=0;t<i;t++)e+="─";return e+="┘",e}function Xu(i,e="http://www.w3.org/2000/svg"){var t,r;return(r=(t=Vt.window)==null?void 0:t.document)==null?void 0:r.createElementNS(e,i)}function go(i=2e3){return Tt(this,null,function*(){return new Promise(e=>setTimeout(e,(Math.random()+.5)*i))})}function Wc(i,e=[]){var t,r;return!i||!i.value||(e.push(i.value),(t=i.children)!=null&&t.length&&((r=i.children)==null||r.forEach(s=>Wc(s,e)))),e}var Qe=(i=>(i.GROS="gros",i.RM="rm",i.WS="ws",i.SU="su",i.EQ="eq",i.FN="fn",i.GL="gl",i.IP="ip",i))(Qe||{}),ua=(i=>(i.BACKGROUND="background",i.ASSETS="assets",i.ANNOTATIONS="annotations",i.TEXT="text",i.ASSET_LABELS="asset-labels",i.LABELS="labels",i))(ua||{});const cs="ae",zc="-",Zu="rm-assets",P0="rm-labels",$c="ws-assets",Gc="ws-labels";function fs(i){return i+zc+ua.ASSETS}function la(i){return i+zc+ua.LABELS}const Yc={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:[Zu,P0,$c,Gc,"eq-assets","eq-labels","fn-assets","fn-labels"],eq:[$c,Gc,"su-assets","su-labels","fn-assets","fn-labels"]};class Ke{constructor(){d(this,"_listeners",new Map)}destroy(){this._listeners.clear()}addEventListener(e,t){let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r)),r.includes(t)||r.push(t)}addEventListeners(e,t){const r=e.split(","),s=r.length;for(let o=0;o<s;o++)this.addEventListener(r[o].trim(),t)}isListening(e){var t;return this._listeners.has(e)&&!!((t=this._listeners.get(e))!=null&&t.length)}hasEventListener(e,t){var r;return this._listeners.size===0?!1:this._listeners.has(e)&&!!((r=this._listeners.get(e))!=null&&r.includes(t))}removeEventListener(e,t){const r=this._listeners.get(e);if(r){const s=r.indexOf(t);s>-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners.get(e.type);if(t){e.target=this;const r=t.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=void 0}}dispatchEventAsync(e){const t=this._listeners.get(e.type);t&&setTimeout(()=>{for(const r of t)r.call(this,e)})}}function Xc(i){if(!i)return"inches";let e=i.querySelector("#defaultView"),t=e==null?void 0:e.getAttribute("units");return t||"inches"}function F0(i){if(!i)return 1;let e=Xc(i),t=1;switch(e){case"mm":t=500/39.3701;break;case"cm":t=50/39.3701;break;case"Metres":t=.5/39.3701;break;case"m":t=.5/39.3701;break;default:t=1}return t}function k0(i,e=new Ot){if(!i)return e;let t=i.split(" "),r=Rt.map(t,s=>parseFloat(s));return(r==null?void 0:r.length)!==4||(e.min.set(r[0],r[1]),e.max.set(r[0]+r[2],r[1]+r[3])),e}function H0(i=new Ot){let e="";const t=[];return t.push(i.min.x),t.push(i.min.y),t.push(Math.abs(i.max.x-i.min.x)),t.push(Math.abs(i.max.y-i.min.y)),e=t.join(" "),e}function Zc(i){var e;if((e=i==null?void 0:i.children)!=null&&e.length){for(let t=0,r=i.children.length;t<r;t++)if(i.children[t].nodeName==="g")return i.children[t]}}const U0=new hs().start();class q0 extends Ke{constructor(t){super();d(this,"isSvgRenderer",!0);d(this,"id");d(this,"params");d(this,"container",Vt.window.document.getElementsByTagName("body")[0]);d(this,"cameraVersion",-1);d(this,"viewAreaLimit",-1);d(this,"autoClear");this.id="SvgRenderer@"+Date.now(),this.params=t,Vt.config=t,this.initSvg(),hs.active(this.params.monitorDuration)}destroy(){hs.active(0)}initSvg(){if(this.params.containerId&&(this.container=Vt.window.document.getElementById(this.params.containerId)),this.container||(this.container=Vt.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 p,A;const t=((p=this.container)==null?void 0:p.parentElement)||document.body,r=t.getBoundingClientRect();if(!r)return;const s=window.getComputedStyle(t),o=r.width-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight),u=r.height-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom),h=(A=this.container)==null?void 0:A.getBoundingClientRect();if(!h)return;const c=o-h.left+r.left,y=u-h.top+r.top;this.setSize(c,y)}setSize(t,r){this.container.style.width=t+"px",this.container.style.height=r+"px",this.params.width=t,this.params.height=r,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(){}render(t,r){return Tt(this,null,function*(){var o;if(!t||!r||this.cameraVersion===(r==null?void 0:r.version))return;r.updateMatrixWorld(),Kc.set(0,0).unproject(r),jc.set(this.params.width,this.params.height).unproject(r),Qc.setFromPoints([Kc,jc]);let s=H0(Qc);(o=t.svg)==null||o.setAttribute("viewBox",s),this.cameraVersion=r.version||-1,U0.addTimer("render cycle")})}getRenderTarget(){}setRenderTarget(t){}renderTexture(t,r){}}const Qc=new Ot,Kc=new k,jc=new k;class ce{constructor(){d(this,"isMatrix3",!0);d(this,"elements",[1,0,0,0,1,0,0,0,1])}static equals(e,t,r=1e-6){if(e.elements.length!=t.elements.length)return!1;for(let s=0,o=e.elements.length;s<o;s++){const u=e.elements[s]-t.elements[s];if(Math.abs(u)>r)return!1}return!0}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}clone(){return new ce().fromArray(this.elements)}compose(e,t,r){const s=Math.sin(t.x),o=Math.cos(t.x);return this.set(r.x*o,r.y*s*-1,e.x,r.x*s,r.y*o,e.y,0,0,1)}composeWithCenter(e,t,r,s){return qr.identity(),yo.makeTranslation(e.x,e.y),ha.makeRotation(t.x),_n.makeScale(r.x,r.y),De.copy(s).applyMatrix3(_n),qr.multiply(Qu.makeTranslation(-De.x,-De.y)).multiply(yo).multiply(Qu.makeTranslation(De.x,De.y)).multiply(ha).multiply(Qu.makeTranslation(-De.x,-De.y)).multiply(_n),this.copy(qr)}decompose(e,t,r){const s=qr.copy(this).elements,o=Math.sqrt(s[0]*s[0]+s[3]*s[3]),u=Math.sqrt(s[1]*s[1]+s[4]*s[4]),h=s[0]*s[4]-s[3]*s[1];s[0]||s[3]?r.set(o,h/o):s[1]||s[4]?r.set(h/u,u):r.set(0,0);let c=0;s[0]||s[3]?c=s[3]>0?-Math.acos(s[0]/o):Math.acos(s[0]/o):s[1]||s[4]?c=Math.PI/2-(s[4]>0?Math.acos(-s[1]/u):-Math.acos(s[1]/u)):c=0,c!==0&&r.y<0&&(c*=-1),t.set(c,c),e.set(s[6],s[7])}compose2(e,t,r){return this.identity().translate(e.x,e.y).rotate(t.x).scale(r.x,r.y),this}decompose2(e,t,r){const s=this.clone();s.scale(-1,1);const o=s.elements[0],u=s.elements[1],h=s.elements[3],c=s.elements[4];let y=0,p=0,A=0;if(o!==0||h!==0){const T=Math.hypot(o,h);y=T,p=(o*c-u*h)/T;const C=Math.acos(o/T);A=h>0?-C:C}else if(u!==0||c!==0){const T=Math.hypot(u,c);y=(o*c-u*h)/T,p=T;const C=Math.acos(u/T);A=Math.PI/2+(c>0?-C:C)}else y=0,p=0,A=0;y=-y,e.x=s.elements[6],e.y=s.elements[7],t.x=t.y=A/Math.PI/180,r.x=y,r.y=p}composeSvgTransform(e=0,t=0,r,s=!1){if(!r&&!e&&!t)return this;this.identity(),qr.identity();let o=r==null?void 0:r.split(") ").map(u=>u.trim()+")").filter(u=>u!==")");return o||(o=[]),(e||t)&&o.push(`translate(${e},${t})`),o.forEach(u=>{const h=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(u),c=/rotate\(\s*(-?\d*\.?\d+)(?:[ ,](-?\d*\.?\d+)(?:[ ,](-?\d*\.?\d+))?)?\s*\)/.exec(u),y=/translate\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(u);if(h){const p=Number(h[1])||1,A=Number(h[2])||p;qr.multiply(_n.makeScale(p,A))}else if(c){const p=m0(Number(c[1])||0);Number(c[2])||Number(c[3])?(Ne.set(Number(c[2]||"0"),Number(c[3]||"0")),qr.multiply(ha.makeRotationByPoint(p,Ne))):qr.multiply(ha.makeRotation(p))}else y&&qr.multiply(yo.makeTranslation(Number(y[1])||0,Number(y[2])||0))}),this.copy(qr),s&&this.premultiply(_n.makeScale(1,-1)),this}decomposeSvgMatrix(e,t,r){const s=qr.copy(this).elements;Ne.set(s[0],s[1]),De.set(s[3],s[4]);let o=Ne.length();Ne.normalize();let u=Ne.dot(De);Jc.copy(Ne).multiplyScalar(-u),De.add(Jc);const h=De.length()||0;De.normalize(),Ne.x*De.y<De.x*Ne.y&&(Ne.x=-Ne.x,Ne.y=-Ne.y,o=-o,u=-u);const c=o?Math.atan2(Ne.y,Ne.x):Math.atan2(-Ne.x,De.y);e.set(s[6],s[7]),t.set(c,c),r.set(o,h)}determinant(){const e=this.elements,t=e[0],r=e[3],s=e[6],o=e[1],u=e[4],h=e[7],c=e[2],y=e[5],p=e[8];return t*u*p-t*y*h-o*r*p+o*y*s+c*r*h-c*u*s}equals(e,t=0){const r=this.elements,s=e.elements;for(let o=0;o<9;o++)if(Math.abs(r[o]-s[o])>t)return!1;return!0}extractBasis2(e,t){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),this}flipY(){return this.multiply(_n.makeScale(1,-1))}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}getComponents(e=[1,0,0,1,0,0]){return e[0]=this.elements[0],e[1]=this.elements[1],e[2]=this.elements[3],e[3]=this.elements[4],e[4]=this.elements[6],e[5]=this.elements[7],e}getNormalMatrix(e){return this.setFromMatrix(e).invert().transpose()}getRotation(e){let t=this.elements;const r=Math.sqrt(t[0]*t[0]+t[3]*t[3]),s=Math.sqrt(t[1]*t[1]+t[4]*t[4]);let o=0;t[0]||t[3]?o=t[3]>0?-Math.acos(t[0]/r):Math.acos(t[0]/r):t[1]||t[4]?o=Math.PI/2-(t[4]>0?Math.acos(-t[1]/s):-Math.acos(t[1]/s)):o=0,this.getScale(De),o!==0&&De.x<0&&(o*=-1),e.set(o,o)}getScale(e){let t=this.elements,r=Math.sqrt(t[0]*t[0]+t[1]*t[1]),s=Math.sqrt(t[3]*t[3]+t[4]*t[4]),o=t[0]*t[4]-t[3]*t[1];t[0]||t[1]?e.set(o/s,s):t[3]||t[4]?e.set(r,o/r):e.set(0,0)}getTransition(e){e.set(this.elements[6],this.elements[7])}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}hasChange(){for(let e=0,t=this.elements.length;e<t;e++)if(Math.abs(this.elements[e]-V0[e])>Number.EPSILON)return!0;return!1}invert(){const e=this.elements,t=e[0],r=e[1],s=e[2],o=e[3],u=e[4],h=e[5],c=e[6],y=e[7],p=e[8],A=p*u-h*y,T=h*c-p*o,C=y*o-u*c,N=t*A+r*T+s*C;if(N===0)return this.set(0,0,0,0,0,0,0,0,0);const O=1/N;return e[0]=A*O,e[1]=(s*y-p*r)*O,e[2]=(h*r-s*u)*O,e[3]=T*O,e[4]=(p*t-s*c)*O,e[5]=(s*o-h*t)*O,e[6]=C*O,e[7]=(r*c-y*t)*O,e[8]=(u*t-r*o)*O,this}lookAt(e,t,r){return this.identity().rotate(t.angle()-e.angle()+r.angle())}makeProjection(e,t,r,s,o,u){const h=o/(t-e),c=u/(r-s),y=o/2-(t+e)*h,p=u/2+(r+s)*c;return this.elements[0]=h,this.elements[3]=0,this.elements[6]=y,this.elements[1]=0,this.elements[4]=-c,this.elements[7]=p,this.elements[2]=0,this.elements[5]=0,this.elements[8]=1,this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeRotationByPoint(e,t){const r=Math.cos(e),s=Math.sin(e),o=-t.x*r+t.y*s+t.x,u=-t.x*s-t.y*r+t.y;return this.set(r,-s,o,s,r,u,0,0,1),this}makeRotationFromQuaternion(e){return this.compose(W0,e,z0)}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}multiply(e){return this.multiplyMatrices(this,e)}multiplyMatrices(e,t){const r=e.elements,s=t.elements,o=this.elements,u=r[0],h=r[3],c=r[6],y=r[1],p=r[4],A=r[7],T=r[2],C=r[5],N=r[8],O=s[0],L=s[3],P=s[6],W=s[1],V=s[4],b=s[7],Y=s[2],z=s[5],j=s[8];return o[0]=u*O+h*W+c*Y,o[3]=u*L+h*V+c*z,o[6]=u*P+h*b+c*j,o[1]=y*O+p*W+A*Y,o[4]=y*L+p*V+A*z,o[7]=y*P+p*b+A*j,o[2]=T*O+C*W+N*Y,o[5]=T*L+C*V+N*z,o[8]=T*P+C*b+N*j,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}premultiply(e){return this.multiplyMatrices(e,this)}rotate(e){return this.premultiply(ha.makeRotation(-e))}scale(e,t){return this.premultiply(_n.makeScale(e,t))}set(e,t,r,s,o,u,h,c,y){return this.elements[0]=e,this.elements[3]=t,this.elements[6]=r,this.elements[1]=s,this.elements[4]=o,this.elements[7]=u,this.elements[2]=h,this.elements[5]=c,this.elements[8]=y,this}setFromDomMatrix(e){return typeof e.m11!="undefined"&&typeof e.m21!="undefined"&&typeof e.m41!="undefined"&&typeof e.m12!="undefined"&&typeof e.m22!="undefined"&&typeof e.m42!="undefined"&&typeof e.m14!="undefined"&&typeof e.m24!="undefined"&&typeof e.m44!="undefined"?this.set(e.m11,e.m21,e.m41,e.m12,e.m22,e.m42,e.m14,e.m24,e.m44):typeof e.a!="undefined"&&typeof e.b!="undefined"&&typeof e.c!="undefined"&&typeof e.d!="undefined"&&typeof e.e!="undefined"&&typeof e.f!="undefined"&&this.set(e.a,e.c,e.e,e.b,e.d,e.f,0,0,1),this}setFromMatrix(e){const t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this}setUvTransform(e,t,r,s,o,u,h){const c=Math.cos(o),y=Math.sin(o);return this.set(r*c,r*y,-r*(c*u+y*h)+u+e,-s*y,s*c,-s*(-y*u+c*h)+h+t,0,0,1),this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}toString(){return`[${this.elements[0]},${this.elements[1]}, ${this.elements[3]},${this.elements[4]}, ${this.elements[6]},${this.elements[7]}]`}translate(e,t){return this.premultiply(yo.makeTranslation(e,t))}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}}const V0=[1,0,0,0,1,0,0,0,1],Ne=new k,De=new k,Jc=new k,qr=new ce,yo=new ce,ha=new ce,_n=new ce,Qu=new ce,W0=new k(0,0,0),z0=new k(1,1,1),Be=["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"],tf=()=>{const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Be[i&255]+Be[i>>8&255]+Be[i>>16&255]+Be[i>>24&255]+"-"+Be[e&255]+Be[e>>8&255]+"-"+Be[e>>16&15|64]+Be[e>>24&255]+"-"+Be[t&63|128]+Be[t>>8&255]+"-"+Be[t>>16&255]+Be[t>>24&255]+Be[r&255]+Be[r>>8&255]+Be[r>>16&255]+Be[r>>24&255]).toLowerCase()};class ef extends Ke{constructor(t={}){super();d(this,"isObject2",!0);d(this,"id",$0++);d(this,"uuid",tf());d(this,"name");d(this,"type","Object2");d(this,"featureKey","Object2_"+this.id);d(this,"parent");d(this,"children",[]);d(this,"up",new k(0,1));d(this,"position",new k);d(this,"rotation",new k);d(this,"scaled",new k(1,1));d(this,"flipY",!1);d(this,"selectable",!1);d(this,"matrix",new ce);d(this,"matrixWorld",new ce);d(this,"matrixWorldInverse",new ce);d(this,"modelViewMatrix",new ce);d(this,"normalMatrix",new ce);d(this,"fixed",!1);d(this,"dynamically",!1);d(this,"matrixAutoUpdate",!1);d(this,"matrixWorldNeedsUpdate",!1);d(this,"matrixWorldAutoUpdate",!1);d(this,"composeNode",!1);d(this,"isInComposeNode",!1);d(this,"alignCenter",!1);d(this,"boundingBox",new Ot);d(this,"boundingBoxWorld",new Ot);d(this,"boundingBoxNeedsUpdate",!1);d(this,"centerPoint",new k);d(this,"visible",!0);d(this,"castShadow",!1);d(this,"receiveShadow",!1);d(this,"renderOrder",0);d(this,"animations",[]);d(this,"finalSize");d(this,"userData",{});d(this,"DefaultUp",new k(0,1));d(this,"_autoSort",!0);d(this,"_version",0);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)}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(Ju)}setPosition(t){return this.position.set(t.x,t.y),this}translate(t,r){this.position.x+=t,this.position.y+=r}setScale(t,r){return this.scaled.set(t,r),this}setRotationFromMatrix(t){t.decompose(fa,this.rotation,ju)}setRotation(t){return this.rotation.set(t,t),this}rotate(t){this.rotation.x+=t}scale(t,r){r?(this.scaled.x*=t,this.scaled.y*=r):this.scaled.multiplyScalar(t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix3(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix3(ai.copy(this.matrixWorld).invert())}lookAt(t){rf.copy(t),this.updateWorldMatrix(!0,!1),this.matrixWorld.getTransition(fa),ai.lookAt(fa,rf,G0),ai.getRotation(Cn),this.rotation.set(Cn.x,Cn.x),this.parent&&(this.parent.matrixWorld.getRotation(Cn),this.rotate(Cn.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 r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateMatrixWorld(t);this.boundingBoxNeedsUpdate&&(this.updateBoundingBox(),this.boundingBoxNeedsUpdate=!1)}updateWorldMatrix(t=!1,r=!1){const s=this.parent;if(t&&s&&s.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(),r){const o=this.children;for(let u=0,h=o.length;u<h;u++)o[u].updateWorldMatrix(!1,!0)}}updateModelViewMatrix(t){ai.copy(this.matrixWorld),t&&this.fixed?this.modelViewMatrix.copy(t.projectionMatrix):t?this.modelViewMatrix.multiplyMatrices(t.viewMatrix,ai):this.modelViewMatrix.copy(ai);for(let r=0,s=this.children.length;r<s;r++)this.children[r].updateModelViewMatrix(t)}computeBoundingBox(){this.boundingBox.makeEmpty(),this.centerPoint.set(0,0);for(let t=0,r=this.children.length;t<r;t++)this.children[t].updateMatrixWorld(),ca.copy(this.children[t].computeBoundingBox()),ca.applyMatrix3(ai.copy(this.children[t].matrixWorld)),this.boundingBox.union(ca);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 r in t)if(!(r==="children"||t[r]===void 0)){if(r==="userData"&&t[r]){Object.keys(t[r]).forEach(s=>this.userData[s]=t[r][s]);continue}this.userData[r]=t[r]}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((r,s)=>r.renderOrder-s.renderOrder),t.dispatchEvent(Y0),this.matrixAutoUpdate||(this.matrixWorldNeedsUpdate=!0),this)}adds(t){if(!t||!t.length)return this;this._autoSort=!1;for(let r=0,s=t.length;r<s;r++)r===t.length-1&&(this._autoSort=!0),this.add(t[r]);return this}remove(t){const r=this.children.indexOf(t);return r!==-1&&(t.parent=void 0,this.children.splice(r,1),t.dispatchEvent(Ju)),this}removes(t){for(let r=0,s=t.length;r<s;r++)this.remove(t[r]);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 r=this.children[t];r.parent=void 0,r.destroy(),r.dispatchEvent(Ju)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),ai.copy(this.matrixWorld).invert(),t.parent&&(t.parent.updateWorldMatrix(!0,!1),ai.multiply(t.parent.matrixWorld)),t.applyMatrix3(ai),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,r){if(this[t]===r)return this;for(let s=0,o=this.children.length;s<o;s++){const h=this.children[s].getObjectByProperty(t,r);if(h!==void 0)return h}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(t,Cn,ju),t}getWorldRotation(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fa,t,ju),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fa,Cn,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 r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].traverse(t)}traverseVisible(t){if(this.visible)return;t(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].traverseVisible(t)}traverseAncestors(t){const r=this.parent;r&&(t(r),r.traverseAncestors(t))}onBeforeRender(t,r,s,o){}render(t){}onAfterRender(t,r,s){}setSelectable(t){this.selectable=t,this.parent&&this.parent.setSelectable(t)}raycast(t,r=[]){}getByRange(t,r=!1,s=[]){if(ca.copy(t),ca.containsBox(this.boundingBoxWorld)&&s.push(this),!r||this.composeNode)return s;for(let o=0,u=this.children.length;o<u;o++)this.children[o].getByRange(t,r,s);return s}clone(t=!0,r=!1){const s=this.constructor;return new s(this.userData).copy(this,t,r)}copy(t,r=!0,s=!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)),r)for(let o=0;o<t.children.length;o++){const u=t.children[o];this.add(u.clone(r,s))}return this}}let $0=0;const Ku=new k,ai=new ce,rf=new k,ca=new Ot,fa=new k,ju=new k,Cn=new k,G0=new k(0,1),Y0={type:"added"},Ju={type:"removed"};class X0 extends ef{constructor(){super();d(this,"name","Scene");d(this,"type","Scene");d(this,"isScene",!0);d(this,"view");d(this,"background");d(this,"featureKey","Scene_"+this.id);d(this,"matrixAutoUpdate",!1)}destroy(){super.destroy(),this.boundingBox.makeEmpty()}setup(t){this.view=t}render(t){var r;this.visible&&((r=this.children)==null||r.forEach(function(s){s.isShape&&s.render(t)}))}getIntersectObjects(t,r=Qe.RM,s=[]){throw new Error("must be implemented in derived")}}class Z0{constructor(e,t,r){d(this,"isLoading",!1);d(this,"itemsLoaded",0);d(this,"itemsTotal",0);d(this,"urlModifier");d(this,"handlers",[]);d(this,"onStart");d(this,"onLoad");d(this,"onProgress");d(this,"onError");this.onLoad=e,this.onProgress=t,this.onError=r}itemStart(e){this.itemsTotal++,this.isLoading||this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(e){this.onError!==void 0&&this.onError(e)}resolveURL(e){return this.urlModifier!==void 0?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,r=this.handlers.length;t<r;t+=2){const s=this.handlers[t],o=this.handlers[t+1];if(s.global&&(s.lastIndex=0),s.test(e))return o}return null}}const nf={enabled:!1,files:{},add:function(i,e){this.enabled&&(this.files[i]=e)},get:function(i){if(this.enabled)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}},Q0=new Z0;class sf{constructor(e=Q0){d(this,"manager");d(this,"crossOrigin","anonymous");d(this,"withCredentials",!1);d(this,"path","");d(this,"resourcePath","");d(this,"requestHeader",{});this.manager=e}loadAsync(e,t){const r=this;return new Promise(function(s,o){r.load(e,s,t,o)})}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const _i={};class K0 extends Error{constructor(t,r){super(t);d(this,"response");this.response=r}}class j0 extends sf{constructor(t){super(t);d(this,"mimeType");d(this,"responseType")}load(t,r,s,o){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const u=nf.get(t);if(u!==void 0)return this.manager.itemStart(t),setTimeout(()=>{r&&r(u),this.manager.itemEnd(t)},0),u;if(_i[t]!==void 0){_i[t].push({onLoad:r,onProgress:s,onError:o});return}_i[t]=[],_i[t].push({onLoad:r,onProgress:s,onError:o});const h=new Vt.window.Request(t,{headers:new Vt.window.Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),c=this.mimeType,y=this.responseType;fetch(h).then(p=>{if(p.status===200||p.status===0){if(p.status===0&&console.warn("FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||p.body===void 0||p.body.getReader===void 0)return p;const A=_i[t],T=p.body.getReader(),C=p.headers.get("Content-Length")||p.headers.get("X-File-Size"),N=C?parseInt(C):0,O=N!==0;let L=0;const P=new ReadableStream({start(W){V();function V(){T.read().then(({done:b,value:Y})=>{if(b)W.close();else{L+=Y.byteLength;const z=new ProgressEvent("progress",{lengthComputable:O,loaded:L,total:N});for(let j=0,tt=A.length;j<tt;j++){const Q=A[j];Q.onProgress&&Q.onProgress(z)}W.enqueue(Y),V()}})}}});return new Response(P)}else throw new K0(`fetch for "${p.url}" responded with ${p.status}: ${p.statusText}`,p)}).then(p=>{switch(y){case"arraybuffer":return p.arrayBuffer();case"blob":return p.blob();case"document":return p.text().then(A=>new DOMParser().parseFromString(A,c));case"json":return p.json();default:if(c===void 0)return p.text();{const T=/charset="?([^;"\s]*)"?/i.exec(c),C=T&&T[1]?T[1].toLowerCase():void 0,N=new TextDecoder(C);return p.arrayBuffer().then(O=>N.decode(O))}}}).then(p=>{nf.add(t,p);const A=_i[t];delete _i[t];for(let T=0,C=A.length;T<C;T++){const N=A[T];N.onLoad&&N.onLoad(p)}}).catch(p=>{const A=_i[t];if(A===void 0)throw this.manager.itemError(t),p;delete _i[t];for(let T=0,C=A.length;T<C;T++){const N=A[T];N.onError&&N.onError(p)}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 af extends sf{constructor(e){super(e)}load(e,t,r,s){const o=this,u=new j0(o.manager);u.setPath(o.path),u.setRequestHeader(o.requestHeader),u.setWithCredentials(o.withCredentials),u.load(e,function(h){try{t&&t(h)}catch(c){s?s(c):console.error(c),o.manager.itemError(e)}},r,s)}}function pa(i,e,t){if(!i)return t;let r=t;if(typeof i.getAttribute=="function"?r=i==null?void 0:i.getAttribute(e):Object.hasOwnProperty.call(i,"attributes")&&(r=i.attributes[e]),!r)return t;if(typeof t!="undefined"){if(typeof t=="string")return r;if(typeof t=="number")return Number(r)}return r}function J0(i,e,t,r,s,o,u,h,c){let y=c*(Math.PI/180),p=Math.cos(y)*(i-t)/2+Math.sin(y)*(e-r)/2,A=-1*Math.sin(y)*(i-t)/2+Math.cos(y)*(e-r)/2,T=p*p/(u*u)+A*A/(h*h);T>1&&(u*=Math.sqrt(T),h*=Math.sqrt(T));let C=Math.sqrt((u*u*(h*h)-u*u*(A*A)-h*h*(p*p))/(u*u*(A*A)+h*h*(p*p)));s===o&&(C*=-1),isNaN(C)&&(C=0);let N=C*u*A/h,O=C*-h*p/u,L=(i+t)/2+Math.cos(y)*N-Math.sin(y)*O,P=(e+r)/2+Math.sin(y)*N+Math.cos(y)*O,W=function(Q){return Math.sqrt(Q[0]*Q[0]+Q[1]*Q[1])},V=function(Q,K){return(Q[0]*K[0]+Q[1]*K[1])/(W(Q)*W(K))},b=function(Q,K){return(Q[0]*K[1]<Q[1]*K[0]?-1:1)*Math.acos(V(Q,K))},Y=b([1,0],[(p-N)/u,(A-O)/h]),z=[(p-N)/u,(A-O)/h],j=[(-1*p-N)/u,(-1*A-O)/h],tt=b(z,j);return V(z,j)<=-1&&(tt=Math.PI),V(z,j)>=1&&(tt=0),o===0&&tt>0&&(tt=tt-2*Math.PI),o===1&&tt<0&&(tt=tt+2*Math.PI),[L,P,u,h,Y,tt,y,o]}function t2(i,e,t,r,s,o,u){const h=[],c=Math.max(Math.floor(Math.abs(o)/(Math.PI/2)),1),y=o/c;for(let p=0;p<c;p++){const A=s+p*y,T=A+y,C=Math.tan(T/4-A/4),N=Math.sin(A),O=Math.cos(A),L=Math.sin(T),P=Math.cos(T),W=i+t*O*Math.cos(u*Math.PI/180)-r*N*Math.sin(u*Math.PI/180),V=e+t*O*Math.sin(u*Math.PI/180)+r*N*Math.cos(u*Math.PI/180),b=i+t*P*Math.cos(u*Math.PI/180)-r*L*Math.sin(u*Math.PI/180),Y=e+t*P*Math.sin(u*Math.PI/180)+r*L*Math.cos(u*Math.PI/180),z=W+C*(-t*N*Math.cos(u*Math.PI/180)-r*O*Math.sin(u*Math.PI/180)),j=V+C*(-t*N*Math.sin(u*Math.PI/180)+r*O*Math.cos(u*Math.PI/180)),tt=b+C*(t*L*Math.cos(u*Math.PI/180)+r*P*Math.sin(u*Math.PI/180)),Q=Y+C*(t*L*Math.sin(u*Math.PI/180)-r*P*Math.cos(u*Math.PI/180));h.push([[W,V],[z,j],[tt,Q],[b,Y]])}return h}const fe=" ";function e2(i){let e="";Array.isArray(i)||(i=[i]);for(let t=0;t<i.length;t++){const r=i[t];if(r.type===I.CLOSE_PATH)e+="z";else if(r.type===I.HORIZ_LINE_TO)e+=(r.relative?"h":"H")+r.x;else if(r.type===I.VERT_LINE_TO)e+=(r.relative?"v":"V")+r.y;else if(r.type===I.MOVE_TO)e+=(r.relative?"m":"M")+r.x+fe+r.y;else if(r.type===I.LINE_TO)e+=(r.relative?"l":"L")+r.x+fe+r.y;else if(r.type===I.CURVE_TO)e+=(r.relative?"c":"C")+r.x1+fe+r.y1+fe+r.x2+fe+r.y2+fe+r.x+fe+r.y;else if(r.type===I.SMOOTH_CURVE_TO)e+=(r.relative?"s":"S")+r.x2+fe+r.y2+fe+r.x+fe+r.y;else if(r.type===I.QUAD_TO)e+=(r.relative?"q":"Q")+r.x1+fe+r.y1+fe+r.x+fe+r.y;else if(r.type===I.SMOOTH_QUAD_TO)e+=(r.relative?"t":"T")+r.x+fe+r.y;else if(r.type===I.ARC)e+=(r.relative?"a":"A")+r.rX+fe+r.rY+fe+r.xRot+fe+ +r.lArcFlag+fe+ +r.sweepFlag+fe+r.x+fe+r.y;else throw new Error(`Unexpected command type "${r==null?void 0:r.type}" at index ${t}.`)}return e}function tl([i,e],t){return[i*Math.cos(t)-e*Math.sin(t),i*Math.sin(t)+e*Math.cos(t)]}function Vr(...i){for(let e=0;e<i.length;e++)if(typeof i[e]!="number")throw new Error(`assertNumbers arguments[${e}] is not a number. ${typeof i[e]} == typeof ${i[e]}`);return!0}const Zi=Math.PI;function el(i,e,t){i.lArcFlag=i.lArcFlag===0?0:1,i.sweepFlag=i.sweepFlag===0?0:1;let{rX:r,rY:s}=i;const{x:o,y:u}=i;if(Math.abs(r)<1e-10||Math.abs(s)<1e-10){i.rX=0,i.rY=0,i.cX=(e+o)/2,i.cY=(t+u)/2,i.phi1=0,i.phi2=0;return}r=Math.abs(i.rX),s=Math.abs(i.rY);const h=i.xRot/180*Zi,[c,y]=tl([(e-o)/2,(t-u)/2],-h),p=Math.pow(c,2)/Math.pow(r,2)+Math.pow(y,2)/Math.pow(s,2);1<p&&(r*=Math.sqrt(p),s*=Math.sqrt(p)),i.rX=r,i.rY=s;const A=Math.pow(r,2)*Math.pow(y,2)+Math.pow(s,2)*Math.pow(c,2),T=(i.lArcFlag!==i.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(s,2)-A)/A)),C=r*y/s*T,N=-s*c/r*T,O=tl([C,N],h);i.cX=O[0]+(e+o)/2,i.cY=O[1]+(t+u)/2,i.phi1=Math.atan2((y-N)/s,(c-C)/r),i.phi2=Math.atan2((-y-N)/s,(-c-C)/r),i.sweepFlag===0&&i.phi2>i.phi1&&(i.phi2-=2*Zi),i.sweepFlag===1&&i.phi2<i.phi1&&(i.phi2+=2*Zi),i.phi1*=180/Zi,i.phi2*=180/Zi}function of(i,e,t){Vr(i,e,t);const r=i*i+e*e-t*t;if(0>r)return[];if(r===0)return[[i*t/(i*i+e*e),e*t/(i*i+e*e)]];const s=Math.sqrt(r);return[[(i*t+e*s)/(i*i+e*e),(e*t-i*s)/(i*i+e*e)],[(i*t-e*s)/(i*i+e*e),(e*t+i*s)/(i*i+e*e)]]}const Dn=Math.PI/180;function uf(i,e,t){return(1-t)*i+t*e}function lf(i,e,t,r){return i+Math.cos(r/180*Zi)*e+Math.sin(r/180*Zi)*t}function hf(i,e,t,r){const o=e-i,u=t-e,h=r-t,c=3*o+3*h-6*u,y=(u-o)*6,p=3*o;return Math.abs(c)<1e-6?Math.abs(y)<1e-6?[]:[-p/y]:r2(y/c,p/c,1e-6)}function cf(i,e,t,r,s){const o=1-s,u=o*o*o,h=3*o*o*s,c=3*o*s*s,y=s*s*s;return i*u+e*h+t*c+r*y}function r2(i,e,t=1e-6){const r=i*i/4-e;if(r<-t)return[];if(r<=t)return[-i/2];const s=Math.sqrt(r);return[-(i/2)-s,-(i/2)+s]}function i2(i,e,t){i.cX||el(i,e,t);const r=i.xRot/180*Zi;if(Math.abs(i.rX)<1e-10||Math.abs(i.rY)<1e-10)return[{relative:i.relative,type:I.CURVE_TO,x1:e+(i.x-e)/3,y1:t+(i.y-t)/3,x2:e+2*(i.x-e)/3,y2:t+2*(i.y-t)/3,x:i.x,y:i.y}];const s=Math.min(i.phi1,i.phi2),o=Math.max(i.phi1,i.phi2),u=o-s,h=Math.ceil(u/90),c=new Array(h);let y=e,p=t;const A=(T,C)=>{const[N,O]=tl([T*i.rX,C*i.rY],r);return[i.cX+N,i.cY+O]};for(let T=0;T<h;T++){const C=uf(i.phi1,i.phi2,T/h),N=uf(i.phi1,i.phi2,(T+1)/h),O=N-C,L=4/3*Math.tan(O*Dn/4),P=Math.cos(C*Dn)-L*Math.sin(C*Dn),W=Math.sin(C*Dn)+L*Math.cos(C*Dn),V=Math.cos(N*Dn),b=Math.sin(N*Dn),Y=V+L*b,z=b-L*V,j=A(P,W),tt=A(Y,z),Q=A(V,b),K={relative:i.relative,type:I.CURVE_TO,x:Q[0],y:Q[1],x1:j[0],y1:j[1],x2:tt[0],y2:tt[1]};i.relative&&(K.x1-=y,K.y1-=p,K.x2-=y,K.y2-=p,K.x-=y,K.y-=p),y=Q[0],p=Q[1],c[T]=K}return c}function rl(i,e,t){const r=e[0]-i[0],s=e[1]-i[1],o=t[0]-i[0],u=t[1]-i[1],h=r*u-s*o;if(!(Math.abs(h)<1e-10))return!1;const y=r*o+s*u,p=r*r+s*s,A=o*o+u*u;return 0<=y&&y<=A&&p<=A}function n2(i,e=!0){if(i.length<2)return i;const t=pe.INFO((o,u,h)=>{var c,y,p;return Ou(Vs({},o),{x:(c=o.x)!=null?c:u,y:(y=o.y)!=null?y:h,relative:(p=o.relative)!=null?p:!1})}),r=[];let s=[];for(const o of i){const u=t(o);u.type===I.MOVE_TO&&s.length>0&&(e?r.push(...mo(s)):r.unshift(...mo(s)),s=[]),s.push(u)}return s.length>0&&(e?r.push(...mo(s)):r.unshift(...mo(s))),r}function mo(i){var s;const e=((s=i[i.length-1])==null?void 0:s.type)===I.CLOSE_PATH,t=e?i.length-2:i.length-1,r=[{type:I.MOVE_TO,relative:!1,x:i[t].x,y:i[t].y}];for(let o=t;o>0;o--){const u=i[o],h=i[o-1];if(u.relative)throw new Error("Relative command are not supported convert first with `toAbs()`");switch(u.type){case I.HORIZ_LINE_TO:r.push({type:I.HORIZ_LINE_TO,relative:!1,x:h.x});break;case I.VERT_LINE_TO:r.push({type:I.VERT_LINE_TO,relative:!1,y:h.y});break;case I.LINE_TO:case I.MOVE_TO:r.push({type:I.LINE_TO,relative:!1,x:h.x,y:h.y});break;case I.CURVE_TO:r.push({type:I.CURVE_TO,relative:!1,x:h.x,y:h.y,x1:u.x2,y1:u.y2,x2:u.x1,y2:u.y1});break;case I.SMOOTH_CURVE_TO:throw new Error("Unsupported command: S (smooth cubic bezier)");case I.SMOOTH_QUAD_TO:throw new Error("Unsupported command: T (smooth quadratic bezier)");case I.ARC:throw new Error("Unsupported command: A (arc)");case I.QUAD_TO:throw new Error("Unsupported command: Q (quadratic bezier)")}}return e&&r.push({type:I.CLOSE_PATH}),r}function s2(i=1e13){Vr(i);function e(t){return Math.round(t*i)/i}return function(r){return"x1"in r&&typeof r.x1!="undefined"&&(r.x1=e(r.x1)),"y1"in r&&typeof r.y1!="undefined"&&(r.y1=e(r.y1)),"x2"in r&&typeof r.x2!="undefined"&&(r.x2=e(r.x2)),"y2"in r&&typeof r.y2!="undefined"&&(r.y2=e(r.y2)),"x"in r&&typeof r.x!="undefined"&&(r.x=e(r.x)),"y"in r&&typeof r.y!="undefined"&&(r.y=e(r.y)),"rX"in r&&typeof r.rX!="undefined"&&(r.rX=e(r.rX)),"rY"in r&&typeof r.rY!="undefined"&&(r.rY=e(r.rY)),r}}function ff(){return Wr((i,e,t)=>(i.relative&&(typeof i.x1!="undefined"&&(i.x1+=e),typeof i.y1!="undefined"&&(i.y1+=t),typeof i.x2!="undefined"&&(i.x2+=e),typeof i.y2!="undefined"&&(i.y2+=t),typeof i.x!="undefined"&&(i.x+=e),typeof i.y!="undefined"&&(i.y+=t),i.relative=!1),i))}function a2(){return Wr((i,e,t)=>(i.relative||(typeof i.x1!="undefined"&&(i.x1-=e),typeof i.y1!="undefined"&&(i.y1-=t),typeof i.x2!="undefined"&&(i.x2-=e),typeof i.y2!="undefined"&&(i.y2-=t),typeof i.x!="undefined"&&(i.x-=e),typeof i.y!="undefined"&&(i.y-=t),i.relative=!0),i))}function o2(i=!0,e=!0,t=!0,r=!0){return Wr((s,o,u,h,c)=>{if(isNaN(h)&&!(s.type&I.MOVE_TO))throw new Error("path must start with moveto");if(e&&s.type&I.HORIZ_LINE_TO&&(s.type=I.LINE_TO,s.y=s.relative?0:u),t&&s.type&I.VERT_LINE_TO&&(s.type=I.LINE_TO,s.x=s.relative?0:o),i&&s.type&I.CLOSE_PATH&&(s.type=I.LINE_TO,s.x=s.relative?h-o:h,s.y=s.relative?c-u:c),s.type&I.ARC&&(s.rX===0||s.rY===0)&&(s.type=I.LINE_TO,delete s.rX,delete s.rY,delete s.xRot,delete s.lArcFlag,delete s.sweepFlag),r&&s.type&I.QUAD_TO){const y=[o,u],p=s.relative?[o+s.x1,u+s.y1]:[s.x1,s.y1],A=s.relative?[o+s.x,u+s.y]:[s.x,s.y];rl(y,p,A)&&(s.type=I.LINE_TO,delete s.x1,delete s.y1)}if(r&&s.type&I.CURVE_TO){const y=[o,u],p=s.relative?[o+s.x1,u+s.y1]:[s.x1,s.y1],A=s.relative?[o+s.x2,u+s.y2]:[s.x2,s.y2],T=s.relative?[o+s.x,u+s.y]:[s.x,s.y];rl(y,p,T)&&rl(y,A,T)&&(s.type=I.LINE_TO,delete s.x1,delete s.y1,delete s.x2,delete s.y2)}return s})}function pf(){let i=NaN,e=NaN,t=NaN,r=NaN;return Wr((s,o,u)=>(s.type&I.SMOOTH_CURVE_TO&&(s.type=I.CURVE_TO,i=isNaN(i)?o:i,e=isNaN(e)?u:e,s.x1=s.relative?o-i:2*o-i,s.y1=s.relative?u-e:2*u-e),s.type&I.CURVE_TO?(i=s.relative?o+s.x2:s.x2,e=s.relative?u+s.y2:s.y2):(i=NaN,e=NaN),s.type&I.SMOOTH_QUAD_TO&&(s.type=I.QUAD_TO,t=isNaN(t)?o:t,r=isNaN(r)?u:r,s.x1=s.relative?o-t:2*o-t,s.y1=s.relative?u-r:2*u-r),s.type&I.QUAD_TO?(t=s.relative?o+s.x1:s.x1,r=s.relative?u+s.y1:s.y1):(t=NaN,r=NaN),s))}function df(){let i=NaN,e=NaN;return Wr((t,r,s)=>{if(t.type&I.SMOOTH_QUAD_TO&&(t.type=I.QUAD_TO,i=isNaN(i)?r:i,e=isNaN(e)?s:e,t.x1=t.relative?r-i:2*r-i,t.y1=t.relative?s-e:2*s-e),t.type&I.QUAD_TO){i=t.relative?r+t.x1:t.x1,e=t.relative?s+t.y1:t.y1;const o=t.x1,u=t.y1;t.type=I.CURVE_TO,t.x1=((t.relative?0:r)+o*2)/3,t.y1=((t.relative?0:s)+u*2)/3,t.x2=(t.x+o*2)/3,t.y2=(t.y+u*2)/3}else i=NaN,e=NaN;return t})}function Wr(i){let e=0,t=0,r=NaN,s=NaN;return function(u){if(isNaN(r)&&!(u.type&I.MOVE_TO))throw new Error("path must start with moveto");const h=i(u,e,t,r,s);return u.type&I.CLOSE_PATH&&(e=r,t=s),"x"in u&&typeof u.x!="undefined"&&(e=u.relative?e+u.x:u.x),"y"in u&&typeof u.y!="undefined"&&(t=u.relative?t+u.y:u.y),u.type&I.MOVE_TO&&(r=e,s=t),h}}function u2(i=0){Vr(i);let e=NaN,t=NaN,r=NaN,s=NaN;return Wr((o,u,h,c,y)=>{const p=Math.abs;let A=!1,T=0,C=0;if(o.type&I.SMOOTH_CURVE_TO&&(T=isNaN(e)?0:u-e,C=isNaN(t)?0:h-t),o.type&(I.CURVE_TO|I.SMOOTH_CURVE_TO)?(e=o.relative?u+o.x2:o.x2,t=o.relative?h+o.y2:o.y2):(e=NaN,t=NaN),o.type&I.SMOOTH_QUAD_TO?(r=isNaN(r)?u:2*u-r,s=isNaN(s)?h:2*h-s):o.type&I.QUAD_TO?(r=o.relative?u+o.x1:o.x1,s=o.relative?h+o.y1:o.y2):(r=NaN,s=NaN),o.type&I.LINE_COMMANDS||o.type&I.ARC&&(o.rX===0||o.rY===0||!o.lArcFlag)||o.type&I.CURVE_TO||o.type&I.SMOOTH_CURVE_TO||o.type&I.QUAD_TO||o.type&I.SMOOTH_QUAD_TO){const N=typeof o.x=="undefined"?0:o.relative?o.x:o.x-u,O=typeof o.y=="undefined"?0:o.relative?o.y:o.y-h;T=isNaN(r)?typeof o.x1=="undefined"?T:o.relative?o.x:o.x1-u:r-u,C=isNaN(s)?typeof o.y1=="undefined"?C:o.relative?o.y:o.y1-h:s-h;const L=typeof o.x2=="undefined"?0:o.relative?o.x:o.x2-u,P=typeof o.y2=="undefined"?0:o.relative?o.y:o.y2-h;p(N)<=i&&p(O)<=i&&p(T)<=i&&p(C)<=i&&p(L)<=i&&p(P)<=i&&(A=!0)}return o.type&I.CLOSE_PATH&&p(u-c)<=i&&p(h-y)<=i&&(A=!0),A?[]:o})}function Qi(i,e,t,r,s,o){return Vr(i,e,t,r,s,o),Wr((u,h,c,y)=>{const p=u.x1,A=u.x2,T=u.relative&&!isNaN(y),C=typeof u.x!="undefined"?u.x:T?0:h,N=typeof u.y!="undefined"?u.y:T?0:c;u.type&I.HORIZ_LINE_TO&&e!==0&&(u.type=I.LINE_TO,u.y=u.relative?0:c),u.type&I.VERT_LINE_TO&&t!==0&&(u.type=I.LINE_TO,u.x=u.relative?0:h),typeof u.x!="undefined"&&(u.x=u.x*i+N*t+(T?0:s)),typeof u.y!="undefined"&&(u.y=C*e+u.y*r+(T?0:o)),typeof u.x1!="undefined"&&(u.x1=u.x1*i+u.y1*t+(T?0:s)),typeof u.y1!="undefined"&&(u.y1=p*e+u.y1*r+(T?0:o)),typeof u.x2!="undefined"&&(u.x2=u.x2*i+u.y2*t+(T?0:s)),typeof u.y2!="undefined"&&(u.y2=A*e+u.y2*r+(T?0:o));function O(P){return P*P}const L=i*r-e*t;if(typeof u.xRot!="undefined"&&(i!==1||e!==0||t!==0||r!==1))if(L===0)delete u.rX,delete u.rY,delete u.xRot,delete u.lArcFlag,delete u.sweepFlag,u.type=I.LINE_TO;else{const P=u.xRot*Math.PI/180,W=Math.sin(P),V=Math.cos(P),b=1/O(u.rX),Y=1/O(u.rY),z=O(V)*b+O(W)*Y,j=2*W*V*(b-Y),tt=O(W)*b+O(V)*Y,Q=z*r*r-j*e*r+tt*e*e,K=j*(i*r+e*t)-2*(z*t*r+tt*i*e),rt=z*t*t-j*i*t+tt*i*i,at=(Math.atan2(K,Q-rt)+Math.PI)%Math.PI/2,ct=Math.sin(at),pt=Math.cos(at);u.rX=Math.abs(L)/Math.sqrt(Q*O(pt)+K*ct*pt+rt*O(ct)),u.rY=Math.abs(L)/Math.sqrt(Q*O(ct)-K*ct*pt+rt*O(pt)),u.xRot=at*180/Math.PI}return typeof u.sweepFlag!="undefined"&&0>L&&(u.sweepFlag=+!u.sweepFlag),u})}function l2(i,e=0,t=0){Vr(i,e,t);const r=Math.sin(i),s=Math.cos(i);return Qi(s,r,-r,s,e-e*s+t*r,t-e*r-t*s)}function h2(i,e=0){return Vr(i,e),Qi(1,0,0,1,i,e)}function c2(i,e=i){return Vr(i,e),Qi(i,0,0,e,0,0)}function f2(i){return Vr(i),Qi(1,0,Math.tan(i),1,0,0)}function p2(i){return Vr(i),Qi(1,Math.tan(i),0,1,0,0)}function d2(i=0){return Vr(i),Qi(-1,0,0,1,i,0)}function g2(i=0){return Vr(i),Qi(1,0,0,-1,0,i)}function y2(){return Wr((i,e,t)=>I.ARC===i.type?i2(i,i.relative?0:e,i.relative?0:t):i)}function m2(){return Wr((i,e,t)=>(i.relative&&(e=0,t=0),I.ARC===i.type&&el(i,e,t),i))}function gf(){return i=>Vs({},i)}function v2(){const i=gf(),e=ff(),t=df(),r=pf(),s=Wr((o,u,h)=>{const c=r(t(e(i(o))));function y(A){A>s.maxX&&(s.maxX=A),A<s.minX&&(s.minX=A)}function p(A){A>s.maxY&&(s.maxY=A),A<s.minY&&(s.minY=A)}if(c.type&I.DRAWING_COMMANDS&&(y(u),p(h)),c.type&I.HORIZ_LINE_TO&&y(c.x),c.type&I.VERT_LINE_TO&&p(c.y),c.type&I.LINE_TO&&(y(c.x),p(c.y)),c.type&I.CURVE_TO){y(c.x),p(c.y);const A=hf(u,c.x1,c.x2,c.x);for(const C of A)0<C&&1>C&&y(cf(u,c.x1,c.x2,c.x,C));const T=hf(h,c.y1,c.y2,c.y);for(const C of T)0<C&&1>C&&p(cf(h,c.y1,c.y2,c.y,C))}if(c.type&I.ARC){y(c.x),p(c.y),el(c,u,h);const A=c.xRot/180*Math.PI,T=Math.cos(A)*c.rX,C=Math.sin(A)*c.rX,N=-Math.sin(A)*c.rY,O=Math.cos(A)*c.rY,[L,P]=c.phi1<c.phi2?[c.phi1,c.phi2]:-180>c.phi2?[c.phi2+360,c.phi1+360]:[c.phi2,c.phi1],W=([Y,z])=>{const tt=Math.atan2(z,Y)*180/Math.PI;return tt<L?tt+360:tt},V=of(N,-T,0).map(W);for(const Y of V)Y>L&&Y<P&&y(lf(c.cX,T,N,Y));const b=of(O,-C,0).map(W);for(const Y of b)Y>L&&Y<P&&p(lf(c.cY,C,O,Y))}return o});return s.minX=1/0,s.maxX=-1/0,s.minY=1/0,s.maxY=-1/0,s}const pe={ROUND:s2,TO_ABS:ff,TO_REL:a2,NORMALIZE_HVZ:o2,NORMALIZE_ST:pf,QT_TO_C:df,INFO:Wr,SANITIZE:u2,MATRIX:Qi,ROTATE:l2,TRANSLATE:h2,SCALE:c2,SKEW_X:f2,SKEW_Y:p2,X_AXIS_SYMMETRY:d2,Y_AXIS_SYMMETRY:g2,A_TO_C:y2,ANNOTATE_ARCS:m2,CLONE:gf,CALCULATE_BOUNDS:v2,REVERSE_PATH:n2};let yf=class{round(e){return this.transform(pe.ROUND(e))}toAbs(){return this.transform(pe.TO_ABS())}toRel(){return this.transform(pe.TO_REL())}normalizeHVZ(e,t,r){return this.transform(pe.NORMALIZE_HVZ(e,t,r))}normalizeST(){return this.transform(pe.NORMALIZE_ST())}qtToC(){return this.transform(pe.QT_TO_C())}aToC(){return this.transform(pe.A_TO_C())}sanitize(e){return this.transform(pe.SANITIZE(e))}translate(e,t){return this.transform(pe.TRANSLATE(e,t))}scale(e,t){return this.transform(pe.SCALE(e,t))}rotate(e,t,r){return this.transform(pe.ROTATE(e,t,r))}matrix(e,t,r,s,o,u){return this.transform(pe.MATRIX(e,t,r,s,o,u))}skewX(e){return this.transform(pe.SKEW_X(e))}skewY(e){return this.transform(pe.SKEW_Y(e))}xSymmetry(e){return this.transform(pe.X_AXIS_SYMMETRY(e))}ySymmetry(e){return this.transform(pe.Y_AXIS_SYMMETRY(e))}annotateArcs(){return this.transform(pe.ANNOTATE_ARCS())}};const x2=i=>i===" "||i===" "||i==="\r"||i===`
33
33
  `,mf=i=>48<=i.charCodeAt(0)&&i.charCodeAt(0)<=57;let E2=class extends yf{constructor(){super();d(this,"curNumber","");d(this,"curCommandType",-1);d(this,"curCommandRelative",!1);d(this,"canParseCommandOrComma",!0);d(this,"curNumberHasExp",!1);d(this,"curNumberHasExpDigits",!1);d(this,"curNumberHasDecimal",!1);d(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,r=[]){const s=o=>{r.push(o),this.curArgs.length=0,this.canParseCommandOrComma=!0};for(let o=0;o<t.length;o++){const u=t[o],h=this.curCommandType===I.ARC&&(this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber.length===1&&(this.curNumber==="0"||this.curNumber==="1"),c=mf(u)&&(this.curNumber==="0"&&u==="0"||h);if(mf(u)&&!c){this.curNumber+=u,this.curNumberHasExpDigits=this.curNumberHasExp;continue}if(u==="e"||u==="E"){this.curNumber+=u,this.curNumberHasExp=!0;continue}if((u==="-"||u==="+")&&this.curNumberHasExp&&!this.curNumberHasExpDigits){this.curNumber+=u;continue}if(u==="."&&!this.curNumberHasExp&&!this.curNumberHasDecimal&&!h){this.curNumber+=u,this.curNumberHasDecimal=!0;continue}if(this.curNumber&&this.curCommandType!==-1){const y=Number(this.curNumber);if(isNaN(y))throw new SyntaxError(`Invalid number ending at ${o}`);if(this.curCommandType===I.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>y)throw new SyntaxError(`Expected positive number, got "${y}" at index "${o}"`)}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 "${o}"`)}this.curArgs.push(y),this.curArgs.length===A2[this.curCommandType]&&(I.HORIZ_LINE_TO===this.curCommandType?s({type:I.HORIZ_LINE_TO,relative:this.curCommandRelative,x:y}):I.VERT_LINE_TO===this.curCommandType?s({type:I.VERT_LINE_TO,relative:this.curCommandRelative,y}):this.curCommandType===I.MOVE_TO||this.curCommandType===I.LINE_TO||this.curCommandType===I.SMOOTH_QUAD_TO?(s({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),I.MOVE_TO===this.curCommandType&&(this.curCommandType=I.LINE_TO)):this.curCommandType===I.CURVE_TO?s({type:I.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===I.SMOOTH_CURVE_TO?s({type:I.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===I.QUAD_TO?s({type:I.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===I.ARC&&s({type:I.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(!x2(u)){if(u===","&&this.canParseCommandOrComma){this.canParseCommandOrComma=!1;continue}if(u==="+"||u==="-"||u==="."){this.curNumber=u,this.curNumberHasDecimal=u===".";continue}if(c){this.curNumber=u,this.curNumberHasDecimal=!1;continue}if(this.curArgs.length!==0)throw new SyntaxError(`Unterminated command at index ${o}.`);if(!this.canParseCommandOrComma)throw new SyntaxError(`Unexpected character "${u}" at index ${o}. Command cannot follow comma`);if(this.canParseCommandOrComma=!1,u==="z"||u==="Z"){r.push({type:I.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1;continue}else if(u==="h"||u==="H")this.curCommandType=I.HORIZ_LINE_TO,this.curCommandRelative=u==="h";else if(u==="v"||u==="V")this.curCommandType=I.VERT_LINE_TO,this.curCommandRelative=u==="v";else if(u==="m"||u==="M")this.curCommandType=I.MOVE_TO,this.curCommandRelative=u==="m";else if(u==="l"||u==="L")this.curCommandType=I.LINE_TO,this.curCommandRelative=u==="l";else if(u==="c"||u==="C")this.curCommandType=I.CURVE_TO,this.curCommandRelative=u==="c";else if(u==="s"||u==="S")this.curCommandType=I.SMOOTH_CURVE_TO,this.curCommandRelative=u==="s";else if(u==="q"||u==="Q")this.curCommandType=I.QUAD_TO,this.curCommandRelative=u==="q";else if(u==="t"||u==="T")this.curCommandType=I.SMOOTH_QUAD_TO,this.curCommandRelative=u==="t";else if(u==="a"||u==="A")this.curCommandType=I.ARC,this.curCommandRelative=u==="a";else throw new SyntaxError(`Unexpected character "${u}" at index ${o}.`)}}return r}transform(t){return Object.create(this,{parse:{value(s,o=[]){const u=Object.getPrototypeOf(this).parse.call(this,s);for(const h of u){const c=t(h);Array.isArray(c)?o.push(...c):o.push(c)}return o}}})}},I=(Ft=class extends yf{constructor(t){super();d(this,"commands");typeof t=="string"?this.commands=Ft.parse(t):this.commands=t}encode(){return Ft.encode(this.commands)}getBounds(){const t=pe.CALCULATE_BOUNDS();return this.transform(t),t}transform(t){const r=[];for(const s of this.commands){const o=t(s);Array.isArray(o)?r.push(...o):r.push(o)}return this.commands=r,this}reverse(t=!0){return this.commands=pe.REVERSE_PATH(this.commands,t),this}static encode(t){return e2(t)}static parse(t){const r=new E2,s=[];return r.parse(t,s),r.finish(s),s}},d(Ft,"CLOSE_PATH",1),d(Ft,"MOVE_TO",2),d(Ft,"HORIZ_LINE_TO",4),d(Ft,"VERT_LINE_TO",8),d(Ft,"LINE_TO",16),d(Ft,"CURVE_TO",32),d(Ft,"SMOOTH_CURVE_TO",64),d(Ft,"QUAD_TO",128),d(Ft,"SMOOTH_QUAD_TO",256),d(Ft,"ARC",512),d(Ft,"LINE_COMMANDS",Ft.LINE_TO|Ft.HORIZ_LINE_TO|Ft.VERT_LINE_TO),d(Ft,"DRAWING_COMMANDS",Ft.HORIZ_LINE_TO|Ft.VERT_LINE_TO|Ft.LINE_TO|Ft.CURVE_TO|Ft.SMOOTH_CURVE_TO|Ft.QUAD_TO|Ft.SMOOTH_QUAD_TO|Ft.ARC),Ft);const A2={[I.MOVE_TO]:2,[I.LINE_TO]:2,[I.HORIZ_LINE_TO]:1,[I.VERT_LINE_TO]:1,[I.CLOSE_PATH]:0,[I.QUAD_TO]:4,[I.SMOOTH_QUAD_TO]:2,[I.CURVE_TO]:6,[I.SMOOTH_CURVE_TO]:4,[I.ARC]:7},de=" ";function b2(i){let e="";Array.isArray(i)||(i=[i]);for(let t=0;t<i.length;t++){const r=i[t];if(r.type===q.CLOSE_PATH)e+="z";else if(r.type===q.HORIZ_LINE_TO)e+=(r.relative?"h":"H")+r.x;else if(r.type===q.VERT_LINE_TO)e+=(r.relative?"v":"V")+r.y;else if(r.type===q.MOVE_TO)e+=(r.relative?"m":"M")+r.x+de+r.y;else if(r.type===q.LINE_TO)e+=(r.relative?"l":"L")+r.x+de+r.y;else if(r.type===q.CURVE_TO)e+=(r.relative?"c":"C")+r.x1+de+r.y1+de+r.x2+de+r.y2+de+r.x+de+r.y;else if(r.type===q.SMOOTH_CURVE_TO)e+=(r.relative?"s":"S")+r.x2+de+r.y2+de+r.x+de+r.y;else if(r.type===q.QUAD_TO)e+=(r.relative?"q":"Q")+r.x1+de+r.y1+de+r.x+de+r.y;else if(r.type===q.SMOOTH_QUAD_TO)e+=(r.relative?"t":"T")+r.x+de+r.y;else if(r.type===q.ARC)e+=(r.relative?"a":"A")+r.rX+de+r.rY+de+r.xRot+de+ +r.lArcFlag+de+ +r.sweepFlag+de+r.x+de+r.y;else throw new Error(`Unexpected command type "${r==null?void 0:r.type}" at index ${t}.`)}return e}class vf{round(e){return this.transform(ae.ROUND(e))}toAbs(){return this.transform(ae.TO_ABS())}toRel(){return this.transform(ae.TO_REL())}normalizeHVZ(e,t,r){return this.transform(ae.NORMALIZE_HVZ(e,t,r))}normalizeST(){return this.transform(ae.NORMALIZE_ST())}qtToC(){return this.transform(ae.QT_TO_C())}aToC(){return this.transform(ae.A_TO_C())}sanitize(e){return this.transform(ae.SANITIZE(e))}translate(e,t){return this.transform(ae.TRANSLATE(e,t))}scale(e,t){return this.transform(ae.SCALE(e,t))}rotate(e,t,r){return this.transform(ae.ROTATE(e,t,r))}matrix(e,t,r,s,o,u){return this.transform(ae.MATRIX(e,t,r,s,o,u))}skewX(e){return this.transform(ae.SKEW_X(e))}skewY(e){return this.transform(ae.SKEW_Y(e))}xSymmetry(e){return this.transform(ae.X_AXIS_SYMMETRY(e))}ySymmetry(e){return this.transform(ae.Y_AXIS_SYMMETRY(e))}annotateArcs(){return this.transform(ae.ANNOTATE_ARCS())}}const w2=i=>i===" "||i===" "||i==="\r"||i===`
34
- `,xf=i=>48<=i.charCodeAt(0)&&i.charCodeAt(0)<=57;class T2 extends vf{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(e=[]){if(this.parse(" ",e),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return e}parse(e,t=[]){const r=s=>{t.push(s),this.curArgs.length=0,this.canParseCommandOrComma=!0};for(let s=0;s<e.length;s++){const o=e[s],u=this.curCommandType===q.ARC&&(this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber.length===1&&(this.curNumber==="0"||this.curNumber==="1"),h=xf(o)&&(this.curNumber==="0"&&o==="0"||u);if(xf(o)&&!h){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&&!u){this.curNumber+=o,this.curNumberHasDecimal=!0;continue}if(this.curNumber&&this.curCommandType!==-1){const c=Number(this.curNumber);if(isNaN(c))throw new SyntaxError(`Invalid number ending at ${s}`);if(this.curCommandType===q.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>c)throw new SyntaxError(`Expected positive number, got "${c}" at index "${s}"`)}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 "${s}"`)}this.curArgs.push(c),this.curArgs.length===_2[this.curCommandType]&&(q.HORIZ_LINE_TO===this.curCommandType?r({type:q.HORIZ_LINE_TO,relative:this.curCommandRelative,x:c}):q.VERT_LINE_TO===this.curCommandType?r({type:q.VERT_LINE_TO,relative:this.curCommandRelative,y:c}):this.curCommandType===q.MOVE_TO||this.curCommandType===q.LINE_TO||this.curCommandType===q.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),q.MOVE_TO===this.curCommandType&&(this.curCommandType=q.LINE_TO)):this.curCommandType===q.CURVE_TO?r({type:q.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===q.SMOOTH_CURVE_TO?r({type:q.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===q.QUAD_TO?r({type:q.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===q.ARC&&r({type:q.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(!w2(o)){if(o===","&&this.canParseCommandOrComma){this.canParseCommandOrComma=!1;continue}if(o==="+"||o==="-"||o==="."){this.curNumber=o,this.curNumberHasDecimal=o===".";continue}if(h){this.curNumber=o,this.curNumberHasDecimal=!1;continue}if(this.curArgs.length!==0)throw new SyntaxError(`Unterminated command at index ${s}.`);if(!this.canParseCommandOrComma)throw new SyntaxError(`Unexpected character "${o}" at index ${s}. Command cannot follow comma`);if(this.canParseCommandOrComma=!1,o==="z"||o==="Z"){t.push({type:q.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1;continue}else if(o==="h"||o==="H")this.curCommandType=q.HORIZ_LINE_TO,this.curCommandRelative=o==="h";else if(o==="v"||o==="V")this.curCommandType=q.VERT_LINE_TO,this.curCommandRelative=o==="v";else if(o==="m"||o==="M")this.curCommandType=q.MOVE_TO,this.curCommandRelative=o==="m";else if(o==="l"||o==="L")this.curCommandType=q.LINE_TO,this.curCommandRelative=o==="l";else if(o==="c"||o==="C")this.curCommandType=q.CURVE_TO,this.curCommandRelative=o==="c";else if(o==="s"||o==="S")this.curCommandType=q.SMOOTH_CURVE_TO,this.curCommandRelative=o==="s";else if(o==="q"||o==="Q")this.curCommandType=q.QUAD_TO,this.curCommandRelative=o==="q";else if(o==="t"||o==="T")this.curCommandType=q.SMOOTH_QUAD_TO,this.curCommandRelative=o==="t";else if(o==="a"||o==="A")this.curCommandType=q.ARC,this.curCommandRelative=o==="a";else throw new SyntaxError(`Unexpected character "${o}" at index ${s}.`)}}return t}transform(e){return Object.create(this,{parse:{value(r,s=[]){const o=Object.getPrototypeOf(this).parse.call(this,r);for(const u of o){const h=e(u);Array.isArray(h)?s.push(...h):s.push(h)}return s}}})}}const Wt=class Wt extends vf{constructor(e){super(),typeof e=="string"?this.commands=Wt.parse(e):this.commands=e}encode(){return Wt.encode(this.commands)}getBounds(){const e=ae.CALCULATE_BOUNDS();return this.transform(e),e}transform(e){const t=[];for(const r of this.commands){const s=e(r);Array.isArray(s)?t.push(...s):t.push(s)}return this.commands=t,this}reverse(e=!0){return this.commands=ae.REVERSE_PATH(this.commands,e),this}static encode(e){return b2(e)}static parse(e){const t=new T2,r=[];return t.parse(e,r),t.finish(r),r}};Wt.CLOSE_PATH=1,Wt.MOVE_TO=2,Wt.HORIZ_LINE_TO=4,Wt.VERT_LINE_TO=8,Wt.LINE_TO=16,Wt.CURVE_TO=32,Wt.SMOOTH_CURVE_TO=64,Wt.QUAD_TO=128,Wt.SMOOTH_QUAD_TO=256,Wt.ARC=512,Wt.LINE_COMMANDS=Wt.LINE_TO|Wt.HORIZ_LINE_TO|Wt.VERT_LINE_TO,Wt.DRAWING_COMMANDS=Wt.HORIZ_LINE_TO|Wt.VERT_LINE_TO|Wt.LINE_TO|Wt.CURVE_TO|Wt.SMOOTH_CURVE_TO|Wt.QUAD_TO|Wt.SMOOTH_QUAD_TO|Wt.ARC;let q=Wt;const _2={[q.MOVE_TO]:2,[q.LINE_TO]:2,[q.HORIZ_LINE_TO]:1,[q.VERT_LINE_TO]:1,[q.CLOSE_PATH]:0,[q.QUAD_TO]:4,[q.SMOOTH_QUAD_TO]:2,[q.CURVE_TO]:6,[q.SMOOTH_CURVE_TO]:4,[q.ARC]:7};function il([i,e],t){return[i*Math.cos(t)-e*Math.sin(t),i*Math.sin(t)+e*Math.cos(t)]}function zr(...i){for(let e=0;e<i.length;e++)if(typeof i[e]!="number")throw new Error(`assertNumbers arguments[${e}] is not a number. ${typeof i[e]} == typeof ${i[e]}`);return!0}const Ki=Math.PI;function nl(i,e,t){i.lArcFlag=i.lArcFlag===0?0:1,i.sweepFlag=i.sweepFlag===0?0:1;let{rX:r,rY:s}=i;const{x:o,y:u}=i;if(Math.abs(r)<1e-10||Math.abs(s)<1e-10){i.rX=0,i.rY=0,i.cX=(e+o)/2,i.cY=(t+u)/2,i.phi1=0,i.phi2=0;return}r=Math.abs(i.rX),s=Math.abs(i.rY);const h=i.xRot/180*Ki,[c,y]=il([(e-o)/2,(t-u)/2],-h),p=Math.pow(c,2)/Math.pow(r,2)+Math.pow(y,2)/Math.pow(s,2);1<p&&(r*=Math.sqrt(p),s*=Math.sqrt(p)),i.rX=r,i.rY=s;const A=Math.pow(r,2)*Math.pow(y,2)+Math.pow(s,2)*Math.pow(c,2),T=(i.lArcFlag!==i.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(s,2)-A)/A)),C=r*y/s*T,N=-s*c/r*T,O=il([C,N],h);i.cX=O[0]+(e+o)/2,i.cY=O[1]+(t+u)/2,i.phi1=Math.atan2((y-N)/s,(c-C)/r),i.phi2=Math.atan2((-y-N)/s,(-c-C)/r),i.sweepFlag===0&&i.phi2>i.phi1&&(i.phi2-=2*Ki),i.sweepFlag===1&&i.phi2<i.phi1&&(i.phi2+=2*Ki),i.phi1*=180/Ki,i.phi2*=180/Ki}function Ef(i,e,t){zr(i,e,t);const r=i*i+e*e-t*t;if(0>r)return[];if(r===0)return[[i*t/(i*i+e*e),e*t/(i*i+e*e)]];const s=Math.sqrt(r);return[[(i*t+e*s)/(i*i+e*e),(e*t-i*s)/(i*i+e*e)],[(i*t-e*s)/(i*i+e*e),(e*t+i*s)/(i*i+e*e)]]}const Sn=Math.PI/180;function Af(i,e,t){return(1-t)*i+t*e}function bf(i,e,t,r){return i+Math.cos(r/180*Ki)*e+Math.sin(r/180*Ki)*t}function wf(i,e,t,r){const o=e-i,u=t-e,h=r-t,c=3*o+3*h-6*u,y=(u-o)*6,p=3*o;return Math.abs(c)<1e-6?Math.abs(y)<1e-6?[]:[-p/y]:C2(y/c,p/c,1e-6)}function Tf(i,e,t,r,s){const o=1-s,u=o*o*o,h=3*o*o*s,c=3*o*s*s,y=s*s*s;return i*u+e*h+t*c+r*y}function C2(i,e,t=1e-6){const r=i*i/4-e;if(r<-t)return[];if(r<=t)return[-i/2];const s=Math.sqrt(r);return[-(i/2)-s,-(i/2)+s]}function D2(i,e,t){i.cX||nl(i,e,t);const r=i.xRot/180*Ki;if(Math.abs(i.rX)<1e-10||Math.abs(i.rY)<1e-10)return[{relative:i.relative,type:q.CURVE_TO,x1:e+(i.x-e)/3,y1:t+(i.y-t)/3,x2:e+2*(i.x-e)/3,y2:t+2*(i.y-t)/3,x:i.x,y:i.y}];const s=Math.min(i.phi1,i.phi2),o=Math.max(i.phi1,i.phi2),u=o-s,h=Math.ceil(u/90),c=new Array(h);let y=e,p=t;const A=(T,C)=>{const[N,O]=il([T*i.rX,C*i.rY],r);return[i.cX+N,i.cY+O]};for(let T=0;T<h;T++){const C=Af(i.phi1,i.phi2,T/h),N=Af(i.phi1,i.phi2,(T+1)/h),O=N-C,L=4/3*Math.tan(O*Sn/4),P=Math.cos(C*Sn)-L*Math.sin(C*Sn),W=Math.sin(C*Sn)+L*Math.cos(C*Sn),V=Math.cos(N*Sn),b=Math.sin(N*Sn),Y=V+L*b,z=b-L*V,j=A(P,W),tt=A(Y,z),Q=A(V,b),K={relative:i.relative,type:q.CURVE_TO,x:Q[0],y:Q[1],x1:j[0],y1:j[1],x2:tt[0],y2:tt[1]};i.relative&&(K.x1-=y,K.y1-=p,K.x2-=y,K.y2-=p,K.x-=y,K.y-=p),y=Q[0],p=Q[1],c[T]=K}return c}function sl(i,e,t){const r=e[0]-i[0],s=e[1]-i[1],o=t[0]-i[0],u=t[1]-i[1],h=r*u-s*o;if(!(Math.abs(h)<1e-10))return!1;const y=r*o+s*u,p=r*r+s*s,A=o*o+u*u;return 0<=y&&y<=A&&p<=A}function S2(i,e=!0){if(i.length<2)return i;const t=ae.INFO((o,u,h)=>{var c,y,p;return Ou(Vs({},o),{x:(c=o.x)!=null?c:u,y:(y=o.y)!=null?y:h,relative:(p=o.relative)!=null?p:!1})}),r=[];let s=[];for(const o of i){const u=t(o);u.type===q.MOVE_TO&&s.length>0&&(e?r.push(...vo(s)):r.unshift(...vo(s)),s=[]),s.push(u)}return s.length>0&&(e?r.push(...vo(s)):r.unshift(...vo(s))),r}function vo(i){var s;const e=((s=i[i.length-1])==null?void 0:s.type)===q.CLOSE_PATH,t=e?i.length-2:i.length-1,r=[{type:q.MOVE_TO,relative:!1,x:i[t].x,y:i[t].y}];for(let o=t;o>0;o--){const u=i[o],h=i[o-1];if(u.relative)throw new Error("Relative command are not supported convert first with `toAbs()`");switch(u.type){case q.HORIZ_LINE_TO:r.push({type:q.HORIZ_LINE_TO,relative:!1,x:h.x});break;case q.VERT_LINE_TO:r.push({type:q.VERT_LINE_TO,relative:!1,y:h.y});break;case q.LINE_TO:case q.MOVE_TO:r.push({type:q.LINE_TO,relative:!1,x:h.x,y:h.y});break;case q.CURVE_TO:r.push({type:q.CURVE_TO,relative:!1,x:h.x,y:h.y,x1:u.x2,y1:u.y2,x2:u.x1,y2:u.y1});break;case q.SMOOTH_CURVE_TO:throw new Error("Unsupported command: S (smooth cubic bezier)");case q.SMOOTH_QUAD_TO:throw new Error("Unsupported command: T (smooth quadratic bezier)");case q.ARC:throw new Error("Unsupported command: A (arc)");case q.QUAD_TO:throw new Error("Unsupported command: Q (quadratic bezier)")}}return e&&r.push({type:q.CLOSE_PATH}),r}function O2(i=1e13){zr(i);function e(t){return Math.round(t*i)/i}return function(r){return"x1"in r&&typeof r.x1!="undefined"&&(r.x1=e(r.x1)),"y1"in r&&typeof r.y1!="undefined"&&(r.y1=e(r.y1)),"x2"in r&&typeof r.x2!="undefined"&&(r.x2=e(r.x2)),"y2"in r&&typeof r.y2!="undefined"&&(r.y2=e(r.y2)),"x"in r&&typeof r.x!="undefined"&&(r.x=e(r.x)),"y"in r&&typeof r.y!="undefined"&&(r.y=e(r.y)),"rX"in r&&typeof r.rX!="undefined"&&(r.rX=e(r.rX)),"rY"in r&&typeof r.rY!="undefined"&&(r.rY=e(r.rY)),r}}function _f(){return $r((i,e,t)=>(i.relative&&(typeof i.x1!="undefined"&&(i.x1+=e),typeof i.y1!="undefined"&&(i.y1+=t),typeof i.x2!="undefined"&&(i.x2+=e),typeof i.y2!="undefined"&&(i.y2+=t),typeof i.x!="undefined"&&(i.x+=e),typeof i.y!="undefined"&&(i.y+=t),i.relative=!1),i))}function M2(){return $r((i,e,t)=>(i.relative||(typeof i.x1!="undefined"&&(i.x1-=e),typeof i.y1!="undefined"&&(i.y1-=t),typeof i.x2!="undefined"&&(i.x2-=e),typeof i.y2!="undefined"&&(i.y2-=t),typeof i.x!="undefined"&&(i.x-=e),typeof i.y!="undefined"&&(i.y-=t),i.relative=!0),i))}function L2(i=!0,e=!0,t=!0,r=!0){return $r((s,o,u,h,c)=>{if(isNaN(h)&&!(s.type&q.MOVE_TO))throw new Error("path must start with moveto");if(e&&s.type&q.HORIZ_LINE_TO&&(s.type=q.LINE_TO,s.y=s.relative?0:u),t&&s.type&q.VERT_LINE_TO&&(s.type=q.LINE_TO,s.x=s.relative?0:o),i&&s.type&q.CLOSE_PATH&&(s.type=q.LINE_TO,s.x=s.relative?h-o:h,s.y=s.relative?c-u:c),s.type&q.ARC&&(s.rX===0||s.rY===0)&&(s.type=q.LINE_TO,delete s.rX,delete s.rY,delete s.xRot,delete s.lArcFlag,delete s.sweepFlag),r&&s.type&q.QUAD_TO){const y=[o,u],p=s.relative?[o+s.x1,u+s.y1]:[s.x1,s.y1],A=s.relative?[o+s.x,u+s.y]:[s.x,s.y];sl(y,p,A)&&(s.type=q.LINE_TO,delete s.x1,delete s.y1)}if(r&&s.type&q.CURVE_TO){const y=[o,u],p=s.relative?[o+s.x1,u+s.y1]:[s.x1,s.y1],A=s.relative?[o+s.x2,u+s.y2]:[s.x2,s.y2],T=s.relative?[o+s.x,u+s.y]:[s.x,s.y];sl(y,p,T)&&sl(y,A,T)&&(s.type=q.LINE_TO,delete s.x1,delete s.y1,delete s.x2,delete s.y2)}return s})}function Cf(){let i=NaN,e=NaN,t=NaN,r=NaN;return $r((s,o,u)=>(s.type&q.SMOOTH_CURVE_TO&&(s.type=q.CURVE_TO,i=isNaN(i)?o:i,e=isNaN(e)?u:e,s.x1=s.relative?o-i:2*o-i,s.y1=s.relative?u-e:2*u-e),s.type&q.CURVE_TO?(i=s.relative?o+s.x2:s.x2,e=s.relative?u+s.y2:s.y2):(i=NaN,e=NaN),s.type&q.SMOOTH_QUAD_TO&&(s.type=q.QUAD_TO,t=isNaN(t)?o:t,r=isNaN(r)?u:r,s.x1=s.relative?o-t:2*o-t,s.y1=s.relative?u-r:2*u-r),s.type&q.QUAD_TO?(t=s.relative?o+s.x1:s.x1,r=s.relative?u+s.y1:s.y1):(t=NaN,r=NaN),s))}function Df(){let i=NaN,e=NaN;return $r((t,r,s)=>{if(t.type&q.SMOOTH_QUAD_TO&&(t.type=q.QUAD_TO,i=isNaN(i)?r:i,e=isNaN(e)?s:e,t.x1=t.relative?r-i:2*r-i,t.y1=t.relative?s-e:2*s-e),t.type&q.QUAD_TO){i=t.relative?r+t.x1:t.x1,e=t.relative?s+t.y1:t.y1;const o=t.x1,u=t.y1;t.type=q.CURVE_TO,t.x1=((t.relative?0:r)+o*2)/3,t.y1=((t.relative?0:s)+u*2)/3,t.x2=(t.x+o*2)/3,t.y2=(t.y+u*2)/3}else i=NaN,e=NaN;return t})}function $r(i){let e=0,t=0,r=NaN,s=NaN;return function(u){if(isNaN(r)&&!(u.type&q.MOVE_TO))throw new Error("path must start with moveto");const h=i(u,e,t,r,s);return u.type&q.CLOSE_PATH&&(e=r,t=s),"x"in u&&typeof u.x!="undefined"&&(e=u.relative?e+u.x:u.x),"y"in u&&typeof u.y!="undefined"&&(t=u.relative?t+u.y:u.y),u.type&q.MOVE_TO&&(r=e,s=t),h}}function N2(i=0){zr(i);let e=NaN,t=NaN,r=NaN,s=NaN;return $r((o,u,h,c,y)=>{const p=Math.abs;let A=!1,T=0,C=0;if(o.type&q.SMOOTH_CURVE_TO&&(T=isNaN(e)?0:u-e,C=isNaN(t)?0:h-t),o.type&(q.CURVE_TO|q.SMOOTH_CURVE_TO)?(e=o.relative?u+o.x2:o.x2,t=o.relative?h+o.y2:o.y2):(e=NaN,t=NaN),o.type&q.SMOOTH_QUAD_TO?(r=isNaN(r)?u:2*u-r,s=isNaN(s)?h:2*h-s):o.type&q.QUAD_TO?(r=o.relative?u+o.x1:o.x1,s=o.relative?h+o.y1:o.y2):(r=NaN,s=NaN),o.type&q.LINE_COMMANDS||o.type&q.ARC&&(o.rX===0||o.rY===0||!o.lArcFlag)||o.type&q.CURVE_TO||o.type&q.SMOOTH_CURVE_TO||o.type&q.QUAD_TO||o.type&q.SMOOTH_QUAD_TO){const N=typeof o.x=="undefined"?0:o.relative?o.x:o.x-u,O=typeof o.y=="undefined"?0:o.relative?o.y:o.y-h;T=isNaN(r)?typeof o.x1=="undefined"?T:o.relative?o.x:o.x1-u:r-u,C=isNaN(s)?typeof o.y1=="undefined"?C:o.relative?o.y:o.y1-h:s-h;const L=typeof o.x2=="undefined"?0:o.relative?o.x:o.x2-u,P=typeof o.y2=="undefined"?0:o.relative?o.y:o.y2-h;p(N)<=i&&p(O)<=i&&p(T)<=i&&p(C)<=i&&p(L)<=i&&p(P)<=i&&(A=!0)}return o.type&q.CLOSE_PATH&&p(u-c)<=i&&p(h-y)<=i&&(A=!0),A?[]:o})}function ji(i,e,t,r,s,o){return zr(i,e,t,r,s,o),$r((u,h,c,y)=>{const p=u.x1,A=u.x2,T=u.relative&&!isNaN(y),C=typeof u.x!="undefined"?u.x:T?0:h,N=typeof u.y!="undefined"?u.y:T?0:c;u.type&q.HORIZ_LINE_TO&&e!==0&&(u.type=q.LINE_TO,u.y=u.relative?0:c),u.type&q.VERT_LINE_TO&&t!==0&&(u.type=q.LINE_TO,u.x=u.relative?0:h),typeof u.x!="undefined"&&(u.x=u.x*i+N*t+(T?0:s)),typeof u.y!="undefined"&&(u.y=C*e+u.y*r+(T?0:o)),typeof u.x1!="undefined"&&(u.x1=u.x1*i+u.y1*t+(T?0:s)),typeof u.y1!="undefined"&&(u.y1=p*e+u.y1*r+(T?0:o)),typeof u.x2!="undefined"&&(u.x2=u.x2*i+u.y2*t+(T?0:s)),typeof u.y2!="undefined"&&(u.y2=A*e+u.y2*r+(T?0:o));function O(P){return P*P}const L=i*r-e*t;if(typeof u.xRot!="undefined"&&(i!==1||e!==0||t!==0||r!==1))if(L===0)delete u.rX,delete u.rY,delete u.xRot,delete u.lArcFlag,delete u.sweepFlag,u.type=q.LINE_TO;else{const P=u.xRot*Math.PI/180,W=Math.sin(P),V=Math.cos(P),b=1/O(u.rX),Y=1/O(u.rY),z=O(V)*b+O(W)*Y,j=2*W*V*(b-Y),tt=O(W)*b+O(V)*Y,Q=z*r*r-j*e*r+tt*e*e,K=j*(i*r+e*t)-2*(z*t*r+tt*i*e),rt=z*t*t-j*i*t+tt*i*i,at=(Math.atan2(K,Q-rt)+Math.PI)%Math.PI/2,ct=Math.sin(at),pt=Math.cos(at);u.rX=Math.abs(L)/Math.sqrt(Q*O(pt)+K*ct*pt+rt*O(ct)),u.rY=Math.abs(L)/Math.sqrt(Q*O(ct)-K*ct*pt+rt*O(pt)),u.xRot=at*180/Math.PI}return typeof u.sweepFlag!="undefined"&&0>L&&(u.sweepFlag=+!u.sweepFlag),u})}function B2(i,e=0,t=0){zr(i,e,t);const r=Math.sin(i),s=Math.cos(i);return ji(s,r,-r,s,e-e*s+t*r,t-e*r-t*s)}function I2(i,e=0){return zr(i,e),ji(1,0,0,1,i,e)}function R2(i,e=i){return zr(i,e),ji(i,0,0,e,0,0)}function P2(i){return zr(i),ji(1,0,Math.tan(i),1,0,0)}function F2(i){return zr(i),ji(1,Math.tan(i),0,1,0,0)}function k2(i=0){return zr(i),ji(-1,0,0,1,i,0)}function H2(i=0){return zr(i),ji(1,0,0,-1,0,i)}function U2(){return $r((i,e,t)=>q.ARC===i.type?D2(i,i.relative?0:e,i.relative?0:t):i)}function q2(){return $r((i,e,t)=>(i.relative&&(e=0,t=0),q.ARC===i.type&&nl(i,e,t),i))}function Sf(){return i=>Vs({},i)}function V2(){const i=Sf(),e=_f(),t=Df(),r=Cf(),s=$r((o,u,h)=>{const c=r(t(e(i(o))));function y(A){A>s.maxX&&(s.maxX=A),A<s.minX&&(s.minX=A)}function p(A){A>s.maxY&&(s.maxY=A),A<s.minY&&(s.minY=A)}if(c.type&q.DRAWING_COMMANDS&&(y(u),p(h)),c.type&q.HORIZ_LINE_TO&&y(c.x),c.type&q.VERT_LINE_TO&&p(c.y),c.type&q.LINE_TO&&(y(c.x),p(c.y)),c.type&q.CURVE_TO){y(c.x),p(c.y);const A=wf(u,c.x1,c.x2,c.x);for(const C of A)0<C&&1>C&&y(Tf(u,c.x1,c.x2,c.x,C));const T=wf(h,c.y1,c.y2,c.y);for(const C of T)0<C&&1>C&&p(Tf(h,c.y1,c.y2,c.y,C))}if(c.type&q.ARC){y(c.x),p(c.y),nl(c,u,h);const A=c.xRot/180*Math.PI,T=Math.cos(A)*c.rX,C=Math.sin(A)*c.rX,N=-Math.sin(A)*c.rY,O=Math.cos(A)*c.rY,[L,P]=c.phi1<c.phi2?[c.phi1,c.phi2]:-180>c.phi2?[c.phi2+360,c.phi1+360]:[c.phi2,c.phi1],W=([Y,z])=>{const tt=Math.atan2(z,Y)*180/Math.PI;return tt<L?tt+360:tt},V=Ef(N,-T,0).map(W);for(const Y of V)Y>L&&Y<P&&y(bf(c.cX,T,N,Y));const b=Ef(O,-C,0).map(W);for(const Y of b)Y>L&&Y<P&&p(bf(c.cY,C,O,Y))}return o});return s.minX=1/0,s.maxX=-1/0,s.minY=1/0,s.maxY=-1/0,s}const ae={ROUND:O2,TO_ABS:_f,TO_REL:M2,NORMALIZE_HVZ:L2,NORMALIZE_ST:Cf,QT_TO_C:Df,INFO:$r,SANITIZE:N2,MATRIX:ji,ROTATE:B2,TRANSLATE:I2,SCALE:R2,SKEW_X:P2,SKEW_Y:F2,X_AXIS_SYMMETRY:k2,Y_AXIS_SYMMETRY:H2,A_TO_C:U2,ANNOTATE_ARCS:q2,CLONE:Sf,CALCULATE_BOUNDS:V2,REVERSE_PATH:S2};class Gr{static destroy(){this.cached.clear(),this.cachedCanvas.clear()}static createCanvas(e){var s;if(!((s=Vt.window)!=null&&s.document))throw new Error("environment not support");let t;e.containerId&&(t=Vt.window.document.getElementById(e.containerId)),t||(t=Vt.window.document.getElementsByTagName("body")[0]);let r;if(e.canvasId&&(r=Vt.window.document.getElementById(e.canvasId)||void 0),e.width||(e.width=(t==null?void 0:t.offsetWidth)||100),e.height||(e.height=(t==null?void 0:t.offsetHeight)||100),e.dpr||(e.dpr=Vt.dpr),r)this.resizeCanvas(r,e.width,e.height,e.dpr);else{if(r=this.createHtmlCanvas(e.width,e.height,e.dpr),!r)throw new Error("error environment");e.canvasId&&r.setAttribute("id",e.canvasId),t==null||t.appendChild(r)}return r.style.background=e.background||"transparent",r}static getContext2D(e,t={}){const r={alpha:!0,willReadFrequently:!!t.willReadFrequently},s=e.getContext("2d",r);if(!s)throw new Error("getContext2D error");return s.scale(t.dpr||1,t.dpr||1),s}static resizeCanvas(e,t,r,s=1){e instanceof OffscreenCanvas?(e.width=t,e.height=r):e instanceof HTMLCanvasElement&&(e.setAttribute("width",(t*s).toString()),e.setAttribute("height",(r*s).toString()),e.style.width=t+"px",e.style.height=r+"px",e.style.padding="0",e.style.margin="0",e.style.border="0",e.style.imageRendering="pixelated",e.style.transform="translateZ(0)")}static getImageBitmapByCanvasAsync(e){return Tt(this,null,function*(){if(e)return e instanceof OffscreenCanvas?e.transferToImageBitmap():e instanceof HTMLCanvasElement?yield createImageBitmap(e):void 0})}static get(e,t,r,s=1){let o=this.cached.get(e);return o||(o=this.create(t,r,s),this.set(e,o)),this.resizeCanvas(o,t,r,s),o}static set(e,t){if(!e||!t)throw new Error("error input");return this.cached.set(e,t)}static remove(e){this.cached.has(e)&&this.cached.delete(e)}static create(e,t,r=1){var s;if((s=Vt.window)!=null&&s.OffscreenCanvas)return new OffscreenCanvas(e,t);throw new Error("environment does not support")}static createHtmlCanvas(e,t,r=1){if(!Vt.window.document)throw new Error("environment does not support");const s=Vt.window.document.createElement("canvas");return this.resizeCanvas(s,e,t,r),s}static measureText(e,t,r=new k){if(!e)throw new Error("input error");const o=this.get("measureText",1,1).getContext("2d");if(!o)throw new Error("bufferCtx not found");t.render(o);const u=o.measureText(e);if(!u)throw new Error("measureText error");const h=u.actualBoundingBoxRight+u.actualBoundingBoxLeft,c=u.actualBoundingBoxAscent+u.actualBoundingBoxDescent;return r.set(h,c),r}}d(Gr,"cached",new Map),d(Gr,"cachedCanvas",new Map);let W2=0;class xo extends I{constructor(t={}){var r;super(t.commands);d(this,"name","Geo2");d(this,"id",++W2);d(this,"params");d(this,"viewMatrix",new ce);d(this,"boundingBox",new Ot);d(this,"flipY",!1);d(this,"renderPath");d(this,"_version",0);typeof t.flipY!="undefined"&&(this.flipY=!!t.flipY),this.params=t,(r=this.commands)!=null&&r.length&&this.toAbs(),t.flipY&&this.scale(1,-1)}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(),yt.identity();for(let r=0,s=((t=this.commands)==null?void 0:t.length)||0;r<s;r++){const o=this.commands[r];switch(o.type){case I.MOVE_TO:this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case I.LINE_TO:this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case I.ARC:typeof o.xRot=="undefined"?(this.boundingBox.expandByXY(o.x,o.y),Ci.set(o.x,o.y).addScalar(-o.rX),this.boundingBox.expandByPoint(Ci),Ci.set(o.x,o.y).addScalar(o.rX),this.boundingBox.expandByPoint(Ci)):this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case I.HORIZ_LINE_TO:this.boundingBox.expandByXY(o.x,yt.y),yt.set(o.x,yt.y);break;case I.VERT_LINE_TO:this.boundingBox.expandByXY(yt.x,o.y),yt.set(yt.x,o.y);break;case I.QUAD_TO:this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break}}return this.boundingBox}render(t,r){if(this.renderPath=new Path2D,!(!t||!(r!=null&&r.length))){yt.identity();for(let s=0,o=(r==null?void 0:r.length)||0;s<o;s++){const u=r[s];switch(u.type){case I.MOVE_TO:this.renderPath.moveTo(u.x,u.y),yt.set(u.x,u.y);break;case I.LINE_TO:this.renderPath.lineTo(u.x,u.y),yt.set(u.x,u.y);break;case I.ARC:this.renderPath.arc(u.x,u.y,u.rX,u.phi1||0,u.phi2||Math.PI*2,u.sweepFlag!==1),yt.set(u.x,u.y);break;case I.HORIZ_LINE_TO:this.renderPath.lineTo(u.x,yt.y),yt.set(u.x,yt.y);break;case I.VERT_LINE_TO:this.renderPath.lineTo(yt.x,u.y),yt.set(yt.x,u.y);break;case I.CURVE_TO:this.renderPath.bezierCurveTo(u.x1,u.y1,u.x2,u.y2,u.x,u.y),yt.set(u.x,u.y);break;case I.SMOOTH_CURVE_TO:yt.set(u.x,u.y);break;case I.QUAD_TO:yt.set(u.x,u.y);break;case I.SMOOTH_QUAD_TO:yt.set(u.x,u.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 u;const r=[];for(let h=0,c=((u=this.commands)==null?void 0:u.length)||0;h<c;h++)r.push(Object.assign({},this.commands[h]));if(!t)return r;yt.identity();const s=ae.MATRIX(t.elements[0],t.elements[1],t.elements[3],t.elements[4],t.elements[6],t.elements[7]),o=[];for(let h=0,c=r.length;h<c;h++){const y=r[h],p=s(y);if(p.type===I.ARC){let[A,T,C,N,O,L,P,W]=J0(yt.x,yt.y,p.x,p.y,p.lArcFlag,p.sweepFlag,p.rX,p.rY,0);if(yt.set(p.x,p.y),p.rX===p.rY&&typeof p.xRot!="undefined")p.x=A,p.y=T,p.rx=C>N?C:N,p.phi1=O,p.phi2=O+L;else if(p.rX===p.rY)t.getScale(Ci),p.rX=p.rY*Math.abs(Ci.x),(p.phi1!==0||p.phi2!==Math.PI*2)&&(t.getRotation(Ci),p.phi1+=Ci.x,p.phi2+=Ci.x);else{const V=t2(A,T,C,N,O,L,P);if(!(V!=null&&V.length))break;p.type=I.MOVE_TO,p.x=A,p.y=T;for(let b=0,Y=V.length;b<Y;b++)o.push({type:I.CURVE_TO,x1:V[b][1][0],y1:V[b][1][1],x2:V[b][2][0],y2:V[b][2][1],x:V[b][3][0],y:V[b][3][1]})}}else yt.set(p.x||yt.x,p.y||yt.y);Array.isArray(p)?o.push(...p):o.push(p)}return o}copy(t){return this.commands=Rt.cloneDeep(t.commands),this.version=0,this}clone(){const t=this.constructor;return new t(this.params).copy(this)}getConvexHull(){var r,s;const t=[];if(!((r=this.commands)!=null&&r.length))return t;for(let o=0,u=((s=this.commands)==null?void 0:s.length)||0;o<u;o++){const h=this.commands[o];switch(h.type){case I.MOVE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case I.LINE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case I.ARC:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case I.HORIZ_LINE_TO:t.push({x:h.x,y:yt.y}),yt.set(h.x,yt.y);break;case I.VERT_LINE_TO:t.push({x:yt.x,y:h.y}),yt.set(yt.x,h.y);break;case I.CURVE_TO:case I.SMOOTH_CURVE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case I.QUAD_TO:case I.SMOOTH_QUAD_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break}}return t}isPointInBoundingBox(t){return this.boundingBox?this.boundingBox.containsPoint(t):!1}isPointInPath(t){if(this.renderPath){Ji.save(),Ji.beginPath(),Ji.lineWidth=5,Ji.stroke(this.renderPath),Ji.fill(this.renderPath),Ji.closePath();const r=Ji.isPointInPath(this.renderPath,t.x,t.y);return Ji.restore(),r}return!1}}const yt=new k,Ci=new k,Ji=Gr.get("RAY_CASTER",10,10).getContext("2d");class z2 extends xo{constructor(t={}){t.commands||(t.commands=[]);super(t);d(this,"isCircle",!0);d(this,"radius",1);d(this,"start",0);d(this,"end",Math.PI*2);typeof t.radius!="undefined"&&(this.radius=t.radius),typeof t.start!="undefined"&&(this.start=t.start),typeof t.end!="undefined"&&(this.end=t.end),this.recomputePath()}recomputePath(){var s,o,u;if(!((o=(s=this.params)==null?void 0:s.points)!=null&&o.length))return this;const t=this.params.points,r=[];for(let h=0,c=t.length;h<c;h++)r.push({type:I.MOVE_TO,x:t[h].x+this.radius,y:t[h].y*(this.params.flipY?-1:1),relative:!1}),r.push({type:I.ARC,rX:this.radius,rY:this.radius,xRot:void 0,lArcFlag:0,sweepFlag:((u=this.params)==null?void 0:u.sweepFlag)||1,phi1:this.start,phi2:this.end,x:t[h].x,y:t[h].y*(this.params.flipY?-1:1),relative:!1});return this.commands=r,this}}class Of{constructor(e={}){d(this,"params");this.params=e}destroy(){}static getInstanceByElement(e,t=!1){if(!e)return;let r;switch(e.nodeName){case"path":r=this.getInstanceByPath(e,t);break;case"circle":r=this.getInstanceByCircle(e,t);break}return r||console.error(`unsupported: ${e}`),r}static getInstanceByPath(e,t=!1){if(!e)return;const r=pa(e,"d");if(!r)return;const s=r.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,""),o=s.match(/([Mm][^Mm]*)/g);if(!o||o.length<=this.splitLimit)try{return new xo({commands:s,flipY:t})}catch(h){console.error(`getInstanceByPath error: ${h}: ${s}`);return}const u=[];for(let h=0,c=o.length;h<c;h+=this.splitLimit){const p=o.slice(h,h+this.splitLimit).join(" ");try{u.push(new xo({commands:p,flipY:t}))}catch(A){console.error(`getInstanceByPath error: ${A}`)}}return u}static getInstanceByCircle(e,t=!1){if(!e||e.nodeName!=="circle")return;Mf.set(pa(e,"cx",0),pa(e,"cy",0));const r=pa(e,"r",0);return new z2({points:[Mf.clone()],radius:r,flipY:t})}static getInstance(e,t=!1){if(e)return new xo({commands:e,flipY:t})}}d(Of,"splitLimit",100);const Mf=new k;class $2{constructor(){d(this,"svg");d(this,"offset",new k);d(this,"svgRoot");d(this,"layers",[]);d(this,"elementsMap",{});d(this,"boundingBoxMap",{});d(this,"boundingBox",new Ot);d(this,"svgSkeletons",[]);d(this,"data");d(this,"_exceptTypes",["view"]);d(this,"_exceptIds",["viewer","mirror"]);d(this,"_lvi",0);d(this,"_lastLinked",[])}bindSvg(e){return this.svg=e,this.svgRoot=Zc(this.svg),this.layers=this.getLayers(2),this.elementsMap={},this.boundingBoxMap={},this.boundingBox.makeEmpty(),this.getElementsMap(this.svg,this.elementsMap),this}getLayers(e){var t;if(!this.svg)throw new Error("please bind svg first");return e===2&&((t=this.layers)!=null&&t.length)?this.layers:(this.layers=this._getSvgLayer(this.svg,e),this.layers)}_getSvgLayer(e,t=0,r=0,s=[]){var h;let o,u=e.id;if(this._exceptTypes.includes(e.tagName)||e.tagName==="defs")return this._lvi--,s;if(t&&this._lvi>t)return s;u&&!this._exceptIds.includes(u)&&(o={value:u,label:u,children:[]},s.push(o)),this._lvi++;for(let c=0,y=e.children.length;c<y;c++)o?this._getSvgLayer(e.children[c],t,this._lvi,o.children):this._getSvgLayer(e.children[c],t,this._lvi,s);return((h=o==null?void 0:o.children)==null?void 0:h.length)===0&&delete o.children,this._lvi=r,s}getElementsMap(e,t={}){return this.traverseSvg(e,r=>{r!==e&&r.id&&(t[r.id]=r)}),t}computeBoundingBoxMap(){var t;if(Object.keys(this.boundingBoxMap).length)return this.boundingBoxMap;let e=(t=this.svg)==null?void 0:t.getBoundingClientRect();return e&&this.offset.set(e.left,e.top),this.traverseSvg(this.svg,r=>{if(!r.id)return;if(r.tagName==="use"){const u=this.getUseSymbolId(r);if(!u)return;const h=this.boundingBoxMap[u];if(h&&!h.isEmpty()){Di.set(Number(r.getAttribute("x")||"0"),Number(r.getAttribute("y")||"0")),Eo.composeSvgTransform(Di.x,Di.y,r.getAttribute("transform"));const p=new Ot().copy(h).applyMatrix3(Eo);this.boundingBoxMap[r.id]=p;return}const c=this.getUseElementBoundingBoxWithSymbol(r);if(!c)return;this.boundingBoxMap[u]=c,Di.set(Number(r.getAttribute("x")||"0"),Number(r.getAttribute("y")||"0")),Eo.composeSvgTransform(Di.x,Di.y,r.getAttribute("transform"));const y=new Ot().copy(c).applyMatrix3(Eo);this.boundingBoxMap[r.id]=y,this.boundingBox.expandByBox(y);return}if(typeof r.getBBox!="function")return;const s=r.getBBox();if((!s.width||!s.height)&&r.tagName==="path"){const u=Of.getInstanceByPath(r);if(!Array.isArray(u)){const h=u==null?void 0:u.computeBoundingBox();if(!h||h.isEmpty())return;h.getSize(Di),s.x=h.min.x,s.y=h.max.y,s.width=Di.x,s.height=Di.y}}if(!s.width||!s.height)return;const o=new Ot(new k(s.x,s.y),new k(s.x+s.width,s.y+s.height));this.boundingBoxMap[r.id]=o.round(),this.boundingBox.expandByBox(o)}),this.boundingBoxMap}getLayerVisible(e){var r;const t=this.getElementById(e);if(t)return((r=t.style)==null?void 0:r.display)!=="none"}updateLayersVisibility(e,t=!1,r=!0){if(!this.elementsMap)throw new Error("please bind svg first");r&&this._updateAllLayersVisibility(!t),e!=null&&e.length||(e=["background"]);for(let s=0,o=e.length;s<o;s++){const u=this.getElementById(e[s]);u&&this._updateLayersVisibility(u,t,!0,!0)}}_updateAllLayersVisibility(e=!1){Object.values(this.elementsMap).forEach(t=>{t.tagName==="svg"||t.tagName==="symbol"||!t.getAttribute("id")||(t.style.display=e?"block":"none")})}_updateLayersVisibility(e,t=!1,r=!1,s=!1){var o,u;if(!(!e||e.tagName==="svg"||!e.getAttribute("id"))){if(e.style.display=t?"block":"none",r&&t){let h=e.parentElement;for(;h&&h.tagName!=="svg";)h.style.display=t?"block":"none",h=h.parentElement}if(s&&((o=e.children)==null?void 0:o.length)>0)for(let h=0,c=(u=e.children)==null?void 0:u.length;h<c;h++)this._updateLayersVisibility(e.children[h],t,!1,!0)}}updateVisibilityByAssetType(e,t=!1,r){r||(r=Yc[e]),this.updateLayersVisibility(r,!t)}updateVisibilityByAssetTypes(e,t=!1,r){if(Array.isArray(e)||(e=[e]),!!(e!=null&&e.length))for(let s=0,o=e.length;s<o;s++)this.updateVisibilityByAssetType(e[s],t,r)}getElementById(e){if(!this.elementsMap)throw new Error("please bind svg first");return this.elementsMap[e]}getElementBoundingBox(e){return this.boundingBoxMap[e]}findSkeletonByPath(e=[]){let t=0,r;const s=Object.keys(this.elementsMap);for(let o=0,u=s.length;o<u;o++){const h=this.elementsMap[s[o]];if(!h)continue;const c=h.getAttribute("d");c&&(c.length<t||(t=c.length,r=h.id?h:h.parent))}return r&&e.push(r),e}setTextInChildren2(e,t){var s;let r;((s=e==null?void 0:e.children)==null?void 0:s.length)<2?(r=Xu("text"),r.setAttribute("dy","1em"),e.appendChild(r)):r=e.children[e.children.length-1],r.innerHTML=t}traverseSvg(e,t){var r;if(!this._exceptTypes.includes(e.tagName)&&!(e.tagName!=="svg"&&e.tagName!=="defs"&&!e.id)&&!(e.tagName==="g"&&((r=e.children)==null?void 0:r.length)===0)){this._exceptIds.includes(e.id)||t(e);for(let s=0,o=e.children.length;s<o;s++)this.traverseSvg(e.children[s],t)}}traverseSvgTLayers(e,t){var r;if(Array.isArray(e)){for(let s=0,o=e.length;s<o;s++)this.traverseSvgTLayers(e[s],t);return}if(t(e),!!((r=e.children)!=null&&r.length))for(let s=0,o=e.children.length;s<o;s++)this.traverseSvgTLayers(e.children[s],t)}getLabelElementsByType(e,t={}){const r=this.getElementById(la(e));return r&&this.getElementsMap(r,t),t}getLabelElementById(e,t="rm"){if(!e)return;const r=this.getElementById(e);if(!r)return;let s=r.getAttribute("aid");return s||(s="l-"+t+"-"+e),this.getElementById(s)}setLabelsById(e,t,r="rm"){var u,h;const s=this.getLabelElementById(e,r);if(!s)return;const o=((u=s.children)==null?void 0:u.length)||0;for(let c=0,y=((t==null?void 0:t.length)||0)-(o-1);c<y;c++){const p=Xu("text");p.setAttribute("x","0"),p.setAttribute("y",o+c+"em"),s.appendChild(p)}for(let c=1,y=(h=s.children)==null?void 0:h.length;c<y;c++)s.children[c].textContent=t&&c<=t.length?t[c-1]:""}clearAssetLabelsByType(e="rm"){var s;const t=this.getLabelElementsByType(e),r=Rt.keys(t);for(let o=0,u=r.length;o<u;o++){const h=t[r[o]];for(let c=1,y=((s=h.children)==null?void 0:s.length)||0;c<y;c++)h.children[c].textContent=""}}getUseSymbolId(e){var t;if(!(!e||e.tagName!=="use"))return(t=e.getAttribute("xlink:href"))==null?void 0:t.substring(1)}getUseSymbol(e){if(!e||e.tagName!=="use")return;const t=this.getUseSymbolId(e);if(t)return this.getElementById(t)}setElementState2selected(e,t=!1){var s;if(!e)return;if(e.tagName==="use"){const o=this._getSymbolBox(e);if(!o)return;t?(s=e.parentNode)==null||s.insertBefore(o,e):e.parentNode&&e.parentNode.contains(o)&&e.parentNode.removeChild(o);return}let r=e.getAttribute("class");r||(r=""),t?r="danger":r=Rt.replace(r,"danger","").trim(),e.setAttribute("class",r)}_getSymbolBox(e){if(!e)return;const t=e.id+"-boundingBox";let r=this.getElementById(t);if(r)return r;const s=this.getUseSymbol(e);if(!s)return;let o=this.getElementBoundingBox(e.id);if(!o||o.isEmpty())return;r=document.createElementNS("http://www.w3.org/2000/svg","rect"),r.setAttribute("id",t),r.setAttribute("class","danger"),r.setAttribute("x",o.min.x.toString()),r.setAttribute("y",o.min.y.toString());const u=new k;return o.getSize(u),r.setAttribute("width",u.x.toString()),r.setAttribute("height",u.y.toString()),s.getAttribute("transform")&&r.setAttribute("transform",s.getAttribute("transform")||""),s.getAttribute("style")&&r.setAttribute("style",s.getAttribute("style")||""),this.elementsMap[t]=r,r}getUseElementBoundingBoxWithSymbol(e){var c;if(!e)return;const t=(c=e.getAttribute("xlink:href"))==null?void 0:c.substring(1);if(!t)return;let r=this.getElementById(t);if(!r)return;const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px";let o;if(Rt.lowerCase(r.tagName)==="symbol"){o=document.createElementNS("http://www.w3.org/2000/svg","g");for(let y=0,p=r.childNodes.length;y<p;y++){const A=r.childNodes[y].cloneNode(!0);o.appendChild(A)}}else o=r.cloneNode(!0);s.appendChild(o),o.setAttribute("style","stroke: #333333;"),document.body.appendChild(s);const u=s.getBBox();if(document.body.removeChild(s),!u)return;const h=new Ot;return h.set(new k(u.x,u.y),new k(u.x+u.width,u.y+u.height)),h}fontZoom(e,t=1){const r=this.getElementById(e);if(!r)return;let s=r.getAttribute("font-size");s||(s="12");const o=/(\d+)([a-zA-Z%]+)/.exec(s),u=o&&(o==null?void 0:o.length)>2?o[2]:"";let h=Math.round(parseFloat(s)*t*100)/100;r.setAttribute("font-size",h+u)}strokeWidthChanged(e=1){var c;const t=(c=this.svg)==null?void 0:c.querySelector("#mirror");if(!t){console.error("Cannot find g SVGElement with ID mirror");return}let r=pa(t,"stroke-width"),s,o="";if(typeof r=="string"){const y=r.match(/^(\d+(\.\d+)?)(\w*)$/);if(y)s=parseFloat(y[1]),o=y[3]||"px";else{console.error("Invalid stroke-width value:",r);return}}else{console.error("Invalid stroke-width type:",typeof r);return}const h=`${s*e}${o}`;t.setAttribute("stroke-width",h)}getCentroid(e,t=new k){const r=e.getAttribute("insX"),s=e.getAttribute("insY");return r||s?t.set(Number(r||"0"),Number(s||"0")):this.getCentroidByDom(e,t)}getCentroidByDom(e,t=new k){const r=Number(e.getAttribute("x")||"0"),s=Number(e.getAttribute("y")||"0"),o=e.getBBox();let u=1,h=1,c=e.getAttribute("transform");if(!c)return t.set(r,s);const y=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(c);if(typeof y=="undefined"||y==null){const p=e.transform.baseVal;if(c&&p.numberOfItems>0){let A=p.getItem(0);A&&A.type===SVGTransform.SVG_TRANSFORM_SCALE&&(u=A.matrix.a!==0?A.matrix.a:1,h=A.matrix.d!==0?A.matrix.d:u)}else return t.set((o.x+o.width/2)*u,(o.y+o.height/2)*h)}else u=y[1]&&Number(y[1])>0?Number(y[1]):1,h=y[2]&&Number(y[2])>0?Number(y[2]):u;return r&&s?t.set(r*u,s*h):t.set((o.x+o.width/2)*u,(o.y+o.height/2)*h),t}linkAssetsByTree(e,t){if(e||(e=Qe.RM),this.clearLinkedLines(e),!t||!t.value)return;const r=this.getLinesByTree(t);this.drawLinkedLines(e,r)}clearLinkedLines(e){var s;const t=fs(e);if(this.getElementById(t)){for(let o=((s=this._lastLinked)==null?void 0:s.length)-1;o>=0;o--){const u=this._lastLinked[o];u.parentNode&&u.parentNode.removeChild(u),this._lastLinked.splice(o,1)}this._lastLinked.length=0}}drawLinkedLines(e,t){var o;if(!(t!=null&&t.length))return;const r=fs(e),s=this.getElementById(r);if(s)for(let u=0,h=t.length;u<h;u++){const c=t[u][0],y=t[u][((o=t[u])==null?void 0:o.length)-1],p=Xu("line");p.setAttribute("x1",c.x.toString()),p.setAttribute("y1",c.y.toString()),p.setAttribute("x2",y.x.toString()),p.setAttribute("y2",y.y.toString()),p.setAttribute("class","danger"),p.setAttribute("style","stroke-width: 2;"),s.appendChild(p),this._lastLinked.push(p)}}getLinesByTree(e,t=[]){var o;if(!(e!=null&&e.value))return t;const r=this.getElementBoundingBox(e.value);if(!r)return t;const s=r.getCenter();return(o=e.children)==null||o.forEach(u=>{var y;const h=this.getElementBoundingBox(u==null?void 0:u.value);if(!h)return;const c=h.getCenter();t.push([s,c]),(y=u.children)!=null&&y.length&&this.getLinesByTree(u,t)}),t}}const Di=new k,Eo=new ce;class G2{constructor(e={},t){d(this,"name","SvgPainter");d(this,"params");d(this,"chef");this.params=e,this.chef=t}drawSocialDistanceCircles(e,t="http://www.w3.org/2000/svg"){var C,N,O;if(!e)return;const r=F0(e),s=Xc(e),o=2*r,u=(N=(C=this.params.socialDistance)==null?void 0:C.colors)!=null&&N.length?(O=this.params.socialDistance)==null?void 0:O.colors:[Qt.green,Qt.red],h=this.getRadius(s),c=e.querySelector(`#${Zu}`),y=c==null?void 0:c.querySelectorAll("path");if(!c||!(y!=null&&y.length))return;let p,A;const T=new Array;for(let L=0,P=(y==null?void 0:y.length)||0;L<P;L++){if(p=y[L],A=p.getAttribute("id"),!A)continue;const W=this.chef.getElementBoundingBox(A);if(!W)continue;const V=new k;W.getCenter(V),T.push({id:A,cp:V})}for(let L=0,P=T.length;L<P;L++){T[L].color=u[0];for(let W=0,V=P;W<V;W++)T[L]!==T[W]&&k.getDistance(T[L].cp,T[W].cp)<h*2&&(T[L].color=u[1])}for(let L=0,P=T.length;L<P;L++){let W=this.createCircle(T[L],h,o,t);c.appendChild(W)}}clearSocialDistanceCircles(e){if(!e)return;const t=e.querySelector(`#${Zu}`),r=t==null?void 0:t.querySelectorAll("circle");if(!(!t||!(r!=null&&r.length)))for(let s=0,o=(r==null?void 0:r.length)||0;s<o;s++){const u=r[s].getAttribute("id");u&&(u==null?void 0:u.indexOf("_circle"))>-1&&t.removeChild(r[s])}}getRadius(e){var r,s,o;let t=((s=(r=this.params)==null?void 0:r.socialDistance)==null?void 0:s.radius)||3;return((o=this.params)==null?void 0:o.displayUnits)==="imperial"?e==="Metres"||e==="m"?t/=3.28084:e==="cm"?t=t/3.28084*100:e==="mm"?t=t/3.28084*1e3:(e==="INCH"||e==="inches")&&(t*=12):e==="INCH"||e==="inches"?t=t*3.28084*12:e==="cm"?t*=100:e==="mm"&&(t*=1e3),t}createCircle(e,t,r,s){const o=document.createElementNS(s,"circle");return o.setAttributeNS(null,"id",e.id+"_circle"),o.setAttributeNS(null,"cx",e.cp.x),o.setAttributeNS(null,"cy",e.cp.y),o.setAttributeNS(null,"r",String(t)),o.setAttributeNS(null,"style",`pointer-events:none;fill-opacity:0.1;stroke:${e.color};stroke-width:${r}px;`),o}}const Y2=function(i){return(i||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};function Ao(i,e){if(!i||!e)return!1;if(e.indexOf(" ")!==-1)throw new Error("className should not contain space.");return i.classList?i.classList.contains(e):(" "+i.className+" ").indexOf(" "+e+" ")>-1}function da(i,e){if(!i)return;let t=i.className;const r=(e||"").split(" ");for(let s=0,o=r.length;s<o;s++){const u=r[s];u&&(i.classList?i.classList.add(u):Ao(i,u)||(t+=" "+u))}i.classList||(i.className=t)}function ga(i,e){if(!i||!e)return;const t=e.split(" ");let r=" "+i.className+" ";for(let s=0,o=t.length;s<o;s++){const u=t[s];u&&(i.classList?i.classList.remove(u):Ao(i,u)&&(r=r.replace(" "+u+" "," ")))}i.classList||(i.className=Y2(r))}class al extends X0{constructor(t={}){super();d(this,"isSvgScene",!0);d(this,"name","SvgScene");d(this,"dynamically",!0);d(this,"params");d(this,"socialDistanceEnable",!1);d(this,"container");d(this,"svg");d(this,"svgStr","");d(this,"svgRoot");d(this,"viewBox",new Ot);d(this,"chef");d(this,"defaultLayers",[]);d(this,"skeletonLayers",[]);d(this,"currentLayers",[]);d(this,"assetType");d(this,"assetsMap",{});d(this,"legend",[]);d(this,"selectedList",[]);d(this,"painter");d(this,"_lastHighlightType","");d(this,"_lastHighlightIds",[]);d(this,"clickSvgElementHandler",this.handleClickSvgElement.bind(this));d(this,"_lastLinkedIds",[]);this.params=t,this.assetType=t.assetType||Qe.RM,this.params.socialDistanceEnable&&(this.socialDistanceEnable=!0),this.container=this.params.containerId?document.getElementById(this.params.containerId):Vt.window.document.getElementsByTagName("body")[0],this.chef=new $2,this.painter=new G2(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)}load(t){return Tt(this,null,function*(){return new af().loadAsync(t)})}bind(t){this.svgStr=t;const r=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;return this.bindSvg(r),!0}bindSvg(t){if(this.svg=t,!this.svg)throw new Error("svg load failed");let r=this.svg.getAttribute("viewBox");r&&(k0(r,this.viewBox),this.chef.bindSvg(this.svg),this.svgRoot=Zc(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 -> ",r,this.viewBox.toString()),this.setAssetsMap(this.assetType,this.assetsMap))}recompute(t){t&&(this.bindSvg(t),this.computeBoundingBox(),this.viewBox.copy(this.boundingBox))}appendStyles(){var r;let t=(r=this.svg)==null?void 0:r.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,r=!1){this.setDefaultLayers(t),this.chef.updateLayersVisibility(t,r)}getLayerVisible(t){return this.chef.getLayerVisible(t)}updateLayersVisibility(t,r=!1,s=!0){this.chef.updateLayersVisibility(t,r,s)}setAssetType(t,r){this.assetsMap={},this.assetType=t,this.setAssetsMap(this.assetType,this.assetsMap),r||(r=[fs(t)],t!==Qe.RM&&r.unshift(fs(Qe.RM))),this.setDefaultLayers(r),this.updateLayersVisibility(this.defaultLayers,!0)}isBelongsToAssetType(t,r){r||(r=this.assetType);const s=this.getAssetsByType(r);return s?!!(s!=null&&s.hasOwnProperty(t)):!1}setAssetsMap(t,r={}){const s=this.chef.getElementById(fs(t));if(!s)return r;r[t]=this.chef.getElementsMap(s);const o=la(t),u=this.chef.getElementById(o);if(!u)return r;const h=this.chef.getElementsMap(u),c=Rt.keys(h);if(!(c!=null&&c.length))return r;if(Rt.startsWith(c[0],`l-${t}-`)){const y=`l-${t}-`.length;for(let p=0,A=c.length;p<A;p++){const T=c[p].slice(y);h[T]=h[c[p]],delete h[c[p]]}}return r[o]=h,r}getAssetsByType(t){return this.assetsMap.hasOwnProperty(t)||this.setAssetsMap(t,this.assetsMap),this.assetsMap[t]}getElementById(t){if(!t)return;const r=this.getAssetsByType(this.assetType);if(!(!r||!Object.hasOwnProperty.call(r,t)))return r[t]}getAssetIdsByType(t){const r=this.getAssetsByType(t),s=[];return r?Rt.keys(r):s}clearFillOrStroke(t="fill"){const r=this.getAssetsByType(this.assetType);if(!r)return;const s=Rt.keys(r);let o;for(let u=0,h=s.length;u<h;u++)o=r[s[u]],o&&(o.hasAttribute(t)&&o.removeAttribute(t),t==="stroke"&&o.removeAttribute("stroke-width"));this.clearLegendBy(t)}clearFillOrStrokeByIds(t,r="fill"){const s=this.getAssetsByType(this.assetType);if(!s)return;const o=Rt.keys(s);let u;for(let h=0,c=o.length;h<c;h++)t!=null&&t.length&&!t.includes(o[h])||(u=s[o[h]],!(!u||!u.hasAttribute(r))&&(u.removeAttribute(r),r==="stroke"&&u.removeAttribute("stroke-width")));this.clearLegendBy(r)}setFillOrStrokeByIds(t,r,s="fill",o="7em"){const u=this.getAssetsByType(this.assetType);if(!u)return;const h=Rt.keys(u);let c;for(let y=0,p=h.length;y<p;y++)t.includes(h[y])&&(c=u[h[y]],c&&(c.setAttribute(s,r),s==="stroke"&&c.setAttribute("stroke-width",o),this.addLegend(s,r,h[y])))}addLegend(t,r,s){let o=this.legend.find(u=>u.color===r);o||(o={type:t,color:r,ids:[]},this.legend.push(o)),o.ids.push(s)}clearLegendBy(t){var r;t||(this.legend.length=0);for(let s=((r=this.legend)==null?void 0:r.length)-1;s>=0;s--)this.legend[s].type===t&&this.legend.splice(s,s)}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,r){this.chef.setLabelsById(t,r,this.assetType)}getAssetLabelsMap(t){var o,u;if(!t)return;const r=la(t);let s=this.getAssetsByType(r);if(!s||!((o=Object.keys(s))!=null&&o.length)){let h=this.chef.getElementById(r);if(h||(h=this.chef.getElementById(t+"-txt-label")),!h)return;s=this.chef.getElementsMap(h),this.assetsMap[r]=s}if(!(!s||!((u=Object.keys(s))!=null&&u.length)))return s}getAssetLabelById(t,r){var h,c;const s=this.getAssetLabelsMap(t);if(!s)return;let o=s[r];if(o&&((h=o==null?void 0:o.childNodes)!=null&&h.length))return o.childNodes[0].textContent||"";const u="l-"+t+"-"+r;if(o=s[u],o&&((c=o==null?void 0:o.children)!=null&&c.length))return o.children[0].textContent||""}clearAssetLabels(){this.chef.clearAssetLabelsByType(this.assetType)}bindAssetsEvents(t){var o;const r=(o=this.svg)==null?void 0:o.querySelector("#"+t);if(!r)return;r.querySelectorAll("[id]").forEach(u=>{u instanceof SVGElement&&u.addEventListener("click",this.clickSvgElementHandler)})}handleClickSvgElement(t){var r;typeof t.preventDefault=="function"&&t.preventDefault(),console.warn("svgScene.handleClickSvgElement: ",(r=t==null?void 0:t.target)==null?void 0:r.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,r){var o;this.resetHighlightAssets(t);const s=this.getAssetsByType(t);!s||!((o=Object.keys(s))!=null&&o.length)||(this._lastHighlightType=t,this._lastHighlightIds=Array.isArray(r)?r:[r],this._lastHighlightIds.forEach(u=>{u&&s[u]&&da(s[u],"active")}))}resetHighlightAssets(t){var s;const r=this.getAssetsByType(t||this._lastHighlightType);!r||!((s=Object.keys(r))!=null&&s.length)||(this._lastHighlightIds.forEach(o=>{o&&r[o]&&ga(r[o],"active")}),this._lastHighlightIds.length=0)}getIntersectObjects(t,r=Qe.RM,s=[]){s.length=0;const o=[],u=this.getAssetsByType(r);if(!u)return s;const h=Rt.keys(u);for(let y=0,p=h.length;y<p;y++){const A=this.chef.getElementBoundingBox(u[h[y]].id);A&&A.containsPoint(t.worldCoords)&&o.push(u[h[y]])}const c=Rt.sortBy(o,y=>{var p;return(p=this.chef.getElementBoundingBox(y.id))==null?void 0:p.getArea()});return s.push(...c),s}clearSelected(){var t,r;if((t=this.selectedList)!=null&&t.length)for(let s=((r=this.selectedList)==null?void 0:r.length)-1;s>=0;s--){let o=this.selectedList[s];this.selectedList.splice(s,1),this.chef.setElementState2selected(o,!1)}}clearSelectedById(t){var s,o;let r=(s=this.selectedList)==null?void 0:s.findIndex(u=>u.getAttribute("id")===t);r>-1&&(this.chef.setElementState2selected(this.selectedList[r],!1),(o=this.selectedList)==null||o.splice(r||0,1))}selectByIds(t,r=!1){Array.isArray(t)||(t=[t]),r||this.clearSelected();const s=Rt.uniq(Rt.map(this.selectedList,u=>u.getAttribute("id")||"")),o=this.getAssetsByType(this.assetType);if(o){for(let u=t.length-1;u>=0;u--)s.includes(t[u])?(this.clearSelectedById(t[u]),t.splice(u,1)):Object.hasOwnProperty.call(o,t[u])&&this.selectedList.push(o[t[u]]);this.selectedList.forEach(u=>{this.chef.setElementState2selected(u,!0)})}}getSelectedIds(){var r;if(!((r=this.selectedList)!=null&&r.length))return;const t=[];for(let s=0,o=this.selectedList.length;s<o;s++)this.selectedList[s].id&&t.push(this.selectedList[s].id);return t}getSelectedBoundingBox(){var r;const t=new Ot;return(r=this.selectedList)!=null&&r.length?(this.selectedList.forEach(s=>{const o=this.chef.boundingBoxMap[s.id];o&&t.expandByBox(o)}),t):t.copy(this.boundingBox)}getElementsByBox(t){const r=[],s=Object.keys(this.chef.boundingBoxMap),o=this.getAssetsByType(this.assetType);if(!o)return r;for(let u=0,h=s.length;u<h;u++)if(o.hasOwnProperty(s[u])&&!(s[u].indexOf("-assets")>-1)&&t.intersectsBox(this.chef.boundingBoxMap[s[u]])){const c=o[s[u]];c&&r.push(c)}return r}getBoundingBoxByIds(t){var s,o;if(!t||Array.isArray(t)&&!t.length)return;Array.isArray(t)||(t=[t]);const r=new Ot;for(let u=0,h=t==null?void 0:t.length;u<h;u++)(o=(s=this.chef)==null?void 0:s.boundingBoxMap)!=null&&o.hasOwnProperty(t[u])&&r.expandByBox(this.chef.boundingBoxMap[t[u]]);return r}getBoundingBoxById(t){if(this.chef.boundingBoxMap.hasOwnProperty(t))return new Ot().copy(this.chef.boundingBoxMap[t])}linkAssetsByTree(t){this.chef.linkAssetsByTree(this.assetType,t);const r=this.chef.getElementById(ua.ASSET_LABELS);r&&(r.style.display="block");const s=la(this.assetType),o=this.chef.getElementById(s);o&&(o.style.display="block");const u=this.assetsMap[s];u&&(this._lastLinkedIds.forEach(h=>{u[h]&&(u[h].style.display="none")}),this._lastLinkedIds=Wc(t),this._lastLinkedIds.forEach(h=>{u[h]&&(u[h].style.display="block")}))}onBeforeRender(){}fullscreen(t=1e3,r=!1){}update(){}}class X2 extends al{constructor(t){super(t);d(this,"name","SvgLoadingScene");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
+ `,xf=i=>48<=i.charCodeAt(0)&&i.charCodeAt(0)<=57;class T2 extends vf{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(e=[]){if(this.parse(" ",e),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return e}parse(e,t=[]){const r=s=>{t.push(s),this.curArgs.length=0,this.canParseCommandOrComma=!0};for(let s=0;s<e.length;s++){const o=e[s],u=this.curCommandType===q.ARC&&(this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber.length===1&&(this.curNumber==="0"||this.curNumber==="1"),h=xf(o)&&(this.curNumber==="0"&&o==="0"||u);if(xf(o)&&!h){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&&!u){this.curNumber+=o,this.curNumberHasDecimal=!0;continue}if(this.curNumber&&this.curCommandType!==-1){const c=Number(this.curNumber);if(isNaN(c))throw new SyntaxError(`Invalid number ending at ${s}`);if(this.curCommandType===q.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>c)throw new SyntaxError(`Expected positive number, got "${c}" at index "${s}"`)}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 "${s}"`)}this.curArgs.push(c),this.curArgs.length===_2[this.curCommandType]&&(q.HORIZ_LINE_TO===this.curCommandType?r({type:q.HORIZ_LINE_TO,relative:this.curCommandRelative,x:c}):q.VERT_LINE_TO===this.curCommandType?r({type:q.VERT_LINE_TO,relative:this.curCommandRelative,y:c}):this.curCommandType===q.MOVE_TO||this.curCommandType===q.LINE_TO||this.curCommandType===q.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),q.MOVE_TO===this.curCommandType&&(this.curCommandType=q.LINE_TO)):this.curCommandType===q.CURVE_TO?r({type:q.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===q.SMOOTH_CURVE_TO?r({type:q.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===q.QUAD_TO?r({type:q.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===q.ARC&&r({type:q.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(!w2(o)){if(o===","&&this.canParseCommandOrComma){this.canParseCommandOrComma=!1;continue}if(o==="+"||o==="-"||o==="."){this.curNumber=o,this.curNumberHasDecimal=o===".";continue}if(h){this.curNumber=o,this.curNumberHasDecimal=!1;continue}if(this.curArgs.length!==0)throw new SyntaxError(`Unterminated command at index ${s}.`);if(!this.canParseCommandOrComma)throw new SyntaxError(`Unexpected character "${o}" at index ${s}. Command cannot follow comma`);if(this.canParseCommandOrComma=!1,o==="z"||o==="Z"){t.push({type:q.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1;continue}else if(o==="h"||o==="H")this.curCommandType=q.HORIZ_LINE_TO,this.curCommandRelative=o==="h";else if(o==="v"||o==="V")this.curCommandType=q.VERT_LINE_TO,this.curCommandRelative=o==="v";else if(o==="m"||o==="M")this.curCommandType=q.MOVE_TO,this.curCommandRelative=o==="m";else if(o==="l"||o==="L")this.curCommandType=q.LINE_TO,this.curCommandRelative=o==="l";else if(o==="c"||o==="C")this.curCommandType=q.CURVE_TO,this.curCommandRelative=o==="c";else if(o==="s"||o==="S")this.curCommandType=q.SMOOTH_CURVE_TO,this.curCommandRelative=o==="s";else if(o==="q"||o==="Q")this.curCommandType=q.QUAD_TO,this.curCommandRelative=o==="q";else if(o==="t"||o==="T")this.curCommandType=q.SMOOTH_QUAD_TO,this.curCommandRelative=o==="t";else if(o==="a"||o==="A")this.curCommandType=q.ARC,this.curCommandRelative=o==="a";else throw new SyntaxError(`Unexpected character "${o}" at index ${s}.`)}}return t}transform(e){return Object.create(this,{parse:{value(r,s=[]){const o=Object.getPrototypeOf(this).parse.call(this,r);for(const u of o){const h=e(u);Array.isArray(h)?s.push(...h):s.push(h)}return s}}})}}const Wt=class Wt extends vf{constructor(e){super(),typeof e=="string"?this.commands=Wt.parse(e):this.commands=e}encode(){return Wt.encode(this.commands)}getBounds(){const e=ae.CALCULATE_BOUNDS();return this.transform(e),e}transform(e){const t=[];for(const r of this.commands){const s=e(r);Array.isArray(s)?t.push(...s):t.push(s)}return this.commands=t,this}reverse(e=!0){return this.commands=ae.REVERSE_PATH(this.commands,e),this}static encode(e){return b2(e)}static parse(e){const t=new T2,r=[];return t.parse(e,r),t.finish(r),r}};Wt.CLOSE_PATH=1,Wt.MOVE_TO=2,Wt.HORIZ_LINE_TO=4,Wt.VERT_LINE_TO=8,Wt.LINE_TO=16,Wt.CURVE_TO=32,Wt.SMOOTH_CURVE_TO=64,Wt.QUAD_TO=128,Wt.SMOOTH_QUAD_TO=256,Wt.ARC=512,Wt.LINE_COMMANDS=Wt.LINE_TO|Wt.HORIZ_LINE_TO|Wt.VERT_LINE_TO,Wt.DRAWING_COMMANDS=Wt.HORIZ_LINE_TO|Wt.VERT_LINE_TO|Wt.LINE_TO|Wt.CURVE_TO|Wt.SMOOTH_CURVE_TO|Wt.QUAD_TO|Wt.SMOOTH_QUAD_TO|Wt.ARC;let q=Wt;const _2={[q.MOVE_TO]:2,[q.LINE_TO]:2,[q.HORIZ_LINE_TO]:1,[q.VERT_LINE_TO]:1,[q.CLOSE_PATH]:0,[q.QUAD_TO]:4,[q.SMOOTH_QUAD_TO]:2,[q.CURVE_TO]:6,[q.SMOOTH_CURVE_TO]:4,[q.ARC]:7};function il([i,e],t){return[i*Math.cos(t)-e*Math.sin(t),i*Math.sin(t)+e*Math.cos(t)]}function zr(...i){for(let e=0;e<i.length;e++)if(typeof i[e]!="number")throw new Error(`assertNumbers arguments[${e}] is not a number. ${typeof i[e]} == typeof ${i[e]}`);return!0}const Ki=Math.PI;function nl(i,e,t){i.lArcFlag=i.lArcFlag===0?0:1,i.sweepFlag=i.sweepFlag===0?0:1;let{rX:r,rY:s}=i;const{x:o,y:u}=i;if(Math.abs(r)<1e-10||Math.abs(s)<1e-10){i.rX=0,i.rY=0,i.cX=(e+o)/2,i.cY=(t+u)/2,i.phi1=0,i.phi2=0;return}r=Math.abs(i.rX),s=Math.abs(i.rY);const h=i.xRot/180*Ki,[c,y]=il([(e-o)/2,(t-u)/2],-h),p=Math.pow(c,2)/Math.pow(r,2)+Math.pow(y,2)/Math.pow(s,2);1<p&&(r*=Math.sqrt(p),s*=Math.sqrt(p)),i.rX=r,i.rY=s;const A=Math.pow(r,2)*Math.pow(y,2)+Math.pow(s,2)*Math.pow(c,2),T=(i.lArcFlag!==i.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(s,2)-A)/A)),C=r*y/s*T,N=-s*c/r*T,O=il([C,N],h);i.cX=O[0]+(e+o)/2,i.cY=O[1]+(t+u)/2,i.phi1=Math.atan2((y-N)/s,(c-C)/r),i.phi2=Math.atan2((-y-N)/s,(-c-C)/r),i.sweepFlag===0&&i.phi2>i.phi1&&(i.phi2-=2*Ki),i.sweepFlag===1&&i.phi2<i.phi1&&(i.phi2+=2*Ki),i.phi1*=180/Ki,i.phi2*=180/Ki}function Ef(i,e,t){zr(i,e,t);const r=i*i+e*e-t*t;if(0>r)return[];if(r===0)return[[i*t/(i*i+e*e),e*t/(i*i+e*e)]];const s=Math.sqrt(r);return[[(i*t+e*s)/(i*i+e*e),(e*t-i*s)/(i*i+e*e)],[(i*t-e*s)/(i*i+e*e),(e*t+i*s)/(i*i+e*e)]]}const Sn=Math.PI/180;function Af(i,e,t){return(1-t)*i+t*e}function bf(i,e,t,r){return i+Math.cos(r/180*Ki)*e+Math.sin(r/180*Ki)*t}function wf(i,e,t,r){const o=e-i,u=t-e,h=r-t,c=3*o+3*h-6*u,y=(u-o)*6,p=3*o;return Math.abs(c)<1e-6?Math.abs(y)<1e-6?[]:[-p/y]:C2(y/c,p/c,1e-6)}function Tf(i,e,t,r,s){const o=1-s,u=o*o*o,h=3*o*o*s,c=3*o*s*s,y=s*s*s;return i*u+e*h+t*c+r*y}function C2(i,e,t=1e-6){const r=i*i/4-e;if(r<-t)return[];if(r<=t)return[-i/2];const s=Math.sqrt(r);return[-(i/2)-s,-(i/2)+s]}function D2(i,e,t){i.cX||nl(i,e,t);const r=i.xRot/180*Ki;if(Math.abs(i.rX)<1e-10||Math.abs(i.rY)<1e-10)return[{relative:i.relative,type:q.CURVE_TO,x1:e+(i.x-e)/3,y1:t+(i.y-t)/3,x2:e+2*(i.x-e)/3,y2:t+2*(i.y-t)/3,x:i.x,y:i.y}];const s=Math.min(i.phi1,i.phi2),o=Math.max(i.phi1,i.phi2),u=o-s,h=Math.ceil(u/90),c=new Array(h);let y=e,p=t;const A=(T,C)=>{const[N,O]=il([T*i.rX,C*i.rY],r);return[i.cX+N,i.cY+O]};for(let T=0;T<h;T++){const C=Af(i.phi1,i.phi2,T/h),N=Af(i.phi1,i.phi2,(T+1)/h),O=N-C,L=4/3*Math.tan(O*Sn/4),P=Math.cos(C*Sn)-L*Math.sin(C*Sn),W=Math.sin(C*Sn)+L*Math.cos(C*Sn),V=Math.cos(N*Sn),b=Math.sin(N*Sn),Y=V+L*b,z=b-L*V,j=A(P,W),tt=A(Y,z),Q=A(V,b),K={relative:i.relative,type:q.CURVE_TO,x:Q[0],y:Q[1],x1:j[0],y1:j[1],x2:tt[0],y2:tt[1]};i.relative&&(K.x1-=y,K.y1-=p,K.x2-=y,K.y2-=p,K.x-=y,K.y-=p),y=Q[0],p=Q[1],c[T]=K}return c}function sl(i,e,t){const r=e[0]-i[0],s=e[1]-i[1],o=t[0]-i[0],u=t[1]-i[1],h=r*u-s*o;if(!(Math.abs(h)<1e-10))return!1;const y=r*o+s*u,p=r*r+s*s,A=o*o+u*u;return 0<=y&&y<=A&&p<=A}function S2(i,e=!0){if(i.length<2)return i;const t=ae.INFO((o,u,h)=>{var c,y,p;return Ou(Vs({},o),{x:(c=o.x)!=null?c:u,y:(y=o.y)!=null?y:h,relative:(p=o.relative)!=null?p:!1})}),r=[];let s=[];for(const o of i){const u=t(o);u.type===q.MOVE_TO&&s.length>0&&(e?r.push(...vo(s)):r.unshift(...vo(s)),s=[]),s.push(u)}return s.length>0&&(e?r.push(...vo(s)):r.unshift(...vo(s))),r}function vo(i){var s;const e=((s=i[i.length-1])==null?void 0:s.type)===q.CLOSE_PATH,t=e?i.length-2:i.length-1,r=[{type:q.MOVE_TO,relative:!1,x:i[t].x,y:i[t].y}];for(let o=t;o>0;o--){const u=i[o],h=i[o-1];if(u.relative)throw new Error("Relative command are not supported convert first with `toAbs()`");switch(u.type){case q.HORIZ_LINE_TO:r.push({type:q.HORIZ_LINE_TO,relative:!1,x:h.x});break;case q.VERT_LINE_TO:r.push({type:q.VERT_LINE_TO,relative:!1,y:h.y});break;case q.LINE_TO:case q.MOVE_TO:r.push({type:q.LINE_TO,relative:!1,x:h.x,y:h.y});break;case q.CURVE_TO:r.push({type:q.CURVE_TO,relative:!1,x:h.x,y:h.y,x1:u.x2,y1:u.y2,x2:u.x1,y2:u.y1});break;case q.SMOOTH_CURVE_TO:throw new Error("Unsupported command: S (smooth cubic bezier)");case q.SMOOTH_QUAD_TO:throw new Error("Unsupported command: T (smooth quadratic bezier)");case q.ARC:throw new Error("Unsupported command: A (arc)");case q.QUAD_TO:throw new Error("Unsupported command: Q (quadratic bezier)")}}return e&&r.push({type:q.CLOSE_PATH}),r}function O2(i=1e13){zr(i);function e(t){return Math.round(t*i)/i}return function(r){return"x1"in r&&typeof r.x1!="undefined"&&(r.x1=e(r.x1)),"y1"in r&&typeof r.y1!="undefined"&&(r.y1=e(r.y1)),"x2"in r&&typeof r.x2!="undefined"&&(r.x2=e(r.x2)),"y2"in r&&typeof r.y2!="undefined"&&(r.y2=e(r.y2)),"x"in r&&typeof r.x!="undefined"&&(r.x=e(r.x)),"y"in r&&typeof r.y!="undefined"&&(r.y=e(r.y)),"rX"in r&&typeof r.rX!="undefined"&&(r.rX=e(r.rX)),"rY"in r&&typeof r.rY!="undefined"&&(r.rY=e(r.rY)),r}}function _f(){return $r((i,e,t)=>(i.relative&&(typeof i.x1!="undefined"&&(i.x1+=e),typeof i.y1!="undefined"&&(i.y1+=t),typeof i.x2!="undefined"&&(i.x2+=e),typeof i.y2!="undefined"&&(i.y2+=t),typeof i.x!="undefined"&&(i.x+=e),typeof i.y!="undefined"&&(i.y+=t),i.relative=!1),i))}function M2(){return $r((i,e,t)=>(i.relative||(typeof i.x1!="undefined"&&(i.x1-=e),typeof i.y1!="undefined"&&(i.y1-=t),typeof i.x2!="undefined"&&(i.x2-=e),typeof i.y2!="undefined"&&(i.y2-=t),typeof i.x!="undefined"&&(i.x-=e),typeof i.y!="undefined"&&(i.y-=t),i.relative=!0),i))}function L2(i=!0,e=!0,t=!0,r=!0){return $r((s,o,u,h,c)=>{if(isNaN(h)&&!(s.type&q.MOVE_TO))throw new Error("path must start with moveto");if(e&&s.type&q.HORIZ_LINE_TO&&(s.type=q.LINE_TO,s.y=s.relative?0:u),t&&s.type&q.VERT_LINE_TO&&(s.type=q.LINE_TO,s.x=s.relative?0:o),i&&s.type&q.CLOSE_PATH&&(s.type=q.LINE_TO,s.x=s.relative?h-o:h,s.y=s.relative?c-u:c),s.type&q.ARC&&(s.rX===0||s.rY===0)&&(s.type=q.LINE_TO,delete s.rX,delete s.rY,delete s.xRot,delete s.lArcFlag,delete s.sweepFlag),r&&s.type&q.QUAD_TO){const y=[o,u],p=s.relative?[o+s.x1,u+s.y1]:[s.x1,s.y1],A=s.relative?[o+s.x,u+s.y]:[s.x,s.y];sl(y,p,A)&&(s.type=q.LINE_TO,delete s.x1,delete s.y1)}if(r&&s.type&q.CURVE_TO){const y=[o,u],p=s.relative?[o+s.x1,u+s.y1]:[s.x1,s.y1],A=s.relative?[o+s.x2,u+s.y2]:[s.x2,s.y2],T=s.relative?[o+s.x,u+s.y]:[s.x,s.y];sl(y,p,T)&&sl(y,A,T)&&(s.type=q.LINE_TO,delete s.x1,delete s.y1,delete s.x2,delete s.y2)}return s})}function Cf(){let i=NaN,e=NaN,t=NaN,r=NaN;return $r((s,o,u)=>(s.type&q.SMOOTH_CURVE_TO&&(s.type=q.CURVE_TO,i=isNaN(i)?o:i,e=isNaN(e)?u:e,s.x1=s.relative?o-i:2*o-i,s.y1=s.relative?u-e:2*u-e),s.type&q.CURVE_TO?(i=s.relative?o+s.x2:s.x2,e=s.relative?u+s.y2:s.y2):(i=NaN,e=NaN),s.type&q.SMOOTH_QUAD_TO&&(s.type=q.QUAD_TO,t=isNaN(t)?o:t,r=isNaN(r)?u:r,s.x1=s.relative?o-t:2*o-t,s.y1=s.relative?u-r:2*u-r),s.type&q.QUAD_TO?(t=s.relative?o+s.x1:s.x1,r=s.relative?u+s.y1:s.y1):(t=NaN,r=NaN),s))}function Df(){let i=NaN,e=NaN;return $r((t,r,s)=>{if(t.type&q.SMOOTH_QUAD_TO&&(t.type=q.QUAD_TO,i=isNaN(i)?r:i,e=isNaN(e)?s:e,t.x1=t.relative?r-i:2*r-i,t.y1=t.relative?s-e:2*s-e),t.type&q.QUAD_TO){i=t.relative?r+t.x1:t.x1,e=t.relative?s+t.y1:t.y1;const o=t.x1,u=t.y1;t.type=q.CURVE_TO,t.x1=((t.relative?0:r)+o*2)/3,t.y1=((t.relative?0:s)+u*2)/3,t.x2=(t.x+o*2)/3,t.y2=(t.y+u*2)/3}else i=NaN,e=NaN;return t})}function $r(i){let e=0,t=0,r=NaN,s=NaN;return function(u){if(isNaN(r)&&!(u.type&q.MOVE_TO))throw new Error("path must start with moveto");const h=i(u,e,t,r,s);return u.type&q.CLOSE_PATH&&(e=r,t=s),"x"in u&&typeof u.x!="undefined"&&(e=u.relative?e+u.x:u.x),"y"in u&&typeof u.y!="undefined"&&(t=u.relative?t+u.y:u.y),u.type&q.MOVE_TO&&(r=e,s=t),h}}function N2(i=0){zr(i);let e=NaN,t=NaN,r=NaN,s=NaN;return $r((o,u,h,c,y)=>{const p=Math.abs;let A=!1,T=0,C=0;if(o.type&q.SMOOTH_CURVE_TO&&(T=isNaN(e)?0:u-e,C=isNaN(t)?0:h-t),o.type&(q.CURVE_TO|q.SMOOTH_CURVE_TO)?(e=o.relative?u+o.x2:o.x2,t=o.relative?h+o.y2:o.y2):(e=NaN,t=NaN),o.type&q.SMOOTH_QUAD_TO?(r=isNaN(r)?u:2*u-r,s=isNaN(s)?h:2*h-s):o.type&q.QUAD_TO?(r=o.relative?u+o.x1:o.x1,s=o.relative?h+o.y1:o.y2):(r=NaN,s=NaN),o.type&q.LINE_COMMANDS||o.type&q.ARC&&(o.rX===0||o.rY===0||!o.lArcFlag)||o.type&q.CURVE_TO||o.type&q.SMOOTH_CURVE_TO||o.type&q.QUAD_TO||o.type&q.SMOOTH_QUAD_TO){const N=typeof o.x=="undefined"?0:o.relative?o.x:o.x-u,O=typeof o.y=="undefined"?0:o.relative?o.y:o.y-h;T=isNaN(r)?typeof o.x1=="undefined"?T:o.relative?o.x:o.x1-u:r-u,C=isNaN(s)?typeof o.y1=="undefined"?C:o.relative?o.y:o.y1-h:s-h;const L=typeof o.x2=="undefined"?0:o.relative?o.x:o.x2-u,P=typeof o.y2=="undefined"?0:o.relative?o.y:o.y2-h;p(N)<=i&&p(O)<=i&&p(T)<=i&&p(C)<=i&&p(L)<=i&&p(P)<=i&&(A=!0)}return o.type&q.CLOSE_PATH&&p(u-c)<=i&&p(h-y)<=i&&(A=!0),A?[]:o})}function ji(i,e,t,r,s,o){return zr(i,e,t,r,s,o),$r((u,h,c,y)=>{const p=u.x1,A=u.x2,T=u.relative&&!isNaN(y),C=typeof u.x!="undefined"?u.x:T?0:h,N=typeof u.y!="undefined"?u.y:T?0:c;u.type&q.HORIZ_LINE_TO&&e!==0&&(u.type=q.LINE_TO,u.y=u.relative?0:c),u.type&q.VERT_LINE_TO&&t!==0&&(u.type=q.LINE_TO,u.x=u.relative?0:h),typeof u.x!="undefined"&&(u.x=u.x*i+N*t+(T?0:s)),typeof u.y!="undefined"&&(u.y=C*e+u.y*r+(T?0:o)),typeof u.x1!="undefined"&&(u.x1=u.x1*i+u.y1*t+(T?0:s)),typeof u.y1!="undefined"&&(u.y1=p*e+u.y1*r+(T?0:o)),typeof u.x2!="undefined"&&(u.x2=u.x2*i+u.y2*t+(T?0:s)),typeof u.y2!="undefined"&&(u.y2=A*e+u.y2*r+(T?0:o));function O(P){return P*P}const L=i*r-e*t;if(typeof u.xRot!="undefined"&&(i!==1||e!==0||t!==0||r!==1))if(L===0)delete u.rX,delete u.rY,delete u.xRot,delete u.lArcFlag,delete u.sweepFlag,u.type=q.LINE_TO;else{const P=u.xRot*Math.PI/180,W=Math.sin(P),V=Math.cos(P),b=1/O(u.rX),Y=1/O(u.rY),z=O(V)*b+O(W)*Y,j=2*W*V*(b-Y),tt=O(W)*b+O(V)*Y,Q=z*r*r-j*e*r+tt*e*e,K=j*(i*r+e*t)-2*(z*t*r+tt*i*e),rt=z*t*t-j*i*t+tt*i*i,at=(Math.atan2(K,Q-rt)+Math.PI)%Math.PI/2,ct=Math.sin(at),pt=Math.cos(at);u.rX=Math.abs(L)/Math.sqrt(Q*O(pt)+K*ct*pt+rt*O(ct)),u.rY=Math.abs(L)/Math.sqrt(Q*O(ct)-K*ct*pt+rt*O(pt)),u.xRot=at*180/Math.PI}return typeof u.sweepFlag!="undefined"&&0>L&&(u.sweepFlag=+!u.sweepFlag),u})}function B2(i,e=0,t=0){zr(i,e,t);const r=Math.sin(i),s=Math.cos(i);return ji(s,r,-r,s,e-e*s+t*r,t-e*r-t*s)}function I2(i,e=0){return zr(i,e),ji(1,0,0,1,i,e)}function R2(i,e=i){return zr(i,e),ji(i,0,0,e,0,0)}function P2(i){return zr(i),ji(1,0,Math.tan(i),1,0,0)}function F2(i){return zr(i),ji(1,Math.tan(i),0,1,0,0)}function k2(i=0){return zr(i),ji(-1,0,0,1,i,0)}function H2(i=0){return zr(i),ji(1,0,0,-1,0,i)}function U2(){return $r((i,e,t)=>q.ARC===i.type?D2(i,i.relative?0:e,i.relative?0:t):i)}function q2(){return $r((i,e,t)=>(i.relative&&(e=0,t=0),q.ARC===i.type&&nl(i,e,t),i))}function Sf(){return i=>Vs({},i)}function V2(){const i=Sf(),e=_f(),t=Df(),r=Cf(),s=$r((o,u,h)=>{const c=r(t(e(i(o))));function y(A){A>s.maxX&&(s.maxX=A),A<s.minX&&(s.minX=A)}function p(A){A>s.maxY&&(s.maxY=A),A<s.minY&&(s.minY=A)}if(c.type&q.DRAWING_COMMANDS&&(y(u),p(h)),c.type&q.HORIZ_LINE_TO&&y(c.x),c.type&q.VERT_LINE_TO&&p(c.y),c.type&q.LINE_TO&&(y(c.x),p(c.y)),c.type&q.CURVE_TO){y(c.x),p(c.y);const A=wf(u,c.x1,c.x2,c.x);for(const C of A)0<C&&1>C&&y(Tf(u,c.x1,c.x2,c.x,C));const T=wf(h,c.y1,c.y2,c.y);for(const C of T)0<C&&1>C&&p(Tf(h,c.y1,c.y2,c.y,C))}if(c.type&q.ARC){y(c.x),p(c.y),nl(c,u,h);const A=c.xRot/180*Math.PI,T=Math.cos(A)*c.rX,C=Math.sin(A)*c.rX,N=-Math.sin(A)*c.rY,O=Math.cos(A)*c.rY,[L,P]=c.phi1<c.phi2?[c.phi1,c.phi2]:-180>c.phi2?[c.phi2+360,c.phi1+360]:[c.phi2,c.phi1],W=([Y,z])=>{const tt=Math.atan2(z,Y)*180/Math.PI;return tt<L?tt+360:tt},V=Ef(N,-T,0).map(W);for(const Y of V)Y>L&&Y<P&&y(bf(c.cX,T,N,Y));const b=Ef(O,-C,0).map(W);for(const Y of b)Y>L&&Y<P&&p(bf(c.cY,C,O,Y))}return o});return s.minX=1/0,s.maxX=-1/0,s.minY=1/0,s.maxY=-1/0,s}const ae={ROUND:O2,TO_ABS:_f,TO_REL:M2,NORMALIZE_HVZ:L2,NORMALIZE_ST:Cf,QT_TO_C:Df,INFO:$r,SANITIZE:N2,MATRIX:ji,ROTATE:B2,TRANSLATE:I2,SCALE:R2,SKEW_X:P2,SKEW_Y:F2,X_AXIS_SYMMETRY:k2,Y_AXIS_SYMMETRY:H2,A_TO_C:U2,ANNOTATE_ARCS:q2,CLONE:Sf,CALCULATE_BOUNDS:V2,REVERSE_PATH:S2};class Gr{static destroy(){this.cached.clear(),this.cachedCanvas.clear()}static createCanvas(e){var s;if(!((s=Vt.window)!=null&&s.document))throw new Error("environment not support");let t;e.containerId&&(t=Vt.window.document.getElementById(e.containerId)),t||(t=Vt.window.document.getElementsByTagName("body")[0]);let r;if(e.canvasId&&(r=Vt.window.document.getElementById(e.canvasId)||void 0),e.width||(e.width=(t==null?void 0:t.offsetWidth)||100),e.height||(e.height=(t==null?void 0:t.offsetHeight)||100),e.dpr||(e.dpr=Vt.dpr),r)this.resizeCanvas(r,e.width,e.height,e.dpr);else{if(r=this.createHtmlCanvas(e.width,e.height,e.dpr),!r)throw new Error("error environment");e.canvasId&&r.setAttribute("id",e.canvasId),t==null||t.appendChild(r)}return r.style.background=e.background||"transparent",r}static getContext2D(e,t={}){const r={alpha:!0,willReadFrequently:!!t.willReadFrequently},s=e.getContext("2d",r);if(!s)throw new Error("getContext2D error");return s.scale(t.dpr||1,t.dpr||1),s}static resizeCanvas(e,t,r,s=1){e instanceof OffscreenCanvas?(e.width=t,e.height=r):e instanceof HTMLCanvasElement&&(e.setAttribute("width",(t*s).toString()),e.setAttribute("height",(r*s).toString()),e.style.width=t+"px",e.style.height=r+"px",e.style.padding="0",e.style.margin="0",e.style.border="0",e.style.imageRendering="pixelated",e.style.transform="translateZ(0)")}static getImageBitmapByCanvasAsync(e){return Tt(this,null,function*(){if(e)return e instanceof OffscreenCanvas?e.transferToImageBitmap():e instanceof HTMLCanvasElement?yield createImageBitmap(e):void 0})}static get(e,t,r,s=1){let o=this.cached.get(e);return o||(o=this.create(t,r,s),this.set(e,o)),this.resizeCanvas(o,t,r,s),o}static set(e,t){if(!e||!t)throw new Error("error input");return this.cached.set(e,t)}static remove(e){this.cached.has(e)&&this.cached.delete(e)}static create(e,t,r=1){var s;if((s=Vt.window)!=null&&s.OffscreenCanvas)return new OffscreenCanvas(e,t);throw new Error("environment does not support")}static createHtmlCanvas(e,t,r=1){if(!Vt.window.document)throw new Error("environment does not support");const s=Vt.window.document.createElement("canvas");return this.resizeCanvas(s,e,t,r),s}static measureText(e,t,r=new k){if(!e)throw new Error("input error");const o=this.get("measureText",1,1).getContext("2d");if(!o)throw new Error("bufferCtx not found");t.render(o);const u=o.measureText(e);if(!u)throw new Error("measureText error");const h=u.actualBoundingBoxRight+u.actualBoundingBoxLeft,c=u.actualBoundingBoxAscent+u.actualBoundingBoxDescent;return r.set(h,c),r}}d(Gr,"cached",new Map),d(Gr,"cachedCanvas",new Map);let W2=0;class xo extends I{constructor(t={}){var r;super(t.commands);d(this,"name","Geo2");d(this,"id",++W2);d(this,"params");d(this,"viewMatrix",new ce);d(this,"boundingBox",new Ot);d(this,"flipY",!1);d(this,"renderPath");d(this,"_version",0);typeof t.flipY!="undefined"&&(this.flipY=!!t.flipY),this.params=t,(r=this.commands)!=null&&r.length&&this.toAbs(),t.flipY&&this.scale(1,-1)}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(),yt.identity();for(let r=0,s=((t=this.commands)==null?void 0:t.length)||0;r<s;r++){const o=this.commands[r];switch(o.type){case I.MOVE_TO:this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case I.LINE_TO:this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case I.ARC:typeof o.xRot=="undefined"?(this.boundingBox.expandByXY(o.x,o.y),Ci.set(o.x,o.y).addScalar(-o.rX),this.boundingBox.expandByPoint(Ci),Ci.set(o.x,o.y).addScalar(o.rX),this.boundingBox.expandByPoint(Ci)):this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case I.HORIZ_LINE_TO:this.boundingBox.expandByXY(o.x,yt.y),yt.set(o.x,yt.y);break;case I.VERT_LINE_TO:this.boundingBox.expandByXY(yt.x,o.y),yt.set(yt.x,o.y);break;case I.QUAD_TO:this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break}}return this.boundingBox}render(t,r){if(this.renderPath=new Path2D,!(!t||!(r!=null&&r.length))){yt.identity();for(let s=0,o=(r==null?void 0:r.length)||0;s<o;s++){const u=r[s];switch(u.type){case I.MOVE_TO:this.renderPath.moveTo(u.x,u.y),yt.set(u.x,u.y);break;case I.LINE_TO:this.renderPath.lineTo(u.x,u.y),yt.set(u.x,u.y);break;case I.ARC:this.renderPath.arc(u.x,u.y,u.rX,u.phi1||0,u.phi2||Math.PI*2,u.sweepFlag!==1),yt.set(u.x,u.y);break;case I.HORIZ_LINE_TO:this.renderPath.lineTo(u.x,yt.y),yt.set(u.x,yt.y);break;case I.VERT_LINE_TO:this.renderPath.lineTo(yt.x,u.y),yt.set(yt.x,u.y);break;case I.CURVE_TO:this.renderPath.bezierCurveTo(u.x1,u.y1,u.x2,u.y2,u.x,u.y),yt.set(u.x,u.y);break;case I.SMOOTH_CURVE_TO:yt.set(u.x,u.y);break;case I.QUAD_TO:yt.set(u.x,u.y);break;case I.SMOOTH_QUAD_TO:yt.set(u.x,u.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 u;const r=[];for(let h=0,c=((u=this.commands)==null?void 0:u.length)||0;h<c;h++)r.push(Object.assign({},this.commands[h]));if(!t)return r;yt.identity();const s=ae.MATRIX(t.elements[0],t.elements[1],t.elements[3],t.elements[4],t.elements[6],t.elements[7]),o=[];for(let h=0,c=r.length;h<c;h++){const y=r[h],p=s(y);if(p.type===I.ARC){let[A,T,C,N,O,L,P,W]=J0(yt.x,yt.y,p.x,p.y,p.lArcFlag,p.sweepFlag,p.rX,p.rY,0);if(yt.set(p.x,p.y),p.rX===p.rY&&typeof p.xRot!="undefined")p.x=A,p.y=T,p.rx=C>N?C:N,p.phi1=O,p.phi2=O+L;else if(p.rX===p.rY)t.getScale(Ci),p.rX=p.rY*Math.abs(Ci.x),(p.phi1!==0||p.phi2!==Math.PI*2)&&(t.getRotation(Ci),p.phi1+=Ci.x,p.phi2+=Ci.x);else{const V=t2(A,T,C,N,O,L,P);if(!(V!=null&&V.length))break;p.type=I.MOVE_TO,p.x=A,p.y=T;for(let b=0,Y=V.length;b<Y;b++)o.push({type:I.CURVE_TO,x1:V[b][1][0],y1:V[b][1][1],x2:V[b][2][0],y2:V[b][2][1],x:V[b][3][0],y:V[b][3][1]})}}else yt.set(p.x||yt.x,p.y||yt.y);Array.isArray(p)?o.push(...p):o.push(p)}return o}copy(t){return this.commands=Rt.cloneDeep(t.commands),this.version=0,this}clone(){const t=this.constructor;return new t(this.params).copy(this)}getConvexHull(){var r,s;const t=[];if(!((r=this.commands)!=null&&r.length))return t;for(let o=0,u=((s=this.commands)==null?void 0:s.length)||0;o<u;o++){const h=this.commands[o];switch(h.type){case I.MOVE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case I.LINE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case I.ARC:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case I.HORIZ_LINE_TO:t.push({x:h.x,y:yt.y}),yt.set(h.x,yt.y);break;case I.VERT_LINE_TO:t.push({x:yt.x,y:h.y}),yt.set(yt.x,h.y);break;case I.CURVE_TO:case I.SMOOTH_CURVE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case I.QUAD_TO:case I.SMOOTH_QUAD_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break}}return t}isPointInBoundingBox(t){return this.boundingBox?this.boundingBox.containsPoint(t):!1}isPointInPath(t){if(this.renderPath){Ji.save(),Ji.beginPath(),Ji.lineWidth=5,Ji.stroke(this.renderPath),Ji.fill(this.renderPath),Ji.closePath();const r=Ji.isPointInPath(this.renderPath,t.x,t.y);return Ji.restore(),r}return!1}}const yt=new k,Ci=new k,Ji=Gr.get("RAY_CASTER",10,10).getContext("2d");class z2 extends xo{constructor(t={}){t.commands||(t.commands=[]);super(t);d(this,"isCircle",!0);d(this,"radius",1);d(this,"start",0);d(this,"end",Math.PI*2);typeof t.radius!="undefined"&&(this.radius=t.radius),typeof t.start!="undefined"&&(this.start=t.start),typeof t.end!="undefined"&&(this.end=t.end),this.recomputePath()}recomputePath(){var s,o,u;if(!((o=(s=this.params)==null?void 0:s.points)!=null&&o.length))return this;const t=this.params.points,r=[];for(let h=0,c=t.length;h<c;h++)r.push({type:I.MOVE_TO,x:t[h].x+this.radius,y:t[h].y*(this.params.flipY?-1:1),relative:!1}),r.push({type:I.ARC,rX:this.radius,rY:this.radius,xRot:void 0,lArcFlag:0,sweepFlag:((u=this.params)==null?void 0:u.sweepFlag)||1,phi1:this.start,phi2:this.end,x:t[h].x,y:t[h].y*(this.params.flipY?-1:1),relative:!1});return this.commands=r,this}}class Of{constructor(e={}){d(this,"params");this.params=e}destroy(){}static getInstanceByElement(e,t=!1){if(!e)return;let r;switch(e.nodeName){case"path":r=this.getInstanceByPath(e,t);break;case"circle":r=this.getInstanceByCircle(e,t);break}return r||console.error(`unsupported: ${e}`),r}static getInstanceByPath(e,t=!1){if(!e)return;const r=pa(e,"d");if(!r)return;const s=r.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,""),o=s.match(/([Mm][^Mm]*)/g);if(!o||o.length<=this.splitLimit)try{return new xo({commands:s,flipY:t})}catch(h){console.error(`getInstanceByPath error: ${h}: ${s}`);return}const u=[];for(let h=0,c=o.length;h<c;h+=this.splitLimit){const p=o.slice(h,h+this.splitLimit).join(" ");try{u.push(new xo({commands:p,flipY:t}))}catch(A){console.error(`getInstanceByPath error: ${A}`)}}return u}static getInstanceByCircle(e,t=!1){if(!e||e.nodeName!=="circle")return;Mf.set(pa(e,"cx",0),pa(e,"cy",0));const r=pa(e,"r",0);return new z2({points:[Mf.clone()],radius:r,flipY:t})}static getInstance(e,t=!1){if(e)return new xo({commands:e,flipY:t})}}d(Of,"splitLimit",100);const Mf=new k;class $2{constructor(){d(this,"svg");d(this,"offset",new k);d(this,"svgRoot");d(this,"layers",[]);d(this,"elementsMap",{});d(this,"boundingBoxMap",{});d(this,"boundingBox",new Ot);d(this,"svgSkeletons",[]);d(this,"data");d(this,"_exceptTypes",["view"]);d(this,"_exceptIds",["viewer","mirror"]);d(this,"_lvi",0);d(this,"_lastLinked",[])}bindSvg(e){return this.svg=e,this.svgRoot=Zc(this.svg),this.layers=this.getLayers(2),this.elementsMap={},this.boundingBoxMap={},this.boundingBox.makeEmpty(),this.getElementsMap(this.svg,this.elementsMap),this}getLayers(e){var t;if(!this.svg)throw new Error("please bind svg first");return e===2&&((t=this.layers)!=null&&t.length)?this.layers:(this.layers=this._getSvgLayer(this.svg,e),this.layers)}_getSvgLayer(e,t=0,r=0,s=[]){var h;let o,u=e.id;if(this._exceptTypes.includes(e.tagName)||e.tagName==="defs")return this._lvi--,s;if(t&&this._lvi>t)return s;u&&!this._exceptIds.includes(u)&&(o={value:u,label:u,children:[]},s.push(o)),this._lvi++;for(let c=0,y=e.children.length;c<y;c++)o?this._getSvgLayer(e.children[c],t,this._lvi,o.children):this._getSvgLayer(e.children[c],t,this._lvi,s);return((h=o==null?void 0:o.children)==null?void 0:h.length)===0&&delete o.children,this._lvi=r,s}getElementsMap(e,t={}){return this.traverseSvg(e,r=>{r!==e&&r.id&&(t[r.id]=r)}),t}computeBoundingBoxMap(){var t;if(Object.keys(this.boundingBoxMap).length)return this.boundingBoxMap;let e=(t=this.svg)==null?void 0:t.getBoundingClientRect();return e&&this.offset.set(e.left,e.top),this.traverseSvg(this.svg,r=>{if(!r.id)return;if(r.tagName==="use"){const u=this.getUseSymbolId(r);if(!u)return;const h=this.boundingBoxMap[u];if(h&&!h.isEmpty()){Di.set(Number(r.getAttribute("x")||"0"),Number(r.getAttribute("y")||"0")),Eo.composeSvgTransform(Di.x,Di.y,r.getAttribute("transform"));const p=new Ot().copy(h).applyMatrix3(Eo);this.boundingBoxMap[r.id]=p;return}const c=this.getUseElementBoundingBoxWithSymbol(r);if(!c)return;this.boundingBoxMap[u]=c,Di.set(Number(r.getAttribute("x")||"0"),Number(r.getAttribute("y")||"0")),Eo.composeSvgTransform(Di.x,Di.y,r.getAttribute("transform"));const y=new Ot().copy(c).applyMatrix3(Eo);this.boundingBoxMap[r.id]=y,this.boundingBox.expandByBox(y);return}if(typeof r.getBBox!="function")return;const s=r.getBBox();if((!s.width||!s.height)&&r.tagName==="path"){const u=Of.getInstanceByPath(r);if(!Array.isArray(u)){const h=u==null?void 0:u.computeBoundingBox();if(!h||h.isEmpty())return;h.getSize(Di),s.x=h.min.x,s.y=h.max.y,s.width=Di.x,s.height=Di.y}}if(!s.width||!s.height)return;const o=new Ot(new k(s.x,s.y),new k(s.x+s.width,s.y+s.height));this.boundingBoxMap[r.id]=o.round(),this.boundingBox.expandByBox(o)}),this.boundingBoxMap}getLayerVisible(e){var r;const t=this.getElementById(e);if(t)return((r=t.style)==null?void 0:r.display)!=="none"}updateLayersVisibility(e,t=!1,r=!0){if(!this.elementsMap)throw new Error("please bind svg first");r&&this._updateAllLayersVisibility(!t),e!=null&&e.length||(e=["background"]);for(let s=0,o=e.length;s<o;s++){const u=this.getElementById(e[s]);u&&this._updateLayersVisibility(u,t,!0,!0)}}_updateAllLayersVisibility(e=!1){Object.values(this.elementsMap).forEach(t=>{t.tagName==="svg"||t.tagName==="symbol"||!t.getAttribute("id")||(t.style.display=e?"block":"none")})}_updateLayersVisibility(e,t=!1,r=!1,s=!1){var o,u;if(!(!e||e.tagName==="svg"||!e.getAttribute("id"))){if(e.style.display=t?"block":"none",r&&t){let h=e.parentElement;for(;h&&h.tagName!=="svg";)h.style.display=t?"block":"none",h=h.parentElement}if(s&&((o=e.children)==null?void 0:o.length)>0)for(let h=0,c=(u=e.children)==null?void 0:u.length;h<c;h++)this._updateLayersVisibility(e.children[h],t,!1,!0)}}updateVisibilityByAssetType(e,t=!1,r){r||(r=Yc[e]),this.updateLayersVisibility(r,!t)}updateVisibilityByAssetTypes(e,t=!1,r){if(Array.isArray(e)||(e=[e]),!!(e!=null&&e.length))for(let s=0,o=e.length;s<o;s++)this.updateVisibilityByAssetType(e[s],t,r)}getElementById(e){if(!this.elementsMap)throw new Error("please bind svg first");return this.elementsMap[e]}getElementBoundingBox(e){return this.boundingBoxMap[e]}findSkeletonByPath(e=[]){let t=0,r;const s=Object.keys(this.elementsMap);for(let o=0,u=s.length;o<u;o++){const h=this.elementsMap[s[o]];if(!h)continue;const c=h.getAttribute("d");c&&(c.length<t||(t=c.length,r=h.id?h:h.parent))}return r&&e.push(r),e}setTextInChildren2(e,t){var s;let r;((s=e==null?void 0:e.children)==null?void 0:s.length)<2?(r=Xu("text"),r.setAttribute("dy","1em"),e.appendChild(r)):r=e.children[e.children.length-1],r.innerHTML=t}traverseSvg(e,t){var r;if(!this._exceptTypes.includes(e.tagName)&&!(e.tagName!=="svg"&&e.tagName!=="defs"&&!e.id)&&!(e.tagName==="g"&&((r=e.children)==null?void 0:r.length)===0)){this._exceptIds.includes(e.id)||t(e);for(let s=0,o=e.children.length;s<o;s++)this.traverseSvg(e.children[s],t)}}traverseSvgTLayers(e,t){var r;if(Array.isArray(e)){for(let s=0,o=e.length;s<o;s++)this.traverseSvgTLayers(e[s],t);return}if(t(e),!!((r=e.children)!=null&&r.length))for(let s=0,o=e.children.length;s<o;s++)this.traverseSvgTLayers(e.children[s],t)}getLabelElementsByType(e,t={}){const r=this.getElementById(la(e));return r&&this.getElementsMap(r,t),t}getLabelElementById(e,t="rm"){if(!e)return;const r=this.getElementById(e);if(!r)return;let s=r.getAttribute("aid");return s||(s="l-"+t+"-"+e),this.getElementById(s)}setLabelsById(e,t,r="rm"){var u,h;const s=this.getLabelElementById(e,r);if(!s)return;const o=((u=s.children)==null?void 0:u.length)||0;for(let c=0,y=((t==null?void 0:t.length)||0)-(o-1);c<y;c++){const p=Xu("text");p.setAttribute("x","0"),p.setAttribute("y",o+c+"em"),s.appendChild(p)}for(let c=1,y=(h=s.children)==null?void 0:h.length;c<y;c++)s.children[c].textContent=t&&c<=t.length?t[c-1]:""}clearAssetLabelsByType(e="rm"){var s;const t=this.getLabelElementsByType(e),r=Rt.keys(t);for(let o=0,u=r.length;o<u;o++){const h=t[r[o]];for(let c=1,y=((s=h.children)==null?void 0:s.length)||0;c<y;c++)h.children[c].textContent=""}}getUseSymbolId(e){var t;if(!(!e||e.tagName!=="use"))return(t=e.getAttribute("xlink:href"))==null?void 0:t.substring(1)}getUseSymbol(e){if(!e||e.tagName!=="use")return;const t=this.getUseSymbolId(e);if(t)return this.getElementById(t)}setElementState2selected(e,t=!1){var s;if(!e)return;if(e.tagName==="use"){const o=this._getSymbolBox(e);if(!o)return;t?(s=e.parentNode)==null||s.insertBefore(o,e):e.parentNode&&e.parentNode.contains(o)&&e.parentNode.removeChild(o);return}let r=e.getAttribute("class");r||(r=""),t?r="danger":r=Rt.replace(r,"danger","").trim(),e.setAttribute("class",r)}_getSymbolBox(e){if(!e)return;const t=e.id+"-boundingBox";let r=this.getElementById(t);if(r)return r;const s=this.getUseSymbol(e);if(!s)return;let o=this.getElementBoundingBox(e.id);if(!o||o.isEmpty())return;r=document.createElementNS("http://www.w3.org/2000/svg","rect"),r.setAttribute("id",t),r.setAttribute("class","danger"),r.setAttribute("x",o.min.x.toString()),r.setAttribute("y",o.min.y.toString());const u=new k;return o.getSize(u),r.setAttribute("width",u.x.toString()),r.setAttribute("height",u.y.toString()),s.getAttribute("transform")&&r.setAttribute("transform",s.getAttribute("transform")||""),s.getAttribute("style")&&r.setAttribute("style",s.getAttribute("style")||""),this.elementsMap[t]=r,r}getUseElementBoundingBoxWithSymbol(e){var c;if(!e)return;const t=(c=e.getAttribute("xlink:href"))==null?void 0:c.substring(1);if(!t)return;let r=this.getElementById(t);if(!r)return;const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px";let o;if(Rt.lowerCase(r.tagName)==="symbol"){o=document.createElementNS("http://www.w3.org/2000/svg","g");for(let y=0,p=r.childNodes.length;y<p;y++){const A=r.childNodes[y].cloneNode(!0);o.appendChild(A)}}else o=r.cloneNode(!0);s.appendChild(o),o.setAttribute("style","stroke: #333333;"),document.body.appendChild(s);const u=s.getBBox();if(document.body.removeChild(s),!u)return;const h=new Ot;return h.set(new k(u.x,u.y),new k(u.x+u.width,u.y+u.height)),h}fontZoom(e,t=1){const r=this.getElementById(e);if(!r)return;let s=r.getAttribute("font-size");s||(s="12");const o=/(\d+)([a-zA-Z%]+)/.exec(s),u=o&&(o==null?void 0:o.length)>2?o[2]:"";let h=Math.round(parseFloat(s)*t*100)/100;r.setAttribute("font-size",h+u)}strokeWidthChanged(e=1){var y,p;const t=(y=this.svg)==null?void 0:y.querySelector("#mirror");if(!t){console.error("Cannot find g SVGElement with ID mirror");return}let r=(p=pa(t,"stroke-width"))!=null?p:"1em";const s=String(r).match(/^([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(%|[a-z]*)$/i);if(!s){console.error("Invalid stroke-width format:",r);return}const o=parseFloat(s[1]),u=s[2]||"em",h=o*e,c=Number.isInteger(h)?h.toFixed(0):h.toString().replace(/\.?0+$/,"");t.setAttribute("stroke-width",`${c}${u}`),u==="em"&&(t.style.fontSize=`${c}${u}`)}getCentroid(e,t=new k){const r=e.getAttribute("insX"),s=e.getAttribute("insY");return r||s?t.set(Number(r||"0"),Number(s||"0")):this.getCentroidByDom(e,t)}getCentroidByDom(e,t=new k){const r=Number(e.getAttribute("x")||"0"),s=Number(e.getAttribute("y")||"0"),o=e.getBBox();let u=1,h=1,c=e.getAttribute("transform");if(!c)return t.set(r,s);const y=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(c);if(typeof y=="undefined"||y==null){const p=e.transform.baseVal;if(c&&p.numberOfItems>0){let A=p.getItem(0);A&&A.type===SVGTransform.SVG_TRANSFORM_SCALE&&(u=A.matrix.a!==0?A.matrix.a:1,h=A.matrix.d!==0?A.matrix.d:u)}else return t.set((o.x+o.width/2)*u,(o.y+o.height/2)*h)}else u=y[1]&&Number(y[1])>0?Number(y[1]):1,h=y[2]&&Number(y[2])>0?Number(y[2]):u;return r&&s?t.set(r*u,s*h):t.set((o.x+o.width/2)*u,(o.y+o.height/2)*h),t}linkAssetsByTree(e,t){if(e||(e=Qe.RM),this.clearLinkedLines(e),!t||!t.value)return;const r=this.getLinesByTree(t);this.drawLinkedLines(e,r)}clearLinkedLines(e){var s;const t=fs(e);if(this.getElementById(t)){for(let o=((s=this._lastLinked)==null?void 0:s.length)-1;o>=0;o--){const u=this._lastLinked[o];u.parentNode&&u.parentNode.removeChild(u),this._lastLinked.splice(o,1)}this._lastLinked.length=0}}drawLinkedLines(e,t){var o;if(!(t!=null&&t.length))return;const r=fs(e),s=this.getElementById(r);if(s)for(let u=0,h=t.length;u<h;u++){const c=t[u][0],y=t[u][((o=t[u])==null?void 0:o.length)-1],p=Xu("line");p.setAttribute("x1",c.x.toString()),p.setAttribute("y1",c.y.toString()),p.setAttribute("x2",y.x.toString()),p.setAttribute("y2",y.y.toString()),p.setAttribute("class","danger"),p.setAttribute("style","stroke-width: 2;"),s.appendChild(p),this._lastLinked.push(p)}}getLinesByTree(e,t=[]){var o;if(!(e!=null&&e.value))return t;const r=this.getElementBoundingBox(e.value);if(!r)return t;const s=r.getCenter();return(o=e.children)==null||o.forEach(u=>{var y;const h=this.getElementBoundingBox(u==null?void 0:u.value);if(!h)return;const c=h.getCenter();t.push([s,c]),(y=u.children)!=null&&y.length&&this.getLinesByTree(u,t)}),t}}const Di=new k,Eo=new ce;class G2{constructor(e={},t){d(this,"name","SvgPainter");d(this,"params");d(this,"chef");this.params=e,this.chef=t}drawSocialDistanceCircles(e,t="http://www.w3.org/2000/svg"){var C,N,O;if(!e)return;const r=F0(e),s=Xc(e),o=2*r,u=(N=(C=this.params.socialDistance)==null?void 0:C.colors)!=null&&N.length?(O=this.params.socialDistance)==null?void 0:O.colors:[Qt.green,Qt.red],h=this.getRadius(s),c=e.querySelector(`#${Zu}`),y=c==null?void 0:c.querySelectorAll("path");if(!c||!(y!=null&&y.length))return;let p,A;const T=new Array;for(let L=0,P=(y==null?void 0:y.length)||0;L<P;L++){if(p=y[L],A=p.getAttribute("id"),!A)continue;const W=this.chef.getElementBoundingBox(A);if(!W)continue;const V=new k;W.getCenter(V),T.push({id:A,cp:V})}for(let L=0,P=T.length;L<P;L++){T[L].color=u[0];for(let W=0,V=P;W<V;W++)T[L]!==T[W]&&k.getDistance(T[L].cp,T[W].cp)<h*2&&(T[L].color=u[1])}for(let L=0,P=T.length;L<P;L++){let W=this.createCircle(T[L],h,o,t);c.appendChild(W)}}clearSocialDistanceCircles(e){if(!e)return;const t=e.querySelector(`#${Zu}`),r=t==null?void 0:t.querySelectorAll("circle");if(!(!t||!(r!=null&&r.length)))for(let s=0,o=(r==null?void 0:r.length)||0;s<o;s++){const u=r[s].getAttribute("id");u&&(u==null?void 0:u.indexOf("_circle"))>-1&&t.removeChild(r[s])}}getRadius(e){var r,s,o;let t=((s=(r=this.params)==null?void 0:r.socialDistance)==null?void 0:s.radius)||3;return((o=this.params)==null?void 0:o.displayUnits)==="imperial"?e==="Metres"||e==="m"?t/=3.28084:e==="cm"?t=t/3.28084*100:e==="mm"?t=t/3.28084*1e3:(e==="INCH"||e==="inches")&&(t*=12):e==="INCH"||e==="inches"?t=t*3.28084*12:e==="cm"?t*=100:e==="mm"&&(t*=1e3),t}createCircle(e,t,r,s){const o=document.createElementNS(s,"circle");return o.setAttributeNS(null,"id",e.id+"_circle"),o.setAttributeNS(null,"cx",e.cp.x),o.setAttributeNS(null,"cy",e.cp.y),o.setAttributeNS(null,"r",String(t)),o.setAttributeNS(null,"style",`pointer-events:none;fill-opacity:0.1;stroke:${e.color};stroke-width:${r}px;`),o}}const Y2=function(i){return(i||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};function Ao(i,e){if(!i||!e)return!1;if(e.indexOf(" ")!==-1)throw new Error("className should not contain space.");return i.classList?i.classList.contains(e):(" "+i.className+" ").indexOf(" "+e+" ")>-1}function da(i,e){if(!i)return;let t=i.className;const r=(e||"").split(" ");for(let s=0,o=r.length;s<o;s++){const u=r[s];u&&(i.classList?i.classList.add(u):Ao(i,u)||(t+=" "+u))}i.classList||(i.className=t)}function ga(i,e){if(!i||!e)return;const t=e.split(" ");let r=" "+i.className+" ";for(let s=0,o=t.length;s<o;s++){const u=t[s];u&&(i.classList?i.classList.remove(u):Ao(i,u)&&(r=r.replace(" "+u+" "," ")))}i.classList||(i.className=Y2(r))}class al extends X0{constructor(t={}){super();d(this,"isSvgScene",!0);d(this,"name","SvgScene");d(this,"dynamically",!0);d(this,"params");d(this,"socialDistanceEnable",!1);d(this,"container");d(this,"svg");d(this,"svgStr","");d(this,"svgRoot");d(this,"viewBox",new Ot);d(this,"chef");d(this,"defaultLayers",[]);d(this,"skeletonLayers",[]);d(this,"currentLayers",[]);d(this,"assetType");d(this,"assetsMap",{});d(this,"legend",[]);d(this,"selectedList",[]);d(this,"painter");d(this,"_lastHighlightType","");d(this,"_lastHighlightIds",[]);d(this,"clickSvgElementHandler",this.handleClickSvgElement.bind(this));d(this,"_lastLinkedIds",[]);this.params=t,this.assetType=t.assetType||Qe.RM,this.params.socialDistanceEnable&&(this.socialDistanceEnable=!0),this.container=this.params.containerId?document.getElementById(this.params.containerId):Vt.window.document.getElementsByTagName("body")[0],this.chef=new $2,this.painter=new G2(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)}load(t){return Tt(this,null,function*(){return new af().loadAsync(t)})}bind(t){this.svgStr=t;const r=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;return this.bindSvg(r),!0}bindSvg(t){if(this.svg=t,!this.svg)throw new Error("svg load failed");let r=this.svg.getAttribute("viewBox");r&&(k0(r,this.viewBox),this.chef.bindSvg(this.svg),this.svgRoot=Zc(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 -> ",r,this.viewBox.toString()),this.setAssetsMap(this.assetType,this.assetsMap))}recompute(t){t&&(this.bindSvg(t),this.computeBoundingBox(),this.viewBox.copy(this.boundingBox))}appendStyles(){var r;let t=(r=this.svg)==null?void 0:r.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,r=!1){this.setDefaultLayers(t),this.chef.updateLayersVisibility(t,r)}getLayerVisible(t){return this.chef.getLayerVisible(t)}updateLayersVisibility(t,r=!1,s=!0){this.chef.updateLayersVisibility(t,r,s)}setAssetType(t,r){this.assetsMap={},this.assetType=t,this.setAssetsMap(this.assetType,this.assetsMap),r||(r=[fs(t)],t!==Qe.RM&&r.unshift(fs(Qe.RM))),this.setDefaultLayers(r),this.updateLayersVisibility(this.defaultLayers,!0)}isBelongsToAssetType(t,r){r||(r=this.assetType);const s=this.getAssetsByType(r);return s?!!(s!=null&&s.hasOwnProperty(t)):!1}setAssetsMap(t,r={}){const s=this.chef.getElementById(fs(t));if(!s)return r;r[t]=this.chef.getElementsMap(s);const o=la(t),u=this.chef.getElementById(o);if(!u)return r;const h=this.chef.getElementsMap(u),c=Rt.keys(h);if(!(c!=null&&c.length))return r;if(Rt.startsWith(c[0],`l-${t}-`)){const y=`l-${t}-`.length;for(let p=0,A=c.length;p<A;p++){const T=c[p].slice(y);h[T]=h[c[p]],delete h[c[p]]}}return r[o]=h,r}getAssetsByType(t){return this.assetsMap.hasOwnProperty(t)||this.setAssetsMap(t,this.assetsMap),this.assetsMap[t]}getElementById(t){if(!t)return;const r=this.getAssetsByType(this.assetType);if(!(!r||!Object.hasOwnProperty.call(r,t)))return r[t]}getAssetIdsByType(t){const r=this.getAssetsByType(t),s=[];return r?Rt.keys(r):s}clearFillOrStroke(t="fill"){const r=this.getAssetsByType(this.assetType);if(!r)return;const s=Rt.keys(r);let o;for(let u=0,h=s.length;u<h;u++)o=r[s[u]],o&&(o.hasAttribute(t)&&o.removeAttribute(t),t==="stroke"&&o.removeAttribute("stroke-width"));this.clearLegendBy(t)}clearFillOrStrokeByIds(t,r="fill"){const s=this.getAssetsByType(this.assetType);if(!s)return;const o=Rt.keys(s);let u;for(let h=0,c=o.length;h<c;h++)t!=null&&t.length&&!t.includes(o[h])||(u=s[o[h]],!(!u||!u.hasAttribute(r))&&(u.removeAttribute(r),r==="stroke"&&u.removeAttribute("stroke-width")));this.clearLegendBy(r)}setFillOrStrokeByIds(t,r,s="fill",o="7em"){const u=this.getAssetsByType(this.assetType);if(!u)return;const h=Rt.keys(u);let c;for(let y=0,p=h.length;y<p;y++)t.includes(h[y])&&(c=u[h[y]],c&&(c.setAttribute(s,r),s==="stroke"&&c.setAttribute("stroke-width",o),this.addLegend(s,r,h[y])))}addLegend(t,r,s){let o=this.legend.find(u=>u.color===r);o||(o={type:t,color:r,ids:[]},this.legend.push(o)),o.ids.push(s)}clearLegendBy(t){var r;t||(this.legend.length=0);for(let s=((r=this.legend)==null?void 0:r.length)-1;s>=0;s--)this.legend[s].type===t&&this.legend.splice(s,s)}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,r){this.chef.setLabelsById(t,r,this.assetType)}getAssetLabelsMap(t){var o,u;if(!t)return;const r=la(t);let s=this.getAssetsByType(r);if(!s||!((o=Object.keys(s))!=null&&o.length)){let h=this.chef.getElementById(r);if(h||(h=this.chef.getElementById(t+"-txt-label")),!h)return;s=this.chef.getElementsMap(h),this.assetsMap[r]=s}if(!(!s||!((u=Object.keys(s))!=null&&u.length)))return s}getAssetLabelById(t,r){var h,c;const s=this.getAssetLabelsMap(t);if(!s)return;let o=s[r];if(o&&((h=o==null?void 0:o.childNodes)!=null&&h.length))return o.childNodes[0].textContent||"";const u="l-"+t+"-"+r;if(o=s[u],o&&((c=o==null?void 0:o.children)!=null&&c.length))return o.children[0].textContent||""}clearAssetLabels(){this.chef.clearAssetLabelsByType(this.assetType)}bindAssetsEvents(t){var o;const r=(o=this.svg)==null?void 0:o.querySelector("#"+t);if(!r)return;r.querySelectorAll("[id]").forEach(u=>{u instanceof SVGElement&&u.addEventListener("click",this.clickSvgElementHandler)})}handleClickSvgElement(t){var r;typeof t.preventDefault=="function"&&t.preventDefault(),console.warn("svgScene.handleClickSvgElement: ",(r=t==null?void 0:t.target)==null?void 0:r.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,r){var o;this.resetHighlightAssets(t);const s=this.getAssetsByType(t);!s||!((o=Object.keys(s))!=null&&o.length)||(this._lastHighlightType=t,this._lastHighlightIds=Array.isArray(r)?r:[r],this._lastHighlightIds.forEach(u=>{u&&s[u]&&da(s[u],"active")}))}resetHighlightAssets(t){var s;const r=this.getAssetsByType(t||this._lastHighlightType);!r||!((s=Object.keys(r))!=null&&s.length)||(this._lastHighlightIds.forEach(o=>{o&&r[o]&&ga(r[o],"active")}),this._lastHighlightIds.length=0)}getIntersectObjects(t,r=Qe.RM,s=[]){s.length=0;const o=[],u=this.getAssetsByType(r);if(!u)return s;const h=Rt.keys(u);for(let y=0,p=h.length;y<p;y++){const A=this.chef.getElementBoundingBox(u[h[y]].id);A&&A.containsPoint(t.worldCoords)&&o.push(u[h[y]])}const c=Rt.sortBy(o,y=>{var p;return(p=this.chef.getElementBoundingBox(y.id))==null?void 0:p.getArea()});return s.push(...c),s}clearSelected(){var t,r;if((t=this.selectedList)!=null&&t.length)for(let s=((r=this.selectedList)==null?void 0:r.length)-1;s>=0;s--){let o=this.selectedList[s];this.selectedList.splice(s,1),this.chef.setElementState2selected(o,!1)}}clearSelectedById(t){var s,o;let r=(s=this.selectedList)==null?void 0:s.findIndex(u=>u.getAttribute("id")===t);r>-1&&(this.chef.setElementState2selected(this.selectedList[r],!1),(o=this.selectedList)==null||o.splice(r||0,1))}selectByIds(t,r=!1){Array.isArray(t)||(t=[t]),r||this.clearSelected();const s=Rt.uniq(Rt.map(this.selectedList,u=>u.getAttribute("id")||"")),o=this.getAssetsByType(this.assetType);if(o){for(let u=t.length-1;u>=0;u--)s.includes(t[u])?(this.clearSelectedById(t[u]),t.splice(u,1)):Object.hasOwnProperty.call(o,t[u])&&this.selectedList.push(o[t[u]]);this.selectedList.forEach(u=>{this.chef.setElementState2selected(u,!0)})}}getSelectedIds(){var r;if(!((r=this.selectedList)!=null&&r.length))return;const t=[];for(let s=0,o=this.selectedList.length;s<o;s++)this.selectedList[s].id&&t.push(this.selectedList[s].id);return t}getSelectedBoundingBox(){var r;const t=new Ot;return(r=this.selectedList)!=null&&r.length?(this.selectedList.forEach(s=>{const o=this.chef.boundingBoxMap[s.id];o&&t.expandByBox(o)}),t):t.copy(this.boundingBox)}getElementsByBox(t){const r=[],s=Object.keys(this.chef.boundingBoxMap),o=this.getAssetsByType(this.assetType);if(!o)return r;for(let u=0,h=s.length;u<h;u++)if(o.hasOwnProperty(s[u])&&!(s[u].indexOf("-assets")>-1)&&t.intersectsBox(this.chef.boundingBoxMap[s[u]])){const c=o[s[u]];c&&r.push(c)}return r}getBoundingBoxByIds(t){var s,o;if(!t||Array.isArray(t)&&!t.length)return;Array.isArray(t)||(t=[t]);const r=new Ot;for(let u=0,h=t==null?void 0:t.length;u<h;u++)(o=(s=this.chef)==null?void 0:s.boundingBoxMap)!=null&&o.hasOwnProperty(t[u])&&r.expandByBox(this.chef.boundingBoxMap[t[u]]);return r}getBoundingBoxById(t){if(this.chef.boundingBoxMap.hasOwnProperty(t))return new Ot().copy(this.chef.boundingBoxMap[t])}linkAssetsByTree(t){this.chef.linkAssetsByTree(this.assetType,t);const r=this.chef.getElementById(ua.ASSET_LABELS);r&&(r.style.display="block");const s=la(this.assetType),o=this.chef.getElementById(s);o&&(o.style.display="block");const u=this.assetsMap[s];u&&(this._lastLinkedIds.forEach(h=>{u[h]&&(u[h].style.display="none")}),this._lastLinkedIds=Wc(t),this._lastLinkedIds.forEach(h=>{u[h]&&(u[h].style.display="block")}))}onBeforeRender(){}fullscreen(t=1e3,r=!1){}update(){}}class X2 extends al{constructor(t){super(t);d(this,"name","SvgLoadingScene");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;}*/