archgine 1.0.58 → 1.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4010,7 +4010,7 @@ Fu.__DOMHandler = Eu;
4010
4010
  Fu.normalizeLineEndings = Le;
4011
4011
  Fu.DOMParser = Ie;
4012
4012
  var gr = Fu.DOMParser;
4013
- const Er = "1.0.58";
4013
+ const Er = "1.0.59";
4014
4014
  function vr() {
4015
4015
  return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
4016
4016
  }
@@ -7,6 +7,7 @@ export interface IApp {
7
7
  destroy(): void;
8
8
  resize(): void;
9
9
  start(): void;
10
+ setRequestHeader(requestHeader: any): IApp;
10
11
  load(url: string, layers?: string[], lv?: number, skeletons?: string[]): any;
11
12
  loadByString(str: string, layers?: string[], lv?: number): ITree[];
12
13
  setSkeletons(skeletons: string[]): void;
@@ -27,6 +27,7 @@ export declare class SvgApp<Config extends ISvgAppConfig> extends EventDispatche
27
27
  zoomBox: Box2;
28
28
  selectEnable: boolean;
29
29
  multiSelectEnable: boolean;
30
+ requestHeader: any;
30
31
  private readonly runningHandler;
31
32
  private readonly pointerOverHandler;
32
33
  private readonly pointerLeaveHandler;
@@ -43,7 +44,8 @@ export declare class SvgApp<Config extends ISvgAppConfig> extends EventDispatche
43
44
  start(): void;
44
45
  /** @description application's lifeCycle */
45
46
  running(time: DOMHighResTimeStamp): void;
46
- load(url: string, reqHeader?: any, layers?: string[], lv?: number, skeletons?: string[]): Promise<ITree[]>;
47
+ setRequestHeader(requestHeader: any): IApp;
48
+ load(url: string, layers?: string[], lv?: number, skeletons?: string[]): Promise<ITree[]>;
47
49
  loadByString(str: string, layers?: string[], lv?: number): ITree[];
48
50
  setSkeletons(skeletons: string[]): void;
49
51
  getLayers(lv?: number): ITree[] | undefined;
package/lib/index.mjs CHANGED
@@ -4010,7 +4010,7 @@ uu.__DOMHandler = La;
4010
4010
  uu.normalizeLineEndings = Td;
4011
4011
  uu.DOMParser = _d;
4012
4012
  var Gx = uu.DOMParser;
4013
- const Yx = "1.0.58";
4013
+ const Yx = "1.0.59";
4014
4014
  function Xx() {
4015
4015
  return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
4016
4016
  }
@@ -17331,6 +17331,7 @@ class Wb extends rr {
17331
17331
  zoomBox = new Nt();
17332
17332
  selectEnable = !1;
17333
17333
  multiSelectEnable = !1;
17334
+ requestHeader = {};
17334
17335
  runningHandler = this.running.bind(this);
17335
17336
  pointerOverHandler = this.handlePointerOver.bind(this);
17336
17337
  pointerLeaveHandler = this.handlePointerLeave.bind(this);
@@ -17377,11 +17378,14 @@ class Wb extends rr {
17377
17378
  this.scene && (this.scene.update(), this.renderer.render(this.scene, this.view.camera), this.view.update(t), requestAnimationFrame(this.runningHandler));
17378
17379
  }
17379
17380
  // ======================= output business logic =======================
17381
+ setRequestHeader(t) {
17382
+ return this.requestHeader = t, this;
17383
+ }
17380
17384
  // @ts-ignore
17381
- async load(t, e = {}, i, a = 2, o) {
17385
+ async load(t, e, i = 2, a) {
17382
17386
  this.isLoadingScene || this.trans2LoadingScene(), await np(this.params.syncDelay);
17383
- const l = await new Bd().setRequestHeader(e).loadAsync(t);
17384
- return this.loadByString(l, i, a);
17387
+ const o = await new Bd().setRequestHeader(this.requestHeader).loadAsync(t);
17388
+ return this.loadByString(o, e, i);
17385
17389
  }
17386
17390
  loadByString(t, e, i = 2) {
17387
17391
  this.mainScene = new zd(this.params), this.mainScene.bind(t), this.view.setByBox(this.mainScene.viewBox);
package/lib/index.umd.js CHANGED
@@ -2,7 +2,7 @@
2
2
  `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),r.entityMap=r.HTML_ENTITIES})(cc);var Ou={},Vs=di.NAMESPACE,Nu=/[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]/,fc=new RegExp("[\\-\\.0-9"+Nu.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),pc=new RegExp("^"+Nu.source+fc.source+"*(?::"+Nu.source+fc.source+"*)?$"),zs=0,zi=1,Jn=2,$s=3,ts=4,es=5,Gs=6,Za=7;function rs(r,t){this.message=r,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,rs)}rs.prototype=new Error,rs.prototype.name=rs.name;function dc(){}dc.prototype={parse:function(r,t,e){var i=this.domBuilder;i.startDocument(),mc(t,t={}),Ug(r,t,e,i,this.errorHandler),i.endDocument()}};function Ug(r,t,e,i,a){function o(O){if(O>65535){O-=65536;var vt=55296+(O>>10),It=56320+(O&1023);return String.fromCharCode(vt,It)}else return String.fromCharCode(O)}function l(O){var vt=O.slice(1,-1);return Object.hasOwnProperty.call(e,vt)?e[vt]:vt.charAt(0)==="#"?o(parseInt(vt.substr(1).replace("x","0x"))):(a.error("entity not found:"+O),O)}function c(O){if(O>N){var vt=r.substring(N,O).replace(/&#?\w+;/g,l);T&&f(N),i.characters(vt,0,O-N),N=O}}function f(O,vt){for(;O>=g&&(vt=E.exec(r));)d=vt.index,g=d+vt[0].length,T.lineNumber++;T.columnNumber=O-d+1}for(var d=0,g=0,E=/.*(?:\r\n?|\n)|.*$/g,T=i.locator,C=[{currentNSMap:t}],L={},N=0;;){try{var M=r.indexOf("<",N);if(M<0){if(!r.substr(N).match(/^\s*$/)){var R=i.doc,W=R.createTextNode(r.substr(N));R.appendChild(W),i.currentElement=W}return}switch(M>N&&c(M),r.charAt(M+1)){case"/":var J=r.indexOf(">",M+3),G=r.substring(M+2,J).replace(/[ \t\n\r]+$/g,""),b=C.pop();J<0?(G=r.substring(M+2).replace(/[\s<].*/,""),a.error("end tag name: "+G+" is not complete:"+b.tagName),J=M+1+G.length):G.match(/\s</)&&(G=G.replace(/[\s<].*/,""),a.error("end tag name: "+G+" maybe not complete"),J=M+1+G.length);var P=b.localNSMap,q=b.tagName==G,K=q||b.tagName&&b.tagName.toLowerCase()==G.toLowerCase();if(K){if(i.endElement(b.uri,b.localName,G),P)for(var tt in P)Object.prototype.hasOwnProperty.call(P,tt)&&i.endPrefixMapping(tt);q||a.fatalError("end tag name: "+G+" is not match the current start tagName:"+b.tagName)}else C.push(b);J++;break;case"?":T&&f(M),J=$g(r,M,i);break;case"!":T&&f(M),J=zg(r,M,i,a);break;default:T&&f(M);var Z=new vc,rt=C[C.length-1].currentNSMap,J=qg(r,M,Z,rt,l,a),st=Z.length;if(!Z.closed&&Vg(r,J,Z.tagName,L)&&(Z.closed=!0,e.nbsp||a.warning("unclosed xml attribute")),T&&st){for(var ct=gc(T,{}),ft=0;ft<st;ft++){var pt=Z[ft];f(pt.offset),pt.locator=gc(T,{})}i.locator=ct,yc(Z,i,rt)&&C.push(Z),i.locator=T}else yc(Z,i,rt)&&C.push(Z);Vs.isHTML(Z.uri)&&!Z.closed?J=Wg(r,J,Z.tagName,l,i):J++}}catch(O){if(O instanceof rs)throw O;a.error("element parse error: "+O),J=-1}J>N?N=J:c(Math.max(M,N)+1)}}function gc(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function qg(r,t,e,i,a,o){function l(T,C,L){e.attributeNames.hasOwnProperty(T)&&o.fatalError("Attribute "+T+" redefined"),e.addValue(T,C.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,a),L)}for(var c,f,d=++t,g=zs;;){var E=r.charAt(d);switch(E){case"=":if(g===zi)c=r.slice(t,d),g=$s;else if(g===Jn)g=$s;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(g===$s||g===zi)if(g===zi&&(o.warning('attribute value must after "="'),c=r.slice(t,d)),t=d+1,d=r.indexOf(E,t),d>0)f=r.slice(t,d),l(c,f,t-1),g=es;else throw new Error("attribute value no end '"+E+"' match");else if(g==ts)f=r.slice(t,d),l(c,f,t),o.warning('attribute "'+c+'" missed start quot('+E+")!!"),t=d+1,g=es;else throw new Error('attribute value must after "="');break;case"/":switch(g){case zs:e.setTagName(r.slice(t,d));case es:case Gs:case Za:g=Za,e.closed=!0;case ts:case zi:break;case Jn:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),g==zs&&e.setTagName(r.slice(t,d)),d;case">":switch(g){case zs:e.setTagName(r.slice(t,d));case es:case Gs:case Za:break;case ts:case zi:f=r.slice(t,d),f.slice(-1)==="/"&&(e.closed=!0,f=f.slice(0,-1));case Jn:g===Jn&&(f=c),g==ts?(o.warning('attribute "'+f+'" missed quot(")!'),l(c,f,t)):((!Vs.isHTML(i[""])||!f.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+f+'" missed value!! "'+f+'" instead!!'),l(f,f,t));break;case $s:throw new Error("attribute value missed!!")}return d;case"€":E=" ";default:if(E<=" ")switch(g){case zs:e.setTagName(r.slice(t,d)),g=Gs;break;case zi:c=r.slice(t,d),g=Jn;break;case ts:var f=r.slice(t,d);o.warning('attribute "'+f+'" missed quot(")!!'),l(c,f,t);case es:g=Gs;break}else switch(g){case Jn:e.tagName,(!Vs.isHTML(i[""])||!c.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=d,g=zi;break;case es:o.warning('attribute space is required"'+c+'"!!');case Gs:g=zi,t=d;break;case $s:g=ts,t=d;break;case Za:throw new Error("elements closed character '/' and '>' must be connected to")}}d++}}function yc(r,t,e){for(var i=r.tagName,a=null,E=r.length;E--;){var o=r[E],l=o.qName,c=o.value,T=l.indexOf(":");if(T>0)var f=o.prefix=l.slice(0,T),d=l.slice(T+1),g=f==="xmlns"&&d;else d=l,f=null,g=l==="xmlns"&&"";o.localName=d,g!==!1&&(a==null&&(a={},mc(e,e={})),e[g]=a[g]=c,o.uri=Vs.XMLNS,t.startPrefixMapping(g,c))}for(var E=r.length;E--;){o=r[E];var f=o.prefix;f&&(f==="xml"&&(o.uri=Vs.XML),f!=="xmlns"&&(o.uri=e[f||""]))}var T=i.indexOf(":");T>0?(f=r.prefix=i.slice(0,T),d=r.localName=i.slice(T+1)):(f=null,d=r.localName=i);var C=r.uri=e[f||""];if(t.startElement(C,d,i,r),r.closed){if(t.endElement(C,d,i),a)for(f in a)Object.prototype.hasOwnProperty.call(a,f)&&t.endPrefixMapping(f)}else return r.currentNSMap=e,r.localNSMap=a,!0}function Wg(r,t,e,i,a){if(/^(?:script|textarea)$/i.test(e)){var o=r.indexOf("</"+e+">",t),l=r.substring(t+1,o);if(/[&<]/.test(l))return/^script$/i.test(e)?(a.characters(l,0,l.length),o):(l=l.replace(/&#?\w+;/g,i),a.characters(l,0,l.length),o)}return t+1}function Vg(r,t,e,i){var a=i[e];return a==null&&(a=r.lastIndexOf("</"+e+">"),a<t&&(a=r.lastIndexOf("</"+e)),i[e]=a),a<t}function mc(r,t){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}function zg(r,t,e,i){var a=r.charAt(t+2);switch(a){case"-":if(r.charAt(t+3)==="-"){var o=r.indexOf("-->",t+4);return o>t?(e.comment(r,t+4,o-t-4),o+3):(i.error("Unclosed comment"),-1)}else return-1;default:if(r.substr(t+3,6)=="CDATA["){var o=r.indexOf("]]>",t+9);return e.startCDATA(),e.characters(r,t+9,o-t-9),e.endCDATA(),o+3}var l=Gg(r,t),c=l.length;if(c>1&&/!doctype/i.test(l[0][0])){var f=l[1][0],d=!1,g=!1;c>3&&(/^public$/i.test(l[2][0])?(d=l[3][0],g=c>4&&l[4][0]):/^system$/i.test(l[2][0])&&(g=l[3][0]));var E=l[c-1];return e.startDTD(f,d,g),e.endDTD(),E.index+E[0].length}}return-1}function $g(r,t,e){var i=r.indexOf("?>",t);if(i){var a=r.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return a?(a[0].length,e.processingInstruction(a[1],a[2]),i+2):-1}return-1}function vc(){this.attributeNames={}}vc.prototype={setTagName:function(r){if(!pc.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!pc.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:t,offset:e}},length:0,getLocalName:function(r){return this[r].localName},getLocator:function(r){return this[r].locator},getQName:function(r){return this[r].qName},getURI:function(r){return this[r].uri},getValue:function(r){return this[r].value}};function Gg(r,t){var e,i=[],a=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(a.lastIndex=t,a.exec(r);e=a.exec(r);)if(i.push(e),e[1])return i}Ou.XMLReader=dc,Ou.ParseError=rs;var Yg=di,Xg=Vi,xc=cc,Ec=Ou,Zg=Xg.DOMImplementation,Ac=Yg.NAMESPACE,Qg=Ec.ParseError,Kg=Ec.XMLReader;function wc(r){return r.replace(/\r[\n\u0085]/g,`
3
3
  `).replace(/[\r\u0085\u2028]/g,`
4
4
  `)}function bc(r){this.options=r||{locator:{}}}bc.prototype.parseFromString=function(r,t){var e=this.options,i=new Kg,a=e.domBuilder||new Ys,o=e.errorHandler,l=e.locator,c=e.xmlns||{},f=/\/x?html?$/.test(t),d=f?xc.HTML_ENTITIES:xc.XML_ENTITIES;l&&a.setDocumentLocator(l),i.errorHandler=jg(o,a,l),i.domBuilder=e.domBuilder||a,f&&(c[""]=Ac.HTML),c.xml=c.xml||Ac.XML;var g=e.normalizeLineEndings||wc;return r&&typeof r=="string"?i.parse(g(r),c,d):i.errorHandler.error("invalid doc source"),a.doc};function jg(r,t,e){if(!r){if(t instanceof Ys)return t;r=t}var i={},a=r instanceof Function;e=e||{};function o(l){var c=r[l];!c&&a&&(c=r.length==2?function(f){r(l,f)}:r),i[l]=c&&function(f){c("[xmldom "+l+"] "+f+Mu(e))}||function(){}}return o("warning"),o("error"),o("fatalError"),i}function Ys(){this.cdata=!1}function is(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}Ys.prototype={startDocument:function(){this.doc=new Zg().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(r,t,e,i){var a=this.doc,o=a.createElementNS(r,e||t),l=i.length;Qa(this,o),this.currentElement=o,this.locator&&is(this.locator,o);for(var c=0;c<l;c++){var r=i.getURI(c),f=i.getValue(c),e=i.getQName(c),d=a.createAttributeNS(r,e);this.locator&&is(i.getLocator(c),d),d.value=d.nodeValue=f,o.setAttributeNode(d)}},endElement:function(r,t,e){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(r,t){},endPrefixMapping:function(r){},processingInstruction:function(r,t){var e=this.doc.createProcessingInstruction(r,t);this.locator&&is(this.locator,e),Qa(this,e)},ignorableWhitespace:function(r,t,e){},characters:function(r,t,e){if(r=Tc.apply(this,arguments),r){if(this.cdata)var i=this.doc.createCDATASection(r);else var i=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(r)&&this.doc.appendChild(i),this.locator&&is(this.locator,i)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){(this.locator=r)&&(r.lineNumber=0)},comment:function(r,t,e){r=Tc.apply(this,arguments);var i=this.doc.createComment(r);this.locator&&is(this.locator,i),Qa(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,t,e){var i=this.doc.implementation;if(i&&i.createDocumentType){var a=i.createDocumentType(r,t,e);this.locator&&is(this.locator,a),Qa(this,a),this.doc.doctype=a}},warning:function(r){console.warn("[xmldom warning] "+r,Mu(this.locator))},error:function(r){console.error("[xmldom error] "+r,Mu(this.locator))},fatalError:function(r){throw new Qg(r,this.locator)}};function Mu(r){if(r)return`
5
- @`+(r.systemId||"")+"#[line:"+r.lineNumber+",col:"+r.columnNumber+"]"}function Tc(r,t,e){return typeof r=="string"?r.substr(t,e):r.length>=t+e||t?new java.lang.String(r,t,e)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){Ys.prototype[r]=function(){return null}});function Qa(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}Xa.__DOMHandler=Ys,Xa.normalizeLineEndings=wc,Xa.DOMParser=bc;var Jg=Xa.DOMParser;const t0="1.0.58";function e0(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const ns=typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{document:void 0,tinyEngine:void 0};ns.Path2D||Ag(ns),ns.DOMParser||(ns.DOMParser=Jg);const kt={window:ns,version:t0,isBrowser:e0(),dpr:typeof window<"u"&&window.devicePixelRatio||1,document:ns.document,time:0,deltaTime:0,config:Zn},Xs=(r,t,e)=>Math.max(t,Math.min(e,r)),_c=(r,t=1e-6)=>Math.abs(r)<t?0:r<0?-1:1,r0=r=>r*(Math.PI/180),i0=(r,t)=>(r%t+t)%t,Bu=(r,t,e)=>(1-e)*r+e*t,n0=r=>{let t=r*(180/Math.PI);return t<0&&(t+=360),t>360&&(t-=360),t},$t={transparent:"rgba(1, 1, 1, 0)",green:"#45b787",darkGreen:"#314a43",blue:"#6e9bc5",darkBlue:"#2775b6",red:"#F26666",darkRed:"#D95970",brown:"#ECD2B9",darkBrown:"#BF9D8A",yellow:"#ECDEC0",darkYellow:"#D0AC57",lightGray:"#e0e0e0",gray:"#beb6b6",darkGray:"#918883",white:"#F2F2F2",darkWhite:"#ececec",lightBlack:"#2E3032",black:"#182327",blackAlpha5:"rgba(0, 0, 0, 0.5)"},s0={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},Rr={h:0,s:0,l:0},Ka={h:0,s:0,l:0};function Iu(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}const a0=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$|rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)|rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[\d.]+\s*\)/;class Wt{isColor=!0;r=1;g=1;b=1;a=1;constructor(t,e,i,a){return e===void 0&&i===void 0?this.set(t):this.setRGBA(t,e,i,a)}static isColor(t){return typeof t=="string"?a0.test(t):typeof t=="number"?t>=0&&t<=16777215:!1}static getRandomStyle(){return vi.random().getStyle()}static getDarken(t,e=.8){return vi.set(t).getHSL(ja),vi.setHSL(ja.h,ja.s,ja.l*e).getStyle()}static getLighten(t,e=1.2){return this.getDarken(t,e)}static getContrast(t){return vi.set(t),vi.getContrastString()}static getArray(t){return vi.set(t).toArray()}static getComplementary(t){return vi.set(t),vi.getComplementaryString()}static getMoreTransparent(t,e){return vi.set(t).setA(e).getStyle()}set(t){return t&&t.isColor?this.copy(t):typeof t=="number"?this.setHex(t):typeof t=="string"&&this.setStyle(t),this}random(){return this.setHex(Math.floor(Math.random()*(1<<24)))}setScalar(t){return this.r=t,this.g=t,this.b=t,this.a=1,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,this.a=1,this}setR(t){return this.r=t,this}setG(t){return this.g=t,this}setB(t){return this.b=t,this}setA(t){return this.a=t,this}setRGB(t,e,i){return this.setRGBA(t,e,i,this.a)}setRGBA(t,e,i,a=1){return this.r=t,this.g=e,this.b=i,this.a=a,this}setHSL(t,e,i,a=1){if(t=i0(t,1),e=Xs(e,0,1),i=Xs(i,0,1),e===0)this.r=this.g=this.b=i;else{const o=i<=.5?i*(1+e):i+e-i*e,l=2*i-o;this.r=Iu(l,o,t+1/3),this.g=Iu(l,o,t),this.b=Iu(l,o,t-1/3)}return this.a=a,this}setStyle(t){let e;if(e=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let i;const a=e[1],o=e[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,this.a=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,this.a=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const l=parseFloat(i[1])/360,c=parseInt(i[2],10)/100,f=parseInt(i[3],10)/100,d=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0);return this.setHSL(l,c,f,d)}break}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=e[1],a=i.length;if(a===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this.a=1,this;if(a===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this.a=1,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=s0[t.toLowerCase()];return e!==void 0?this.setHex(e):console.warn("Color: Unknown color "+t),this}clone(){return new Wt(this.r,this.g,this.b,this.a)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}getRGB(t=new Wt){return t.setRGB(this.r,this.g,this.b)}getRGBByBg(t=new Wt){const e=this.a,i=e*this.r+(1-e)*t.r,a=e*this.g+(1-e)*t.g,o=e*this.b+(1-e)*t.b;return new Wt(i,a,o)}getHex(){return Xs(this.r*255,0,255)<<16^Xs(this.g*255,0,255)<<8^Xs(this.b*255,0,255)<<0}getHSL(t){const e=this.r,i=this.g,a=this.b,o=Math.max(e,i,a),l=Math.min(e,i,a);let c=0,f;const d=(l+o)/2;if(l===o)c=0,f=0;else{const g=o-l;switch(f=d<=.5?g/(o+l):g/(2-o-l),o){case e:c=(i-a)/g+(i<a?6:0);break;case i:c=(a-e)/g+2;break;case a:c=(e-i)/g+4;break}c/=6}return t.h=c,t.s=f,t.l=d,t}getStyle(){return this.a===1?`rgb(${this.r*255|0},${this.g*255|0},${this.b*255|0})`:`rgba(${this.r*255|0},${this.g*255|0},${this.b*255|0},${this.a||1})`}getHexString(){return"#"+("000000"+this.getHex().toString(16)).slice(-6)}getBrightness(){let t=(this.r*255*299+this.g*255*587+this.b*255*144)/1e3;return t+=(255-t)*(255-this.a*255)/255,t}getContrastString(){return this.getBrightness()>125?"#2f2f2f":"#f2f2f2"}getComplementary(t=new Wt){const e=this.toArray(),i=[0,0,0,1];for(let a=0;a<e.length;a++)if(a<3)i[a]=1-e[a];else if(a===3)e[a]>1||e[a]<=0?i[a]=1:i[a]=Math.max(Math.min(parseFloat(e[a].toFixed(2)),1),0);else continue;return t.setRGBA(i[0],i[1],i[2],parseFloat(i[3].toFixed(2)))}getComplementaryString(){return this.getComplementary().getStyle()}getLightenOrDarken(t){if(typeof t>"u"||t>=1)return this.getHexString();const e=this.getRGBByBg(),i=e.r*t+(1-t),a=e.g*t+(1-t),o=e.b*t+(1-t);return new Wt(i,a,o).getHexString()}getNormalized(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.a,1),0).toFixed(2))]}getNormalized3(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2))]}offsetHSL(t,e,i){return this.getHSL(Rr),Rr.h+=t,Rr.s+=e,Rr.l+=i,this.setHSL(Rr.h,Rr.s,Rr.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Rr),t.getHSL(Ka);const i=Bu(Rr.h,Ka.h,e),a=Bu(Rr.s,Ka.s,e),o=Bu(Rr.l,Ka.l,e);return this.setHSL(i,a,o),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this.a=t[e+3],this}toArray(t=[0,0,0,0],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),t.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const vi=new Wt,ja={h:0,s:0,l:0};class F{isVector2=!0;x=0;y=0;z;constructor(t=0,e=0,i){this.x=t,this.y=e,this.z=i||0}static isZero(t){return t.x===0&&t.y===0}static isEmpty(t){return!Number.isFinite(t.x)&&!Number.isFinite(t.y)}static equals(t,e,i=!0){return i?t.x===e.x&&t.y===e.y:Math.abs(t.x-e.x)<Number.EPSILON&&Math.abs(t.y-e.y)<Number.EPSILON}static getInt32Array(t,e=2){const i=new ArrayBuffer(t.length*e*4),a=new Int32Array(i);for(let o=0,l=t.length;o<l;o++)a[o*2]=t[o].x,a[o*2+1]=t[o].y;return a}static getFloat64Array(t,e=2){const i=new ArrayBuffer(t.length*e*8),a=new Float64Array(i);for(let o=0,l=t.length;o<l;o++)a[o*2]=t[o].x,a[o*2+1]=t[o].y;return a}static getVectors(t){const e=[];for(let i=0,a=t.length;i<a;i++)e.push(new F(t[i].x,t[i].y));return e}static getStrings(t){const e=[];if(!t||!t.length)return"";for(let i=0,a=t.length;i<a;i++)e.push(F.getString(t[i]));return e.join(",")}static getString(t){return`${t.x},${t.y}`}static getLength(t){return Math.sqrt(t.x*t.x+t.y*t.y)}static getDistance(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static sub(t,e){return new F().subVectors(t,e)}static isPointOnSegment(t,e,i){return _c(this.sub(t,i).cross(this.sub(e,i)))===0&&_c(this.sub(t,i).dot(this.sub(e,i)))<=0}static angle(t,e,i){return i?Math.atan2(t.y-e.y,t.x-e.x):n0(Math.atan2(t.y-e.y,t.x-e.x))}static getSamplingPoints(t,e=100){let i=this.getClothoidPoints(t,e),a=0;for(let o=0,l=i.length;o<l;o++){let c=Math.max(0,o-1);o>0?a+=this.getDistance(i[c],i[c+1]):a=0,i[o].l=Math.round(a);let f=this.angle(i[c+1],i[c]);i[o].a=Math.round(f*100)/100}return i}static getClothoidPoints(t,e=100){let i=[],a=t.concat([]);if(!a||a.length<2)return i;a.length===2?(a.push(a[1]),a.unshift(a[0])):a.length===3&&a.splice(2,0,a[1]);for(let o=0;o<a.length-3;o+=3){let l=new F(a[o].x,a[o].y),c=new F(a[o+1].x,a[o+1].y),f=new F(a[o+2].x,a[o+2].y),d=new F(a[o+3].x,a[o+3].y),g=0;g+=l.distanceTo(c),g+=c.distanceTo(f),g+=f.distanceTo(d);let E=Math.min(.5,1/(g/e));for(let T=E;T<1;T+=E){let C=3*(c.x-l.x),L=3*(f.x-c.x)-C,N=d.x-l.x-C-L,M=3*(c.y-l.y),R=3*(f.y-c.y)-M,W=d.y-l.y-M-R,G=N*Math.pow(T,3)+L*Math.pow(T,2)+C*T+l.x,b=W*Math.pow(T,3)+R*Math.pow(T,2)+M*T+l.y;i.push({x:Math.round(G),y:Math.round(b),a:0,l:0})}}return i.unshift({x:a[0].x,y:a[0].y,a:0,l:0}),i.push({x:a[a.length-1].x,y:a[a.length-1].y,a:0,l:0}),i}static getClothoidLength(t){let e=0;if(t.length>2)for(let i=0;i<t.length;i++){let a=Math.max(0,i-1);i>0&&(e+=this.getDistance(t[a],t[a+1]))}return e}static getCircleCenterByChord(t,e,i,a=!0,o=new F){const l=this.getDistance(t,e);if(l===0)return o.x=1/0,o.y=1/0,o;Ru.set((t.x+e.x)/2,(t.y+e.y)/2);const c=Math.sqrt(i*i-l*l/4),f=a?-1:1;return o.x=Ru.x+f*c*(e.y-t.y)/l,o.y=Ru.y-f*c*(e.x-t.x)/l,o}static isPointInCircle(t,e,i){return this.getDistance(i,t)<e}static isPointInConvexHull(t,e){let i=!1;const a=e.length;for(let o=0,l=a-1;o<a;l=o++){const c=e[o],f=e[l];if(Math.min(c.x,f.x)<=t.x&&t.x<=Math.max(c.x,f.x)&&Math.min(c.y,f.y)<=t.y&&t.y<=Math.max(c.y,f.y)){const d=(f.x-c.x)*(t.y-c.y)-(f.y-c.y)*(t.x-c.x);if(Math.abs(d)<1e-12)return!0}c.y>t.y!=f.y>t.y&&t.x<(f.x-c.x)*(t.y-c.y)/(f.y-c.y)+c.x&&(i=!i)}return i}static isPointInPolygonByRay(t,e){let i=0;const a=new F().copy(t),o=new F,l=new F;for(let c=0;c<e.length;c++){c===e.length-1?(o.copy(e[c]),l.copy(e[0])):(o.copy(e[c]),l.copy(e[c+1]));let f=[o.y,l.y].sort((d,g)=>d-g);f[0]<a.y&&f[1]>a.y&&(o.x<a.x||l.x<a.x)&&i++}return i%2===1}static getIntersectionOfSegments(t,e,i,a,o=!1,l=new F){const c=(a.y-i.y)*(e.x-t.x)-(a.x-i.x)*(e.y-t.y);if(c===0)return l.makeEmpty();const f=(a.x-i.x)*(t.y-i.y)-(a.y-i.y)*(t.x-i.x),d=(e.x-t.x)*(t.y-i.y)-(e.y-t.y)*(t.x-i.x),g=f/c,E=d/c;return o&&(g<0||g>1||E<0||E>1)?l.makeEmpty():(l.x=t.x+g*(e.x-t.x),l.y=t.y+g*(e.y-t.y),l)}static getConvexHullByGrahamScan(t,e=!1,i=[]){if(!t||!t.length)return i;const a=t.length;let o=0;for(let f=0;f<a;f++)t[f].x<t[o].x&&(o=f);let l=o,c;do{i.push(t[l]),c=(l+1)%a;for(let f=0;f<a;f++)this.whichSideOfSegment(t[l],t[f],t[c])>0&&(c=f);l=c}while(l!==o);return e&&i.push(t[o]),i}static whichSideOfSegment(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}static getPointsWithMatrix3(t,e){const i=[];if(!t)return i;for(let a=0,o=t.length;a<o;a++)i.push({x:e.elements[0]*t[a].x+e.elements[3]*t[a].y+e.elements[6],y:e.elements[1]*t[a].x+e.elements[4]*t[a].y+e.elements[7]});return i}static getPointsApplyMatrix3(t,e=[]){for(let i=0,a=e.length;i<a;i++){const o=t.elements[0]*e[i].x+t.elements[3]*e[i].y+t.elements[6],l=t.elements[1]*e[i].x+t.elements[4]*e[i].y+t.elements[7];e[i].x=o,e[i].y=l}return e}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(t){const e=this.x,i=this.y,a=t.elements;return this.x=a[0]*e+a[3]*i+a[6],this.y=a[1]*e+a[4]*i+a[7],this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clone(){return new F(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}cross(t){return this.x*t.y-this.y*t.x}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}dot(t){return this.x*t.x+this.y*t.y}equals(t,e=!0){return e?t.x===this.x&&t.y===this.y:Math.abs(t.x-this.x)<Number.EPSILON&&Math.abs(t.y-this.y)<Number.EPSILON}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}floorToZero(){return this.roundToZero()}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+t)}}identity(){return this.set(0,0)}isEmpty(){return!Number.isFinite(this.x)&&!Number.isFinite(this.y)}isZero(){return this.x===0&&this.y===0}length(){return Math.sqrt(this.dot(this))}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}maxXY(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}minXY(t,e){return this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t,e){return this.x*=t,this.y*=e||t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(t){return this.applyMatrix3(t.matrixWorldInverse).applyMatrix3(t.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(t){const e=Math.cos(t),i=Math.sin(t),a=this.x,o=this.y;return this.x=a*e-o*i,this.y=a*i+o*e,this}rotateAround(t,e){const i=Math.cos(e),a=Math.sin(e),o=this.x-t.x,l=this.y-t.y;return this.x=o*i-l*a+t.x,this.y=o*a+l*i+t.y,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}set(t,e){return this.x=t,this.y=e,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("out of range: "+t)}return this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*3)}setLength(t){return this.normalize().multiplyScalar(t)}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(t,e=!1){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}}const Ru=new F,o0=Object.freeze(Object.defineProperty({__proto__:null,default:F},Symbol.toStringTag,{value:"Module"}));var Ja={exports:{}};/**
5
+ @`+(r.systemId||"")+"#[line:"+r.lineNumber+",col:"+r.columnNumber+"]"}function Tc(r,t,e){return typeof r=="string"?r.substr(t,e):r.length>=t+e||t?new java.lang.String(r,t,e)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){Ys.prototype[r]=function(){return null}});function Qa(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}Xa.__DOMHandler=Ys,Xa.normalizeLineEndings=wc,Xa.DOMParser=bc;var Jg=Xa.DOMParser;const t0="1.0.59";function e0(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const ns=typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{document:void 0,tinyEngine:void 0};ns.Path2D||Ag(ns),ns.DOMParser||(ns.DOMParser=Jg);const kt={window:ns,version:t0,isBrowser:e0(),dpr:typeof window<"u"&&window.devicePixelRatio||1,document:ns.document,time:0,deltaTime:0,config:Zn},Xs=(r,t,e)=>Math.max(t,Math.min(e,r)),_c=(r,t=1e-6)=>Math.abs(r)<t?0:r<0?-1:1,r0=r=>r*(Math.PI/180),i0=(r,t)=>(r%t+t)%t,Bu=(r,t,e)=>(1-e)*r+e*t,n0=r=>{let t=r*(180/Math.PI);return t<0&&(t+=360),t>360&&(t-=360),t},$t={transparent:"rgba(1, 1, 1, 0)",green:"#45b787",darkGreen:"#314a43",blue:"#6e9bc5",darkBlue:"#2775b6",red:"#F26666",darkRed:"#D95970",brown:"#ECD2B9",darkBrown:"#BF9D8A",yellow:"#ECDEC0",darkYellow:"#D0AC57",lightGray:"#e0e0e0",gray:"#beb6b6",darkGray:"#918883",white:"#F2F2F2",darkWhite:"#ececec",lightBlack:"#2E3032",black:"#182327",blackAlpha5:"rgba(0, 0, 0, 0.5)"},s0={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},Rr={h:0,s:0,l:0},Ka={h:0,s:0,l:0};function Iu(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}const a0=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$|rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)|rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[\d.]+\s*\)/;class Wt{isColor=!0;r=1;g=1;b=1;a=1;constructor(t,e,i,a){return e===void 0&&i===void 0?this.set(t):this.setRGBA(t,e,i,a)}static isColor(t){return typeof t=="string"?a0.test(t):typeof t=="number"?t>=0&&t<=16777215:!1}static getRandomStyle(){return vi.random().getStyle()}static getDarken(t,e=.8){return vi.set(t).getHSL(ja),vi.setHSL(ja.h,ja.s,ja.l*e).getStyle()}static getLighten(t,e=1.2){return this.getDarken(t,e)}static getContrast(t){return vi.set(t),vi.getContrastString()}static getArray(t){return vi.set(t).toArray()}static getComplementary(t){return vi.set(t),vi.getComplementaryString()}static getMoreTransparent(t,e){return vi.set(t).setA(e).getStyle()}set(t){return t&&t.isColor?this.copy(t):typeof t=="number"?this.setHex(t):typeof t=="string"&&this.setStyle(t),this}random(){return this.setHex(Math.floor(Math.random()*(1<<24)))}setScalar(t){return this.r=t,this.g=t,this.b=t,this.a=1,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,this.a=1,this}setR(t){return this.r=t,this}setG(t){return this.g=t,this}setB(t){return this.b=t,this}setA(t){return this.a=t,this}setRGB(t,e,i){return this.setRGBA(t,e,i,this.a)}setRGBA(t,e,i,a=1){return this.r=t,this.g=e,this.b=i,this.a=a,this}setHSL(t,e,i,a=1){if(t=i0(t,1),e=Xs(e,0,1),i=Xs(i,0,1),e===0)this.r=this.g=this.b=i;else{const o=i<=.5?i*(1+e):i+e-i*e,l=2*i-o;this.r=Iu(l,o,t+1/3),this.g=Iu(l,o,t),this.b=Iu(l,o,t-1/3)}return this.a=a,this}setStyle(t){let e;if(e=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let i;const a=e[1],o=e[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,this.a=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,this.a=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const l=parseFloat(i[1])/360,c=parseInt(i[2],10)/100,f=parseInt(i[3],10)/100,d=Math.max(Math.min(1,i[4]!==void 0?parseFloat(i[4]):1),0);return this.setHSL(l,c,f,d)}break}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=e[1],a=i.length;if(a===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this.a=1,this;if(a===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this.a=1,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=s0[t.toLowerCase()];return e!==void 0?this.setHex(e):console.warn("Color: Unknown color "+t),this}clone(){return new Wt(this.r,this.g,this.b,this.a)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}getRGB(t=new Wt){return t.setRGB(this.r,this.g,this.b)}getRGBByBg(t=new Wt){const e=this.a,i=e*this.r+(1-e)*t.r,a=e*this.g+(1-e)*t.g,o=e*this.b+(1-e)*t.b;return new Wt(i,a,o)}getHex(){return Xs(this.r*255,0,255)<<16^Xs(this.g*255,0,255)<<8^Xs(this.b*255,0,255)<<0}getHSL(t){const e=this.r,i=this.g,a=this.b,o=Math.max(e,i,a),l=Math.min(e,i,a);let c=0,f;const d=(l+o)/2;if(l===o)c=0,f=0;else{const g=o-l;switch(f=d<=.5?g/(o+l):g/(2-o-l),o){case e:c=(i-a)/g+(i<a?6:0);break;case i:c=(a-e)/g+2;break;case a:c=(e-i)/g+4;break}c/=6}return t.h=c,t.s=f,t.l=d,t}getStyle(){return this.a===1?`rgb(${this.r*255|0},${this.g*255|0},${this.b*255|0})`:`rgba(${this.r*255|0},${this.g*255|0},${this.b*255|0},${this.a||1})`}getHexString(){return"#"+("000000"+this.getHex().toString(16)).slice(-6)}getBrightness(){let t=(this.r*255*299+this.g*255*587+this.b*255*144)/1e3;return t+=(255-t)*(255-this.a*255)/255,t}getContrastString(){return this.getBrightness()>125?"#2f2f2f":"#f2f2f2"}getComplementary(t=new Wt){const e=this.toArray(),i=[0,0,0,1];for(let a=0;a<e.length;a++)if(a<3)i[a]=1-e[a];else if(a===3)e[a]>1||e[a]<=0?i[a]=1:i[a]=Math.max(Math.min(parseFloat(e[a].toFixed(2)),1),0);else continue;return t.setRGBA(i[0],i[1],i[2],parseFloat(i[3].toFixed(2)))}getComplementaryString(){return this.getComplementary().getStyle()}getLightenOrDarken(t){if(typeof t>"u"||t>=1)return this.getHexString();const e=this.getRGBByBg(),i=e.r*t+(1-t),a=e.g*t+(1-t),o=e.b*t+(1-t);return new Wt(i,a,o).getHexString()}getNormalized(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.a,1),0).toFixed(2))]}getNormalized3(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2))]}offsetHSL(t,e,i){return this.getHSL(Rr),Rr.h+=t,Rr.s+=e,Rr.l+=i,this.setHSL(Rr.h,Rr.s,Rr.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Rr),t.getHSL(Ka);const i=Bu(Rr.h,Ka.h,e),a=Bu(Rr.s,Ka.s,e),o=Bu(Rr.l,Ka.l,e);return this.setHSL(i,a,o),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this.a=t[e+3],this}toArray(t=[0,0,0,0],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),t.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const vi=new Wt,ja={h:0,s:0,l:0};class F{isVector2=!0;x=0;y=0;z;constructor(t=0,e=0,i){this.x=t,this.y=e,this.z=i||0}static isZero(t){return t.x===0&&t.y===0}static isEmpty(t){return!Number.isFinite(t.x)&&!Number.isFinite(t.y)}static equals(t,e,i=!0){return i?t.x===e.x&&t.y===e.y:Math.abs(t.x-e.x)<Number.EPSILON&&Math.abs(t.y-e.y)<Number.EPSILON}static getInt32Array(t,e=2){const i=new ArrayBuffer(t.length*e*4),a=new Int32Array(i);for(let o=0,l=t.length;o<l;o++)a[o*2]=t[o].x,a[o*2+1]=t[o].y;return a}static getFloat64Array(t,e=2){const i=new ArrayBuffer(t.length*e*8),a=new Float64Array(i);for(let o=0,l=t.length;o<l;o++)a[o*2]=t[o].x,a[o*2+1]=t[o].y;return a}static getVectors(t){const e=[];for(let i=0,a=t.length;i<a;i++)e.push(new F(t[i].x,t[i].y));return e}static getStrings(t){const e=[];if(!t||!t.length)return"";for(let i=0,a=t.length;i<a;i++)e.push(F.getString(t[i]));return e.join(",")}static getString(t){return`${t.x},${t.y}`}static getLength(t){return Math.sqrt(t.x*t.x+t.y*t.y)}static getDistance(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static sub(t,e){return new F().subVectors(t,e)}static isPointOnSegment(t,e,i){return _c(this.sub(t,i).cross(this.sub(e,i)))===0&&_c(this.sub(t,i).dot(this.sub(e,i)))<=0}static angle(t,e,i){return i?Math.atan2(t.y-e.y,t.x-e.x):n0(Math.atan2(t.y-e.y,t.x-e.x))}static getSamplingPoints(t,e=100){let i=this.getClothoidPoints(t,e),a=0;for(let o=0,l=i.length;o<l;o++){let c=Math.max(0,o-1);o>0?a+=this.getDistance(i[c],i[c+1]):a=0,i[o].l=Math.round(a);let f=this.angle(i[c+1],i[c]);i[o].a=Math.round(f*100)/100}return i}static getClothoidPoints(t,e=100){let i=[],a=t.concat([]);if(!a||a.length<2)return i;a.length===2?(a.push(a[1]),a.unshift(a[0])):a.length===3&&a.splice(2,0,a[1]);for(let o=0;o<a.length-3;o+=3){let l=new F(a[o].x,a[o].y),c=new F(a[o+1].x,a[o+1].y),f=new F(a[o+2].x,a[o+2].y),d=new F(a[o+3].x,a[o+3].y),g=0;g+=l.distanceTo(c),g+=c.distanceTo(f),g+=f.distanceTo(d);let E=Math.min(.5,1/(g/e));for(let T=E;T<1;T+=E){let C=3*(c.x-l.x),L=3*(f.x-c.x)-C,N=d.x-l.x-C-L,M=3*(c.y-l.y),R=3*(f.y-c.y)-M,W=d.y-l.y-M-R,G=N*Math.pow(T,3)+L*Math.pow(T,2)+C*T+l.x,b=W*Math.pow(T,3)+R*Math.pow(T,2)+M*T+l.y;i.push({x:Math.round(G),y:Math.round(b),a:0,l:0})}}return i.unshift({x:a[0].x,y:a[0].y,a:0,l:0}),i.push({x:a[a.length-1].x,y:a[a.length-1].y,a:0,l:0}),i}static getClothoidLength(t){let e=0;if(t.length>2)for(let i=0;i<t.length;i++){let a=Math.max(0,i-1);i>0&&(e+=this.getDistance(t[a],t[a+1]))}return e}static getCircleCenterByChord(t,e,i,a=!0,o=new F){const l=this.getDistance(t,e);if(l===0)return o.x=1/0,o.y=1/0,o;Ru.set((t.x+e.x)/2,(t.y+e.y)/2);const c=Math.sqrt(i*i-l*l/4),f=a?-1:1;return o.x=Ru.x+f*c*(e.y-t.y)/l,o.y=Ru.y-f*c*(e.x-t.x)/l,o}static isPointInCircle(t,e,i){return this.getDistance(i,t)<e}static isPointInConvexHull(t,e){let i=!1;const a=e.length;for(let o=0,l=a-1;o<a;l=o++){const c=e[o],f=e[l];if(Math.min(c.x,f.x)<=t.x&&t.x<=Math.max(c.x,f.x)&&Math.min(c.y,f.y)<=t.y&&t.y<=Math.max(c.y,f.y)){const d=(f.x-c.x)*(t.y-c.y)-(f.y-c.y)*(t.x-c.x);if(Math.abs(d)<1e-12)return!0}c.y>t.y!=f.y>t.y&&t.x<(f.x-c.x)*(t.y-c.y)/(f.y-c.y)+c.x&&(i=!i)}return i}static isPointInPolygonByRay(t,e){let i=0;const a=new F().copy(t),o=new F,l=new F;for(let c=0;c<e.length;c++){c===e.length-1?(o.copy(e[c]),l.copy(e[0])):(o.copy(e[c]),l.copy(e[c+1]));let f=[o.y,l.y].sort((d,g)=>d-g);f[0]<a.y&&f[1]>a.y&&(o.x<a.x||l.x<a.x)&&i++}return i%2===1}static getIntersectionOfSegments(t,e,i,a,o=!1,l=new F){const c=(a.y-i.y)*(e.x-t.x)-(a.x-i.x)*(e.y-t.y);if(c===0)return l.makeEmpty();const f=(a.x-i.x)*(t.y-i.y)-(a.y-i.y)*(t.x-i.x),d=(e.x-t.x)*(t.y-i.y)-(e.y-t.y)*(t.x-i.x),g=f/c,E=d/c;return o&&(g<0||g>1||E<0||E>1)?l.makeEmpty():(l.x=t.x+g*(e.x-t.x),l.y=t.y+g*(e.y-t.y),l)}static getConvexHullByGrahamScan(t,e=!1,i=[]){if(!t||!t.length)return i;const a=t.length;let o=0;for(let f=0;f<a;f++)t[f].x<t[o].x&&(o=f);let l=o,c;do{i.push(t[l]),c=(l+1)%a;for(let f=0;f<a;f++)this.whichSideOfSegment(t[l],t[f],t[c])>0&&(c=f);l=c}while(l!==o);return e&&i.push(t[o]),i}static whichSideOfSegment(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}static getPointsWithMatrix3(t,e){const i=[];if(!t)return i;for(let a=0,o=t.length;a<o;a++)i.push({x:e.elements[0]*t[a].x+e.elements[3]*t[a].y+e.elements[6],y:e.elements[1]*t[a].x+e.elements[4]*t[a].y+e.elements[7]});return i}static getPointsApplyMatrix3(t,e=[]){for(let i=0,a=e.length;i<a;i++){const o=t.elements[0]*e[i].x+t.elements[3]*e[i].y+t.elements[6],l=t.elements[1]*e[i].x+t.elements[4]*e[i].y+t.elements[7];e[i].x=o,e[i].y=l}return e}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(t){const e=this.x,i=this.y,a=t.elements;return this.x=a[0]*e+a[3]*i+a[6],this.y=a[1]*e+a[4]*i+a[7],this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clone(){return new F(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}cross(t){return this.x*t.y-this.y*t.x}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}dot(t){return this.x*t.x+this.y*t.y}equals(t,e=!0){return e?t.x===this.x&&t.y===this.y:Math.abs(t.x-this.x)<Number.EPSILON&&Math.abs(t.y-this.y)<Number.EPSILON}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}floorToZero(){return this.roundToZero()}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+t)}}identity(){return this.set(0,0)}isEmpty(){return!Number.isFinite(this.x)&&!Number.isFinite(this.y)}isZero(){return this.x===0&&this.y===0}length(){return Math.sqrt(this.dot(this))}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}maxXY(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}minXY(t,e){return this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t,e){return this.x*=t,this.y*=e||t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(t){return this.applyMatrix3(t.matrixWorldInverse).applyMatrix3(t.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(t){const e=Math.cos(t),i=Math.sin(t),a=this.x,o=this.y;return this.x=a*e-o*i,this.y=a*i+o*e,this}rotateAround(t,e){const i=Math.cos(e),a=Math.sin(e),o=this.x-t.x,l=this.y-t.y;return this.x=o*i-l*a+t.x,this.y=o*a+l*i+t.y,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}set(t,e){return this.x=t,this.y=e,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("out of range: "+t)}return this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*3)}setLength(t){return this.normalize().multiplyScalar(t)}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(t,e=!1){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}}const Ru=new F,o0=Object.freeze(Object.defineProperty({__proto__:null,default:F},Symbol.toStringTag,{value:"Module"}));var Ja={exports:{}};/**
6
6
  * @license
7
7
  * Lodash <https://lodash.com/>
8
8
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -69,4 +69,4 @@ function print() { __p += __j.call(arguments, '') }
69
69
  `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
70
70
 
71
71
  `,`1) content: element.innerHTML
72
- `,"2) content: () => element.cloneNode(true)"].join(" "))}var c=a.reduce(function(f,d){var g=d&&fm(d,i);return g&&f.push(g),f},[]);return pa(r)?c[0]:c}ga.defaultProps=ar,ga.setDefaultProps=um,ga.currentInput=ii,Object.assign({},bf,{effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow)}}),ga.setDefaultProps({render:sp});let pm=0;const ji=ga(document.body,{theme:"translucent",animation:"scale",inertia:!0,delay:[200,100],content:"",allowHTML:!0,placement:"left-start",trigger:"manual",arrow:!0});class cl{constructor(t,e){this.container=t,this.text=e,t?this.container=t:this.container=document.getElementsByTagName("body")[0],this.text=e}name="Label";id="Label"+pm++;el;position=new F;get isMounted(){return ji.state.isMounted}get isShown(){return ji.state.isShown}destroy(){this.text="",this.position.identity()}setHtml(t=""){return this.text=t,this}update(t){t&&(this.position.copy(t),ji.show())}async show(t){if(t)return await this.hide(),this.position.copy(t),ji.setContent(this.text),ji.setProps({getReferenceClientRect:()=>({width:0,height:0,right:this.position.x,left:this.position.x,bottom:this.position.y,top:this.position.y,x:this.position.x,y:this.position.y,toJSON(){}})}),ji.clearDelayTimeouts(),ji.show(),new Promise(e=>{Mt.delay(function(){e()},300)})}async hide(){return ji.hide(),new Promise(t=>{Mt.delay(function(){t()},100)})}}let dm=0;class gm extends Ge{name="DummyPoint";id="dummyPoint"+dm++;container;offset=new F;el;label;radius=10;position=new F;worldPosition=new F;userData;constructor(t,e){var a,o;super(),t?this.container=t:this.container=document.getElementsByTagName("body")[0];let i=this.container.getBoundingClientRect();this.offset.set(i.left,i.top),this.userData=e,(a=this.userData)!=null&&a.type||Mt.set(this,"userData.type",_n.DEFAULT),this.initDom(),this.setType((o=this.userData)==null?void 0:o.type),this.mount(),this.initLabel()}destroy(){var t;super.destroy(),this.unmount(),(t=this.label)==null||t.destroy()}get isMounted(){var t;return!!((t=this.el)!=null&&t.parentNode)}mount(){var t;this.el&&((t=this.el)!=null&&t.parentNode||this.container.appendChild(this.el))}unmount(){var t,e,i,a;(e=(t=this.el)==null?void 0:t.parentNode)==null||e.removeChild(this.el),(i=this.el)==null||i.remove(),(a=this.label)==null||a.hide()}setText(t=""){return this.el?(this.el.innerText=t,this):this}initDom(){var t;this.el=document.createElement("div"),this.el.setAttribute("id",this.id),this.el.setAttribute("class","dummy-point"),this.el.setAttribute(as+"-id",(t=this.userData)==null?void 0:t.value)}initLabel(){var t;(t=this.userData)!=null&&t.label&&(this.label=new cl(this.container,this.userData.label))}setActive(t){return t?(ra(this.el,"active"),this.showLabel()):(ia(this.el,"active"),this.hideLabel()),this}showLabel(){var t;(t=this.label)==null||t.show(ym.copy(this.position).add(this.offset).subScalar(this.radius))}hideLabel(){var t;(t=this.label)==null||t.hide()}setType(t){var i;if(!this.userData)return this;const e=(i=this.userData)==null?void 0:i.type;return t||(t=_n.DEFAULT),e&&uo(this.el,e)&&ia(this.el,e),this.userData.type=t,ra(this.el,this.userData.type),this}update(t,e=!1){!t||!this.isMounted||(e||t.subScalar(this.radius).round(),this.position.copy(t),this.el.style.transform=`translate3D(${this.position.x}px, ${this.position.y}px, 0)`)}}const ym=new F;let mm=0;class vm extends Ge{name="DummyRect";id="dummyRect"+mm++;container;offset=new F;el;radius=10;position=new F;worldPosition=new F;label;userData;constructor(t,e){super(),t?this.container=t:this.container=document.getElementsByTagName("body")[0];let i=this.container.getBoundingClientRect();this.offset.set(i.left,i.top),this.userData=e,this.initDom(),this.mount(),this.initLabel()}destroy(){var t;super.destroy(),this.unmount(),(t=this.label)==null||t.destroy()}get isMounted(){var t;return!!((t=this.el)!=null&&t.parentNode)}mount(){this.container.appendChild(this.el)}unmount(){var t,e,i,a;this.setText(""),(e=(t=this.el)==null?void 0:t.parentNode)==null||e.removeChild(this.el),(i=this.el)==null||i.remove(),(a=this.label)==null||a.hide()}initDom(){var t;this.el=document.createElement("div"),this.el.setAttribute("id",this.id),this.el.setAttribute("class","dummy-rect"),this.el.setAttribute(as+"-id",((t=this.userData)==null?void 0:t.rmId)||"undefined")}initLabel(){this.label=new cl(this.container,"")}setText(t=""){return this.el.innerText=t,this}setActive(t){return t?ra(this.el,"active"):ia(this.el,"active"),this}showLabel(){var t;(t=this.label)==null||t.show(xm.copy(this.position).add(this.offset).subScalar(this.radius))}hideLabel(){var t;(t=this.label)==null||t.hide()}setType(t){var i;if(!this.userData)return this;const e=(i=this.userData)==null?void 0:i.type;return t=_n.DEFAULT,e&&uo(this.el,e)&&ia(this.el,e),this.userData.type=t,ra(this.el,this.userData.type),this}update(t,e=!1){!t||!this.isMounted||(e||t.subScalar(this.radius).round(),this.position.copy(t),this.el.style.transform=`translate3D(${this.position.x}px, ${this.position.y}px, 0)`)}}const xm=new F;class Em extends Ge{name="Dummies";container;controller;scene;viewMatrix=new ne;dummies=[];rmMap=new Map;mergedMap=new Map;cameraUpdateHandler=this.handleCameraUpdate.bind(this);controllerTapHandler=this.handleControllerTap.bind(this);constructor(t,e){super(),this.container=t,this.controller=e,this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.clearDummies()}bindEvents(){this.controller.camera.addEventListener(lo.UPDATE,this.cameraUpdateHandler),this.controller.addEventListener(ot.TAP,this.controllerTapHandler)}unbindEvents(){this.controller.camera.removeEventListener(lo.UPDATE,this.cameraUpdateHandler),this.controller.removeEventListener(ot.TAP,this.controllerTapHandler)}bindScene(t){this.scene=t}update(t){var e,i,a;if(t){this.viewMatrix.copy(t);for(let o=0,l=(this.dummies||[]).length;o<l;o++){const c=this.dummies[o],f=(i=this.scene)==null?void 0:i.getElementById((e=c.userData)==null?void 0:e.rmId);if(f){const d=(a=this.scene)==null?void 0:a.chef.getElementBoundingBox(f.id);d==null||d.getCenter(Ji),Ji.applyMatrix3(this.viewMatrix).round(),c.position.copy(Ji)}else Ji.copy(c.worldPosition).applyMatrix3(this.viewMatrix).round(),c.update(Ji)}this.mergeDummies()}}setDummies(t){this.clearDummies();for(let e=0,i=(t||[]).length;e<i;e++)this.addDummy(t[e])}addDummy(t){var a,o;const e=new gm(this.container,t);this.dummies.push(e);const i=(a=e.userData)==null?void 0:a.rmId;return i&&(this.rmMap.has(i)||this.rmMap.set(i,[]),(o=this.rmMap.get(i))==null||o.push(e)),e}removeDummy(t){var a;const e=this.dummies.indexOf(t);e>-1&&this.dummies.splice(e,1);const i=(a=t.userData)==null?void 0:a.rmId;if(i){const o=this.mergedMap.get(i);o==null||o.destroy(),this.mergedMap.delete(i);const l=this.rmMap.get(i);if(!l)return;if(l.length===1)this.rmMap.delete(i);else{const c=l.indexOf(t);c>-1&&(l.splice(c,1),this.rmMap.set(i,l))}}t.destroy()}clearDummies(t){var e,i,a;for(let o=(((e=this.dummies)==null?void 0:e.length)||0)-1;o>=0;o--){const l=this.dummies[o];(!t||(i=l==null?void 0:l.userData)!=null&&i.type&&(t!=null&&t.includes((a=l.userData)==null?void 0:a.type)))&&this.removeDummy(l)}t||(this.dummies.length=0,this.mergedMap.clear(),this.rmMap.clear())}mergeDummies(){this.rmMap.forEach((t,e)=>{var a,o,l,c;if((a=this.scene)==null?void 0:a.getElementById(e)){const f=(o=this.scene)==null?void 0:o.chef.getElementBoundingBox(e);if(!f)return;fl.copy(f).applyMatrix3(this.viewMatrix).round(),fl.getSize(Ji);const d=t[0].radius,g=fl.centralArrange(t.length,d*2,d*2);if(Ji.x<d*3||Ji.y<d*3){t.forEach(T=>T.unmount());const E=this.mergedMap.get(e);E==null||E.unmount()}else if(Array.isArray(g))this.mergedMap.has(e)&&((l=this.mergedMap.get(e))==null||l.unmount()),t.forEach((E,T)=>{E.isMounted||E.mount(),E.update(g[T])});else{t.forEach(C=>C.unmount());let E=this.mergedMap.get(e);if(E)E.isMounted||E.mount();else{const C=Mt.cloneDeep(t[0].userData)||{},L=Mt.reduce(t,(M,R)=>{var W,G;return(W=R.userData)!=null&&W.label&&M.push((G=R.userData)==null?void 0:G.label),M},[]);C.label=L.join(", ");const N=Mt.reduce(t,(M,R)=>{var W,G;return(W=R.userData)!=null&&W.value&&M.push((G=R.userData)==null?void 0:G.value),M},[]);C.value=N.join(","),C.rmId=e,E=new vm(this.container,C),this.mergedMap.set(e,E)}E.setText(t.length.toString());const T=Mt.reduce(t,(C,L)=>{var N,M;return(N=L.userData)!=null&&N.label&&C.push((M=L.userData)==null?void 0:M.label),C},[]);(c=E.label)==null||c.setHtml(T.join(", <br />")),E.update(t[0].position)}}})}getDummyById(t){return this.dummies.find(e=>{var i;return((i=e.userData)==null?void 0:i.value)===t})}setActiveByIds(t){var e,i;if(this.resetActives(),!!t&&(Array.isArray(t)||(t=[t]),!!(t!=null&&t.length)))for(let a=0,o=t.length;a<o;a++){const l=this.getDummyById(t[a]);if(l&&l.setActive(!0),l&&((e=l.userData)!=null&&e.rmId)){const c=this.mergedMap.get((i=l.userData)==null?void 0:i.rmId);c&&c.setActive(!0)}}}resetActives(){this.dummies.forEach(t=>t.setActive(!1)),this.mergedMap.forEach(t=>t.setActive(!1))}showDummyLabel(t){if(!t)return;const e=this.getDummyById(t);e&&e.showLabel();const i=this.mergedMap.get(t);i&&i.showLabel()}async hideDummyLabel(){this.dummies.forEach(t=>t.hideLabel()),this.mergedMap.forEach(t=>t.hideLabel())}handleCameraUpdate(){this.update(this.controller.camera.viewMatrix)}handleControllerTap(t){var a,o,l,c,f;if((t==null?void 0:t.type)!==ot.TAP)return;const e=((a=t==null?void 0:t.e)==null?void 0:a.target)||((l=(o=t==null?void 0:t.e)==null?void 0:o.srcEvent)==null?void 0:l.target)||((f=(c=t==null?void 0:t.e)==null?void 0:c.srcEvent)==null?void 0:f.srcElement),i=e==null?void 0:e.getAttribute(as+"-id");i&&console.warn("【TODO】handleControllerTap: ",i)}}const Ji=new F,fl=new St;(function(){return window[Qi.prefixed(window,"requestAnimationFrame")]||function(r){window.setTimeout(r,1e3/60)}})();class Am extends Ge{name="DragController";dragFake=!1;container;offset=new F;controller;scene;raycaster;dummies;_els=[];_hms=new Map;_vos=new Map;_elMap=new Map;_panType=_n.SUCCESS;onPanHandler=this.handleOnPan.bind(this);panEndHandler=Mt.debounce(this.handlePanEnd.bind(this),500);constructor(t,e,i=!0){super(),this.container=t;let a=this.container.getBoundingClientRect();this.offset.set(a.left,a.top),this.controller=e,this.dummies=new Em(t,e),this.raycaster=new xf,this.dragFake=i}destroy(){var t;super.destroy();for(let e=(((t=this._els)==null?void 0:t.length)||0)-1;e>=0;e--)this.drop(this._els[e]);this.dummies.destroy()}bindScene(t){var e;this.scene=t,(e=this.dummies)==null||e.bindScene(t)}drag(t,e){t&&(this._els.includes(t)||(this.bindEvent(t),this._els.push(t),this._vos.set(t,e)))}drop(t){if(!t)return;this.unbindEvent(t),this._vos.delete(t),this._elMap.delete(t);const e=this._els.findIndex(i=>i===t);e>-1&&this._els.splice(e,1)}bindEvent(t){if(!t)return;const e=new Qi.Manager(t,{domEvents:!0});e.add(new Qi.Pan({threshold:0,pointers:0})),e.on(["panstart","panmove","panend"].join(" "),this.onPanHandler),this._hms.set(t,e)}unbindEvent(t){if(!t)return;const e=this._hms.get(t);e&&(e.off(["panstart","panmove","panend"].join(" "),this.onPanHandler),e.destroy(),this._hms.delete(t))}handleOnPan(t){if(typeof t.preventDefault=="function"&&t.preventDefault(),typeof t.srcEvent.stopPropagation=="function"&&t.srcEvent.stopPropagation(),typeof t.srcEvent.stopImmediatePropagation=="function"&&t.srcEvent.stopImmediatePropagation(),!this.controller)return;t.type==="panstart"||t.isFirst?this.controller.enablePan=!1:t.type==="panmove"||t.type==="panend"&&(this.controller.enablePan=!0);const e=this._vos.get(t.target);if(!e)return;const i=Mt.cloneDeep(e);i.type=this._panType;const a=this._getDummy(t.target,i);ya.set(t.center.x,t.center.y).sub(this.offset),a.worldPosition.copy(ya).unproject(this.controller.camera),a.update(ya),this.panEndHandler({type:"panend",e:t})}handlePanEnd(t){if((t==null?void 0:t.type)!=="panend")return;const e=this.getDummies(!0);this.dispatchEvent({type:"panend",data:e})}getDummies(t=!0){const e=[];return this._els.forEach(i=>{var o;let a=this._vos.get(i);if(!(!a||a.type!==_n.SUCCESS)){if(t){const l=this._elMap.get(i);if(!l||!this.controller.camera)return;ya.copy(l.position),this.raycaster.setFromCamera(ya,this.controller.camera);const c=[];if((o=this.scene)==null||o.getIntersectObjects(this.raycaster,$e.RM,c),!(c!=null&&c.length))return;a=Mt.cloneDeep(a),a.rmId=c[0].id}e.push(a)}}),e}setDummiesByVos(t){var e,i;for(let a=0,o=(t||[]).length;a<o;a++){const l=(e=this.dummies)==null?void 0:e.addDummy(t[a]);if(!l)continue;const c=Mt.cloneDeep(t[a]);delete c.rmId,delete c.wsId,this.drag(l.el,c)}(i=this.dummies)==null||i.update(this.controller.camera.viewMatrix)}clearDummies(t){var e,i;for(let a=(((e=this._els)==null?void 0:e.length)||0)-1;a>=0;a--){const o=this._vos.get(this._els[a]);(!t||t&&(o!=null&&o.type)&&t.includes(o.type))&&this.drop(this._els[a])}(i=this.dummies)==null||i.clearDummies(t)}getDummyById(t){return this.dummies.getDummyById(t)}highlightDummies(t){var e;(e=this.dummies)==null||e.setActiveByIds(t)}resetHighlightDummies(){var t;(t=this.dummies)==null||t.resetActives()}showDummyLabel(t){var e;(e=this.dummies)==null||e.showDummyLabel(t)}start(){}_getDummy(t,e){let i=this._elMap.get(t);if(i||(i=this.dummies.addDummy(e).setType(_n.SUCCESS),this._elMap.set(t,i)),i.isMounted||i.mount(),this.dummies.dummies.includes(i)||this.dummies.dummies.push(i),!this._elMap.get(i.el)){this._elMap.set(i.el,i);const o=Mt.cloneDeep(e);delete o.rmId,delete o.wsId,this.drag(i.el,o)}return i}}const ya=new F;var ps=Object.freeze({Linear:Object.freeze({None:function(r){return r},In:function(r){return r},Out:function(r){return r},InOut:function(r){return r}}),Quadratic:Object.freeze({In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}}),Cubic:Object.freeze({In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}}),Quartic:Object.freeze({In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}}),Quintic:Object.freeze({In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}}),Sinusoidal:Object.freeze({In:function(r){return 1-Math.sin((1-r)*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.sin(Math.PI*(.5-r)))}}),Exponential:Object.freeze({In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}}),Circular:Object.freeze({In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}}),Elastic:Object.freeze({In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(r){var t=1.70158;return r===1?1:r*r*((t+1)*r-t)},Out:function(r){var t=1.70158;return r===0?0:--r*r*((t+1)*r+t)+1},InOut:function(r){var t=2.5949095;return(r*=2)<1?.5*(r*r*((t+1)*r-t)):.5*((r-=2)*r*((t+1)*r+t)+2)}}),Bounce:Object.freeze({In:function(r){return 1-ps.Bounce.Out(1-r)},Out:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},InOut:function(r){return r<.5?ps.Bounce.In(r*2)*.5:ps.Bounce.Out(r*2-1)*.5+.5}}),generatePow:function(r){return r===void 0&&(r=4),r=r<Number.EPSILON?Number.EPSILON:r,r=r>1e4?1e4:r,{In:function(t){return Math.pow(t,r)},Out:function(t){return 1-Math.pow(1-t,r)},InOut:function(t){return t<.5?Math.pow(t*2,r)/2:(1-Math.pow(2-t*2,r))/2+.5}}}}),ds=function(){return performance.now()},ap=function(){function r(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return r.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},r.prototype.removeAll=function(){this._tweens={}},r.prototype.add=function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];for(var a=0,o=e;a<o.length;a++){var l=o[a];(t=l._group)===null||t===void 0||t.remove(l),l._group=this,this._tweens[l.getId()]=l,this._tweensAddedDuringUpdate[l.getId()]=l}},r.prototype.remove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=0,a=t;i<a.length;i++){var o=a[i];o._group=void 0,delete this._tweens[o.getId()],delete this._tweensAddedDuringUpdate[o.getId()]}},r.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},r.prototype.update=function(t,e){t===void 0&&(t=ds()),e===void 0&&(e=!0);var i=Object.keys(this._tweens);if(i.length!==0)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var a=0;a<i.length;a++){var o=this._tweens[i[a]],l=!e;o&&o.update(t,l)===!1&&!e&&this.remove(o)}i=Object.keys(this._tweensAddedDuringUpdate)}},r}(),On={Linear:function(r,t){var e=r.length-1,i=e*t,a=Math.floor(i),o=On.Utils.Linear;return t<0?o(r[0],r[1],i):t>1?o(r[e],r[e-1],e-i):o(r[a],r[a+1>e?e:a+1],i-a)},Bezier:function(r,t){for(var e=0,i=r.length-1,a=Math.pow,o=On.Utils.Bernstein,l=0;l<=i;l++)e+=a(1-t,i-l)*a(t,l)*r[l]*o(i,l);return e},CatmullRom:function(r,t){var e=r.length-1,i=e*t,a=Math.floor(i),o=On.Utils.CatmullRom;return r[0]===r[e]?(t<0&&(a=Math.floor(i=e*(1+t))),o(r[(a-1+e)%e],r[a],r[(a+1)%e],r[(a+2)%e],i-a)):t<0?r[0]-(o(r[0],r[0],r[1],r[1],-i)-r[0]):t>1?r[e]-(o(r[e],r[e],r[e-1],r[e-1],i-e)-r[e]):o(r[a?a-1:0],r[a],r[e<a+1?e:a+1],r[e<a+2?e:a+2],i-a)},Utils:{Linear:function(r,t,e){return(t-r)*e+r},Bernstein:function(r,t){var e=On.Utils.Factorial;return e(r)/e(t)/e(r-t)},Factorial:function(){var r=[1];return function(t){var e=1;if(r[t])return r[t];for(var i=t;i>1;i--)e*=i;return r[t]=e,e}}(),CatmullRom:function(r,t,e,i,a){var o=(e-r)*.5,l=(i-t)*.5,c=a*a,f=a*c;return(2*t-2*e+o+l)*f+(-3*t+3*e-2*o-l)*c+o*a+t}}},pl=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),dl=new ap,wm=function(){function r(t,e){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ps.Linear.None,this._interpolationFunction=On.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=pl.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof e=="object"?(this._group=e,e.add(this)):e===!0&&(this._group=dl,dl.add(this))}return r.prototype.getId=function(){return this._id},r.prototype.isPlaying=function(){return this._isPlaying},r.prototype.isPaused=function(){return this._isPaused},r.prototype.getDuration=function(){return this._duration},r.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},r.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},r.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},r.prototype.start=function(t,e){if(t===void 0&&(t=ds()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var a={};for(var o in this._valuesEnd)a[o]=this._valuesEnd[o];this._valuesEnd=a}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},r.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},r.prototype._setupProperties=function(t,e,i,a,o){for(var l in i){var c=t[l],f=Array.isArray(c),d=f?"array":typeof c,g=!f&&Array.isArray(i[l]);if(!(d==="undefined"||d==="function")){if(g){var E=i[l];if(E.length===0)continue;for(var T=[c],C=0,L=E.length;C<L;C+=1){var N=this._handleRelativeValue(c,E[C]);if(isNaN(N)){g=!1,console.warn("Found invalid interpolation list. Skipping.");break}T.push(N)}g&&(i[l]=T)}if((d==="object"||f)&&c&&!g){e[l]=f?[]:{};var M=c;for(var R in M)e[l][R]=M[R];a[l]=f?[]:{};var E=i[l];if(!this._isDynamic){var W={};for(var R in E)W[R]=E[R];i[l]=E=W}this._setupProperties(M,e[l],E,a[l],o)}else(typeof e[l]>"u"||o)&&(e[l]=c),f||(e[l]*=1),g?a[l]=i[l].slice().reverse():a[l]=e[l]||0}}},r.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},r.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},r.prototype.pause=function(t){return t===void 0&&(t=ds()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},r.prototype.resume=function(t){return t===void 0&&(t=ds()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},r.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},r.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},r.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},r.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},r.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},r.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},r.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},r.prototype.easing=function(t){return t===void 0&&(t=ps.Linear.None),this._easingFunction=t,this},r.prototype.interpolation=function(t){return t===void 0&&(t=On.Linear),this._interpolationFunction=t,this},r.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},r.prototype.onStart=function(t){return this._onStartCallback=t,this},r.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},r.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},r.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},r.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},r.prototype.onStop=function(t){return this._onStopCallback=t,this},r.prototype.update=function(t,e){var i=this,a;if(t===void 0&&(t=ds()),e===void 0&&(e=r.autoStartOnUpdate),this._isPaused)return!0;var o;if(!this._goToEnd&&!this._isPlaying)if(e)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var l=t-this._startTime,c=this._duration+((a=this._repeatDelayTime)!==null&&a!==void 0?a:this._delayTime),f=this._duration+this._repeat*c,d=function(){if(i._duration===0||l>f)return 1;var N=Math.trunc(l/c),M=l-N*c,R=Math.min(M/i._duration,1);return R===0&&l===i._duration?1:R},g=d(),E=this._easingFunction(g);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,E),this._onUpdateCallback&&this._onUpdateCallback(this._object,g),this._duration===0||l>=this._duration)if(this._repeat>0){var T=Math.min(Math.trunc((l-this._duration)/c)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=T);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=c*T,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var C=0,L=this._chainedTweens.length;C<L;C++)this._chainedTweens[C].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},r.prototype._updateProperties=function(t,e,i,a){for(var o in i)if(e[o]!==void 0){var l=e[o]||0,c=i[o],f=Array.isArray(t[o]),d=Array.isArray(c),g=!f&&d;g?t[o]=this._interpolationFunction(c,a):typeof c=="object"&&c?this._updateProperties(t[o],l,c,a):(c=this._handleRelativeValue(l,c),typeof c=="number"&&(t[o]=l+(c-l)*a))}},r.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},r.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},r.autoStartOnUpdate=!1,r}(),bm="25.0.0",Tm=pl.nextId,ni=dl,_m=ni.getAll.bind(ni),Cm=ni.removeAll.bind(ni),Dm=ni.add.bind(ni),Sm=ni.remove.bind(ni),Om=ni.update.bind(ni),mo={Easing:ps,Group:ap,Interpolation:On,now:ds,Sequence:pl,nextId:Tm,Tween:wm,VERSION:bm,getAll:_m,removeAll:Cm,add:Dm,remove:Sm,update:Om};class Nm extends Ge{name="View";params;visible=!0;cvs;scene;scenes=[];camera;controller;tween;animateDuration;constructor(t={}){super(),this.params=t,this.animateDuration=this.params.animateDuration||300,this.cvs=t.cvs,this.camera=new mf(t.camera||{})}destroy(){this.controller&&this.controller.destroy(),this.camera&&this.camera.destroy(),this.scene&&this.scene.destroy(),this.scenes.forEach(t=>t.destroy()),this.scenes.length=0,super.destroy()}bindScene(t){this.scenes.push(t),this.reset(),this.scene=t,t.isStatic}saveCameraPosition(t){gs.copy(this.camera.boundingBoxWorld);const e=t?Er+t:Er;sessionStorage.setItem(e,JSON.stringify(gs))}clearCameraPosition(t){const e=t?Er+t:Er;sessionStorage.setItem(e,"")}restoreCameraPosition(t){const e=t?Er+t:Er,i=sessionStorage.getItem(e);i&&(gs.copy(JSON.parse(i)),this.resetCameraByBoundingBox(gs,!0))}fullscreen(t=10,e=!1){this.scene&&(this.scene.boundingBox.isEmpty()&&this.scene.computeBoundingBox(),gs.copy(this.scene.boundingBox).expandByVector(vo.set(t,t)),this.resetCameraByBoundingBox(gs,e))}handleCameraChanged(t){console.warn("handleCameraChanged: ",t.target.camera.position.z,t.target.camera.scaled.x)}reset(){}async resetCameraByBoundingBox(t,e=!1){if(!this.camera)return;if(!t||t.isEmpty())throw new Error("BoundingBox empty");if(!e)return this.camera.setByBox(t),Promise.resolve();const i=this.camera.getCameraPosition();t.getCenter(vo),t.getSize(gl);const a=Math.max(gl.x/this.camera.width,gl.y/this.camera.height),o={x:vo.x,y:vo.y,z:0,s:a,r:0};await this.animateCamera(i,o)}async animateCamera(t,e){return this.controller&&(this.controller.enabled=!1),this.tween&&this.tween.stop(),new Promise(i=>{this.tween=new mo.Tween(t).to(e,this.animateDuration).easing(mo.Easing.Exponential.Out).onUpdate(a=>{this.camera.position.set(a.x,a.y),this.camera.scaled.set(a.s,a.s),this.camera.rotation.set(a.r,a.r),this.camera.update()}).onComplete(()=>{this.controller&&(this.controller.enabled=!0),i()}).start()})}computeBoundingBox(t,e=new St){return!t||!t.length||(e.makeEmpty(),t.forEach(i=>e.union(i.computeBoundingBox()))),e}expandScenesBoundingBox(t,e=new St){t.forEach(i=>i.boundingBox.union(e))}update(t){this.tween&&this.tween.update(t)}}const Er="camera_position_",vo=new F,gl=new F,gs=new St;class Mm extends Ge{name="SvgView";params;container;offset=new F;camera;controller;scene;p1=new F;p2=new F;graph;multiSelector;dummiesController;zoomToSelectEnable=!1;zoomBox=new St;selectEnable=!1;multiSelectEnable=!1;tween;animateDuration;label;controllerPanStartHandler=this.handlePanStart.bind(this);controllerPanEndHandler=this.handlePanEnd.bind(this);controllerWheelStartHandler=this.handlePanStart.bind(this);controllerWheelEndHandler=this.handlePanEnd.bind(this);controllerPanMoveHandler=this.handleControllerPanMove.bind(this);controllerPointerOverHandler=this.handleControllerPointerOver.bind(this);multiSelectorSelectedHandler=this.handleMultiSelectorSelected.bind(this);_currentAssetId;constructor(t={}){super(),this.params=t,this.params.zoomToSelectEnable&&(this.zoomToSelectEnable=!0),this.params.selectEnable&&(this.selectEnable=!0),this.params.multiSelectEnable&&(this.multiSelectEnable=!0),this.params.camera||(this.params.camera={}),this.params.camera.flipY=!0,this.animateDuration=this.params.animateDuration||300,this.camera=new mf(this.params.camera),this.container=this.params.containerId?document.getElementById(this.params.containerId):kt.window.document.getElementsByTagName("body")[0];let e=this.container.getBoundingClientRect();this.offset.set(e.left,e.top),this.controller=new yf(this.container,this.camera,!0),this.graph=new zu(this.container),this.multiSelector=new I2(this.container,this.controller),this.dummiesController=new Am(this.container,this.controller),this.bindControllerEvents(),this.initLabel()}destroy(){var t;this.unbindControllerEvents(),super.destroy(),(t=this.label)==null||t.destroy()}initLabel(){this.label=new cl(this.container,"")}showAssetsLabel(t,e,i){var o,l,c,f,d;if(!e)return;t||(t=(o=this.scene)==null?void 0:o.assetType);const a=(l=this.scene)==null?void 0:l.chef.getElementBoundingBox(e);a&&!a.isEmpty()&&(i||(i=(c=this.scene)==null?void 0:c.getAssetLabelById(t,e),i||(i=e)),(f=this.label)==null||f.setHtml(i),Nn.copy(a.min).applyMatrix3(this.camera.viewMatrix).add(this.offset).round(),(d=this.label)==null||d.show(Nn))}async hideAssetsLabel(){var t;return(t=this.label)==null?void 0:t.hide()}bindScene(t){var e;this.scene=t,this.multiSelector.bindScene(this.scene),(e=this.dummiesController)==null||e.bindScene(this.scene)}resize(){var t,e;(t=this.camera)==null||t.resize(),(e=this.controller)==null||e.resize(),console.log("【svgView】resize: ",this.params.width,this.params.height)}async setByBox(t,e=!0){await this.resetCameraByBoundingBox(t,e)}zoomIn(){this.controller.scaled=this.camera.scaled.x*.9,this.controller.update()}zoomOut(){this.controller.scaled=this.camera.scaled.x*1.1,this.controller.update()}zoomToSelectEnableChanged(t){console.log("TODO: zoomToSelectEnableChanged: ",t),this.zoomToSelectEnable=t,this.controller.enablePan=!this.zoomToSelectEnable}selectEnableChanged(t){this.selectEnable=!!t,this.multiSelector.selectEnableChanged(t)}multiSelectEnableChanged(t){this.multiSelectEnable=!!t,this.multiSelector.multiSelectEnableChanged(t)}getIntersectObjects(t,e,i=[]){return this.scene?this.scene.getIntersectObjects(t,e,i):i}async focusAt(t,e=500){return this.camera?(Xt.setFromCenterAndSize(t,Nn.set(e*2,e*2)),this.resetCameraByBoundingBox(Xt,!0)):Promise.resolve()}async focusAtById(t,e=500){var a;const i=(a=this.scene)==null?void 0:a.getBoundingBoxById(t);if(console.log("focusAtById: ",t,i==null?void 0:i.toString()),i){i.expandByScalar(e),Xt.copy(this.camera.boundingBoxWorld),Xt.containsBox(i)||await this.resetCameraByBoundingBox(i,!0);return}}async focusAtDummy(t,e=500){var o,l;const i=this.dummiesController.getDummyById(t),a=(o=i==null?void 0:i.userData)==null?void 0:o.rmId;if(a){const c=(l=this.scene)==null?void 0:l.getBoundingBoxById(a);if(c){c.expandByScalar(e),Xt.copy(this.camera.boundingBoxWorld),Xt.containsBox(c)||await this.resetCameraByBoundingBox(c,!0);return}}if(i!=null&&i.position&&!(i!=null&&i.position.isEmpty())){Xt.setFromCenterAndSize(i.worldPosition,Nn.set(e*2,e*2)),this.camera.boundingBoxWorld.containsBox(Xt)||await this.resetCameraByBoundingBox(Xt,!0);return}}async resetCameraByBoundingBox(t,e=!1){if(!this.camera)return Promise.resolve();if(!t||t.isEmpty())throw new Error("BoundingBox empty");if(!e)return this.camera.setByBox(t),Promise.resolve();const i=this.camera.getCameraPosition();t.getCenter(Nn),t.getSize(yl);const a=Math.max(yl.x/this.camera.width,yl.y/this.camera.height),o={x:Nn.x,y:Nn.y,z:0,s:a,r:0};await this.animateCamera(i,o)}async animateCamera(t,e){return this.controller&&(this.controller.enabled=!1),this.tween&&this.tween.stop(),new Promise(i=>{this.tween=new mo.Tween(t).to(e,this.animateDuration).easing(mo.Easing.Exponential.Out).onUpdate(a=>{this.camera.position.set(a.x,a.y),this.camera.scaled.set(a.s,a.s),this.camera.rotation.set(a.r,a.r),this.camera.update()}).onComplete(()=>{this.controller&&(this.controller.enabled=!0),i()}).start()})}fullscreen(){this.scene&&(this.scene&&!this.scene.viewBox.isEmpty()?Xt.copy(this.scene.viewBox):(this.scene.updateMatrixWorld(!0),this.scene.computeBoundingBox(),Xt.copy(this.scene.boundingBox)),this.resetCameraByBoundingBox(Xt,!0))}saveCameraPosition(t){Xt.copy(this.camera.boundingBoxWorld);const e=t?Er+t:Er;sessionStorage.setItem(e,JSON.stringify(Xt))}restoreCameraPosition(t){const e=t?Er+t:Er,i=sessionStorage.getItem(e);if(!i)return this.fullscreen();Xt.copy(JSON.parse(i)),this.resetCameraByBoundingBox(Xt,!0)}clearCameraPosition(t){const e=t?Er+t:Er;sessionStorage.setItem(e,"")}bindControllerEvents(){this.controller.addEventListener(ot.PAN_START,this.controllerPanStartHandler),this.controller.addEventListener(ot.PAN_END,this.controllerPanEndHandler),this.controller.addEventListener(ot.WHEEL_START,this.controllerWheelStartHandler),this.controller.addEventListener(ot.WHEEL_END,this.controllerWheelEndHandler),this.controller.addEventListener(ot.PAN_MOVE,this.controllerPanMoveHandler),this.controller.addEventListener(ot.POINTEROVER,this.controllerPointerOverHandler),this.multiSelector.addEventListener(Yu.SELECTED,this.multiSelectorSelectedHandler)}unbindControllerEvents(){this.controller.removeEventListener(ot.PAN_START,this.controllerPanStartHandler),this.controller.removeEventListener(ot.PAN_END,this.controllerPanEndHandler),this.controller.removeEventListener(ot.WHEEL_START,this.controllerWheelStartHandler),this.controller.removeEventListener(ot.WHEEL_END,this.controllerWheelEndHandler),this.controller.removeEventListener(ot.PAN_MOVE,this.controllerPanMoveHandler),this.controller.removeEventListener(ot.POINTEROVER,this.controllerPointerOverHandler),this.multiSelector.removeEventListener(Yu.SELECTED,this.multiSelectorSelectedHandler)}handlePanStart(t){if(!((t==null?void 0:t.type)!==ot.PAN_START&&(t==null?void 0:t.type)!==ot.WHEEL_START)&&this.zoomToSelectEnable){this.p1.copy(t.data.screenCoords),Xt.makeEmpty().expandByPoint(this.p1),this.graph.draw(Xt);return}}handlePanEnd(t){if(!((t==null?void 0:t.type)!==ot.PAN_END&&(t==null?void 0:t.type)!==ot.WHEEL_END)&&this.zoomToSelectEnable){this.p2.copy(t.data.screenCoords),Xt.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2).unproject(this.controller.camera),this.setByBox(Xt),this.graph.hide(),Xt.makeEmpty();return}}handleControllerPanMove(t){(t==null?void 0:t.type)===ot.PAN_MOVE&&this.zoomToSelectEnable&&(this.p2.copy(t.data.screenCoords),Xt.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2),this.graph.draw(Xt))}handleControllerPointerOver(t){var a,o,l,c,f;const e=((a=t==null?void 0:t.e)==null?void 0:a.target)||((l=(o=t==null?void 0:t.e)==null?void 0:o.srcEvent)==null?void 0:l.target);let i=e==null?void 0:e.id;(i==null?void 0:i.indexOf("dummy"))>-1?(i=e.getAttribute(as+"-id"),i&&this._currentAssetId!==i&&this.dispatchEvent({type:"POINTEROVER",data:{id:i,assetType:"dummy"},e:t.e})):i&&((c=this.scene)!=null&&c.isBelongsToAssetType(i,$e.WS))?this._currentAssetId!==i&&this.dispatchEvent({type:"POINTEROVER",data:{id:i,assetType:$e.WS},e:t.e}):i&&((f=this.scene)!=null&&f.isBelongsToAssetType(i,$e.RM))?this._currentAssetId!==i&&this.dispatchEvent({type:"POINTEROVER",data:{id:i,assetType:$e.RM},e:t.e}):(this._currentAssetId=void 0,this.dispatchEvent({type:"POINTERLEAVE",e:t.e})),this._currentAssetId=i}handleMultiSelectorSelected(t){console.warn("handleMultiSelectorSelected:",t.data),this.dispatchEvent({type:"SELECTED",data:t.data})}setDummies(t){this.dummiesController.setDummiesByVos(t)}clearDummies(t){this.dummiesController.clearDummies(t)}update(t){this.tween&&this.tween.update(t)}}const Xt=new St,Nn=new F,yl=new F;var Mn=(r=>(r.SELECTED="SELECTED",r.POINTEROVER="POINTEROVER",r.POINTERLEAVE="POINTERLEAVE",r))(Mn||{});class Bm extends Ge{name="SvgApp";params;renderer;view;scene;loadingScene;mainScene;zoomToSelectEnable=!1;zoomBox=new St;selectEnable=!1;multiSelectEnable=!1;runningHandler=this.running.bind(this);pointerOverHandler=this.handlePointerOver.bind(this);pointerLeaveHandler=this.handlePointerLeave.bind(this);multiSelectorSelectedHandler=this.handleMultiSelectorSelected.bind(this);dragEndHandler=this.handleDragEnd.bind(this);constructor(t={}){super(),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=Wt.getMoreTransparent($t.white,.3)),this.params.defaultStroke||(this.params.defaultStroke=Wt.getMoreTransparent($t.darkWhite,.8)),this.params.infoFill||(this.params.infoFill=Wt.getMoreTransparent($t.gray,.3)),this.params.infoStroke||(this.params.infoStroke=Wt.getMoreTransparent($t.darkGray,.8)),this.params.primaryFill||(this.params.primaryFill=Wt.getMoreTransparent($t.blue,.3)),this.params.primaryStroke||(this.params.primaryStroke=Wt.getMoreTransparent($t.darkBlue,.8)),this.params.successFill||(this.params.successFill=Wt.getMoreTransparent($t.green,.3)),this.params.successStroke||(this.params.successStroke=Wt.getMoreTransparent($t.darkGreen,.8)),this.params.warningFill||(this.params.warningFill=Wt.getMoreTransparent($t.yellow,.3)),this.params.warningStroke||(this.params.warningStroke=Wt.getMoreTransparent($t.darkYellow,.8)),this.params.dangerFill||(this.params.dangerFill=Wt.getMoreTransparent($t.red,.3)),this.params.dangerStroke||(this.params.dangerStroke=Wt.getMoreTransparent($t.darkRed,.8)),this.params.activeFill||(this.params.activeFill=Wt.getMoreTransparent($t.brown,.3)),this.params.activeStroke||(this.params.activeStroke=Wt.getMoreTransparent($t.darkBrown,.8)),this.renderer=new _0(t),this.view=new Mm(t),this.trans2LoadingScene()}get isLoadingScene(){var t;return((t=this.scene)==null?void 0:t.name)==="SvgLoadingScene"}destroy(){var t,e;this.unbindAssetsEvents(),super.destroy(),(t=this.view)==null||t.destroy(),(e=this.renderer)==null||e.destroy()}resize(){var t,e;(t=this.renderer)==null||t.resize(),(e=this.view)==null||e.resize()}isScene(t){var e;return((e=this.scene)==null?void 0:e.uuid)===t.uuid}removeScene(t){this.scene=void 0,t==null||t.destroy()}trans2MainScene(){var t,e;(t=this.scene)==null||t.unmount(),this.scene=this.mainScene,this.scene.isMounted||this.scene.mount(),this.view.bindScene(this.scene),(e=this.loadingScene)==null||e.destroy()}trans2LoadingScene(){var e,i;console.log("trans2LoadingScene: ",this.params),this.loadingScene=new M2(this.params),(e=this.scene)==null||e.unmount(),this.scene=this.loadingScene,this.scene.isMounted||this.scene.mount();const t=new St().copy(this.loadingScene.viewBox).expandByVector(new F(1,1).multiplyScalar(150));console.log("trans2LoadingScene: ",t.toString()),this.view.setByBox(t,!1),(i=this.mainScene)==null||i.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))}async load(t,e={},i,a=2,o){this.isLoadingScene||this.trans2LoadingScene(),await Dc(this.params.syncDelay);const l=await new Uc().setRequestHeader(e).loadAsync(t);return this.loadByString(l,i,a)}loadByString(t,e,i=2){this.mainScene=new pf(this.params),this.mainScene.bind(t),this.view.setByBox(this.mainScene.viewBox);const a=this.mainScene.getLayers(i);return e!=null&&e.length||(e=Mt.map(a,"label")),this.mainScene.showDefaultLayers(e,!0),this.trans2MainScene(),this.bindAssetsEvents(),console.log("svgApp.loadByString: ",a),a}setSkeletons(t){var e;(e=this.scene)==null||e.setSkeletonLayers(t)}getLayers(t=2){var e;return(e=this.scene)==null?void 0:e.getLayers(t)}updateLayersVisibility(t,e=!1){var i;(i=this.scene)==null||i.updateLayersVisibility(t,e)}selectByIds(t){var e;(e=this.scene)==null||e.selectByIds(t,this.multiSelectEnable)}clearSelectedByIds(t){var e;Array.isArray(t)?t.forEach(i=>{var a;return(a=this.scene)==null?void 0:a.clearSelectedById(i)}):(e=this.scene)==null||e.clearSelectedById(t)}clearSelected(){var t;(t=this.scene)==null||t.clearSelected()}getSelectedIds(){var t;return(t=this.scene)==null?void 0:t.getSelectedIds()}async targetByIds(t,e=100){var i;this.scene&&((i=this.scene)==null||i.selectByIds(t,!1),ml.copy(this.scene.getSelectedBoundingBox()).expandByVector(new F(1,1).multiplyScalar(e)),await Dc(100),ml.isEmpty()||await this.view.setByBox(ml))}linkAssetsByTree(t){var e;(e=this.scene)==null||e.linkAssetsByTree(t)}setViewAreaLimit(t){this.renderer.viewAreaLimit=t}setAssetType(t,e){var i;(i=this.scene)==null||i.setAssetType(t,e)}getAssetIdsByType(t){var e;return(e=this.scene)==null?void 0:e.getAssetIdsByType(t)}clearFill(){var t;(t=this.scene)==null||t.clearFillOrStroke("fill")}clearFillByIds(t){var e;(e=this.scene)==null||e.clearFillOrStrokeByIds(t,"fill")}setFillByIds(t,e){var i;(i=this.scene)==null||i.setFillOrStrokeByIds(t,e,"fill")}clearStroke(){var t;(t=this.scene)==null||t.clearFillOrStroke("stroke")}clearStrokeByIds(t){var e;(e=this.scene)==null||e.clearFillOrStrokeByIds(t,"stroke")}setStrokeByIds(t,e){var i;(i=this.scene)==null||i.setFillOrStrokeByIds(t,e,"stroke")}getLegend(){var t;return(t=this.scene)==null?void 0:t.getLegend()}setAssetLabels(t,e){var i;(i=this.scene)==null||i.setAssetLabels(t,e)}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,e=1e3){var i;(i=this.view)==null||i.focusAt(t,e)}async focusAtById(t,e=1e3){var i;return(i=this.view)==null?void 0:i.focusAtById(t,e)}async focusAtDummy(t,e=1e3){var i;return(i=this.view)==null?void 0:i.focusAtDummy(t,e)}showAssetsLabel(t,e,i){var a,o,l,c;e?t==="dummy"?(l=(o=(a=this.view)==null?void 0:a.dummiesController)==null?void 0:o.dummies)==null||l.showDummyLabel(e):(c=this.view)==null||c.showAssetsLabel(t,e,i):this.hideAssetsLabel()}hideAssetsLabel(){var t,e,i,a;(i=(e=(t=this.view)==null?void 0:t.dummiesController)==null?void 0:e.dummies)==null||i.hideDummyLabel(),(a=this.view)==null||a.hideAssetsLabel()}highlightAssets(t,e){var i;(i=this.scene)==null||i.highlightAssets(t,e)}resetHighlightAssets(t){var e;(e=this.scene)==null||e.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 e;(e=this.scene)==null||e.socialDistanceEnableChanged(t)}getBoundingBoxById(t,e=!0){var a;if(!t)return;const i=(a=this.scene)==null?void 0:a.getBoundingBoxById(t);return i&&e&&i.applyMatrix3(this.view.camera.viewMatrix).round(),i}setDummies(t){var e;(e=this.view)==null||e.setDummies(t)}clearDummies(t){var e;(e=this.view)==null||e.clearDummies(t)}highlightDummies(t){var e,i;(i=(e=this.view)==null?void 0:e.dummiesController)==null||i.highlightDummies(t)}resetHighlightDummies(){var t,e;(e=(t=this.view)==null?void 0:t.dummiesController)==null||e.resetHighlightDummies()}bindAssetsEvents(){var t,e;this.view.addEventListener(Mn.POINTEROVER,this.pointerOverHandler),this.view.addEventListener(Mn.POINTERLEAVE,this.pointerLeaveHandler),this.view.addEventListener(Mn.SELECTED,this.multiSelectorSelectedHandler),(e=(t=this.view)==null?void 0:t.dummiesController)==null||e.addEventListener("panend",this.dragEndHandler)}unbindAssetsEvents(){var t,e;this.view.removeEventListener(Mn.POINTEROVER,this.pointerOverHandler),this.view.removeEventListener(Mn.POINTERLEAVE,this.pointerLeaveHandler),this.view.removeEventListener(Mn.SELECTED,this.multiSelectorSelectedHandler),(e=(t=this.view)==null?void 0:t.dummiesController)==null||e.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 ...")}async handleInitializeComplete(t){console.log("App.initializeComplete ...",t),t!=null&&t.data&&this.launch()}handleDragEnd(t){this.dispatchEvent(t)}launch(){console.log("App.launch ...")}}const ml=new St;var op=(r=>(r.SELECTED="SELECTED",r.POINTEROVER="pointerover",r.POINTERLEAVE="pointerleave",r.DRAG_END="panend",r))(op||{}),Dt=(r=>(r.INIT="init",r.LOAD="load",r.LOADED="loaded",r.GET_LAYERS="getLayers",r.GET_ASSET_IDS_BY_TYPE="getAssetIdsByType",r.SET_FILL_BY_IDS="setFillByIds",r.CLEAR_FILL="clearFill",r.SET_STROKE_BY_IDS="setStrokeByIds",r.CLEAR_STROKE="clearStroke",r.TERMINATE="terminate",r.CAMERA_SYNC="cameraSync",r.ASSET_TYPE_CHANGED="assetTypeChanged",r.SVG_LOADING_TYPE_CHANGED="svgLoadingTypeChanged",r.USED_CACHE_CHANGED="usedCacheChanged",r.DEBOUNCE_CACHE_CHANGED="debounceCacheChanged",r.WIREFRAME_CHANGED="wireframeChanged",r.BG_PASS_CHANGED="bgPass",r.SELECT_ENABLE_CHANGED="selectEnableChanged",r.MULTI_SELECT_ENABLE_CHANGED="multiSelectEnableChanged",r.MULTI_SELECT_BY_RANGE="multiSelectByRange",r.ZOOM_TO_SELECT_ENABLE_CHANGED="zoomToSelectEnableChanged",r.FONT_ZOOM_IN="fontZoomIn",r.FONT_ZOOM_OUT="fontZoomOut",r.CAMERA_CHANGED="cameraChanged",r.SCENES_CHANGED="scenesChanged",r.UPDATE_LAYERS_VISIBILITY="updateLayersVisibility",r.DYNAMIC_LOADED="dynamicLoaded",r.SYNC_TEXTURE_HELPER_CACHED="syncTextureHelperCached",r.INITIALIZATION_START="INITIALIZATION_START",r.INITIALIZATION_COMPLETE="INITIALIZATION_COMPLETE",r.SELECTED="selected",r.SELECT_BY_IDS="selectByIds",r.CLEAR_SELECTED="clearSelected",r.TARGET_BY_IDS="targetByIds",r.TAP="tap",r.SINGLE_TAP="singletap",r.DOUBLE_TAP="doubletap",r.PRESS="press",r.PAN="pan",r.PAN_START="panstart",r.PAN_MOVE="panmove",r.PAN_END="panend",r.ROTATE="rotate",r.ROTATE_START="rotatestart",r.ROTATE_MOVE="rotatemove",r.ROTATE_END="rotateend",r.PINCH="pinch",r.PINCH_START="pinchstart",r.PINCH_MOVE="pinchmove",r.PINCH_END="pinchend",r.PINCH_IN="pinchin",r.PINCH_OUT="pinchout",r.SWIPE="swipe",r))(Dt||{});class Im extends Nm{name="OpeView";container;graph;zoomToSelectEnable;multiSelectEnable;rayCaster=new xf;intersects=[];controllerPanStartHandler=this.handlePanStart.bind(this);controllerPanEndHandler=this.handlePanEnd.bind(this);controllerPanMoveHandler=this.handleControllerPanMove.bind(this);controllerPointerOverHandler=this.handleControllerPointerOver.bind(this);constructor(t={}){super(t),this.container=this.params.cvs?this.params.cvs:this.params.canvasId?document.getElementById(this.params.canvasId):kt.window.document.getElementsByTagName("body")[0],console.warn("opeView.constructor: ",this.container,this.container.tagName),this.controller=new yf(this.container,this.camera),this.bindControllerEvents();let e=this.container.tagName.toLowerCase()!=="body"?this.container.parentNode:this.container;this.graph=new zu(e)}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(ot.PAN_START,this.controllerPanStartHandler),this.controller.addEventListener(ot.PAN_END,this.controllerPanEndHandler),this.controller.addEventListener(ot.PAN_MOVE,this.controllerPanMoveHandler),this.controller.addEventListener(ot.POINTEROVER,this.controllerPointerOverHandler)}unbindControllerEvents(){this.controller.removeEventListener(ot.PAN_START,this.controllerPanStartHandler),this.controller.removeEventListener(ot.PAN_END,this.controllerPanEndHandler),this.controller.removeEventListener(ot.PAN_MOVE,this.controllerPanMoveHandler),this.controller.removeEventListener(ot.POINTEROVER,this.controllerPointerOverHandler)}handlePanStart(t){(t==null?void 0:t.type)!==ot.PAN_START&&(t==null?void 0:t.type)!==ot.WHEEL_START||(this.zoomToSelectEnable||this.multiSelectEnable)&&(xo.copy(t.data.screenCoords),tn.makeEmpty().expandByPoint(xo),this.graph.draw(tn))}async handlePanEnd(t){(t==null?void 0:t.type)!==ot.PAN_END&&(t==null?void 0:t.type)!==ot.WHEEL_END||((this.zoomToSelectEnable||this.multiSelectEnable)&&(Eo.copy(t.data.screenCoords),tn.makeEmpty().expandByPoint(xo).expandByPoint(Eo).unproject(this.controller.camera),this.graph.hide()),this.zoomToSelectEnable&&await this.resetCameraByBoundingBox(tn,!0),this.multiSelectEnable&&this.dispatchEvent({type:Dt.MULTI_SELECT_BY_RANGE,data:tn.clone()}),tn.makeEmpty())}handleControllerPanMove(t){(t==null?void 0:t.type)===ot.PAN_MOVE&&(this.zoomToSelectEnable||this.multiSelectEnable)&&(Eo.copy(t.data.screenCoords),tn.makeEmpty().expandByPoint(xo).expandByPoint(Eo),this.graph.draw(tn))}handleControllerPointerOver(t){t==null||t.type,ot.POINTEROVER}handleMultiSelectorSelected(t){}handleCameraChanged(t){console.warn("handleCameraChanged: ",t.target.camera.position.z,t.target.camera.scaled.x)}}const xo=new F,Eo=new F,tn=new St;function up(r){return!!(r&&r.constructor&&r.call&&r.apply)}const Rm="children",Lm="get",Pm="set",vl="Changed";class Fm extends Ge{name="Node2";userData={};_cache=new Map;_attachedDepsListeners=new Map;constructor(t){super(),this.setAttrs(t)}destroy(){super.destroy(),this._clearCache()}setAttrs(t){if(!t)return this;let e;for(const i in t)i!==Rm&&(e=Pm+i,up(this[e])?this[e](t[i]):this.setAttr(i,t[i]));return this}setAttr(t,e){Object.hasOwnProperty.call(this,t)&&(this.userData[t]=e,this[t]=e)}getAttrs(){return this.userData||{}}getAttr(t){const e=Lm+Mt.capitalize(t);return up(this[e])?this[e]():this.userData[t]}getAttrKey(){return Object.values(this.userData).filter(t=>!(t instanceof Array||t instanceof Object)).join("_")}_getCache(t,e){let i=this._cache.get(t);return(i===void 0||i.dirty===!0)&&(i=e.call(this),this._cache.set(t,i)),i}_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(e){const i=this.userData[t];this.userData[t]=e,i!==e&&this.dispatchEvent({type:t+vl,data:{oldVal:i,newVal:e}})},enumerable:!0,configurable:!0})}computed(t,e,i){if(!this._attachedDepsListeners.get(t)){const a=e.map(o=>o+vl).join(",");this.addEventListeners(a,()=>this._clearCache(t)),e.forEach(o=>this._setProperty(o)),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,i)}watch(t,e){(t||[]).forEach(i=>{this._setProperty(i),this.addEventListener(i+vl,e)})}}const Wr=new F;class km extends Fm{isTexture=!0;isRenderTargetTexture=!1;type="Texture";name="Texture";uuid=Lc();originSize=new F;originCenter=new F;size=new F;matrix=new ne;matrixAutoUpdate=!0;userData={};version=0;_needsUpdate=!1;image;offset=new F;repeat=new F(1,1);center=new F;rotate=0;scale=1;flipY=!0;constructor(t={}){super(t),this.setAttrs(t)}destroy(){super.destroy()}set needsUpdate(t){t&&(this.version++,this._needsUpdate=!0)}get needsUpdate(){return this._needsUpdate}updateSize(t,e,i,a){return this.originSize.copy(t),this.originCenter.copy(e),this.flipY&&this.originCenter.multiplyScalar(1,-1),this.updateFinalSize(i,a)}updateFinalSize(t,e){t&&!F.isZero(t)&&!F.isEmpty(t)?Wr.copy(t):Wr.copy(this.originSize),Wr.maxXY(1,1);const i=Math.sqrt(Wr.x*Wr.x+Wr.y*Wr.y)/Math.sqrt(e.x*e.x+e.y*e.y);return i>1&&Wr.multiplyScalar(1/i),this.scale=Wr.length()/this.originSize.length(),this.repeat.multiplyScalar(this.originSize.length()/Wr.length()),this.size.copy(Wr),this.offset.copy(this.originSize).multiplyScalar(-.5).add(this.originCenter),this.updateMatrix(),this}reset(t,e){t&&this.originSize.copy(t),e&&this.size.copy(e),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}}class en{static cached=new Map;static precisionOptimized=!0;static precisionOptimizeLevels=[.5,.25,1e-4];static initialized=!1;static textureMaxSize=new F;static DEBUG_DisplayCachedTexture=Mt.throttle((t=80,e=.8)=>{let i=Um();if(i||(i=qm(t,e)),!i)throw new Error("dom not found");Wm(i,this.cached)},5e3);static destroy(){Object.values(this.cached).forEach(t=>{t.destroy()}),this.cached=new Map}static has(t){return this.cached.has(t)}static get(t,e){if(t)return!this.precisionOptimized||!e?this.cached.get(t):e&&e<this.precisionOptimizeLevels[2]?this.get(t+"_3"):e&&e<this.precisionOptimizeLevels[1]?this.get(t+"_2"):e&&e<this.precisionOptimizeLevels[0]?this.get(t+"_1"):this.get(t)}static set(t,e){if(!t||!e)throw new Error("error input");return this.cached.set(t,e),e}static remove(t){if(!t||!this.cached.has(t))return;const e=this.cached.get(t);if(e&&e.destroy(),this.cached.delete(t),this.precisionOptimized)for(let i=1,a=this.precisionOptimizeLevels.length;i<=a;i++){const o=t+"_"+i;let l;this.cached.has(o)&&(l=this.cached.get(o),l&&l.destroy(),this.cached.delete(o))}}static clear(){this.destroy()}static setTextureMaxSize(){this.initialized||(this.textureMaxSize.set(kt.config.width,kt.config.height).multiplyScalar(.5).round(),this.initialized=!0)}static getTextureMaxSize(){return this.initialized||this.setTextureMaxSize(),this.textureMaxSize}static getTextureByShape(t,e,i,a){var l;const o=new km;if(this.setTextureMaxSize(),o.scale=1,o.repeat.set(1,1),o.rotate=0,o.image=void 0,o.version=0,console.warn("getTextureByShape: ============================",t.name),e&&!F.isZero(e)&&!F.isEmpty(e))ma.copy(e),t.alignCenter?t.boundingBox.getCenter(va):va.set(0,0);else{if(t.isShape&&((l=t.geometry)!=null&&l.boundingBox))wo.copy(t.geometry.boundingBox);else if(t.boundingBox)wo.copy(t.boundingBox);else throw new Error("get boundingBox error");wo.getSize(ma),t.alignCenter?t.boundingBox.getCenter(va):wo.getCenter(va)}return i&&!F.isZero(i)&&!F.isEmpty(i)?Ci.copy(i):Ci.copy(ma),(Ci.x<lp.x||Ci.y<lp.y)&&Ci.normalize().multiplyScalar(10).round(),ai.copy(this.getTextureMaxSize()),a&&(xa.set((a==null?void 0:a.shadowBlur)||0,(a==null?void 0:a.shadowBlur)||0),Ci.add(xa.clone().multiplyScalar(2)),ma.multiplyScalar(3),ai.multiplyScalar(.3)),o.updateSize(ma,va,Ci,ai),o}static setPrecisionOptimizeTextures(t,e,i,a,o){if(!this.precisionOptimized)return;let l;for(let c=0,f=this.precisionOptimizeLevels.length;c<f;c++){ai.copy(i.size).multiplyScalar(this.precisionOptimizeLevels[c]);const d=this.getTextureByShape(e,a,ai,o);this.renderShapeTexture(e,d,o),l=t+"_"+(c+1),d.userData.textureKey=l,en.set(l,d)}}static renderShapeTexture(t,e,i){i?(xa.set(i.shadowBlur||0,i.shadowBlur||0),si.copy(e.originSize).multiplyScalar(-.5).sub(e.originCenter).multiplyScalar(e.scale),t.alignCenter?Ao.copy(e.originSize).multiplyScalar(e.scale):Ao.copy(e.originSize).add(xa.clone().multiplyScalar(1)).multiplyScalar(e.scale)):si.copy(e.offset).negate().multiplyScalar(e.scale);const a=wi.create(e.size.x,e.size.y),o=wi.getContext2D(a,{alpha:!0});if(t.isText||!t.matrix.hasChange())o.clearRect(0,0,a.width,a.height),o.translate(si.x,si.y),o.scale(e.scale,-e.scale);else{t.matrix.decompose(hp,Hm,cp);const l=1/cp.x;si.sub(hp.multiplyScalar(l,-l)),o.clearRect(0,0,a.width,a.height),o.translate(si.x,si.y),o.scale(l,-l)}i&&(o.shadowColor=$t.black,o.shadowOffsetX=Ao.x,o.shadowOffsetY=Ao.y,o.shadowBlur=xa.x),t.render(o),e.image=a}static setByShape(t,e,i,a){const o=this.getTextureByShape(e,i,a);return o.userData.textureKey=t,this.renderShapeTexture(e,o),en.set(t,o),e.featureKey=t,o}static setShadowByShape(t,e,i){const a=this.getTextureByShape(e,void 0,void 0,i);return a.userData.textureKey=t,this.renderShapeTexture(e,a,i),en.set(t,a),a}static setPointsByShape(t,e){var d,g,E,T,C;const i=[];e.isGroup?e.traverse(L=>L.isShape?i.push(...L.geometry.points):void 0):e.isShape&&e.geometry.points?i.push(...e.geometry.points):e.boundingBox&&i.push(e.boundingBox.min,e.boundingBox.max);const a=this.getTextureByShape(e),o=((d=e.material)==null?void 0:d.lineWidth)*2||3;Di.set(1,1).multiplyScalar(o),a.size.copy(Di).multiplyScalar(a.scale).multiplyScalar(2).add(Ci),a.offset.sub(Di),a.updateMatrix();const l=wi.create(a.size.x,a.size.y),c=wi.getContext2D(l,{alpha:!0});si.subVectors(a.originSize.clone().multiplyScalar(.5),a.originCenter).add(Di),c.clearRect(0,0,l.width,l.height),c.scale(a.scale,a.scale),c.translate(si.x,si.y);let f=$t.black;e.material?f=((g=e.material)==null?void 0:g.stroke)||((E=e.material)==null?void 0:E.fill):e.isGroup&&e.children.length&&e.children[0].isShape&&(f=((T=e.children[0].material)==null?void 0:T.stroke)||((C=e.children[0].material)==null?void 0:C.fill)),c.fillStyle=Wt.getDarken(f);for(let L=0,N=i.length||0;L<N;L++)ai.copy(i[L]),c.moveTo(ai.x,ai.y),c.arc(ai.x,ai.y,Di.x,0,Math.PI*2);return c.fill(),a.image=l,en.set(t,a),a}static setWireframeByShape(t,e){var c;const i=this.getTextureByShape(e);Di.set(1,1).multiplyScalar(((c=e.mat)==null?void 0:c.lineWidth)||1),i.size.copy(Di).multiplyScalar(i.scale).multiplyScalar(2).add(Ci),i.offset.sub(Di),i.updateMatrix();const a=wi.create(i.size.x,i.size.y),o=wi.getContext2D(a,{alpha:!0}),l=Di.x*i.scale*5;return o.clearRect(0,0,a.width,a.height),o.strokeStyle=$t.darkGray,o.lineWidth=l,o.setLineDash([l*3,l]),o.strokeRect(0,0,i.size.x,i.size.y),i.image=a,en.set(t,i),i}}const lp=new F(10,10),ma=new F,va=new F,Ci=new F,si=new F,Ao=new F,xa=new F,ai=new F,Di=new F,wo=new St,hp=new F,Hm=new F,cp=new F;function Um(){return window.document.getElementById("DEBUG_Displaycached")}function qm(r=80,t=.8){const e=document.createElement("div");function i(){e.style.opacity="1"}function a(){e.style.opacity=t.toString()}return e.setAttribute("id","DEBUG_Displaycached"),e.style.position="absolute",e.style.width=r+"px",e.style.height="92vh",e.style.background=`rgba(255, 255, 255, ${t})`,e.style.left="20px",e.style.top="20px",e.style.overflow="auto",e.style.padding="6px",e.style.opacity=t.toString(),e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",a),document.body.appendChild(e),e}function Wm(r,t){t.forEach((e,i)=>{!e||!e.image||Vm(r,i,e)})}function Vm(r,t,e){let i;for(let a=0,o=r.childNodes.length;a<o;a++)if(r.childNodes[a].getAttribute("id")===t){i=r.childNodes[a];break}i?$m(i,e):zm(r,t,e)}function zm(r,t,e){if(!e.image)return;const i=kt.document.createElement("div");i.setAttribute("id",t),i.style.display="flex",i.style.flexDirection="column";const a=wi.createCanvas({containerId:r.id,width:e.image.width,height:e.image.height,dpr:window.devicePixelRatio});a.style.border=`${$t.yellow} 1px solid`,a.style.maxWidth=parseInt(r.style.width)-2+"px",a.style.maxHeight=parseInt(a.style.maxWidth)/(e.image.width/e.image.height)+"px";const o=a.getContext("2d",{alpha:!0});if(!o)throw new Error("getContext error");o.save(),o.scale(window.devicePixelRatio,window.devicePixelRatio),o.drawImage(e.image,0,0),o.restore(),i.appendChild(a);const l=kt.document.createElement("p");l.innerHTML=e.image.width+" * "+e.image.height,l.innerHTML+="<br/>"+t,l.style.margin="0",l.style.padding="0",l.style.lineHeight="1.2",l.style.fontSize="10px",l.style.padding="3px 0 6px 0",l.style.color=$t.black,i.appendChild(l),r.appendChild(i);function c(){const f=a.toDataURL("image/png",.6),d=document.createElement("a"),g=new MouseEvent("click");d.download=`thumb.${Date.now()}.png`,d.href=f,d.dispatchEvent(g)}i.addEventListener("click",c)}function $m(r,t){if(!t.image)return;const e=r.querySelector("canvas");if(!e)return;const i=e.getContext("2d",{alpha:!0});if(!i)throw new Error("getContext error");i.clearRect(0,0,e.width,e.height),i.save(),i.scale(window.devicePixelRatio,window.devicePixelRatio),i.drawImage(t.image,0,0),i.restore()}class Gm extends Ge{cvs;worker;view;boundingBox=new St;viewTapHandler=this.handleViewTap.bind(this);multiSelectByRangeHandler=this.handleMultiSelectByRange.bind(this);workerMessageHandler=this.handleWorkerMessage.bind(this);cameraHandler=this.handleCameraChanged.bind(this);runningHandler=this.running.bind(this);constructor(t={},e){super(),t.workerRender=!0,this.params=t,kt.config=t;const i=wi.createCanvas(t);if(!i.transferControlToOffscreen)throw new Error("not support transferControlToOffscreen");this.cvs=i.transferControlToOffscreen(),this.view=new Im(t),this.view.camera.name="mainCamera",this.view.camera.resize(),this.worker=e,this.bindEvents()}destroy(){super.destroy(),this.unbindEvents(),this.worker.postMessage({task:Dt.TERMINATE}),this.worker.terminate()}bindEvents(){var t,e,i,a,o;(e=(t=this.view)==null?void 0:t.controller)==null||e.addEventListener(ot.TAP,this.viewTapHandler),(i=this.view)==null||i.addEventListener(Dt.MULTI_SELECT_BY_RANGE,this.multiSelectByRangeHandler),(o=(a=this.view)==null?void 0:a.camera)==null||o.addEventListener(lo.UPDATE,this.cameraHandler),this.worker.addEventListener("message",this.workerMessageHandler)}unbindEvents(){var t,e,i,a;(e=(t=this.view)==null?void 0:t.controller)==null||e.removeEventListener(ot.TAP,this.viewTapHandler),(a=(i=this.view)==null?void 0:i.controller)==null||a.removeEventListener(ot.CAMERA_CHANGED,this.cameraHandler),this.worker.removeEventListener("message",this.workerMessageHandler)}async handleViewTap(t){if((t==null?void 0:t.type)!==ot.TAP)return;const e=await this.promiseWorkerResponse(Dt.TAP,t.data);this.dispatchEvent({type:Dt.SELECTED,data:e})}handleWorkerMessage(t){var e,i,a,o,l,c;switch(t.data.task){case Dt.CAMERA_SYNC:if(!((e=t==null?void 0:t.data)!=null&&e.data))break;const f=JSON.parse(t.data.data);(a=(i=this.view)==null?void 0:i.camera)==null||a.fromJSON(f),this.view.camera.computeBoundingBox();break;case Dt.CAMERA_CHANGED:const{t:d,r:g,s:E}=t.data.data;(l=(o=this.view)==null?void 0:o.camera)==null||l.setTRS(d,g,E);break;case Dt.SCENES_CHANGED:const{box:T}=t.data.data;if(!T)return;this.boundingBox.fromString(T);break;case"syncTextureHelperCached":(((c=t.data)==null?void 0:c.data)||[]).forEach((C,L)=>en.set(L,C));break;case"pong":console.log("response: pong");break}}handleCameraChanged(t){this.worker.postMessage({task:Dt.CAMERA_CHANGED,data:t.data})}promiseWorkerResponse(t,e){return new Promise((i,a)=>{const o=c=>{var f;((f=c==null?void 0:c.data)==null?void 0:f.task)===t&&(this.worker.removeEventListener("message",o),this.worker.removeEventListener("error",l),i(c.data.data))},l=c=>{this.worker.removeEventListener("message",o),this.worker.removeEventListener("error",l),a(c.error)};this.worker.addEventListener("message",o),this.worker.addEventListener("error",l),this.worker.postMessage({task:t,data:e})})}async handleMultiSelectByRange(t){return this.promiseWorkerResponse(Dt.MULTI_SELECT_BY_RANGE,t.data)}resize(){var t;(t=this.view.camera)==null||t.resize()}async load(t,e){return this.promiseWorkerResponse(Dt.LOAD,{url:t,layers:e})}async getLayers(t=2){return this.promiseWorkerResponse(Dt.GET_LAYERS,{lv:t})}assetTypeChanged(t=$e.RM){this.params.assetType=t,this.worker.postMessage({task:Dt.ASSET_TYPE_CHANGED,data:t})}usedCacheChanged(t=!1){this.params.usedCache=t,this.worker.postMessage({task:Dt.USED_CACHE_CHANGED,data:t})}debounceCacheChanged(t=!1){this.params.debounceCache=t,this.worker.postMessage({task:Dt.DEBOUNCE_CACHE_CHANGED,data:t})}wireframeChanged(t=!1){this.params.wireframe=t,this.worker.postMessage({task:Dt.WIREFRAME_CHANGED,data:t})}bgPassChanged(t=!1){this.params.bgPass=t,this.worker.postMessage({task:Dt.BG_PASS_CHANGED,data:t})}async selectEnableChanged(t=!1){await this.clearSelected(),this.params.selectEnable=t,this.worker.postMessage({task:Dt.SELECT_ENABLE_CHANGED,data:t})}async multiSelectEnableChanged(t=!1){await this.clearSelected(),this.params.multiSelectEnable=t,this.view.multiSelectEnableChanged(t),this.worker.postMessage({task:Dt.MULTI_SELECT_ENABLE_CHANGED,data:t})}async zoomToSelectEnableChanged(t=!1){return this.params.zoomToSelectEnable=t,this.view.zoomToSelectEnableChanged(t),this.promiseWorkerResponse(Dt.ZOOM_TO_SELECT_ENABLE_CHANGED,{data:t})}async svgLoadingTypeChanged(t){return this.params.svgLoadingType=t,this.promiseWorkerResponse(Dt.SVG_LOADING_TYPE_CHANGED,t)}async fullscreen(){await 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,e=!1){this.worker.postMessage({task:Dt.UPDATE_LAYERS_VISIBILITY,data:{ids:t,visible:e}})}clearSelected(t){return this.promiseWorkerResponse(Dt.CLEAR_SELECTED,{data:t})}selectByIds(t){this.worker.postMessage({task:Dt.SELECT_BY_IDS,data:t})}targetByIds(t){this.worker.postMessage({task:Dt.TARGET_BY_IDS,data:t})}async getAssetIdsByType(t){return this.promiseWorkerResponse(Dt.GET_ASSET_IDS_BY_TYPE,{assetType:t})}setFillByIds(t,e){this.worker.postMessage({task:Dt.SET_FILL_BY_IDS,data:{ids:t,c:e}})}clearFill(){this.worker.postMessage({task:Dt.CLEAR_FILL})}setStrokeByIds(t,e){this.worker.postMessage({task:Dt.SET_STROKE_BY_IDS,data:{ids:t,c:e}})}clearStroke(){this.worker.postMessage({task:Dt.CLEAR_STROKE})}async fontZoomIn(t=1.1){return this.promiseWorkerResponse(Dt.FONT_ZOOM_IN,t)}async fontZoomOut(t=.9){return this.promiseWorkerResponse(Dt.FONT_ZOOM_OUT,t)}start(){const t=this.cvs,e=JSON.stringify(this.params);this.worker.postMessage({task:Dt.INIT,data:{cvs:t,config:e}},[t]),requestAnimationFrame(this.runningHandler)}running(t){var e;(e=this.view)==null||e.update(t),requestAnimationFrame(this.runningHandler),en.DEBUG_DisplayCachedTexture()}stop(){}}function Ym(r){return new Worker("/environment.worker.js",{type:"module",name:r==null?void 0:r.name})}function Xm(r){return new Worker("/renderer.worker.js",{type:"module",name:r==null?void 0:r.name})}ce.AppEnum=op,ce.AppOffscreen=Gm,ce.AssetTypeEnum=$e,ce.Box2=l0,ce.Color=Wt,ce.ColorsEnum=$t,ce.EnvironmentWorker=Ym,ce.GLOB=kt,ce.LayerTypeEnum=Ks,ce.Monitor=Ft,ce.RendererWorker=Xm,ce.SvgApp=Bm,ce.Vector2=o0,ce.defaultConfig=Zn,Object.defineProperty(ce,Symbol.toStringTag,{value:"Module"})});
72
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var c=a.reduce(function(f,d){var g=d&&fm(d,i);return g&&f.push(g),f},[]);return pa(r)?c[0]:c}ga.defaultProps=ar,ga.setDefaultProps=um,ga.currentInput=ii,Object.assign({},bf,{effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow)}}),ga.setDefaultProps({render:sp});let pm=0;const ji=ga(document.body,{theme:"translucent",animation:"scale",inertia:!0,delay:[200,100],content:"",allowHTML:!0,placement:"left-start",trigger:"manual",arrow:!0});class cl{constructor(t,e){this.container=t,this.text=e,t?this.container=t:this.container=document.getElementsByTagName("body")[0],this.text=e}name="Label";id="Label"+pm++;el;position=new F;get isMounted(){return ji.state.isMounted}get isShown(){return ji.state.isShown}destroy(){this.text="",this.position.identity()}setHtml(t=""){return this.text=t,this}update(t){t&&(this.position.copy(t),ji.show())}async show(t){if(t)return await this.hide(),this.position.copy(t),ji.setContent(this.text),ji.setProps({getReferenceClientRect:()=>({width:0,height:0,right:this.position.x,left:this.position.x,bottom:this.position.y,top:this.position.y,x:this.position.x,y:this.position.y,toJSON(){}})}),ji.clearDelayTimeouts(),ji.show(),new Promise(e=>{Mt.delay(function(){e()},300)})}async hide(){return ji.hide(),new Promise(t=>{Mt.delay(function(){t()},100)})}}let dm=0;class gm extends Ge{name="DummyPoint";id="dummyPoint"+dm++;container;offset=new F;el;label;radius=10;position=new F;worldPosition=new F;userData;constructor(t,e){var a,o;super(),t?this.container=t:this.container=document.getElementsByTagName("body")[0];let i=this.container.getBoundingClientRect();this.offset.set(i.left,i.top),this.userData=e,(a=this.userData)!=null&&a.type||Mt.set(this,"userData.type",_n.DEFAULT),this.initDom(),this.setType((o=this.userData)==null?void 0:o.type),this.mount(),this.initLabel()}destroy(){var t;super.destroy(),this.unmount(),(t=this.label)==null||t.destroy()}get isMounted(){var t;return!!((t=this.el)!=null&&t.parentNode)}mount(){var t;this.el&&((t=this.el)!=null&&t.parentNode||this.container.appendChild(this.el))}unmount(){var t,e,i,a;(e=(t=this.el)==null?void 0:t.parentNode)==null||e.removeChild(this.el),(i=this.el)==null||i.remove(),(a=this.label)==null||a.hide()}setText(t=""){return this.el?(this.el.innerText=t,this):this}initDom(){var t;this.el=document.createElement("div"),this.el.setAttribute("id",this.id),this.el.setAttribute("class","dummy-point"),this.el.setAttribute(as+"-id",(t=this.userData)==null?void 0:t.value)}initLabel(){var t;(t=this.userData)!=null&&t.label&&(this.label=new cl(this.container,this.userData.label))}setActive(t){return t?(ra(this.el,"active"),this.showLabel()):(ia(this.el,"active"),this.hideLabel()),this}showLabel(){var t;(t=this.label)==null||t.show(ym.copy(this.position).add(this.offset).subScalar(this.radius))}hideLabel(){var t;(t=this.label)==null||t.hide()}setType(t){var i;if(!this.userData)return this;const e=(i=this.userData)==null?void 0:i.type;return t||(t=_n.DEFAULT),e&&uo(this.el,e)&&ia(this.el,e),this.userData.type=t,ra(this.el,this.userData.type),this}update(t,e=!1){!t||!this.isMounted||(e||t.subScalar(this.radius).round(),this.position.copy(t),this.el.style.transform=`translate3D(${this.position.x}px, ${this.position.y}px, 0)`)}}const ym=new F;let mm=0;class vm extends Ge{name="DummyRect";id="dummyRect"+mm++;container;offset=new F;el;radius=10;position=new F;worldPosition=new F;label;userData;constructor(t,e){super(),t?this.container=t:this.container=document.getElementsByTagName("body")[0];let i=this.container.getBoundingClientRect();this.offset.set(i.left,i.top),this.userData=e,this.initDom(),this.mount(),this.initLabel()}destroy(){var t;super.destroy(),this.unmount(),(t=this.label)==null||t.destroy()}get isMounted(){var t;return!!((t=this.el)!=null&&t.parentNode)}mount(){this.container.appendChild(this.el)}unmount(){var t,e,i,a;this.setText(""),(e=(t=this.el)==null?void 0:t.parentNode)==null||e.removeChild(this.el),(i=this.el)==null||i.remove(),(a=this.label)==null||a.hide()}initDom(){var t;this.el=document.createElement("div"),this.el.setAttribute("id",this.id),this.el.setAttribute("class","dummy-rect"),this.el.setAttribute(as+"-id",((t=this.userData)==null?void 0:t.rmId)||"undefined")}initLabel(){this.label=new cl(this.container,"")}setText(t=""){return this.el.innerText=t,this}setActive(t){return t?ra(this.el,"active"):ia(this.el,"active"),this}showLabel(){var t;(t=this.label)==null||t.show(xm.copy(this.position).add(this.offset).subScalar(this.radius))}hideLabel(){var t;(t=this.label)==null||t.hide()}setType(t){var i;if(!this.userData)return this;const e=(i=this.userData)==null?void 0:i.type;return t=_n.DEFAULT,e&&uo(this.el,e)&&ia(this.el,e),this.userData.type=t,ra(this.el,this.userData.type),this}update(t,e=!1){!t||!this.isMounted||(e||t.subScalar(this.radius).round(),this.position.copy(t),this.el.style.transform=`translate3D(${this.position.x}px, ${this.position.y}px, 0)`)}}const xm=new F;class Em extends Ge{name="Dummies";container;controller;scene;viewMatrix=new ne;dummies=[];rmMap=new Map;mergedMap=new Map;cameraUpdateHandler=this.handleCameraUpdate.bind(this);controllerTapHandler=this.handleControllerTap.bind(this);constructor(t,e){super(),this.container=t,this.controller=e,this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.clearDummies()}bindEvents(){this.controller.camera.addEventListener(lo.UPDATE,this.cameraUpdateHandler),this.controller.addEventListener(ot.TAP,this.controllerTapHandler)}unbindEvents(){this.controller.camera.removeEventListener(lo.UPDATE,this.cameraUpdateHandler),this.controller.removeEventListener(ot.TAP,this.controllerTapHandler)}bindScene(t){this.scene=t}update(t){var e,i,a;if(t){this.viewMatrix.copy(t);for(let o=0,l=(this.dummies||[]).length;o<l;o++){const c=this.dummies[o],f=(i=this.scene)==null?void 0:i.getElementById((e=c.userData)==null?void 0:e.rmId);if(f){const d=(a=this.scene)==null?void 0:a.chef.getElementBoundingBox(f.id);d==null||d.getCenter(Ji),Ji.applyMatrix3(this.viewMatrix).round(),c.position.copy(Ji)}else Ji.copy(c.worldPosition).applyMatrix3(this.viewMatrix).round(),c.update(Ji)}this.mergeDummies()}}setDummies(t){this.clearDummies();for(let e=0,i=(t||[]).length;e<i;e++)this.addDummy(t[e])}addDummy(t){var a,o;const e=new gm(this.container,t);this.dummies.push(e);const i=(a=e.userData)==null?void 0:a.rmId;return i&&(this.rmMap.has(i)||this.rmMap.set(i,[]),(o=this.rmMap.get(i))==null||o.push(e)),e}removeDummy(t){var a;const e=this.dummies.indexOf(t);e>-1&&this.dummies.splice(e,1);const i=(a=t.userData)==null?void 0:a.rmId;if(i){const o=this.mergedMap.get(i);o==null||o.destroy(),this.mergedMap.delete(i);const l=this.rmMap.get(i);if(!l)return;if(l.length===1)this.rmMap.delete(i);else{const c=l.indexOf(t);c>-1&&(l.splice(c,1),this.rmMap.set(i,l))}}t.destroy()}clearDummies(t){var e,i,a;for(let o=(((e=this.dummies)==null?void 0:e.length)||0)-1;o>=0;o--){const l=this.dummies[o];(!t||(i=l==null?void 0:l.userData)!=null&&i.type&&(t!=null&&t.includes((a=l.userData)==null?void 0:a.type)))&&this.removeDummy(l)}t||(this.dummies.length=0,this.mergedMap.clear(),this.rmMap.clear())}mergeDummies(){this.rmMap.forEach((t,e)=>{var a,o,l,c;if((a=this.scene)==null?void 0:a.getElementById(e)){const f=(o=this.scene)==null?void 0:o.chef.getElementBoundingBox(e);if(!f)return;fl.copy(f).applyMatrix3(this.viewMatrix).round(),fl.getSize(Ji);const d=t[0].radius,g=fl.centralArrange(t.length,d*2,d*2);if(Ji.x<d*3||Ji.y<d*3){t.forEach(T=>T.unmount());const E=this.mergedMap.get(e);E==null||E.unmount()}else if(Array.isArray(g))this.mergedMap.has(e)&&((l=this.mergedMap.get(e))==null||l.unmount()),t.forEach((E,T)=>{E.isMounted||E.mount(),E.update(g[T])});else{t.forEach(C=>C.unmount());let E=this.mergedMap.get(e);if(E)E.isMounted||E.mount();else{const C=Mt.cloneDeep(t[0].userData)||{},L=Mt.reduce(t,(M,R)=>{var W,G;return(W=R.userData)!=null&&W.label&&M.push((G=R.userData)==null?void 0:G.label),M},[]);C.label=L.join(", ");const N=Mt.reduce(t,(M,R)=>{var W,G;return(W=R.userData)!=null&&W.value&&M.push((G=R.userData)==null?void 0:G.value),M},[]);C.value=N.join(","),C.rmId=e,E=new vm(this.container,C),this.mergedMap.set(e,E)}E.setText(t.length.toString());const T=Mt.reduce(t,(C,L)=>{var N,M;return(N=L.userData)!=null&&N.label&&C.push((M=L.userData)==null?void 0:M.label),C},[]);(c=E.label)==null||c.setHtml(T.join(", <br />")),E.update(t[0].position)}}})}getDummyById(t){return this.dummies.find(e=>{var i;return((i=e.userData)==null?void 0:i.value)===t})}setActiveByIds(t){var e,i;if(this.resetActives(),!!t&&(Array.isArray(t)||(t=[t]),!!(t!=null&&t.length)))for(let a=0,o=t.length;a<o;a++){const l=this.getDummyById(t[a]);if(l&&l.setActive(!0),l&&((e=l.userData)!=null&&e.rmId)){const c=this.mergedMap.get((i=l.userData)==null?void 0:i.rmId);c&&c.setActive(!0)}}}resetActives(){this.dummies.forEach(t=>t.setActive(!1)),this.mergedMap.forEach(t=>t.setActive(!1))}showDummyLabel(t){if(!t)return;const e=this.getDummyById(t);e&&e.showLabel();const i=this.mergedMap.get(t);i&&i.showLabel()}async hideDummyLabel(){this.dummies.forEach(t=>t.hideLabel()),this.mergedMap.forEach(t=>t.hideLabel())}handleCameraUpdate(){this.update(this.controller.camera.viewMatrix)}handleControllerTap(t){var a,o,l,c,f;if((t==null?void 0:t.type)!==ot.TAP)return;const e=((a=t==null?void 0:t.e)==null?void 0:a.target)||((l=(o=t==null?void 0:t.e)==null?void 0:o.srcEvent)==null?void 0:l.target)||((f=(c=t==null?void 0:t.e)==null?void 0:c.srcEvent)==null?void 0:f.srcElement),i=e==null?void 0:e.getAttribute(as+"-id");i&&console.warn("【TODO】handleControllerTap: ",i)}}const Ji=new F,fl=new St;(function(){return window[Qi.prefixed(window,"requestAnimationFrame")]||function(r){window.setTimeout(r,1e3/60)}})();class Am extends Ge{name="DragController";dragFake=!1;container;offset=new F;controller;scene;raycaster;dummies;_els=[];_hms=new Map;_vos=new Map;_elMap=new Map;_panType=_n.SUCCESS;onPanHandler=this.handleOnPan.bind(this);panEndHandler=Mt.debounce(this.handlePanEnd.bind(this),500);constructor(t,e,i=!0){super(),this.container=t;let a=this.container.getBoundingClientRect();this.offset.set(a.left,a.top),this.controller=e,this.dummies=new Em(t,e),this.raycaster=new xf,this.dragFake=i}destroy(){var t;super.destroy();for(let e=(((t=this._els)==null?void 0:t.length)||0)-1;e>=0;e--)this.drop(this._els[e]);this.dummies.destroy()}bindScene(t){var e;this.scene=t,(e=this.dummies)==null||e.bindScene(t)}drag(t,e){t&&(this._els.includes(t)||(this.bindEvent(t),this._els.push(t),this._vos.set(t,e)))}drop(t){if(!t)return;this.unbindEvent(t),this._vos.delete(t),this._elMap.delete(t);const e=this._els.findIndex(i=>i===t);e>-1&&this._els.splice(e,1)}bindEvent(t){if(!t)return;const e=new Qi.Manager(t,{domEvents:!0});e.add(new Qi.Pan({threshold:0,pointers:0})),e.on(["panstart","panmove","panend"].join(" "),this.onPanHandler),this._hms.set(t,e)}unbindEvent(t){if(!t)return;const e=this._hms.get(t);e&&(e.off(["panstart","panmove","panend"].join(" "),this.onPanHandler),e.destroy(),this._hms.delete(t))}handleOnPan(t){if(typeof t.preventDefault=="function"&&t.preventDefault(),typeof t.srcEvent.stopPropagation=="function"&&t.srcEvent.stopPropagation(),typeof t.srcEvent.stopImmediatePropagation=="function"&&t.srcEvent.stopImmediatePropagation(),!this.controller)return;t.type==="panstart"||t.isFirst?this.controller.enablePan=!1:t.type==="panmove"||t.type==="panend"&&(this.controller.enablePan=!0);const e=this._vos.get(t.target);if(!e)return;const i=Mt.cloneDeep(e);i.type=this._panType;const a=this._getDummy(t.target,i);ya.set(t.center.x,t.center.y).sub(this.offset),a.worldPosition.copy(ya).unproject(this.controller.camera),a.update(ya),this.panEndHandler({type:"panend",e:t})}handlePanEnd(t){if((t==null?void 0:t.type)!=="panend")return;const e=this.getDummies(!0);this.dispatchEvent({type:"panend",data:e})}getDummies(t=!0){const e=[];return this._els.forEach(i=>{var o;let a=this._vos.get(i);if(!(!a||a.type!==_n.SUCCESS)){if(t){const l=this._elMap.get(i);if(!l||!this.controller.camera)return;ya.copy(l.position),this.raycaster.setFromCamera(ya,this.controller.camera);const c=[];if((o=this.scene)==null||o.getIntersectObjects(this.raycaster,$e.RM,c),!(c!=null&&c.length))return;a=Mt.cloneDeep(a),a.rmId=c[0].id}e.push(a)}}),e}setDummiesByVos(t){var e,i;for(let a=0,o=(t||[]).length;a<o;a++){const l=(e=this.dummies)==null?void 0:e.addDummy(t[a]);if(!l)continue;const c=Mt.cloneDeep(t[a]);delete c.rmId,delete c.wsId,this.drag(l.el,c)}(i=this.dummies)==null||i.update(this.controller.camera.viewMatrix)}clearDummies(t){var e,i;for(let a=(((e=this._els)==null?void 0:e.length)||0)-1;a>=0;a--){const o=this._vos.get(this._els[a]);(!t||t&&(o!=null&&o.type)&&t.includes(o.type))&&this.drop(this._els[a])}(i=this.dummies)==null||i.clearDummies(t)}getDummyById(t){return this.dummies.getDummyById(t)}highlightDummies(t){var e;(e=this.dummies)==null||e.setActiveByIds(t)}resetHighlightDummies(){var t;(t=this.dummies)==null||t.resetActives()}showDummyLabel(t){var e;(e=this.dummies)==null||e.showDummyLabel(t)}start(){}_getDummy(t,e){let i=this._elMap.get(t);if(i||(i=this.dummies.addDummy(e).setType(_n.SUCCESS),this._elMap.set(t,i)),i.isMounted||i.mount(),this.dummies.dummies.includes(i)||this.dummies.dummies.push(i),!this._elMap.get(i.el)){this._elMap.set(i.el,i);const o=Mt.cloneDeep(e);delete o.rmId,delete o.wsId,this.drag(i.el,o)}return i}}const ya=new F;var ps=Object.freeze({Linear:Object.freeze({None:function(r){return r},In:function(r){return r},Out:function(r){return r},InOut:function(r){return r}}),Quadratic:Object.freeze({In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}}),Cubic:Object.freeze({In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}}),Quartic:Object.freeze({In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}}),Quintic:Object.freeze({In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}}),Sinusoidal:Object.freeze({In:function(r){return 1-Math.sin((1-r)*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.sin(Math.PI*(.5-r)))}}),Exponential:Object.freeze({In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}}),Circular:Object.freeze({In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}}),Elastic:Object.freeze({In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(r){var t=1.70158;return r===1?1:r*r*((t+1)*r-t)},Out:function(r){var t=1.70158;return r===0?0:--r*r*((t+1)*r+t)+1},InOut:function(r){var t=2.5949095;return(r*=2)<1?.5*(r*r*((t+1)*r-t)):.5*((r-=2)*r*((t+1)*r+t)+2)}}),Bounce:Object.freeze({In:function(r){return 1-ps.Bounce.Out(1-r)},Out:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},InOut:function(r){return r<.5?ps.Bounce.In(r*2)*.5:ps.Bounce.Out(r*2-1)*.5+.5}}),generatePow:function(r){return r===void 0&&(r=4),r=r<Number.EPSILON?Number.EPSILON:r,r=r>1e4?1e4:r,{In:function(t){return Math.pow(t,r)},Out:function(t){return 1-Math.pow(1-t,r)},InOut:function(t){return t<.5?Math.pow(t*2,r)/2:(1-Math.pow(2-t*2,r))/2+.5}}}}),ds=function(){return performance.now()},ap=function(){function r(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return r.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},r.prototype.removeAll=function(){this._tweens={}},r.prototype.add=function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];for(var a=0,o=e;a<o.length;a++){var l=o[a];(t=l._group)===null||t===void 0||t.remove(l),l._group=this,this._tweens[l.getId()]=l,this._tweensAddedDuringUpdate[l.getId()]=l}},r.prototype.remove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=0,a=t;i<a.length;i++){var o=a[i];o._group=void 0,delete this._tweens[o.getId()],delete this._tweensAddedDuringUpdate[o.getId()]}},r.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},r.prototype.update=function(t,e){t===void 0&&(t=ds()),e===void 0&&(e=!0);var i=Object.keys(this._tweens);if(i.length!==0)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var a=0;a<i.length;a++){var o=this._tweens[i[a]],l=!e;o&&o.update(t,l)===!1&&!e&&this.remove(o)}i=Object.keys(this._tweensAddedDuringUpdate)}},r}(),On={Linear:function(r,t){var e=r.length-1,i=e*t,a=Math.floor(i),o=On.Utils.Linear;return t<0?o(r[0],r[1],i):t>1?o(r[e],r[e-1],e-i):o(r[a],r[a+1>e?e:a+1],i-a)},Bezier:function(r,t){for(var e=0,i=r.length-1,a=Math.pow,o=On.Utils.Bernstein,l=0;l<=i;l++)e+=a(1-t,i-l)*a(t,l)*r[l]*o(i,l);return e},CatmullRom:function(r,t){var e=r.length-1,i=e*t,a=Math.floor(i),o=On.Utils.CatmullRom;return r[0]===r[e]?(t<0&&(a=Math.floor(i=e*(1+t))),o(r[(a-1+e)%e],r[a],r[(a+1)%e],r[(a+2)%e],i-a)):t<0?r[0]-(o(r[0],r[0],r[1],r[1],-i)-r[0]):t>1?r[e]-(o(r[e],r[e],r[e-1],r[e-1],i-e)-r[e]):o(r[a?a-1:0],r[a],r[e<a+1?e:a+1],r[e<a+2?e:a+2],i-a)},Utils:{Linear:function(r,t,e){return(t-r)*e+r},Bernstein:function(r,t){var e=On.Utils.Factorial;return e(r)/e(t)/e(r-t)},Factorial:function(){var r=[1];return function(t){var e=1;if(r[t])return r[t];for(var i=t;i>1;i--)e*=i;return r[t]=e,e}}(),CatmullRom:function(r,t,e,i,a){var o=(e-r)*.5,l=(i-t)*.5,c=a*a,f=a*c;return(2*t-2*e+o+l)*f+(-3*t+3*e-2*o-l)*c+o*a+t}}},pl=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),dl=new ap,wm=function(){function r(t,e){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ps.Linear.None,this._interpolationFunction=On.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=pl.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof e=="object"?(this._group=e,e.add(this)):e===!0&&(this._group=dl,dl.add(this))}return r.prototype.getId=function(){return this._id},r.prototype.isPlaying=function(){return this._isPlaying},r.prototype.isPaused=function(){return this._isPaused},r.prototype.getDuration=function(){return this._duration},r.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},r.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},r.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},r.prototype.start=function(t,e){if(t===void 0&&(t=ds()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var a={};for(var o in this._valuesEnd)a[o]=this._valuesEnd[o];this._valuesEnd=a}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},r.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},r.prototype._setupProperties=function(t,e,i,a,o){for(var l in i){var c=t[l],f=Array.isArray(c),d=f?"array":typeof c,g=!f&&Array.isArray(i[l]);if(!(d==="undefined"||d==="function")){if(g){var E=i[l];if(E.length===0)continue;for(var T=[c],C=0,L=E.length;C<L;C+=1){var N=this._handleRelativeValue(c,E[C]);if(isNaN(N)){g=!1,console.warn("Found invalid interpolation list. Skipping.");break}T.push(N)}g&&(i[l]=T)}if((d==="object"||f)&&c&&!g){e[l]=f?[]:{};var M=c;for(var R in M)e[l][R]=M[R];a[l]=f?[]:{};var E=i[l];if(!this._isDynamic){var W={};for(var R in E)W[R]=E[R];i[l]=E=W}this._setupProperties(M,e[l],E,a[l],o)}else(typeof e[l]>"u"||o)&&(e[l]=c),f||(e[l]*=1),g?a[l]=i[l].slice().reverse():a[l]=e[l]||0}}},r.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},r.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},r.prototype.pause=function(t){return t===void 0&&(t=ds()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},r.prototype.resume=function(t){return t===void 0&&(t=ds()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},r.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},r.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},r.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},r.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},r.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},r.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},r.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},r.prototype.easing=function(t){return t===void 0&&(t=ps.Linear.None),this._easingFunction=t,this},r.prototype.interpolation=function(t){return t===void 0&&(t=On.Linear),this._interpolationFunction=t,this},r.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},r.prototype.onStart=function(t){return this._onStartCallback=t,this},r.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},r.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},r.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},r.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},r.prototype.onStop=function(t){return this._onStopCallback=t,this},r.prototype.update=function(t,e){var i=this,a;if(t===void 0&&(t=ds()),e===void 0&&(e=r.autoStartOnUpdate),this._isPaused)return!0;var o;if(!this._goToEnd&&!this._isPlaying)if(e)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var l=t-this._startTime,c=this._duration+((a=this._repeatDelayTime)!==null&&a!==void 0?a:this._delayTime),f=this._duration+this._repeat*c,d=function(){if(i._duration===0||l>f)return 1;var N=Math.trunc(l/c),M=l-N*c,R=Math.min(M/i._duration,1);return R===0&&l===i._duration?1:R},g=d(),E=this._easingFunction(g);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,E),this._onUpdateCallback&&this._onUpdateCallback(this._object,g),this._duration===0||l>=this._duration)if(this._repeat>0){var T=Math.min(Math.trunc((l-this._duration)/c)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=T);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=c*T,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var C=0,L=this._chainedTweens.length;C<L;C++)this._chainedTweens[C].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},r.prototype._updateProperties=function(t,e,i,a){for(var o in i)if(e[o]!==void 0){var l=e[o]||0,c=i[o],f=Array.isArray(t[o]),d=Array.isArray(c),g=!f&&d;g?t[o]=this._interpolationFunction(c,a):typeof c=="object"&&c?this._updateProperties(t[o],l,c,a):(c=this._handleRelativeValue(l,c),typeof c=="number"&&(t[o]=l+(c-l)*a))}},r.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},r.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},r.autoStartOnUpdate=!1,r}(),bm="25.0.0",Tm=pl.nextId,ni=dl,_m=ni.getAll.bind(ni),Cm=ni.removeAll.bind(ni),Dm=ni.add.bind(ni),Sm=ni.remove.bind(ni),Om=ni.update.bind(ni),mo={Easing:ps,Group:ap,Interpolation:On,now:ds,Sequence:pl,nextId:Tm,Tween:wm,VERSION:bm,getAll:_m,removeAll:Cm,add:Dm,remove:Sm,update:Om};class Nm extends Ge{name="View";params;visible=!0;cvs;scene;scenes=[];camera;controller;tween;animateDuration;constructor(t={}){super(),this.params=t,this.animateDuration=this.params.animateDuration||300,this.cvs=t.cvs,this.camera=new mf(t.camera||{})}destroy(){this.controller&&this.controller.destroy(),this.camera&&this.camera.destroy(),this.scene&&this.scene.destroy(),this.scenes.forEach(t=>t.destroy()),this.scenes.length=0,super.destroy()}bindScene(t){this.scenes.push(t),this.reset(),this.scene=t,t.isStatic}saveCameraPosition(t){gs.copy(this.camera.boundingBoxWorld);const e=t?Er+t:Er;sessionStorage.setItem(e,JSON.stringify(gs))}clearCameraPosition(t){const e=t?Er+t:Er;sessionStorage.setItem(e,"")}restoreCameraPosition(t){const e=t?Er+t:Er,i=sessionStorage.getItem(e);i&&(gs.copy(JSON.parse(i)),this.resetCameraByBoundingBox(gs,!0))}fullscreen(t=10,e=!1){this.scene&&(this.scene.boundingBox.isEmpty()&&this.scene.computeBoundingBox(),gs.copy(this.scene.boundingBox).expandByVector(vo.set(t,t)),this.resetCameraByBoundingBox(gs,e))}handleCameraChanged(t){console.warn("handleCameraChanged: ",t.target.camera.position.z,t.target.camera.scaled.x)}reset(){}async resetCameraByBoundingBox(t,e=!1){if(!this.camera)return;if(!t||t.isEmpty())throw new Error("BoundingBox empty");if(!e)return this.camera.setByBox(t),Promise.resolve();const i=this.camera.getCameraPosition();t.getCenter(vo),t.getSize(gl);const a=Math.max(gl.x/this.camera.width,gl.y/this.camera.height),o={x:vo.x,y:vo.y,z:0,s:a,r:0};await this.animateCamera(i,o)}async animateCamera(t,e){return this.controller&&(this.controller.enabled=!1),this.tween&&this.tween.stop(),new Promise(i=>{this.tween=new mo.Tween(t).to(e,this.animateDuration).easing(mo.Easing.Exponential.Out).onUpdate(a=>{this.camera.position.set(a.x,a.y),this.camera.scaled.set(a.s,a.s),this.camera.rotation.set(a.r,a.r),this.camera.update()}).onComplete(()=>{this.controller&&(this.controller.enabled=!0),i()}).start()})}computeBoundingBox(t,e=new St){return!t||!t.length||(e.makeEmpty(),t.forEach(i=>e.union(i.computeBoundingBox()))),e}expandScenesBoundingBox(t,e=new St){t.forEach(i=>i.boundingBox.union(e))}update(t){this.tween&&this.tween.update(t)}}const Er="camera_position_",vo=new F,gl=new F,gs=new St;class Mm extends Ge{name="SvgView";params;container;offset=new F;camera;controller;scene;p1=new F;p2=new F;graph;multiSelector;dummiesController;zoomToSelectEnable=!1;zoomBox=new St;selectEnable=!1;multiSelectEnable=!1;tween;animateDuration;label;controllerPanStartHandler=this.handlePanStart.bind(this);controllerPanEndHandler=this.handlePanEnd.bind(this);controllerWheelStartHandler=this.handlePanStart.bind(this);controllerWheelEndHandler=this.handlePanEnd.bind(this);controllerPanMoveHandler=this.handleControllerPanMove.bind(this);controllerPointerOverHandler=this.handleControllerPointerOver.bind(this);multiSelectorSelectedHandler=this.handleMultiSelectorSelected.bind(this);_currentAssetId;constructor(t={}){super(),this.params=t,this.params.zoomToSelectEnable&&(this.zoomToSelectEnable=!0),this.params.selectEnable&&(this.selectEnable=!0),this.params.multiSelectEnable&&(this.multiSelectEnable=!0),this.params.camera||(this.params.camera={}),this.params.camera.flipY=!0,this.animateDuration=this.params.animateDuration||300,this.camera=new mf(this.params.camera),this.container=this.params.containerId?document.getElementById(this.params.containerId):kt.window.document.getElementsByTagName("body")[0];let e=this.container.getBoundingClientRect();this.offset.set(e.left,e.top),this.controller=new yf(this.container,this.camera,!0),this.graph=new zu(this.container),this.multiSelector=new I2(this.container,this.controller),this.dummiesController=new Am(this.container,this.controller),this.bindControllerEvents(),this.initLabel()}destroy(){var t;this.unbindControllerEvents(),super.destroy(),(t=this.label)==null||t.destroy()}initLabel(){this.label=new cl(this.container,"")}showAssetsLabel(t,e,i){var o,l,c,f,d;if(!e)return;t||(t=(o=this.scene)==null?void 0:o.assetType);const a=(l=this.scene)==null?void 0:l.chef.getElementBoundingBox(e);a&&!a.isEmpty()&&(i||(i=(c=this.scene)==null?void 0:c.getAssetLabelById(t,e),i||(i=e)),(f=this.label)==null||f.setHtml(i),Nn.copy(a.min).applyMatrix3(this.camera.viewMatrix).add(this.offset).round(),(d=this.label)==null||d.show(Nn))}async hideAssetsLabel(){var t;return(t=this.label)==null?void 0:t.hide()}bindScene(t){var e;this.scene=t,this.multiSelector.bindScene(this.scene),(e=this.dummiesController)==null||e.bindScene(this.scene)}resize(){var t,e;(t=this.camera)==null||t.resize(),(e=this.controller)==null||e.resize(),console.log("【svgView】resize: ",this.params.width,this.params.height)}async setByBox(t,e=!0){await this.resetCameraByBoundingBox(t,e)}zoomIn(){this.controller.scaled=this.camera.scaled.x*.9,this.controller.update()}zoomOut(){this.controller.scaled=this.camera.scaled.x*1.1,this.controller.update()}zoomToSelectEnableChanged(t){console.log("TODO: zoomToSelectEnableChanged: ",t),this.zoomToSelectEnable=t,this.controller.enablePan=!this.zoomToSelectEnable}selectEnableChanged(t){this.selectEnable=!!t,this.multiSelector.selectEnableChanged(t)}multiSelectEnableChanged(t){this.multiSelectEnable=!!t,this.multiSelector.multiSelectEnableChanged(t)}getIntersectObjects(t,e,i=[]){return this.scene?this.scene.getIntersectObjects(t,e,i):i}async focusAt(t,e=500){return this.camera?(Xt.setFromCenterAndSize(t,Nn.set(e*2,e*2)),this.resetCameraByBoundingBox(Xt,!0)):Promise.resolve()}async focusAtById(t,e=500){var a;const i=(a=this.scene)==null?void 0:a.getBoundingBoxById(t);if(console.log("focusAtById: ",t,i==null?void 0:i.toString()),i){i.expandByScalar(e),Xt.copy(this.camera.boundingBoxWorld),Xt.containsBox(i)||await this.resetCameraByBoundingBox(i,!0);return}}async focusAtDummy(t,e=500){var o,l;const i=this.dummiesController.getDummyById(t),a=(o=i==null?void 0:i.userData)==null?void 0:o.rmId;if(a){const c=(l=this.scene)==null?void 0:l.getBoundingBoxById(a);if(c){c.expandByScalar(e),Xt.copy(this.camera.boundingBoxWorld),Xt.containsBox(c)||await this.resetCameraByBoundingBox(c,!0);return}}if(i!=null&&i.position&&!(i!=null&&i.position.isEmpty())){Xt.setFromCenterAndSize(i.worldPosition,Nn.set(e*2,e*2)),this.camera.boundingBoxWorld.containsBox(Xt)||await this.resetCameraByBoundingBox(Xt,!0);return}}async resetCameraByBoundingBox(t,e=!1){if(!this.camera)return Promise.resolve();if(!t||t.isEmpty())throw new Error("BoundingBox empty");if(!e)return this.camera.setByBox(t),Promise.resolve();const i=this.camera.getCameraPosition();t.getCenter(Nn),t.getSize(yl);const a=Math.max(yl.x/this.camera.width,yl.y/this.camera.height),o={x:Nn.x,y:Nn.y,z:0,s:a,r:0};await this.animateCamera(i,o)}async animateCamera(t,e){return this.controller&&(this.controller.enabled=!1),this.tween&&this.tween.stop(),new Promise(i=>{this.tween=new mo.Tween(t).to(e,this.animateDuration).easing(mo.Easing.Exponential.Out).onUpdate(a=>{this.camera.position.set(a.x,a.y),this.camera.scaled.set(a.s,a.s),this.camera.rotation.set(a.r,a.r),this.camera.update()}).onComplete(()=>{this.controller&&(this.controller.enabled=!0),i()}).start()})}fullscreen(){this.scene&&(this.scene&&!this.scene.viewBox.isEmpty()?Xt.copy(this.scene.viewBox):(this.scene.updateMatrixWorld(!0),this.scene.computeBoundingBox(),Xt.copy(this.scene.boundingBox)),this.resetCameraByBoundingBox(Xt,!0))}saveCameraPosition(t){Xt.copy(this.camera.boundingBoxWorld);const e=t?Er+t:Er;sessionStorage.setItem(e,JSON.stringify(Xt))}restoreCameraPosition(t){const e=t?Er+t:Er,i=sessionStorage.getItem(e);if(!i)return this.fullscreen();Xt.copy(JSON.parse(i)),this.resetCameraByBoundingBox(Xt,!0)}clearCameraPosition(t){const e=t?Er+t:Er;sessionStorage.setItem(e,"")}bindControllerEvents(){this.controller.addEventListener(ot.PAN_START,this.controllerPanStartHandler),this.controller.addEventListener(ot.PAN_END,this.controllerPanEndHandler),this.controller.addEventListener(ot.WHEEL_START,this.controllerWheelStartHandler),this.controller.addEventListener(ot.WHEEL_END,this.controllerWheelEndHandler),this.controller.addEventListener(ot.PAN_MOVE,this.controllerPanMoveHandler),this.controller.addEventListener(ot.POINTEROVER,this.controllerPointerOverHandler),this.multiSelector.addEventListener(Yu.SELECTED,this.multiSelectorSelectedHandler)}unbindControllerEvents(){this.controller.removeEventListener(ot.PAN_START,this.controllerPanStartHandler),this.controller.removeEventListener(ot.PAN_END,this.controllerPanEndHandler),this.controller.removeEventListener(ot.WHEEL_START,this.controllerWheelStartHandler),this.controller.removeEventListener(ot.WHEEL_END,this.controllerWheelEndHandler),this.controller.removeEventListener(ot.PAN_MOVE,this.controllerPanMoveHandler),this.controller.removeEventListener(ot.POINTEROVER,this.controllerPointerOverHandler),this.multiSelector.removeEventListener(Yu.SELECTED,this.multiSelectorSelectedHandler)}handlePanStart(t){if(!((t==null?void 0:t.type)!==ot.PAN_START&&(t==null?void 0:t.type)!==ot.WHEEL_START)&&this.zoomToSelectEnable){this.p1.copy(t.data.screenCoords),Xt.makeEmpty().expandByPoint(this.p1),this.graph.draw(Xt);return}}handlePanEnd(t){if(!((t==null?void 0:t.type)!==ot.PAN_END&&(t==null?void 0:t.type)!==ot.WHEEL_END)&&this.zoomToSelectEnable){this.p2.copy(t.data.screenCoords),Xt.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2).unproject(this.controller.camera),this.setByBox(Xt),this.graph.hide(),Xt.makeEmpty();return}}handleControllerPanMove(t){(t==null?void 0:t.type)===ot.PAN_MOVE&&this.zoomToSelectEnable&&(this.p2.copy(t.data.screenCoords),Xt.makeEmpty().expandByPoint(this.p1).expandByPoint(this.p2),this.graph.draw(Xt))}handleControllerPointerOver(t){var a,o,l,c,f;const e=((a=t==null?void 0:t.e)==null?void 0:a.target)||((l=(o=t==null?void 0:t.e)==null?void 0:o.srcEvent)==null?void 0:l.target);let i=e==null?void 0:e.id;(i==null?void 0:i.indexOf("dummy"))>-1?(i=e.getAttribute(as+"-id"),i&&this._currentAssetId!==i&&this.dispatchEvent({type:"POINTEROVER",data:{id:i,assetType:"dummy"},e:t.e})):i&&((c=this.scene)!=null&&c.isBelongsToAssetType(i,$e.WS))?this._currentAssetId!==i&&this.dispatchEvent({type:"POINTEROVER",data:{id:i,assetType:$e.WS},e:t.e}):i&&((f=this.scene)!=null&&f.isBelongsToAssetType(i,$e.RM))?this._currentAssetId!==i&&this.dispatchEvent({type:"POINTEROVER",data:{id:i,assetType:$e.RM},e:t.e}):(this._currentAssetId=void 0,this.dispatchEvent({type:"POINTERLEAVE",e:t.e})),this._currentAssetId=i}handleMultiSelectorSelected(t){console.warn("handleMultiSelectorSelected:",t.data),this.dispatchEvent({type:"SELECTED",data:t.data})}setDummies(t){this.dummiesController.setDummiesByVos(t)}clearDummies(t){this.dummiesController.clearDummies(t)}update(t){this.tween&&this.tween.update(t)}}const Xt=new St,Nn=new F,yl=new F;var Mn=(r=>(r.SELECTED="SELECTED",r.POINTEROVER="POINTEROVER",r.POINTERLEAVE="POINTERLEAVE",r))(Mn||{});class Bm extends Ge{name="SvgApp";params;renderer;view;scene;loadingScene;mainScene;zoomToSelectEnable=!1;zoomBox=new St;selectEnable=!1;multiSelectEnable=!1;requestHeader={};runningHandler=this.running.bind(this);pointerOverHandler=this.handlePointerOver.bind(this);pointerLeaveHandler=this.handlePointerLeave.bind(this);multiSelectorSelectedHandler=this.handleMultiSelectorSelected.bind(this);dragEndHandler=this.handleDragEnd.bind(this);constructor(t={}){super(),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=Wt.getMoreTransparent($t.white,.3)),this.params.defaultStroke||(this.params.defaultStroke=Wt.getMoreTransparent($t.darkWhite,.8)),this.params.infoFill||(this.params.infoFill=Wt.getMoreTransparent($t.gray,.3)),this.params.infoStroke||(this.params.infoStroke=Wt.getMoreTransparent($t.darkGray,.8)),this.params.primaryFill||(this.params.primaryFill=Wt.getMoreTransparent($t.blue,.3)),this.params.primaryStroke||(this.params.primaryStroke=Wt.getMoreTransparent($t.darkBlue,.8)),this.params.successFill||(this.params.successFill=Wt.getMoreTransparent($t.green,.3)),this.params.successStroke||(this.params.successStroke=Wt.getMoreTransparent($t.darkGreen,.8)),this.params.warningFill||(this.params.warningFill=Wt.getMoreTransparent($t.yellow,.3)),this.params.warningStroke||(this.params.warningStroke=Wt.getMoreTransparent($t.darkYellow,.8)),this.params.dangerFill||(this.params.dangerFill=Wt.getMoreTransparent($t.red,.3)),this.params.dangerStroke||(this.params.dangerStroke=Wt.getMoreTransparent($t.darkRed,.8)),this.params.activeFill||(this.params.activeFill=Wt.getMoreTransparent($t.brown,.3)),this.params.activeStroke||(this.params.activeStroke=Wt.getMoreTransparent($t.darkBrown,.8)),this.renderer=new _0(t),this.view=new Mm(t),this.trans2LoadingScene()}get isLoadingScene(){var t;return((t=this.scene)==null?void 0:t.name)==="SvgLoadingScene"}destroy(){var t,e;this.unbindAssetsEvents(),super.destroy(),(t=this.view)==null||t.destroy(),(e=this.renderer)==null||e.destroy()}resize(){var t,e;(t=this.renderer)==null||t.resize(),(e=this.view)==null||e.resize()}isScene(t){var e;return((e=this.scene)==null?void 0:e.uuid)===t.uuid}removeScene(t){this.scene=void 0,t==null||t.destroy()}trans2MainScene(){var t,e;(t=this.scene)==null||t.unmount(),this.scene=this.mainScene,this.scene.isMounted||this.scene.mount(),this.view.bindScene(this.scene),(e=this.loadingScene)==null||e.destroy()}trans2LoadingScene(){var e,i;console.log("trans2LoadingScene: ",this.params),this.loadingScene=new M2(this.params),(e=this.scene)==null||e.unmount(),this.scene=this.loadingScene,this.scene.isMounted||this.scene.mount();const t=new St().copy(this.loadingScene.viewBox).expandByVector(new F(1,1).multiplyScalar(150));console.log("trans2LoadingScene: ",t.toString()),this.view.setByBox(t,!1),(i=this.mainScene)==null||i.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}async load(t,e,i=2,a){this.isLoadingScene||this.trans2LoadingScene(),await Dc(this.params.syncDelay);const o=await new Uc().setRequestHeader(this.requestHeader).loadAsync(t);return this.loadByString(o,e,i)}loadByString(t,e,i=2){this.mainScene=new pf(this.params),this.mainScene.bind(t),this.view.setByBox(this.mainScene.viewBox);const a=this.mainScene.getLayers(i);return e!=null&&e.length||(e=Mt.map(a,"label")),this.mainScene.showDefaultLayers(e,!0),this.trans2MainScene(),this.bindAssetsEvents(),console.log("svgApp.loadByString: ",a),a}setSkeletons(t){var e;(e=this.scene)==null||e.setSkeletonLayers(t)}getLayers(t=2){var e;return(e=this.scene)==null?void 0:e.getLayers(t)}updateLayersVisibility(t,e=!1){var i;(i=this.scene)==null||i.updateLayersVisibility(t,e)}selectByIds(t){var e;(e=this.scene)==null||e.selectByIds(t,this.multiSelectEnable)}clearSelectedByIds(t){var e;Array.isArray(t)?t.forEach(i=>{var a;return(a=this.scene)==null?void 0:a.clearSelectedById(i)}):(e=this.scene)==null||e.clearSelectedById(t)}clearSelected(){var t;(t=this.scene)==null||t.clearSelected()}getSelectedIds(){var t;return(t=this.scene)==null?void 0:t.getSelectedIds()}async targetByIds(t,e=100){var i;this.scene&&((i=this.scene)==null||i.selectByIds(t,!1),ml.copy(this.scene.getSelectedBoundingBox()).expandByVector(new F(1,1).multiplyScalar(e)),await Dc(100),ml.isEmpty()||await this.view.setByBox(ml))}linkAssetsByTree(t){var e;(e=this.scene)==null||e.linkAssetsByTree(t)}setViewAreaLimit(t){this.renderer.viewAreaLimit=t}setAssetType(t,e){var i;(i=this.scene)==null||i.setAssetType(t,e)}getAssetIdsByType(t){var e;return(e=this.scene)==null?void 0:e.getAssetIdsByType(t)}clearFill(){var t;(t=this.scene)==null||t.clearFillOrStroke("fill")}clearFillByIds(t){var e;(e=this.scene)==null||e.clearFillOrStrokeByIds(t,"fill")}setFillByIds(t,e){var i;(i=this.scene)==null||i.setFillOrStrokeByIds(t,e,"fill")}clearStroke(){var t;(t=this.scene)==null||t.clearFillOrStroke("stroke")}clearStrokeByIds(t){var e;(e=this.scene)==null||e.clearFillOrStrokeByIds(t,"stroke")}setStrokeByIds(t,e){var i;(i=this.scene)==null||i.setFillOrStrokeByIds(t,e,"stroke")}getLegend(){var t;return(t=this.scene)==null?void 0:t.getLegend()}setAssetLabels(t,e){var i;(i=this.scene)==null||i.setAssetLabels(t,e)}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,e=1e3){var i;(i=this.view)==null||i.focusAt(t,e)}async focusAtById(t,e=1e3){var i;return(i=this.view)==null?void 0:i.focusAtById(t,e)}async focusAtDummy(t,e=1e3){var i;return(i=this.view)==null?void 0:i.focusAtDummy(t,e)}showAssetsLabel(t,e,i){var a,o,l,c;e?t==="dummy"?(l=(o=(a=this.view)==null?void 0:a.dummiesController)==null?void 0:o.dummies)==null||l.showDummyLabel(e):(c=this.view)==null||c.showAssetsLabel(t,e,i):this.hideAssetsLabel()}hideAssetsLabel(){var t,e,i,a;(i=(e=(t=this.view)==null?void 0:t.dummiesController)==null?void 0:e.dummies)==null||i.hideDummyLabel(),(a=this.view)==null||a.hideAssetsLabel()}highlightAssets(t,e){var i;(i=this.scene)==null||i.highlightAssets(t,e)}resetHighlightAssets(t){var e;(e=this.scene)==null||e.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 e;(e=this.scene)==null||e.socialDistanceEnableChanged(t)}getBoundingBoxById(t,e=!0){var a;if(!t)return;const i=(a=this.scene)==null?void 0:a.getBoundingBoxById(t);return i&&e&&i.applyMatrix3(this.view.camera.viewMatrix).round(),i}setDummies(t){var e;(e=this.view)==null||e.setDummies(t)}clearDummies(t){var e;(e=this.view)==null||e.clearDummies(t)}highlightDummies(t){var e,i;(i=(e=this.view)==null?void 0:e.dummiesController)==null||i.highlightDummies(t)}resetHighlightDummies(){var t,e;(e=(t=this.view)==null?void 0:t.dummiesController)==null||e.resetHighlightDummies()}bindAssetsEvents(){var t,e;this.view.addEventListener(Mn.POINTEROVER,this.pointerOverHandler),this.view.addEventListener(Mn.POINTERLEAVE,this.pointerLeaveHandler),this.view.addEventListener(Mn.SELECTED,this.multiSelectorSelectedHandler),(e=(t=this.view)==null?void 0:t.dummiesController)==null||e.addEventListener("panend",this.dragEndHandler)}unbindAssetsEvents(){var t,e;this.view.removeEventListener(Mn.POINTEROVER,this.pointerOverHandler),this.view.removeEventListener(Mn.POINTERLEAVE,this.pointerLeaveHandler),this.view.removeEventListener(Mn.SELECTED,this.multiSelectorSelectedHandler),(e=(t=this.view)==null?void 0:t.dummiesController)==null||e.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 ...")}async handleInitializeComplete(t){console.log("App.initializeComplete ...",t),t!=null&&t.data&&this.launch()}handleDragEnd(t){this.dispatchEvent(t)}launch(){console.log("App.launch ...")}}const ml=new St;var op=(r=>(r.SELECTED="SELECTED",r.POINTEROVER="pointerover",r.POINTERLEAVE="pointerleave",r.DRAG_END="panend",r))(op||{}),Dt=(r=>(r.INIT="init",r.LOAD="load",r.LOADED="loaded",r.GET_LAYERS="getLayers",r.GET_ASSET_IDS_BY_TYPE="getAssetIdsByType",r.SET_FILL_BY_IDS="setFillByIds",r.CLEAR_FILL="clearFill",r.SET_STROKE_BY_IDS="setStrokeByIds",r.CLEAR_STROKE="clearStroke",r.TERMINATE="terminate",r.CAMERA_SYNC="cameraSync",r.ASSET_TYPE_CHANGED="assetTypeChanged",r.SVG_LOADING_TYPE_CHANGED="svgLoadingTypeChanged",r.USED_CACHE_CHANGED="usedCacheChanged",r.DEBOUNCE_CACHE_CHANGED="debounceCacheChanged",r.WIREFRAME_CHANGED="wireframeChanged",r.BG_PASS_CHANGED="bgPass",r.SELECT_ENABLE_CHANGED="selectEnableChanged",r.MULTI_SELECT_ENABLE_CHANGED="multiSelectEnableChanged",r.MULTI_SELECT_BY_RANGE="multiSelectByRange",r.ZOOM_TO_SELECT_ENABLE_CHANGED="zoomToSelectEnableChanged",r.FONT_ZOOM_IN="fontZoomIn",r.FONT_ZOOM_OUT="fontZoomOut",r.CAMERA_CHANGED="cameraChanged",r.SCENES_CHANGED="scenesChanged",r.UPDATE_LAYERS_VISIBILITY="updateLayersVisibility",r.DYNAMIC_LOADED="dynamicLoaded",r.SYNC_TEXTURE_HELPER_CACHED="syncTextureHelperCached",r.INITIALIZATION_START="INITIALIZATION_START",r.INITIALIZATION_COMPLETE="INITIALIZATION_COMPLETE",r.SELECTED="selected",r.SELECT_BY_IDS="selectByIds",r.CLEAR_SELECTED="clearSelected",r.TARGET_BY_IDS="targetByIds",r.TAP="tap",r.SINGLE_TAP="singletap",r.DOUBLE_TAP="doubletap",r.PRESS="press",r.PAN="pan",r.PAN_START="panstart",r.PAN_MOVE="panmove",r.PAN_END="panend",r.ROTATE="rotate",r.ROTATE_START="rotatestart",r.ROTATE_MOVE="rotatemove",r.ROTATE_END="rotateend",r.PINCH="pinch",r.PINCH_START="pinchstart",r.PINCH_MOVE="pinchmove",r.PINCH_END="pinchend",r.PINCH_IN="pinchin",r.PINCH_OUT="pinchout",r.SWIPE="swipe",r))(Dt||{});class Im extends Nm{name="OpeView";container;graph;zoomToSelectEnable;multiSelectEnable;rayCaster=new xf;intersects=[];controllerPanStartHandler=this.handlePanStart.bind(this);controllerPanEndHandler=this.handlePanEnd.bind(this);controllerPanMoveHandler=this.handleControllerPanMove.bind(this);controllerPointerOverHandler=this.handleControllerPointerOver.bind(this);constructor(t={}){super(t),this.container=this.params.cvs?this.params.cvs:this.params.canvasId?document.getElementById(this.params.canvasId):kt.window.document.getElementsByTagName("body")[0],console.warn("opeView.constructor: ",this.container,this.container.tagName),this.controller=new yf(this.container,this.camera),this.bindControllerEvents();let e=this.container.tagName.toLowerCase()!=="body"?this.container.parentNode:this.container;this.graph=new zu(e)}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(ot.PAN_START,this.controllerPanStartHandler),this.controller.addEventListener(ot.PAN_END,this.controllerPanEndHandler),this.controller.addEventListener(ot.PAN_MOVE,this.controllerPanMoveHandler),this.controller.addEventListener(ot.POINTEROVER,this.controllerPointerOverHandler)}unbindControllerEvents(){this.controller.removeEventListener(ot.PAN_START,this.controllerPanStartHandler),this.controller.removeEventListener(ot.PAN_END,this.controllerPanEndHandler),this.controller.removeEventListener(ot.PAN_MOVE,this.controllerPanMoveHandler),this.controller.removeEventListener(ot.POINTEROVER,this.controllerPointerOverHandler)}handlePanStart(t){(t==null?void 0:t.type)!==ot.PAN_START&&(t==null?void 0:t.type)!==ot.WHEEL_START||(this.zoomToSelectEnable||this.multiSelectEnable)&&(xo.copy(t.data.screenCoords),tn.makeEmpty().expandByPoint(xo),this.graph.draw(tn))}async handlePanEnd(t){(t==null?void 0:t.type)!==ot.PAN_END&&(t==null?void 0:t.type)!==ot.WHEEL_END||((this.zoomToSelectEnable||this.multiSelectEnable)&&(Eo.copy(t.data.screenCoords),tn.makeEmpty().expandByPoint(xo).expandByPoint(Eo).unproject(this.controller.camera),this.graph.hide()),this.zoomToSelectEnable&&await this.resetCameraByBoundingBox(tn,!0),this.multiSelectEnable&&this.dispatchEvent({type:Dt.MULTI_SELECT_BY_RANGE,data:tn.clone()}),tn.makeEmpty())}handleControllerPanMove(t){(t==null?void 0:t.type)===ot.PAN_MOVE&&(this.zoomToSelectEnable||this.multiSelectEnable)&&(Eo.copy(t.data.screenCoords),tn.makeEmpty().expandByPoint(xo).expandByPoint(Eo),this.graph.draw(tn))}handleControllerPointerOver(t){t==null||t.type,ot.POINTEROVER}handleMultiSelectorSelected(t){}handleCameraChanged(t){console.warn("handleCameraChanged: ",t.target.camera.position.z,t.target.camera.scaled.x)}}const xo=new F,Eo=new F,tn=new St;function up(r){return!!(r&&r.constructor&&r.call&&r.apply)}const Rm="children",Lm="get",Pm="set",vl="Changed";class Fm extends Ge{name="Node2";userData={};_cache=new Map;_attachedDepsListeners=new Map;constructor(t){super(),this.setAttrs(t)}destroy(){super.destroy(),this._clearCache()}setAttrs(t){if(!t)return this;let e;for(const i in t)i!==Rm&&(e=Pm+i,up(this[e])?this[e](t[i]):this.setAttr(i,t[i]));return this}setAttr(t,e){Object.hasOwnProperty.call(this,t)&&(this.userData[t]=e,this[t]=e)}getAttrs(){return this.userData||{}}getAttr(t){const e=Lm+Mt.capitalize(t);return up(this[e])?this[e]():this.userData[t]}getAttrKey(){return Object.values(this.userData).filter(t=>!(t instanceof Array||t instanceof Object)).join("_")}_getCache(t,e){let i=this._cache.get(t);return(i===void 0||i.dirty===!0)&&(i=e.call(this),this._cache.set(t,i)),i}_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(e){const i=this.userData[t];this.userData[t]=e,i!==e&&this.dispatchEvent({type:t+vl,data:{oldVal:i,newVal:e}})},enumerable:!0,configurable:!0})}computed(t,e,i){if(!this._attachedDepsListeners.get(t)){const a=e.map(o=>o+vl).join(",");this.addEventListeners(a,()=>this._clearCache(t)),e.forEach(o=>this._setProperty(o)),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,i)}watch(t,e){(t||[]).forEach(i=>{this._setProperty(i),this.addEventListener(i+vl,e)})}}const Wr=new F;class km extends Fm{isTexture=!0;isRenderTargetTexture=!1;type="Texture";name="Texture";uuid=Lc();originSize=new F;originCenter=new F;size=new F;matrix=new ne;matrixAutoUpdate=!0;userData={};version=0;_needsUpdate=!1;image;offset=new F;repeat=new F(1,1);center=new F;rotate=0;scale=1;flipY=!0;constructor(t={}){super(t),this.setAttrs(t)}destroy(){super.destroy()}set needsUpdate(t){t&&(this.version++,this._needsUpdate=!0)}get needsUpdate(){return this._needsUpdate}updateSize(t,e,i,a){return this.originSize.copy(t),this.originCenter.copy(e),this.flipY&&this.originCenter.multiplyScalar(1,-1),this.updateFinalSize(i,a)}updateFinalSize(t,e){t&&!F.isZero(t)&&!F.isEmpty(t)?Wr.copy(t):Wr.copy(this.originSize),Wr.maxXY(1,1);const i=Math.sqrt(Wr.x*Wr.x+Wr.y*Wr.y)/Math.sqrt(e.x*e.x+e.y*e.y);return i>1&&Wr.multiplyScalar(1/i),this.scale=Wr.length()/this.originSize.length(),this.repeat.multiplyScalar(this.originSize.length()/Wr.length()),this.size.copy(Wr),this.offset.copy(this.originSize).multiplyScalar(-.5).add(this.originCenter),this.updateMatrix(),this}reset(t,e){t&&this.originSize.copy(t),e&&this.size.copy(e),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}}class en{static cached=new Map;static precisionOptimized=!0;static precisionOptimizeLevels=[.5,.25,1e-4];static initialized=!1;static textureMaxSize=new F;static DEBUG_DisplayCachedTexture=Mt.throttle((t=80,e=.8)=>{let i=Um();if(i||(i=qm(t,e)),!i)throw new Error("dom not found");Wm(i,this.cached)},5e3);static destroy(){Object.values(this.cached).forEach(t=>{t.destroy()}),this.cached=new Map}static has(t){return this.cached.has(t)}static get(t,e){if(t)return!this.precisionOptimized||!e?this.cached.get(t):e&&e<this.precisionOptimizeLevels[2]?this.get(t+"_3"):e&&e<this.precisionOptimizeLevels[1]?this.get(t+"_2"):e&&e<this.precisionOptimizeLevels[0]?this.get(t+"_1"):this.get(t)}static set(t,e){if(!t||!e)throw new Error("error input");return this.cached.set(t,e),e}static remove(t){if(!t||!this.cached.has(t))return;const e=this.cached.get(t);if(e&&e.destroy(),this.cached.delete(t),this.precisionOptimized)for(let i=1,a=this.precisionOptimizeLevels.length;i<=a;i++){const o=t+"_"+i;let l;this.cached.has(o)&&(l=this.cached.get(o),l&&l.destroy(),this.cached.delete(o))}}static clear(){this.destroy()}static setTextureMaxSize(){this.initialized||(this.textureMaxSize.set(kt.config.width,kt.config.height).multiplyScalar(.5).round(),this.initialized=!0)}static getTextureMaxSize(){return this.initialized||this.setTextureMaxSize(),this.textureMaxSize}static getTextureByShape(t,e,i,a){var l;const o=new km;if(this.setTextureMaxSize(),o.scale=1,o.repeat.set(1,1),o.rotate=0,o.image=void 0,o.version=0,console.warn("getTextureByShape: ============================",t.name),e&&!F.isZero(e)&&!F.isEmpty(e))ma.copy(e),t.alignCenter?t.boundingBox.getCenter(va):va.set(0,0);else{if(t.isShape&&((l=t.geometry)!=null&&l.boundingBox))wo.copy(t.geometry.boundingBox);else if(t.boundingBox)wo.copy(t.boundingBox);else throw new Error("get boundingBox error");wo.getSize(ma),t.alignCenter?t.boundingBox.getCenter(va):wo.getCenter(va)}return i&&!F.isZero(i)&&!F.isEmpty(i)?Ci.copy(i):Ci.copy(ma),(Ci.x<lp.x||Ci.y<lp.y)&&Ci.normalize().multiplyScalar(10).round(),ai.copy(this.getTextureMaxSize()),a&&(xa.set((a==null?void 0:a.shadowBlur)||0,(a==null?void 0:a.shadowBlur)||0),Ci.add(xa.clone().multiplyScalar(2)),ma.multiplyScalar(3),ai.multiplyScalar(.3)),o.updateSize(ma,va,Ci,ai),o}static setPrecisionOptimizeTextures(t,e,i,a,o){if(!this.precisionOptimized)return;let l;for(let c=0,f=this.precisionOptimizeLevels.length;c<f;c++){ai.copy(i.size).multiplyScalar(this.precisionOptimizeLevels[c]);const d=this.getTextureByShape(e,a,ai,o);this.renderShapeTexture(e,d,o),l=t+"_"+(c+1),d.userData.textureKey=l,en.set(l,d)}}static renderShapeTexture(t,e,i){i?(xa.set(i.shadowBlur||0,i.shadowBlur||0),si.copy(e.originSize).multiplyScalar(-.5).sub(e.originCenter).multiplyScalar(e.scale),t.alignCenter?Ao.copy(e.originSize).multiplyScalar(e.scale):Ao.copy(e.originSize).add(xa.clone().multiplyScalar(1)).multiplyScalar(e.scale)):si.copy(e.offset).negate().multiplyScalar(e.scale);const a=wi.create(e.size.x,e.size.y),o=wi.getContext2D(a,{alpha:!0});if(t.isText||!t.matrix.hasChange())o.clearRect(0,0,a.width,a.height),o.translate(si.x,si.y),o.scale(e.scale,-e.scale);else{t.matrix.decompose(hp,Hm,cp);const l=1/cp.x;si.sub(hp.multiplyScalar(l,-l)),o.clearRect(0,0,a.width,a.height),o.translate(si.x,si.y),o.scale(l,-l)}i&&(o.shadowColor=$t.black,o.shadowOffsetX=Ao.x,o.shadowOffsetY=Ao.y,o.shadowBlur=xa.x),t.render(o),e.image=a}static setByShape(t,e,i,a){const o=this.getTextureByShape(e,i,a);return o.userData.textureKey=t,this.renderShapeTexture(e,o),en.set(t,o),e.featureKey=t,o}static setShadowByShape(t,e,i){const a=this.getTextureByShape(e,void 0,void 0,i);return a.userData.textureKey=t,this.renderShapeTexture(e,a,i),en.set(t,a),a}static setPointsByShape(t,e){var d,g,E,T,C;const i=[];e.isGroup?e.traverse(L=>L.isShape?i.push(...L.geometry.points):void 0):e.isShape&&e.geometry.points?i.push(...e.geometry.points):e.boundingBox&&i.push(e.boundingBox.min,e.boundingBox.max);const a=this.getTextureByShape(e),o=((d=e.material)==null?void 0:d.lineWidth)*2||3;Di.set(1,1).multiplyScalar(o),a.size.copy(Di).multiplyScalar(a.scale).multiplyScalar(2).add(Ci),a.offset.sub(Di),a.updateMatrix();const l=wi.create(a.size.x,a.size.y),c=wi.getContext2D(l,{alpha:!0});si.subVectors(a.originSize.clone().multiplyScalar(.5),a.originCenter).add(Di),c.clearRect(0,0,l.width,l.height),c.scale(a.scale,a.scale),c.translate(si.x,si.y);let f=$t.black;e.material?f=((g=e.material)==null?void 0:g.stroke)||((E=e.material)==null?void 0:E.fill):e.isGroup&&e.children.length&&e.children[0].isShape&&(f=((T=e.children[0].material)==null?void 0:T.stroke)||((C=e.children[0].material)==null?void 0:C.fill)),c.fillStyle=Wt.getDarken(f);for(let L=0,N=i.length||0;L<N;L++)ai.copy(i[L]),c.moveTo(ai.x,ai.y),c.arc(ai.x,ai.y,Di.x,0,Math.PI*2);return c.fill(),a.image=l,en.set(t,a),a}static setWireframeByShape(t,e){var c;const i=this.getTextureByShape(e);Di.set(1,1).multiplyScalar(((c=e.mat)==null?void 0:c.lineWidth)||1),i.size.copy(Di).multiplyScalar(i.scale).multiplyScalar(2).add(Ci),i.offset.sub(Di),i.updateMatrix();const a=wi.create(i.size.x,i.size.y),o=wi.getContext2D(a,{alpha:!0}),l=Di.x*i.scale*5;return o.clearRect(0,0,a.width,a.height),o.strokeStyle=$t.darkGray,o.lineWidth=l,o.setLineDash([l*3,l]),o.strokeRect(0,0,i.size.x,i.size.y),i.image=a,en.set(t,i),i}}const lp=new F(10,10),ma=new F,va=new F,Ci=new F,si=new F,Ao=new F,xa=new F,ai=new F,Di=new F,wo=new St,hp=new F,Hm=new F,cp=new F;function Um(){return window.document.getElementById("DEBUG_Displaycached")}function qm(r=80,t=.8){const e=document.createElement("div");function i(){e.style.opacity="1"}function a(){e.style.opacity=t.toString()}return e.setAttribute("id","DEBUG_Displaycached"),e.style.position="absolute",e.style.width=r+"px",e.style.height="92vh",e.style.background=`rgba(255, 255, 255, ${t})`,e.style.left="20px",e.style.top="20px",e.style.overflow="auto",e.style.padding="6px",e.style.opacity=t.toString(),e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",a),document.body.appendChild(e),e}function Wm(r,t){t.forEach((e,i)=>{!e||!e.image||Vm(r,i,e)})}function Vm(r,t,e){let i;for(let a=0,o=r.childNodes.length;a<o;a++)if(r.childNodes[a].getAttribute("id")===t){i=r.childNodes[a];break}i?$m(i,e):zm(r,t,e)}function zm(r,t,e){if(!e.image)return;const i=kt.document.createElement("div");i.setAttribute("id",t),i.style.display="flex",i.style.flexDirection="column";const a=wi.createCanvas({containerId:r.id,width:e.image.width,height:e.image.height,dpr:window.devicePixelRatio});a.style.border=`${$t.yellow} 1px solid`,a.style.maxWidth=parseInt(r.style.width)-2+"px",a.style.maxHeight=parseInt(a.style.maxWidth)/(e.image.width/e.image.height)+"px";const o=a.getContext("2d",{alpha:!0});if(!o)throw new Error("getContext error");o.save(),o.scale(window.devicePixelRatio,window.devicePixelRatio),o.drawImage(e.image,0,0),o.restore(),i.appendChild(a);const l=kt.document.createElement("p");l.innerHTML=e.image.width+" * "+e.image.height,l.innerHTML+="<br/>"+t,l.style.margin="0",l.style.padding="0",l.style.lineHeight="1.2",l.style.fontSize="10px",l.style.padding="3px 0 6px 0",l.style.color=$t.black,i.appendChild(l),r.appendChild(i);function c(){const f=a.toDataURL("image/png",.6),d=document.createElement("a"),g=new MouseEvent("click");d.download=`thumb.${Date.now()}.png`,d.href=f,d.dispatchEvent(g)}i.addEventListener("click",c)}function $m(r,t){if(!t.image)return;const e=r.querySelector("canvas");if(!e)return;const i=e.getContext("2d",{alpha:!0});if(!i)throw new Error("getContext error");i.clearRect(0,0,e.width,e.height),i.save(),i.scale(window.devicePixelRatio,window.devicePixelRatio),i.drawImage(t.image,0,0),i.restore()}class Gm extends Ge{cvs;worker;view;boundingBox=new St;viewTapHandler=this.handleViewTap.bind(this);multiSelectByRangeHandler=this.handleMultiSelectByRange.bind(this);workerMessageHandler=this.handleWorkerMessage.bind(this);cameraHandler=this.handleCameraChanged.bind(this);runningHandler=this.running.bind(this);constructor(t={},e){super(),t.workerRender=!0,this.params=t,kt.config=t;const i=wi.createCanvas(t);if(!i.transferControlToOffscreen)throw new Error("not support transferControlToOffscreen");this.cvs=i.transferControlToOffscreen(),this.view=new Im(t),this.view.camera.name="mainCamera",this.view.camera.resize(),this.worker=e,this.bindEvents()}destroy(){super.destroy(),this.unbindEvents(),this.worker.postMessage({task:Dt.TERMINATE}),this.worker.terminate()}bindEvents(){var t,e,i,a,o;(e=(t=this.view)==null?void 0:t.controller)==null||e.addEventListener(ot.TAP,this.viewTapHandler),(i=this.view)==null||i.addEventListener(Dt.MULTI_SELECT_BY_RANGE,this.multiSelectByRangeHandler),(o=(a=this.view)==null?void 0:a.camera)==null||o.addEventListener(lo.UPDATE,this.cameraHandler),this.worker.addEventListener("message",this.workerMessageHandler)}unbindEvents(){var t,e,i,a;(e=(t=this.view)==null?void 0:t.controller)==null||e.removeEventListener(ot.TAP,this.viewTapHandler),(a=(i=this.view)==null?void 0:i.controller)==null||a.removeEventListener(ot.CAMERA_CHANGED,this.cameraHandler),this.worker.removeEventListener("message",this.workerMessageHandler)}async handleViewTap(t){if((t==null?void 0:t.type)!==ot.TAP)return;const e=await this.promiseWorkerResponse(Dt.TAP,t.data);this.dispatchEvent({type:Dt.SELECTED,data:e})}handleWorkerMessage(t){var e,i,a,o,l,c;switch(t.data.task){case Dt.CAMERA_SYNC:if(!((e=t==null?void 0:t.data)!=null&&e.data))break;const f=JSON.parse(t.data.data);(a=(i=this.view)==null?void 0:i.camera)==null||a.fromJSON(f),this.view.camera.computeBoundingBox();break;case Dt.CAMERA_CHANGED:const{t:d,r:g,s:E}=t.data.data;(l=(o=this.view)==null?void 0:o.camera)==null||l.setTRS(d,g,E);break;case Dt.SCENES_CHANGED:const{box:T}=t.data.data;if(!T)return;this.boundingBox.fromString(T);break;case"syncTextureHelperCached":(((c=t.data)==null?void 0:c.data)||[]).forEach((C,L)=>en.set(L,C));break;case"pong":console.log("response: pong");break}}handleCameraChanged(t){this.worker.postMessage({task:Dt.CAMERA_CHANGED,data:t.data})}promiseWorkerResponse(t,e){return new Promise((i,a)=>{const o=c=>{var f;((f=c==null?void 0:c.data)==null?void 0:f.task)===t&&(this.worker.removeEventListener("message",o),this.worker.removeEventListener("error",l),i(c.data.data))},l=c=>{this.worker.removeEventListener("message",o),this.worker.removeEventListener("error",l),a(c.error)};this.worker.addEventListener("message",o),this.worker.addEventListener("error",l),this.worker.postMessage({task:t,data:e})})}async handleMultiSelectByRange(t){return this.promiseWorkerResponse(Dt.MULTI_SELECT_BY_RANGE,t.data)}resize(){var t;(t=this.view.camera)==null||t.resize()}async load(t,e){return this.promiseWorkerResponse(Dt.LOAD,{url:t,layers:e})}async getLayers(t=2){return this.promiseWorkerResponse(Dt.GET_LAYERS,{lv:t})}assetTypeChanged(t=$e.RM){this.params.assetType=t,this.worker.postMessage({task:Dt.ASSET_TYPE_CHANGED,data:t})}usedCacheChanged(t=!1){this.params.usedCache=t,this.worker.postMessage({task:Dt.USED_CACHE_CHANGED,data:t})}debounceCacheChanged(t=!1){this.params.debounceCache=t,this.worker.postMessage({task:Dt.DEBOUNCE_CACHE_CHANGED,data:t})}wireframeChanged(t=!1){this.params.wireframe=t,this.worker.postMessage({task:Dt.WIREFRAME_CHANGED,data:t})}bgPassChanged(t=!1){this.params.bgPass=t,this.worker.postMessage({task:Dt.BG_PASS_CHANGED,data:t})}async selectEnableChanged(t=!1){await this.clearSelected(),this.params.selectEnable=t,this.worker.postMessage({task:Dt.SELECT_ENABLE_CHANGED,data:t})}async multiSelectEnableChanged(t=!1){await this.clearSelected(),this.params.multiSelectEnable=t,this.view.multiSelectEnableChanged(t),this.worker.postMessage({task:Dt.MULTI_SELECT_ENABLE_CHANGED,data:t})}async zoomToSelectEnableChanged(t=!1){return this.params.zoomToSelectEnable=t,this.view.zoomToSelectEnableChanged(t),this.promiseWorkerResponse(Dt.ZOOM_TO_SELECT_ENABLE_CHANGED,{data:t})}async svgLoadingTypeChanged(t){return this.params.svgLoadingType=t,this.promiseWorkerResponse(Dt.SVG_LOADING_TYPE_CHANGED,t)}async fullscreen(){await 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,e=!1){this.worker.postMessage({task:Dt.UPDATE_LAYERS_VISIBILITY,data:{ids:t,visible:e}})}clearSelected(t){return this.promiseWorkerResponse(Dt.CLEAR_SELECTED,{data:t})}selectByIds(t){this.worker.postMessage({task:Dt.SELECT_BY_IDS,data:t})}targetByIds(t){this.worker.postMessage({task:Dt.TARGET_BY_IDS,data:t})}async getAssetIdsByType(t){return this.promiseWorkerResponse(Dt.GET_ASSET_IDS_BY_TYPE,{assetType:t})}setFillByIds(t,e){this.worker.postMessage({task:Dt.SET_FILL_BY_IDS,data:{ids:t,c:e}})}clearFill(){this.worker.postMessage({task:Dt.CLEAR_FILL})}setStrokeByIds(t,e){this.worker.postMessage({task:Dt.SET_STROKE_BY_IDS,data:{ids:t,c:e}})}clearStroke(){this.worker.postMessage({task:Dt.CLEAR_STROKE})}async fontZoomIn(t=1.1){return this.promiseWorkerResponse(Dt.FONT_ZOOM_IN,t)}async fontZoomOut(t=.9){return this.promiseWorkerResponse(Dt.FONT_ZOOM_OUT,t)}start(){const t=this.cvs,e=JSON.stringify(this.params);this.worker.postMessage({task:Dt.INIT,data:{cvs:t,config:e}},[t]),requestAnimationFrame(this.runningHandler)}running(t){var e;(e=this.view)==null||e.update(t),requestAnimationFrame(this.runningHandler),en.DEBUG_DisplayCachedTexture()}stop(){}}function Ym(r){return new Worker("/environment.worker.js",{type:"module",name:r==null?void 0:r.name})}function Xm(r){return new Worker("/renderer.worker.js",{type:"module",name:r==null?void 0:r.name})}ce.AppEnum=op,ce.AppOffscreen=Gm,ce.AssetTypeEnum=$e,ce.Box2=l0,ce.Color=Wt,ce.ColorsEnum=$t,ce.EnvironmentWorker=Ym,ce.GLOB=kt,ce.LayerTypeEnum=Ks,ce.Monitor=Ft,ce.RendererWorker=Xm,ce.SvgApp=Bm,ce.Vector2=o0,ce.defaultConfig=Zn,Object.defineProperty(ce,Symbol.toStringTag,{value:"Module"})});
@@ -4035,7 +4035,7 @@ var Gw = qx((La) => {
4035
4035
  Pa.normalizeLineEndings = Od;
4036
4036
  Pa.DOMParser = Md;
4037
4037
  var T_ = Pa.DOMParser;
4038
- const C_ = "1.0.58";
4038
+ const C_ = "1.0.59";
4039
4039
  function S_() {
4040
4040
  return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
4041
4041
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archgine",
3
- "version": "1.0.58",
3
+ "version": "1.0.59",
4
4
  "description": "A simple rendering engine developed by archbds.",
5
5
  "author": "diozhu@163.com",
6
6
  "license": "ISC",