archgine 1.0.72 → 1.0.73

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.cjs.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})(Ld);var Th={},Oa=zi.NAMESPACE,ih=/[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]/,sp=new RegExp("[\\-\\.0-9"+ih.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),ap=new RegExp("^"+ih.source+sp.source+"*(?::"+ih.source+sp.source+"*)?$"),ua=0,hn=1,ys=2,la=3,ms=4,vs=5,ha=6,Ho=7;function Ls(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Ls)}Ls.prototype=new Error;Ls.prototype.name=Ls.name;function Nd(){}Nd.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),Md(e,e={}),Qx(i,e,t,r,this.errorHandler),r.endDocument()}};function Qx(i,e,t,r,s){function o(N){if(N>65535){N-=65536;var xt=55296+(N>>10),Pt=56320+(N&1023);return String.fromCharCode(xt,Pt)}else return String.fromCharCode(N)}function u(N){var xt=N.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:"+N),N)}function h(N){if(N>L){var xt=i.substring(L,N).replace(/&#?\w+;/g,u);_&&c(L),r.characters(xt,0,N-L),L=N}}function c(N,xt){for(;N>=g&&(xt=A.exec(i));)y=xt.index,g=y+xt[0].length,_.lineNumber++;_.columnNumber=N-y+1}for(var y=0,g=0,A=/.*(?:\r\n?|\n)|.*$/g,_=r.locator,D=[{currentNSMap:e}],B={},L=0;;){try{var I=i.indexOf("<",L);if(I<0){if(!i.substr(L).match(/^\s*$/)){var P=r.doc,V=P.createTextNode(i.substr(L));P.appendChild(V),r.currentElement=V}return}switch(I>L&&h(I),i.charAt(I+1)){case"/":var tt=i.indexOf(">",I+3),G=i.substring(I+2,tt).replace(/[ \t\n\r]+$/g,""),b=D.pop();tt<0?(G=i.substring(I+2).replace(/[\s<].*/,""),s.error("end tag name: "+G+" is not complete:"+b.tagName),tt=I+1+G.length):G.match(/\s</)&&(G=G.replace(/[\s<].*/,""),s.error("end tag name: "+G+" maybe not complete"),tt=I+1+G.length);var F=b.localNSMap,W=b.tagName==G,j=W||b.tagName&&b.tagName.toLowerCase()==G.toLowerCase();if(j){if(r.endElement(b.uri,b.localName,G),F)for(var rt in F)Object.prototype.hasOwnProperty.call(F,rt)&&r.endPrefixMapping(rt);W||s.fatalError("end tag name: "+G+" is not match the current start tagName:"+b.tagName)}else D.push(b);tt++;break;case"?":_&&c(I),tt=eE(i,I,r);break;case"!":_&&c(I),tt=tE(i,I,r,s);break;default:_&&c(I);var Q=new Bd,it=D[D.length-1].currentNSMap,tt=Kx(i,I,Q,it,u,s),at=Q.length;if(!Q.closed&&Jx(i,tt,Q.tagName,B)&&(Q.closed=!0,t.nbsp||s.warning("unclosed xml attribute")),_&&at){for(var ft=op(_,{}),pt=0;pt<at;pt++){var dt=Q[pt];c(dt.offset),dt.locator=op(_,{})}r.locator=ft,up(Q,r,it)&&D.push(Q),r.locator=_}else up(Q,r,it)&&D.push(Q);Oa.isHTML(Q.uri)&&!Q.closed?tt=jx(i,tt,Q.tagName,u,r):tt++}}catch(N){if(N instanceof Ls)throw N;s.error("element parse error: "+N),tt=-1}tt>L?L=tt:h(Math.max(I,L)+1)}}function op(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function Kx(i,e,t,r,s,o){function u(_,D,B){t.attributeNames.hasOwnProperty(_)&&o.fatalError("Attribute "+_+" redefined"),t.addValue(_,D.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),B)}for(var h,c,y=++e,g=ua;;){var A=i.charAt(y);switch(A){case"=":if(g===hn)h=i.slice(e,y),g=la;else if(g===ys)g=la;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(g===la||g===hn)if(g===hn&&(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),g=vs;else throw new Error("attribute value no end '"+A+"' match");else if(g==ms)c=i.slice(e,y),u(h,c,e),o.warning('attribute "'+h+'" missed start quot('+A+")!!"),e=y+1,g=vs;else throw new Error('attribute value must after "="');break;case"/":switch(g){case ua:t.setTagName(i.slice(e,y));case vs:case ha:case Ho:g=Ho,t.closed=!0;case ms:case hn:break;case ys:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),g==ua&&t.setTagName(i.slice(e,y)),y;case">":switch(g){case ua:t.setTagName(i.slice(e,y));case vs:case ha:case Ho:break;case ms:case hn:c=i.slice(e,y),c.slice(-1)==="/"&&(t.closed=!0,c=c.slice(0,-1));case ys:g===ys&&(c=h),g==ms?(o.warning('attribute "'+c+'" missed quot(")!'),u(h,c,e)):((!Oa.isHTML(r[""])||!c.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),u(c,c,e));break;case la:throw new Error("attribute value missed!!")}return y;case"€":A=" ";default:if(A<=" ")switch(g){case ua:t.setTagName(i.slice(e,y)),g=ha;break;case hn:h=i.slice(e,y),g=ys;break;case ms:var c=i.slice(e,y);o.warning('attribute "'+c+'" missed quot(")!!'),u(h,c,e);case vs:g=ha;break}else switch(g){case ys:t.tagName,(!Oa.isHTML(r[""])||!h.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+h+'" missed value!! "'+h+'" instead2!!'),u(h,h,e),e=y,g=hn;break;case vs:o.warning('attribute space is required"'+h+'"!!');case ha:g=hn,e=y;break;case la:g=ms,e=y;break;case Ho:throw new Error("elements closed character '/' and '>' must be connected to")}}y++}}function up(i,e,t){for(var r=i.tagName,s=null,A=i.length;A--;){var o=i[A],u=o.qName,h=o.value,_=u.indexOf(":");if(_>0)var c=o.prefix=u.slice(0,_),y=u.slice(_+1),g=c==="xmlns"&&y;else y=u,c=null,g=u==="xmlns"&&"";o.localName=y,g!==!1&&(s==null&&(s={},Md(t,t={})),t[g]=s[g]=h,o.uri=Oa.XMLNS,e.startPrefixMapping(g,h))}for(var A=i.length;A--;){o=i[A];var c=o.prefix;c&&(c==="xml"&&(o.uri=Oa.XML),c!=="xmlns"&&(o.uri=t[c||""]))}var _=r.indexOf(":");_>0?(c=i.prefix=r.slice(0,_),y=i.localName=r.slice(_+1)):(c=null,y=i.localName=r);var D=i.uri=t[c||""];if(e.startElement(D,y,r,i),i.closed){if(e.endElement(D,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 jx(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 Jx(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 Md(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function tE(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=rE(i,e),h=u.length;if(h>1&&/!doctype/i.test(u[0][0])){var c=u[1][0],y=!1,g=!1;h>3&&(/^public$/i.test(u[2][0])?(y=u[3][0],g=h>4&&u[4][0]):/^system$/i.test(u[2][0])&&(g=u[3][0]));var A=u[h-1];return t.startDTD(c,y,g),t.endDTD(),A.index+A[0].length}}return-1}function eE(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 Bd(){this.attributeNames={}}Bd.prototype={setTagName:function(i){if(!ap.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!ap.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 rE(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}Th.XMLReader=Nd;Th.ParseError=Ls;var iE=zi,nE=vn,lp=Ld,Id=Th,sE=nE.DOMImplementation,hp=iE.NAMESPACE,aE=Id.ParseError,oE=Id.XMLReader;function Rd(i){return i.replace(/\r[\n\u0085]/g,`
3
3
  `).replace(/[\r\u0085\u2028]/g,`
4
4
  `)}function Pd(i){this.options=i||{locator:{}}}Pd.prototype.parseFromString=function(i,e){var t=this.options,r=new oE,s=t.domBuilder||new Ha,o=t.errorHandler,u=t.locator,h=t.xmlns||{},c=/\/x?html?$/.test(e),y=c?lp.HTML_ENTITIES:lp.XML_ENTITIES;u&&s.setDocumentLocator(u),r.errorHandler=uE(o,s,u),r.domBuilder=t.domBuilder||s,c&&(h[""]=hp.HTML),h.xml=h.xml||hp.XML;var g=t.normalizeLineEndings||Rd;return i&&typeof i=="string"?r.parse(g(i),h,y):r.errorHandler.error("invalid doc source"),s.doc};function uE(i,e,t){if(!i){if(e instanceof Ha)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+nh(t))}||function(){}}return o("warning"),o("error"),o("fatalError"),r}function Ha(){this.cdata=!1}function xs(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}Ha.prototype={startDocument:function(){this.doc=new sE().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&&xs(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&&xs(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&&xs(this.locator,t),Uo(this,t)},ignorableWhitespace:function(i,e,t){},characters:function(i,e,t){if(i=cp.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&&xs(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=cp.apply(this,arguments);var r=this.doc.createComment(i);this.locator&&xs(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&&xs(this.locator,s),Uo(this,s),this.doc.doctype=s}},warning:function(i){console.warn("[xmldom warning] "+i,nh(this.locator))},error:function(i){console.error("[xmldom error] "+i,nh(this.locator))},fatalError:function(i){throw new aE(i,this.locator)}};function nh(i){if(i)return`
5
- @`+(i.systemId||"")+"#[line:"+i.lineNumber+",col:"+i.columnNumber+"]"}function cp(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){Ha.prototype[i]=function(){return null}});function Uo(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}du.__DOMHandler=Ha;du.normalizeLineEndings=Rd;du.DOMParser=Pd;var lE=du.DOMParser;const hE="1.0.72";function cE(){return typeof window!="undefined"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Ns=typeof window!="undefined"?window:typeof WorkerGlobalScope!="undefined"?self:{document:void 0,tinyEngine:void 0};Ns.Path2D||Nx(Ns);Ns.DOMParser||(Ns.DOMParser=lE);const Vt={window:Ns,version:hE,isBrowser:cE(),dpr:typeof window!="undefined"&&window.devicePixelRatio||1,document:Ns.document,time:0,deltaTime:0,config:ad},ca=(i,e,t)=>Math.max(e,Math.min(t,i)),fp=(i,e=1e-6)=>Math.abs(i)<e?0:i<0?-1:1,fE=i=>i*(Math.PI/180),pE=(i,e)=>(i%e+e)%e,Pl=(i,e,t)=>(1-t)*i+t*e,dE=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)"},gE={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},Wr={h:0,s:0,l:0},qo={h:0,s:0,l:0};function Fl(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 yE=/^#([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){p(this,"isColor",!0);p(this,"r",1);p(this,"g",1);p(this,"b",1);p(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"?yE.test(e):typeof e=="number"?e>=0&&e<=16777215:!1}static getRandomStyle(){return Mi.random().getStyle()}static getDarken(e,t=.8){return Mi.set(e).getHSL(Wo),Mi.setHSL(Wo.h,Wo.s,Wo.l*t).getStyle()}static getLighten(e,t=1.2){return this.getDarken(e,t)}static getContrast(e){return Mi.set(e),Mi.getContrastString()}static getArray(e){return Mi.set(e).toArray()}static getComplementary(e){return Mi.set(e),Mi.getComplementaryString()}static getMoreTransparent(e,t){return Mi.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=pE(e,1),t=ca(t,0,1),r=ca(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=Fl(u,o,e+1/3),this.g=Fl(u,o,e),this.b=Fl(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=gE[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 ca(this.r*255,0,255)<<16^ca(this.g*255,0,255)<<8^ca(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 g=o-u;switch(c=y<=.5?g/(o+u):g/(2-o-u),o){case t:h=(r-s)/g+(r<s?6:0);break;case r:h=(s-t)/g+2;break;case s:h=(t-r)/g+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(Wr),Wr.h+=e,Wr.s+=t,Wr.l+=r,this.setHSL(Wr.h,Wr.s,Wr.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(Wr),e.getHSL(qo);const r=Pl(Wr.h,qo.h,t),s=Pl(Wr.s,qo.s,t),o=Pl(Wr.l,qo.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 Mi=new Yt,Wo={h:0,s:0,l:0};class k{constructor(e=0,t=0,r){p(this,"isVector2",!0);p(this,"x",0);p(this,"y",0);p(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 fp(this.sub(e,r).cross(this.sub(t,r)))===0&&fp(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):dE(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),g=0;g+=u.distanceTo(h),g+=h.distanceTo(c),g+=c.distanceTo(y);let A=Math.min(.5,1/(g/t));for(let _=A;_<1;_+=A){let D=3*(h.x-u.x),B=3*(c.x-h.x)-D,L=y.x-u.x-D-B,I=3*(h.y-u.y),P=3*(c.y-h.y)-I,V=y.y-u.y-I-P,G=L*Math.pow(_,3)+B*Math.pow(_,2)+D*_+u.x,b=V*Math.pow(_,3)+P*Math.pow(_,2)+I*_+u.y;r.push({x:Math.round(G),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;kl.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=kl.x+c*h*(t.y-e.y)/u,o.y=kl.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,g)=>y-g);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),g=c/h,A=y/h;return o&&(g<0||g>1||A<0||A>1)?u.makeEmpty():(u.x=e.x+g*(t.x-e.x),u.y=e.y+g*(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 kl=new k,mE=Object.freeze(Object.defineProperty({__proto__:null,default:k},Symbol.toStringTag,{value:"Module"}));var au={exports:{}};/**
5
+ @`+(i.systemId||"")+"#[line:"+i.lineNumber+",col:"+i.columnNumber+"]"}function cp(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){Ha.prototype[i]=function(){return null}});function Uo(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}du.__DOMHandler=Ha;du.normalizeLineEndings=Rd;du.DOMParser=Pd;var lE=du.DOMParser;const hE="1.0.73";function cE(){return typeof window!="undefined"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Ns=typeof window!="undefined"?window:typeof WorkerGlobalScope!="undefined"?self:{document:void 0,tinyEngine:void 0};Ns.Path2D||Nx(Ns);Ns.DOMParser||(Ns.DOMParser=lE);const Vt={window:Ns,version:hE,isBrowser:cE(),dpr:typeof window!="undefined"&&window.devicePixelRatio||1,document:Ns.document,time:0,deltaTime:0,config:ad},ca=(i,e,t)=>Math.max(e,Math.min(t,i)),fp=(i,e=1e-6)=>Math.abs(i)<e?0:i<0?-1:1,fE=i=>i*(Math.PI/180),pE=(i,e)=>(i%e+e)%e,Pl=(i,e,t)=>(1-t)*i+t*e,dE=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)"},gE={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},Wr={h:0,s:0,l:0},qo={h:0,s:0,l:0};function Fl(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 yE=/^#([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){p(this,"isColor",!0);p(this,"r",1);p(this,"g",1);p(this,"b",1);p(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"?yE.test(e):typeof e=="number"?e>=0&&e<=16777215:!1}static getRandomStyle(){return Mi.random().getStyle()}static getDarken(e,t=.8){return Mi.set(e).getHSL(Wo),Mi.setHSL(Wo.h,Wo.s,Wo.l*t).getStyle()}static getLighten(e,t=1.2){return this.getDarken(e,t)}static getContrast(e){return Mi.set(e),Mi.getContrastString()}static getArray(e){return Mi.set(e).toArray()}static getComplementary(e){return Mi.set(e),Mi.getComplementaryString()}static getMoreTransparent(e,t){return Mi.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=pE(e,1),t=ca(t,0,1),r=ca(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=Fl(u,o,e+1/3),this.g=Fl(u,o,e),this.b=Fl(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=gE[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 ca(this.r*255,0,255)<<16^ca(this.g*255,0,255)<<8^ca(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 g=o-u;switch(c=y<=.5?g/(o+u):g/(2-o-u),o){case t:h=(r-s)/g+(r<s?6:0);break;case r:h=(s-t)/g+2;break;case s:h=(t-r)/g+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(Wr),Wr.h+=e,Wr.s+=t,Wr.l+=r,this.setHSL(Wr.h,Wr.s,Wr.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(Wr),e.getHSL(qo);const r=Pl(Wr.h,qo.h,t),s=Pl(Wr.s,qo.s,t),o=Pl(Wr.l,qo.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 Mi=new Yt,Wo={h:0,s:0,l:0};class k{constructor(e=0,t=0,r){p(this,"isVector2",!0);p(this,"x",0);p(this,"y",0);p(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 fp(this.sub(e,r).cross(this.sub(t,r)))===0&&fp(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):dE(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),g=0;g+=u.distanceTo(h),g+=h.distanceTo(c),g+=c.distanceTo(y);let A=Math.min(.5,1/(g/t));for(let _=A;_<1;_+=A){let D=3*(h.x-u.x),B=3*(c.x-h.x)-D,L=y.x-u.x-D-B,I=3*(h.y-u.y),P=3*(c.y-h.y)-I,V=y.y-u.y-I-P,G=L*Math.pow(_,3)+B*Math.pow(_,2)+D*_+u.x,b=V*Math.pow(_,3)+P*Math.pow(_,2)+I*_+u.y;r.push({x:Math.round(G),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;kl.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=kl.x+c*h*(t.y-e.y)/u,o.y=kl.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,g)=>y-g);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),g=c/h,A=y/h;return o&&(g<0||g>1||A<0||A>1)?u.makeEmpty():(u.x=e.x+g*(t.x-e.x),u.y=e.y+g*(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 kl=new k,mE=Object.freeze(Object.defineProperty({__proto__:null,default:k},Symbol.toStringTag,{value:"Module"}));var au={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 wt=$f(function(){return Rt(x,st+"return "+Y).apply(t,w)});if(wt.source=Y,Al(wt))throw wt;return wt}function M1(n){return Ft(n).toLowerCase()}function B1(n){return Ft(n).toUpperCase()}function I1(n,a,l){if(n=Ft(n),n&&(l||a===t))return Jh(n);if(!n||!(a=pr(a)))return n;var f=kr(n),d=kr(a),x=tc(f,d),w=ec(f,d)+1;return un(f,x,w).join("")}function R1(n,a,l){if(n=Ft(n),n&&(l||a===t))return n.slice(0,ic(n)+1);if(!n||!(a=pr(a)))return n;var f=kr(n),d=ec(f,kr(a))+1;return un(f,0,d).join("")}function P1(n,a,l){if(n=Ft(n),n&&(l||a===t))return n.replace(ks,"");if(!n||!(a=pr(a)))return n;var f=kr(n),d=tc(f,kr(a));return un(f,d).join("")}function F1(n,a){var l=it,f=tt;if(Jt(a)){var d="separator"in a?a.separator:d;l="length"in a?vt(a.length):l,f="omission"in a?pr(a.omission):f}n=Ft(n);var x=n.length;if(ns(n)){var w=kr(n);x=w.length}if(l>=x)return n;var C=l-ss(f);if(C<1)return f;var O=w?un(w,0,C).join(""):n.slice(0,C);if(d===t)return O+f;if(w&&(C+=O.length-C),wl(d)){if(n.slice(C).search(d)){var z,$=O;for(d.global||(d=ku(d.source,Ft(Us.exec(d))+"g")),d.lastIndex=0;z=d.exec($);)var Y=z.index;O=O.slice(0,Y===t?C:Y)}}else if(n.indexOf(pr(d),C)!=C){var K=O.lastIndexOf(d);K>-1&&(O=O.slice(0,K))}return O+f}function k1(n){return n=Ft(n),n&&lr.test(n)?n.replace(Er,p0):n}var H1=fs(function(n,a,l){return n+(l?" ":"")+a.toUpperCase()}),_l=$c("toUpperCase");function zf(n,a,l){return n=Ft(n),a=l?t:a,a===t?u0(n)?y0(n):Jg(n):n.match(a)||[]}var $f=bt(function(n,a){try{return cr(n,t,a)}catch(l){return Al(l)?l:new gt(l)}}),U1=Di(function(n,a){return Tr(a,function(l){l=si(l),_i(n,l,xl(n[l],n))}),n});function q1(n){var a=n==null?0:n.length,l=ut();return n=a?Zt(n,function(f){if(typeof f[1]!="function")throw new _r(u);return[l(f[0]),f[1]]}):[],bt(function(f){for(var d=-1;++d<a;){var x=n[d];if(cr(x[0],this,f))return cr(x[1],this,f)}})}function W1(n){return p2(Dr(n,A))}function Cl(n){return function(){return n}}function V1(n,a){return n==null||n!==n?a:n}var z1=Yc(),$1=Yc(!0);function Ke(n){return n}function Dl(n){return bc(typeof n=="function"?n:Dr(n,A))}function G1(n){return _c(Dr(n,A))}function Y1(n,a){return Cc(n,Dr(a,A))}var X1=bt(function(n,a){return function(l){return Js(l,n,a)}}),Z1=bt(function(n,a){return function(l){return Js(n,l,a)}});function Sl(n,a,l){var f=Ae(a),d=vo(a,f);l==null&&!(Jt(a)&&(d.length||!f.length))&&(l=a,a=n,n=this,d=vo(a,Ae(a)));var x=!(Jt(l)&&"chain"in l)||!!l.chain,w=Oi(n);return Tr(d,function(C){var O=a[C];n[C]=O,w&&(n.prototype[C]=function(){var z=this.__chain__;if(x||z){var $=n(this.__wrapped__),Y=$.__actions__=Xe(this.__actions__);return Y.push({func:O,args:arguments,thisArg:n}),$.__chain__=z,$}return O.apply(n,en([this.value()],arguments))})}),n}function Q1(){return _e._===this&&(_e._=w0),this}function Ol(){}function K1(n){return n=vt(n),bt(function(a){return Dc(a,n)})}var j1=al(Zt),J1=al(Xh),tx=al(Nu);function Gf(n){return pl(n)?Mu(si(n)):L2(n)}function ex(n){return function(a){return n==null?t:Rn(n,a)}}var rx=Zc(),ix=Zc(!0);function Ll(){return[]}function Nl(){return!1}function nx(){return{}}function sx(){return""}function ax(){return!0}function ox(n,a){if(n=vt(n),n<1||n>Pt)return[];var l=oe,f=Me(n,oe);a=ut(a),n-=oe;for(var d=Ru(f,a);++l<n;)a(l);return d}function ux(n){return mt(n)?Zt(n,si):dr(n)?[n]:Xe(ff(Ft(n)))}function lx(n){var a=++E0;return Ft(n)+a}var hx=To(function(n,a){return n+a},0),cx=ol("ceil"),fx=To(function(n,a){return n/a},1),px=ol("floor");function dx(n){return n&&n.length?mo(n,Ke,Gu):t}function gx(n,a){return n&&n.length?mo(n,ut(a,2),Gu):t}function yx(n){return Kh(n,Ke)}function mx(n,a){return Kh(n,ut(a,2))}function vx(n){return n&&n.length?mo(n,Ke,Qu):t}function xx(n,a){return n&&n.length?mo(n,ut(a,2),Qu):t}var Ex=To(function(n,a){return n*a},1),Ax=ol("round"),wx=To(function(n,a){return n-a},0);function bx(n){return n&&n.length?Iu(n,Ke):0}function Tx(n,a){return n&&n.length?Iu(n,ut(a,2)):0}return v.after=Gm,v.ary=bf,v.assign=Bv,v.assignIn=Ff,v.assignInWith=Fo,v.assignWith=Iv,v.at=Rv,v.before=Tf,v.bind=xl,v.bindAll=U1,v.bindKey=_f,v.castArray=nv,v.chain=Ef,v.chunk=py,v.compact=dy,v.concat=gy,v.cond=q1,v.conforms=W1,v.constant=Cl,v.countBy=bm,v.create=Pv,v.curry=Cf,v.curryRight=Df,v.debounce=Sf,v.defaults=Fv,v.defaultsDeep=kv,v.defer=Ym,v.delay=Xm,v.difference=yy,v.differenceBy=my,v.differenceWith=vy,v.drop=xy,v.dropRight=Ey,v.dropRightWhile=Ay,v.dropWhile=wy,v.fill=by,v.filter=_m,v.flatMap=Sm,v.flatMapDeep=Om,v.flatMapDepth=Lm,v.flatten=yf,v.flattenDeep=Ty,v.flattenDepth=_y,v.flip=Zm,v.flow=z1,v.flowRight=$1,v.fromPairs=Cy,v.functions=$v,v.functionsIn=Gv,v.groupBy=Nm,v.initial=Sy,v.intersection=Oy,v.intersectionBy=Ly,v.intersectionWith=Ny,v.invert=Xv,v.invertBy=Zv,v.invokeMap=Bm,v.iteratee=Dl,v.keyBy=Im,v.keys=Ae,v.keysIn=Qe,v.map=No,v.mapKeys=Kv,v.mapValues=jv,v.matches=G1,v.matchesProperty=Y1,v.memoize=Bo,v.merge=Jv,v.mergeWith=kf,v.method=X1,v.methodOf=Z1,v.mixin=Sl,v.negate=Io,v.nthArg=K1,v.omit=t1,v.omitBy=e1,v.once=Qm,v.orderBy=Rm,v.over=j1,v.overArgs=Km,v.overEvery=J1,v.overSome=tx,v.partial=El,v.partialRight=Of,v.partition=Pm,v.pick=r1,v.pickBy=Hf,v.property=Gf,v.propertyOf=ex,v.pull=Ry,v.pullAll=vf,v.pullAllBy=Py,v.pullAllWith=Fy,v.pullAt=ky,v.range=rx,v.rangeRight=ix,v.rearg=jm,v.reject=Hm,v.remove=Hy,v.rest=Jm,v.reverse=ml,v.sampleSize=qm,v.set=n1,v.setWith=s1,v.shuffle=Wm,v.slice=Uy,v.sortBy=$m,v.sortedUniq=Yy,v.sortedUniqBy=Xy,v.split=S1,v.spread=tv,v.tail=Zy,v.take=Qy,v.takeRight=Ky,v.takeRightWhile=jy,v.takeWhile=Jy,v.tap=dm,v.throttle=ev,v.thru=Lo,v.toArray=If,v.toPairs=Uf,v.toPairsIn=qf,v.toPath=ux,v.toPlainObject=Pf,v.transform=a1,v.unary=rv,v.union=tm,v.unionBy=em,v.unionWith=rm,v.uniq=im,v.uniqBy=nm,v.uniqWith=sm,v.unset=o1,v.unzip=vl,v.unzipWith=xf,v.update=u1,v.updateWith=l1,v.values=gs,v.valuesIn=h1,v.without=am,v.words=zf,v.wrap=iv,v.xor=om,v.xorBy=um,v.xorWith=lm,v.zip=hm,v.zipObject=cm,v.zipObjectDeep=fm,v.zipWith=pm,v.entries=Uf,v.entriesIn=qf,v.extend=Ff,v.extendWith=Fo,Sl(v,v),v.add=hx,v.attempt=$f,v.camelCase=d1,v.capitalize=Wf,v.ceil=cx,v.clamp=c1,v.clone=sv,v.cloneDeep=ov,v.cloneDeepWith=uv,v.cloneWith=av,v.conformsTo=lv,v.deburr=Vf,v.defaultTo=V1,v.divide=fx,v.endsWith=g1,v.eq=Ur,v.escape=y1,v.escapeRegExp=m1,v.every=Tm,v.find=Cm,v.findIndex=df,v.findKey=Hv,v.findLast=Dm,v.findLastIndex=gf,v.findLastKey=Uv,v.floor=px,v.forEach=Af,v.forEachRight=wf,v.forIn=qv,v.forInRight=Wv,v.forOwn=Vv,v.forOwnRight=zv,v.get=bl,v.gt=hv,v.gte=cv,v.has=Yv,v.hasIn=Tl,v.head=mf,v.identity=Ke,v.includes=Mm,v.indexOf=Dy,v.inRange=f1,v.invoke=Qv,v.isArguments=kn,v.isArray=mt,v.isArrayBuffer=fv,v.isArrayLike=Ze,v.isArrayLikeObject=ne,v.isBoolean=pv,v.isBuffer=ln,v.isDate=dv,v.isElement=gv,v.isEmpty=yv,v.isEqual=mv,v.isEqualWith=vv,v.isError=Al,v.isFinite=xv,v.isFunction=Oi,v.isInteger=Lf,v.isLength=Ro,v.isMap=Nf,v.isMatch=Ev,v.isMatchWith=Av,v.isNaN=wv,v.isNative=bv,v.isNil=_v,v.isNull=Tv,v.isNumber=Mf,v.isObject=Jt,v.isObjectLike=re,v.isPlainObject=sa,v.isRegExp=wl,v.isSafeInteger=Cv,v.isSet=Bf,v.isString=Po,v.isSymbol=dr,v.isTypedArray=ds,v.isUndefined=Dv,v.isWeakMap=Sv,v.isWeakSet=Ov,v.join=My,v.kebabCase=v1,v.last=Or,v.lastIndexOf=By,v.lowerCase=x1,v.lowerFirst=E1,v.lt=Lv,v.lte=Nv,v.max=dx,v.maxBy=gx,v.mean=yx,v.meanBy=mx,v.min=vx,v.minBy=xx,v.stubArray=Ll,v.stubFalse=Nl,v.stubObject=nx,v.stubString=sx,v.stubTrue=ax,v.multiply=Ex,v.nth=Iy,v.noConflict=Q1,v.noop=Ol,v.now=Mo,v.pad=A1,v.padEnd=w1,v.padStart=b1,v.parseInt=T1,v.random=p1,v.reduce=Fm,v.reduceRight=km,v.repeat=_1,v.replace=C1,v.result=i1,v.round=Ax,v.runInContext=S,v.sample=Um,v.size=Vm,v.snakeCase=D1,v.some=zm,v.sortedIndex=qy,v.sortedIndexBy=Wy,v.sortedIndexOf=Vy,v.sortedLastIndex=zy,v.sortedLastIndexBy=$y,v.sortedLastIndexOf=Gy,v.startCase=O1,v.startsWith=L1,v.subtract=wx,v.sum=bx,v.sumBy=Tx,v.template=N1,v.times=ox,v.toFinite=Li,v.toInteger=vt,v.toLength=Rf,v.toLower=M1,v.toNumber=Lr,v.toSafeInteger=Mv,v.toString=Ft,v.toUpper=B1,v.trim=I1,v.trimEnd=R1,v.trimStart=P1,v.truncate=F1,v.unescape=k1,v.uniqueId=lx,v.upperCase=H1,v.upperFirst=_l,v.each=Af,v.eachRight=wf,v.first=mf,Sl(v,function(){var n={};return ii(v,function(a,l){Ht.call(v.prototype,l)||(n[l]=a)}),n}(),{chain:!1}),v.VERSION=r,Tr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){v[n].placeholder=v}),Tr(["drop","take"],function(n,a){Ct.prototype[n]=function(l){l=l===t?1:ye(vt(l),0);var f=this.__filtered__&&!a?new Ct(this):this.clone();return f.__filtered__?f.__takeCount__=Me(l,f.__takeCount__):f.__views__.push({size:Me(l,oe),type:n+(f.__dir__<0?"Right":"")}),f},Ct.prototype[n+"Right"]=function(l){return this.reverse()[n](l).reverse()}}),Tr(["filter","map","takeWhile"],function(n,a){var l=a+1,f=l==pt||l==N;Ct.prototype[n]=function(d){var x=this.clone();return x.__iteratees__.push({iteratee:ut(d,3),type:l}),x.__filtered__=x.__filtered__||f,x}}),Tr(["head","last"],function(n,a){var l="take"+(a?"Right":"");Ct.prototype[n]=function(){return this[l](1).value()[0]}}),Tr(["initial","tail"],function(n,a){var l="drop"+(a?"":"Right");Ct.prototype[n]=function(){return this.__filtered__?new Ct(this):this[l](1)}}),Ct.prototype.compact=function(){return this.filter(Ke)},Ct.prototype.find=function(n){return this.filter(n).head()},Ct.prototype.findLast=function(n){return this.reverse().find(n)},Ct.prototype.invokeMap=bt(function(n,a){return typeof n=="function"?new Ct(this):this.map(function(l){return Js(l,n,a)})}),Ct.prototype.reject=function(n){return this.filter(Io(ut(n)))},Ct.prototype.slice=function(n,a){n=vt(n);var l=this;return l.__filtered__&&(n>0||a<0)?new Ct(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)},Ct.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ct.prototype.toArray=function(){return this.take(oe)},ii(Ct.prototype,function(n,a){var l=/^(?:filter|find|map|reject)|While$/.test(a),f=/^(?:head|last)$/.test(a),d=v[f?"take"+(a=="last"?"Right":""):a],x=f||/^find/.test(a);d&&(v.prototype[a]=function(){var w=this.__wrapped__,C=f?[1]:arguments,O=w instanceof Ct,z=C[0],$=O||mt(w),Y=function(Tt){var St=d.apply(v,en([Tt],C));return f&&K?St[0]:St};$&&l&&typeof z=="function"&&z.length!=1&&(O=$=!1);var K=this.__chain__,st=!!this.__actions__.length,ht=x&&!K,wt=O&&!st;if(!x&&$){w=wt?w:new Ct(this);var ct=n.apply(w,C);return ct.__actions__.push({func:Lo,args:[Y],thisArg:t}),new Cr(ct,K)}return ht&&wt?n.apply(this,C):(ct=this.thru(Y),ht?f?ct.value()[0]:ct.value():ct)})}),Tr(["pop","push","shift","sort","splice","unshift"],function(n){var a=eo[n],l=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",f=/^(?:pop|shift)$/.test(n);v.prototype[n]=function(){var d=arguments;if(f&&!this.__chain__){var x=this.value();return a.apply(mt(x)?x:[],d)}return this[l](function(w){return a.apply(mt(w)?w:[],d)})}}),ii(Ct.prototype,function(n,a){var l=v[a];if(l){var f=l.name+"";Ht.call(ls,f)||(ls[f]=[]),ls[f].push({name:a,func:l})}}),ls[bo(t,P).name]=[{name:"wrapper",func:t}],Ct.prototype.clone=k0,Ct.prototype.reverse=H0,Ct.prototype.value=U0,v.prototype.at=gm,v.prototype.chain=ym,v.prototype.commit=mm,v.prototype.next=vm,v.prototype.plant=Em,v.prototype.reverse=Am,v.prototype.toJSON=v.prototype.valueOf=v.prototype.value=wm,v.prototype.first=v.prototype.head,Gs&&(v.prototype[Gs]=xm),v},as=m0();Ln?((Ln.exports=as)._=as,Du._=as):_e._=as}).call(oa)})(au,au.exports);var vE=au.exports;const It=od(vE);class Ot{constructor(e=new k(1/0,1/0),t=new k(-1/0,-1/0)){p(this,"isBox2",!0);p(this,"min");p(this,"max");this.min=e,this.max=t}applyMatrix3(e){return this.isEmpty()?this:(fa[0].set(this.min.x,this.min.y).applyMatrix3(e),fa[1].set(this.min.x,this.max.y).applyMatrix3(e),fa[3].set(this.max.x,this.max.y).applyMatrix3(e),fa[2].set(this.max.x,this.min.y).applyMatrix3(e),this.setFromPoints(fa),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 je.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(),Es.copy(e.geometry.boundingBox),Es.applyMatrix3(e.matrixWorld),this.union(Es)):e.geometry.points&&e.geometry.points.length&&(Es.setFromPoints(e.geometry.points),Es.applyMatrix3(e.matrixWorld),this.union(Es)),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(je),je.x*je.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(je.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=je.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=It.map(r,o=>parseFloat(o));for(let o=0,u=s.length;o<u;o+=2)this.expandByPoint(je.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(je),this.getSize(ai),ai.subScalar(t);const o=Math.floor(ai.x/s),u=Math.ceil(e/o),h=o*s,c=u*s;if(ai.x<s||ai.y<s||h>=ai.x||c>=ai.y)return je.clone();let g=[],A=0,_=0;for(let D=0;D<e;D++){const B=o>e?e*s:h,L=je.x-B/2+_*s+s/2,I=je.y-c/2+A*s+s/2;g.push(new k(L,I)),_++,_>=o&&(_=0,A++)}return g}flipY(){return je.copy(this.min).multiplyScalar(1,-1),ai.copy(this.max).multiplyScalar(1,-1),this.min.set(je.x,ai.y),this.max.set(ai.x,je.y),this}}const Es=new Ot,fa=[new k,new k,new k,new k],je=new k,ai=new k,xE=Object.freeze(Object.defineProperty({__proto__:null,default:Ot},Symbol.toStringTag,{value:"Module"})),EE=Vt.window.requestAnimationFrame,pa=Vt.window.performance?()=>Vt.window.performance.now():()=>new Date().getTime(),pp=EE,Bt=class Bt{constructor(){p(this,"id",Bt.idCounter++);p(this,"timers",new Map);p(this,"timersDuration",new Map);p(this,"counters",new Map);p(this,"countersAmount",new Map);p(this,"out",[])}static active(e){e?Bt.actived=!0:Bt.actived=!1,Bt.duration=e||0}static add(e){this.children.push(e),this.handleStart()}static remove(e){for(let t=0,r=Bt.children.length;t<r;t++)if(Bt.children[t].id===e.id){this.children.splice(t,1);break}}static handleStart(){this.isRunning||(this.isRunning=!0,pp(this.runLoop))}static runLoop(){Bt.children.length?(Bt.runFrames(),pp(Bt.runLoop)):Bt.isRunning=!1}static runFrames(){let e,t=pa();if(!(t-Bt.lastTime<Bt.duration)){Bt.lastTime=t;for(let r=0,s=this.children.length;r<s;r++)e=this.children[r],e.calculateTimers(),e.calculateCounters(),Bt.messages=Bt.messages.concat(e.out),e.out.length=0;if(Bt.messages.length){if(Bt.actived){let r=[];r.push(AE),r.push(wE),r.push(bE),this.messages.forEach(s=>r.push(OE(s,this.maxLetters))),r.push(TE),console.log(r.join(`
32
32
  `))}Bt.messages.length=0}}}destroy(){Bt.remove(this)}addTimer(e,t=pa(),r=pa()-(this.timersDuration.get(e)||pa())){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(),Bt.add(this),this}stop(){return Bt.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/Bt.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/Bt.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}};p(Bt,"idCounter",0),p(Bt,"children",[]),p(Bt,"isRunning",!1),p(Bt,"actived",!1),p(Bt,"duration",0),p(Bt,"lastTime",pa()),p(Bt,"messages",[]),p(Bt,"maxLetters",20);let Ms=Bt;const gu=20,yu=["avg","min","max","stdDev","count","FPS"],hi=CE(yu,1),AE=_E(yu,gu),wE=DE(yu,gu),bE=SE(yu,gu),TE=LE(gu);function _E(i,e=20){let t="┌";t+="─".repeat(e),t+="┬";for(let r=0,s=i.length;r<s;r++)t+="─".repeat(hi),r<s-1?t+="┬":t+="┐";return t}function CE(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 DE(i,e=20){let t="│";t+=" ".repeat(e),t+="│";for(let r=0,s=i.length;r<s;r++)t+=" ".repeat(Math.max(hi-i[r].length-1,0)),t+=i[r],t+=" │";return t}function SE(i,e=20){let t="├";t+="─".repeat(e),t+="┼";for(let r=0,s=i.length;r<s;r++)t+="─".repeat(hi),r<s-1?t+="┴":t+="┘";return t}function OE(i,e=20){let t="│";t+=" ".repeat(Math.max(e-i.name.length,0)),t+=i.name,t+="│";const r=typeof i.avg=="string"?hi-i.avg.length:hi-i.avg.toString().length;return t+=" ".repeat(Math.max(r,0)),t+=i.avg+" ",t+=" ".repeat(Math.max(hi-i.min.toString().length,0)),t+=i.min+" ",t+=" ".repeat(Math.max(hi-i.max.toString().length,0)),t+=i.max+" ",t+=" ".repeat(Math.max(hi-i.stdDev.toString().length,0)),t+=i.stdDev+" ",t+=" ".repeat(Math.max(hi-i.count.toString().length,0)),t+=i.count+" ",t+=" ".repeat(Math.max(hi-i.FPS.toString().length,0)),t+=i.FPS,t}function LE(i=20){let e="└";for(let t=0;t<i;t++)e+="─";return e+="┘",e}function Hl(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 Jo(i=2e3){return _t(this,null,function*(){return new Promise(e=>setTimeout(e,(Math.random()+.5)*i))})}function Fd(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=>Fd(s,e)))),e}var er=(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))(er||{}),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 Bs="ae",kd="-",sh="rm-assets",NE="rm-labels",dp="ws-assets",gp="ws-labels";function Cs(i){return i+kd+Ua.ASSETS}function ba(i){return i+kd+Ua.LABELS}const Hd={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:[sh,NE,dp,gp,"eq-assets","eq-labels","fn-assets","fn-labels"],eq:[dp,gp,"su-assets","su-labels","fn-assets","fn-labels"]};class ar{constructor(){p(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 Ud(i){if(!i)return"inches";let e=i.querySelector("#defaultView"),t=e==null?void 0:e.getAttribute("units");return t||"inches"}function ME(i){if(!i)return 1;let e=Ud(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 BE(i,e=new Ot){if(!i)return e;let t=i.split(" "),r=It.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 IE(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 qd(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 RE=new Ms().start();class PE extends ar{constructor(t){super();p(this,"isSvgRenderer",!0);p(this,"id");p(this,"params");p(this,"container",Vt.window.document.getElementsByTagName("body")[0]);p(this,"cameraVersion",-1);p(this,"viewAreaLimit",-1);p(this,"autoClear");this.id="SvgRenderer@"+Date.now(),this.params=t,Vt.config=t,this.initSvg(),Ms.active(this.params.monitorDuration)}destroy(){Ms.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 g,A;const t=((g=this.container)==null?void 0:g.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 _t(this,null,function*(){var o;if(!t||!r||this.cameraVersion===(r==null?void 0:r.version))return;r.updateMatrixWorld(),mp.set(0,0).unproject(r),vp.set(this.params.width,this.params.height).unproject(r),yp.setFromPoints([mp,vp]);let s=IE(yp);(o=t.svg)==null||o.setAttribute("viewBox",s),this.cameraVersion=r.version||-1,RE.addTimer("render cycle")})}getRenderTarget(){}setRenderTarget(t){}renderTexture(t,r){}}const yp=new Ot,mp=new k,vp=new k;class pe{constructor(){p(this,"isMatrix3",!0);p(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 pe().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 Vr.identity(),Vo.makeTranslation(e.x,e.y),da.makeRotation(t.x),Hn.makeScale(r.x,r.y),De.copy(s).applyMatrix3(Hn),Vr.multiply(Ul.makeTranslation(-De.x,-De.y)).multiply(Vo).multiply(Ul.makeTranslation(De.x,De.y)).multiply(da).multiply(Ul.makeTranslation(-De.x,-De.y)).multiply(Hn),this.copy(Vr)}decompose(e,t,r){const s=Vr.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,g=0,A=0;if(o!==0||h!==0){const _=Math.hypot(o,h);y=_,g=(o*c-u*h)/_;const D=Math.acos(o/_);A=h>0?-D:D}else if(u!==0||c!==0){const _=Math.hypot(u,c);y=(o*c-u*h)/_,g=_;const D=Math.acos(u/_);A=Math.PI/2+(c>0?-D:D)}else y=0,g=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=g}composeSvgTransform(e=0,t=0,r,s=!1){if(!r&&!e&&!t)return this;this.identity(),Vr.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 g=Number(h[1])||1,A=Number(h[2])||g;Vr.multiply(Hn.makeScale(g,A))}else if(c){const g=fE(Number(c[1])||0);Number(c[2])||Number(c[3])?(Ie.set(Number(c[2]||"0"),Number(c[3]||"0")),Vr.multiply(da.makeRotationByPoint(g,Ie))):Vr.multiply(da.makeRotation(g))}else y&&Vr.multiply(Vo.makeTranslation(Number(y[1])||0,Number(y[2])||0))}),this.copy(Vr),s&&this.premultiply(Hn.makeScale(1,-1)),this}decomposeSvgMatrix(e,t,r){const s=Vr.copy(this).elements;Ie.set(s[0],s[1]),De.set(s[3],s[4]);let o=Ie.length();Ie.normalize();let u=Ie.dot(De);xp.copy(Ie).multiplyScalar(-u),De.add(xp);const h=De.length()||0;De.normalize(),Ie.x*De.y<De.x*Ie.y&&(Ie.x=-Ie.x,Ie.y=-Ie.y,o=-o,u=-u);const c=o?Math.atan2(Ie.y,Ie.x):Math.atan2(-Ie.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],g=e[8];return t*u*g-t*y*h-o*r*g+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(Hn.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]-FE[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],g=e[8],A=g*u-h*y,_=h*c-g*o,D=y*o-u*c,B=t*A+r*_+s*D;if(B===0)return this.set(0,0,0,0,0,0,0,0,0);const L=1/B;return e[0]=A*L,e[1]=(s*y-g*r)*L,e[2]=(h*r-s*u)*L,e[3]=_*L,e[4]=(g*t-s*c)*L,e[5]=(s*o-h*t)*L,e[6]=D*L,e[7]=(r*c-y*t)*L,e[8]=(u*t-r*o)*L,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,g=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]=g,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(kE,e,HE)}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],g=r[4],A=r[7],_=r[2],D=r[5],B=r[8],L=s[0],I=s[3],P=s[6],V=s[1],G=s[4],b=s[7],F=s[2],W=s[5],j=s[8];return o[0]=u*L+h*V+c*F,o[3]=u*I+h*G+c*W,o[6]=u*P+h*b+c*j,o[1]=y*L+g*V+A*F,o[4]=y*I+g*G+A*W,o[7]=y*P+g*b+A*j,o[2]=_*L+D*V+B*F,o[5]=_*I+D*G+B*W,o[8]=_*P+D*b+B*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(da.makeRotation(-e))}scale(e,t){return this.premultiply(Hn.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(Vo.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 FE=[1,0,0,0,1,0,0,0,1],Ie=new k,De=new k,xp=new k,Vr=new pe,Vo=new pe,da=new pe,Hn=new pe,Ul=new pe,kE=new k(0,0,0),HE=new k(1,1,1),Re=["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"],Wd=()=>{const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Re[i&255]+Re[i>>8&255]+Re[i>>16&255]+Re[i>>24&255]+"-"+Re[e&255]+Re[e>>8&255]+"-"+Re[e>>16&15|64]+Re[e>>24&255]+"-"+Re[t&63|128]+Re[t>>8&255]+"-"+Re[t>>16&255]+Re[t>>24&255]+Re[r&255]+Re[r>>8&255]+Re[r>>16&255]+Re[r>>24&255]).toLowerCase()};class Vd extends ar{constructor(t={}){super();p(this,"isObject2",!0);p(this,"id",UE++);p(this,"uuid",Wd());p(this,"name");p(this,"type","Object2");p(this,"featureKey","Object2_"+this.id);p(this,"parent");p(this,"children",[]);p(this,"up",new k(0,1));p(this,"position",new k);p(this,"rotation",new k);p(this,"scaled",new k(1,1));p(this,"flipY",!1);p(this,"selectable",!1);p(this,"matrix",new pe);p(this,"matrixWorld",new pe);p(this,"matrixWorldInverse",new pe);p(this,"modelViewMatrix",new pe);p(this,"normalMatrix",new pe);p(this,"fixed",!1);p(this,"dynamically",!1);p(this,"matrixAutoUpdate",!1);p(this,"matrixWorldNeedsUpdate",!1);p(this,"matrixWorldAutoUpdate",!1);p(this,"composeNode",!1);p(this,"isInComposeNode",!1);p(this,"alignCenter",!1);p(this,"boundingBox",new Ot);p(this,"boundingBoxWorld",new Ot);p(this,"boundingBoxNeedsUpdate",!1);p(this,"centerPoint",new k);p(this,"visible",!0);p(this,"castShadow",!1);p(this,"receiveShadow",!1);p(this,"renderOrder",0);p(this,"animations",[]);p(this,"finalSize");p(this,"userData",{});p(this,"DefaultUp",new k(0,1));p(this,"_autoSort",!0);p(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(Vl)}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(ya,this.rotation,Wl)}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(oi.copy(this.matrixWorld).invert())}lookAt(t){Ep.copy(t),this.updateWorldMatrix(!0,!1),this.matrixWorld.getTransition(ya),oi.lookAt(ya,Ep,qE),oi.getRotation(Un),this.rotation.set(Un.x,Un.x),this.parent&&(this.parent.matrixWorld.getRotation(Un),this.rotate(Un.x))}applyMatrix3(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.rotation,this.scaled)}updateMatrix(){ql.copy(this.scaled),this.flipY&&(ql.y*=-1),this.matrix.compose(this.position,this.rotation,ql),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){oi.copy(this.matrixWorld),t&&this.fixed?this.modelViewMatrix.copy(t.projectionMatrix):t?this.modelViewMatrix.multiplyMatrices(t.viewMatrix,oi):this.modelViewMatrix.copy(oi);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(),ga.copy(this.children[t].computeBoundingBox()),ga.applyMatrix3(oi.copy(this.children[t].matrixWorld)),this.boundingBox.union(ga);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(WE),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(Vl)),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(Vl)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),oi.copy(this.matrixWorld).invert(),t.parent&&(t.parent.updateWorldMatrix(!0,!1),oi.multiply(t.parent.matrixWorld)),t.applyMatrix3(oi),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,Un,Wl),t}getWorldRotation(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ya,t,Wl),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ya,Un,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(ga.copy(t),ga.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 UE=0;const ql=new k,oi=new pe,Ep=new k,ga=new Ot,ya=new k,Wl=new k,Un=new k,qE=new k(0,1),WE={type:"added"},Vl={type:"removed"};class VE extends Vd{constructor(){super();p(this,"name","Scene");p(this,"type","Scene");p(this,"isScene",!0);p(this,"view");p(this,"background");p(this,"featureKey","Scene_"+this.id);p(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=er.RM,s=[]){throw new Error("must be implemented in derived")}}class zE{constructor(e,t,r){p(this,"isLoading",!1);p(this,"itemsLoaded",0);p(this,"itemsTotal",0);p(this,"urlModifier");p(this,"handlers",[]);p(this,"onStart");p(this,"onLoad");p(this,"onProgress");p(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 Ap={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={}}},$E=new zE;class zd{constructor(e=$E){p(this,"manager");p(this,"crossOrigin","anonymous");p(this,"withCredentials",!1);p(this,"path","");p(this,"resourcePath","");p(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 Bi={};class GE extends Error{constructor(t,r){super(t);p(this,"response");this.response=r}}class YE extends zd{constructor(t){super(t);p(this,"mimeType");p(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=Ap.get(t);if(u!==void 0)return this.manager.itemStart(t),setTimeout(()=>{r&&r(u),this.manager.itemEnd(t)},0),u;if(Bi[t]!==void 0){Bi[t].push({onLoad:r,onProgress:s,onError:o});return}Bi[t]=[],Bi[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(g=>{if(g.status===200||g.status===0){if(g.status===0&&console.warn("FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||g.body===void 0||g.body.getReader===void 0)return g;const A=Bi[t],_=g.body.getReader(),D=g.headers.get("Content-Length")||g.headers.get("X-File-Size"),B=D?parseInt(D):0,L=B!==0;let I=0;const P=new ReadableStream({start(V){G();function G(){_.read().then(({done:b,value:F})=>{if(b)V.close();else{I+=F.byteLength;const W=new ProgressEvent("progress",{lengthComputable:L,loaded:I,total:B});for(let j=0,rt=A.length;j<rt;j++){const Q=A[j];Q.onProgress&&Q.onProgress(W)}V.enqueue(F),G()}})}}});return new Response(P)}else throw new GE(`fetch for "${g.url}" responded with ${g.status}: ${g.statusText}`,g)}).then(g=>{switch(y){case"arraybuffer":return g.arrayBuffer();case"blob":return g.blob();case"document":return g.text().then(A=>new DOMParser().parseFromString(A,c));case"json":return g.json();default:if(c===void 0)return g.text();{const _=/charset="?([^;"\s]*)"?/i.exec(c),D=_&&_[1]?_[1].toLowerCase():void 0,B=new TextDecoder(D);return g.arrayBuffer().then(L=>B.decode(L))}}}).then(g=>{Ap.add(t,g);const A=Bi[t];delete Bi[t];for(let _=0,D=A.length;_<D;_++){const B=A[_];B.onLoad&&B.onLoad(g)}}).catch(g=>{const A=Bi[t];if(A===void 0)throw this.manager.itemError(t),g;delete Bi[t];for(let _=0,D=A.length;_<D;_++){const B=A[_];B.onError&&B.onError(g)}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 $d extends zd{constructor(e){super(e)}load(e,t,r,s){const o=this,u=new YE(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 zo(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 XE(i,e,t,r,s,o,u,h,c){let y=c*(Math.PI/180),g=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,_=g*g/(u*u)+A*A/(h*h);_>1&&(u*=Math.sqrt(_),h*=Math.sqrt(_));let D=Math.sqrt((u*u*(h*h)-u*u*(A*A)-h*h*(g*g))/(u*u*(A*A)+h*h*(g*g)));s===o&&(D*=-1),isNaN(D)&&(D=0);let B=D*u*A/h,L=D*-h*g/u,I=(i+t)/2+Math.cos(y)*B-Math.sin(y)*L,P=(e+r)/2+Math.sin(y)*B+Math.cos(y)*L,V=function(Q){return Math.sqrt(Q[0]*Q[0]+Q[1]*Q[1])},G=function(Q,it){return(Q[0]*it[0]+Q[1]*it[1])/(V(Q)*V(it))},b=function(Q,it){return(Q[0]*it[1]<Q[1]*it[0]?-1:1)*Math.acos(G(Q,it))},F=b([1,0],[(g-B)/u,(A-L)/h]),W=[(g-B)/u,(A-L)/h],j=[(-1*g-B)/u,(-1*A-L)/h],rt=b(W,j);return G(W,j)<=-1&&(rt=Math.PI),G(W,j)>=1&&(rt=0),o===0&&rt>0&&(rt=rt-2*Math.PI),o===1&&rt<0&&(rt=rt+2*Math.PI),[I,P,u,h,F,rt,y,o]}const ce=" ";function ZE(i){let e="";Array.isArray(i)||(i=[i]);for(let t=0;t<i.length;t++){const r=i[t];if(r.type===U.CLOSE_PATH)e+="z";else if(r.type===U.HORIZ_LINE_TO)e+=(r.relative?"h":"H")+r.x;else if(r.type===U.VERT_LINE_TO)e+=(r.relative?"v":"V")+r.y;else if(r.type===U.MOVE_TO)e+=(r.relative?"m":"M")+r.x+ce+r.y;else if(r.type===U.LINE_TO)e+=(r.relative?"l":"L")+r.x+ce+r.y;else if(r.type===U.CURVE_TO)e+=(r.relative?"c":"C")+r.x1+ce+r.y1+ce+r.x2+ce+r.y2+ce+r.x+ce+r.y;else if(r.type===U.SMOOTH_CURVE_TO)e+=(r.relative?"s":"S")+r.x2+ce+r.y2+ce+r.x+ce+r.y;else if(r.type===U.QUAD_TO)e+=(r.relative?"q":"Q")+r.x1+ce+r.y1+ce+r.x+ce+r.y;else if(r.type===U.SMOOTH_QUAD_TO)e+=(r.relative?"t":"T")+r.x+ce+r.y;else if(r.type===U.ARC)e+=(r.relative?"a":"A")+r.rX+ce+r.rY+ce+r.xRot+ce+ +r.lArcFlag+ce+ +r.sweepFlag+ce+r.x+ce+r.y;else throw new Error(`Unexpected command type "${r==null?void 0:r.type}" at index ${t}.`)}return e}function ah([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 gn=Math.PI;function _h(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;r=Math.abs(i.rX),s=Math.abs(i.rY);const[h,c]=ah([(e-o)/2,(t-u)/2],-i.xRot/180*gn),y=Math.pow(h,2)/Math.pow(r,2)+Math.pow(c,2)/Math.pow(s,2);1<y&&(r*=Math.sqrt(y),s*=Math.sqrt(y)),i.rX=r,i.rY=s;const g=Math.pow(r,2)*Math.pow(c,2)+Math.pow(s,2)*Math.pow(h,2),A=(i.lArcFlag!==i.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(s,2)-g)/g)),_=r*c/s*A,D=-s*h/r*A,B=ah([_,D],i.xRot/180*gn);i.cX=B[0]+(e+o)/2,i.cY=B[1]+(t+u)/2,i.phi1=Math.atan2((c-D)/s,(h-_)/r),i.phi2=Math.atan2((-c-D)/s,(-h-_)/r),i.sweepFlag===0&&i.phi2>i.phi1&&(i.phi2-=2*gn),i.sweepFlag===1&&i.phi2<i.phi1&&(i.phi2+=2*gn),i.phi1*=180/gn,i.phi2*=180/gn}function wp(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 Ii=Math.PI/180;function bp(i,e,t){return(1-t)*i+t*e}function Tp(i,e,t,r){return i+Math.cos(r/180*gn)*e+Math.sin(r/180*gn)*t}function _p(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,g=3*o;return Math.abs(c)<1e-6?[-g/y]:QE(y/c,g/c,1e-6)}function Cp(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 QE(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 KE(i,e,t){i.cX||_h(i,e,t);const r=Math.min(i.phi1,i.phi2),s=Math.max(i.phi1,i.phi2),o=s-r,u=Math.ceil(o/90),h=new Array(u);let c=e,y=t;for(let g=0;g<u;g++){const A=bp(i.phi1,i.phi2,g/u),_=bp(i.phi1,i.phi2,(g+1)/u),D=_-A,B=4/3*Math.tan(D*Ii/4),[L,I]=[Math.cos(A*Ii)-B*Math.sin(A*Ii),Math.sin(A*Ii)+B*Math.cos(A*Ii)],[P,V]=[Math.cos(_*Ii),Math.sin(_*Ii)],[G,b]=[P+B*Math.sin(_*Ii),V-B*Math.cos(_*Ii)],F={relative:i.relative,type:U.CURVE_TO},W=(j,rt)=>{const[Q,it]=ah([j*i.rX,rt*i.rY],i.xRot);return[i.cX+Q,i.cY+it]};[F.x1,F.y1]=W(L,I),[F.x2,F.y2]=W(G,b),[F.x,F.y]=W(P,V),i.relative&&(F.x1-=c,F.y1-=y,F.x2-=c,F.y2-=y,F.x-=c,F.y-=y),[c,y]=[F.x,F.y],h[g]=F}return h}function jE(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 Gd(){return Qr((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 JE(){return Qr((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 tA(i=!0,e=!0,t=!0){return Qr((r,s,o,u,h)=>{if(isNaN(u)&&!(r.type&U.MOVE_TO))throw new Error("path must start with moveto");return e&&r.type&U.HORIZ_LINE_TO&&(r.type=U.LINE_TO,r.y=r.relative?0:o),t&&r.type&U.VERT_LINE_TO&&(r.type=U.LINE_TO,r.x=r.relative?0:s),i&&r.type&U.CLOSE_PATH&&(r.type=U.LINE_TO,r.x=r.relative?u-s:u,r.y=r.relative?h-o:h),r.type&U.ARC&&(r.rX===0||r.rY===0)&&(r.type=U.LINE_TO,delete r.rX,delete r.rY,delete r.xRot,delete r.lArcFlag,delete r.sweepFlag),r})}function Yd(){let i=NaN,e=NaN,t=NaN,r=NaN;return Qr((s,o,u)=>(s.type&U.SMOOTH_CURVE_TO&&(s.type=U.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&U.CURVE_TO?(i=s.relative?o+s.x2:s.x2,e=s.relative?u+s.y2:s.y2):(i=NaN,e=NaN),s.type&U.SMOOTH_QUAD_TO&&(s.type=U.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&U.QUAD_TO?(t=s.relative?o+s.x1:s.x1,r=s.relative?u+s.y1:s.y1):(t=NaN,r=NaN),s))}function Xd(){let i=NaN,e=NaN;return Qr((t,r,s)=>{if(t.type&U.SMOOTH_QUAD_TO&&(t.type=U.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&U.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=U.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 Qr(i){let e=0,t=0,r=NaN,s=NaN;return function(u){if(isNaN(r)&&!(u.type&U.MOVE_TO))throw new Error("path must start with moveto");const h=i(u,e,t,r,s);return u.type&U.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&U.MOVE_TO&&(r=e,s=t),h}}function eA(i=0){Zr(i);let e=NaN,t=NaN,r=NaN,s=NaN;return Qr((o,u,h,c,y)=>{const g=Math.abs;let A=!1,_=0,D=0;if(o.type&U.SMOOTH_CURVE_TO&&(_=isNaN(e)?0:u-e,D=isNaN(t)?0:h-t),o.type&(U.CURVE_TO|U.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&U.SMOOTH_QUAD_TO?(r=isNaN(r)?u:2*u-r,s=isNaN(s)?h:2*h-s):o.type&U.QUAD_TO?(r=o.relative?u+o.x1:o.x1,s=o.relative?h+o.y1:o.y2):(r=NaN,s=NaN),o.type&U.LINE_COMMANDS||o.type&U.ARC&&(o.rX===0||o.rY===0||!o.lArcFlag)||o.type&U.CURVE_TO||o.type&U.SMOOTH_CURVE_TO||o.type&U.QUAD_TO||o.type&U.SMOOTH_QUAD_TO){const B=typeof o.x=="undefined"?0:o.relative?o.x:o.x-u,L=typeof o.y=="undefined"?0:o.relative?o.y:o.y-h;_=isNaN(r)?typeof o.x1=="undefined"?_:o.relative?o.x:o.x1-u:r-u,D=isNaN(s)?typeof o.y1=="undefined"?D:o.relative?o.y:o.y1-h:s-h;const I=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;g(B)<=i&&g(L)<=i&&g(_)<=i&&g(D)<=i&&g(I)<=i&&g(P)<=i&&(A=!0)}return o.type&U.CLOSE_PATH&&g(u-c)<=i&&g(h-y)<=i&&(A=!0),A?[]:o})}function xn(i,e,t,r,s,o){return Zr(i,e,t,r,s,o),Qr((u,h,c,y)=>{const g=u.x1,A=u.x2,_=u.relative&&!isNaN(y),D=typeof u.x!="undefined"?u.x:_?0:h,B=typeof u.y!="undefined"?u.y:_?0:c;u.type&U.HORIZ_LINE_TO&&e!==0&&(u.type=U.LINE_TO,u.y=u.relative?0:c),u.type&U.VERT_LINE_TO&&t!==0&&(u.type=U.LINE_TO,u.x=u.relative?0:h),typeof u.x!="undefined"&&(u.x=u.x*i+B*t+(_?0:s)),typeof u.y!="undefined"&&(u.y=D*e+u.y*r+(_?0:o)),typeof u.x1!="undefined"&&(u.x1=u.x1*i+u.y1*t+(_?0:s)),typeof u.y1!="undefined"&&(u.y1=g*e+u.y1*r+(_?0:o)),typeof u.x2!="undefined"&&(u.x2=u.x2*i+u.y2*t+(_?0:s)),typeof u.y2!="undefined"&&(u.y2=A*e+u.y2*r+(_?0:o));function L(P){return P*P}const I=i*r-e*t;if(typeof u.xRot!="undefined"&&(i!==1||e!==0||t!==0||r!==1))if(I===0)delete u.rX,delete u.rY,delete u.xRot,delete u.lArcFlag,delete u.sweepFlag,u.type=U.LINE_TO;else{const P=u.xRot*Math.PI/180,V=Math.sin(P),G=Math.cos(P),b=1/L(u.rX),F=1/L(u.rY),W=L(G)*b+L(V)*F,j=2*V*G*(b-F),rt=L(V)*b+L(G)*F,Q=W*r*r-j*e*r+rt*e*e,it=j*(i*r+e*t)-2*(W*t*r+rt*i*e),tt=W*t*t-j*i*t+rt*i*i,at=(Math.atan2(it,Q-tt)+Math.PI)%Math.PI/2,ft=Math.sin(at),pt=Math.cos(at);u.rX=Math.abs(I)/Math.sqrt(Q*L(pt)+it*ft*pt+tt*L(ft)),u.rY=Math.abs(I)/Math.sqrt(Q*L(ft)-it*ft*pt+tt*L(pt)),u.xRot=at*180/Math.PI}return typeof u.sweepFlag!="undefined"&&0>I&&(u.sweepFlag=+!u.sweepFlag),u})}function rA(i,e=0,t=0){Zr(i,e,t);const r=Math.sin(i),s=Math.cos(i);return xn(s,r,-r,s,e-e*s+t*r,t-e*r-t*s)}function iA(i,e=0){return Zr(i,e),xn(1,0,0,1,i,e)}function nA(i,e=i){return Zr(i,e),xn(i,0,0,e,0,0)}function sA(i){return Zr(i),xn(1,0,Math.atan(i),1,0,0)}function aA(i){return Zr(i),xn(1,Math.atan(i),0,1,0,0)}function oA(i=0){return Zr(i),xn(-1,0,0,1,i,0)}function uA(i=0){return Zr(i),xn(1,0,0,-1,0,i)}function lA(){return Qr((i,e,t)=>U.ARC===i.type?KE(i,i.relative?0:e,i.relative?0:t):i)}function hA(){return Qr((i,e,t)=>(i.relative&&(e=0,t=0),U.ARC===i.type&&_h(i,e,t),i))}function Zd(){return i=>ko({},i)}function cA(){const i=Zd(),e=Gd(),t=Xd(),r=Yd(),s=Qr((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 g(A){A>s.maxY&&(s.maxY=A),A<s.minY&&(s.minY=A)}if(c.type&U.DRAWING_COMMANDS&&(y(u),g(h)),c.type&U.HORIZ_LINE_TO&&y(c.x),c.type&U.VERT_LINE_TO&&g(c.y),c.type&U.LINE_TO&&(y(c.x),g(c.y)),c.type&U.CURVE_TO){y(c.x),g(c.y);const A=_p(u,c.x1,c.x2,c.x);for(const D of A)0<D&&1>D&&y(Cp(u,c.x1,c.x2,c.x,D));const _=_p(h,c.y1,c.y2,c.y);for(const D of _)0<D&&1>D&&g(Cp(h,c.y1,c.y2,c.y,D))}if(c.type&U.ARC){y(c.x),g(c.y),_h(c,u,h);const A=c.xRot/180*Math.PI,_=Math.cos(A)*c.rX,D=Math.sin(A)*c.rX,B=-Math.sin(A)*c.rY,L=Math.cos(A)*c.rY,[I,P]=c.phi1<c.phi2?[c.phi1,c.phi2]:-180>c.phi2?[c.phi2+360,c.phi1+360]:[c.phi2,c.phi1],V=([F,W])=>{const rt=Math.atan2(W,F)*180/Math.PI;return rt<I?rt+360:rt},G=wp(B,-_,0).map(V);for(const F of G)F>I&&F<P&&y(Tp(c.cX,_,B,F));const b=wp(L,-D,0).map(V);for(const F of b)F>I&&F<P&&g(Tp(c.cY,D,L,F))}return o});return s.minX=1/0,s.maxX=-1/0,s.minY=1/0,s.maxY=-1/0,s}const we={ROUND:jE,TO_ABS:Gd,TO_REL:JE,NORMALIZE_HVZ:tA,NORMALIZE_ST:Yd,QT_TO_C:Xd,INFO:Qr,SANITIZE:eA,MATRIX:xn,ROTATE:rA,TRANSLATE:iA,SCALE:nA,SKEW_X:sA,SKEW_Y:aA,X_AXIS_SYMMETRY:oA,Y_AXIS_SYMMETRY:uA,A_TO_C:lA,ANNOTATE_ARCS:hA,CLONE:Zd,CALCULATE_BOUNDS:cA};let Qd=class{round(e){return this.transform(we.ROUND(e))}toAbs(){return this.transform(we.TO_ABS())}toRel(){return this.transform(we.TO_REL())}normalizeHVZ(e,t,r){return this.transform(we.NORMALIZE_HVZ(e,t,r))}normalizeST(){return this.transform(we.NORMALIZE_ST())}qtToC(){return this.transform(we.QT_TO_C())}aToC(){return this.transform(we.A_TO_C())}sanitize(e){return this.transform(we.SANITIZE(e))}translate(e,t){return this.transform(we.TRANSLATE(e,t))}scale(e,t){return this.transform(we.SCALE(e,t))}rotate(e,t,r){return this.transform(we.ROTATE(e,t,r))}matrix(e,t,r,s,o,u){return this.transform(we.MATRIX(e,t,r,s,o,u))}skewX(e){return this.transform(we.SKEW_X(e))}skewY(e){return this.transform(we.SKEW_Y(e))}xSymmetry(e){return this.transform(we.X_AXIS_SYMMETRY(e))}ySymmetry(e){return this.transform(we.Y_AXIS_SYMMETRY(e))}annotateArcs(){return this.transform(we.ANNOTATE_ARCS())}};const fA=i=>i===" "||i===" "||i==="\r"||i===`
33
33
  `,Dp=i=>48<=i.charCodeAt(0)&&i.charCodeAt(0)<=57;let pA=class extends Qd{constructor(){super();p(this,"curNumber","");p(this,"curCommandType",-1);p(this,"curCommandRelative",!1);p(this,"canParseCommandOrComma",!0);p(this,"curNumberHasExp",!1);p(this,"curNumberHasExpDigits",!1);p(this,"curNumberHasDecimal",!1);p(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===U.ARC&&(this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber.length===1&&(this.curNumber==="0"||this.curNumber==="1"),c=Dp(u)&&(this.curNumber==="0"&&u==="0"||h);if(Dp(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===U.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===dA[this.curCommandType]&&(U.HORIZ_LINE_TO===this.curCommandType?s({type:U.HORIZ_LINE_TO,relative:this.curCommandRelative,x:y}):U.VERT_LINE_TO===this.curCommandType?s({type:U.VERT_LINE_TO,relative:this.curCommandRelative,y}):this.curCommandType===U.MOVE_TO||this.curCommandType===U.LINE_TO||this.curCommandType===U.SMOOTH_QUAD_TO?(s({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),U.MOVE_TO===this.curCommandType&&(this.curCommandType=U.LINE_TO)):this.curCommandType===U.CURVE_TO?s({type:U.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===U.SMOOTH_CURVE_TO?s({type:U.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===U.QUAD_TO?s({type:U.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===U.ARC&&s({type:U.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(!fA(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:U.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1;continue}else if(u==="h"||u==="H")this.curCommandType=U.HORIZ_LINE_TO,this.curCommandRelative=u==="h";else if(u==="v"||u==="V")this.curCommandType=U.VERT_LINE_TO,this.curCommandRelative=u==="v";else if(u==="m"||u==="M")this.curCommandType=U.MOVE_TO,this.curCommandRelative=u==="m";else if(u==="l"||u==="L")this.curCommandType=U.LINE_TO,this.curCommandRelative=u==="l";else if(u==="c"||u==="C")this.curCommandType=U.CURVE_TO,this.curCommandRelative=u==="c";else if(u==="s"||u==="S")this.curCommandType=U.SMOOTH_CURVE_TO,this.curCommandRelative=u==="s";else if(u==="q"||u==="Q")this.curCommandType=U.QUAD_TO,this.curCommandRelative=u==="q";else if(u==="t"||u==="T")this.curCommandType=U.SMOOTH_QUAD_TO,this.curCommandRelative=u==="t";else if(u==="a"||u==="A")this.curCommandType=U.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}}})}};var kt;let U=(kt=class extends Qd{constructor(t){super();p(this,"commands");typeof t=="string"?this.commands=kt.parse(t):this.commands=t}encode(){return kt.encode(this.commands)}getBounds(){const t=we.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}static encode(t){return ZE(t)}static parse(t){const r=new pA,s=[];return r.parse(t,s),r.finish(s),s}},p(kt,"CLOSE_PATH",1),p(kt,"MOVE_TO",2),p(kt,"HORIZ_LINE_TO",4),p(kt,"VERT_LINE_TO",8),p(kt,"LINE_TO",16),p(kt,"CURVE_TO",32),p(kt,"SMOOTH_CURVE_TO",64),p(kt,"QUAD_TO",128),p(kt,"SMOOTH_QUAD_TO",256),p(kt,"ARC",512),p(kt,"LINE_COMMANDS",kt.LINE_TO|kt.HORIZ_LINE_TO|kt.VERT_LINE_TO),p(kt,"DRAWING_COMMANDS",kt.HORIZ_LINE_TO|kt.VERT_LINE_TO|kt.LINE_TO|kt.CURVE_TO|kt.SMOOTH_CURVE_TO|kt.QUAD_TO|kt.SMOOTH_QUAD_TO|kt.ARC),kt);const dA={[U.MOVE_TO]:2,[U.LINE_TO]:2,[U.HORIZ_LINE_TO]:1,[U.VERT_LINE_TO]:1,[U.CLOSE_PATH]:0,[U.QUAD_TO]:4,[U.SMOOTH_QUAD_TO]:2,[U.CURVE_TO]:6,[U.SMOOTH_CURVE_TO]:4,[U.ARC]:7},fe=" ";function gA(i){let e="";Array.isArray(i)||(i=[i]);for(let t=0;t<i.length;t++){const r=i[t];if(r.type===Z.CLOSE_PATH)e+="z";else if(r.type===Z.HORIZ_LINE_TO)e+=(r.relative?"h":"H")+r.x;else if(r.type===Z.VERT_LINE_TO)e+=(r.relative?"v":"V")+r.y;else if(r.type===Z.MOVE_TO)e+=(r.relative?"m":"M")+r.x+fe+r.y;else if(r.type===Z.LINE_TO)e+=(r.relative?"l":"L")+r.x+fe+r.y;else if(r.type===Z.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===Z.SMOOTH_CURVE_TO)e+=(r.relative?"s":"S")+r.x2+fe+r.y2+fe+r.x+fe+r.y;else if(r.type===Z.QUAD_TO)e+=(r.relative?"q":"Q")+r.x1+fe+r.y1+fe+r.x+fe+r.y;else if(r.type===Z.SMOOTH_QUAD_TO)e+=(r.relative?"t":"T")+r.x+fe+r.y;else if(r.type===Z.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}class Kd{round(e){return this.transform(me.ROUND(e))}toAbs(){return this.transform(me.TO_ABS())}toRel(){return this.transform(me.TO_REL())}normalizeHVZ(e,t,r){return this.transform(me.NORMALIZE_HVZ(e,t,r))}normalizeST(){return this.transform(me.NORMALIZE_ST())}qtToC(){return this.transform(me.QT_TO_C())}aToC(){return this.transform(me.A_TO_C())}sanitize(e){return this.transform(me.SANITIZE(e))}translate(e,t){return this.transform(me.TRANSLATE(e,t))}scale(e,t){return this.transform(me.SCALE(e,t))}rotate(e,t,r){return this.transform(me.ROTATE(e,t,r))}matrix(e,t,r,s,o,u){return this.transform(me.MATRIX(e,t,r,s,o,u))}skewX(e){return this.transform(me.SKEW_X(e))}skewY(e){return this.transform(me.SKEW_Y(e))}xSymmetry(e){return this.transform(me.X_AXIS_SYMMETRY(e))}ySymmetry(e){return this.transform(me.Y_AXIS_SYMMETRY(e))}annotateArcs(){return this.transform(me.ANNOTATE_ARCS())}}const yA=i=>i===" "||i===" "||i==="\r"||i===`
34
- `,Sp=i=>48<=i.charCodeAt(0)&&i.charCodeAt(0)<=57;class mA extends Kd{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===Z.ARC&&(this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber.length===1&&(this.curNumber==="0"||this.curNumber==="1"),h=Sp(o)&&(this.curNumber==="0"&&o==="0"||u);if(Sp(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===Z.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===vA[this.curCommandType]&&(Z.HORIZ_LINE_TO===this.curCommandType?r({type:Z.HORIZ_LINE_TO,relative:this.curCommandRelative,x:c}):Z.VERT_LINE_TO===this.curCommandType?r({type:Z.VERT_LINE_TO,relative:this.curCommandRelative,y:c}):this.curCommandType===Z.MOVE_TO||this.curCommandType===Z.LINE_TO||this.curCommandType===Z.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),Z.MOVE_TO===this.curCommandType&&(this.curCommandType=Z.LINE_TO)):this.curCommandType===Z.CURVE_TO?r({type:Z.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===Z.SMOOTH_CURVE_TO?r({type:Z.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===Z.QUAD_TO?r({type:Z.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===Z.ARC&&r({type:Z.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(!yA(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:Z.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1;continue}else if(o==="h"||o==="H")this.curCommandType=Z.HORIZ_LINE_TO,this.curCommandRelative=o==="h";else if(o==="v"||o==="V")this.curCommandType=Z.VERT_LINE_TO,this.curCommandRelative=o==="v";else if(o==="m"||o==="M")this.curCommandType=Z.MOVE_TO,this.curCommandRelative=o==="m";else if(o==="l"||o==="L")this.curCommandType=Z.LINE_TO,this.curCommandRelative=o==="l";else if(o==="c"||o==="C")this.curCommandType=Z.CURVE_TO,this.curCommandRelative=o==="c";else if(o==="s"||o==="S")this.curCommandType=Z.SMOOTH_CURVE_TO,this.curCommandRelative=o==="s";else if(o==="q"||o==="Q")this.curCommandType=Z.QUAD_TO,this.curCommandRelative=o==="q";else if(o==="t"||o==="T")this.curCommandType=Z.SMOOTH_QUAD_TO,this.curCommandRelative=o==="t";else if(o==="a"||o==="A")this.curCommandType=Z.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 Kd{constructor(e){super(),typeof e=="string"?this.commands=Wt.parse(e):this.commands=e}encode(){return Wt.encode(this.commands)}getBounds(){const e=me.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}static encode(e){return gA(e)}static parse(e){const t=new mA,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 Z=Wt;const vA={[Z.MOVE_TO]:2,[Z.LINE_TO]:2,[Z.HORIZ_LINE_TO]:1,[Z.VERT_LINE_TO]:1,[Z.CLOSE_PATH]:0,[Z.QUAD_TO]:4,[Z.SMOOTH_QUAD_TO]:2,[Z.CURVE_TO]:6,[Z.SMOOTH_CURVE_TO]:4,[Z.ARC]:7};function oh([i,e],t){return[i*Math.cos(t)-e*Math.sin(t),i*Math.sin(t)+e*Math.cos(t)]}function Kr(...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 yn=Math.PI;function Ch(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;r=Math.abs(i.rX),s=Math.abs(i.rY);const[h,c]=oh([(e-o)/2,(t-u)/2],-i.xRot/180*yn),y=Math.pow(h,2)/Math.pow(r,2)+Math.pow(c,2)/Math.pow(s,2);1<y&&(r*=Math.sqrt(y),s*=Math.sqrt(y)),i.rX=r,i.rY=s;const g=Math.pow(r,2)*Math.pow(c,2)+Math.pow(s,2)*Math.pow(h,2),A=(i.lArcFlag!==i.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(s,2)-g)/g)),_=r*c/s*A,D=-s*h/r*A,B=oh([_,D],i.xRot/180*yn);i.cX=B[0]+(e+o)/2,i.cY=B[1]+(t+u)/2,i.phi1=Math.atan2((c-D)/s,(h-_)/r),i.phi2=Math.atan2((-c-D)/s,(-h-_)/r),i.sweepFlag===0&&i.phi2>i.phi1&&(i.phi2-=2*yn),i.sweepFlag===1&&i.phi2<i.phi1&&(i.phi2+=2*yn),i.phi1*=180/yn,i.phi2*=180/yn}function Op(i,e,t){Kr(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 Ri=Math.PI/180;function Lp(i,e,t){return(1-t)*i+t*e}function Np(i,e,t,r){return i+Math.cos(r/180*yn)*e+Math.sin(r/180*yn)*t}function Mp(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,g=3*o;return Math.abs(c)<1e-6?[-g/y]:xA(y/c,g/c,1e-6)}function Bp(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 xA(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 EA(i,e,t){i.cX||Ch(i,e,t);const r=Math.min(i.phi1,i.phi2),s=Math.max(i.phi1,i.phi2),o=s-r,u=Math.ceil(o/90),h=new Array(u);let c=e,y=t;for(let g=0;g<u;g++){const A=Lp(i.phi1,i.phi2,g/u),_=Lp(i.phi1,i.phi2,(g+1)/u),D=_-A,B=4/3*Math.tan(D*Ri/4),[L,I]=[Math.cos(A*Ri)-B*Math.sin(A*Ri),Math.sin(A*Ri)+B*Math.cos(A*Ri)],[P,V]=[Math.cos(_*Ri),Math.sin(_*Ri)],[G,b]=[P+B*Math.sin(_*Ri),V-B*Math.cos(_*Ri)],F={relative:i.relative,type:Z.CURVE_TO},W=(j,rt)=>{const[Q,it]=oh([j*i.rX,rt*i.rY],i.xRot);return[i.cX+Q,i.cY+it]};[F.x1,F.y1]=W(L,I),[F.x2,F.y2]=W(G,b),[F.x,F.y]=W(P,V),i.relative&&(F.x1-=c,F.y1-=y,F.x2-=c,F.y2-=y,F.x-=c,F.y-=y),[c,y]=[F.x,F.y],h[g]=F}return h}function AA(i=1e13){Kr(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 jd(){return jr((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 wA(){return jr((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 bA(i=!0,e=!0,t=!0){return jr((r,s,o,u,h)=>{if(isNaN(u)&&!(r.type&Z.MOVE_TO))throw new Error("path must start with moveto");return e&&r.type&Z.HORIZ_LINE_TO&&(r.type=Z.LINE_TO,r.y=r.relative?0:o),t&&r.type&Z.VERT_LINE_TO&&(r.type=Z.LINE_TO,r.x=r.relative?0:s),i&&r.type&Z.CLOSE_PATH&&(r.type=Z.LINE_TO,r.x=r.relative?u-s:u,r.y=r.relative?h-o:h),r.type&Z.ARC&&(r.rX===0||r.rY===0)&&(r.type=Z.LINE_TO,delete r.rX,delete r.rY,delete r.xRot,delete r.lArcFlag,delete r.sweepFlag),r})}function Jd(){let i=NaN,e=NaN,t=NaN,r=NaN;return jr((s,o,u)=>(s.type&Z.SMOOTH_CURVE_TO&&(s.type=Z.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&Z.CURVE_TO?(i=s.relative?o+s.x2:s.x2,e=s.relative?u+s.y2:s.y2):(i=NaN,e=NaN),s.type&Z.SMOOTH_QUAD_TO&&(s.type=Z.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&Z.QUAD_TO?(t=s.relative?o+s.x1:s.x1,r=s.relative?u+s.y1:s.y1):(t=NaN,r=NaN),s))}function tg(){let i=NaN,e=NaN;return jr((t,r,s)=>{if(t.type&Z.SMOOTH_QUAD_TO&&(t.type=Z.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&Z.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=Z.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 jr(i){let e=0,t=0,r=NaN,s=NaN;return function(u){if(isNaN(r)&&!(u.type&Z.MOVE_TO))throw new Error("path must start with moveto");const h=i(u,e,t,r,s);return u.type&Z.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&Z.MOVE_TO&&(r=e,s=t),h}}function TA(i=0){Kr(i);let e=NaN,t=NaN,r=NaN,s=NaN;return jr((o,u,h,c,y)=>{const g=Math.abs;let A=!1,_=0,D=0;if(o.type&Z.SMOOTH_CURVE_TO&&(_=isNaN(e)?0:u-e,D=isNaN(t)?0:h-t),o.type&(Z.CURVE_TO|Z.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&Z.SMOOTH_QUAD_TO?(r=isNaN(r)?u:2*u-r,s=isNaN(s)?h:2*h-s):o.type&Z.QUAD_TO?(r=o.relative?u+o.x1:o.x1,s=o.relative?h+o.y1:o.y2):(r=NaN,s=NaN),o.type&Z.LINE_COMMANDS||o.type&Z.ARC&&(o.rX===0||o.rY===0||!o.lArcFlag)||o.type&Z.CURVE_TO||o.type&Z.SMOOTH_CURVE_TO||o.type&Z.QUAD_TO||o.type&Z.SMOOTH_QUAD_TO){const B=typeof o.x=="undefined"?0:o.relative?o.x:o.x-u,L=typeof o.y=="undefined"?0:o.relative?o.y:o.y-h;_=isNaN(r)?typeof o.x1=="undefined"?_:o.relative?o.x:o.x1-u:r-u,D=isNaN(s)?typeof o.y1=="undefined"?D:o.relative?o.y:o.y1-h:s-h;const I=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;g(B)<=i&&g(L)<=i&&g(_)<=i&&g(D)<=i&&g(I)<=i&&g(P)<=i&&(A=!0)}return o.type&Z.CLOSE_PATH&&g(u-c)<=i&&g(h-y)<=i&&(A=!0),A?[]:o})}function En(i,e,t,r,s,o){return Kr(i,e,t,r,s,o),jr((u,h,c,y)=>{const g=u.x1,A=u.x2,_=u.relative&&!isNaN(y),D=typeof u.x!="undefined"?u.x:_?0:h,B=typeof u.y!="undefined"?u.y:_?0:c;u.type&Z.HORIZ_LINE_TO&&e!==0&&(u.type=Z.LINE_TO,u.y=u.relative?0:c),u.type&Z.VERT_LINE_TO&&t!==0&&(u.type=Z.LINE_TO,u.x=u.relative?0:h),typeof u.x!="undefined"&&(u.x=u.x*i+B*t+(_?0:s)),typeof u.y!="undefined"&&(u.y=D*e+u.y*r+(_?0:o)),typeof u.x1!="undefined"&&(u.x1=u.x1*i+u.y1*t+(_?0:s)),typeof u.y1!="undefined"&&(u.y1=g*e+u.y1*r+(_?0:o)),typeof u.x2!="undefined"&&(u.x2=u.x2*i+u.y2*t+(_?0:s)),typeof u.y2!="undefined"&&(u.y2=A*e+u.y2*r+(_?0:o));function L(P){return P*P}const I=i*r-e*t;if(typeof u.xRot!="undefined"&&(i!==1||e!==0||t!==0||r!==1))if(I===0)delete u.rX,delete u.rY,delete u.xRot,delete u.lArcFlag,delete u.sweepFlag,u.type=Z.LINE_TO;else{const P=u.xRot*Math.PI/180,V=Math.sin(P),G=Math.cos(P),b=1/L(u.rX),F=1/L(u.rY),W=L(G)*b+L(V)*F,j=2*V*G*(b-F),rt=L(V)*b+L(G)*F,Q=W*r*r-j*e*r+rt*e*e,it=j*(i*r+e*t)-2*(W*t*r+rt*i*e),tt=W*t*t-j*i*t+rt*i*i,at=(Math.atan2(it,Q-tt)+Math.PI)%Math.PI/2,ft=Math.sin(at),pt=Math.cos(at);u.rX=Math.abs(I)/Math.sqrt(Q*L(pt)+it*ft*pt+tt*L(ft)),u.rY=Math.abs(I)/Math.sqrt(Q*L(ft)-it*ft*pt+tt*L(pt)),u.xRot=at*180/Math.PI}return typeof u.sweepFlag!="undefined"&&0>I&&(u.sweepFlag=+!u.sweepFlag),u})}function _A(i,e=0,t=0){Kr(i,e,t);const r=Math.sin(i),s=Math.cos(i);return En(s,r,-r,s,e-e*s+t*r,t-e*r-t*s)}function CA(i,e=0){return Kr(i,e),En(1,0,0,1,i,e)}function DA(i,e=i){return Kr(i,e),En(i,0,0,e,0,0)}function SA(i){return Kr(i),En(1,0,Math.atan(i),1,0,0)}function OA(i){return Kr(i),En(1,Math.atan(i),0,1,0,0)}function LA(i=0){return Kr(i),En(-1,0,0,1,i,0)}function NA(i=0){return Kr(i),En(1,0,0,-1,0,i)}function MA(){return jr((i,e,t)=>Z.ARC===i.type?EA(i,i.relative?0:e,i.relative?0:t):i)}function BA(){return jr((i,e,t)=>(i.relative&&(e=0,t=0),Z.ARC===i.type&&Ch(i,e,t),i))}function eg(){return i=>ko({},i)}function IA(){const i=eg(),e=jd(),t=tg(),r=Jd(),s=jr((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 g(A){A>s.maxY&&(s.maxY=A),A<s.minY&&(s.minY=A)}if(c.type&Z.DRAWING_COMMANDS&&(y(u),g(h)),c.type&Z.HORIZ_LINE_TO&&y(c.x),c.type&Z.VERT_LINE_TO&&g(c.y),c.type&Z.LINE_TO&&(y(c.x),g(c.y)),c.type&Z.CURVE_TO){y(c.x),g(c.y);const A=Mp(u,c.x1,c.x2,c.x);for(const D of A)0<D&&1>D&&y(Bp(u,c.x1,c.x2,c.x,D));const _=Mp(h,c.y1,c.y2,c.y);for(const D of _)0<D&&1>D&&g(Bp(h,c.y1,c.y2,c.y,D))}if(c.type&Z.ARC){y(c.x),g(c.y),Ch(c,u,h);const A=c.xRot/180*Math.PI,_=Math.cos(A)*c.rX,D=Math.sin(A)*c.rX,B=-Math.sin(A)*c.rY,L=Math.cos(A)*c.rY,[I,P]=c.phi1<c.phi2?[c.phi1,c.phi2]:-180>c.phi2?[c.phi2+360,c.phi1+360]:[c.phi2,c.phi1],V=([F,W])=>{const rt=Math.atan2(W,F)*180/Math.PI;return rt<I?rt+360:rt},G=Op(B,-_,0).map(V);for(const F of G)F>I&&F<P&&y(Np(c.cX,_,B,F));const b=Op(L,-D,0).map(V);for(const F of b)F>I&&F<P&&g(Np(c.cY,D,L,F))}return o});return s.minX=1/0,s.maxX=-1/0,s.minY=1/0,s.maxY=-1/0,s}const me={ROUND:AA,TO_ABS:jd,TO_REL:wA,NORMALIZE_HVZ:bA,NORMALIZE_ST:Jd,QT_TO_C:tg,INFO:jr,SANITIZE:TA,MATRIX:En,ROTATE:_A,TRANSLATE:CA,SCALE:DA,SKEW_X:SA,SKEW_Y:OA,X_AXIS_SYMMETRY:LA,Y_AXIS_SYMMETRY:NA,A_TO_C:MA,ANNOTATE_ARCS:BA,CLONE:eg,CALCULATE_BOUNDS:IA};class Yr{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 _t(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}}p(Yr,"cached",new Map),p(Yr,"cachedCanvas",new Map);let RA=0;class tu extends U{constructor(t={}){var r;super(t.commands);p(this,"name","Geo2");p(this,"id",++RA);p(this,"params");p(this,"viewMatrix",new pe);p(this,"boundingBox",new Ot);p(this,"flipY",!1);p(this,"renderPath");p(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.matrix(1,0,0,-1,0,0)}get version(){return this._version}set version(t){this._version=t}set needsUpdate(t){t&&this._version++}setFromPoints(t){return t!=null&&t.length?(this.params.points=t,this.recomputePath(),this):this}recomputePath(){throw new Error("must be implemented in derived")}computeBoundingBox(){var t;this.boundingBox.makeEmpty(),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 U.MOVE_TO:this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case U.LINE_TO:this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case U.ARC:typeof o.xRot=="undefined"?(this.boundingBox.expandByXY(o.x,o.y),zr.set(o.x,o.y).addScalar(-o.rX),this.boundingBox.expandByPoint(zr),zr.set(o.x,o.y).addScalar(o.rX),this.boundingBox.expandByPoint(zr)):this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case U.HORIZ_LINE_TO:this.boundingBox.expandByXY(o.x,yt.y),yt.set(o.x,yt.y);break;case U.VERT_LINE_TO:this.boundingBox.expandByXY(yt.x,o.y),yt.set(yt.x,o.y);break;case U.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 U.MOVE_TO:this.renderPath.moveTo(u.x,u.y),yt.set(u.x,u.y);break;case U.LINE_TO:this.renderPath.lineTo(u.x,u.y),yt.set(u.x,u.y);break;case U.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 U.HORIZ_LINE_TO:this.renderPath.lineTo(u.x,yt.y),yt.set(u.x,yt.y);break;case U.VERT_LINE_TO:this.renderPath.lineTo(yt.x,u.y),yt.set(yt.x,u.y);break;case U.CURVE_TO:yt.set(u.x,u.y);break;case U.SMOOTH_CURVE_TO:yt.set(u.x,u.y);break;case U.QUAD_TO:yt.set(u.x,u.y);break;case U.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=me.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],g=s(y);if(g.type===U.ARC&&typeof g.xRot!="undefined"){const A=XE(yt.x,yt.y,g.x,g.y,g.lArcFlag,g.sweepFlag,g.rX,g.rY,0);yt.set(g.x,g.y),g.x=A[0],g.y=A[1],g.rX=A[2]>A[3]?A[2]:A[3],g.phi1=A[4],g.phi2=A[4]+A[5],g.sweepFlag=A[7],g.phi2===0&&(g.phi2=g.phi1>0?1e-6:-1e-6)}else if(g.type===U.ARC){if(yt.set(g.x,g.y),t.getScale(zr),g.rX=g.rY*Math.abs(zr.x),g.phi1!==0||g.phi2!==Math.PI*2){t.getRotation(zr),g.phi1+=zr.x,g.phi2+=zr.x;const A=o[o.length-1];A.x=(A.x||0)+Math.cos(zr.x)*g.rX*2,A.y=(A.y||0)+Math.sin(zr.x)*g.rX*2}}else yt.set(g.x||yt.x,g.y||yt.y);Array.isArray(g)?o.push(...g):o.push(g)}return o}copy(t){return this.commands=It.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 U.MOVE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case U.LINE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case U.ARC:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case U.HORIZ_LINE_TO:t.push({x:h.x,y:yt.y}),yt.set(h.x,yt.y);break;case U.VERT_LINE_TO:t.push({x:yt.x,y:h.y}),yt.set(yt.x,h.y);break;case U.CURVE_TO:case U.SMOOTH_CURVE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case U.QUAD_TO:case U.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){cn.save(),cn.beginPath(),cn.lineWidth=5,cn.stroke(this.renderPath),cn.fill(this.renderPath),cn.closePath();const r=cn.isPointInPath(this.renderPath,t.x,t.y);return cn.restore(),r}return!1}}const yt=new k,zr=new k,PA=Yr.get("RAY_CASTER",10,10),cn=PA.getContext("2d");class FA extends tu{constructor(t={}){t.commands||(t.commands=[]);super(t);p(this,"isCircle",!0);p(this,"radius",1);p(this,"start",0);p(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:U.MOVE_TO,x:t[h].x>0?t[h].x+this.radius:t[h].x-this.radius,y:t[h].y*(this.params.flipY?-1:1),relative:!1}),r.push({type:U.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 rg{constructor(e={}){p(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=zo(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 tu({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 g=o.slice(h,h+this.splitLimit).join(" ");try{u.push(new tu({commands:g,flipY:t}))}catch(A){console.error(`getInstanceByPath error: ${A}`)}}return u}static getInstanceByCircle(e,t=!1){if(!e||e.nodeName!=="circle")return;Ip.set(zo(e,"cx",0),zo(e,"cy",0));const r=zo(e,"r",0);return new FA({points:[Ip.clone()],radius:r,flipY:t})}static getInstance(e,t=!1){if(e)return new tu({commands:e,flipY:t})}}p(rg,"splitLimit",100);const Ip=new k;class kA{constructor(){p(this,"svg");p(this,"offset",new k);p(this,"svgRoot");p(this,"layers",[]);p(this,"elementsMap",{});p(this,"boundingBoxMap",{});p(this,"boundingBox",new Ot);p(this,"svgSkeletons",[]);p(this,"data");p(this,"_exceptTypes",["view"]);p(this,"_exceptIds",["viewer","mirror"]);p(this,"_lvi",0);p(this,"_lastLinked",[])}bindSvg(e){return this.svg=e,this.svgRoot=qd(this.svg),this.layers=this.getLayers(2),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()){Pi.set(Number(r.getAttribute("x")||"0"),Number(r.getAttribute("y")||"0")),$o.composeSvgTransform(Pi.x,Pi.y,r.getAttribute("transform"));const g=new Ot().copy(h).applyMatrix3($o);this.boundingBoxMap[r.id]=g;return}const c=this.getUseElementBoundingBoxWithSymbol(r);if(!c)return;this.boundingBoxMap[u]=c,Pi.set(Number(r.getAttribute("x")||"0"),Number(r.getAttribute("y")||"0")),$o.composeSvgTransform(Pi.x,Pi.y,r.getAttribute("transform"));const y=new Ot().copy(c).applyMatrix3($o);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=rg.getInstanceByPath(r);if(!Array.isArray(u)){const h=u==null?void 0:u.computeBoundingBox();if(!h||h.isEmpty())return;h.getSize(Pi),s.x=h.min.x,s.y=h.max.y,s.width=Pi.x,s.height=Pi.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=Hd[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=Hl("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(ba(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 g=Hl("text");g.setAttribute("x","0"),g.setAttribute("y",o+c+"em"),s.appendChild(g)}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=It.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=It.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(It.lowerCase(r.tagName)==="symbol"){o=document.createElementNS("http://www.w3.org/2000/svg","g");for(let y=0,g=r.childNodes.length;y<g;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)}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 g=e.transform.baseVal;if(c&&g.numberOfItems>0){let A=g.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=er.RM),this.clearLinkedLines(e),!t||!t.value)return;const r=this.getLinesByTree(t);this.drawLinkedLines(e,r)}clearLinkedLines(e){var s;const t=Cs(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=Cs(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],g=Hl("line");g.setAttribute("x1",c.x.toString()),g.setAttribute("y1",c.y.toString()),g.setAttribute("x2",y.x.toString()),g.setAttribute("y2",y.y.toString()),g.setAttribute("class","danger"),g.setAttribute("style","stroke-width: 2;"),s.appendChild(g),this._lastLinked.push(g)}}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 Pi=new k,$o=new pe;class HA{constructor(e={},t){p(this,"name","SvgPainter");p(this,"params");p(this,"chef");this.params=e,this.chef=t}drawSocialDistanceCircles(e,t="http://www.w3.org/2000/svg"){var D,B,L;if(!e)return;const r=ME(e),s=Ud(e),o=2*r,u=(B=(D=this.params.socialDistance)==null?void 0:D.colors)!=null&&B.length?(L=this.params.socialDistance)==null?void 0:L.colors:[Qt.green,Qt.red],h=this.getRadius(s),c=e.querySelector(`#${sh}`),y=c==null?void 0:c.querySelectorAll("path");if(!c||!(y!=null&&y.length))return;let g,A;const _=new Array;for(let I=0,P=(y==null?void 0:y.length)||0;I<P;I++){if(g=y[I],A=g.getAttribute("id"),!A)continue;const V=this.chef.getElementBoundingBox(A);if(!V)continue;const G=new k;V.getCenter(G),_.push({id:A,cp:G})}for(let I=0,P=_.length;I<P;I++){_[I].color=u[0];for(let V=0,G=P;V<G;V++)_[I]!==_[V]&&k.getDistance(_[I].cp,_[V].cp)<h*2&&(_[I].color=u[1])}for(let I=0,P=_.length;I<P;I++){let V=this.createCircle(_[I],h,o,t);c.appendChild(V)}}clearSocialDistanceCircles(e){if(!e)return;const t=e.querySelector(`#${sh}`),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 UA=function(i){return(i||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};function mu(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 La(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):mu(i,u)||(t+=" "+u))}i.classList||(i.className=t)}function Na(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):mu(i,u)&&(r=r.replace(" "+u+" "," ")))}i.classList||(i.className=UA(r))}class Dh extends VE{constructor(t={}){super();p(this,"isSvgScene",!0);p(this,"name","SvgScene");p(this,"dynamically",!0);p(this,"params");p(this,"socialDistanceEnable",!1);p(this,"container");p(this,"svg");p(this,"svgStr","");p(this,"svgRoot");p(this,"viewBox",new Ot);p(this,"chef");p(this,"defaultLayers",[]);p(this,"skeletonLayers",[]);p(this,"currentLayers",[]);p(this,"assetType");p(this,"assetsMap",{});p(this,"legend",[]);p(this,"selectedList",[]);p(this,"painter");p(this,"_lastHighlightType","");p(this,"_lastHighlightIds",[]);p(this,"clickSvgElementHandler",this.handleClickSvgElement.bind(this));p(this,"_lastLinkedIds",[]);this.params=t,this.assetType=t.assetType||er.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 kA,this.painter=new HA(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 _t(this,null,function*(){return new $d().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&&(BE(r,this.viewBox),this.chef.bindSvg(this.svg),this.svgRoot=qd(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())}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=[Cs(t)],t!==er.RM&&r.unshift(Cs(er.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(Cs(t));if(!s)return r;r[t]=this.chef.getElementsMap(s);const o=ba(t),u=this.chef.getElementById(o);if(!u)return r;const h=this.chef.getElementsMap(u),c=It.keys(h);if(!(c!=null&&c.length))return r;if(It.startsWith(c[0],`l-${t}-`)){const y=`l-${t}-`.length;for(let g=0,A=c.length;g<A;g++){const _=c[g].slice(y);h[_]=h[c[g]],delete h[c[g]]}}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?It.keys(r):s}clearFillOrStroke(t="fill"){const r=this.getAssetsByType(this.assetType);if(!r)return;const s=It.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=It.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=It.keys(u);let c;for(let y=0,g=h.length;y<g;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=ba(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]&&La(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]&&Na(r[o],"active")}),this._lastHighlightIds.length=0)}getIntersectObjects(t,r=er.RM,s=[]){s.length=0;const o=[],u=this.getAssetsByType(r);if(!u)return s;const h=It.keys(u);for(let y=0,g=h.length;y<g;y++){const A=this.chef.getElementBoundingBox(u[h[y]].id);A&&A.containsPoint(t.worldCoords)&&o.push(u[h[y]])}const c=It.sortBy(o,y=>{var g;return(g=this.chef.getElementBoundingBox(y.id))==null?void 0:g.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=It.uniq(It.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=ba(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=Fd(t),this._lastLinkedIds.forEach(h=>{u[h]&&(u[h].style.display="block")}))}onBeforeRender(){}fullscreen(t=1e3,r=!1){}update(){}}class qA extends Dh{constructor(t){super(t);p(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
+ `,Sp=i=>48<=i.charCodeAt(0)&&i.charCodeAt(0)<=57;class mA extends Kd{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===Z.ARC&&(this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber.length===1&&(this.curNumber==="0"||this.curNumber==="1"),h=Sp(o)&&(this.curNumber==="0"&&o==="0"||u);if(Sp(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===Z.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===vA[this.curCommandType]&&(Z.HORIZ_LINE_TO===this.curCommandType?r({type:Z.HORIZ_LINE_TO,relative:this.curCommandRelative,x:c}):Z.VERT_LINE_TO===this.curCommandType?r({type:Z.VERT_LINE_TO,relative:this.curCommandRelative,y:c}):this.curCommandType===Z.MOVE_TO||this.curCommandType===Z.LINE_TO||this.curCommandType===Z.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),Z.MOVE_TO===this.curCommandType&&(this.curCommandType=Z.LINE_TO)):this.curCommandType===Z.CURVE_TO?r({type:Z.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===Z.SMOOTH_CURVE_TO?r({type:Z.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===Z.QUAD_TO?r({type:Z.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===Z.ARC&&r({type:Z.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(!yA(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:Z.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1;continue}else if(o==="h"||o==="H")this.curCommandType=Z.HORIZ_LINE_TO,this.curCommandRelative=o==="h";else if(o==="v"||o==="V")this.curCommandType=Z.VERT_LINE_TO,this.curCommandRelative=o==="v";else if(o==="m"||o==="M")this.curCommandType=Z.MOVE_TO,this.curCommandRelative=o==="m";else if(o==="l"||o==="L")this.curCommandType=Z.LINE_TO,this.curCommandRelative=o==="l";else if(o==="c"||o==="C")this.curCommandType=Z.CURVE_TO,this.curCommandRelative=o==="c";else if(o==="s"||o==="S")this.curCommandType=Z.SMOOTH_CURVE_TO,this.curCommandRelative=o==="s";else if(o==="q"||o==="Q")this.curCommandType=Z.QUAD_TO,this.curCommandRelative=o==="q";else if(o==="t"||o==="T")this.curCommandType=Z.SMOOTH_QUAD_TO,this.curCommandRelative=o==="t";else if(o==="a"||o==="A")this.curCommandType=Z.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 Kd{constructor(e){super(),typeof e=="string"?this.commands=Wt.parse(e):this.commands=e}encode(){return Wt.encode(this.commands)}getBounds(){const e=me.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}static encode(e){return gA(e)}static parse(e){const t=new mA,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 Z=Wt;const vA={[Z.MOVE_TO]:2,[Z.LINE_TO]:2,[Z.HORIZ_LINE_TO]:1,[Z.VERT_LINE_TO]:1,[Z.CLOSE_PATH]:0,[Z.QUAD_TO]:4,[Z.SMOOTH_QUAD_TO]:2,[Z.CURVE_TO]:6,[Z.SMOOTH_CURVE_TO]:4,[Z.ARC]:7};function oh([i,e],t){return[i*Math.cos(t)-e*Math.sin(t),i*Math.sin(t)+e*Math.cos(t)]}function Kr(...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 yn=Math.PI;function Ch(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;r=Math.abs(i.rX),s=Math.abs(i.rY);const[h,c]=oh([(e-o)/2,(t-u)/2],-i.xRot/180*yn),y=Math.pow(h,2)/Math.pow(r,2)+Math.pow(c,2)/Math.pow(s,2);1<y&&(r*=Math.sqrt(y),s*=Math.sqrt(y)),i.rX=r,i.rY=s;const g=Math.pow(r,2)*Math.pow(c,2)+Math.pow(s,2)*Math.pow(h,2),A=(i.lArcFlag!==i.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(s,2)-g)/g)),_=r*c/s*A,D=-s*h/r*A,B=oh([_,D],i.xRot/180*yn);i.cX=B[0]+(e+o)/2,i.cY=B[1]+(t+u)/2,i.phi1=Math.atan2((c-D)/s,(h-_)/r),i.phi2=Math.atan2((-c-D)/s,(-h-_)/r),i.sweepFlag===0&&i.phi2>i.phi1&&(i.phi2-=2*yn),i.sweepFlag===1&&i.phi2<i.phi1&&(i.phi2+=2*yn),i.phi1*=180/yn,i.phi2*=180/yn}function Op(i,e,t){Kr(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 Ri=Math.PI/180;function Lp(i,e,t){return(1-t)*i+t*e}function Np(i,e,t,r){return i+Math.cos(r/180*yn)*e+Math.sin(r/180*yn)*t}function Mp(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,g=3*o;return Math.abs(c)<1e-6?[-g/y]:xA(y/c,g/c,1e-6)}function Bp(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 xA(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 EA(i,e,t){i.cX||Ch(i,e,t);const r=Math.min(i.phi1,i.phi2),s=Math.max(i.phi1,i.phi2),o=s-r,u=Math.ceil(o/90),h=new Array(u);let c=e,y=t;for(let g=0;g<u;g++){const A=Lp(i.phi1,i.phi2,g/u),_=Lp(i.phi1,i.phi2,(g+1)/u),D=_-A,B=4/3*Math.tan(D*Ri/4),[L,I]=[Math.cos(A*Ri)-B*Math.sin(A*Ri),Math.sin(A*Ri)+B*Math.cos(A*Ri)],[P,V]=[Math.cos(_*Ri),Math.sin(_*Ri)],[G,b]=[P+B*Math.sin(_*Ri),V-B*Math.cos(_*Ri)],F={relative:i.relative,type:Z.CURVE_TO},W=(j,rt)=>{const[Q,it]=oh([j*i.rX,rt*i.rY],i.xRot);return[i.cX+Q,i.cY+it]};[F.x1,F.y1]=W(L,I),[F.x2,F.y2]=W(G,b),[F.x,F.y]=W(P,V),i.relative&&(F.x1-=c,F.y1-=y,F.x2-=c,F.y2-=y,F.x-=c,F.y-=y),[c,y]=[F.x,F.y],h[g]=F}return h}function AA(i=1e13){Kr(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 jd(){return jr((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 wA(){return jr((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 bA(i=!0,e=!0,t=!0){return jr((r,s,o,u,h)=>{if(isNaN(u)&&!(r.type&Z.MOVE_TO))throw new Error("path must start with moveto");return e&&r.type&Z.HORIZ_LINE_TO&&(r.type=Z.LINE_TO,r.y=r.relative?0:o),t&&r.type&Z.VERT_LINE_TO&&(r.type=Z.LINE_TO,r.x=r.relative?0:s),i&&r.type&Z.CLOSE_PATH&&(r.type=Z.LINE_TO,r.x=r.relative?u-s:u,r.y=r.relative?h-o:h),r.type&Z.ARC&&(r.rX===0||r.rY===0)&&(r.type=Z.LINE_TO,delete r.rX,delete r.rY,delete r.xRot,delete r.lArcFlag,delete r.sweepFlag),r})}function Jd(){let i=NaN,e=NaN,t=NaN,r=NaN;return jr((s,o,u)=>(s.type&Z.SMOOTH_CURVE_TO&&(s.type=Z.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&Z.CURVE_TO?(i=s.relative?o+s.x2:s.x2,e=s.relative?u+s.y2:s.y2):(i=NaN,e=NaN),s.type&Z.SMOOTH_QUAD_TO&&(s.type=Z.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&Z.QUAD_TO?(t=s.relative?o+s.x1:s.x1,r=s.relative?u+s.y1:s.y1):(t=NaN,r=NaN),s))}function tg(){let i=NaN,e=NaN;return jr((t,r,s)=>{if(t.type&Z.SMOOTH_QUAD_TO&&(t.type=Z.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&Z.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=Z.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 jr(i){let e=0,t=0,r=NaN,s=NaN;return function(u){if(isNaN(r)&&!(u.type&Z.MOVE_TO))throw new Error("path must start with moveto");const h=i(u,e,t,r,s);return u.type&Z.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&Z.MOVE_TO&&(r=e,s=t),h}}function TA(i=0){Kr(i);let e=NaN,t=NaN,r=NaN,s=NaN;return jr((o,u,h,c,y)=>{const g=Math.abs;let A=!1,_=0,D=0;if(o.type&Z.SMOOTH_CURVE_TO&&(_=isNaN(e)?0:u-e,D=isNaN(t)?0:h-t),o.type&(Z.CURVE_TO|Z.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&Z.SMOOTH_QUAD_TO?(r=isNaN(r)?u:2*u-r,s=isNaN(s)?h:2*h-s):o.type&Z.QUAD_TO?(r=o.relative?u+o.x1:o.x1,s=o.relative?h+o.y1:o.y2):(r=NaN,s=NaN),o.type&Z.LINE_COMMANDS||o.type&Z.ARC&&(o.rX===0||o.rY===0||!o.lArcFlag)||o.type&Z.CURVE_TO||o.type&Z.SMOOTH_CURVE_TO||o.type&Z.QUAD_TO||o.type&Z.SMOOTH_QUAD_TO){const B=typeof o.x=="undefined"?0:o.relative?o.x:o.x-u,L=typeof o.y=="undefined"?0:o.relative?o.y:o.y-h;_=isNaN(r)?typeof o.x1=="undefined"?_:o.relative?o.x:o.x1-u:r-u,D=isNaN(s)?typeof o.y1=="undefined"?D:o.relative?o.y:o.y1-h:s-h;const I=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;g(B)<=i&&g(L)<=i&&g(_)<=i&&g(D)<=i&&g(I)<=i&&g(P)<=i&&(A=!0)}return o.type&Z.CLOSE_PATH&&g(u-c)<=i&&g(h-y)<=i&&(A=!0),A?[]:o})}function En(i,e,t,r,s,o){return Kr(i,e,t,r,s,o),jr((u,h,c,y)=>{const g=u.x1,A=u.x2,_=u.relative&&!isNaN(y),D=typeof u.x!="undefined"?u.x:_?0:h,B=typeof u.y!="undefined"?u.y:_?0:c;u.type&Z.HORIZ_LINE_TO&&e!==0&&(u.type=Z.LINE_TO,u.y=u.relative?0:c),u.type&Z.VERT_LINE_TO&&t!==0&&(u.type=Z.LINE_TO,u.x=u.relative?0:h),typeof u.x!="undefined"&&(u.x=u.x*i+B*t+(_?0:s)),typeof u.y!="undefined"&&(u.y=D*e+u.y*r+(_?0:o)),typeof u.x1!="undefined"&&(u.x1=u.x1*i+u.y1*t+(_?0:s)),typeof u.y1!="undefined"&&(u.y1=g*e+u.y1*r+(_?0:o)),typeof u.x2!="undefined"&&(u.x2=u.x2*i+u.y2*t+(_?0:s)),typeof u.y2!="undefined"&&(u.y2=A*e+u.y2*r+(_?0:o));function L(P){return P*P}const I=i*r-e*t;if(typeof u.xRot!="undefined"&&(i!==1||e!==0||t!==0||r!==1))if(I===0)delete u.rX,delete u.rY,delete u.xRot,delete u.lArcFlag,delete u.sweepFlag,u.type=Z.LINE_TO;else{const P=u.xRot*Math.PI/180,V=Math.sin(P),G=Math.cos(P),b=1/L(u.rX),F=1/L(u.rY),W=L(G)*b+L(V)*F,j=2*V*G*(b-F),rt=L(V)*b+L(G)*F,Q=W*r*r-j*e*r+rt*e*e,it=j*(i*r+e*t)-2*(W*t*r+rt*i*e),tt=W*t*t-j*i*t+rt*i*i,at=(Math.atan2(it,Q-tt)+Math.PI)%Math.PI/2,ft=Math.sin(at),pt=Math.cos(at);u.rX=Math.abs(I)/Math.sqrt(Q*L(pt)+it*ft*pt+tt*L(ft)),u.rY=Math.abs(I)/Math.sqrt(Q*L(ft)-it*ft*pt+tt*L(pt)),u.xRot=at*180/Math.PI}return typeof u.sweepFlag!="undefined"&&0>I&&(u.sweepFlag=+!u.sweepFlag),u})}function _A(i,e=0,t=0){Kr(i,e,t);const r=Math.sin(i),s=Math.cos(i);return En(s,r,-r,s,e-e*s+t*r,t-e*r-t*s)}function CA(i,e=0){return Kr(i,e),En(1,0,0,1,i,e)}function DA(i,e=i){return Kr(i,e),En(i,0,0,e,0,0)}function SA(i){return Kr(i),En(1,0,Math.atan(i),1,0,0)}function OA(i){return Kr(i),En(1,Math.atan(i),0,1,0,0)}function LA(i=0){return Kr(i),En(-1,0,0,1,i,0)}function NA(i=0){return Kr(i),En(1,0,0,-1,0,i)}function MA(){return jr((i,e,t)=>Z.ARC===i.type?EA(i,i.relative?0:e,i.relative?0:t):i)}function BA(){return jr((i,e,t)=>(i.relative&&(e=0,t=0),Z.ARC===i.type&&Ch(i,e,t),i))}function eg(){return i=>ko({},i)}function IA(){const i=eg(),e=jd(),t=tg(),r=Jd(),s=jr((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 g(A){A>s.maxY&&(s.maxY=A),A<s.minY&&(s.minY=A)}if(c.type&Z.DRAWING_COMMANDS&&(y(u),g(h)),c.type&Z.HORIZ_LINE_TO&&y(c.x),c.type&Z.VERT_LINE_TO&&g(c.y),c.type&Z.LINE_TO&&(y(c.x),g(c.y)),c.type&Z.CURVE_TO){y(c.x),g(c.y);const A=Mp(u,c.x1,c.x2,c.x);for(const D of A)0<D&&1>D&&y(Bp(u,c.x1,c.x2,c.x,D));const _=Mp(h,c.y1,c.y2,c.y);for(const D of _)0<D&&1>D&&g(Bp(h,c.y1,c.y2,c.y,D))}if(c.type&Z.ARC){y(c.x),g(c.y),Ch(c,u,h);const A=c.xRot/180*Math.PI,_=Math.cos(A)*c.rX,D=Math.sin(A)*c.rX,B=-Math.sin(A)*c.rY,L=Math.cos(A)*c.rY,[I,P]=c.phi1<c.phi2?[c.phi1,c.phi2]:-180>c.phi2?[c.phi2+360,c.phi1+360]:[c.phi2,c.phi1],V=([F,W])=>{const rt=Math.atan2(W,F)*180/Math.PI;return rt<I?rt+360:rt},G=Op(B,-_,0).map(V);for(const F of G)F>I&&F<P&&y(Np(c.cX,_,B,F));const b=Op(L,-D,0).map(V);for(const F of b)F>I&&F<P&&g(Np(c.cY,D,L,F))}return o});return s.minX=1/0,s.maxX=-1/0,s.minY=1/0,s.maxY=-1/0,s}const me={ROUND:AA,TO_ABS:jd,TO_REL:wA,NORMALIZE_HVZ:bA,NORMALIZE_ST:Jd,QT_TO_C:tg,INFO:jr,SANITIZE:TA,MATRIX:En,ROTATE:_A,TRANSLATE:CA,SCALE:DA,SKEW_X:SA,SKEW_Y:OA,X_AXIS_SYMMETRY:LA,Y_AXIS_SYMMETRY:NA,A_TO_C:MA,ANNOTATE_ARCS:BA,CLONE:eg,CALCULATE_BOUNDS:IA};class Yr{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 _t(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}}p(Yr,"cached",new Map),p(Yr,"cachedCanvas",new Map);let RA=0;class tu extends U{constructor(t={}){var r;super(t.commands);p(this,"name","Geo2");p(this,"id",++RA);p(this,"params");p(this,"viewMatrix",new pe);p(this,"boundingBox",new Ot);p(this,"flipY",!1);p(this,"renderPath");p(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.matrix(1,0,0,-1,0,0)}get version(){return this._version}set version(t){this._version=t}set needsUpdate(t){t&&this._version++}setFromPoints(t){return t!=null&&t.length?(this.params.points=t,this.recomputePath(),this):this}recomputePath(){throw new Error("must be implemented in derived")}computeBoundingBox(){var t;this.boundingBox.makeEmpty(),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 U.MOVE_TO:this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case U.LINE_TO:this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case U.ARC:typeof o.xRot=="undefined"?(this.boundingBox.expandByXY(o.x,o.y),zr.set(o.x,o.y).addScalar(-o.rX),this.boundingBox.expandByPoint(zr),zr.set(o.x,o.y).addScalar(o.rX),this.boundingBox.expandByPoint(zr)):this.boundingBox.expandByXY(o.x,o.y),yt.set(o.x,o.y);break;case U.HORIZ_LINE_TO:this.boundingBox.expandByXY(o.x,yt.y),yt.set(o.x,yt.y);break;case U.VERT_LINE_TO:this.boundingBox.expandByXY(yt.x,o.y),yt.set(yt.x,o.y);break;case U.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 U.MOVE_TO:this.renderPath.moveTo(u.x,u.y),yt.set(u.x,u.y);break;case U.LINE_TO:this.renderPath.lineTo(u.x,u.y),yt.set(u.x,u.y);break;case U.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 U.HORIZ_LINE_TO:this.renderPath.lineTo(u.x,yt.y),yt.set(u.x,yt.y);break;case U.VERT_LINE_TO:this.renderPath.lineTo(yt.x,u.y),yt.set(yt.x,u.y);break;case U.CURVE_TO:yt.set(u.x,u.y);break;case U.SMOOTH_CURVE_TO:yt.set(u.x,u.y);break;case U.QUAD_TO:yt.set(u.x,u.y);break;case U.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=me.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],g=s(y);if(g.type===U.ARC&&typeof g.xRot!="undefined"){const A=XE(yt.x,yt.y,g.x,g.y,g.lArcFlag,g.sweepFlag,g.rX,g.rY,0);yt.set(g.x,g.y),g.x=A[0],g.y=A[1],g.rX=A[2]>A[3]?A[2]:A[3],g.phi1=A[4],g.phi2=A[4]+A[5],g.sweepFlag=A[7],g.phi2===0&&(g.phi2=g.phi1>0?1e-6:-1e-6)}else if(g.type===U.ARC){if(yt.set(g.x,g.y),t.getScale(zr),g.rX=g.rY*Math.abs(zr.x),g.phi1!==0||g.phi2!==Math.PI*2){t.getRotation(zr),g.phi1+=zr.x,g.phi2+=zr.x;const A=o[o.length-1];A.x=(A.x||0)+Math.cos(zr.x)*g.rX*2,A.y=(A.y||0)+Math.sin(zr.x)*g.rX*2}}else yt.set(g.x||yt.x,g.y||yt.y);Array.isArray(g)?o.push(...g):o.push(g)}return o}copy(t){return this.commands=It.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 U.MOVE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case U.LINE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case U.ARC:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case U.HORIZ_LINE_TO:t.push({x:h.x,y:yt.y}),yt.set(h.x,yt.y);break;case U.VERT_LINE_TO:t.push({x:yt.x,y:h.y}),yt.set(yt.x,h.y);break;case U.CURVE_TO:case U.SMOOTH_CURVE_TO:t.push({x:h.x,y:h.y}),yt.set(h.x,h.y);break;case U.QUAD_TO:case U.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){cn.save(),cn.beginPath(),cn.lineWidth=5,cn.stroke(this.renderPath),cn.fill(this.renderPath),cn.closePath();const r=cn.isPointInPath(this.renderPath,t.x,t.y);return cn.restore(),r}return!1}}const yt=new k,zr=new k,PA=Yr.get("RAY_CASTER",10,10),cn=PA.getContext("2d");class FA extends tu{constructor(t={}){t.commands||(t.commands=[]);super(t);p(this,"isCircle",!0);p(this,"radius",1);p(this,"start",0);p(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:U.MOVE_TO,x:t[h].x>0?t[h].x+this.radius:t[h].x-this.radius,y:t[h].y*(this.params.flipY?-1:1),relative:!1}),r.push({type:U.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 rg{constructor(e={}){p(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=zo(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 tu({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 g=o.slice(h,h+this.splitLimit).join(" ");try{u.push(new tu({commands:g,flipY:t}))}catch(A){console.error(`getInstanceByPath error: ${A}`)}}return u}static getInstanceByCircle(e,t=!1){if(!e||e.nodeName!=="circle")return;Ip.set(zo(e,"cx",0),zo(e,"cy",0));const r=zo(e,"r",0);return new FA({points:[Ip.clone()],radius:r,flipY:t})}static getInstance(e,t=!1){if(e)return new tu({commands:e,flipY:t})}}p(rg,"splitLimit",100);const Ip=new k;class kA{constructor(){p(this,"svg");p(this,"offset",new k);p(this,"svgRoot");p(this,"layers",[]);p(this,"elementsMap",{});p(this,"boundingBoxMap",{});p(this,"boundingBox",new Ot);p(this,"svgSkeletons",[]);p(this,"data");p(this,"_exceptTypes",["view"]);p(this,"_exceptIds",["viewer","mirror"]);p(this,"_lvi",0);p(this,"_lastLinked",[])}bindSvg(e){return this.svg=e,this.svgRoot=qd(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()){Pi.set(Number(r.getAttribute("x")||"0"),Number(r.getAttribute("y")||"0")),$o.composeSvgTransform(Pi.x,Pi.y,r.getAttribute("transform"));const g=new Ot().copy(h).applyMatrix3($o);this.boundingBoxMap[r.id]=g;return}const c=this.getUseElementBoundingBoxWithSymbol(r);if(!c)return;this.boundingBoxMap[u]=c,Pi.set(Number(r.getAttribute("x")||"0"),Number(r.getAttribute("y")||"0")),$o.composeSvgTransform(Pi.x,Pi.y,r.getAttribute("transform"));const y=new Ot().copy(c).applyMatrix3($o);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=rg.getInstanceByPath(r);if(!Array.isArray(u)){const h=u==null?void 0:u.computeBoundingBox();if(!h||h.isEmpty())return;h.getSize(Pi),s.x=h.min.x,s.y=h.max.y,s.width=Pi.x,s.height=Pi.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=Hd[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=Hl("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(ba(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 g=Hl("text");g.setAttribute("x","0"),g.setAttribute("y",o+c+"em"),s.appendChild(g)}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=It.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=It.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(It.lowerCase(r.tagName)==="symbol"){o=document.createElementNS("http://www.w3.org/2000/svg","g");for(let y=0,g=r.childNodes.length;y<g;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)}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 g=e.transform.baseVal;if(c&&g.numberOfItems>0){let A=g.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=er.RM),this.clearLinkedLines(e),!t||!t.value)return;const r=this.getLinesByTree(t);this.drawLinkedLines(e,r)}clearLinkedLines(e){var s;const t=Cs(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=Cs(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],g=Hl("line");g.setAttribute("x1",c.x.toString()),g.setAttribute("y1",c.y.toString()),g.setAttribute("x2",y.x.toString()),g.setAttribute("y2",y.y.toString()),g.setAttribute("class","danger"),g.setAttribute("style","stroke-width: 2;"),s.appendChild(g),this._lastLinked.push(g)}}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 Pi=new k,$o=new pe;class HA{constructor(e={},t){p(this,"name","SvgPainter");p(this,"params");p(this,"chef");this.params=e,this.chef=t}drawSocialDistanceCircles(e,t="http://www.w3.org/2000/svg"){var D,B,L;if(!e)return;const r=ME(e),s=Ud(e),o=2*r,u=(B=(D=this.params.socialDistance)==null?void 0:D.colors)!=null&&B.length?(L=this.params.socialDistance)==null?void 0:L.colors:[Qt.green,Qt.red],h=this.getRadius(s),c=e.querySelector(`#${sh}`),y=c==null?void 0:c.querySelectorAll("path");if(!c||!(y!=null&&y.length))return;let g,A;const _=new Array;for(let I=0,P=(y==null?void 0:y.length)||0;I<P;I++){if(g=y[I],A=g.getAttribute("id"),!A)continue;const V=this.chef.getElementBoundingBox(A);if(!V)continue;const G=new k;V.getCenter(G),_.push({id:A,cp:G})}for(let I=0,P=_.length;I<P;I++){_[I].color=u[0];for(let V=0,G=P;V<G;V++)_[I]!==_[V]&&k.getDistance(_[I].cp,_[V].cp)<h*2&&(_[I].color=u[1])}for(let I=0,P=_.length;I<P;I++){let V=this.createCircle(_[I],h,o,t);c.appendChild(V)}}clearSocialDistanceCircles(e){if(!e)return;const t=e.querySelector(`#${sh}`),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 UA=function(i){return(i||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};function mu(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 La(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):mu(i,u)||(t+=" "+u))}i.classList||(i.className=t)}function Na(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):mu(i,u)&&(r=r.replace(" "+u+" "," ")))}i.classList||(i.className=UA(r))}class Dh extends VE{constructor(t={}){super();p(this,"isSvgScene",!0);p(this,"name","SvgScene");p(this,"dynamically",!0);p(this,"params");p(this,"socialDistanceEnable",!1);p(this,"container");p(this,"svg");p(this,"svgStr","");p(this,"svgRoot");p(this,"viewBox",new Ot);p(this,"chef");p(this,"defaultLayers",[]);p(this,"skeletonLayers",[]);p(this,"currentLayers",[]);p(this,"assetType");p(this,"assetsMap",{});p(this,"legend",[]);p(this,"selectedList",[]);p(this,"painter");p(this,"_lastHighlightType","");p(this,"_lastHighlightIds",[]);p(this,"clickSvgElementHandler",this.handleClickSvgElement.bind(this));p(this,"_lastLinkedIds",[]);this.params=t,this.assetType=t.assetType||er.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 kA,this.painter=new HA(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 _t(this,null,function*(){return new $d().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&&(BE(r,this.viewBox),this.chef.bindSvg(this.svg),this.svgRoot=qd(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=[Cs(t)],t!==er.RM&&r.unshift(Cs(er.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(Cs(t));if(!s)return r;r[t]=this.chef.getElementsMap(s);const o=ba(t),u=this.chef.getElementById(o);if(!u)return r;const h=this.chef.getElementsMap(u),c=It.keys(h);if(!(c!=null&&c.length))return r;if(It.startsWith(c[0],`l-${t}-`)){const y=`l-${t}-`.length;for(let g=0,A=c.length;g<A;g++){const _=c[g].slice(y);h[_]=h[c[g]],delete h[c[g]]}}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?It.keys(r):s}clearFillOrStroke(t="fill"){const r=this.getAssetsByType(this.assetType);if(!r)return;const s=It.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=It.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=It.keys(u);let c;for(let y=0,g=h.length;y<g;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=ba(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]&&La(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]&&Na(r[o],"active")}),this._lastHighlightIds.length=0)}getIntersectObjects(t,r=er.RM,s=[]){s.length=0;const o=[],u=this.getAssetsByType(r);if(!u)return s;const h=It.keys(u);for(let y=0,g=h.length;y<g;y++){const A=this.chef.getElementBoundingBox(u[h[y]].id);A&&A.containsPoint(t.worldCoords)&&o.push(u[h[y]])}const c=It.sortBy(o,y=>{var g;return(g=this.chef.getElementBoundingBox(y.id))==null?void 0:g.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=It.uniq(It.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=ba(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=Fd(t),this._lastLinkedIds.forEach(h=>{u[h]&&(u[h].style.display="block")}))}onBeforeRender(){}fullscreen(t=1e3,r=!1){}update(){}}class qA extends Dh{constructor(t){super(t);p(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;}*/
@@ -149,4 +149,4 @@ function print() { __p += __j.call(arguments, '') }
149
149
  <path class="line" d="M103.5 46L187 46" />
150
150
  <path class="triangle" d="M103.5 56L133.5 90L73.5 90Z" />
151
151
  </g>
152
- </svg>`)}}class Vb extends ar{constructor(t={}){super();p(this,"name","SvgApp");p(this,"params");p(this,"renderer");p(this,"view");p(this,"scene");p(this,"loadingScene");p(this,"emptyScene");p(this,"mainScene");p(this,"zoomToSelectEnable",!1);p(this,"zoomBox",new Ot);p(this,"selectEnable",!1);p(this,"multiSelectEnable",!1);p(this,"fnEnable",!1);p(this,"requestHeader",{});p(this,"runningHandler",this.running.bind(this));p(this,"pointerOverHandler",this.handlePointerOver.bind(this));p(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this));p(this,"multiSelectorSelectedHandler",this.handleMultiSelectorSelected.bind(this));p(this,"dragEndHandler",this.handleDragEnd.bind(this));this.params=t,this.params.zoomToSelectEnable&&(this.zoomToSelectEnable=!0),this.params.selectEnable&&(this.selectEnable=!0),this.params.multiSelectEnable&&(this.multiSelectEnable=!0),this.params.defaultFill||(this.params.defaultFill=Yt.getMoreTransparent(Qt.white,.3)),this.params.defaultStroke||(this.params.defaultStroke=Yt.getMoreTransparent(Qt.darkWhite,.8)),this.params.infoFill||(this.params.infoFill=Yt.getMoreTransparent(Qt.gray,.3)),this.params.infoStroke||(this.params.infoStroke=Yt.getMoreTransparent(Qt.darkGray,.8)),this.params.primaryFill||(this.params.primaryFill=Yt.getMoreTransparent(Qt.blue,.3)),this.params.primaryStroke||(this.params.primaryStroke=Yt.getMoreTransparent(Qt.darkBlue,.8)),this.params.successFill||(this.params.successFill=Yt.getMoreTransparent(Qt.green,.3)),this.params.successStroke||(this.params.successStroke=Yt.getMoreTransparent(Qt.darkGreen,.8)),this.params.warningFill||(this.params.warningFill=Yt.getMoreTransparent(Qt.yellow,.3)),this.params.warningStroke||(this.params.warningStroke=Yt.getMoreTransparent(Qt.darkYellow,.8)),this.params.dangerFill||(this.params.dangerFill=Yt.getMoreTransparent(Qt.red,.3)),this.params.dangerStroke||(this.params.dangerStroke=Yt.getMoreTransparent(Qt.darkRed,.8)),this.params.activeFill||(this.params.activeFill=Yt.getMoreTransparent(Qt.brown,.3)),this.params.activeStroke||(this.params.activeStroke=Yt.getMoreTransparent(Qt.darkBrown,.8)),this.renderer=new PE(t),this.view=new qb(t),this.trans2LoadingScene()}get isLoadingScene(){var t;return((t=this.scene)==null?void 0:t.name)==="SvgLoadingScene"}destroy(){var t,r;this.unbindAssetsEvents(),super.destroy(),(t=this.view)==null||t.destroy(),(r=this.renderer)==null||r.destroy()}resize(){var t,r;(t=this.renderer)==null||t.resize(),(r=this.view)==null||r.resize()}isScene(t){var r;return((r=this.scene)==null?void 0:r.uuid)===t.uuid}removeScene(t){this.scene=void 0,t==null||t.destroy()}trans2MainScene(){var t,r;(t=this.scene)==null||t.unmount(),this.scene=this.mainScene,this.scene.isMounted||this.scene.mount(),this.view.bindScene(this.scene),(r=this.loadingScene)==null||r.destroy()}trans2LoadingScene(){var r,s;console.log("trans2LoadingScene: ",this.params),this.loadingScene=new qA(this.params),(r=this.scene)==null||r.unmount(),this.scene=this.loadingScene,this.scene.isMounted||this.scene.mount();const t=new Ot().copy(this.loadingScene.viewBox).expandByVector(new k(1,1).multiplyScalar(150));console.log("trans2LoadingScene: ",t.toString()),this.view.setByBox(t,!1),(s=this.mainScene)==null||s.destroy()}trans2EmptyScene(){var r,s;console.log("trans2EmptyScene: ",this.params),this.emptyScene=new Wb(this.params),(r=this.scene)==null||r.unmount(),this.scene=this.emptyScene,this.scene.isMounted||this.scene.mount();const t=new Ot().copy(this.emptyScene.viewBox).expandByVector(new k(1,1).multiplyScalar(150));console.log("trans2EmptyScene: ",t.toString()),this.view.setByBox(t,!1),(s=this.mainScene)==null||s.destroy()}start(){requestAnimationFrame(this.runningHandler)}running(t){this.scene&&(this.scene.update(),this.renderer.render(this.scene,this.view.camera),this.view.update(t),requestAnimationFrame(this.runningHandler))}setRequestHeader(t){return this.requestHeader=t,this}load(t,r,s=2,o){return _t(this,null,function*(){this.isLoadingScene||this.trans2LoadingScene(),yield Jo(this.params.syncDelay);const u=yield new $d().setRequestHeader(this.requestHeader).loadAsync(t).catch(()=>{this.trans2EmptyScene()});return this.loadByString(u,r,s)})}loadByString(t,r,s=2){return _t(this,null,function*(){if(this.mainScene=new Dh(this.params),!this.mainScene.bind(t))return this.trans2EmptyScene(),[];this.view.setByBox(this.mainScene.viewBox);const u=this.mainScene.getLayers(s);return r!=null&&r.length||(r=It.map(u,"label")),this.mainScene.showDefaultLayers(r,!0),this.trans2MainScene(),this.bindAssetsEvents(),console.log("svgApp.loadByString: ",u),u})}recompute(t){var r;(r=this.scene)==null||r.recompute(t)}setSkeletons(t){var r;(r=this.scene)==null||r.setSkeletonLayers(t)}getLayers(t=2){var r;return(r=this.scene)==null?void 0:r.getLayers(t)}getLayerVisible(t){var r;return(r=this.scene)==null?void 0:r.getLayerVisible(t)}updateLayersVisibility(t,r=!1,s=!0){var o;(o=this.scene)==null||o.updateLayersVisibility(t,r,s)}selectByIds(t){var r;(r=this.scene)==null||r.selectByIds(t,this.multiSelectEnable)}clearSelectedByIds(t){var r;Array.isArray(t)?t.forEach(s=>{var o;return(o=this.scene)==null?void 0:o.clearSelectedById(s)}):(r=this.scene)==null||r.clearSelectedById(t)}clearSelected(){var t;(t=this.scene)==null||t.clearSelected()}getSelectedIds(){var t;return(t=this.scene)==null?void 0:t.getSelectedIds()}targetByIds(t,r=100){return _t(this,null,function*(){var s;this.scene&&((s=this.scene)==null||s.selectByIds(t,!1),Jl.copy(this.scene.getSelectedBoundingBox()).expandByVector(new k(1,1).multiplyScalar(r)),yield Jo(100),Jl.isEmpty()||(yield this.view.setByBox(Jl)))})}linkAssetsByTree(t){var r;(r=this.scene)==null||r.linkAssetsByTree(t)}setViewAreaLimit(t){this.renderer.viewAreaLimit=t}setAssetType(t,r){var s;(s=this.scene)==null||s.setAssetType(t,r)}getAssetIdsByType(t){var r;return(r=this.scene)==null?void 0:r.getAssetIdsByType(t)}clearFill(){var t;(t=this.scene)==null||t.clearFillOrStroke("fill")}clearFillByIds(t){var r;(r=this.scene)==null||r.clearFillOrStrokeByIds(t,"fill")}setFillByIds(t,r){var s;(s=this.scene)==null||s.setFillOrStrokeByIds(t,r,"fill")}clearStroke(){var t;(t=this.scene)==null||t.clearFillOrStroke("stroke")}clearStrokeByIds(t){var r;(r=this.scene)==null||r.clearFillOrStrokeByIds(t,"stroke")}setStrokeByIds(t,r,s){var o;(o=this.scene)==null||o.setFillOrStrokeByIds(t,r,"stroke",s)}getLegend(){var t;return(t=this.scene)==null?void 0:t.getLegend()}setAssetLabels(t,r){var s;(s=this.scene)==null||s.setAssetLabels(t,r)}clearAssetLabels(){var t;(t=this.scene)==null||t.clearAssetLabels()}fullscreen(){this.view.fullscreen()}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}focusAt(t,r=1e3){var s;(s=this.view)==null||s.focusAt(t,r)}focusAtIds(t,r=100){return _t(this,null,function*(){if(!this.scene)return;const s=this.scene.getBoundingBoxByIds(t);s&&(s.expandByVector(new k(1,1).multiplyScalar(r)),yield Jo(100),s.isEmpty()||(yield this.view.setByBox(s)))})}focusAtById(t,r=1e3){return _t(this,null,function*(){var s;return(s=this.view)==null?void 0:s.focusAtById(t,r)})}focusAtDummy(t,r=1e3){return _t(this,null,function*(){var s;return(s=this.view)==null?void 0:s.focusAtDummy(t,r)})}showAssetsLabel(t,r,s){var o,u,h,c;r?t==="dummy"?(h=(u=(o=this.view)==null?void 0:o.dummiesController)==null?void 0:u.dummies)==null||h.showDummyLabel(r):(c=this.view)==null||c.showAssetsLabel(t,r,s):this.hideAssetsLabel()}hideAssetsLabel(){var t,r,s,o;(s=(r=(t=this.view)==null?void 0:t.dummiesController)==null?void 0:r.dummies)==null||s.hideDummyLabel(),(o=this.view)==null||o.hideAssetsLabel()}highlightAssets(t,r){var s;(s=this.scene)==null||s.highlightAssets(t,r)}resetHighlightAssets(t){var r;(r=this.scene)==null||r.resetHighlightAssets(t)}fontZoomIn(){var t;(t=this.scene)==null||t.chef.fontZoom("asset-labels",1.1)}fontZoomOut(){var t;(t=this.scene)==null||t.chef.fontZoom("asset-labels",.9)}zoomToSelectEnableChanged(t){this.view.zoomToSelectEnableChanged(t)}selectEnableChanged(t){this.selectEnable=!!t,this.view.selectEnableChanged(t)}multiSelectEnableChanged(t){this.multiSelectEnable=!!t,this.view.multiSelectEnableChanged(t)}socialDistanceEnableChanged(t){var r;(r=this.scene)==null||r.socialDistanceEnableChanged(t)}fnEnableChanged(t){this.fnEnable=!!t,this.view.fnEnableChanged(t)}getBoundingBoxById(t,r=!0){var o;if(!t)return;const s=(o=this.scene)==null?void 0:o.getBoundingBoxById(t);return s&&r&&s.applyMatrix3(this.view.camera.viewMatrix).round(),s}setDummies(t){var r;(r=this.view)==null||r.setDummies(t)}clearDummies(t){var r;(r=this.view)==null||r.clearDummies(t)}highlightDummies(t){var r,s;(s=(r=this.view)==null?void 0:r.dummiesController)==null||s.highlightDummies(t)}resetHighlightDummies(){var t,r;(r=(t=this.view)==null?void 0:t.dummiesController)==null||r.resetHighlightDummies()}bindAssetsEvents(){var t,r;this.view.addEventListener(zn.POINTEROVER,this.pointerOverHandler),this.view.addEventListener(zn.POINTERLEAVE,this.pointerLeaveHandler),this.view.addEventListener(zn.SELECTED,this.multiSelectorSelectedHandler),(r=(t=this.view)==null?void 0:t.dummiesController)==null||r.addEventListener("panend",this.dragEndHandler)}unbindAssetsEvents(){var t,r;this.view.removeEventListener(zn.POINTEROVER,this.pointerOverHandler),this.view.removeEventListener(zn.POINTERLEAVE,this.pointerLeaveHandler),this.view.removeEventListener(zn.SELECTED,this.multiSelectorSelectedHandler),(r=(t=this.view)==null?void 0:t.dummiesController)==null||r.removeEventListener("panend",this.dragEndHandler)}handleMultiSelectorSelected(t){this.dispatchEvent({type:"SELECTED",data:t.data})}handlePointerOver(t){this.dispatchEvent({type:"pointerover",data:t.data,e:t.e})}handlePointerLeave(t){this.dispatchEvent({type:"pointerleave",data:t.data,e:t.e})}handleInitializeStart(){console.log("App.initializeStart ...")}handleInitializeComplete(t){return _t(this,null,function*(){console.log("App.initializeComplete ...",t),t!=null&&t.data&&this.launch()})}handleDragEnd(t){this.dispatchEvent(t)}launch(){console.log("App.launch ...")}}const Jl=new Ot;var Og=(i=>(i.SELECTED="SELECTED",i.POINTEROVER="pointerover",i.POINTERLEAVE="pointerleave",i.DRAG_END="panend",i))(Og||{}),Lt=(i=>(i.INIT="init",i.LOAD="load",i.LOADED="loaded",i.GET_LAYERS="getLayers",i.GET_ASSET_IDS_BY_TYPE="getAssetIdsByType",i.SET_FILL_BY_IDS="setFillByIds",i.CLEAR_FILL="clearFill",i.SET_STROKE_BY_IDS="setStrokeByIds",i.CLEAR_STROKE="clearStroke",i.TERMINATE="terminate",i.CAMERA_SYNC="cameraSync",i.ASSET_TYPE_CHANGED="assetTypeChanged",i.SVG_LOADING_TYPE_CHANGED="svgLoadingTypeChanged",i.USED_CACHE_CHANGED="usedCacheChanged",i.DEBOUNCE_CACHE_CHANGED="debounceCacheChanged",i.WIREFRAME_CHANGED="wireframeChanged",i.BG_PASS_CHANGED="bgPass",i.SELECT_ENABLE_CHANGED="selectEnableChanged",i.MULTI_SELECT_ENABLE_CHANGED="multiSelectEnableChanged",i.MULTI_SELECT_BY_RANGE="multiSelectByRange",i.ZOOM_TO_SELECT_ENABLE_CHANGED="zoomToSelectEnableChanged",i.FONT_ZOOM_IN="fontZoomIn",i.FONT_ZOOM_OUT="fontZoomOut",i.CAMERA_CHANGED="cameraChanged",i.SCENES_CHANGED="scenesChanged",i.UPDATE_LAYERS_VISIBILITY="updateLayersVisibility",i.DYNAMIC_LOADED="dynamicLoaded",i.SYNC_TEXTURE_HELPER_CACHED="syncTextureHelperCached",i.INITIALIZATION_START="INITIALIZATION_START",i.INITIALIZATION_COMPLETE="INITIALIZATION_COMPLETE",i.SELECTED="selected",i.SELECT_BY_IDS="selectByIds",i.CLEAR_SELECTED="clearSelected",i.TARGET_BY_IDS="targetByIds",i.TAP="tap",i.SINGLE_TAP="singletap",i.DOUBLE_TAP="doubletap",i.PRESS="press",i.PAN="pan",i.PAN_START="panstart",i.PAN_MOVE="panmove",i.PAN_END="panend",i.ROTATE="rotate",i.ROTATE_START="rotatestart",i.ROTATE_MOVE="rotatemove",i.ROTATE_END="rotateend",i.PINCH="pinch",i.PINCH_START="pinchstart",i.PINCH_MOVE="pinchmove",i.PINCH_END="pinchend",i.PINCH_IN="pinchin",i.PINCH_OUT="pinchout",i.SWIPE="swipe",i))(Lt||{});class zb extends Ub{constructor(t={}){super(t);p(this,"name","OpeView");p(this,"container");p(this,"graph");p(this,"zoomToSelectEnable");p(this,"multiSelectEnable");p(this,"rayCaster",new ag);p(this,"intersects",[]);p(this,"controllerPanStartHandler",this.handlePanStart.bind(this));p(this,"controllerPanEndHandler",this.handlePanEnd.bind(this));p(this,"controllerPanMoveHandler",this.handleControllerPanMove.bind(this));p(this,"controllerPointerOverHandler",this.handleControllerPointerOver.bind(this));this.container=this.params.cvs?this.params.cvs:this.params.canvasId?document.getElementById(this.params.canvasId):Vt.window.document.getElementsByTagName("body")[0],console.warn("opeView.constructor: ",this.container,this.container.tagName),this.controller=new ng(this.container,this.camera),this.bindControllerEvents();let r=this.container.tagName.toLowerCase()!=="body"?this.container.parentNode:this.container;this.graph=new Sh(r)}destroy(){this.unbindControllerEvents(),this.controller&&this.controller.destroy(),super.destroy()}zoomToSelectEnableChanged(t=!1){this.zoomToSelectEnable=t,this.controller.enablePan=!this.zoomToSelectEnable}multiSelectEnableChanged(t=!1){this.multiSelectEnable=t,this.controller.enablePan=!this.multiSelectEnable}bindControllerEvents(){this.controller.addEventListener(lt.PAN_START,this.controllerPanStartHandler),this.controller.addEventListener(lt.PAN_END,this.controllerPanEndHandler),this.controller.addEventListener(lt.PAN_MOVE,this.controllerPanMoveHandler),this.controller.addEventListener(lt.POINTEROVER,this.controllerPointerOverHandler)}unbindControllerEvents(){this.controller.removeEventListener(lt.PAN_START,this.controllerPanStartHandler),this.controller.removeEventListener(lt.PAN_END,this.controllerPanEndHandler),this.controller.removeEventListener(lt.PAN_MOVE,this.controllerPanMoveHandler),this.controller.removeEventListener(lt.POINTEROVER,this.controllerPointerOverHandler)}handlePanStart(t){(t==null?void 0:t.type)!==lt.PAN_START&&(t==null?void 0:t.type)!==lt.WHEEL_START||(this.zoomToSelectEnable||this.multiSelectEnable)&&(Zo.copy(t.data.screenCoords),dn.makeEmpty().expandByPoint(Zo),this.graph.draw(dn))}handlePanEnd(t){return _t(this,null,function*(){(t==null?void 0:t.type)!==lt.PAN_END&&(t==null?void 0:t.type)!==lt.WHEEL_END||((this.zoomToSelectEnable||this.multiSelectEnable)&&(Qo.copy(t.data.screenCoords),dn.makeEmpty().expandByPoint(Zo).expandByPoint(Qo).unproject(this.controller.camera),this.graph.hide()),this.zoomToSelectEnable&&(yield this.resetCameraByBoundingBox(dn,!0)),this.multiSelectEnable&&this.dispatchEvent({type:Lt.MULTI_SELECT_BY_RANGE,data:dn.clone()}),dn.makeEmpty())})}handleControllerPanMove(t){(t==null?void 0:t.type)===lt.PAN_MOVE&&(this.zoomToSelectEnable||this.multiSelectEnable)&&(Qo.copy(t.data.screenCoords),dn.makeEmpty().expandByPoint(Zo).expandByPoint(Qo),this.graph.draw(dn))}handleControllerPointerOver(t){t==null||t.type,lt.POINTEROVER}handleMultiSelectorSelected(t){}handleCameraChanged(t){console.warn("handleCameraChanged: ",t.target.camera.position.z,t.target.camera.scaled.x)}}const Zo=new k,Qo=new k,dn=new Ot;function rd(i){return!!(i&&i.constructor&&i.call&&i.apply)}const $b="children",Gb="get",Yb="set",th="Changed";class Xb extends ar{constructor(t){super();p(this,"name","Node2");p(this,"userData",{});p(this,"_cache",new Map);p(this,"_attachedDepsListeners",new Map);this.setAttrs(t)}destroy(){super.destroy(),this._clearCache()}setAttrs(t){if(!t)return this;let r;for(const s in t)s!==$b&&(r=Yb+s,rd(this[r])?this[r](t[s]):this.setAttr(s,t[s]));return this}setAttr(t,r){Object.hasOwnProperty.call(this,t)&&(this.userData[t]=r,this[t]=r)}getAttrs(){return this.userData||{}}getAttr(t){const r=Gb+It.capitalize(t);return rd(this[r])?this[r]():this.userData[t]}getAttrKey(){return Object.values(this.userData).filter(t=>!(t instanceof Array||t instanceof Object)).join("_")}_getCache(t,r){let s=this._cache.get(t);return(s===void 0||s.dirty===!0)&&(s=r.call(this),this._cache.set(t,s)),s}_clearCache(t){t===void 0?this._cache.clear():this._cache.has(t)&&this._cache.get(t).isMatrix3?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_setProperty(t){Object.hasOwnProperty.call(this,t)&&delete this[t],Object.defineProperty(this,t,{get(){return this.userData[t]},set(r){const s=this.userData[t];this.userData[t]=r,s!==r&&this.dispatchEvent({type:t+th,data:{oldVal:s,newVal:r}})},enumerable:!0,configurable:!0})}computed(t,r,s){if(!this._attachedDepsListeners.get(t)){const o=r.map(u=>u+th).join(",");this.addEventListeners(o,()=>this._clearCache(t)),r.forEach(u=>this._setProperty(u)),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,s)}watch(t,r){(t||[]).forEach(s=>{this._setProperty(s),this.addEventListener(s+th,r)})}}const Gr=new k;class Zb extends Xb{constructor(t={}){super(t);p(this,"isTexture",!0);p(this,"isRenderTargetTexture",!1);p(this,"type","Texture");p(this,"name","Texture");p(this,"uuid",Wd());p(this,"originSize",new k);p(this,"originCenter",new k);p(this,"size",new k);p(this,"matrix",new pe);p(this,"matrixAutoUpdate",!0);p(this,"userData",{});p(this,"version",0);p(this,"_needsUpdate",!1);p(this,"image");p(this,"offset",new k);p(this,"repeat",new k(1,1));p(this,"center",new k);p(this,"rotate",0);p(this,"scale",1);p(this,"flipY",!0);this.setAttrs(t)}destroy(){super.destroy()}set needsUpdate(t){t&&(this.version++,this._needsUpdate=!0)}get needsUpdate(){return this._needsUpdate}updateSize(t,r,s,o){return this.originSize.copy(t),this.originCenter.copy(r),this.flipY&&this.originCenter.multiplyScalar(1,-1),this.updateFinalSize(s,o)}updateFinalSize(t,r){t&&!k.isZero(t)&&!k.isEmpty(t)?Gr.copy(t):Gr.copy(this.originSize),Gr.maxXY(1,1);const s=Math.sqrt(Gr.x*Gr.x+Gr.y*Gr.y)/Math.sqrt(r.x*r.x+r.y*r.y);return s>1&&Gr.multiplyScalar(1/s),this.scale=Gr.length()/this.originSize.length(),this.repeat.multiplyScalar(this.originSize.length()/Gr.length()),this.size.copy(Gr),this.offset.copy(this.originSize).multiplyScalar(-.5).add(this.originCenter),this.updateMatrix(),this}reset(t,r){t&&this.originSize.copy(t),r&&this.size.copy(r),this.scale=this.size.x/this.originSize.x,this.repeat.set(1,1),this.center.set(0,0),this.rotate=0,this.offset.copy(this.originSize).multiplyScalar(.5).sub(this.originCenter).multiplyScalar(this.scale),this.updateMatrix()}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotate,this.center.x,this.center.y)}clone(){const t=this.constructor;return new t(this.attrs).copy(this)}copy(t){return this.name=t.name,this.originSize.copy(t.originSize),this.originCenter.copy(t.originCenter),this.size.copy(t.size),this.matrix.copy(t.matrix),this.matrixAutoUpdate=t.matrixAutoUpdate,this.userData=JSON.parse(JSON.stringify(t.userData)),this.image=t.image,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotate=t.rotate,this.scale=t.scale,this.flipY=t.flipY,this}}const Je=class Je{static destroy(){Object.values(this.cached).forEach(e=>{e.destroy()}),this.cached=new Map}static has(e){return this.cached.has(e)}static get(e,t){if(e)return!this.precisionOptimized||!t?this.cached.get(e):t&&t<this.precisionOptimizeLevels[2]?this.get(e+"_3"):t&&t<this.precisionOptimizeLevels[1]?this.get(e+"_2"):t&&t<this.precisionOptimizeLevels[0]?this.get(e+"_1"):this.get(e)}static set(e,t){if(!e||!t)throw new Error("error input");return this.cached.set(e,t),t}static remove(e){if(!e||!this.cached.has(e))return;const t=this.cached.get(e);if(t&&t.destroy(),this.cached.delete(e),this.precisionOptimized)for(let r=1,s=this.precisionOptimizeLevels.length;r<=s;r++){const o=e+"_"+r;let u;this.cached.has(o)&&(u=this.cached.get(o),u&&u.destroy(),this.cached.delete(o))}}static clear(){this.destroy()}static setTextureMaxSize(){this.initialized||(this.textureMaxSize.set(Vt.config.width,Vt.config.height).multiplyScalar(.5).round(),this.initialized=!0)}static getTextureMaxSize(){return this.initialized||this.setTextureMaxSize(),this.textureMaxSize}static getTextureByShape(e,t,r,s){var u;const o=new Zb;if(this.setTextureMaxSize(),o.scale=1,o.repeat.set(1,1),o.rotate=0,o.image=void 0,o.version=0,console.warn("getTextureByShape: ============================",e.name),t&&!k.isZero(t)&&!k.isEmpty(t))Ea.copy(t),e.alignCenter?e.boundingBox.getCenter(Aa):Aa.set(0,0);else{if(e.isShape&&((u=e.geometry)!=null&&u.boundingBox))jo.copy(e.geometry.boundingBox);else if(e.boundingBox)jo.copy(e.boundingBox);else throw new Error("get boundingBox error");jo.getSize(Ea),e.alignCenter?e.boundingBox.getCenter(Aa):jo.getCenter(Aa)}return r&&!k.isZero(r)&&!k.isEmpty(r)?Fi.copy(r):Fi.copy(Ea),(Fi.x<id.x||Fi.y<id.y)&&Fi.normalize().multiplyScalar(10).round(),li.copy(this.getTextureMaxSize()),s&&(wa.set((s==null?void 0:s.shadowBlur)||0,(s==null?void 0:s.shadowBlur)||0),Fi.add(wa.clone().multiplyScalar(2)),Ea.multiplyScalar(3),li.multiplyScalar(.3)),o.updateSize(Ea,Aa,Fi,li),o}static setPrecisionOptimizeTextures(e,t,r,s,o){if(!this.precisionOptimized)return;let u;for(let h=0,c=this.precisionOptimizeLevels.length;h<c;h++){li.copy(r.size).multiplyScalar(this.precisionOptimizeLevels[h]);const y=this.getTextureByShape(t,s,li,o);this.renderShapeTexture(t,y,o),u=e+"_"+(h+1),y.userData.textureKey=u,Je.set(u,y)}}static renderShapeTexture(e,t,r){r?(wa.set(r.shadowBlur||0,r.shadowBlur||0),ui.copy(t.originSize).multiplyScalar(-.5).sub(t.originCenter).multiplyScalar(t.scale),e.alignCenter?Ko.copy(t.originSize).multiplyScalar(t.scale):Ko.copy(t.originSize).add(wa.clone().multiplyScalar(1)).multiplyScalar(t.scale)):ui.copy(t.offset).negate().multiplyScalar(t.scale);const s=Yr.create(t.size.x,t.size.y),o=Yr.getContext2D(s,{alpha:!0});if(e.isText||!e.matrix.hasChange())o.clearRect(0,0,s.width,s.height),o.translate(ui.x,ui.y),o.scale(t.scale,-t.scale);else{e.matrix.decompose(nd,Qb,sd);const u=1/sd.x;ui.sub(nd.multiplyScalar(u,-u)),o.clearRect(0,0,s.width,s.height),o.translate(ui.x,ui.y),o.scale(u,-u)}r&&(o.shadowColor=Qt.black,o.shadowOffsetX=Ko.x,o.shadowOffsetY=Ko.y,o.shadowBlur=wa.x),e.render(o),t.image=s}static setByShape(e,t,r,s){const o=this.getTextureByShape(t,r,s);return o.userData.textureKey=e,this.renderShapeTexture(t,o),Je.set(e,o),t.featureKey=e,o}static setShadowByShape(e,t,r){const s=this.getTextureByShape(t,void 0,void 0,r);return s.userData.textureKey=e,this.renderShapeTexture(t,s,r),Je.set(e,s),s}static setPointsByShape(e,t){var y,g,A,_,D;const r=[];t.isGroup?t.traverse(B=>B.isShape?r.push(...B.geometry.points):void 0):t.isShape&&t.geometry.points?r.push(...t.geometry.points):t.boundingBox&&r.push(t.boundingBox.min,t.boundingBox.max);const s=this.getTextureByShape(t),o=((y=t.material)==null?void 0:y.lineWidth)*2||3;ki.set(1,1).multiplyScalar(o),s.size.copy(ki).multiplyScalar(s.scale).multiplyScalar(2).add(Fi),s.offset.sub(ki),s.updateMatrix();const u=Yr.create(s.size.x,s.size.y),h=Yr.getContext2D(u,{alpha:!0});ui.subVectors(s.originSize.clone().multiplyScalar(.5),s.originCenter).add(ki),h.clearRect(0,0,u.width,u.height),h.scale(s.scale,s.scale),h.translate(ui.x,ui.y);let c=Qt.black;t.material?c=((g=t.material)==null?void 0:g.stroke)||((A=t.material)==null?void 0:A.fill):t.isGroup&&t.children.length&&t.children[0].isShape&&(c=((_=t.children[0].material)==null?void 0:_.stroke)||((D=t.children[0].material)==null?void 0:D.fill)),h.fillStyle=Yt.getDarken(c);for(let B=0,L=r.length||0;B<L;B++)li.copy(r[B]),h.moveTo(li.x,li.y),h.arc(li.x,li.y,ki.x,0,Math.PI*2);return h.fill(),s.image=u,Je.set(e,s),s}static setWireframeByShape(e,t){var h;const r=this.getTextureByShape(t);ki.set(1,1).multiplyScalar(((h=t.mat)==null?void 0:h.lineWidth)||1),r.size.copy(ki).multiplyScalar(r.scale).multiplyScalar(2).add(Fi),r.offset.sub(ki),r.updateMatrix();const s=Yr.create(r.size.x,r.size.y),o=Yr.getContext2D(s,{alpha:!0}),u=ki.x*r.scale*5;return o.clearRect(0,0,s.width,s.height),o.strokeStyle=Qt.darkGray,o.lineWidth=u,o.setLineDash([u*3,u]),o.strokeRect(0,0,r.size.x,r.size.y),r.image=s,Je.set(e,r),r}};p(Je,"cached",new Map),p(Je,"precisionOptimized",!0),p(Je,"precisionOptimizeLevels",[.5,.25,1e-4]),p(Je,"initialized",!1),p(Je,"textureMaxSize",new k),p(Je,"DEBUG_DisplayCachedTexture",It.throttle((e=80,t=.8)=>{let r=Kb();if(r||(r=jb(e,t)),!r)throw new Error("dom not found");Jb(r,Je.cached)},5e3));let cu=Je;const id=new k(10,10),Ea=new k,Aa=new k,Fi=new k,ui=new k,Ko=new k,wa=new k,li=new k,ki=new k,jo=new Ot,nd=new k,Qb=new k,sd=new k;function Kb(){return window.document.getElementById("DEBUG_Displaycached")}function jb(i=80,e=.8){const t=document.createElement("div");function r(){t.style.opacity="1"}function s(){t.style.opacity=e.toString()}return t.setAttribute("id","DEBUG_Displaycached"),t.style.position="absolute",t.style.width=i+"px",t.style.height="92vh",t.style.background=`rgba(255, 255, 255, ${e})`,t.style.left="20px",t.style.top="20px",t.style.overflow="auto",t.style.padding="6px",t.style.opacity=e.toString(),t.addEventListener("mouseenter",r),t.addEventListener("mouseleave",s),document.body.appendChild(t),t}function Jb(i,e){e.forEach((t,r)=>{!t||!t.image||tT(i,r,t)})}function tT(i,e,t){let r;for(let s=0,o=i.childNodes.length;s<o;s++)if(i.childNodes[s].getAttribute("id")===e){r=i.childNodes[s];break}r?rT(r,t):eT(i,e,t)}function eT(i,e,t){if(!t.image)return;const r=Vt.document.createElement("div");r.setAttribute("id",e),r.style.display="flex",r.style.flexDirection="column";const s=Yr.createCanvas({containerId:i.id,width:t.image.width,height:t.image.height,dpr:window.devicePixelRatio});s.style.border=`${Qt.yellow} 1px solid`,s.style.maxWidth=parseInt(i.style.width)-2+"px",s.style.maxHeight=parseInt(s.style.maxWidth)/(t.image.width/t.image.height)+"px";const o=s.getContext("2d",{alpha:!0});if(!o)throw new Error("getContext error");o.save(),o.scale(window.devicePixelRatio,window.devicePixelRatio),o.drawImage(t.image,0,0),o.restore(),r.appendChild(s);const u=Vt.document.createElement("p");u.innerHTML=t.image.width+" * "+t.image.height,u.innerHTML+="<br/>"+e,u.style.margin="0",u.style.padding="0",u.style.lineHeight="1.2",u.style.fontSize="10px",u.style.padding="3px 0 6px 0",u.style.color=Qt.black,r.appendChild(u),i.appendChild(r);function h(){const c=s.toDataURL("image/png",.6),y=document.createElement("a"),g=new MouseEvent("click");y.download=`thumb.${Date.now()}.png`,y.href=c,y.dispatchEvent(g)}r.addEventListener("click",h)}function rT(i,e){if(!e.image)return;const t=i.querySelector("canvas");if(!t)return;const r=t.getContext("2d",{alpha:!0});if(!r)throw new Error("getContext error");r.clearRect(0,0,t.width,t.height),r.save(),r.scale(window.devicePixelRatio,window.devicePixelRatio),r.drawImage(e.image,0,0),r.restore()}class iT extends ar{constructor(t={},r){super();p(this,"cvs");p(this,"worker");p(this,"view");p(this,"boundingBox",new Ot);p(this,"viewTapHandler",this.handleViewTap.bind(this));p(this,"multiSelectByRangeHandler",this.handleMultiSelectByRange.bind(this));p(this,"workerMessageHandler",this.handleWorkerMessage.bind(this));p(this,"cameraHandler",this.handleCameraChanged.bind(this));p(this,"runningHandler",this.running.bind(this));t.workerRender=!0,this.params=t,Vt.config=t;const s=Yr.createCanvas(t);if(!s.transferControlToOffscreen)throw new Error("not support transferControlToOffscreen");this.cvs=s.transferControlToOffscreen(),this.view=new zb(t),this.view.camera.name="mainCamera",this.view.camera.resize(),this.worker=r,this.bindEvents()}destroy(){super.destroy(),this.unbindEvents(),this.worker.postMessage({task:Lt.TERMINATE}),this.worker.terminate()}bindEvents(){var t,r,s,o,u;(r=(t=this.view)==null?void 0:t.controller)==null||r.addEventListener(lt.TAP,this.viewTapHandler),(s=this.view)==null||s.addEventListener(Lt.MULTI_SELECT_BY_RANGE,this.multiSelectByRangeHandler),(u=(o=this.view)==null?void 0:o.camera)==null||u.addEventListener(ou.UPDATE,this.cameraHandler),this.worker.addEventListener("message",this.workerMessageHandler)}unbindEvents(){var t,r,s,o;(r=(t=this.view)==null?void 0:t.controller)==null||r.removeEventListener(lt.TAP,this.viewTapHandler),(o=(s=this.view)==null?void 0:s.controller)==null||o.removeEventListener(lt.CAMERA_CHANGED,this.cameraHandler),this.worker.removeEventListener("message",this.workerMessageHandler)}handleViewTap(t){return _t(this,null,function*(){if((t==null?void 0:t.type)!==lt.TAP)return;const r=yield this.promiseWorkerResponse(Lt.TAP,t.data);this.dispatchEvent({type:Lt.SELECTED,data:r})})}handleWorkerMessage(t){var r,s,o,u,h,c;switch(t.data.task){case Lt.CAMERA_SYNC:if(!((r=t==null?void 0:t.data)!=null&&r.data))break;const y=JSON.parse(t.data.data);(o=(s=this.view)==null?void 0:s.camera)==null||o.fromJSON(y),this.view.camera.computeBoundingBox();break;case Lt.CAMERA_CHANGED:const{t:g,r:A,s:_}=t.data.data;(h=(u=this.view)==null?void 0:u.camera)==null||h.setTRS(g,A,_);break;case Lt.SCENES_CHANGED:const{box:D}=t.data.data;if(!D)return;this.boundingBox.fromString(D);break;case"syncTextureHelperCached":(((c=t.data)==null?void 0:c.data)||[]).forEach((B,L)=>cu.set(L,B));break;case"pong":console.log("response: pong");break}}handleCameraChanged(t){this.worker.postMessage({task:Lt.CAMERA_CHANGED,data:t.data})}promiseWorkerResponse(t,r){return new Promise((s,o)=>{const u=c=>{var y;((y=c==null?void 0:c.data)==null?void 0:y.task)===t&&(this.worker.removeEventListener("message",u),this.worker.removeEventListener("error",h),s(c.data.data))},h=c=>{this.worker.removeEventListener("message",u),this.worker.removeEventListener("error",h),o(c.error)};this.worker.addEventListener("message",u),this.worker.addEventListener("error",h),this.worker.postMessage({task:t,data:r})})}handleMultiSelectByRange(t){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.MULTI_SELECT_BY_RANGE,t.data)})}resize(){var t;(t=this.view.camera)==null||t.resize()}load(t,r){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.LOAD,{url:t,layers:r})})}getLayers(t=2){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.GET_LAYERS,{lv:t})})}assetTypeChanged(t=er.RM){this.params.assetType=t,this.worker.postMessage({task:Lt.ASSET_TYPE_CHANGED,data:t})}usedCacheChanged(t=!1){this.params.usedCache=t,this.worker.postMessage({task:Lt.USED_CACHE_CHANGED,data:t})}debounceCacheChanged(t=!1){this.params.debounceCache=t,this.worker.postMessage({task:Lt.DEBOUNCE_CACHE_CHANGED,data:t})}wireframeChanged(t=!1){this.params.wireframe=t,this.worker.postMessage({task:Lt.WIREFRAME_CHANGED,data:t})}bgPassChanged(t=!1){this.params.bgPass=t,this.worker.postMessage({task:Lt.BG_PASS_CHANGED,data:t})}selectEnableChanged(t=!1){return _t(this,null,function*(){yield this.clearSelected(),this.params.selectEnable=t,this.worker.postMessage({task:Lt.SELECT_ENABLE_CHANGED,data:t})})}multiSelectEnableChanged(t=!1){return _t(this,null,function*(){yield this.clearSelected(),this.params.multiSelectEnable=t,this.view.multiSelectEnableChanged(t),this.worker.postMessage({task:Lt.MULTI_SELECT_ENABLE_CHANGED,data:t})})}zoomToSelectEnableChanged(t=!1){return _t(this,null,function*(){return this.params.zoomToSelectEnable=t,this.view.zoomToSelectEnableChanged(t),this.promiseWorkerResponse(Lt.ZOOM_TO_SELECT_ENABLE_CHANGED,{data:t})})}svgLoadingTypeChanged(t){return _t(this,null,function*(){return this.params.svgLoadingType=t,this.promiseWorkerResponse(Lt.SVG_LOADING_TYPE_CHANGED,t)})}fullscreen(){return _t(this,null,function*(){yield this.view.resetCameraByBoundingBox(this.boundingBox,!0)})}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}updateLayersVisibility(t,r=!1){this.worker.postMessage({task:Lt.UPDATE_LAYERS_VISIBILITY,data:{ids:t,visible:r}})}clearSelected(t){return this.promiseWorkerResponse(Lt.CLEAR_SELECTED,{data:t})}selectByIds(t){this.worker.postMessage({task:Lt.SELECT_BY_IDS,data:t})}targetByIds(t){this.worker.postMessage({task:Lt.TARGET_BY_IDS,data:t})}getAssetIdsByType(t){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.GET_ASSET_IDS_BY_TYPE,{assetType:t})})}setFillByIds(t,r){this.worker.postMessage({task:Lt.SET_FILL_BY_IDS,data:{ids:t,c:r}})}clearFill(){this.worker.postMessage({task:Lt.CLEAR_FILL})}setStrokeByIds(t,r){this.worker.postMessage({task:Lt.SET_STROKE_BY_IDS,data:{ids:t,c:r}})}clearStroke(){this.worker.postMessage({task:Lt.CLEAR_STROKE})}fontZoomIn(t=1.1){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.FONT_ZOOM_IN,t)})}fontZoomOut(t=.9){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.FONT_ZOOM_OUT,t)})}start(){const t=this.cvs,r=JSON.stringify(this.params);this.worker.postMessage({task:Lt.INIT,data:{cvs:t,config:r}},[t]),requestAnimationFrame(this.runningHandler)}running(t){var r;(r=this.view)==null||r.update(t),requestAnimationFrame(this.runningHandler),cu.DEBUG_DisplayCachedTexture()}stop(){}}function nT(i){return new Worker("/environment.worker.js",{type:"module",name:i==null?void 0:i.name})}function sT(i){return new Worker("/renderer.worker.js",{type:"module",name:i==null?void 0:i.name})}exports.AppEnum=Og;exports.AppOffscreen=iT;exports.AssetTypeEnum=er;exports.Box2=xE;exports.Color=Yt;exports.ColorsEnum=Qt;exports.EnvironmentWorker=nT;exports.GLOB=Vt;exports.LayerTypeEnum=Ua;exports.Monitor=Ms;exports.RendererWorker=sT;exports.SvgApp=Vb;exports.Vector2=mE;exports.assetTypeConflicts=Hd;exports.defaultConfig=ad;exports.getAssetLabelByType=ba;exports.getAssetLayerByType=Cs;exports.randomDelay=Jo;
152
+ </svg>`)}}class Vb extends ar{constructor(t={}){super();p(this,"name","SvgApp");p(this,"params");p(this,"renderer");p(this,"view");p(this,"scene");p(this,"loadingScene");p(this,"emptyScene");p(this,"mainScene");p(this,"zoomToSelectEnable",!1);p(this,"zoomBox",new Ot);p(this,"selectEnable",!1);p(this,"multiSelectEnable",!1);p(this,"fnEnable",!1);p(this,"requestHeader",{});p(this,"runningHandler",this.running.bind(this));p(this,"pointerOverHandler",this.handlePointerOver.bind(this));p(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this));p(this,"multiSelectorSelectedHandler",this.handleMultiSelectorSelected.bind(this));p(this,"dragEndHandler",this.handleDragEnd.bind(this));this.params=t,this.params.zoomToSelectEnable&&(this.zoomToSelectEnable=!0),this.params.selectEnable&&(this.selectEnable=!0),this.params.multiSelectEnable&&(this.multiSelectEnable=!0),this.params.defaultFill||(this.params.defaultFill=Yt.getMoreTransparent(Qt.white,.3)),this.params.defaultStroke||(this.params.defaultStroke=Yt.getMoreTransparent(Qt.darkWhite,.8)),this.params.infoFill||(this.params.infoFill=Yt.getMoreTransparent(Qt.gray,.3)),this.params.infoStroke||(this.params.infoStroke=Yt.getMoreTransparent(Qt.darkGray,.8)),this.params.primaryFill||(this.params.primaryFill=Yt.getMoreTransparent(Qt.blue,.3)),this.params.primaryStroke||(this.params.primaryStroke=Yt.getMoreTransparent(Qt.darkBlue,.8)),this.params.successFill||(this.params.successFill=Yt.getMoreTransparent(Qt.green,.3)),this.params.successStroke||(this.params.successStroke=Yt.getMoreTransparent(Qt.darkGreen,.8)),this.params.warningFill||(this.params.warningFill=Yt.getMoreTransparent(Qt.yellow,.3)),this.params.warningStroke||(this.params.warningStroke=Yt.getMoreTransparent(Qt.darkYellow,.8)),this.params.dangerFill||(this.params.dangerFill=Yt.getMoreTransparent(Qt.red,.3)),this.params.dangerStroke||(this.params.dangerStroke=Yt.getMoreTransparent(Qt.darkRed,.8)),this.params.activeFill||(this.params.activeFill=Yt.getMoreTransparent(Qt.brown,.3)),this.params.activeStroke||(this.params.activeStroke=Yt.getMoreTransparent(Qt.darkBrown,.8)),this.renderer=new PE(t),this.view=new qb(t),this.trans2LoadingScene()}get isLoadingScene(){var t;return((t=this.scene)==null?void 0:t.name)==="SvgLoadingScene"}destroy(){var t,r;this.unbindAssetsEvents(),super.destroy(),(t=this.view)==null||t.destroy(),(r=this.renderer)==null||r.destroy()}resize(){var t,r;(t=this.renderer)==null||t.resize(),(r=this.view)==null||r.resize()}isScene(t){var r;return((r=this.scene)==null?void 0:r.uuid)===t.uuid}removeScene(t){this.scene=void 0,t==null||t.destroy()}trans2MainScene(){var t,r;(t=this.scene)==null||t.unmount(),this.scene=this.mainScene,this.scene.isMounted||this.scene.mount(),this.view.bindScene(this.scene),(r=this.loadingScene)==null||r.destroy()}trans2LoadingScene(){var r,s;console.log("trans2LoadingScene: ",this.params),this.loadingScene=new qA(this.params),(r=this.scene)==null||r.unmount(),this.scene=this.loadingScene,this.scene.isMounted||this.scene.mount();const t=new Ot().copy(this.loadingScene.viewBox).expandByVector(new k(1,1).multiplyScalar(150));console.log("trans2LoadingScene: ",t.toString()),this.view.setByBox(t,!1),(s=this.mainScene)==null||s.destroy()}trans2EmptyScene(){var r,s;console.log("trans2EmptyScene: ",this.params),this.emptyScene=new Wb(this.params),(r=this.scene)==null||r.unmount(),this.scene=this.emptyScene,this.scene.isMounted||this.scene.mount();const t=new Ot().copy(this.emptyScene.viewBox).expandByVector(new k(1,1).multiplyScalar(150));console.log("trans2EmptyScene: ",t.toString()),this.view.setByBox(t,!1),(s=this.mainScene)==null||s.destroy()}start(){requestAnimationFrame(this.runningHandler)}running(t){this.scene&&(this.scene.update(),this.renderer.render(this.scene,this.view.camera),this.view.update(t),requestAnimationFrame(this.runningHandler))}setRequestHeader(t){return this.requestHeader=t,this}load(t,r,s=2,o){return _t(this,null,function*(){this.isLoadingScene||this.trans2LoadingScene(),yield Jo(this.params.syncDelay);const u=yield new $d().setRequestHeader(this.requestHeader).loadAsync(t).catch(()=>{this.trans2EmptyScene()});return this.loadByString(u,r,s)})}loadByString(t,r,s=2){return _t(this,null,function*(){if(this.mainScene=new Dh(this.params),!this.mainScene.bind(t))return this.trans2EmptyScene(),[];this.view.setByBox(this.mainScene.viewBox);const u=this.mainScene.getLayers(s);return r!=null&&r.length||(r=It.map(u,"label")),this.mainScene.showDefaultLayers(r,!0),this.trans2MainScene(),this.bindAssetsEvents(),console.log("svgApp.loadByString: ",u),u})}recompute(t){var r;(r=this.scene)==null||r.recompute(t),this.fullscreen()}setSkeletons(t){var r;(r=this.scene)==null||r.setSkeletonLayers(t)}getLayers(t=2){var r;return(r=this.scene)==null?void 0:r.getLayers(t)}getLayerVisible(t){var r;return(r=this.scene)==null?void 0:r.getLayerVisible(t)}updateLayersVisibility(t,r=!1,s=!0){var o;(o=this.scene)==null||o.updateLayersVisibility(t,r,s)}selectByIds(t){var r;(r=this.scene)==null||r.selectByIds(t,this.multiSelectEnable)}clearSelectedByIds(t){var r;Array.isArray(t)?t.forEach(s=>{var o;return(o=this.scene)==null?void 0:o.clearSelectedById(s)}):(r=this.scene)==null||r.clearSelectedById(t)}clearSelected(){var t;(t=this.scene)==null||t.clearSelected()}getSelectedIds(){var t;return(t=this.scene)==null?void 0:t.getSelectedIds()}targetByIds(t,r=100){return _t(this,null,function*(){var s;this.scene&&((s=this.scene)==null||s.selectByIds(t,!1),Jl.copy(this.scene.getSelectedBoundingBox()).expandByVector(new k(1,1).multiplyScalar(r)),yield Jo(100),Jl.isEmpty()||(yield this.view.setByBox(Jl)))})}linkAssetsByTree(t){var r;(r=this.scene)==null||r.linkAssetsByTree(t)}setViewAreaLimit(t){this.renderer.viewAreaLimit=t}setAssetType(t,r){var s;(s=this.scene)==null||s.setAssetType(t,r)}getAssetIdsByType(t){var r;return(r=this.scene)==null?void 0:r.getAssetIdsByType(t)}clearFill(){var t;(t=this.scene)==null||t.clearFillOrStroke("fill")}clearFillByIds(t){var r;(r=this.scene)==null||r.clearFillOrStrokeByIds(t,"fill")}setFillByIds(t,r){var s;(s=this.scene)==null||s.setFillOrStrokeByIds(t,r,"fill")}clearStroke(){var t;(t=this.scene)==null||t.clearFillOrStroke("stroke")}clearStrokeByIds(t){var r;(r=this.scene)==null||r.clearFillOrStrokeByIds(t,"stroke")}setStrokeByIds(t,r,s){var o;(o=this.scene)==null||o.setFillOrStrokeByIds(t,r,"stroke",s)}getLegend(){var t;return(t=this.scene)==null?void 0:t.getLegend()}setAssetLabels(t,r){var s;(s=this.scene)==null||s.setAssetLabels(t,r)}clearAssetLabels(){var t;(t=this.scene)==null||t.clearAssetLabels()}fullscreen(){this.view.fullscreen()}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}focusAt(t,r=1e3){var s;(s=this.view)==null||s.focusAt(t,r)}focusAtIds(t,r=100){return _t(this,null,function*(){if(!this.scene)return;const s=this.scene.getBoundingBoxByIds(t);s&&(s.expandByVector(new k(1,1).multiplyScalar(r)),yield Jo(100),s.isEmpty()||(yield this.view.setByBox(s)))})}focusAtById(t,r=1e3){return _t(this,null,function*(){var s;return(s=this.view)==null?void 0:s.focusAtById(t,r)})}focusAtDummy(t,r=1e3){return _t(this,null,function*(){var s;return(s=this.view)==null?void 0:s.focusAtDummy(t,r)})}showAssetsLabel(t,r,s){var o,u,h,c;r?t==="dummy"?(h=(u=(o=this.view)==null?void 0:o.dummiesController)==null?void 0:u.dummies)==null||h.showDummyLabel(r):(c=this.view)==null||c.showAssetsLabel(t,r,s):this.hideAssetsLabel()}hideAssetsLabel(){var t,r,s,o;(s=(r=(t=this.view)==null?void 0:t.dummiesController)==null?void 0:r.dummies)==null||s.hideDummyLabel(),(o=this.view)==null||o.hideAssetsLabel()}highlightAssets(t,r){var s;(s=this.scene)==null||s.highlightAssets(t,r)}resetHighlightAssets(t){var r;(r=this.scene)==null||r.resetHighlightAssets(t)}fontZoomIn(){var t;(t=this.scene)==null||t.chef.fontZoom("asset-labels",1.1)}fontZoomOut(){var t;(t=this.scene)==null||t.chef.fontZoom("asset-labels",.9)}zoomToSelectEnableChanged(t){this.view.zoomToSelectEnableChanged(t)}selectEnableChanged(t){this.selectEnable=!!t,this.view.selectEnableChanged(t)}multiSelectEnableChanged(t){this.multiSelectEnable=!!t,this.view.multiSelectEnableChanged(t)}socialDistanceEnableChanged(t){var r;(r=this.scene)==null||r.socialDistanceEnableChanged(t)}fnEnableChanged(t){this.fnEnable=!!t,this.view.fnEnableChanged(t)}getBoundingBoxById(t,r=!0){var o;if(!t)return;const s=(o=this.scene)==null?void 0:o.getBoundingBoxById(t);return s&&r&&s.applyMatrix3(this.view.camera.viewMatrix).round(),s}setDummies(t){var r;(r=this.view)==null||r.setDummies(t)}clearDummies(t){var r;(r=this.view)==null||r.clearDummies(t)}highlightDummies(t){var r,s;(s=(r=this.view)==null?void 0:r.dummiesController)==null||s.highlightDummies(t)}resetHighlightDummies(){var t,r;(r=(t=this.view)==null?void 0:t.dummiesController)==null||r.resetHighlightDummies()}bindAssetsEvents(){var t,r;this.view.addEventListener(zn.POINTEROVER,this.pointerOverHandler),this.view.addEventListener(zn.POINTERLEAVE,this.pointerLeaveHandler),this.view.addEventListener(zn.SELECTED,this.multiSelectorSelectedHandler),(r=(t=this.view)==null?void 0:t.dummiesController)==null||r.addEventListener("panend",this.dragEndHandler)}unbindAssetsEvents(){var t,r;this.view.removeEventListener(zn.POINTEROVER,this.pointerOverHandler),this.view.removeEventListener(zn.POINTERLEAVE,this.pointerLeaveHandler),this.view.removeEventListener(zn.SELECTED,this.multiSelectorSelectedHandler),(r=(t=this.view)==null?void 0:t.dummiesController)==null||r.removeEventListener("panend",this.dragEndHandler)}handleMultiSelectorSelected(t){this.dispatchEvent({type:"SELECTED",data:t.data})}handlePointerOver(t){this.dispatchEvent({type:"pointerover",data:t.data,e:t.e})}handlePointerLeave(t){this.dispatchEvent({type:"pointerleave",data:t.data,e:t.e})}handleInitializeStart(){console.log("App.initializeStart ...")}handleInitializeComplete(t){return _t(this,null,function*(){console.log("App.initializeComplete ...",t),t!=null&&t.data&&this.launch()})}handleDragEnd(t){this.dispatchEvent(t)}launch(){console.log("App.launch ...")}}const Jl=new Ot;var Og=(i=>(i.SELECTED="SELECTED",i.POINTEROVER="pointerover",i.POINTERLEAVE="pointerleave",i.DRAG_END="panend",i))(Og||{}),Lt=(i=>(i.INIT="init",i.LOAD="load",i.LOADED="loaded",i.GET_LAYERS="getLayers",i.GET_ASSET_IDS_BY_TYPE="getAssetIdsByType",i.SET_FILL_BY_IDS="setFillByIds",i.CLEAR_FILL="clearFill",i.SET_STROKE_BY_IDS="setStrokeByIds",i.CLEAR_STROKE="clearStroke",i.TERMINATE="terminate",i.CAMERA_SYNC="cameraSync",i.ASSET_TYPE_CHANGED="assetTypeChanged",i.SVG_LOADING_TYPE_CHANGED="svgLoadingTypeChanged",i.USED_CACHE_CHANGED="usedCacheChanged",i.DEBOUNCE_CACHE_CHANGED="debounceCacheChanged",i.WIREFRAME_CHANGED="wireframeChanged",i.BG_PASS_CHANGED="bgPass",i.SELECT_ENABLE_CHANGED="selectEnableChanged",i.MULTI_SELECT_ENABLE_CHANGED="multiSelectEnableChanged",i.MULTI_SELECT_BY_RANGE="multiSelectByRange",i.ZOOM_TO_SELECT_ENABLE_CHANGED="zoomToSelectEnableChanged",i.FONT_ZOOM_IN="fontZoomIn",i.FONT_ZOOM_OUT="fontZoomOut",i.CAMERA_CHANGED="cameraChanged",i.SCENES_CHANGED="scenesChanged",i.UPDATE_LAYERS_VISIBILITY="updateLayersVisibility",i.DYNAMIC_LOADED="dynamicLoaded",i.SYNC_TEXTURE_HELPER_CACHED="syncTextureHelperCached",i.INITIALIZATION_START="INITIALIZATION_START",i.INITIALIZATION_COMPLETE="INITIALIZATION_COMPLETE",i.SELECTED="selected",i.SELECT_BY_IDS="selectByIds",i.CLEAR_SELECTED="clearSelected",i.TARGET_BY_IDS="targetByIds",i.TAP="tap",i.SINGLE_TAP="singletap",i.DOUBLE_TAP="doubletap",i.PRESS="press",i.PAN="pan",i.PAN_START="panstart",i.PAN_MOVE="panmove",i.PAN_END="panend",i.ROTATE="rotate",i.ROTATE_START="rotatestart",i.ROTATE_MOVE="rotatemove",i.ROTATE_END="rotateend",i.PINCH="pinch",i.PINCH_START="pinchstart",i.PINCH_MOVE="pinchmove",i.PINCH_END="pinchend",i.PINCH_IN="pinchin",i.PINCH_OUT="pinchout",i.SWIPE="swipe",i))(Lt||{});class zb extends Ub{constructor(t={}){super(t);p(this,"name","OpeView");p(this,"container");p(this,"graph");p(this,"zoomToSelectEnable");p(this,"multiSelectEnable");p(this,"rayCaster",new ag);p(this,"intersects",[]);p(this,"controllerPanStartHandler",this.handlePanStart.bind(this));p(this,"controllerPanEndHandler",this.handlePanEnd.bind(this));p(this,"controllerPanMoveHandler",this.handleControllerPanMove.bind(this));p(this,"controllerPointerOverHandler",this.handleControllerPointerOver.bind(this));this.container=this.params.cvs?this.params.cvs:this.params.canvasId?document.getElementById(this.params.canvasId):Vt.window.document.getElementsByTagName("body")[0],console.warn("opeView.constructor: ",this.container,this.container.tagName),this.controller=new ng(this.container,this.camera),this.bindControllerEvents();let r=this.container.tagName.toLowerCase()!=="body"?this.container.parentNode:this.container;this.graph=new Sh(r)}destroy(){this.unbindControllerEvents(),this.controller&&this.controller.destroy(),super.destroy()}zoomToSelectEnableChanged(t=!1){this.zoomToSelectEnable=t,this.controller.enablePan=!this.zoomToSelectEnable}multiSelectEnableChanged(t=!1){this.multiSelectEnable=t,this.controller.enablePan=!this.multiSelectEnable}bindControllerEvents(){this.controller.addEventListener(lt.PAN_START,this.controllerPanStartHandler),this.controller.addEventListener(lt.PAN_END,this.controllerPanEndHandler),this.controller.addEventListener(lt.PAN_MOVE,this.controllerPanMoveHandler),this.controller.addEventListener(lt.POINTEROVER,this.controllerPointerOverHandler)}unbindControllerEvents(){this.controller.removeEventListener(lt.PAN_START,this.controllerPanStartHandler),this.controller.removeEventListener(lt.PAN_END,this.controllerPanEndHandler),this.controller.removeEventListener(lt.PAN_MOVE,this.controllerPanMoveHandler),this.controller.removeEventListener(lt.POINTEROVER,this.controllerPointerOverHandler)}handlePanStart(t){(t==null?void 0:t.type)!==lt.PAN_START&&(t==null?void 0:t.type)!==lt.WHEEL_START||(this.zoomToSelectEnable||this.multiSelectEnable)&&(Zo.copy(t.data.screenCoords),dn.makeEmpty().expandByPoint(Zo),this.graph.draw(dn))}handlePanEnd(t){return _t(this,null,function*(){(t==null?void 0:t.type)!==lt.PAN_END&&(t==null?void 0:t.type)!==lt.WHEEL_END||((this.zoomToSelectEnable||this.multiSelectEnable)&&(Qo.copy(t.data.screenCoords),dn.makeEmpty().expandByPoint(Zo).expandByPoint(Qo).unproject(this.controller.camera),this.graph.hide()),this.zoomToSelectEnable&&(yield this.resetCameraByBoundingBox(dn,!0)),this.multiSelectEnable&&this.dispatchEvent({type:Lt.MULTI_SELECT_BY_RANGE,data:dn.clone()}),dn.makeEmpty())})}handleControllerPanMove(t){(t==null?void 0:t.type)===lt.PAN_MOVE&&(this.zoomToSelectEnable||this.multiSelectEnable)&&(Qo.copy(t.data.screenCoords),dn.makeEmpty().expandByPoint(Zo).expandByPoint(Qo),this.graph.draw(dn))}handleControllerPointerOver(t){t==null||t.type,lt.POINTEROVER}handleMultiSelectorSelected(t){}handleCameraChanged(t){console.warn("handleCameraChanged: ",t.target.camera.position.z,t.target.camera.scaled.x)}}const Zo=new k,Qo=new k,dn=new Ot;function rd(i){return!!(i&&i.constructor&&i.call&&i.apply)}const $b="children",Gb="get",Yb="set",th="Changed";class Xb extends ar{constructor(t){super();p(this,"name","Node2");p(this,"userData",{});p(this,"_cache",new Map);p(this,"_attachedDepsListeners",new Map);this.setAttrs(t)}destroy(){super.destroy(),this._clearCache()}setAttrs(t){if(!t)return this;let r;for(const s in t)s!==$b&&(r=Yb+s,rd(this[r])?this[r](t[s]):this.setAttr(s,t[s]));return this}setAttr(t,r){Object.hasOwnProperty.call(this,t)&&(this.userData[t]=r,this[t]=r)}getAttrs(){return this.userData||{}}getAttr(t){const r=Gb+It.capitalize(t);return rd(this[r])?this[r]():this.userData[t]}getAttrKey(){return Object.values(this.userData).filter(t=>!(t instanceof Array||t instanceof Object)).join("_")}_getCache(t,r){let s=this._cache.get(t);return(s===void 0||s.dirty===!0)&&(s=r.call(this),this._cache.set(t,s)),s}_clearCache(t){t===void 0?this._cache.clear():this._cache.has(t)&&this._cache.get(t).isMatrix3?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_setProperty(t){Object.hasOwnProperty.call(this,t)&&delete this[t],Object.defineProperty(this,t,{get(){return this.userData[t]},set(r){const s=this.userData[t];this.userData[t]=r,s!==r&&this.dispatchEvent({type:t+th,data:{oldVal:s,newVal:r}})},enumerable:!0,configurable:!0})}computed(t,r,s){if(!this._attachedDepsListeners.get(t)){const o=r.map(u=>u+th).join(",");this.addEventListeners(o,()=>this._clearCache(t)),r.forEach(u=>this._setProperty(u)),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,s)}watch(t,r){(t||[]).forEach(s=>{this._setProperty(s),this.addEventListener(s+th,r)})}}const Gr=new k;class Zb extends Xb{constructor(t={}){super(t);p(this,"isTexture",!0);p(this,"isRenderTargetTexture",!1);p(this,"type","Texture");p(this,"name","Texture");p(this,"uuid",Wd());p(this,"originSize",new k);p(this,"originCenter",new k);p(this,"size",new k);p(this,"matrix",new pe);p(this,"matrixAutoUpdate",!0);p(this,"userData",{});p(this,"version",0);p(this,"_needsUpdate",!1);p(this,"image");p(this,"offset",new k);p(this,"repeat",new k(1,1));p(this,"center",new k);p(this,"rotate",0);p(this,"scale",1);p(this,"flipY",!0);this.setAttrs(t)}destroy(){super.destroy()}set needsUpdate(t){t&&(this.version++,this._needsUpdate=!0)}get needsUpdate(){return this._needsUpdate}updateSize(t,r,s,o){return this.originSize.copy(t),this.originCenter.copy(r),this.flipY&&this.originCenter.multiplyScalar(1,-1),this.updateFinalSize(s,o)}updateFinalSize(t,r){t&&!k.isZero(t)&&!k.isEmpty(t)?Gr.copy(t):Gr.copy(this.originSize),Gr.maxXY(1,1);const s=Math.sqrt(Gr.x*Gr.x+Gr.y*Gr.y)/Math.sqrt(r.x*r.x+r.y*r.y);return s>1&&Gr.multiplyScalar(1/s),this.scale=Gr.length()/this.originSize.length(),this.repeat.multiplyScalar(this.originSize.length()/Gr.length()),this.size.copy(Gr),this.offset.copy(this.originSize).multiplyScalar(-.5).add(this.originCenter),this.updateMatrix(),this}reset(t,r){t&&this.originSize.copy(t),r&&this.size.copy(r),this.scale=this.size.x/this.originSize.x,this.repeat.set(1,1),this.center.set(0,0),this.rotate=0,this.offset.copy(this.originSize).multiplyScalar(.5).sub(this.originCenter).multiplyScalar(this.scale),this.updateMatrix()}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotate,this.center.x,this.center.y)}clone(){const t=this.constructor;return new t(this.attrs).copy(this)}copy(t){return this.name=t.name,this.originSize.copy(t.originSize),this.originCenter.copy(t.originCenter),this.size.copy(t.size),this.matrix.copy(t.matrix),this.matrixAutoUpdate=t.matrixAutoUpdate,this.userData=JSON.parse(JSON.stringify(t.userData)),this.image=t.image,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotate=t.rotate,this.scale=t.scale,this.flipY=t.flipY,this}}const Je=class Je{static destroy(){Object.values(this.cached).forEach(e=>{e.destroy()}),this.cached=new Map}static has(e){return this.cached.has(e)}static get(e,t){if(e)return!this.precisionOptimized||!t?this.cached.get(e):t&&t<this.precisionOptimizeLevels[2]?this.get(e+"_3"):t&&t<this.precisionOptimizeLevels[1]?this.get(e+"_2"):t&&t<this.precisionOptimizeLevels[0]?this.get(e+"_1"):this.get(e)}static set(e,t){if(!e||!t)throw new Error("error input");return this.cached.set(e,t),t}static remove(e){if(!e||!this.cached.has(e))return;const t=this.cached.get(e);if(t&&t.destroy(),this.cached.delete(e),this.precisionOptimized)for(let r=1,s=this.precisionOptimizeLevels.length;r<=s;r++){const o=e+"_"+r;let u;this.cached.has(o)&&(u=this.cached.get(o),u&&u.destroy(),this.cached.delete(o))}}static clear(){this.destroy()}static setTextureMaxSize(){this.initialized||(this.textureMaxSize.set(Vt.config.width,Vt.config.height).multiplyScalar(.5).round(),this.initialized=!0)}static getTextureMaxSize(){return this.initialized||this.setTextureMaxSize(),this.textureMaxSize}static getTextureByShape(e,t,r,s){var u;const o=new Zb;if(this.setTextureMaxSize(),o.scale=1,o.repeat.set(1,1),o.rotate=0,o.image=void 0,o.version=0,console.warn("getTextureByShape: ============================",e.name),t&&!k.isZero(t)&&!k.isEmpty(t))Ea.copy(t),e.alignCenter?e.boundingBox.getCenter(Aa):Aa.set(0,0);else{if(e.isShape&&((u=e.geometry)!=null&&u.boundingBox))jo.copy(e.geometry.boundingBox);else if(e.boundingBox)jo.copy(e.boundingBox);else throw new Error("get boundingBox error");jo.getSize(Ea),e.alignCenter?e.boundingBox.getCenter(Aa):jo.getCenter(Aa)}return r&&!k.isZero(r)&&!k.isEmpty(r)?Fi.copy(r):Fi.copy(Ea),(Fi.x<id.x||Fi.y<id.y)&&Fi.normalize().multiplyScalar(10).round(),li.copy(this.getTextureMaxSize()),s&&(wa.set((s==null?void 0:s.shadowBlur)||0,(s==null?void 0:s.shadowBlur)||0),Fi.add(wa.clone().multiplyScalar(2)),Ea.multiplyScalar(3),li.multiplyScalar(.3)),o.updateSize(Ea,Aa,Fi,li),o}static setPrecisionOptimizeTextures(e,t,r,s,o){if(!this.precisionOptimized)return;let u;for(let h=0,c=this.precisionOptimizeLevels.length;h<c;h++){li.copy(r.size).multiplyScalar(this.precisionOptimizeLevels[h]);const y=this.getTextureByShape(t,s,li,o);this.renderShapeTexture(t,y,o),u=e+"_"+(h+1),y.userData.textureKey=u,Je.set(u,y)}}static renderShapeTexture(e,t,r){r?(wa.set(r.shadowBlur||0,r.shadowBlur||0),ui.copy(t.originSize).multiplyScalar(-.5).sub(t.originCenter).multiplyScalar(t.scale),e.alignCenter?Ko.copy(t.originSize).multiplyScalar(t.scale):Ko.copy(t.originSize).add(wa.clone().multiplyScalar(1)).multiplyScalar(t.scale)):ui.copy(t.offset).negate().multiplyScalar(t.scale);const s=Yr.create(t.size.x,t.size.y),o=Yr.getContext2D(s,{alpha:!0});if(e.isText||!e.matrix.hasChange())o.clearRect(0,0,s.width,s.height),o.translate(ui.x,ui.y),o.scale(t.scale,-t.scale);else{e.matrix.decompose(nd,Qb,sd);const u=1/sd.x;ui.sub(nd.multiplyScalar(u,-u)),o.clearRect(0,0,s.width,s.height),o.translate(ui.x,ui.y),o.scale(u,-u)}r&&(o.shadowColor=Qt.black,o.shadowOffsetX=Ko.x,o.shadowOffsetY=Ko.y,o.shadowBlur=wa.x),e.render(o),t.image=s}static setByShape(e,t,r,s){const o=this.getTextureByShape(t,r,s);return o.userData.textureKey=e,this.renderShapeTexture(t,o),Je.set(e,o),t.featureKey=e,o}static setShadowByShape(e,t,r){const s=this.getTextureByShape(t,void 0,void 0,r);return s.userData.textureKey=e,this.renderShapeTexture(t,s,r),Je.set(e,s),s}static setPointsByShape(e,t){var y,g,A,_,D;const r=[];t.isGroup?t.traverse(B=>B.isShape?r.push(...B.geometry.points):void 0):t.isShape&&t.geometry.points?r.push(...t.geometry.points):t.boundingBox&&r.push(t.boundingBox.min,t.boundingBox.max);const s=this.getTextureByShape(t),o=((y=t.material)==null?void 0:y.lineWidth)*2||3;ki.set(1,1).multiplyScalar(o),s.size.copy(ki).multiplyScalar(s.scale).multiplyScalar(2).add(Fi),s.offset.sub(ki),s.updateMatrix();const u=Yr.create(s.size.x,s.size.y),h=Yr.getContext2D(u,{alpha:!0});ui.subVectors(s.originSize.clone().multiplyScalar(.5),s.originCenter).add(ki),h.clearRect(0,0,u.width,u.height),h.scale(s.scale,s.scale),h.translate(ui.x,ui.y);let c=Qt.black;t.material?c=((g=t.material)==null?void 0:g.stroke)||((A=t.material)==null?void 0:A.fill):t.isGroup&&t.children.length&&t.children[0].isShape&&(c=((_=t.children[0].material)==null?void 0:_.stroke)||((D=t.children[0].material)==null?void 0:D.fill)),h.fillStyle=Yt.getDarken(c);for(let B=0,L=r.length||0;B<L;B++)li.copy(r[B]),h.moveTo(li.x,li.y),h.arc(li.x,li.y,ki.x,0,Math.PI*2);return h.fill(),s.image=u,Je.set(e,s),s}static setWireframeByShape(e,t){var h;const r=this.getTextureByShape(t);ki.set(1,1).multiplyScalar(((h=t.mat)==null?void 0:h.lineWidth)||1),r.size.copy(ki).multiplyScalar(r.scale).multiplyScalar(2).add(Fi),r.offset.sub(ki),r.updateMatrix();const s=Yr.create(r.size.x,r.size.y),o=Yr.getContext2D(s,{alpha:!0}),u=ki.x*r.scale*5;return o.clearRect(0,0,s.width,s.height),o.strokeStyle=Qt.darkGray,o.lineWidth=u,o.setLineDash([u*3,u]),o.strokeRect(0,0,r.size.x,r.size.y),r.image=s,Je.set(e,r),r}};p(Je,"cached",new Map),p(Je,"precisionOptimized",!0),p(Je,"precisionOptimizeLevels",[.5,.25,1e-4]),p(Je,"initialized",!1),p(Je,"textureMaxSize",new k),p(Je,"DEBUG_DisplayCachedTexture",It.throttle((e=80,t=.8)=>{let r=Kb();if(r||(r=jb(e,t)),!r)throw new Error("dom not found");Jb(r,Je.cached)},5e3));let cu=Je;const id=new k(10,10),Ea=new k,Aa=new k,Fi=new k,ui=new k,Ko=new k,wa=new k,li=new k,ki=new k,jo=new Ot,nd=new k,Qb=new k,sd=new k;function Kb(){return window.document.getElementById("DEBUG_Displaycached")}function jb(i=80,e=.8){const t=document.createElement("div");function r(){t.style.opacity="1"}function s(){t.style.opacity=e.toString()}return t.setAttribute("id","DEBUG_Displaycached"),t.style.position="absolute",t.style.width=i+"px",t.style.height="92vh",t.style.background=`rgba(255, 255, 255, ${e})`,t.style.left="20px",t.style.top="20px",t.style.overflow="auto",t.style.padding="6px",t.style.opacity=e.toString(),t.addEventListener("mouseenter",r),t.addEventListener("mouseleave",s),document.body.appendChild(t),t}function Jb(i,e){e.forEach((t,r)=>{!t||!t.image||tT(i,r,t)})}function tT(i,e,t){let r;for(let s=0,o=i.childNodes.length;s<o;s++)if(i.childNodes[s].getAttribute("id")===e){r=i.childNodes[s];break}r?rT(r,t):eT(i,e,t)}function eT(i,e,t){if(!t.image)return;const r=Vt.document.createElement("div");r.setAttribute("id",e),r.style.display="flex",r.style.flexDirection="column";const s=Yr.createCanvas({containerId:i.id,width:t.image.width,height:t.image.height,dpr:window.devicePixelRatio});s.style.border=`${Qt.yellow} 1px solid`,s.style.maxWidth=parseInt(i.style.width)-2+"px",s.style.maxHeight=parseInt(s.style.maxWidth)/(t.image.width/t.image.height)+"px";const o=s.getContext("2d",{alpha:!0});if(!o)throw new Error("getContext error");o.save(),o.scale(window.devicePixelRatio,window.devicePixelRatio),o.drawImage(t.image,0,0),o.restore(),r.appendChild(s);const u=Vt.document.createElement("p");u.innerHTML=t.image.width+" * "+t.image.height,u.innerHTML+="<br/>"+e,u.style.margin="0",u.style.padding="0",u.style.lineHeight="1.2",u.style.fontSize="10px",u.style.padding="3px 0 6px 0",u.style.color=Qt.black,r.appendChild(u),i.appendChild(r);function h(){const c=s.toDataURL("image/png",.6),y=document.createElement("a"),g=new MouseEvent("click");y.download=`thumb.${Date.now()}.png`,y.href=c,y.dispatchEvent(g)}r.addEventListener("click",h)}function rT(i,e){if(!e.image)return;const t=i.querySelector("canvas");if(!t)return;const r=t.getContext("2d",{alpha:!0});if(!r)throw new Error("getContext error");r.clearRect(0,0,t.width,t.height),r.save(),r.scale(window.devicePixelRatio,window.devicePixelRatio),r.drawImage(e.image,0,0),r.restore()}class iT extends ar{constructor(t={},r){super();p(this,"cvs");p(this,"worker");p(this,"view");p(this,"boundingBox",new Ot);p(this,"viewTapHandler",this.handleViewTap.bind(this));p(this,"multiSelectByRangeHandler",this.handleMultiSelectByRange.bind(this));p(this,"workerMessageHandler",this.handleWorkerMessage.bind(this));p(this,"cameraHandler",this.handleCameraChanged.bind(this));p(this,"runningHandler",this.running.bind(this));t.workerRender=!0,this.params=t,Vt.config=t;const s=Yr.createCanvas(t);if(!s.transferControlToOffscreen)throw new Error("not support transferControlToOffscreen");this.cvs=s.transferControlToOffscreen(),this.view=new zb(t),this.view.camera.name="mainCamera",this.view.camera.resize(),this.worker=r,this.bindEvents()}destroy(){super.destroy(),this.unbindEvents(),this.worker.postMessage({task:Lt.TERMINATE}),this.worker.terminate()}bindEvents(){var t,r,s,o,u;(r=(t=this.view)==null?void 0:t.controller)==null||r.addEventListener(lt.TAP,this.viewTapHandler),(s=this.view)==null||s.addEventListener(Lt.MULTI_SELECT_BY_RANGE,this.multiSelectByRangeHandler),(u=(o=this.view)==null?void 0:o.camera)==null||u.addEventListener(ou.UPDATE,this.cameraHandler),this.worker.addEventListener("message",this.workerMessageHandler)}unbindEvents(){var t,r,s,o;(r=(t=this.view)==null?void 0:t.controller)==null||r.removeEventListener(lt.TAP,this.viewTapHandler),(o=(s=this.view)==null?void 0:s.controller)==null||o.removeEventListener(lt.CAMERA_CHANGED,this.cameraHandler),this.worker.removeEventListener("message",this.workerMessageHandler)}handleViewTap(t){return _t(this,null,function*(){if((t==null?void 0:t.type)!==lt.TAP)return;const r=yield this.promiseWorkerResponse(Lt.TAP,t.data);this.dispatchEvent({type:Lt.SELECTED,data:r})})}handleWorkerMessage(t){var r,s,o,u,h,c;switch(t.data.task){case Lt.CAMERA_SYNC:if(!((r=t==null?void 0:t.data)!=null&&r.data))break;const y=JSON.parse(t.data.data);(o=(s=this.view)==null?void 0:s.camera)==null||o.fromJSON(y),this.view.camera.computeBoundingBox();break;case Lt.CAMERA_CHANGED:const{t:g,r:A,s:_}=t.data.data;(h=(u=this.view)==null?void 0:u.camera)==null||h.setTRS(g,A,_);break;case Lt.SCENES_CHANGED:const{box:D}=t.data.data;if(!D)return;this.boundingBox.fromString(D);break;case"syncTextureHelperCached":(((c=t.data)==null?void 0:c.data)||[]).forEach((B,L)=>cu.set(L,B));break;case"pong":console.log("response: pong");break}}handleCameraChanged(t){this.worker.postMessage({task:Lt.CAMERA_CHANGED,data:t.data})}promiseWorkerResponse(t,r){return new Promise((s,o)=>{const u=c=>{var y;((y=c==null?void 0:c.data)==null?void 0:y.task)===t&&(this.worker.removeEventListener("message",u),this.worker.removeEventListener("error",h),s(c.data.data))},h=c=>{this.worker.removeEventListener("message",u),this.worker.removeEventListener("error",h),o(c.error)};this.worker.addEventListener("message",u),this.worker.addEventListener("error",h),this.worker.postMessage({task:t,data:r})})}handleMultiSelectByRange(t){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.MULTI_SELECT_BY_RANGE,t.data)})}resize(){var t;(t=this.view.camera)==null||t.resize()}load(t,r){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.LOAD,{url:t,layers:r})})}getLayers(t=2){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.GET_LAYERS,{lv:t})})}assetTypeChanged(t=er.RM){this.params.assetType=t,this.worker.postMessage({task:Lt.ASSET_TYPE_CHANGED,data:t})}usedCacheChanged(t=!1){this.params.usedCache=t,this.worker.postMessage({task:Lt.USED_CACHE_CHANGED,data:t})}debounceCacheChanged(t=!1){this.params.debounceCache=t,this.worker.postMessage({task:Lt.DEBOUNCE_CACHE_CHANGED,data:t})}wireframeChanged(t=!1){this.params.wireframe=t,this.worker.postMessage({task:Lt.WIREFRAME_CHANGED,data:t})}bgPassChanged(t=!1){this.params.bgPass=t,this.worker.postMessage({task:Lt.BG_PASS_CHANGED,data:t})}selectEnableChanged(t=!1){return _t(this,null,function*(){yield this.clearSelected(),this.params.selectEnable=t,this.worker.postMessage({task:Lt.SELECT_ENABLE_CHANGED,data:t})})}multiSelectEnableChanged(t=!1){return _t(this,null,function*(){yield this.clearSelected(),this.params.multiSelectEnable=t,this.view.multiSelectEnableChanged(t),this.worker.postMessage({task:Lt.MULTI_SELECT_ENABLE_CHANGED,data:t})})}zoomToSelectEnableChanged(t=!1){return _t(this,null,function*(){return this.params.zoomToSelectEnable=t,this.view.zoomToSelectEnableChanged(t),this.promiseWorkerResponse(Lt.ZOOM_TO_SELECT_ENABLE_CHANGED,{data:t})})}svgLoadingTypeChanged(t){return _t(this,null,function*(){return this.params.svgLoadingType=t,this.promiseWorkerResponse(Lt.SVG_LOADING_TYPE_CHANGED,t)})}fullscreen(){return _t(this,null,function*(){yield this.view.resetCameraByBoundingBox(this.boundingBox,!0)})}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}updateLayersVisibility(t,r=!1){this.worker.postMessage({task:Lt.UPDATE_LAYERS_VISIBILITY,data:{ids:t,visible:r}})}clearSelected(t){return this.promiseWorkerResponse(Lt.CLEAR_SELECTED,{data:t})}selectByIds(t){this.worker.postMessage({task:Lt.SELECT_BY_IDS,data:t})}targetByIds(t){this.worker.postMessage({task:Lt.TARGET_BY_IDS,data:t})}getAssetIdsByType(t){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.GET_ASSET_IDS_BY_TYPE,{assetType:t})})}setFillByIds(t,r){this.worker.postMessage({task:Lt.SET_FILL_BY_IDS,data:{ids:t,c:r}})}clearFill(){this.worker.postMessage({task:Lt.CLEAR_FILL})}setStrokeByIds(t,r){this.worker.postMessage({task:Lt.SET_STROKE_BY_IDS,data:{ids:t,c:r}})}clearStroke(){this.worker.postMessage({task:Lt.CLEAR_STROKE})}fontZoomIn(t=1.1){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.FONT_ZOOM_IN,t)})}fontZoomOut(t=.9){return _t(this,null,function*(){return this.promiseWorkerResponse(Lt.FONT_ZOOM_OUT,t)})}start(){const t=this.cvs,r=JSON.stringify(this.params);this.worker.postMessage({task:Lt.INIT,data:{cvs:t,config:r}},[t]),requestAnimationFrame(this.runningHandler)}running(t){var r;(r=this.view)==null||r.update(t),requestAnimationFrame(this.runningHandler),cu.DEBUG_DisplayCachedTexture()}stop(){}}function nT(i){return new Worker("/environment.worker.js",{type:"module",name:i==null?void 0:i.name})}function sT(i){return new Worker("/renderer.worker.js",{type:"module",name:i==null?void 0:i.name})}exports.AppEnum=Og;exports.AppOffscreen=iT;exports.AssetTypeEnum=er;exports.Box2=xE;exports.Color=Yt;exports.ColorsEnum=Qt;exports.EnvironmentWorker=nT;exports.GLOB=Vt;exports.LayerTypeEnum=Ua;exports.Monitor=Ms;exports.RendererWorker=sT;exports.SvgApp=Vb;exports.Vector2=mE;exports.assetTypeConflicts=Hd;exports.defaultConfig=ad;exports.getAssetLabelByType=ba;exports.getAssetLayerByType=Cs;exports.randomDelay=Jo;