@esri/solutions-components 1.0.2 → 1.0.4

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.
Files changed (476) hide show
  1. package/dist/cdn/{HISSLYMD.js → 22U6FEYE.js} +2 -2
  2. package/dist/cdn/{AGN7ST2V.js → 2CQ66JGS.js} +2 -2
  3. package/dist/cdn/{T7XUVORP.js → 2IQPFNPX.js} +2 -2
  4. package/dist/cdn/{QUB3JPGL.js → 2MCXJEIU.js} +1 -1
  5. package/dist/cdn/{VSEHM5KR.js → 2N3SSEWE.js} +2 -2
  6. package/dist/cdn/{N4BYA7EI.js → 2QFAL42J.js} +2 -2
  7. package/dist/cdn/{3UITRYPY.js → 2UH456LC.js} +1 -1
  8. package/dist/cdn/{B2AUDLTO.js → 2XKHAKJH.js} +2 -2
  9. package/dist/cdn/{K3UTGJMU.js → 3CQVKR4G.js} +1 -1
  10. package/dist/cdn/{34FKJAYZ.js → 3FJRQN27.js} +2 -2
  11. package/dist/cdn/{Q2BUQJJY.js → 3HR3VX4I.js} +2 -2
  12. package/dist/cdn/{4CA5Q4HU.js → 3HVOQ754.js} +2 -2
  13. package/dist/cdn/{MRHAUAK5.js → 3KRHILOK.js} +1 -1
  14. package/dist/cdn/{GJYS7J5Y.js → 3M5E2W6J.js} +2 -2
  15. package/dist/cdn/{EXPP7EHV.js → 3MTECQIQ.js} +2 -2
  16. package/dist/cdn/{IGNOSAEB.js → 3O2FMCDB.js} +1 -1
  17. package/dist/cdn/{SFYHUOTM.js → 3PGLZBWX.js} +2 -2
  18. package/dist/cdn/{FQRP6IK4.js → 3PNCQZNB.js} +2 -2
  19. package/dist/cdn/{HVCG3MNH.js → 3VRCHULS.js} +2 -2
  20. package/dist/cdn/{QMCJ7WTH.js → 42AUJGFJ.js} +2 -2
  21. package/dist/cdn/{M4Q44Y7R.js → 45R5CD5E.js} +2 -2
  22. package/dist/cdn/{2TV52QIG.js → 46Z6LRFP.js} +2 -2
  23. package/dist/cdn/{ZM76BYQX.js → 4P2ED5MG.js} +2 -2
  24. package/dist/cdn/{ZUKAASU2.js → 4QEWKLNG.js} +2 -2
  25. package/dist/cdn/{TL4CBL4J.js → 4QGW7XLZ.js} +2 -2
  26. package/dist/cdn/{QTN6BMW2.js → 4RUO65YZ.js} +1 -1
  27. package/dist/cdn/{Q4KUEUUN.js → 4V3EN7XG.js} +2 -2
  28. package/dist/cdn/{BN32H2NI.js → 525IK7S3.js} +2 -2
  29. package/dist/cdn/{RSH2UKEC.js → 55MHSSEJ.js} +2 -2
  30. package/dist/cdn/{MRDF2627.js → 5FTGQPO5.js} +2 -2
  31. package/dist/cdn/{45JENHBT.js → 5GCZQ47Q.js} +2 -2
  32. package/dist/cdn/{YWLH4TVT.js → 5GEHFK5G.js} +2 -2
  33. package/dist/cdn/{AXNLHEND.js → 5KH5K5HP.js} +2 -2
  34. package/dist/cdn/{IARLSMD2.js → 5OKQHKMQ.js} +2 -2
  35. package/dist/cdn/5Q2JJCFF.js +4 -0
  36. package/dist/cdn/{L6MHQFEW.js → 5QPBHI6N.js} +2 -2
  37. package/dist/cdn/{MFT2YTZE.js → 5YJKRSII.js} +2 -2
  38. package/dist/cdn/{UGDEHIGY.js → 5ZUU5HU5.js} +2 -2
  39. package/dist/cdn/{TGECS5FN.js → 62OBHD7N.js} +2 -2
  40. package/dist/cdn/{C6RAYAOF.js → 67776ZSV.js} +2 -2
  41. package/dist/cdn/{TND7GPH7.js → 6DXOCCZA.js} +1 -1
  42. package/dist/cdn/{QBKQBYYD.js → 6M3KYJDD.js} +2 -2
  43. package/dist/cdn/{5D4L7E7B.js → 6QIO3AQD.js} +2 -2
  44. package/dist/cdn/{UGWIFJHW.js → 72A2Y2EQ.js} +1 -1
  45. package/dist/cdn/{N4NNCHK6.js → 73W26K5Q.js} +2 -2
  46. package/dist/cdn/{2WXZBSU3.js → 755YFLK2.js} +2 -2
  47. package/dist/cdn/{6YWQEJ3R.js → 77SH6QGE.js} +2 -2
  48. package/dist/cdn/{DAE4AFWE.js → 7DEMXTPR.js} +2 -2
  49. package/dist/cdn/7GJVOL2K.js +4 -0
  50. package/dist/cdn/{TYK6M57O.js → 7KJZVI5W.js} +2 -2
  51. package/dist/cdn/{3UIKDYVX.js → 7M4VGKUT.js} +1 -1
  52. package/dist/cdn/{7DSO57VG.js → 7UJMLOZS.js} +2 -2
  53. package/dist/cdn/{SPYEGWSA.js → 7W5RZY7N.js} +2 -2
  54. package/dist/cdn/{4V6HHPEY.js → 7WWEF64M.js} +2 -2
  55. package/dist/cdn/{BTHJLT2K.js → 7XD5FYQH.js} +2 -2
  56. package/dist/cdn/{6RC6X7JL.js → A3ZMYVXL.js} +2 -2
  57. package/dist/cdn/{CST36BMZ.js → A6ZN7UQQ.js} +2 -2
  58. package/dist/cdn/{XNRASUFU.js → A7ABJL6C.js} +2 -2
  59. package/dist/cdn/{ME3PJXJC.js → A7PIN73K.js} +2 -2
  60. package/dist/cdn/{WONNB7ZA.js → ACYYQPGH.js} +2 -2
  61. package/dist/cdn/{W5Q4PI4D.js → AD654KDS.js} +2 -2
  62. package/dist/cdn/{TF5NNCNV.js → ADQGTHIK.js} +2 -2
  63. package/dist/cdn/{CU4HDBVA.js → AI6YM633.js} +2 -2
  64. package/dist/cdn/{6OFBEWUU.js → AK2IOGVT.js} +1 -1
  65. package/dist/cdn/{NS7LWOIF.js → AQOENSWY.js} +1 -1
  66. package/dist/cdn/{LYLGDYC3.js → AROCXE5W.js} +2 -2
  67. package/dist/cdn/{YX4KF34C.js → ATGDZI46.js} +2 -2
  68. package/dist/cdn/{SEVUDBYU.js → B5TR3333.js} +2 -2
  69. package/dist/cdn/{U5EERXBG.js → B5XYDLJB.js} +2 -2
  70. package/dist/cdn/BII4KR4A.js +4 -0
  71. package/dist/cdn/{M6VJRRQ6.js → BRT757S3.js} +2 -2
  72. package/dist/cdn/{RDBY4KOY.js → C3OFPO6W.js} +2 -2
  73. package/dist/cdn/C5C4KHG2.js +4 -0
  74. package/dist/cdn/{ZLEZXMKN.js → CBMM32W4.js} +2 -2
  75. package/dist/cdn/{QKUXZWFL.js → CFXL3A27.js} +2 -2
  76. package/dist/cdn/{Y3DUHGHO.js → CH7DLGUP.js} +1 -1
  77. package/dist/cdn/{XL6DAOQU.js → CHBTCIMS.js} +2 -2
  78. package/dist/cdn/{5PEEQTOJ.js → CIWLUKBJ.js} +2 -2
  79. package/dist/cdn/{QNUW3X3Y.js → CJOWQ5NE.js} +2 -2
  80. package/dist/cdn/{JCJADZGS.js → CKQRWDEZ.js} +2 -2
  81. package/dist/cdn/{DKB2YHXU.js → CSQMTZUS.js} +2 -2
  82. package/dist/cdn/{BBCZTH66.js → CUKJYJQY.js} +1 -1
  83. package/dist/cdn/{IJNIOO5S.js → CWSLTV67.js} +2 -2
  84. package/dist/cdn/{QZWC4VIB.js → D22VRCQZ.js} +2 -2
  85. package/dist/cdn/{AXPTSMNQ.js → D2RRQ3X4.js} +2 -2
  86. package/dist/cdn/{WDJYH74E.js → DBZRC2CE.js} +2 -2
  87. package/dist/cdn/{NJBLOY6O.js → DC2E55EL.js} +2 -2
  88. package/dist/cdn/{427VOQVY.js → DDOXQYTI.js} +2 -2
  89. package/dist/cdn/{EW2G5EHV.js → DGN4U6I6.js} +2 -2
  90. package/dist/cdn/{C5LL6JKL.js → DHOIKSPR.js} +2 -2
  91. package/dist/cdn/{53U2O7QU.js → DJ4ET7YE.js} +2 -2
  92. package/dist/cdn/{OX6RYCMB.js → DLQHSRI3.js} +2 -2
  93. package/dist/cdn/{J6BS2SYI.js → DNSJZC4P.js} +2 -2
  94. package/dist/cdn/{OJUIATLV.js → DSZ5WOHN.js} +2 -2
  95. package/dist/cdn/{6CHYPF6P.js → DVIQ73JS.js} +2 -2
  96. package/dist/cdn/{PT2PN6JX.js → DYEFEHAR.js} +2 -2
  97. package/dist/cdn/{ZPQ43SZ3.js → EFKYF4YS.js} +2 -2
  98. package/dist/cdn/{TA2KPG6T.js → EI2SLBFR.js} +2 -2
  99. package/dist/cdn/{UJYMNOGA.js → EK6E5RV4.js} +2 -2
  100. package/dist/cdn/{RQNGE4QQ.js → EKX5RPAU.js} +2 -2
  101. package/dist/cdn/{P6I2SMSL.js → ENKVILKY.js} +2 -2
  102. package/dist/cdn/{HE7ELDIR.js → EOWZY5KN.js} +1 -1
  103. package/dist/cdn/{URAHLQ3P.js → EPWZGWQJ.js} +2 -2
  104. package/dist/cdn/{O7SEZIYA.js → EQ3E3UVU.js} +2 -2
  105. package/dist/cdn/{PJC5OY32.js → EQQAWMKP.js} +1 -1
  106. package/dist/cdn/{GLKAIY7B.js → ERJCAGCH.js} +2 -2
  107. package/dist/cdn/{UHULYTFL.js → EUZPXNNK.js} +1 -1
  108. package/dist/cdn/F2MMZAMU.js +18 -0
  109. package/dist/cdn/{KQ6WZUPW.js → F7N2K2CB.js} +2 -2
  110. package/dist/cdn/{RUMM4LRY.js → FFIBCVX2.js} +2 -2
  111. package/dist/cdn/{PWAA6UKX.js → FMIGRU3V.js} +2 -2
  112. package/dist/cdn/{QIVGXNMA.js → FTC6GK32.js} +2 -2
  113. package/dist/cdn/{V3KV4ZPK.js → GAV3AXFW.js} +1 -1
  114. package/dist/cdn/{DNSP25OL.js → GCOXBUN5.js} +1 -1
  115. package/dist/cdn/{HMOPCXOD.js → GDUFF5HE.js} +2 -2
  116. package/dist/cdn/{E7DQW7XG.js → GGCVMVWS.js} +2 -2
  117. package/dist/cdn/{DVKB52PG.js → GJGBNYWB.js} +2 -2
  118. package/dist/cdn/{NDXSJLKV.js → GOMTEPFA.js} +1 -1
  119. package/dist/cdn/{QPQDH5UO.js → GPO4L446.js} +2 -2
  120. package/dist/cdn/{N6AFW5X5.js → GPR4I62X.js} +2 -2
  121. package/dist/cdn/{3L5CUNW3.js → H3QBALK4.js} +2 -2
  122. package/dist/cdn/{DDIKF3Y6.js → H4R7X2AK.js} +2 -2
  123. package/dist/cdn/{R6VHQQOK.js → H57ZKHJ4.js} +1 -1
  124. package/dist/cdn/{BPHSFWBE.js → HOQDPNYX.js} +2 -2
  125. package/dist/cdn/{XWBLDO6F.js → HPVZXEFN.js} +1 -1
  126. package/dist/cdn/{3VJVSHZ3.js → HZDGJLAD.js} +2 -2
  127. package/dist/cdn/{Z2FRFIOF.js → I74ECT7N.js} +2 -2
  128. package/dist/cdn/{627BP4CQ.js → I7AMZQNZ.js} +2 -2
  129. package/dist/cdn/{BIVUMER5.js → IEEVFYKM.js} +1 -1
  130. package/dist/cdn/{OMJT2NGS.js → IQE4M5WS.js} +2 -2
  131. package/dist/cdn/{5Q6ZKF23.js → J2SERNA3.js} +1 -1
  132. package/dist/cdn/{G57AFF3K.js → JSCLICIM.js} +1 -1
  133. package/dist/cdn/{YX2IMVKL.js → JSML77IB.js} +1 -1
  134. package/dist/cdn/{P5VXHMBV.js → JUWCTKXD.js} +2 -2
  135. package/dist/cdn/{CH2V66RG.js → JWLGFVVC.js} +2 -2
  136. package/dist/cdn/{NHKMUTOW.js → JYVM54WT.js} +2 -2
  137. package/dist/cdn/{CDC2AGQU.js → KC4KCTUH.js} +2 -2
  138. package/dist/cdn/{T757ITK2.js → KEC5BNS2.js} +2 -2
  139. package/dist/cdn/{SMUXGPZR.js → KJROYCIQ.js} +2 -2
  140. package/dist/cdn/{Q7OC2577.js → KK3QWOG2.js} +2 -2
  141. package/dist/cdn/{RVQFI2GI.js → KLCMDGZK.js} +2 -2
  142. package/dist/cdn/{MEIJQ75E.js → KNBDWSMQ.js} +2 -2
  143. package/dist/cdn/{MPH25RN2.js → KPNSWPLU.js} +2 -2
  144. package/dist/cdn/{CXHBMY3H.js → KYNAJJDV.js} +2 -2
  145. package/dist/cdn/{MBB3DRUX.js → L6PPOZ6H.js} +2 -2
  146. package/dist/cdn/{MW46SBLS.js → LCT3NQOR.js} +2 -2
  147. package/dist/cdn/{AX3GHSA4.js → LEPX2J3T.js} +2 -2
  148. package/dist/cdn/{MCOVXOZE.js → LFX2BV5P.js} +2 -2
  149. package/dist/cdn/{UZSGGRRN.js → M4VW4GKI.js} +2 -2
  150. package/dist/cdn/{NF6VWQKC.js → M53O7AL7.js} +2 -2
  151. package/dist/cdn/{H236KX4X.js → M6I7SCR3.js} +2 -2
  152. package/dist/cdn/MA6BHO3S.js +4 -0
  153. package/dist/cdn/{2DREXAAI.js → MALVFH5T.js} +2 -2
  154. package/dist/cdn/{PQ55EL2N.js → MEARRFPL.js} +2 -2
  155. package/dist/cdn/{XOZFNKXY.js → MEIVZYDH.js} +2 -2
  156. package/dist/cdn/{V72LELKA.js → MFHU7RCE.js} +2 -2
  157. package/dist/cdn/{CBU5ZJTL.js → MFRHP354.js} +2 -2
  158. package/dist/cdn/{HX4VINVI.js → MGAAWVDA.js} +1 -1
  159. package/dist/cdn/{ORFCQZNQ.js → MIBMXAW4.js} +2 -2
  160. package/dist/cdn/{LHDC2KUS.js → MICSEU5B.js} +2 -2
  161. package/dist/cdn/{RQZHVOZW.js → MN4AZD42.js} +2 -2
  162. package/dist/cdn/{623OCGUZ.js → MN5Q6VKW.js} +2 -2
  163. package/dist/cdn/{GSHJMUOL.js → MQWLMWGB.js} +2 -2
  164. package/dist/cdn/{AWOD4YMZ.js → N7IUWXAA.js} +2 -2
  165. package/dist/cdn/{PBS5CVH6.js → NCLWZM55.js} +2 -2
  166. package/dist/cdn/{RZBKYA4H.js → NDWOAOHX.js} +1 -1
  167. package/dist/cdn/{IDOBPHGE.js → NF47PQ7Q.js} +2 -2
  168. package/dist/cdn/{3QXMAC7L.js → NGN4GJ7L.js} +2 -2
  169. package/dist/cdn/NJB5H6NT.js +4 -0
  170. package/dist/cdn/{J5SSKOUJ.js → NK6VN5CV.js} +2 -2
  171. package/dist/cdn/{5UIQ5XPI.js → NM3XHUXJ.js} +1 -1
  172. package/dist/cdn/{6ZPPQS7Z.js → NNED4X6O.js} +2 -2
  173. package/dist/cdn/{EJ2ZYQDN.js → NT3MKX5U.js} +2 -2
  174. package/dist/cdn/{LMJVHANR.js → NXZAIYZX.js} +2 -2
  175. package/dist/cdn/{PK2KYHCB.js → NZ6L23VR.js} +2 -2
  176. package/dist/cdn/{UDSTQRSC.js → NZJDAUCM.js} +2 -2
  177. package/dist/cdn/{A2LA4B77.js → O27D4YVO.js} +2 -2
  178. package/dist/cdn/{TSJWAHST.js → O42JTMA4.js} +2 -2
  179. package/dist/cdn/{PZ4I46YP.js → O5G3N4I4.js} +2 -2
  180. package/dist/cdn/{KK5EFX35.js → O6DAQEXK.js} +2 -2
  181. package/dist/cdn/{3OPTGOTN.js → OBGLJ4AM.js} +2 -2
  182. package/dist/cdn/{JQKAETCU.js → OHWF5VUN.js} +1 -1
  183. package/dist/cdn/{FGX5VXCN.js → ORKHRXHB.js} +2 -2
  184. package/dist/cdn/{5IMGOBVR.js → P3ZGSTRY.js} +2 -2
  185. package/dist/cdn/{CBAXU66B.js → P5WUMEFT.js} +2 -2
  186. package/dist/cdn/{BSBALSW3.js → PEHGGHQ4.js} +2 -2
  187. package/dist/cdn/{N6WPLWG3.js → PEJAYVXV.js} +2 -2
  188. package/dist/cdn/{5BS5RPN3.js → PEPBVRCK.js} +2 -2
  189. package/dist/cdn/{JFXEOOWV.js → PKEJXERE.js} +2 -2
  190. package/dist/cdn/{XINOQA62.js → PMRPPUOG.js} +1 -1
  191. package/dist/cdn/{MJ6UHJO5.js → PPCFTYMM.js} +2 -2
  192. package/dist/cdn/{HY3PBNPE.js → PQ75UOOH.js} +3 -3
  193. package/dist/cdn/{FYGEDZYU.js → PSP2EVIP.js} +2 -2
  194. package/dist/cdn/{XPTTFHFY.js → PTLSOJ2V.js} +2 -2
  195. package/dist/cdn/{DMOKBYTT.js → PY6UCRJ4.js} +2 -2
  196. package/dist/cdn/{D3MKS27U.js → Q4EXL46G.js} +2 -2
  197. package/dist/cdn/{MDBE6QB6.js → QENLODCT.js} +2 -2
  198. package/dist/cdn/{NVRFL7NL.js → QFODTZZX.js} +2 -2
  199. package/dist/cdn/{4B47MLZ4.js → QH63BAVO.js} +2 -2
  200. package/dist/cdn/{2HCC42DE.js → QLVKQU3N.js} +2 -2
  201. package/dist/cdn/{E6YH3G2I.js → QPJLKOGU.js} +1 -1
  202. package/dist/cdn/{X26TSF65.js → QT25SZ3S.js} +2 -2
  203. package/dist/cdn/{WS7S5Z7C.js → QVEKZTHX.js} +2 -2
  204. package/dist/cdn/{BWY46B5P.js → R2IVNBNU.js} +2 -2
  205. package/dist/cdn/{57ICJINS.js → R4JBNSHM.js} +2 -2
  206. package/dist/cdn/{I2QY6RRM.js → RNVECRCO.js} +2 -2
  207. package/dist/cdn/{G2U2FC5M.js → ROGVNZHG.js} +2 -2
  208. package/dist/cdn/{YFRUN4NK.js → S3O4R37V.js} +2 -2
  209. package/dist/cdn/{VOP3WFWQ.js → S7TD37PA.js} +2 -2
  210. package/dist/cdn/{T5ORGPHJ.js → SISGIM4G.js} +2 -2
  211. package/dist/cdn/{2KQCEICX.js → SK6BPGF7.js} +4 -4
  212. package/dist/cdn/{WPQTSQ5W.js → SM2ZGXN2.js} +2 -2
  213. package/dist/cdn/{RHC7DNDW.js → SN7Y4QIQ.js} +1 -1
  214. package/dist/cdn/{OU5FGKZQ.js → SQA4Z3HQ.js} +2 -2
  215. package/dist/cdn/{6ULIHKIX.js → ST5DNJ5A.js} +1 -1
  216. package/dist/cdn/{VC3OUF74.js → SU5YNWLR.js} +2 -2
  217. package/dist/cdn/{OSZNMAJF.js → T2MYK67I.js} +2 -2
  218. package/dist/cdn/{C7N6NXZS.js → TA7HLGDD.js} +2 -2
  219. package/dist/cdn/{OWFH6YUK.js → TFCVVUA3.js} +2 -2
  220. package/dist/cdn/{OGNLV67M.js → THC2GZPK.js} +1 -1
  221. package/dist/cdn/{YWS4DWQO.js → TIJ35HYZ.js} +2 -2
  222. package/dist/cdn/{QH7FXF55.js → TNZETMBZ.js} +2 -2
  223. package/dist/cdn/{X7CS7ZS5.js → TPLOAFHX.js} +2 -2
  224. package/dist/cdn/{EU66V4DL.js → TW6H3Y5C.js} +2 -2
  225. package/dist/cdn/{3BCY5VBO.js → TZTD5Q2B.js} +2 -2
  226. package/dist/cdn/{ZQRUDWGJ.js → U75KCBUY.js} +2 -2
  227. package/dist/cdn/{2N4CQXHT.js → UBNEDJDQ.js} +2 -2
  228. package/dist/cdn/{MMQ4KQ2B.js → UD6VCHUK.js} +2 -2
  229. package/dist/cdn/{AGXQF5CB.js → UFT52UFX.js} +2 -2
  230. package/dist/cdn/{EIG2RIEW.js → UHGKM2WA.js} +2 -2
  231. package/dist/cdn/{Z3W52BA5.js → UJN2FPCY.js} +2 -2
  232. package/dist/cdn/{ITWRX5NJ.js → UJSAFWWD.js} +2 -2
  233. package/dist/cdn/{J4QVOH72.js → UK42NUMO.js} +2 -2
  234. package/dist/cdn/{5X2CUO2G.js → UYA6RFIA.js} +2 -2
  235. package/dist/cdn/{IQVXZDV3.js → UZQC4ZVD.js} +2 -2
  236. package/dist/cdn/{VVZJIYXL.js → V46NQTOH.js} +2 -2
  237. package/dist/cdn/{SZVMRJ24.js → VCK56OWN.js} +1 -1
  238. package/dist/cdn/{MWZRE5PN.js → VRFHYYVR.js} +2 -2
  239. package/dist/cdn/{KF6SZPRF.js → VY7KRQYG.js} +2 -2
  240. package/dist/cdn/{6Y37L4Y2.js → W3Z2KVM3.js} +1 -1
  241. package/dist/cdn/{KYJLH6UV.js → W7DEAFBS.js} +2 -2
  242. package/dist/cdn/WAN4LQ52.js +18 -0
  243. package/dist/cdn/{2RQJQWZN.js → WB2FCUBE.js} +2 -2
  244. package/dist/cdn/{MS7LIRHZ.js → WG5YJAJK.js} +2 -2
  245. package/dist/cdn/{SB6IKLS3.js → WGL2BCUM.js} +2 -2
  246. package/dist/cdn/{BVYE77GY.js → WMRXZUG4.js} +2 -2
  247. package/dist/cdn/{EUJJCM4N.js → WNOY5N4R.js} +1 -1
  248. package/dist/cdn/{SEWOHKIX.js → WRG6UGAU.js} +2 -2
  249. package/dist/cdn/{MX2NQ664.js → WRLRDSID.js} +2 -2
  250. package/dist/cdn/{PA6X2UX4.js → WS42HFTU.js} +2 -2
  251. package/dist/cdn/{R2RYAQ6J.js → WT2FKAP6.js} +2 -2
  252. package/dist/cdn/{YEK5YHI4.js → X57FB3KD.js} +2 -2
  253. package/dist/cdn/{3J3GWPGS.js → X63ISSA7.js} +2 -2
  254. package/dist/cdn/{N2SRPBDD.js → X6LWFUFK.js} +1 -1
  255. package/dist/cdn/{N765GK5M.js → X6NXSOAM.js} +2 -2
  256. package/dist/cdn/{XF3EBBPG.js → XE2T5GMW.js} +2 -2
  257. package/dist/cdn/{DHZBJPEI.js → XIWW264L.js} +2 -2
  258. package/dist/cdn/{34K3UEZZ.js → XKQGFDT5.js} +2 -2
  259. package/dist/cdn/{W23X7NWO.js → XTADI7OE.js} +2 -2
  260. package/dist/cdn/{UPVA5Z5X.js → XURZ7NUD.js} +2 -2
  261. package/dist/cdn/{WQUBINLR.js → XV4GT4PM.js} +2 -2
  262. package/dist/cdn/{DQCGIKDE.js → XXJ2SGBR.js} +2 -2
  263. package/dist/cdn/{XYDJHJLZ.js → XZQRI4EN.js} +1 -1
  264. package/dist/cdn/{3XT4LMZL.js → XZRHSLHF.js} +1 -1
  265. package/dist/cdn/{42CBSGWQ.js → Y2GJJZVT.js} +2 -2
  266. package/dist/cdn/{XYDZ75MI.js → Y7FST2QV.js} +2 -2
  267. package/dist/cdn/{XHXK6QN7.js → YA3SBEXZ.js} +2 -2
  268. package/dist/cdn/{KMK3IXHT.js → YEE23JC2.js} +2 -2
  269. package/dist/cdn/{TK6UBBJX.js → YF5TQNZI.js} +2 -2
  270. package/dist/cdn/{UHMFK7KR.js → YHIK3V5C.js} +2 -2
  271. package/dist/cdn/YI47D7GW.js +4 -0
  272. package/dist/cdn/{BY7442LE.js → YOTDGZIS.js} +2 -2
  273. package/dist/cdn/{F3ITEU5L.js → YPFDFW4X.js} +2 -2
  274. package/dist/cdn/{OXHWMQRP.js → YXM7GNWW.js} +2 -2
  275. package/dist/cdn/{6OP4PP3P.js → Z2BS6PDT.js} +2 -2
  276. package/dist/cdn/{J6SZZA33.js → Z2J6R7BH.js} +1 -1
  277. package/dist/cdn/{H7J6NVIQ.js → Z3NILA3R.js} +2 -2
  278. package/dist/cdn/{J67A6WYJ.js → Z7DOTE4W.js} +2 -2
  279. package/dist/cdn/{SLARORK6.js → ZEFYE6IH.js} +2 -2
  280. package/dist/cdn/{BH7LJ72A.js → ZFQ2JKAE.js} +2 -2
  281. package/dist/cdn/{BJQ5IZYR.js → ZQUJEICA.js} +2 -2
  282. package/dist/cdn/{G4VDYGGB.js → ZTWWXPZM.js} +2 -2
  283. package/dist/cdn/{ZRIOHEOT.js → ZVSLAQ5X.js} +2 -2
  284. package/dist/cdn/assets/layer-table/t9n/messages.ar.json +1 -1
  285. package/dist/cdn/assets/layer-table/t9n/messages.bg.json +1 -1
  286. package/dist/cdn/assets/layer-table/t9n/messages.bs.json +1 -1
  287. package/dist/cdn/assets/layer-table/t9n/messages.ca.json +1 -1
  288. package/dist/cdn/assets/layer-table/t9n/messages.cs.json +1 -1
  289. package/dist/cdn/assets/layer-table/t9n/messages.da.json +1 -1
  290. package/dist/cdn/assets/layer-table/t9n/messages.de.json +1 -1
  291. package/dist/cdn/assets/layer-table/t9n/messages.el.json +1 -1
  292. package/dist/cdn/assets/layer-table/t9n/messages.es.json +1 -1
  293. package/dist/cdn/assets/layer-table/t9n/messages.et.json +1 -1
  294. package/dist/cdn/assets/layer-table/t9n/messages.fi.json +1 -1
  295. package/dist/cdn/assets/layer-table/t9n/messages.fr.json +1 -1
  296. package/dist/cdn/assets/layer-table/t9n/messages.he.json +1 -1
  297. package/dist/cdn/assets/layer-table/t9n/messages.hr.json +1 -1
  298. package/dist/cdn/assets/layer-table/t9n/messages.hu.json +1 -1
  299. package/dist/cdn/assets/layer-table/t9n/messages.id.json +1 -1
  300. package/dist/cdn/assets/layer-table/t9n/messages.it.json +1 -1
  301. package/dist/cdn/assets/layer-table/t9n/messages.ja.json +1 -1
  302. package/dist/cdn/assets/layer-table/t9n/messages.ko.json +1 -1
  303. package/dist/cdn/assets/layer-table/t9n/messages.lt.json +1 -1
  304. package/dist/cdn/assets/layer-table/t9n/messages.lv.json +1 -1
  305. package/dist/cdn/assets/layer-table/t9n/messages.nl.json +1 -1
  306. package/dist/cdn/assets/layer-table/t9n/messages.no.json +1 -1
  307. package/dist/cdn/assets/layer-table/t9n/messages.pl.json +1 -1
  308. package/dist/cdn/assets/layer-table/t9n/messages.pt-BR.json +1 -1
  309. package/dist/cdn/assets/layer-table/t9n/messages.pt-PT.json +1 -1
  310. package/dist/cdn/assets/layer-table/t9n/messages.ro.json +1 -1
  311. package/dist/cdn/assets/layer-table/t9n/messages.ru.json +1 -1
  312. package/dist/cdn/assets/layer-table/t9n/messages.sk.json +1 -1
  313. package/dist/cdn/assets/layer-table/t9n/messages.sl.json +1 -1
  314. package/dist/cdn/assets/layer-table/t9n/messages.sr.json +1 -1
  315. package/dist/cdn/assets/layer-table/t9n/messages.sv.json +1 -1
  316. package/dist/cdn/assets/layer-table/t9n/messages.th.json +1 -1
  317. package/dist/cdn/assets/layer-table/t9n/messages.tr.json +1 -1
  318. package/dist/cdn/assets/layer-table/t9n/messages.uk.json +1 -1
  319. package/dist/cdn/assets/layer-table/t9n/messages.vi.json +1 -1
  320. package/dist/cdn/assets/layer-table/t9n/messages.zh-CN.json +1 -1
  321. package/dist/cdn/assets/layer-table/t9n/messages.zh-HK.json +1 -1
  322. package/dist/cdn/assets/layer-table/t9n/messages.zh-TW.json +1 -1
  323. package/dist/cdn/assets/map-card/t9n/messages.ar.json +1 -1
  324. package/dist/cdn/assets/map-card/t9n/messages.bg.json +1 -1
  325. package/dist/cdn/assets/map-card/t9n/messages.bs.json +1 -1
  326. package/dist/cdn/assets/map-card/t9n/messages.ca.json +1 -1
  327. package/dist/cdn/assets/map-card/t9n/messages.cs.json +1 -1
  328. package/dist/cdn/assets/map-card/t9n/messages.da.json +1 -1
  329. package/dist/cdn/assets/map-card/t9n/messages.de.json +1 -1
  330. package/dist/cdn/assets/map-card/t9n/messages.el.json +1 -1
  331. package/dist/cdn/assets/map-card/t9n/messages.es.json +1 -1
  332. package/dist/cdn/assets/map-card/t9n/messages.et.json +1 -1
  333. package/dist/cdn/assets/map-card/t9n/messages.fi.json +1 -1
  334. package/dist/cdn/assets/map-card/t9n/messages.fr.json +1 -1
  335. package/dist/cdn/assets/map-card/t9n/messages.he.json +1 -1
  336. package/dist/cdn/assets/map-card/t9n/messages.hr.json +1 -1
  337. package/dist/cdn/assets/map-card/t9n/messages.hu.json +1 -1
  338. package/dist/cdn/assets/map-card/t9n/messages.id.json +1 -1
  339. package/dist/cdn/assets/map-card/t9n/messages.it.json +1 -1
  340. package/dist/cdn/assets/map-card/t9n/messages.ja.json +1 -1
  341. package/dist/cdn/assets/map-card/t9n/messages.ko.json +1 -1
  342. package/dist/cdn/assets/map-card/t9n/messages.lt.json +1 -1
  343. package/dist/cdn/assets/map-card/t9n/messages.lv.json +1 -1
  344. package/dist/cdn/assets/map-card/t9n/messages.nl.json +1 -1
  345. package/dist/cdn/assets/map-card/t9n/messages.no.json +1 -1
  346. package/dist/cdn/assets/map-card/t9n/messages.pl.json +1 -1
  347. package/dist/cdn/assets/map-card/t9n/messages.pt-BR.json +1 -1
  348. package/dist/cdn/assets/map-card/t9n/messages.pt-PT.json +1 -1
  349. package/dist/cdn/assets/map-card/t9n/messages.ro.json +1 -1
  350. package/dist/cdn/assets/map-card/t9n/messages.ru.json +1 -1
  351. package/dist/cdn/assets/map-card/t9n/messages.sk.json +1 -1
  352. package/dist/cdn/assets/map-card/t9n/messages.sl.json +1 -1
  353. package/dist/cdn/assets/map-card/t9n/messages.sr.json +1 -1
  354. package/dist/cdn/assets/map-card/t9n/messages.sv.json +1 -1
  355. package/dist/cdn/assets/map-card/t9n/messages.th.json +1 -1
  356. package/dist/cdn/assets/map-card/t9n/messages.tr.json +1 -1
  357. package/dist/cdn/assets/map-card/t9n/messages.uk.json +1 -1
  358. package/dist/cdn/assets/map-card/t9n/messages.vi.json +1 -1
  359. package/dist/cdn/assets/map-card/t9n/messages.zh-CN.json +1 -1
  360. package/dist/cdn/assets/map-card/t9n/messages.zh-HK.json +1 -1
  361. package/dist/cdn/assets/map-card/t9n/messages.zh-TW.json +1 -1
  362. package/dist/cdn/index.js +2 -2
  363. package/dist/chunks/Auth.js +1 -1
  364. package/dist/chunks/appConfig.js +1 -1
  365. package/dist/chunks/cardFetchingUtils.js +1 -1
  366. package/dist/chunks/common.js +1 -1
  367. package/dist/chunks/deployAppContexts.js +1 -1
  368. package/dist/chunks/downloadUtils.js +1 -1
  369. package/dist/chunks/helpers.js +1 -1
  370. package/dist/chunks/index.js +1 -1
  371. package/dist/chunks/interfaces.js +1 -1
  372. package/dist/chunks/loadModules.js +1 -1
  373. package/dist/chunks/mapViewUtils.js +1 -1
  374. package/dist/chunks/pciUtils.js +1 -1
  375. package/dist/chunks/popupUtils.js +1 -1
  376. package/dist/chunks/prepareDataForSolutionDisplay.js +1 -1
  377. package/dist/chunks/privilegeUtils.js +1 -1
  378. package/dist/chunks/publicNotificationStore.js +1 -1
  379. package/dist/chunks/queryUtils.js +1 -1
  380. package/dist/chunks/runtime.js +1 -1
  381. package/dist/chunks/solution-store.js +1 -1
  382. package/dist/chunks/templates.js +1 -1
  383. package/dist/chunks/useT9n.js +1 -1
  384. package/dist/components/arcgis-solutions-assistant/customElement.js +1 -1
  385. package/dist/components/basemap-gallery/customElement.js +1 -1
  386. package/dist/components/buffer-tools/customElement.js +1 -1
  387. package/dist/components/card-manager/customElement.js +1 -1
  388. package/dist/components/consent-manager/customElement.js +1 -1
  389. package/dist/components/create-feature/customElement.js +1 -1
  390. package/dist/components/create-related-feature/customElement.js +1 -1
  391. package/dist/components/crowdsource-manager/customElement.js +1 -1
  392. package/dist/components/crowdsource-reporter/customElement.js +1 -1
  393. package/dist/components/deduct-calculator/customElement.js +1 -1
  394. package/dist/components/delete-button/customElement.js +1 -1
  395. package/dist/components/delete-dialog/customElement.js +1 -1
  396. package/dist/components/edit-card/customElement.js +1 -1
  397. package/dist/components/feature-details/customElement.js +1 -1
  398. package/dist/components/feature-list/customElement.js +50 -50
  399. package/dist/components/field-selection/customElement.js +1 -1
  400. package/dist/components/floor-filter/customElement.js +1 -1
  401. package/dist/components/info-card/customElement.js +1 -1
  402. package/dist/components/json-editor/customElement.js +1 -1
  403. package/dist/components/layer-list/customElement.js +1 -1
  404. package/dist/components/layer-table/customElement.js +1 -1
  405. package/dist/components/map-card/customElement.js +1 -1
  406. package/dist/components/map-draw-tools/customElement.js +1 -1
  407. package/dist/components/map-fullscreen/customElement.js +1 -1
  408. package/dist/components/map-layer-picker/customElement.js +1 -1
  409. package/dist/components/map-legend/customElement.js +1 -1
  410. package/dist/components/map-picker/customElement.js +1 -1
  411. package/dist/components/map-search/customElement.js +1 -1
  412. package/dist/components/map-select-tools/customElement.js +1 -1
  413. package/dist/components/map-tools/customElement.js +1 -1
  414. package/dist/components/pci-calculator/customElement.js +1 -1
  415. package/dist/components/pdf-download/customElement.js +1 -1
  416. package/dist/components/public-notification/customElement.js +1 -1
  417. package/dist/components/refine-selection/customElement.js +1 -1
  418. package/dist/components/selection-tool/customElement.js +1 -1
  419. package/dist/components/solution-article-card/customElement.js +1 -1
  420. package/dist/components/solution-configuration/customElement.js +1 -1
  421. package/dist/components/solution-configure-dialog/customElement.d.ts +7 -1
  422. package/dist/components/solution-configure-dialog/customElement.js +36 -22
  423. package/dist/components/solution-configure-titles/customElement.js +1 -1
  424. package/dist/components/solution-contents/customElement.js +1 -1
  425. package/dist/components/solution-delete-dialog/customElement.js +1 -1
  426. package/dist/components/solution-deploy-dialog/customElement.js +1 -1
  427. package/dist/components/solution-deployed-card/customElement.d.ts +13 -0
  428. package/dist/components/solution-deployed-card/customElement.js +39 -30
  429. package/dist/components/solution-deployed-card/index.d.ts +2 -1
  430. package/dist/components/solution-deployed-card/index.js +2 -1
  431. package/dist/components/solution-deploying-panel/customElement.js +1 -1
  432. package/dist/components/solution-details-card/customElement.js +1 -1
  433. package/dist/components/solution-details-panel/customElement.js +1 -1
  434. package/dist/components/solution-item/customElement.js +1 -1
  435. package/dist/components/solution-item-accordion/customElement.js +1 -1
  436. package/dist/components/solution-item-details/customElement.js +1 -1
  437. package/dist/components/solution-item-diagram/customElement.js +1 -1
  438. package/dist/components/solution-item-icon/customElement.js +1 -1
  439. package/dist/components/solution-item-sharing/customElement.js +1 -1
  440. package/dist/components/solution-organization-variables/customElement.js +1 -1
  441. package/dist/components/solution-resource-item/customElement.js +1 -1
  442. package/dist/components/solution-snapshot-gallery/customElement.js +1 -1
  443. package/dist/components/solution-spatial-ref/customElement.js +1 -1
  444. package/dist/components/solution-template-data/customElement.js +1 -1
  445. package/dist/components/solution-variables/customElement.js +1 -1
  446. package/dist/components/solutions-all-panel/customElement.js +1 -1
  447. package/dist/components/solutions-all-shell/customElement.js +1 -1
  448. package/dist/components/solutions-article-panel/customElement.js +1 -1
  449. package/dist/components/solutions-articles/customElement.js +1 -1
  450. package/dist/components/solutions-articles-shell/customElement.js +1 -1
  451. package/dist/components/solutions-deployed-panel/customElement.js +1 -1
  452. package/dist/components/solutions-deployed-shell/customElement.js +1 -1
  453. package/dist/components/solutions-filter-panel/customElement.js +1 -1
  454. package/dist/components/spatial-ref/customElement.js +1 -1
  455. package/dist/components/store-manager/customElement.js +1 -1
  456. package/dist/docs/api.json +126 -1
  457. package/dist/docs/docs.json +133 -2
  458. package/dist/docs/vscode.html-custom-data.json +7 -2
  459. package/dist/docs/web-types.json +34 -5
  460. package/dist/index.d.ts +15 -1
  461. package/dist/index.js +1 -1
  462. package/dist/loader.js +3 -3
  463. package/dist/types/lumina.d.ts +2 -1
  464. package/dist/types/preact.d.ts +2 -1
  465. package/dist/types/react.d.ts +2 -1
  466. package/dist/types/stencil.d.ts +2 -1
  467. package/package.json +1 -1
  468. package/dist/cdn/4UFLKP6T.js +0 -4
  469. package/dist/cdn/6FBUKPW2.js +0 -4
  470. package/dist/cdn/BP6NB6LJ.js +0 -18
  471. package/dist/cdn/NZUFRJWD.js +0 -4
  472. package/dist/cdn/S5AIQSGG.js +0 -18
  473. package/dist/cdn/T4PEWJBT.js +0 -4
  474. package/dist/cdn/V3STUVBX.js +0 -4
  475. package/dist/cdn/XMOLE7SD.js +0 -4
  476. package/dist/cdn/ZXBKW6YA.js +0 -4
@@ -1,7 +1,7 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/1.0/esri/copyright.txt for details.
3
- v1.0.2 */
4
- import{a as Zs,b as Qs}from"./SLARORK6.js";import{a as Zn}from"./J67A6WYJ.js";import{D as Jn,c as qn,d as Hn,p as Wn,y as $n}from"./6ULIHKIX.js";import"./QTN6BMW2.js";(function(){let A=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};A.requestAnimationFrame===void 0&&(A.setImmediate===void 0?A.requestAnimationFrame=x=>A.setTimeout(x,0):A.requestAnimationFrame=A.setImmediate);class f{static tr=A.navigator!==void 0&&A.navigator.platform!==void 0&&A.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static Rk(t,e,i){let s=-1;return function(){let n=this,o=arguments;s!==-1&&f.Tg(s),s=f.ir(()=>{s=-1,i||t.apply(n,o)},e),i&&!s&&t.apply(n,o)}}static ir(t,e){return A.setTimeout(t,e)}static Tg(t){A.clearTimeout(t)}static hs(t){return A.document.createElement(t)}static o(t){throw new Error(t)}static L(t,e){let i="The object is frozen, so its properties cannot be set: "+t.toString();e!==void 0&&(i+=" to value: "+e),f.o(i)}static dE(t,e,i,s){}static s(t,e,i,s){}static gE(t,e,i){}static ec(t,e,i){if(t===null||typeof t!="object"){let s=f.fC(e);i!==void 0&&(s+="."+i),f.Zi(t,"object",s)}}static k(t,e,i){f.s(t,"function",e,i)}static mE(t,e,i){}static Zi(t,e,i,s){}static W(t,e,i,s){let n=f.fC(i);s!==void 0&&(n+="."+s),f.o(n+" is not in the range "+e+": "+t)}static Re(t){}static er(t,e){}static ni(t){A.console&&A.console.log(t)}static G(t){return t!==null&&typeof t=="object"}static it(t){return typeof t=="function"}static vk=[];static et(){let t=f.vk.pop();return t===void 0?[]:t}static J(t){t.length=0,f.vk.push(t)}static pE=Object.freeze([]);static fC(t){return t===null?"*":typeof t=="string"?t:f.it(t)?t.name:""}static Dn(t){return f.it(t)?t.className?t.className:t.name:f.G(t)&&t.constructor?f.Dn(t.constructor):typeof t}static Uh(t,e){return e==null||e===""?null:f.G(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return f.G(t)&&(t.text?e=t.text:t.name?e=t.name:t.key!==void 0?e=t.key:t.id!==void 0?e=t.id:t.constructor===Object&&(t.Text?e=t.Text:t.Name?e=t.Name:t.Key!==void 0?e=t.Key:t.Id!==void 0?e=t.Id:t.ID!==void 0&&(e=t.ID))),e===void 0?"undefined":e===null?"null":e.toString()}static dw(t,e){if(t.hasOwnProperty(e))return!0;let i=Object.getPrototypeOf(t);for(;i&&i!==Function;){if(i.hasOwnProperty(e))return!0;let s=i.yE;if(s&&s[e])return!0;i=Object.getPrototypeOf(i)}return!1}static WD(t){let e=[],i=0;for(i=0;i<256;i++)e[i]=i;let s=0,n=0;for(i=0;i<256;i++)s=(s+e[i]+119)%256,n=e[i],e[i]=e[s],e[s]=n;i=0,s=0;let o="";for(let r=0;r<t.length;r++)i=(i+1)%256,s=(s+e[i])%256,n=e[i],e[i]=e[s],e[s]=n,o+=String.fromCharCode(t.charCodeAt(r)^e[(e[i]+e[s])%256]);return o}static JD(t){let e="0123456789abcdef",i=[];for(let r=0;r<256;r++)i[e.charAt(r>>4)+e.charAt(r&15)]=String.fromCharCode(r);t.length%2&&(t="0"+t);let s=[],n=0;for(let r=0;r<t.length;r+=2)s[n++]=i[t.substring(r,r+2)];let o=s.join("");return o===""?"0":o}static Ts(t){return f.WD(f.JD(t))}static color1="@COLOR1";static color2="@COLOR2";static gw="32ab5ff3b26f42dc0ed90f21412913b5"}f.vfo="29e646fdb162";class B{Ok;constructor(){this.Ok=[]}toString(){return this.Ok.join("")}add(t){t!==""&&this.Ok.push(t)}}class K{}class W{g;constructor(){this.g=[]}[Symbol.iterator](){return this.g.values()}key;value;get iterator(){return this}reset(){}next(){return!1}hasNext(){return!1}first(){return null}any(){return!1}all(){return!0}each(){return this}map(t){return this}filter(){return this}get count(){return 0}ul(){}toString(){return"EmptyIterator"}static instance=new W}class ${constructor(t){this.key=-1,this.value=t}[Symbol.iterator](){return[this.value].values()}key;value;get iterator(){return this}reset(){this.key=-1}next(){return this.key===-1?(this.key=0,!0):!1}hasNext(){return this.next()}first(){return this.key=0,this.value}any(t){return this.key=-1,t(this.value)}all(t){return this.key=-1,t(this.value)}each(t){return this.key=-1,t(this.value),this}map(t){return new $(t(this.value))}filter(t){return t(this.value)?new $(this.value):W.instance}get count(){return 1}ul(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class it{qt;Ds;Gt;At;constructor(t){this.qt=t,this.Ds=null,t.sr=null,this.Gt=t.nt,this.At=-1}[Symbol.iterator](){return this.Ds===null?this.qt.r.values():this.qt.r.filter(this.Ds).values()}key;value;get iterator(){return this}get predicate(){return this.Ds}set predicate(t){this.Ds=t}reset(){let t=this.qt;t.sr=null,this.Gt=t.nt,this.At=-1}next(){let t=this.qt;if(t.nt!==this.Gt){if(this.key<0)return!1;f.Re(t)}let e=t.r,i=e.length,s=++this.At,n=this.Ds;if(n!==null)for(;s<i;){let o=e[s];if(n(o))return this.At=s,this.key=s,this.value=o,!0;s++}else{if(s<i)return this.key=s,this.value=e[s],!0;this.ul()}return!1}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.nt,this.At=0;let e=t.r,i=e.length,s=this.Ds;if(s!==null){let n=0;for(;n<i;){let o=e[n];if(s(o))return this.At=n,this.key=n,this.value=o,o;n++}return null}else if(i>0){let n=e[0];return this.key=0,this.value=n,n}else return null}any(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(t(a))return!0;e.nt!==i&&f.Re(e)}}return!1}all(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(!t(a))return!1;e.nt!==i&&f.Re(e)}}return!0}each(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];o!==null&&!o(a)||(t(a),e.nt!==i&&f.Re(e))}return this}map(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=[],n=e.r,o=n.length,r=this.Ds;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(s.push(t(l)),e.nt!==i&&f.Re(e))}let a=new G;return a.r=s,a.ve(),a.iterator}filter(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=[],n=e.r,o=n.length,r=this.Ds;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(t(l)&&s.push(l),e.nt!==i&&f.Re(e))}let a=new G;return a.r=s,a.ve(),a.iterator}get count(){let t=this.Ds;if(t!==null){let e=0,i=this.qt.r,s=i.length;for(let n=0;n<s;n++)t(i[n])&&e++;return e}else return this.qt.r.length}ul(){this.key=-1,this.value=null,this.Gt=-1,this.Ds=null,this.qt.sr=this}toString(){return"ListIterator@"+this.At+"/"+this.qt.count}}class ht{qt;Gt;At;constructor(t){this.qt=t,t.nr=null,this.Gt=t.nt,this.At=t.r.length}[Symbol.iterator](){return this.qt.r.reverse().values()}key;value;get iterator(){return this}reset(){let t=this.qt;t.nr=null,this.Gt=t.nt,this.At=t.r.length}next(){let t=this.qt;if(t.nt!==this.Gt){if(this.key<0)return!1;f.Re(t)}let e=--this.At;return e>=0?(this.key=e,this.value=t.r[e],!0):(this.ul(),!1)}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.nt;let e=t.r,i=e.length-1;if(this.At=i,i>=0){let s=e[i];return this.key=i,this.value=s,s}else return null}any(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];if(t(r))return!0;e.nt!==i&&f.Re(e)}return!1}all(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];if(!t(r))return!1;e.nt!==i&&f.Re(e)}return!0}each(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];t(r),e.nt!==i&&f.Re(e)}return this}map(t){let e=this.qt;e.nr=null;let i=e.nt,s=[],n=e.r,o=n.length;this.At=o;for(let a=o-1;a>=0;a--){let h=n[a];s.push(t(h)),e.nt!==i&&f.Re(e)}let r=new G;return r.r=s,r.ve(),r.iterator}filter(t){let e=this.qt;e.nr=null;let i=e.nt,s=[],n=e.r,o=n.length;this.At=o;for(let a=o-1;a>=0;a--){let h=n[a];t(h)&&s.push(h),e.nt!==i&&f.Re(e)}let r=new G;return r.r=s,r.ve(),r.iterator}get count(){return this.qt.r.length}ul(){this.key=-1,this.value=null,this.Gt=-1,this.qt.nr=this}toString(){return"ListIteratorBackwards("+this.At+"/"+this.qt.count+")"}}class G{h;r;nt;sr;nr;constructor(t){I.Ki(this),this.h=!1,this.r=[],this.nt=0,this.sr=null,this.nr=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.r.values()}ve(){let t=this.nt;t++,t>999999999&&(t=0),this.nt=t}u(){return this.h=!0,this}Nt(){return this.h=!1,this}toString(){return"List()#"+I.as(this)}add(t){return this.h&&f.L(this,t),this.r.push(t),this.ve(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.h&&f.L(this);let e=this.r;if(Array.isArray(t)){let i=t.length;for(let s=0;s<i;s++){let n=t[s];e.push(n)}}else{let i=t.iterator;for(;i.next();){let s=i.value;e.push(s)}}return this.ve(),this}clear(){this.h&&f.L(this),this.r.length=0,this.ve()}contains(t){return this.has(t)}has(t){return t===null?!1:this.r.indexOf(t)!==-1}indexOf(t){return t===null?-1:this.r.indexOf(t)}elt(t){let e=this.r;return(t<0||t>=e.length)&&f.W(t,"0 <= i < length",G,"elt:i"),e[t]}get(t){return this.elt(t)}setElt(t,e){let i=this.r;(t<0||t>=i.length)&&f.W(t,"0 <= i < length",G,"setElt:i"),this.h&&f.L(this,t),i[t]=e}set(t,e){this.setElt(t,e)}first(){let t=this.r;return t.length===0?null:t[0]}last(){let t=this.r,e=t.length;return e>0?t[e-1]:null}pop(){this.h&&f.L(this);let t=this.r;return t.length>0?t.pop():null}any(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++){if(t(e[n]))return!0;this.nt!==i&&f.Re(this)}return!1}all(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++){if(!t(e[n]))return!1;this.nt!==i&&f.Re(this)}return!0}each(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++)t(e[n]),this.nt!==i&&f.Re(this);return this}map(t){let e=new G,i=[],s=this.r,n=this.nt,o=s.length;for(let r=0;r<o;r++)i.push(t(s[r])),this.nt!==n&&f.Re(this);return e.r=i,e.ve(),e}filter(t){let e=new G,i=[],s=this.r,n=this.nt,o=s.length;for(let r=0;r<o;r++){let a=s[r];t(a)&&i.push(a),this.nt!==n&&f.Re(this)}return e.r=i,e.ve(),e}insertAt(t,e){t<0&&f.W(t,">= 0",G,"insertAt:i"),this.h&&f.L(this,t);let i=this.r;t>=i.length?i.push(e):i.splice(t,0,e),this.ve()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.h&&f.L(this,t);let e=this.r,i=e.indexOf(t);return i===-1?!1:(i===e.length-1?e.pop():e.splice(i,1),this.ve(),!0)}removeAt(t){let e=this.r;(t<0||t>=e.length)&&f.W(t,"0 <= i < length",G,"removeAt:i"),this.h&&f.L(this,t),t===e.length-1?e.pop():e.splice(t,1),this.ve()}removeRange(t,e){let i=this.r,s=i.length;if(t<0)t=0;else if(t>=s)return this;if(e<0)return this;if(e>=s&&(e=s-1),t>e)return this;this.h&&f.L(this);let n=t,o=e+1;for(;o<s;)i[n++]=i[o++];return i.length=s-(e-t+1),this.ve(),this}copy(){let t=new G,e=this.r;return e.length>0&&(t.r=Array.prototype.slice.call(e)),t}toArray(){let t=this.r,e=this.count,i=new Array(e);for(let s=0;s<e;s++)i[s]=t[s];return i}get uC(){return this.r}toSet(){let t=new I,e=this.r,i=this.count;for(let s=0;s<i;s++)t.add(e[s]);return t}sort(t){return this.h&&f.L(this),this.r.sort(t),this.ve(),this}sortRange(t,e,i){let s=this.r,n=s.length;e===void 0&&(e=0),i===void 0&&(i=n),this.h&&f.L(this);let o=i-e;if(o<=1)return this;if((e<0||e>=n-1)&&f.W(e,"0 <= from < length",G,"sortRange:from"),o===2){let r=s[e],a=s[e+1];return t(r,a)>0&&(s[e]=a,s[e+1]=r,this.ve()),this}if(e===0)if(i>=n)s.sort(t);else{let r=s.slice(0,i);r.sort(t);for(let a=0;a<i;a++)s[a]=r[a]}else if(i>=n){let r=s.slice(e);r.sort(t);for(let a=e;a<n;a++)s[a]=r[a-e]}else{let r=s.slice(e,i);r.sort(t);for(let a=e;a<i;a++)s[a]=r[a-e]}return this.ve(),this}reverse(){return this.h&&f.L(this),this.r.reverse(),this.ve(),this}get count(){return this.r.length}get size(){return this.r.length}get length(){return this.r.length}get iterator(){if(this.r.length<=0)return W.instance;let t=this.sr;return t!==null?(t.reset(),t):new it(this)}get iteratorBackwards(){if(this.r.length<=0)return W.instance;let t=this.nr;return t!==null?(t.reset(),t):new ht(this)}}class Tt{wo;ii;constructor(t){this.wo=t,this.ii=t.g.values()}[Symbol.iterator](){return this.wo.g.values()}key;value;get iterator(){return this}reset(){let t=this.wo;this.ii=t.g.values()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.wo.g.size===0?null:(this.ii=this.wo.g.values(),this.ii.next().value)}any(t){return this.wo.any(t)}all(t){return this.wo.all(t)}each(t){return this.wo.each(t),this}map(t){let e=new G;return this.wo.g.forEach(i=>e.add(t(i))),e.iterator}filter(t){let e=new G;return this.wo.g.forEach(i=>{t(i)&&e.add(i)}),e.iterator}get count(){return this.wo.count}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"SetIterator"}}class I{h;g;constructor(t){this.h=!1,this.g=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.values()}values(){return this.g.values()}u(){return this.h=!0,this}Nt(){return this.h=!1,this}toString(){return"Set()#"+I.as(this)}add(t){return t===null?this:(this.g.add(t),this)}addAll(t){if(t===null)return this;if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];s!==null&&this.g.add(s)}}else{let e=t.iterator;for(;e.next();){let i=e.value;i!==null&&this.g.add(i)}}return this}has(t){return this.g.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;let e=t.iterator;for(;e.next();)if(!this.has(e.value))return!1;return!0}containsAny(t){if(t===null)return!0;let e=t.iterator;for(;e.next();)if(this.has(e.value))return!0;return!1}first(){return this.g.size===0?null:this.g.values().next().value}any(t){for(let e of this.g)if(t(e))return!0;return!1}all(t){for(let e of this.g)if(!t(e))return!1;return!0}each(t){for(let e of this.g)t(e);return this}map(t){let e=new I;for(let i of this.g)e.add(t(i));return e}filter(t){let e=new I;for(let i of this.g)t(i)&&e.add(i);return e}delete(t){return this.h&&f.L(this),this.g.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.h&&f.L(this),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++)this.delete(t[i])}else{let e=t.iterator;for(;e.next();)this.delete(e.value)}return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.h&&f.L(this);let e=new I;e.addAll(t);let i=[],s=this.iterator;for(;s.next();){let n=s.value;e.has(n)||i.push(n)}return this.removeAll(i),this}clear(){this.h&&f.L(this),this.g.clear()}copy(){let t=new I;return this.g.forEach(e=>t.add(e)),t}toArray(){return Array.from(this.g)}toList(){let t=new G;return this.g.forEach(e=>t.add(e)),t}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?W.instance:new Tt(this)}entries(){return this.g.entries()}keys(){return this.g.keys()}forEach(t,e){return this.g.forEach(t,e)}static mw=1;static Ki(t){t.__gohashid=I.mw++}static as(t){return t.__gohashid}}class Rt{q;ii;constructor(t){this.q=t,this.ii=t.g.keys()}[Symbol.iterator](){return this.q.g.keys()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.keys()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.ii=this.q.g.keys(),this.ii.next().value)}any(t){for(let e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.q.g)t(e[0]);return this}map(t){let e=this.q,i=new G;for(let s of e.g)i.add(t(s[0]));return i.iterator}filter(t){let e=this.q,i=new G;for(let s of e.g){let n=s[0];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapKeySetIterator"}}class he extends I{q;constructor(t){super(),I.Ki(this),this.h=!0,this.q=t}[Symbol.iterator](){return this.g.keys()}values(){return this.g.keys()}u(){return this}Nt(){return this}toString(){return"MapKeySet("+this.q.toString()+")"}add(t){f.o("This Set is read-only: "+this.toString())}has(t){return this.q.has(t)}contains(t){return this.has(t)}delete(t){f.o("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){f.o("This Set is read-only: "+this.toString())}first(){return this.q.g.size===0?null:this.q.g.keys().next().value}any(t){for(let e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.q.g)t(e[0]);return this}map(t){let e=new I;for(let i of this.q.g)e.add(t(i[0]));return e}filter(t){let e=new I;for(let i of this.q.g){let s=i[0];t(s)&&e.add(s)}return e}copy(){return new he(this.q)}toSet(){let t=new I,e=this.q.g;for(let i of e)t.add(i[0]);return t}toArray(){let t=this.q.g,e=new Array(t.size),i=0;for(let s of t)e[i]=s[0],i++;return e}toList(){let t=new G,e=this.q.g;for(let i of e)t.add(i[0]);return t}get count(){return this.q.size}get size(){return this.q.size}get iterator(){return this.q.size<=0?W.instance:new Rt(this.q)}}class Oe{q;ii;constructor(t){this.q=t,this.ii=t.g.values()}[Symbol.iterator](){return this.q.g.values()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.values()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.ii=this.q.g.values(),this.ii.next().value)}any(t){for(let e of this.q.g)if(t(e[1]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[1]))return!1;return!0}each(t){for(let e of this.q.g)t(e[1]);return this}map(t){let e=this.q,i=new G;for(let s of e.g)i.add(t(s[1]));return i.iterator}filter(t){let e=this.q,i=new G;for(let s of e.g){let n=s[1];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapValueSetIterator"}}class Ut{constructor(t,e){this.key=t,this.value=e}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class Wt{q;ii;constructor(t){this.q=t,this.ii=t.g.entries()}[Symbol.iterator](){return this.q.g.entries()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.entries()}next(){let t=this.ii.next();return t.done?(this.key=null,this.value=null,!1):(this.key=t.value[0],this.value=t.value[1],!0)}hasNext(){return this.next()}first(){if(this.q.g.size===0)return null;this.ii=this.q.g.entries();let t=this.ii.next().value;return this.key=t[0],this.value=t[1],new Ut(t[0],t[1])}any(t){return this.q.any(t)}all(t){return this.q.all(t)}each(t){return this.q.each(t),this}map(t){let e=new G,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ut(n,s):(i.key=n,i.value=s),e.add(t(i))}),e.iterator}filter(t){let e=new G,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ut(n,s):(i.key=n,i.value=s),t(i)&&(e.add(i),i=null)}),e.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapIterator"}}class pt{h;g;constructor(t){I.Ki(this),this.h=!1,this.g=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.entries()}entries(){return this.g.entries()}u(){return this.h=!0,this}Nt(){return this.h=!1,this}toString(){return"Map()#"+I.as(this)}set(t,e){return this.h&&f.L(this,t),this.g.set(t,e),this}add(t,e){return this.set(t,e)}addAll(t){if(t===null)return this;if(this.h&&f.L(this),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];this.set(s.key,s.value)}}else if(t instanceof pt){let e=t.iterator;for(;e.next();)this.set(e.key,e.value)}else{let e=t.iterator;for(;e.next();){let i=e.value;this.set(i.key,i.value)}}return this}first(){if(this.g.size===0)return null;let t=this.g.entries().next().value;return new Ut(t[0],t[1])}any(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ut(i,s):(e.key=i,e.value=s),t(e))return!0;return!1}all(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ut(i,s):(e.key=i,e.value=s),!t(e))return!1;return!0}each(t){let e=null;for(let[i,s]of this.g)e===null?e=new Ut(i,s):(e.key=i,e.value=s),t(e);return this}map(t){let e=new pt,i=null;for(let[s,n]of this.g)i===null?i=new Ut(s,n):(i.key=s,i.value=n),e.set(s,t(i));return e}filter(t){let e=new pt,i=null;for(let[s,n]of this.g)i===null?i=new Ut(s,n):(i.key=s,i.value=n),t(i)&&e.set(s,n);return e}has(t){return this.g.has(t)}contains(t){return this.has(t)}get(t){let e=this.g.get(t);return e===void 0?null:e}getValue(t){return this.get(t)}delete(t){return t===null?!1:(this.h&&f.L(this,t),this.g.delete(t))}remove(t){return this.delete(t)}clear(){this.h&&f.L(this),this.g.clear()}copy(){let t=new pt;return t.g=new Map(this.g),t}toArray(){let t=this.g,e=new Array(t.size),i=0;for(let s of t)e[i]=new Ut(s[0],s[1]),i++;return e}toKeySet(){return new he(this)}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?W.instance:new Wt(this)}get iteratorKeys(){return this.count<=0?W.instance:new Rt(this)}keys(){return this.g.keys()}get iteratorValues(){return this.count<=0?W.instance:new Oe(this)}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}}class P{px;py;h;constructor(t,e){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof e=="number"?(this.px=t,this.py=e):f.o("Invalid arguments to Point constructor: "+t+", "+e),this.h=!1}a(t){return this.px=t.px,this.py=t.py,this}i(t,e){return this.px=t,this.py=e,this}setTo(t,e){return this.px=t,this.py=e,this}set(t){return this.px=t.px,this.py=t.py,this}copy(){let t=new P;return t.px=this.px,t.py=this.py,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new P(s,o)}else return new P}static stringify(t){return t.x.toString()+" "+t.y.toString()}static stringifyFixed(t){return f.s(t,"number",P,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)}toString(){return"Point("+this.x+","+this.y+")"}equals(t){return t instanceof P?this.px===t.x&&this.py===t.y:!1}equalTo(t,e){return this.px===t&&this.py===e}equalsApprox(t){return L.f(this.px,t.x)&&L.f(this.py,t.y)}add(t){return this.px+=t.x,this.py+=t.y,this}subtract(t){return this.px-=t.x,this.py-=t.y,this}offset(t,e){return this.px+=t,this.py+=e,this}rotate(t){if(t===0)return this;let e=this.px,i=this.py;if(e===0&&i===0)return this;let s=0,n=0;if(t>=360?t-=360:t<0&&(t+=360),t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let o=t*Math.PI/180;s=Math.cos(o),n=Math.sin(o)}return this.px=s*e-n*i,this.py=n*e+s*i,this}scale(t,e){return this.px*=t,this.py*=e,this}distanceSquaredPoint(t){let e=t.x-this.px,i=t.y-this.py;return e*e+i*i}distanceSquared(t,e){let i=t-this.px,s=e-this.py;return i*i+s*s}normalize(){let t=this.px,e=this.py,i=Math.sqrt(t*t+e*e);return i>0&&(this.px=t/i,this.py=e/i),this}directionPoint(t){return this.dC(t.x-this.px,t.y-this.py)}direction(t,e){return this.dC(t-this.px,e-this.py)}dC(t,e){if(t===0)return e>0?90:e<0?270:0;if(e===0)return t>0?0:180;{if(isNaN(t)||isNaN(e))return 0;let i=Math.atan(Math.abs(e/t))*180/Math.PI;return t<0?e<0?i+=180:i=180-i:e<0&&(i=360-i),i}}static compareWithLineSegment(t,e,i,s,n,o){return L.eu(t,e,i,s,n,o)}compareWithLineSegmentPoint(t,e){return L.eu(t.x,t.y,e.x,e.y,this.x,this.y)}static intersectingLineSegments(t,e,i,s,n,o,r,a){return L.su(t,e,i,s,n,o,r,a)}projectOntoLineSegment(t,e,i,s){return L.dl(t,e,i,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,e){return L.dl(t.x,t.y,e.x,e.y,this.px,this.py,this),this}snapToGrid(t,e,i,s){return L.Dg(this.px,this.py,t,e,i,s,this),this}snapToGridPoint(t,e){return L.Dg(this.px,this.py,t.x,t.y,e.width,e.height,this),this}setRectSpot(t,e){return this.px=t.x+e.x*t.width+e.offsetX,this.py=t.y+e.y*t.height+e.offsetY,this}setSpot(t,e,i,s,n){return this.px=t+n.x*i+n.offsetX,this.py=e+n.y*s+n.offsetY,this}T(t){return t.gt(this),this}Oe(t){return t.$e(this),this}static distanceLineSegmentSquared(t,e,i,s,n,o){let r=n-i,a=o-s,h=r*r+a*a,l=i-t,c=s-e,u=-l*r-c*a;if(u<=0||u>=h)return r=n-t,a=o-e,Math.min(l*l+c*c,r*r+a*a);{let d=r*c-a*l;return d*d/h}}static distanceSquared(t,e,i,s){let n=i-t,o=s-e;return n*n+o*o}static direction(t,e,i,s){let n=i-t,o=s-e;if(n===0)return o>0?90:o<0?270:0;if(o===0)return n>0?0:180;{if(isNaN(n)||isNaN(o))return 0;let r=Math.atan(Math.abs(o/n))*180/Math.PI;return n<0?o<0?r+=180:r=180-r:o<0&&(r=360-r),r}}get x(){return this.px}set x(t){this.px=t}get y(){return this.py}set y(t){this.py=t}isReal(){return isFinite(this.x)&&isFinite(this.y)}static xo=new P(0,0).$();static gC=new P(-1/0,-1/0).$();static mC=new P(1/0,1/0).$();static pC=new P(6,6).$();static Ik=new P(NaN,NaN).$();static Ek=[];static l(){let t=P.Ek.pop();return t===void 0?new P:t}static V(t,e){let i=P.Ek.pop();return i===void 0?new P(t,e):(i.x=t,i.y=e,i)}static e(t){P.Ek.push(t)}}class Q{sw;sh;h;constructor(t,e){t===void 0?(this.sw=0,this.sh=0):typeof t=="number"&&(t>=0||isNaN(t))&&typeof e=="number"&&(e>=0||isNaN(e))?(this.sw=t,this.sh=e):f.o("Invalid arguments to Size constructor: "+t+", "+e),this.h=!1}a(t){return this.sw=t.sw,this.sh=t.sh,this}i(t,e){return this.sw=t,this.sh=e,this}setTo(t,e){return this.sw=t,this.sh=e,this}set(t){return this.sw=t.sw,this.sh=t.sh,this}copy(){let t=new Q;return t.sw=this.sw,t.sh=this.sh,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new Q(s,o)}else return new Q}static stringify(t){return t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return f.s(t,"number",Q,"stringifyFixed:digits"),e=>e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof Q?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,e){return this.sw===t&&this.sh===e}equalsApprox(t){return L.f(this.sw,t.width)&&L.f(this.sh,t.height)}inflate(t,e){let i=this.width+t;this.sw=i>=0?i:0;let s=this.height+e;return this.sh=s>=0?s:0,this}get width(){return this.sw}set width(t){t<0&&f.W(t,">= 0",Q,"width"),this.sw=t}get height(){return this.sh}set height(t){t<0&&f.W(t,">= 0",Q,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static sc=new Q(0,0).$();static Uk=new Q(1,1).$();static yC=new Q(6,6).$();static nu=new Q(8,8).$();static wC=new Q(10,10).$();static Bk=new Q(1/0,1/0).$();static yw=new Q(NaN,NaN).$();static xC=[];static l(){let t=Q.xC.pop();return t===void 0?new Q:t}static e(t){Q.xC.push(t)}}class z{rx;ry;rw;rh;h;constructor(t,e,i,s){if(t===void 0)this.rx=0,this.ry=0,this.rw=0,this.rh=0;else if(typeof t=="number"&&typeof e=="number"&&typeof i=="number"&&(i>=0||isNaN(i))&&typeof s=="number"&&(s>=0||isNaN(s)))this.rx=t,this.ry=e,this.rw=i,this.rh=s;else if(t instanceof P){let n=t.x,o=t.y;if(e instanceof P){let r=e.x,a=e.y;this.rx=Math.min(n,r),this.ry=Math.min(o,a),this.rw=Math.abs(n-r),this.rh=Math.abs(o-a)}else e instanceof Q?(this.rx=n,this.ry=o,this.rw=e.width,this.rh=e.height):f.o("Incorrect second argument supplied to Rect constructor "+e)}else f.o("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+s);this.h=!1}a(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}i(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}Fn(t,e){return this.rw=t,this.rh=e,this}setTo(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}set(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}setPoint(t){return this.rx=t.x,this.ry=t.y,this}setSize(t){return this.rw=t.width,this.rh=t.height,this}copy(){let t=new z;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n&&(r=parseFloat(n));let a=0;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),new z(s,o,r,a)}else return new z}static stringify(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return f.s(t,"number",z,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"}equals(t){return t instanceof z?this.rx===t.x&&this.ry===t.y&&this.rw===t.width&&this.rh===t.height:!1}equalTo(t,e,i,s){return this.rx===t&&this.ry===e&&this.rw===i&&this.rh===s}equalsApprox(t){return L.f(this.rx,t.x)&&L.f(this.ry,t.y)&&L.f(this.rw,t.width)&&L.f(this.rh,t.height)}equalsApproxTo(t,e,i,s){return L.f(this.rx,t)&&L.f(this.ry,e)&&L.f(this.rw,i)&&L.f(this.rh,s)}equalsApproxClose(t){return L.z(this.rx,t.x)&&L.z(this.ry,t.y)&&L.z(this.rw,t.width)&&L.z(this.rh,t.height)}containsPoint(t){return this.rx<=t.x&&this.rx+this.rw>=t.x&&this.ry<=t.y&&this.ry+this.rh>=t.y}containsRect(t){return this.rx<=t.x&&t.x+t.width<=this.rx+this.rw&&this.ry<=t.y&&t.y+t.height<=this.ry+this.rh}contains(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.rx<=t&&t+i<=this.rx+this.rw&&this.ry<=e&&e+s<=this.ry+this.rh}offset(t,e){return this.rx+=t,this.ry+=e,this}inflate(t,e){return this.ww(e,t,e,t)}addMargin(t){return this.ww(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.ww(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.ww(t,e,i,s)}ww(t,e,i,s){let n=this.rw;e+s<=-n?(this.rx+=n/2,this.rw=0):(this.rx-=s,this.rw+=e+s);let o=this.rh;return t+i<=-o?(this.ry+=o/2,this.rh=0):(this.ry-=t,this.rh+=t+i),this}intersectRect(t){return this.bC(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.bC(t,e,i,s)}bC(t,e,i,s){let n=Math.max(this.rx,t),o=Math.max(this.ry,e),r=Math.min(this.rx+this.rw,t+i),a=Math.min(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=Math.max(0,r-n),this.rh=Math.max(0,a-o),this}intersectsRect(t){return this.intersects(t.x,t.y,t.width,t.height)}intersects(t,e,i,s){let n=this.rw,o=this.rx;if(n!==1/0&&i!==1/0&&(n+=o,i+=t,isNaN(i)||isNaN(n)||o>i||t>n))return!1;let r=this.rh,a=this.ry;return!(r!==1/0&&s!==1/0&&(r+=a,s+=e,isNaN(s)||isNaN(r)||a>s||e>r))}intersectsRectPlus(t,e){let i=this.rw,s=t.width+e+e,n=this.rx,o=t.x-e;if(i+=n,s+=o,n>s||o>i)return!1;let r=this.rh,a=t.height+e+e,h=this.ry,l=t.y-e;return r+=h,a+=l,!(h>a||l>r)}unionPoint(t){return this.unionNoCheck(t.x,t.y,0,0)}unionRect(t){return this.unionNoCheck(t.rx,t.ry,t.rw,t.rh)}union(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.unionNoCheck(t,e,i,s)}unionNoCheck(t,e,i,s){let n=Math.min(this.rx,t),o=Math.min(this.ry,e),r=Math.max(this.rx+this.rw,t+i),a=Math.max(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=r-n,this.rh=a-o,this}setSpot(t,e,i){return this.rx=t-i.offsetX-i.x*this.rw,this.ry=e-i.offsetY-i.y*this.rh,this}static contains(t,e,i,s,n,o,r,a){return r===void 0&&(r=0),a===void 0&&(a=0),t<=n&&n+r<=t+i&&e<=o&&o+a<=e+s}static intersects(t,e,i,s,n,o,r,a){let h=i,l=r,c=t,u=n;if(h+=c,l+=u,c>l||u>h)return!1;let d=s,g=a,p=e,m=o;return d+=p,g+=m,!(p>g||m>d)}static intersectsLineSegment(t,e,i,s,n,o,r,a){return L.kC(t,e,i,s,n,o,r,a)}get x(){return this.rx}set x(t){this.rx=t}get y(){return this.ry}set y(t){this.ry=t}get width(){return this.rw}set width(t){t<0&&f.W(t,">= 0",z,"width"),this.rw=t}get height(){return this.rh}set height(t){t<0&&f.W(t,">= 0",z,"height"),this.rh=t}get left(){return this.rx}set left(t){this.rx=t}get top(){return this.ry}set top(t){this.ry=t}get right(){return this.rx+this.rw}set right(t){this.rx+=t-(this.rx+this.rw)}get bottom(){return this.ry+this.rh}set bottom(t){this.ry+=t-(this.ry+this.rh)}get position(){return new P(this.rx,this.ry)}set position(t){this.rx=t.x,this.ry=t.y}get size(){return new Q(this.rw,this.rh)}set size(t){this.rw=t.width,this.rh=t.height}get center(){return new P(this.rx+this.rw/2,this.ry+this.rh/2)}set center(t){this.rx=t.x-this.rw/2,this.ry=t.y-this.rh/2}get centerX(){return this.rx+this.rw/2}set centerX(t){this.rx=t-this.rw/2}get centerY(){return this.ry+this.rh/2}set centerY(t){this.ry=t-this.rh/2}isReal(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)}isEmpty(){return this.width===0&&this.height===0}static Fg=new z(0,0,0,0).$();static $D=new z(NaN,NaN,NaN,NaN).$();static Vk=[];static l(){let t=z.Vk.pop();return t===void 0?new z:t}static V(t,e,i,s){let n=z.Vk.pop();return n===void 0?new z(t,e,i,s):n.i(t,e,i,s)}static e(t){z.Vk.push(t)}}class Lt{mt;mr;mb;ml;h;constructor(t,e,i,s){t===void 0?(this.mt=0,this.mr=0,this.mb=0,this.ml=0):e===void 0?(e=t,i=t,s=t,this.mt=t,this.mr=e,this.mb=i,this.ml=s):i===void 0?(i=t,s=e,this.mt=t,this.mr=e,this.mb=i,this.ml=s):s!==void 0?(this.mt=t,this.mr=e,this.mb=i,this.ml=s):f.o("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+s),this.h=!1}a(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}setTo(t,e,i,s){return this.mt=t,this.mr=e,this.mb=i,this.ml=s,this}set(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}copy(){let t=new Lt;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=NaN;for(;e[i]==="";)i++;let n=e[i++];if(n&&(s=parseFloat(n)),isNaN(s))return new Lt;let o=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(o=parseFloat(n)),isNaN(o))return new Lt(s);let r=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(r=parseFloat(n)),isNaN(r))return new Lt(s,o);let a=NaN;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),isNaN(a)?new Lt(s,o):new Lt(s,o,r,a)}else return new Lt}static stringify(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return f.s(t,"number",Lt,"stringifyFixed:digits"),e=>e.top.toFixed(t)+" "+e.right.toFixed(t)+" "+e.bottom.toFixed(t)+" "+e.left.toFixed(t)}toString(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"}equals(t){return t instanceof Lt?this.mt===t.top&&this.mr===t.right&&this.mb===t.bottom&&this.ml===t.left:!1}equalTo(t,e,i,s){return this.mt===t&&this.mr===e&&this.mb===i&&this.ml===s}equalsApprox(t){return L.f(this.mt,t.top)&&L.f(this.mr,t.right)&&L.f(this.mb,t.bottom)&&L.f(this.ml,t.left)}get top(){return this.mt}set top(t){this.mt=t}get right(){return this.mr}set right(t){this.mr=t}get bottom(){return this.mb}set bottom(t){this.mb=t}get left(){return this.ml}set left(t){this.ml=t}isReal(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)}static Rg=new Lt(0,0,0,0).$();static PC=new Lt(2,2,2,2).$();static SC=[];static l(){let t=Lt.SC.pop();return t===void 0?new Lt:t}static e(t){Lt.SC.push(t)}}class D{sx;sy;ox;oy;h;constructor(t,e,i,s){t===void 0?(this.sx=0,this.sy=0,this.ox=0,this.oy=0):(e===void 0&&(e=0),i===void 0&&(i=0),s===void 0&&(s=0),this.sx=t,this.sy=e,this.ox=i,this.oy=s),this.h=!1}a(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}setTo(t,e,i,s){return this.sx=t,this.sy=e,this.ox=i,this.oy=s,this}set(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}copy(){let t=new D;return t.sx=this.sx,t.sy=this.sy,t.ox=this.ox,t.oy=this.oy,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}Ie(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this}wE(t,e){(isNaN(t)||t>1||t<0)&&f.W(t,"0 <= "+e+" <= 1",D,e)}xE(t,e){(isNaN(t)||t===1/0||t===-1/0)&&f.W(t,"real number, not NaN or Infinity",D,e)}static parse(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return D.None;if(t==="TopLeft")return D.TopLeft;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return D.TopCenter;if(t==="TopRight")return D.TopRight;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return D.LeftCenter;if(t==="Center")return D.Center;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return D.RightCenter;if(t==="BottomLeft")return D.BottomLeft;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return D.BottomCenter;if(t==="BottomRight")return D.BottomRight;if(t==="TopSide")return D.TopSide;if(t==="LeftSide")return D.LeftSide;if(t==="RightSide")return D.RightSide;if(t==="BottomSide")return D.BottomSide;if(t==="TopBottomSides")return D.TopBottomSides;if(t==="LeftRightSides")return D.LeftRightSides;if(t==="TopLeftSides")return D.TopLeftSides;if(t==="TopRightSides")return D.TopRightSides;if(t==="BottomLeftSides")return D.BottomLeftSides;if(t==="BottomRightSides")return D.BottomRightSides;if(t==="NotTopSide")return D.NotTopSide;if(t==="NotLeftSide")return D.NotLeftSide;if(t==="NotRightSide")return D.NotRightSide;if(t==="NotBottomSide")return D.NotBottomSide;if(t==="AllSides")return D.AllSides;if(t==="Default")return D.Default;let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n!==void 0&&n.length>0&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(r=parseFloat(n));let a=0;for(;e[i]==="";)i++;return n=e[i++],n!==void 0&&n.length>0&&(a=parseFloat(n)),new D(s,o,r,a)}else return new D}static stringify(t){return t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return f.s(t,"number",D,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.offsetX.toFixed(t)+" "+e.offsetY.toFixed(t)}toString(){return this.isSpot()?this.ox===0&&this.oy===0?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.equals(D.None)?"None":this.equals(D.TopLeft)?"TopLeft":this.equals(D.TopCenter)?"Top":this.equals(D.TopRight)?"TopRight":this.equals(D.LeftCenter)?"Left":this.equals(D.Center)?"Center":this.equals(D.RightCenter)?"Right":this.equals(D.BottomLeft)?"BottomLeft":this.equals(D.BottomCenter)?"Bottom":this.equals(D.BottomRight)?"BottomRight":this.equals(D.TopSide)?"TopSide":this.equals(D.LeftSide)?"LeftSide":this.equals(D.RightSide)?"RightSide":this.equals(D.BottomSide)?"BottomSide":this.equals(D.TopBottomSides)?"TopBottomSides":this.equals(D.LeftRightSides)?"LeftRightSides":this.equals(D.TopLeftSides)?"TopLeftSides":this.equals(D.TopRightSides)?"TopRightSides":this.equals(D.BottomLeftSides)?"BottomLeftSides":this.equals(D.BottomRightSides)?"BottomRightSides":this.equals(D.NotTopSide)?"NotTopSide":this.equals(D.NotLeftSide)?"NotLeftSide":this.equals(D.NotRightSide)?"NotRightSide":this.equals(D.NotBottomSide)?"NotBottomSide":this.equals(D.AllSides)?"AllSides":this.equals(D.Default)?"Default":"None"}equals(t){return t instanceof D?(this.sx===t.x||isNaN(this.sx)&&isNaN(t.x))&&(this.sy===t.y||isNaN(this.sy)&&isNaN(t.y))&&this.ox===t.offsetX&&this.oy===t.offsetY:!1}opposite(){return new D(.5-(this.sx-.5),.5-(this.sy-.5),-this.ox,-this.oy)}includesSide(t){if(!this.isSide())return!1;if(!t.isSide())if(t.equals(D.Left))t=D.LeftSide;else if(t.equals(D.Right))t=D.RightSide;else if(t.equals(D.Top))t=D.TopSide;else if(t.equals(D.Bottom))t=D.BottomSide;else return!1;let e=this.oy,i=t.offsetY;return(e&i)===i}get x(){return this.sx}set x(t){this.sx=t}get y(){return this.sy}set y(t){this.sy=t}get offsetX(){return this.ox}set offsetX(t){this.ox=t}get offsetY(){return this.oy}set offsetY(t){this.oy=t}isSpot(){return!isNaN(this.x)&&!isNaN(this.y)}isNoSpot(){return isNaN(this.x)||isNaN(this.y)}isSide(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===1&&this.offsetY!==0}isNone(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===0&&this.offsetY===0}isDefault(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===-1&&this.offsetY===0}static None=new D(0,0,0,0).Ie(0).$();static Default=new D(0,0,-1,0).Ie(-1).$();static TopLeft=new D(0,0,0,0).$();static TopCenter=new D(.5,0,0,0).$();static TopRight=new D(1,0,0,0).$();static LeftCenter=new D(0,.5,0,0).$();static Center=new D(.5,.5,0,0).$();static RightCenter=new D(1,.5,0,0).$();static BottomLeft=new D(0,1,0,0).$();static BottomCenter=new D(.5,1,0,0).$();static BottomRight=new D(1,1,0,0).$();static MiddleTop=D.TopCenter;static MiddleLeft=D.LeftCenter;static MiddleRight=D.RightCenter;static MiddleBottom=D.BottomCenter;static Top=D.TopCenter;static Left=D.LeftCenter;static Right=D.RightCenter;static Bottom=D.BottomCenter;static TopSide=new D(0,0,1,1).Ie(1).$();static LeftSide=new D(0,0,1,2).Ie(1).$();static RightSide=new D(0,0,1,4).Ie(1).$();static BottomSide=new D(0,0,1,8).Ie(1).$();static TopBottomSides=new D(0,0,1,9).Ie(1).$();static LeftRightSides=new D(0,0,1,6).Ie(1).$();static TopLeftSides=new D(0,0,1,3).Ie(1).$();static TopRightSides=new D(0,0,1,5).Ie(1).$();static BottomLeftSides=new D(0,0,1,10).Ie(1).$();static BottomRightSides=new D(0,0,1,12).Ie(1).$();static NotTopSide=new D(0,0,1,14).Ie(1).$();static NotLeftSide=new D(0,0,1,13).Ie(1).$();static NotRightSide=new D(0,0,1,11).Ie(1).$();static NotBottomSide=new D(0,0,1,7).Ie(1).$();static AllSides=new D(0,0,1,15).Ie(1).$();static zk=new D(.156,.156).$();static Xk=new D(.844,.844).$();static MC=[];static l(){let t=D.MC.pop();return t===void 0?new D:t}static e(t){D.MC.push(t)}}class Pt{m11;m12;m21;m22;dx;dy;constructor(){this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0}set(t){return this.m11=t.m11,this.m12=t.m12,this.m21=t.m21,this.m22=t.m22,this.dx=t.dx,this.dy=t.dy,this}setTo(t,e,i,s,n,o){return this.m11=t,this.m12=e,this.m21=i,this.m22=s,this.dx=n,this.dy=o,this}copy(){let t=new Pt;return t.m11=this.m11,t.m12=this.m12,t.m21=this.m21,t.m22=this.m22,t.dx=this.dx,t.dy=this.dy,t}toString(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"}equals(t){return this.m11===t.m11&&this.m12===t.m12&&this.m21===t.m21&&this.m22===t.m22&&this.dx===t.dx&&this.dy===t.dy}Yk(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1}Ri(){return this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0,this}nc(t){let e=this.m11*t.m11+this.m21*t.m12,i=this.m12*t.m11+this.m22*t.m12,s=this.m11*t.m21+this.m21*t.m22,n=this.m12*t.m21+this.m22*t.m22;return this.dx=this.m11*t.dx+this.m21*t.dy+this.dx,this.dy=this.m12*t.dx+this.m22*t.dy+this.dy,this.m11=e,this.m12=i,this.m21=s,this.m22=n,this}NC(t){let e=1/(t.m11*t.m22-t.m12*t.m21),i=t.m22*e,s=-t.m12*e,n=-t.m21*e,o=t.m11*e,r=e*(t.m21*t.dy-t.m22*t.dx),a=e*(t.m12*t.dx-t.m11*t.dy),h=this.m11*i+this.m21*s,l=this.m12*i+this.m22*s,c=this.m11*n+this.m21*o,u=this.m12*n+this.m22*o;return this.dx=this.m11*r+this.m21*a+this.dx,this.dy=this.m12*r+this.m22*a+this.dy,this.m11=h,this.m12=l,this.m21=c,this.m22=u,this}xw(){let t=1/(this.m11*this.m22-this.m12*this.m21),e=this.m22*t,i=-this.m12*t,s=-this.m21*t,n=this.m11*t,o=t*(this.m21*this.dy-this.m22*this.dx),r=t*(this.m12*this.dx-this.m11*this.dy);return this.m11=e,this.m12=i,this.m21=s,this.m22=n,this.dx=o,this.dy=r,this}cs(t,e,i){if(t>=360?t-=360:t<0&&(t+=360),t===0)return this;this.Fs(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let l=t*Math.PI/180;s=Math.cos(l),n=Math.sin(l)}let o=this.m11*s+this.m21*n,r=this.m12*s+this.m22*n,a=this.m11*-n+this.m21*s,h=this.m12*-n+this.m22*s;return this.m11=o,this.m12=r,this.m21=a,this.m22=h,this.Fs(-e,-i),this}Fs(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this}tt(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this}ZD(){if(this.m11===1&&this.m12===0)return 0;let t=Math.atan2(this.m12,this.m11)*180/Math.PI;return t<0&&(t+=360),t}gt(t){let e=t.x,i=t.y;return t.i(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)}$e(t){let e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=t.x-this.dx,a=t.y-this.dy;return t.i(r*i+a*n,r*s+a*o)}bw(t){let e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=e*(this.m21*this.dy-this.m22*this.dx),a=e*(this.m12*this.dx-this.m11*this.dy),h=t.x*1.25,l=t.y*1.2;return t.i(h*i+l*n+r,h*s+l*o+a)}vg(t){let e=t.x,i=t.y,s=e+t.width,n=i+t.height,o=this.m11,r=this.m12,a=this.m21,h=this.m22,l=this.dx,c=this.dy,u=e*o+i*a+l,d=e*r+i*h+c,g=s*o+i*a+l,p=s*r+i*h+c,m=e*o+n*a+l,y=e*r+n*h+c,w=s*o+n*a+l,b=s*r+n*h+c,v=u,k=u,S=d,M=d;return v=Math.min(v,g),k=Math.max(k,g),S=Math.min(S,p),M=Math.max(M,p),v=Math.min(v,m),k=Math.max(k,m),S=Math.min(S,y),M=Math.max(M,y),v=Math.min(v,w),k=Math.max(k,w),S=Math.min(S,b),M=Math.max(M,b),t.i(v,S,k-v,M-S),t}static CC=[];static l(){let t=Pt.CC.pop();return t===void 0?new Pt:t}static e(t){Pt.CC.push(t)}static Gk="54a702f3e53909c447824c6706603faf4c"}let L={QD:"7da71ca0ad381e90",Rn:4*((Math.sqrt(2)-1)/3),LC:null,kw:x=>{if(x<=0)return 0;let t=L.LC;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);L.LC=t}if(x<1){let e=1/x;return e<=2e3?1/t[e|0]:Math.sqrt(x)}else return x<=2e3?t[x|0]:Math.sqrt(x)},f:(x,t)=>{let e=x-t;return e<.5&&e>-.5},z:(x,t)=>{let e=x-t;return e<5e-8&&e>-5e-8},vi:(x,t,e,i,s,n,o)=>{s<=0&&(s=1e-6);let r=0,a=0,h=0,l=0;if(x<e?(a=x,r=e):(a=e,r=x),t<i?(l=t,h=i):(l=i,h=t),x===e)return l<=o&&o<=h&&x-s<=n&&n<=x+s;if(t===i)return a<=n&&n<=r&&t-s<=o&&o<=t+s;let c=r+s,u=a-s;if(u<=n&&n<=c){let d=h+s,g=l-s;if(g<=o&&o<=d)if(c-u>d-g)if(x-e>s||e-x>s){let p=(i-t)/(e-x)*(n-x)+t;if(p-s<=o&&o<=p+s)return!0}else return!0;else if(t-i>s||i-t>s){let p=(e-x)/(i-t)*(o-t)+x;if(p-s<=n&&n<=p+s)return!0}else return!0}return!1},Pw:(x,t,e,i,s,n,o,r,a,h,l,c)=>{if(!L.vi(x,t,o,r,c,e,i)||!L.vi(x,t,o,r,c,s,n)){let u=(x+e)/2,d=(t+i)/2,g=(e+s)/2,p=(i+n)/2,m=(s+o)/2,y=(n+r)/2,w=(u+g)/2,b=(d+p)/2,v=(g+m)/2,k=(p+y)/2,S=(w+v)/2,M=(b+k)/2;return L.Pw(x,t,u,d,w,b,S,M,a,h,l,c)||L.Pw(S,M,v,k,m,y,o,r,a,h,l,c)}else return L.vi(x,t,o,r,c,h,l)},AC:(x,t,e,i,s,n,o,r,a)=>{let h=(x+e)/2,l=(t+i)/2,c=(e+s)/2,u=(i+n)/2,d=(s+o)/2,g=(n+r)/2,p=(h+c)/2,m=(l+u)/2,y=(c+d)/2,w=(u+g)/2;return a.i((p+y)/2,(m+w)/2),a},_D:(x,t,e,i,s,n,o,r)=>{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,c=(i+n)/2,u=(s+o)/2,d=(n+r)/2,g=(a+l)/2,p=(h+c)/2,m=(l+u)/2,y=(c+d)/2;return P.direction(g,p,m,y)},ou:(x,t,e,i,s,n,o,r,a,h)=>{if(!L.vi(x,t,o,r,a,e,i)||!L.vi(x,t,o,r,a,s,n)){let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,g=(s+o)/2,p=(n+r)/2,m=(l+u)/2,y=(c+d)/2,w=(u+g)/2,b=(d+p)/2,v=(m+w)/2,k=(y+b)/2;L.ou(x,t,l,c,m,y,v,k,a,h),L.ou(v,k,w,b,g,p,o,r,a,h)}else h.unionNoCheck(x,t,0,0),h.unionNoCheck(o,r,0,0);return h},vn:(x,t,e,i,s,n,o,r,a,h)=>{if(!L.vi(x,t,o,r,a,e,i)||!L.vi(x,t,o,r,a,s,n)){let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,g=(s+o)/2,p=(n+r)/2,m=(l+u)/2,y=(c+d)/2,w=(u+g)/2,b=(d+p)/2,v=(m+w)/2,k=(y+b)/2;L.vn(x,t,l,c,m,y,v,k,a,h),L.vn(v,k,w,b,g,p,o,r,a,h)}else h.length===0&&(h.push(x),h.push(t)),h.push(o),h.push(r);return h},Kk:(x,t,e,i,s,n,o,r,a,h)=>{if(L.vi(x,t,s,n,h,e,i))return L.vi(x,t,s,n,h,r,a);{let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,g=(l+u)/2,p=(c+d)/2;return L.Kk(x,t,l,c,g,p,o,r,a,h)||L.Kk(g,p,u,d,s,n,o,r,a,h)}},bE:(x,t,e,i,s,n,o)=>{let r=(x+e)/2,a=(t+i)/2,h=(e+s)/2,l=(i+n)/2;return o.i((r+h)/2,(a+l)/2),o},jk:(x,t,e,i,s,n,o,r)=>{if(L.vi(x,t,s,n,o,e,i))r.unionNoCheck(x,t,0,0),r.unionNoCheck(s,n,0,0);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,c=(i+n)/2,u=(a+l)/2,d=(h+c)/2;L.jk(x,t,a,h,u,d,o,r),L.jk(u,d,l,c,s,n,o,r)}return r},Og:(x,t,e,i,s,n,o,r)=>{if(L.vi(x,t,s,n,o,e,i))r.length===0&&(r.push(x),r.push(t)),r.push(s),r.push(n);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,c=(i+n)/2,u=(a+l)/2,d=(h+c)/2;L.Og(x,t,a,h,u,d,o,r),L.Og(u,d,l,c,s,n,o,r)}return r},Ig:(x,t,e,i,s,n,o,r,a,h,l,c,u,d)=>{if(!L.vi(x,t,o,r,u,e,i)||!L.vi(x,t,o,r,u,s,n)){let g=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,w=(s+o)/2,b=(n+r)/2,v=(g+m)/2,k=(p+y)/2,S=(m+w)/2,M=(y+b)/2,F=(v+S)/2,T=(k+M)/2,N=1/0,C=!1,R=0,O=0;if(L.Ig(x,t,g,p,v,k,F,T,a,h,l,c,u,d)){let V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,C=!0,R=d.x,O=d.y)}if(L.Ig(F,T,S,M,w,b,o,r,a,h,l,c,u,d)){let V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,C=!0,R=d.x,O=d.y)}return C&&(d.x=R,d.y=O),C}else{if(!L.su(x,t,o,r,a,h,l,c))return!1;let g=(x-o)*(h-c)-(t-r)*(a-l);if(g===0)return!1;let p=((x*r-t*o)*(a-l)-(x-o)*(a*c-h*l))/g,m=((x*r-t*o)*(h-c)-(t-r)*(a*c-h*l))/g;return d.i(p,m),!0}},Eg:(x,t,e,i,s,n,o,r,a,h,l,c,u)=>{let d=0;if(!L.vi(x,t,o,r,u,e,i)||!L.vi(x,t,o,r,u,s,n)){let g=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,w=(s+o)/2,b=(n+r)/2,v=(g+m)/2,k=(p+y)/2,S=(m+w)/2,M=(y+b)/2,F=(v+S)/2,T=(k+M)/2;d+=L.Eg(x,t,g,p,v,k,F,T,a,h,l,c,u),d+=L.Eg(F,T,S,M,w,b,o,r,a,h,l,c,u)}else{let g=(x-o)*(h-c)-(t-r)*(a-l);if(g===0)return d;let p=((x*r-t*o)*(a-l)-(x-o)*(a*c-h*l))/g,m=((x*r-t*o)*(h-c)-(t-r)*(a*c-h*l))/g;if(p>=l)return d;let y=0,w=0;if((a>l?a-l:l-a)<(h>c?h-c:c-h)){if(t<r?(y=t,w=r):(y=r,w=t),m<y||m>w)return d}else if(x<o?(y=x,w=o):(y=o,w=x),p<y||p>w)return d;g>0?d++:g<0&&d--}return d},dl:(x,t,e,i,s,n,o)=>{if(L.z(x,e)){let r=0,a=0;t<i?(r=t,a=i):(r=i,a=t);let h=n;return h<r?(o.i(x,r),!1):h>a?(o.i(x,a),!1):(o.i(x,h),!0)}else if(L.z(t,i)){let r=0,a=0;x<e?(r=x,a=e):(r=e,a=x);let h=s;return h<r?(o.i(r,t),!1):h>a?(o.i(a,t),!1):(o.i(h,t),!0)}else{let r=(e-x)**2+(i-t)**2,a=((x-s)*(x-e)+(t-n)*(t-i))/r;if(a<-5e-6)return o.i(x,t),!1;if(a>1.000005)return o.i(e,i),!1;{let h=x+a*(e-x),l=t+a*(i-t);return o.i(h,l),!0}}},On:(x,t,e,i,s,n,o,r,a)=>{if(L.f(x,e)&&L.f(t,i))return a.i(x,t),!1;if(L.z(s,o)){if(L.z(x,e))return L.dl(x,t,e,i,s,n,a),!1;{let h=(i-t)/(e-x)*(s-x)+t;return L.dl(x,t,e,i,s,h,a)}}else{let h=(r-n)/(o-s);if(L.z(x,e)){let l=h*(x-s)+n,c=0,u=0;return t<i?(c=t,u=i):(c=i,u=t),l<c?(a.i(x,c),!1):l>u?(a.i(x,u),!1):(a.i(x,l),!0)}else{let l=(i-t)/(e-x);if(L.z(h,l))return L.dl(x,t,e,i,s,n,a),!1;{let c=(l*x-h*s+n-t)/(l-h);if(L.z(l,0)){let u=0,d=0;return x<e?(u=x,d=e):(u=e,d=x),c<u?(a.i(u,t),!1):c>d?(a.i(d,t),!1):(a.i(c,t),!0)}else{let u=l*(c-x)+t;return L.dl(x,t,e,i,c,u,a)}}}}},kE:(x,t,e,i,s)=>L.On(e.x,e.y,i.x,i.y,x.x,x.y,t.x,t.y,s),PE:(x,t,e,i,s,n,o,r,a,h)=>{let l=1/0;function c(S,M){let F=(S-x)**2+(M-t)**2;F<l&&(l=F,a.i(S,M))}c(a.x,a.y);let u=0,d=0,g=0,p=0;s<o?(u=s,d=o):(u=o,d=s),n<r?(g=s,p=o):(g=o,p=s);let m=d-u,y=p-g,w=m/2+h,b=y/2+h,v=(s+o)/2,k=(n+r)/2;if(w===0||b===0)return a;if(L.f(x,e)){let S=1-(e-v)**2/(w*w);if(S<0)return a;let M=Math.sqrt(S),F=b*M+k,T=-b*M+k;c(e,F),c(e,T)}else{let S=(i-t)/(e-x),M=1/(w*w)+S*S/(b*b),F=2*S*(t-S*x)/(b*b)-2*S*k/(b*b)-2*v/(w*w),T=2*S*x*k/(b*b)-2*t*k/(b*b)+k*k/(b*b)+v*v/(w*w)-1+(t-S*x)*(t-S*x)/(b*b),N=F*F-4*M*T;if(N<0)return a;let C=Math.sqrt(N),R=(-F+C)/(2*M);c(R,S*R-S*x+t);let O=(-F-C)/(2*M);c(O,S*O-S*x+t)}return a},gl:(x,t,e,i,s,n,o,r,a)=>{let h=1e21,l=x,c=t;if(L.On(x,t,x,i,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}if(L.On(e,t,e,i,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}if(L.On(x,t,e,t,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}if(L.On(x,i,e,i,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}return a.i(l,c),h<1e21},Sw:(x,t,e)=>L.kC(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),kC:(x,t,e,i,s,n,o,r)=>{let a=x,h=x+e,l=t,c=t+i;if(s===o){let u=0,d=0;return n<r?(u=n,d=r):(u=r,d=n),a<=s&&s<=h&&u<=c&&d>=l}if(n===r){let u=0,d=0;return s<o?(u=s,d=o):(u=o,d=s),l<=n&&n<=c&&u<=h&&d>=a}return!!(z.contains(x,t,e,i,s,n)||z.contains(x,t,e,i,o,r)||L.su(a,l,h,l,s,n,o,r)||L.su(h,l,h,c,s,n,o,r)||L.su(h,c,a,c,s,n,o,r)||L.su(a,c,a,l,s,n,o,r))},su:(x,t,e,i,s,n,o,r)=>x===e&&t===i&&s===o&&n===r?x===s&&t===n:L.eu(x,t,e,i,s,n)*L.eu(x,t,e,i,o,r)<=0&&L.eu(s,n,o,r,x,t)*L.eu(s,n,o,r,e,i)<=0,eu:(x,t,e,i,s,n)=>{let o=e-x,r=i-t,a=s-x,h=n-t,l=a*r-h*o;return l===0&&(l=a*o+h*r,l>0&&(a-=o,h-=r,l=a*o+h*r,l<0&&(l=0))),l},Ug:x=>(x<0&&(x+=360),x>=360&&(x-=360),x),TC:(x,t,e,i,s,n)=>{let o=Math.PI;n||(i=i*(o/180),s=s*(o/180));let r=i>s?-1:1,a=1e-5,h=o*2,l=[],c=o/2,u=i,d=Math.min(h,Math.abs(s-i));if(d<a){let g=u+r*Math.min(d,c),p=x+e*Math.cos(u),m=t+e*Math.sin(u),y=x+e*Math.cos(g),w=t+e*Math.sin(g),b=(p+y)/2,v=(m+w)/2;return l.push([p,m,b,v,b,v,y,w]),l}for(;d>a;){let g=u+r*Math.min(d,c);l.push(L.tF(e,u,g,x,t)),d-=Math.abs(g-u),u=g}return l},tF:(x,t,e,i,s)=>{let n=(e-t)/2,o=x*Math.cos(n),r=x*Math.sin(n),a=o,h=-r,l=a*a+h*h,c=l+a*o+h*r,u=4/3*(Math.sqrt(2*l*c)-c)/(a*r-h*o),d=a-u*h,g=h+u*a,p=d,m=-g,y=n+t,w=Math.cos(y),b=Math.sin(y);return[i+x*Math.cos(t),s+x*Math.sin(t),i+d*w-g*b,s+d*b+g*w,i+p*w-m*b,s+p*b+m*w,i+x*Math.cos(e),s+x*Math.sin(e)]},Dg:(x,t,e,i,s,n,o)=>{let r=s,a=n,h=Math.floor((x-e)/r)*r+e,l=Math.floor((t-i)/a)*a+i,c=h;h+r-x<r/2&&(c=h+r);let u=l;return l+a-t<a/2&&(u=l+a),o.i(c,u),o},DC:(x,t)=>{let e=Math.max(x,t),i=Math.min(x,t),s=1,n=1;do s=e%i,n=i,e=i,i=s;while(s>0);return n},iF:(x,t,e,i)=>{let s=e<0,n=i<0,o=0,r=0,a=0;x<t?(r=1,a=0):(r=0,a=1);let h=0,l=0,c=0,u=0;return o=r,h=o===0?x:t,c=o===0?e:i,(o===0?s:n)&&(c=-c),o=a,l=o===0?x:t,u=o===0?e:i,(o===0?s:n)&&(u=-u),L.eF(h,l,c,u,0,0)},eF:(x,t,e,i,s,n)=>{let o=0;if(i>0)if(e>0){let r=x*x,a=t*t,h=x*e,l=t*i,c=-a+l,u=-a+Math.sqrt(h*h+l*l),d=c,g=9999999999;for(let y=0;y<g&&(d=.5*(c+u),!(d===c||d===u));++y){let w=h/(d+r),b=l/(d+a),v=w*w+b*b-1;if(v>0)c=d;else if(v<0)u=d;else break}s=r*e/(d+r),n=a*i/(d+a);let p=s-e,m=n-i;o=Math.sqrt(p*p+m*m)}else s=0,n=t,o=Math.abs(i-t);else{let r=x*x-t*t,a=x*e;if(a<r){let h=a/r,l=h*h;s=x*h,n=t*Math.sqrt(Math.abs(1-l));let c=s-e;o=Math.sqrt(c*c+n*n)}else s=x,n=0,o=Math.abs(e-x)}return o},In:new K,Bg:new K,or:new K,rr:0,Vg:100};L.za=L.QD;var ei=(x=>(x[x.Line=1]="Line",x[x.Rectangle=2]="Rectangle",x[x.Ellipse=3]="Ellipse",x[x.Path=4]="Path",x))(ei||{}),ms=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x))(ms||{});class kt{n;zg;Xg;oc;ru;lu;En;Un;Bn;H;we;xe;Qi;_i;Rs;rc;lc;constructor(t){I.Ki(this),this.n=2,t===void 0&&(t=4),this.H=t,this.we=0,this.xe=0,this.Qi=0,this._i=0,t===4?this.Rs=new G:this.Rs=kt.Mw,this.zg=this.Rs.nt,this.Xg=new z().u(),this.oc=null,this.ru=null,this.lu=NaN,this.En=D.TopLeft,this.Un=D.BottomRight,this.rc=NaN,this.lc=NaN,this.Bn=2}copy(){let t=new kt;if(t.n=this.n&-2,t.H=this.H,t.we=this.we,t.xe=this.xe,t.Qi=this.Qi,t._i=this._i,this.H===4){let e=this.Rs.r,i=t.Rs;for(let s=0;s<e.length;s++){let n=e[s];i.add(n.copy())}t.Rs=i}else t.Rs=this.Rs;return t.zg=this.zg,t.Xg.a(this.Xg),t.oc=this.oc,t.ru=this.ru,t.lu=this.lu,t.En=this.En.P(),t.Un=this.Un.P(),t.rc=this.rc,t.lc=this.lc,t.Bn=this.Bn,t}static Line=1;static Rectangle=2;static Ellipse=3;static Path=4;static Mw=new G().u();get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){if(this.h=!0,this.type!==4)return this;let t=this.figures;t.u();for(let e of t)e.u();return this}equalsApprox(t){if(!(t instanceof kt))return!1;if(this.type!==t.type)return this.type===1&&t.type===4?this.FC(t):t.type===1&&this.type===4?t.FC(this):!1;if(this.type===4){let e=this.figures.r,i=t.figures.r,s=e.length;if(s!==i.length)return!1;for(let n=0;n<s;n++){let o=e[n],r=i[n];if(!o.equalsApprox(r))return!1}return!0}else return L.f(this.startX,t.startX)&&L.f(this.startY,t.startY)&&L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)}FC(t){if(this.type!==1||t.type!==4)return!1;if(t.figures.count===1){let e=t.figures.elt(0);if(e.segments.count===1&&L.f(this.startX,e.startX)&&L.f(this.startY,e.startY)){let i=e.segments.elt(0);if(i.type===2&&L.f(this.endX,i.endX)&&L.f(this.endY,i.endY))return!0}}return!1}static stringify(t){return t.toString()}static stringifyFixed(t){return f.s(t,"number",kt,"stringifyFixed:digits"),e=>e.toString(t)}oi(t){t in ei?this.type=t:f.er(this,t)}toString(t){t===void 0&&(t=-1);let e=s=>s===0?"0":s.toFixed(t),i;switch(this.type){case 1:return t<0?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+e(this.startX)+" "+e(this.startY)+"L"+e(this.endX)+" "+e(this.endY);case 2:return i=new z(this.startX,this.startY,0,0),i.union(this.endX,this.endY,0,0),t<0?"M"+i.x.toString()+" "+i.y.toString()+"H"+i.right.toString()+"V"+i.bottom.toString()+"H"+i.left.toString()+"z":"M"+e(i.x)+" "+e(i.y)+"H"+e(i.right)+"V"+e(i.bottom)+"H"+e(i.left)+"z";case 3:if(i=new z(this.startX,this.startY,0,0),i.union(this.endX,this.endY,0,0),t<0){let r=i.left.toString()+" "+(i.y+i.height/2).toString(),a=i.right.toString()+" "+(i.y+i.height/2).toString();return"M"+r+"A"+(i.width/2).toString()+" "+(i.height/2).toString()+" 0 0 1 "+a+"A"+(i.width/2).toString()+" "+(i.height/2).toString()+" 0 0 1 "+r}else{let r=e(i.left)+" "+e(i.y+i.height/2),a=e(i.right)+" "+e(i.y+i.height/2);return"M"+r+"A"+e(i.width/2)+" "+e(i.height/2)+" 0 0 1 "+a+"A"+e(i.width/2)+" "+e(i.height/2)+" 0 0 1 "+r}case 4:let s="",n=this.figures.r,o=n.length;for(let r=0;r<o;r++){let a=n[r];r>0&&(s+=" x "),a.isFilled&&(s+="F "),s+=a.toString(t)}return s;default:return ei[this.type]}}static fillPath(t){typeof t!="string"&&f.Zi(t,"string",kt,"fillPath:str");let e=t.split(/[Xx]/),i=e.length,s="";for(let n=0;n<i;n++){let o=e[n];if(o.match(/[Ff]/)!==null){n===0?s+=o:s+="X"+(o[0]===" "?"":" ")+o;continue}s+=(n===0?"":"X ")+"F"+(o[0]===" "?"":" ")+o}return s}static Yg="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";static parse(t,e){e===void 0&&(e=!1),typeof t!="string"&&f.Zi(t,"string",kt,"parse:str");let i=new RegExp("(["+kt.Yg+"])(["+kt.Yg+"])","gm"),s=new RegExp("(["+kt.Yg+"])([^s])","gm"),n=new RegExp("([^s])(["+kt.Yg+"])","gm");t=t.replace(/,/gm," "),t=t.replace(i,"$1 $2"),t=t.replace(i,"$1 $2"),t=t.replace(s,"$1 $2"),t=t.replace(n,"$1 $2"),t=t.replace(/([0-9])([+\-])/gm,"$1 $2"),t=t.replace(/[\s\r\t\n]+/gm," "),t=t.replace(/^\s+|\s+$/g,"");let o=t.split(" ");for(let R=0;R<o.length;R++){let O=o[R];if(O.match(/(\.[0-9]*)(\.)/gm)!==null){let V=f.et(),X="",Y=!1;for(let j=0;j<O.length;j++){let U=O[j];U==="."&&!Y?(Y=!0,X+=U):U==="."?(V.push(X),X="."):X+=U}V.push(X),o.splice(R,1);for(let j=0;j<V.length;j++)o.splice(R+j,0,V[j]);R+=V.length-1,f.J(V)}}let r=-1,a="",h="",l=new P(0,0),c=new P(0,0),u=new P(0,0),d=!0;function g(){return r>=v-1||o[r+1].match(N)!==null?!0:(d=!1,!1)}function p(){return r++,o[r]}function m(R){let O=parseFloat(p()),V=parseFloat(p());a===a.toLowerCase()&&(O=u.x+O,V=u.y+V),R.i(O,V)}function y(){return m(u),u}function w(){return m(c),c}function b(){let R=h.toLowerCase();return R==="c"||R==="s"||R==="q"||R==="t"?new P(2*u.x-c.x,2*u.y-c.y):new P(u.x,u.y)}let v=o.length,k=Ke.RC(null),S=!1,M=!1,F=!1,T=!0,N=new RegExp("["+kt.Yg+"]");for(;!(r>=v-1);){if(h=a,a=p(),a==="")continue;d=!0;let R=!1;switch(a.toUpperCase()){case"X":T=!0,S=!1,M=!1;break;case"M":let O=y();for(k.bi===null||T===!0?(k.hu(O.x,O.y,S,!1,!M,F),T=!1):k.sF(O.x,O.y),l.a(u);!g();){let V=y();k.lr(V.x,V.y)}break;case"L":for(;!g();){let V=y();k.lr(V.x,V.y)}d&&(R=!0);break;case"H":for(;!g();)u.i((a===a.toLowerCase()?u.x:0)+parseFloat(p()),u.y),k.lr(u.x,u.y);break;case"V":for(;!g();)u.i(u.x,(a===a.toLowerCase()?u.y:0)+parseFloat(p())),k.lr(u.x,u.y);d&&(R=!0);break;case"C":for(;!g();){let V=new P;m(V);let X=w(),Y=y();k.hr(V.x,V.y,X.x,X.y,Y.x,Y.y)}d&&(R=!0);break;case"S":for(;!g();){let V=b(),X=w(),Y=y();k.hr(V.x,V.y,X.x,X.y,Y.x,Y.y)}d&&(R=!0);break;case"Q":for(;!g();){let V=w(),X=y();k.Nw(V.x,V.y,X.x,X.y)}d&&(R=!0);break;case"T":for(;!g();){let V=b();c.a(V);let X=y();k.Nw(V.x,V.y,X.x,X.y),c.a(X)}d&&(R=!0);break;case"B":for(;!g();){let V=parseFloat(p()),X=parseFloat(p()),Y=parseFloat(p()),j=parseFloat(p()),U=parseFloat(p()),nt=U,at=!1;g()||(nt=parseFloat(p()),g()||(at=parseFloat(p())!==0)),a===a.toLowerCase()&&(Y+=u.x,j+=u.y),k.nF(V,X,Y,j,U,nt,at)}d&&(R=!0);break;case"A":for(;!g();){let V=Math.abs(parseFloat(p())),X=Math.abs(parseFloat(p())),Y=parseFloat(p()),j=!1,U=!1,nt=0,at=0,tt=p();tt.length===1?(j=!!parseFloat(tt),U=!!parseFloat(p()),nt=parseFloat(p()),at=parseFloat(p())):tt.length===2?(j=!!parseFloat(tt[0]),U=!!parseFloat(tt[1]),nt=parseFloat(p()),at=parseFloat(p())):(j=!!parseFloat(tt[0]),U=!!parseFloat(tt[1]),nt=parseFloat(tt.slice(2)),at=parseFloat(p())),a===a.toLowerCase()&&(nt=u.x+nt,at=u.y+at),u.i(nt,at),k.oF(V,X,Y,j,U,nt,at)}d&&(R=!0);break;case"Z":k.rF(),u.a(l);break;case"F":{let V="",X=1;for(;o[r+X];){if(o[r+X]==="0"){F=!0,X++;continue}if(o[r+X].match(/[Uu]/)!==null){X++;continue}if(o[r+X].match(N)===null){X++;continue}V=o[r+X];break}V.match(/[Mm]/)?S=!0:k.lF();break}case"U":{let V="",X=1;for(;o[r+X];){if(o[r+X].match(/[Ff]/)!==null){X++;continue}if(o[r+X].match(N)===null){X++;continue}V=o[r+X];break}V.match(/[Mm]/)?M=!0:k.hF(!1);break}default:if(a==="0"||a==="1")break;f.ni("Unknown geometry command: "+a);break}if(R){f.ni(`Bad geometry command: ${a}, next token: ${p()},
3
+ v1.0.4 */
4
+ import{a as Zs,b as Qs}from"./ZEFYE6IH.js";import{a as Zn}from"./Z7DOTE4W.js";import{D as Jn,c as qn,d as Hn,p as Wn,y as $n}from"./ST5DNJ5A.js";import"./4RUO65YZ.js";(function(){let A=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};A.requestAnimationFrame===void 0&&(A.setImmediate===void 0?A.requestAnimationFrame=x=>A.setTimeout(x,0):A.requestAnimationFrame=A.setImmediate);class f{static tr=A.navigator!==void 0&&A.navigator.platform!==void 0&&A.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static Rk(t,e,i){let s=-1;return function(){let n=this,o=arguments;s!==-1&&f.Tg(s),s=f.ir(()=>{s=-1,i||t.apply(n,o)},e),i&&!s&&t.apply(n,o)}}static ir(t,e){return A.setTimeout(t,e)}static Tg(t){A.clearTimeout(t)}static hs(t){return A.document.createElement(t)}static o(t){throw new Error(t)}static L(t,e){let i="The object is frozen, so its properties cannot be set: "+t.toString();e!==void 0&&(i+=" to value: "+e),f.o(i)}static dE(t,e,i,s){}static s(t,e,i,s){}static gE(t,e,i){}static ec(t,e,i){if(t===null||typeof t!="object"){let s=f.fC(e);i!==void 0&&(s+="."+i),f.Zi(t,"object",s)}}static k(t,e,i){f.s(t,"function",e,i)}static mE(t,e,i){}static Zi(t,e,i,s){}static W(t,e,i,s){let n=f.fC(i);s!==void 0&&(n+="."+s),f.o(n+" is not in the range "+e+": "+t)}static Re(t){}static er(t,e){}static ni(t){A.console&&A.console.log(t)}static G(t){return t!==null&&typeof t=="object"}static it(t){return typeof t=="function"}static vk=[];static et(){let t=f.vk.pop();return t===void 0?[]:t}static J(t){t.length=0,f.vk.push(t)}static pE=Object.freeze([]);static fC(t){return t===null?"*":typeof t=="string"?t:f.it(t)?t.name:""}static Dn(t){return f.it(t)?t.className?t.className:t.name:f.G(t)&&t.constructor?f.Dn(t.constructor):typeof t}static Uh(t,e){return e==null||e===""?null:f.G(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return f.G(t)&&(t.text?e=t.text:t.name?e=t.name:t.key!==void 0?e=t.key:t.id!==void 0?e=t.id:t.constructor===Object&&(t.Text?e=t.Text:t.Name?e=t.Name:t.Key!==void 0?e=t.Key:t.Id!==void 0?e=t.Id:t.ID!==void 0&&(e=t.ID))),e===void 0?"undefined":e===null?"null":e.toString()}static dw(t,e){if(t.hasOwnProperty(e))return!0;let i=Object.getPrototypeOf(t);for(;i&&i!==Function;){if(i.hasOwnProperty(e))return!0;let s=i.yE;if(s&&s[e])return!0;i=Object.getPrototypeOf(i)}return!1}static WD(t){let e=[],i=0;for(i=0;i<256;i++)e[i]=i;let s=0,n=0;for(i=0;i<256;i++)s=(s+e[i]+119)%256,n=e[i],e[i]=e[s],e[s]=n;i=0,s=0;let o="";for(let r=0;r<t.length;r++)i=(i+1)%256,s=(s+e[i])%256,n=e[i],e[i]=e[s],e[s]=n,o+=String.fromCharCode(t.charCodeAt(r)^e[(e[i]+e[s])%256]);return o}static JD(t){let e="0123456789abcdef",i=[];for(let r=0;r<256;r++)i[e.charAt(r>>4)+e.charAt(r&15)]=String.fromCharCode(r);t.length%2&&(t="0"+t);let s=[],n=0;for(let r=0;r<t.length;r+=2)s[n++]=i[t.substring(r,r+2)];let o=s.join("");return o===""?"0":o}static Ts(t){return f.WD(f.JD(t))}static color1="@COLOR1";static color2="@COLOR2";static gw="32ab5ff3b26f42dc0ed90f21412913b5"}f.vfo="29e646fdb162";class B{Ok;constructor(){this.Ok=[]}toString(){return this.Ok.join("")}add(t){t!==""&&this.Ok.push(t)}}class K{}class W{g;constructor(){this.g=[]}[Symbol.iterator](){return this.g.values()}key;value;get iterator(){return this}reset(){}next(){return!1}hasNext(){return!1}first(){return null}any(){return!1}all(){return!0}each(){return this}map(t){return this}filter(){return this}get count(){return 0}ul(){}toString(){return"EmptyIterator"}static instance=new W}class ${constructor(t){this.key=-1,this.value=t}[Symbol.iterator](){return[this.value].values()}key;value;get iterator(){return this}reset(){this.key=-1}next(){return this.key===-1?(this.key=0,!0):!1}hasNext(){return this.next()}first(){return this.key=0,this.value}any(t){return this.key=-1,t(this.value)}all(t){return this.key=-1,t(this.value)}each(t){return this.key=-1,t(this.value),this}map(t){return new $(t(this.value))}filter(t){return t(this.value)?new $(this.value):W.instance}get count(){return 1}ul(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class it{qt;Ds;Gt;At;constructor(t){this.qt=t,this.Ds=null,t.sr=null,this.Gt=t.nt,this.At=-1}[Symbol.iterator](){return this.Ds===null?this.qt.r.values():this.qt.r.filter(this.Ds).values()}key;value;get iterator(){return this}get predicate(){return this.Ds}set predicate(t){this.Ds=t}reset(){let t=this.qt;t.sr=null,this.Gt=t.nt,this.At=-1}next(){let t=this.qt;if(t.nt!==this.Gt){if(this.key<0)return!1;f.Re(t)}let e=t.r,i=e.length,s=++this.At,n=this.Ds;if(n!==null)for(;s<i;){let o=e[s];if(n(o))return this.At=s,this.key=s,this.value=o,!0;s++}else{if(s<i)return this.key=s,this.value=e[s],!0;this.ul()}return!1}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.nt,this.At=0;let e=t.r,i=e.length,s=this.Ds;if(s!==null){let n=0;for(;n<i;){let o=e[n];if(s(o))return this.At=n,this.key=n,this.value=o,o;n++}return null}else if(i>0){let n=e[0];return this.key=0,this.value=n,n}else return null}any(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(t(a))return!0;e.nt!==i&&f.Re(e)}}return!1}all(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(!t(a))return!1;e.nt!==i&&f.Re(e)}}return!0}each(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];o!==null&&!o(a)||(t(a),e.nt!==i&&f.Re(e))}return this}map(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=[],n=e.r,o=n.length,r=this.Ds;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(s.push(t(l)),e.nt!==i&&f.Re(e))}let a=new G;return a.r=s,a.ve(),a.iterator}filter(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=[],n=e.r,o=n.length,r=this.Ds;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(t(l)&&s.push(l),e.nt!==i&&f.Re(e))}let a=new G;return a.r=s,a.ve(),a.iterator}get count(){let t=this.Ds;if(t!==null){let e=0,i=this.qt.r,s=i.length;for(let n=0;n<s;n++)t(i[n])&&e++;return e}else return this.qt.r.length}ul(){this.key=-1,this.value=null,this.Gt=-1,this.Ds=null,this.qt.sr=this}toString(){return"ListIterator@"+this.At+"/"+this.qt.count}}class ht{qt;Gt;At;constructor(t){this.qt=t,t.nr=null,this.Gt=t.nt,this.At=t.r.length}[Symbol.iterator](){return this.qt.r.reverse().values()}key;value;get iterator(){return this}reset(){let t=this.qt;t.nr=null,this.Gt=t.nt,this.At=t.r.length}next(){let t=this.qt;if(t.nt!==this.Gt){if(this.key<0)return!1;f.Re(t)}let e=--this.At;return e>=0?(this.key=e,this.value=t.r[e],!0):(this.ul(),!1)}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.nt;let e=t.r,i=e.length-1;if(this.At=i,i>=0){let s=e[i];return this.key=i,this.value=s,s}else return null}any(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];if(t(r))return!0;e.nt!==i&&f.Re(e)}return!1}all(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];if(!t(r))return!1;e.nt!==i&&f.Re(e)}return!0}each(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];t(r),e.nt!==i&&f.Re(e)}return this}map(t){let e=this.qt;e.nr=null;let i=e.nt,s=[],n=e.r,o=n.length;this.At=o;for(let a=o-1;a>=0;a--){let h=n[a];s.push(t(h)),e.nt!==i&&f.Re(e)}let r=new G;return r.r=s,r.ve(),r.iterator}filter(t){let e=this.qt;e.nr=null;let i=e.nt,s=[],n=e.r,o=n.length;this.At=o;for(let a=o-1;a>=0;a--){let h=n[a];t(h)&&s.push(h),e.nt!==i&&f.Re(e)}let r=new G;return r.r=s,r.ve(),r.iterator}get count(){return this.qt.r.length}ul(){this.key=-1,this.value=null,this.Gt=-1,this.qt.nr=this}toString(){return"ListIteratorBackwards("+this.At+"/"+this.qt.count+")"}}class G{h;r;nt;sr;nr;constructor(t){I.Ki(this),this.h=!1,this.r=[],this.nt=0,this.sr=null,this.nr=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.r.values()}ve(){let t=this.nt;t++,t>999999999&&(t=0),this.nt=t}u(){return this.h=!0,this}Nt(){return this.h=!1,this}toString(){return"List()#"+I.as(this)}add(t){return this.h&&f.L(this,t),this.r.push(t),this.ve(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.h&&f.L(this);let e=this.r;if(Array.isArray(t)){let i=t.length;for(let s=0;s<i;s++){let n=t[s];e.push(n)}}else{let i=t.iterator;for(;i.next();){let s=i.value;e.push(s)}}return this.ve(),this}clear(){this.h&&f.L(this),this.r.length=0,this.ve()}contains(t){return this.has(t)}has(t){return t===null?!1:this.r.indexOf(t)!==-1}indexOf(t){return t===null?-1:this.r.indexOf(t)}elt(t){let e=this.r;return(t<0||t>=e.length)&&f.W(t,"0 <= i < length",G,"elt:i"),e[t]}get(t){return this.elt(t)}setElt(t,e){let i=this.r;(t<0||t>=i.length)&&f.W(t,"0 <= i < length",G,"setElt:i"),this.h&&f.L(this,t),i[t]=e}set(t,e){this.setElt(t,e)}first(){let t=this.r;return t.length===0?null:t[0]}last(){let t=this.r,e=t.length;return e>0?t[e-1]:null}pop(){this.h&&f.L(this);let t=this.r;return t.length>0?t.pop():null}any(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++){if(t(e[n]))return!0;this.nt!==i&&f.Re(this)}return!1}all(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++){if(!t(e[n]))return!1;this.nt!==i&&f.Re(this)}return!0}each(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++)t(e[n]),this.nt!==i&&f.Re(this);return this}map(t){let e=new G,i=[],s=this.r,n=this.nt,o=s.length;for(let r=0;r<o;r++)i.push(t(s[r])),this.nt!==n&&f.Re(this);return e.r=i,e.ve(),e}filter(t){let e=new G,i=[],s=this.r,n=this.nt,o=s.length;for(let r=0;r<o;r++){let a=s[r];t(a)&&i.push(a),this.nt!==n&&f.Re(this)}return e.r=i,e.ve(),e}insertAt(t,e){t<0&&f.W(t,">= 0",G,"insertAt:i"),this.h&&f.L(this,t);let i=this.r;t>=i.length?i.push(e):i.splice(t,0,e),this.ve()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.h&&f.L(this,t);let e=this.r,i=e.indexOf(t);return i===-1?!1:(i===e.length-1?e.pop():e.splice(i,1),this.ve(),!0)}removeAt(t){let e=this.r;(t<0||t>=e.length)&&f.W(t,"0 <= i < length",G,"removeAt:i"),this.h&&f.L(this,t),t===e.length-1?e.pop():e.splice(t,1),this.ve()}removeRange(t,e){let i=this.r,s=i.length;if(t<0)t=0;else if(t>=s)return this;if(e<0)return this;if(e>=s&&(e=s-1),t>e)return this;this.h&&f.L(this);let n=t,o=e+1;for(;o<s;)i[n++]=i[o++];return i.length=s-(e-t+1),this.ve(),this}copy(){let t=new G,e=this.r;return e.length>0&&(t.r=Array.prototype.slice.call(e)),t}toArray(){let t=this.r,e=this.count,i=new Array(e);for(let s=0;s<e;s++)i[s]=t[s];return i}get uC(){return this.r}toSet(){let t=new I,e=this.r,i=this.count;for(let s=0;s<i;s++)t.add(e[s]);return t}sort(t){return this.h&&f.L(this),this.r.sort(t),this.ve(),this}sortRange(t,e,i){let s=this.r,n=s.length;e===void 0&&(e=0),i===void 0&&(i=n),this.h&&f.L(this);let o=i-e;if(o<=1)return this;if((e<0||e>=n-1)&&f.W(e,"0 <= from < length",G,"sortRange:from"),o===2){let r=s[e],a=s[e+1];return t(r,a)>0&&(s[e]=a,s[e+1]=r,this.ve()),this}if(e===0)if(i>=n)s.sort(t);else{let r=s.slice(0,i);r.sort(t);for(let a=0;a<i;a++)s[a]=r[a]}else if(i>=n){let r=s.slice(e);r.sort(t);for(let a=e;a<n;a++)s[a]=r[a-e]}else{let r=s.slice(e,i);r.sort(t);for(let a=e;a<i;a++)s[a]=r[a-e]}return this.ve(),this}reverse(){return this.h&&f.L(this),this.r.reverse(),this.ve(),this}get count(){return this.r.length}get size(){return this.r.length}get length(){return this.r.length}get iterator(){if(this.r.length<=0)return W.instance;let t=this.sr;return t!==null?(t.reset(),t):new it(this)}get iteratorBackwards(){if(this.r.length<=0)return W.instance;let t=this.nr;return t!==null?(t.reset(),t):new ht(this)}}class Tt{wo;ii;constructor(t){this.wo=t,this.ii=t.g.values()}[Symbol.iterator](){return this.wo.g.values()}key;value;get iterator(){return this}reset(){let t=this.wo;this.ii=t.g.values()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.wo.g.size===0?null:(this.ii=this.wo.g.values(),this.ii.next().value)}any(t){return this.wo.any(t)}all(t){return this.wo.all(t)}each(t){return this.wo.each(t),this}map(t){let e=new G;return this.wo.g.forEach(i=>e.add(t(i))),e.iterator}filter(t){let e=new G;return this.wo.g.forEach(i=>{t(i)&&e.add(i)}),e.iterator}get count(){return this.wo.count}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"SetIterator"}}class I{h;g;constructor(t){this.h=!1,this.g=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.values()}values(){return this.g.values()}u(){return this.h=!0,this}Nt(){return this.h=!1,this}toString(){return"Set()#"+I.as(this)}add(t){return t===null?this:(this.g.add(t),this)}addAll(t){if(t===null)return this;if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];s!==null&&this.g.add(s)}}else{let e=t.iterator;for(;e.next();){let i=e.value;i!==null&&this.g.add(i)}}return this}has(t){return this.g.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;let e=t.iterator;for(;e.next();)if(!this.has(e.value))return!1;return!0}containsAny(t){if(t===null)return!0;let e=t.iterator;for(;e.next();)if(this.has(e.value))return!0;return!1}first(){return this.g.size===0?null:this.g.values().next().value}any(t){for(let e of this.g)if(t(e))return!0;return!1}all(t){for(let e of this.g)if(!t(e))return!1;return!0}each(t){for(let e of this.g)t(e);return this}map(t){let e=new I;for(let i of this.g)e.add(t(i));return e}filter(t){let e=new I;for(let i of this.g)t(i)&&e.add(i);return e}delete(t){return this.h&&f.L(this),this.g.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.h&&f.L(this),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++)this.delete(t[i])}else{let e=t.iterator;for(;e.next();)this.delete(e.value)}return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.h&&f.L(this);let e=new I;e.addAll(t);let i=[],s=this.iterator;for(;s.next();){let n=s.value;e.has(n)||i.push(n)}return this.removeAll(i),this}clear(){this.h&&f.L(this),this.g.clear()}copy(){let t=new I;return this.g.forEach(e=>t.add(e)),t}toArray(){return Array.from(this.g)}toList(){let t=new G;return this.g.forEach(e=>t.add(e)),t}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?W.instance:new Tt(this)}entries(){return this.g.entries()}keys(){return this.g.keys()}forEach(t,e){return this.g.forEach(t,e)}static mw=1;static Ki(t){t.__gohashid=I.mw++}static as(t){return t.__gohashid}}class Rt{q;ii;constructor(t){this.q=t,this.ii=t.g.keys()}[Symbol.iterator](){return this.q.g.keys()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.keys()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.ii=this.q.g.keys(),this.ii.next().value)}any(t){for(let e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.q.g)t(e[0]);return this}map(t){let e=this.q,i=new G;for(let s of e.g)i.add(t(s[0]));return i.iterator}filter(t){let e=this.q,i=new G;for(let s of e.g){let n=s[0];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapKeySetIterator"}}class he extends I{q;constructor(t){super(),I.Ki(this),this.h=!0,this.q=t}[Symbol.iterator](){return this.g.keys()}values(){return this.g.keys()}u(){return this}Nt(){return this}toString(){return"MapKeySet("+this.q.toString()+")"}add(t){f.o("This Set is read-only: "+this.toString())}has(t){return this.q.has(t)}contains(t){return this.has(t)}delete(t){f.o("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){f.o("This Set is read-only: "+this.toString())}first(){return this.q.g.size===0?null:this.q.g.keys().next().value}any(t){for(let e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.q.g)t(e[0]);return this}map(t){let e=new I;for(let i of this.q.g)e.add(t(i[0]));return e}filter(t){let e=new I;for(let i of this.q.g){let s=i[0];t(s)&&e.add(s)}return e}copy(){return new he(this.q)}toSet(){let t=new I,e=this.q.g;for(let i of e)t.add(i[0]);return t}toArray(){let t=this.q.g,e=new Array(t.size),i=0;for(let s of t)e[i]=s[0],i++;return e}toList(){let t=new G,e=this.q.g;for(let i of e)t.add(i[0]);return t}get count(){return this.q.size}get size(){return this.q.size}get iterator(){return this.q.size<=0?W.instance:new Rt(this.q)}}class Oe{q;ii;constructor(t){this.q=t,this.ii=t.g.values()}[Symbol.iterator](){return this.q.g.values()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.values()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.ii=this.q.g.values(),this.ii.next().value)}any(t){for(let e of this.q.g)if(t(e[1]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[1]))return!1;return!0}each(t){for(let e of this.q.g)t(e[1]);return this}map(t){let e=this.q,i=new G;for(let s of e.g)i.add(t(s[1]));return i.iterator}filter(t){let e=this.q,i=new G;for(let s of e.g){let n=s[1];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapValueSetIterator"}}class Ut{constructor(t,e){this.key=t,this.value=e}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class Wt{q;ii;constructor(t){this.q=t,this.ii=t.g.entries()}[Symbol.iterator](){return this.q.g.entries()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.entries()}next(){let t=this.ii.next();return t.done?(this.key=null,this.value=null,!1):(this.key=t.value[0],this.value=t.value[1],!0)}hasNext(){return this.next()}first(){if(this.q.g.size===0)return null;this.ii=this.q.g.entries();let t=this.ii.next().value;return this.key=t[0],this.value=t[1],new Ut(t[0],t[1])}any(t){return this.q.any(t)}all(t){return this.q.all(t)}each(t){return this.q.each(t),this}map(t){let e=new G,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ut(n,s):(i.key=n,i.value=s),e.add(t(i))}),e.iterator}filter(t){let e=new G,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ut(n,s):(i.key=n,i.value=s),t(i)&&(e.add(i),i=null)}),e.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapIterator"}}class pt{h;g;constructor(t){I.Ki(this),this.h=!1,this.g=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.entries()}entries(){return this.g.entries()}u(){return this.h=!0,this}Nt(){return this.h=!1,this}toString(){return"Map()#"+I.as(this)}set(t,e){return this.h&&f.L(this,t),this.g.set(t,e),this}add(t,e){return this.set(t,e)}addAll(t){if(t===null)return this;if(this.h&&f.L(this),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];this.set(s.key,s.value)}}else if(t instanceof pt){let e=t.iterator;for(;e.next();)this.set(e.key,e.value)}else{let e=t.iterator;for(;e.next();){let i=e.value;this.set(i.key,i.value)}}return this}first(){if(this.g.size===0)return null;let t=this.g.entries().next().value;return new Ut(t[0],t[1])}any(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ut(i,s):(e.key=i,e.value=s),t(e))return!0;return!1}all(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ut(i,s):(e.key=i,e.value=s),!t(e))return!1;return!0}each(t){let e=null;for(let[i,s]of this.g)e===null?e=new Ut(i,s):(e.key=i,e.value=s),t(e);return this}map(t){let e=new pt,i=null;for(let[s,n]of this.g)i===null?i=new Ut(s,n):(i.key=s,i.value=n),e.set(s,t(i));return e}filter(t){let e=new pt,i=null;for(let[s,n]of this.g)i===null?i=new Ut(s,n):(i.key=s,i.value=n),t(i)&&e.set(s,n);return e}has(t){return this.g.has(t)}contains(t){return this.has(t)}get(t){let e=this.g.get(t);return e===void 0?null:e}getValue(t){return this.get(t)}delete(t){return t===null?!1:(this.h&&f.L(this,t),this.g.delete(t))}remove(t){return this.delete(t)}clear(){this.h&&f.L(this),this.g.clear()}copy(){let t=new pt;return t.g=new Map(this.g),t}toArray(){let t=this.g,e=new Array(t.size),i=0;for(let s of t)e[i]=new Ut(s[0],s[1]),i++;return e}toKeySet(){return new he(this)}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?W.instance:new Wt(this)}get iteratorKeys(){return this.count<=0?W.instance:new Rt(this)}keys(){return this.g.keys()}get iteratorValues(){return this.count<=0?W.instance:new Oe(this)}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}}class P{px;py;h;constructor(t,e){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof e=="number"?(this.px=t,this.py=e):f.o("Invalid arguments to Point constructor: "+t+", "+e),this.h=!1}a(t){return this.px=t.px,this.py=t.py,this}i(t,e){return this.px=t,this.py=e,this}setTo(t,e){return this.px=t,this.py=e,this}set(t){return this.px=t.px,this.py=t.py,this}copy(){let t=new P;return t.px=this.px,t.py=this.py,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new P(s,o)}else return new P}static stringify(t){return t.x.toString()+" "+t.y.toString()}static stringifyFixed(t){return f.s(t,"number",P,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)}toString(){return"Point("+this.x+","+this.y+")"}equals(t){return t instanceof P?this.px===t.x&&this.py===t.y:!1}equalTo(t,e){return this.px===t&&this.py===e}equalsApprox(t){return L.f(this.px,t.x)&&L.f(this.py,t.y)}add(t){return this.px+=t.x,this.py+=t.y,this}subtract(t){return this.px-=t.x,this.py-=t.y,this}offset(t,e){return this.px+=t,this.py+=e,this}rotate(t){if(t===0)return this;let e=this.px,i=this.py;if(e===0&&i===0)return this;let s=0,n=0;if(t>=360?t-=360:t<0&&(t+=360),t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let o=t*Math.PI/180;s=Math.cos(o),n=Math.sin(o)}return this.px=s*e-n*i,this.py=n*e+s*i,this}scale(t,e){return this.px*=t,this.py*=e,this}distanceSquaredPoint(t){let e=t.x-this.px,i=t.y-this.py;return e*e+i*i}distanceSquared(t,e){let i=t-this.px,s=e-this.py;return i*i+s*s}normalize(){let t=this.px,e=this.py,i=Math.sqrt(t*t+e*e);return i>0&&(this.px=t/i,this.py=e/i),this}directionPoint(t){return this.dC(t.x-this.px,t.y-this.py)}direction(t,e){return this.dC(t-this.px,e-this.py)}dC(t,e){if(t===0)return e>0?90:e<0?270:0;if(e===0)return t>0?0:180;{if(isNaN(t)||isNaN(e))return 0;let i=Math.atan(Math.abs(e/t))*180/Math.PI;return t<0?e<0?i+=180:i=180-i:e<0&&(i=360-i),i}}static compareWithLineSegment(t,e,i,s,n,o){return L.eu(t,e,i,s,n,o)}compareWithLineSegmentPoint(t,e){return L.eu(t.x,t.y,e.x,e.y,this.x,this.y)}static intersectingLineSegments(t,e,i,s,n,o,r,a){return L.su(t,e,i,s,n,o,r,a)}projectOntoLineSegment(t,e,i,s){return L.dl(t,e,i,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,e){return L.dl(t.x,t.y,e.x,e.y,this.px,this.py,this),this}snapToGrid(t,e,i,s){return L.Dg(this.px,this.py,t,e,i,s,this),this}snapToGridPoint(t,e){return L.Dg(this.px,this.py,t.x,t.y,e.width,e.height,this),this}setRectSpot(t,e){return this.px=t.x+e.x*t.width+e.offsetX,this.py=t.y+e.y*t.height+e.offsetY,this}setSpot(t,e,i,s,n){return this.px=t+n.x*i+n.offsetX,this.py=e+n.y*s+n.offsetY,this}T(t){return t.gt(this),this}Oe(t){return t.$e(this),this}static distanceLineSegmentSquared(t,e,i,s,n,o){let r=n-i,a=o-s,h=r*r+a*a,l=i-t,c=s-e,u=-l*r-c*a;if(u<=0||u>=h)return r=n-t,a=o-e,Math.min(l*l+c*c,r*r+a*a);{let d=r*c-a*l;return d*d/h}}static distanceSquared(t,e,i,s){let n=i-t,o=s-e;return n*n+o*o}static direction(t,e,i,s){let n=i-t,o=s-e;if(n===0)return o>0?90:o<0?270:0;if(o===0)return n>0?0:180;{if(isNaN(n)||isNaN(o))return 0;let r=Math.atan(Math.abs(o/n))*180/Math.PI;return n<0?o<0?r+=180:r=180-r:o<0&&(r=360-r),r}}get x(){return this.px}set x(t){this.px=t}get y(){return this.py}set y(t){this.py=t}isReal(){return isFinite(this.x)&&isFinite(this.y)}static xo=new P(0,0).$();static gC=new P(-1/0,-1/0).$();static mC=new P(1/0,1/0).$();static pC=new P(6,6).$();static Ik=new P(NaN,NaN).$();static Ek=[];static l(){let t=P.Ek.pop();return t===void 0?new P:t}static V(t,e){let i=P.Ek.pop();return i===void 0?new P(t,e):(i.x=t,i.y=e,i)}static e(t){P.Ek.push(t)}}class Q{sw;sh;h;constructor(t,e){t===void 0?(this.sw=0,this.sh=0):typeof t=="number"&&(t>=0||isNaN(t))&&typeof e=="number"&&(e>=0||isNaN(e))?(this.sw=t,this.sh=e):f.o("Invalid arguments to Size constructor: "+t+", "+e),this.h=!1}a(t){return this.sw=t.sw,this.sh=t.sh,this}i(t,e){return this.sw=t,this.sh=e,this}setTo(t,e){return this.sw=t,this.sh=e,this}set(t){return this.sw=t.sw,this.sh=t.sh,this}copy(){let t=new Q;return t.sw=this.sw,t.sh=this.sh,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new Q(s,o)}else return new Q}static stringify(t){return t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return f.s(t,"number",Q,"stringifyFixed:digits"),e=>e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof Q?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,e){return this.sw===t&&this.sh===e}equalsApprox(t){return L.f(this.sw,t.width)&&L.f(this.sh,t.height)}inflate(t,e){let i=this.width+t;this.sw=i>=0?i:0;let s=this.height+e;return this.sh=s>=0?s:0,this}get width(){return this.sw}set width(t){t<0&&f.W(t,">= 0",Q,"width"),this.sw=t}get height(){return this.sh}set height(t){t<0&&f.W(t,">= 0",Q,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static sc=new Q(0,0).$();static Uk=new Q(1,1).$();static yC=new Q(6,6).$();static nu=new Q(8,8).$();static wC=new Q(10,10).$();static Bk=new Q(1/0,1/0).$();static yw=new Q(NaN,NaN).$();static xC=[];static l(){let t=Q.xC.pop();return t===void 0?new Q:t}static e(t){Q.xC.push(t)}}class z{rx;ry;rw;rh;h;constructor(t,e,i,s){if(t===void 0)this.rx=0,this.ry=0,this.rw=0,this.rh=0;else if(typeof t=="number"&&typeof e=="number"&&typeof i=="number"&&(i>=0||isNaN(i))&&typeof s=="number"&&(s>=0||isNaN(s)))this.rx=t,this.ry=e,this.rw=i,this.rh=s;else if(t instanceof P){let n=t.x,o=t.y;if(e instanceof P){let r=e.x,a=e.y;this.rx=Math.min(n,r),this.ry=Math.min(o,a),this.rw=Math.abs(n-r),this.rh=Math.abs(o-a)}else e instanceof Q?(this.rx=n,this.ry=o,this.rw=e.width,this.rh=e.height):f.o("Incorrect second argument supplied to Rect constructor "+e)}else f.o("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+s);this.h=!1}a(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}i(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}Fn(t,e){return this.rw=t,this.rh=e,this}setTo(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}set(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}setPoint(t){return this.rx=t.x,this.ry=t.y,this}setSize(t){return this.rw=t.width,this.rh=t.height,this}copy(){let t=new z;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n&&(r=parseFloat(n));let a=0;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),new z(s,o,r,a)}else return new z}static stringify(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return f.s(t,"number",z,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"}equals(t){return t instanceof z?this.rx===t.x&&this.ry===t.y&&this.rw===t.width&&this.rh===t.height:!1}equalTo(t,e,i,s){return this.rx===t&&this.ry===e&&this.rw===i&&this.rh===s}equalsApprox(t){return L.f(this.rx,t.x)&&L.f(this.ry,t.y)&&L.f(this.rw,t.width)&&L.f(this.rh,t.height)}equalsApproxTo(t,e,i,s){return L.f(this.rx,t)&&L.f(this.ry,e)&&L.f(this.rw,i)&&L.f(this.rh,s)}equalsApproxClose(t){return L.z(this.rx,t.x)&&L.z(this.ry,t.y)&&L.z(this.rw,t.width)&&L.z(this.rh,t.height)}containsPoint(t){return this.rx<=t.x&&this.rx+this.rw>=t.x&&this.ry<=t.y&&this.ry+this.rh>=t.y}containsRect(t){return this.rx<=t.x&&t.x+t.width<=this.rx+this.rw&&this.ry<=t.y&&t.y+t.height<=this.ry+this.rh}contains(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.rx<=t&&t+i<=this.rx+this.rw&&this.ry<=e&&e+s<=this.ry+this.rh}offset(t,e){return this.rx+=t,this.ry+=e,this}inflate(t,e){return this.ww(e,t,e,t)}addMargin(t){return this.ww(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.ww(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.ww(t,e,i,s)}ww(t,e,i,s){let n=this.rw;e+s<=-n?(this.rx+=n/2,this.rw=0):(this.rx-=s,this.rw+=e+s);let o=this.rh;return t+i<=-o?(this.ry+=o/2,this.rh=0):(this.ry-=t,this.rh+=t+i),this}intersectRect(t){return this.bC(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.bC(t,e,i,s)}bC(t,e,i,s){let n=Math.max(this.rx,t),o=Math.max(this.ry,e),r=Math.min(this.rx+this.rw,t+i),a=Math.min(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=Math.max(0,r-n),this.rh=Math.max(0,a-o),this}intersectsRect(t){return this.intersects(t.x,t.y,t.width,t.height)}intersects(t,e,i,s){let n=this.rw,o=this.rx;if(n!==1/0&&i!==1/0&&(n+=o,i+=t,isNaN(i)||isNaN(n)||o>i||t>n))return!1;let r=this.rh,a=this.ry;return!(r!==1/0&&s!==1/0&&(r+=a,s+=e,isNaN(s)||isNaN(r)||a>s||e>r))}intersectsRectPlus(t,e){let i=this.rw,s=t.width+e+e,n=this.rx,o=t.x-e;if(i+=n,s+=o,n>s||o>i)return!1;let r=this.rh,a=t.height+e+e,h=this.ry,l=t.y-e;return r+=h,a+=l,!(h>a||l>r)}unionPoint(t){return this.unionNoCheck(t.x,t.y,0,0)}unionRect(t){return this.unionNoCheck(t.rx,t.ry,t.rw,t.rh)}union(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.unionNoCheck(t,e,i,s)}unionNoCheck(t,e,i,s){let n=Math.min(this.rx,t),o=Math.min(this.ry,e),r=Math.max(this.rx+this.rw,t+i),a=Math.max(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=r-n,this.rh=a-o,this}setSpot(t,e,i){return this.rx=t-i.offsetX-i.x*this.rw,this.ry=e-i.offsetY-i.y*this.rh,this}static contains(t,e,i,s,n,o,r,a){return r===void 0&&(r=0),a===void 0&&(a=0),t<=n&&n+r<=t+i&&e<=o&&o+a<=e+s}static intersects(t,e,i,s,n,o,r,a){let h=i,l=r,c=t,u=n;if(h+=c,l+=u,c>l||u>h)return!1;let d=s,g=a,p=e,m=o;return d+=p,g+=m,!(p>g||m>d)}static intersectsLineSegment(t,e,i,s,n,o,r,a){return L.kC(t,e,i,s,n,o,r,a)}get x(){return this.rx}set x(t){this.rx=t}get y(){return this.ry}set y(t){this.ry=t}get width(){return this.rw}set width(t){t<0&&f.W(t,">= 0",z,"width"),this.rw=t}get height(){return this.rh}set height(t){t<0&&f.W(t,">= 0",z,"height"),this.rh=t}get left(){return this.rx}set left(t){this.rx=t}get top(){return this.ry}set top(t){this.ry=t}get right(){return this.rx+this.rw}set right(t){this.rx+=t-(this.rx+this.rw)}get bottom(){return this.ry+this.rh}set bottom(t){this.ry+=t-(this.ry+this.rh)}get position(){return new P(this.rx,this.ry)}set position(t){this.rx=t.x,this.ry=t.y}get size(){return new Q(this.rw,this.rh)}set size(t){this.rw=t.width,this.rh=t.height}get center(){return new P(this.rx+this.rw/2,this.ry+this.rh/2)}set center(t){this.rx=t.x-this.rw/2,this.ry=t.y-this.rh/2}get centerX(){return this.rx+this.rw/2}set centerX(t){this.rx=t-this.rw/2}get centerY(){return this.ry+this.rh/2}set centerY(t){this.ry=t-this.rh/2}isReal(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)}isEmpty(){return this.width===0&&this.height===0}static Fg=new z(0,0,0,0).$();static $D=new z(NaN,NaN,NaN,NaN).$();static Vk=[];static l(){let t=z.Vk.pop();return t===void 0?new z:t}static V(t,e,i,s){let n=z.Vk.pop();return n===void 0?new z(t,e,i,s):n.i(t,e,i,s)}static e(t){z.Vk.push(t)}}class Lt{mt;mr;mb;ml;h;constructor(t,e,i,s){t===void 0?(this.mt=0,this.mr=0,this.mb=0,this.ml=0):e===void 0?(e=t,i=t,s=t,this.mt=t,this.mr=e,this.mb=i,this.ml=s):i===void 0?(i=t,s=e,this.mt=t,this.mr=e,this.mb=i,this.ml=s):s!==void 0?(this.mt=t,this.mr=e,this.mb=i,this.ml=s):f.o("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+s),this.h=!1}a(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}setTo(t,e,i,s){return this.mt=t,this.mr=e,this.mb=i,this.ml=s,this}set(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}copy(){let t=new Lt;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=NaN;for(;e[i]==="";)i++;let n=e[i++];if(n&&(s=parseFloat(n)),isNaN(s))return new Lt;let o=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(o=parseFloat(n)),isNaN(o))return new Lt(s);let r=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(r=parseFloat(n)),isNaN(r))return new Lt(s,o);let a=NaN;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),isNaN(a)?new Lt(s,o):new Lt(s,o,r,a)}else return new Lt}static stringify(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return f.s(t,"number",Lt,"stringifyFixed:digits"),e=>e.top.toFixed(t)+" "+e.right.toFixed(t)+" "+e.bottom.toFixed(t)+" "+e.left.toFixed(t)}toString(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"}equals(t){return t instanceof Lt?this.mt===t.top&&this.mr===t.right&&this.mb===t.bottom&&this.ml===t.left:!1}equalTo(t,e,i,s){return this.mt===t&&this.mr===e&&this.mb===i&&this.ml===s}equalsApprox(t){return L.f(this.mt,t.top)&&L.f(this.mr,t.right)&&L.f(this.mb,t.bottom)&&L.f(this.ml,t.left)}get top(){return this.mt}set top(t){this.mt=t}get right(){return this.mr}set right(t){this.mr=t}get bottom(){return this.mb}set bottom(t){this.mb=t}get left(){return this.ml}set left(t){this.ml=t}isReal(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)}static Rg=new Lt(0,0,0,0).$();static PC=new Lt(2,2,2,2).$();static SC=[];static l(){let t=Lt.SC.pop();return t===void 0?new Lt:t}static e(t){Lt.SC.push(t)}}class D{sx;sy;ox;oy;h;constructor(t,e,i,s){t===void 0?(this.sx=0,this.sy=0,this.ox=0,this.oy=0):(e===void 0&&(e=0),i===void 0&&(i=0),s===void 0&&(s=0),this.sx=t,this.sy=e,this.ox=i,this.oy=s),this.h=!1}a(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}setTo(t,e,i,s){return this.sx=t,this.sy=e,this.ox=i,this.oy=s,this}set(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}copy(){let t=new D;return t.sx=this.sx,t.sy=this.sy,t.ox=this.ox,t.oy=this.oy,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}Ie(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this}wE(t,e){(isNaN(t)||t>1||t<0)&&f.W(t,"0 <= "+e+" <= 1",D,e)}xE(t,e){(isNaN(t)||t===1/0||t===-1/0)&&f.W(t,"real number, not NaN or Infinity",D,e)}static parse(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return D.None;if(t==="TopLeft")return D.TopLeft;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return D.TopCenter;if(t==="TopRight")return D.TopRight;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return D.LeftCenter;if(t==="Center")return D.Center;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return D.RightCenter;if(t==="BottomLeft")return D.BottomLeft;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return D.BottomCenter;if(t==="BottomRight")return D.BottomRight;if(t==="TopSide")return D.TopSide;if(t==="LeftSide")return D.LeftSide;if(t==="RightSide")return D.RightSide;if(t==="BottomSide")return D.BottomSide;if(t==="TopBottomSides")return D.TopBottomSides;if(t==="LeftRightSides")return D.LeftRightSides;if(t==="TopLeftSides")return D.TopLeftSides;if(t==="TopRightSides")return D.TopRightSides;if(t==="BottomLeftSides")return D.BottomLeftSides;if(t==="BottomRightSides")return D.BottomRightSides;if(t==="NotTopSide")return D.NotTopSide;if(t==="NotLeftSide")return D.NotLeftSide;if(t==="NotRightSide")return D.NotRightSide;if(t==="NotBottomSide")return D.NotBottomSide;if(t==="AllSides")return D.AllSides;if(t==="Default")return D.Default;let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n!==void 0&&n.length>0&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(r=parseFloat(n));let a=0;for(;e[i]==="";)i++;return n=e[i++],n!==void 0&&n.length>0&&(a=parseFloat(n)),new D(s,o,r,a)}else return new D}static stringify(t){return t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return f.s(t,"number",D,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.offsetX.toFixed(t)+" "+e.offsetY.toFixed(t)}toString(){return this.isSpot()?this.ox===0&&this.oy===0?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.equals(D.None)?"None":this.equals(D.TopLeft)?"TopLeft":this.equals(D.TopCenter)?"Top":this.equals(D.TopRight)?"TopRight":this.equals(D.LeftCenter)?"Left":this.equals(D.Center)?"Center":this.equals(D.RightCenter)?"Right":this.equals(D.BottomLeft)?"BottomLeft":this.equals(D.BottomCenter)?"Bottom":this.equals(D.BottomRight)?"BottomRight":this.equals(D.TopSide)?"TopSide":this.equals(D.LeftSide)?"LeftSide":this.equals(D.RightSide)?"RightSide":this.equals(D.BottomSide)?"BottomSide":this.equals(D.TopBottomSides)?"TopBottomSides":this.equals(D.LeftRightSides)?"LeftRightSides":this.equals(D.TopLeftSides)?"TopLeftSides":this.equals(D.TopRightSides)?"TopRightSides":this.equals(D.BottomLeftSides)?"BottomLeftSides":this.equals(D.BottomRightSides)?"BottomRightSides":this.equals(D.NotTopSide)?"NotTopSide":this.equals(D.NotLeftSide)?"NotLeftSide":this.equals(D.NotRightSide)?"NotRightSide":this.equals(D.NotBottomSide)?"NotBottomSide":this.equals(D.AllSides)?"AllSides":this.equals(D.Default)?"Default":"None"}equals(t){return t instanceof D?(this.sx===t.x||isNaN(this.sx)&&isNaN(t.x))&&(this.sy===t.y||isNaN(this.sy)&&isNaN(t.y))&&this.ox===t.offsetX&&this.oy===t.offsetY:!1}opposite(){return new D(.5-(this.sx-.5),.5-(this.sy-.5),-this.ox,-this.oy)}includesSide(t){if(!this.isSide())return!1;if(!t.isSide())if(t.equals(D.Left))t=D.LeftSide;else if(t.equals(D.Right))t=D.RightSide;else if(t.equals(D.Top))t=D.TopSide;else if(t.equals(D.Bottom))t=D.BottomSide;else return!1;let e=this.oy,i=t.offsetY;return(e&i)===i}get x(){return this.sx}set x(t){this.sx=t}get y(){return this.sy}set y(t){this.sy=t}get offsetX(){return this.ox}set offsetX(t){this.ox=t}get offsetY(){return this.oy}set offsetY(t){this.oy=t}isSpot(){return!isNaN(this.x)&&!isNaN(this.y)}isNoSpot(){return isNaN(this.x)||isNaN(this.y)}isSide(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===1&&this.offsetY!==0}isNone(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===0&&this.offsetY===0}isDefault(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===-1&&this.offsetY===0}static None=new D(0,0,0,0).Ie(0).$();static Default=new D(0,0,-1,0).Ie(-1).$();static TopLeft=new D(0,0,0,0).$();static TopCenter=new D(.5,0,0,0).$();static TopRight=new D(1,0,0,0).$();static LeftCenter=new D(0,.5,0,0).$();static Center=new D(.5,.5,0,0).$();static RightCenter=new D(1,.5,0,0).$();static BottomLeft=new D(0,1,0,0).$();static BottomCenter=new D(.5,1,0,0).$();static BottomRight=new D(1,1,0,0).$();static MiddleTop=D.TopCenter;static MiddleLeft=D.LeftCenter;static MiddleRight=D.RightCenter;static MiddleBottom=D.BottomCenter;static Top=D.TopCenter;static Left=D.LeftCenter;static Right=D.RightCenter;static Bottom=D.BottomCenter;static TopSide=new D(0,0,1,1).Ie(1).$();static LeftSide=new D(0,0,1,2).Ie(1).$();static RightSide=new D(0,0,1,4).Ie(1).$();static BottomSide=new D(0,0,1,8).Ie(1).$();static TopBottomSides=new D(0,0,1,9).Ie(1).$();static LeftRightSides=new D(0,0,1,6).Ie(1).$();static TopLeftSides=new D(0,0,1,3).Ie(1).$();static TopRightSides=new D(0,0,1,5).Ie(1).$();static BottomLeftSides=new D(0,0,1,10).Ie(1).$();static BottomRightSides=new D(0,0,1,12).Ie(1).$();static NotTopSide=new D(0,0,1,14).Ie(1).$();static NotLeftSide=new D(0,0,1,13).Ie(1).$();static NotRightSide=new D(0,0,1,11).Ie(1).$();static NotBottomSide=new D(0,0,1,7).Ie(1).$();static AllSides=new D(0,0,1,15).Ie(1).$();static zk=new D(.156,.156).$();static Xk=new D(.844,.844).$();static MC=[];static l(){let t=D.MC.pop();return t===void 0?new D:t}static e(t){D.MC.push(t)}}class Pt{m11;m12;m21;m22;dx;dy;constructor(){this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0}set(t){return this.m11=t.m11,this.m12=t.m12,this.m21=t.m21,this.m22=t.m22,this.dx=t.dx,this.dy=t.dy,this}setTo(t,e,i,s,n,o){return this.m11=t,this.m12=e,this.m21=i,this.m22=s,this.dx=n,this.dy=o,this}copy(){let t=new Pt;return t.m11=this.m11,t.m12=this.m12,t.m21=this.m21,t.m22=this.m22,t.dx=this.dx,t.dy=this.dy,t}toString(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"}equals(t){return this.m11===t.m11&&this.m12===t.m12&&this.m21===t.m21&&this.m22===t.m22&&this.dx===t.dx&&this.dy===t.dy}Yk(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1}Ri(){return this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0,this}nc(t){let e=this.m11*t.m11+this.m21*t.m12,i=this.m12*t.m11+this.m22*t.m12,s=this.m11*t.m21+this.m21*t.m22,n=this.m12*t.m21+this.m22*t.m22;return this.dx=this.m11*t.dx+this.m21*t.dy+this.dx,this.dy=this.m12*t.dx+this.m22*t.dy+this.dy,this.m11=e,this.m12=i,this.m21=s,this.m22=n,this}NC(t){let e=1/(t.m11*t.m22-t.m12*t.m21),i=t.m22*e,s=-t.m12*e,n=-t.m21*e,o=t.m11*e,r=e*(t.m21*t.dy-t.m22*t.dx),a=e*(t.m12*t.dx-t.m11*t.dy),h=this.m11*i+this.m21*s,l=this.m12*i+this.m22*s,c=this.m11*n+this.m21*o,u=this.m12*n+this.m22*o;return this.dx=this.m11*r+this.m21*a+this.dx,this.dy=this.m12*r+this.m22*a+this.dy,this.m11=h,this.m12=l,this.m21=c,this.m22=u,this}xw(){let t=1/(this.m11*this.m22-this.m12*this.m21),e=this.m22*t,i=-this.m12*t,s=-this.m21*t,n=this.m11*t,o=t*(this.m21*this.dy-this.m22*this.dx),r=t*(this.m12*this.dx-this.m11*this.dy);return this.m11=e,this.m12=i,this.m21=s,this.m22=n,this.dx=o,this.dy=r,this}cs(t,e,i){if(t>=360?t-=360:t<0&&(t+=360),t===0)return this;this.Fs(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let l=t*Math.PI/180;s=Math.cos(l),n=Math.sin(l)}let o=this.m11*s+this.m21*n,r=this.m12*s+this.m22*n,a=this.m11*-n+this.m21*s,h=this.m12*-n+this.m22*s;return this.m11=o,this.m12=r,this.m21=a,this.m22=h,this.Fs(-e,-i),this}Fs(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this}tt(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this}ZD(){if(this.m11===1&&this.m12===0)return 0;let t=Math.atan2(this.m12,this.m11)*180/Math.PI;return t<0&&(t+=360),t}gt(t){let e=t.x,i=t.y;return t.i(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)}$e(t){let e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=t.x-this.dx,a=t.y-this.dy;return t.i(r*i+a*n,r*s+a*o)}bw(t){let e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=e*(this.m21*this.dy-this.m22*this.dx),a=e*(this.m12*this.dx-this.m11*this.dy),h=t.x*1.25,l=t.y*1.2;return t.i(h*i+l*n+r,h*s+l*o+a)}vg(t){let e=t.x,i=t.y,s=e+t.width,n=i+t.height,o=this.m11,r=this.m12,a=this.m21,h=this.m22,l=this.dx,c=this.dy,u=e*o+i*a+l,d=e*r+i*h+c,g=s*o+i*a+l,p=s*r+i*h+c,m=e*o+n*a+l,y=e*r+n*h+c,w=s*o+n*a+l,b=s*r+n*h+c,v=u,k=u,S=d,M=d;return v=Math.min(v,g),k=Math.max(k,g),S=Math.min(S,p),M=Math.max(M,p),v=Math.min(v,m),k=Math.max(k,m),S=Math.min(S,y),M=Math.max(M,y),v=Math.min(v,w),k=Math.max(k,w),S=Math.min(S,b),M=Math.max(M,b),t.i(v,S,k-v,M-S),t}static CC=[];static l(){let t=Pt.CC.pop();return t===void 0?new Pt:t}static e(t){Pt.CC.push(t)}static Gk="54a702f3e53909c447824c6706603faf4c"}let L={QD:"7da71ca0ad381e90",Rn:4*((Math.sqrt(2)-1)/3),LC:null,kw:x=>{if(x<=0)return 0;let t=L.LC;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);L.LC=t}if(x<1){let e=1/x;return e<=2e3?1/t[e|0]:Math.sqrt(x)}else return x<=2e3?t[x|0]:Math.sqrt(x)},f:(x,t)=>{let e=x-t;return e<.5&&e>-.5},z:(x,t)=>{let e=x-t;return e<5e-8&&e>-5e-8},vi:(x,t,e,i,s,n,o)=>{s<=0&&(s=1e-6);let r=0,a=0,h=0,l=0;if(x<e?(a=x,r=e):(a=e,r=x),t<i?(l=t,h=i):(l=i,h=t),x===e)return l<=o&&o<=h&&x-s<=n&&n<=x+s;if(t===i)return a<=n&&n<=r&&t-s<=o&&o<=t+s;let c=r+s,u=a-s;if(u<=n&&n<=c){let d=h+s,g=l-s;if(g<=o&&o<=d)if(c-u>d-g)if(x-e>s||e-x>s){let p=(i-t)/(e-x)*(n-x)+t;if(p-s<=o&&o<=p+s)return!0}else return!0;else if(t-i>s||i-t>s){let p=(e-x)/(i-t)*(o-t)+x;if(p-s<=n&&n<=p+s)return!0}else return!0}return!1},Pw:(x,t,e,i,s,n,o,r,a,h,l,c)=>{if(!L.vi(x,t,o,r,c,e,i)||!L.vi(x,t,o,r,c,s,n)){let u=(x+e)/2,d=(t+i)/2,g=(e+s)/2,p=(i+n)/2,m=(s+o)/2,y=(n+r)/2,w=(u+g)/2,b=(d+p)/2,v=(g+m)/2,k=(p+y)/2,S=(w+v)/2,M=(b+k)/2;return L.Pw(x,t,u,d,w,b,S,M,a,h,l,c)||L.Pw(S,M,v,k,m,y,o,r,a,h,l,c)}else return L.vi(x,t,o,r,c,h,l)},AC:(x,t,e,i,s,n,o,r,a)=>{let h=(x+e)/2,l=(t+i)/2,c=(e+s)/2,u=(i+n)/2,d=(s+o)/2,g=(n+r)/2,p=(h+c)/2,m=(l+u)/2,y=(c+d)/2,w=(u+g)/2;return a.i((p+y)/2,(m+w)/2),a},_D:(x,t,e,i,s,n,o,r)=>{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,c=(i+n)/2,u=(s+o)/2,d=(n+r)/2,g=(a+l)/2,p=(h+c)/2,m=(l+u)/2,y=(c+d)/2;return P.direction(g,p,m,y)},ou:(x,t,e,i,s,n,o,r,a,h)=>{if(!L.vi(x,t,o,r,a,e,i)||!L.vi(x,t,o,r,a,s,n)){let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,g=(s+o)/2,p=(n+r)/2,m=(l+u)/2,y=(c+d)/2,w=(u+g)/2,b=(d+p)/2,v=(m+w)/2,k=(y+b)/2;L.ou(x,t,l,c,m,y,v,k,a,h),L.ou(v,k,w,b,g,p,o,r,a,h)}else h.unionNoCheck(x,t,0,0),h.unionNoCheck(o,r,0,0);return h},vn:(x,t,e,i,s,n,o,r,a,h)=>{if(!L.vi(x,t,o,r,a,e,i)||!L.vi(x,t,o,r,a,s,n)){let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,g=(s+o)/2,p=(n+r)/2,m=(l+u)/2,y=(c+d)/2,w=(u+g)/2,b=(d+p)/2,v=(m+w)/2,k=(y+b)/2;L.vn(x,t,l,c,m,y,v,k,a,h),L.vn(v,k,w,b,g,p,o,r,a,h)}else h.length===0&&(h.push(x),h.push(t)),h.push(o),h.push(r);return h},Kk:(x,t,e,i,s,n,o,r,a,h)=>{if(L.vi(x,t,s,n,h,e,i))return L.vi(x,t,s,n,h,r,a);{let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,g=(l+u)/2,p=(c+d)/2;return L.Kk(x,t,l,c,g,p,o,r,a,h)||L.Kk(g,p,u,d,s,n,o,r,a,h)}},bE:(x,t,e,i,s,n,o)=>{let r=(x+e)/2,a=(t+i)/2,h=(e+s)/2,l=(i+n)/2;return o.i((r+h)/2,(a+l)/2),o},jk:(x,t,e,i,s,n,o,r)=>{if(L.vi(x,t,s,n,o,e,i))r.unionNoCheck(x,t,0,0),r.unionNoCheck(s,n,0,0);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,c=(i+n)/2,u=(a+l)/2,d=(h+c)/2;L.jk(x,t,a,h,u,d,o,r),L.jk(u,d,l,c,s,n,o,r)}return r},Og:(x,t,e,i,s,n,o,r)=>{if(L.vi(x,t,s,n,o,e,i))r.length===0&&(r.push(x),r.push(t)),r.push(s),r.push(n);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,c=(i+n)/2,u=(a+l)/2,d=(h+c)/2;L.Og(x,t,a,h,u,d,o,r),L.Og(u,d,l,c,s,n,o,r)}return r},Ig:(x,t,e,i,s,n,o,r,a,h,l,c,u,d)=>{if(!L.vi(x,t,o,r,u,e,i)||!L.vi(x,t,o,r,u,s,n)){let g=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,w=(s+o)/2,b=(n+r)/2,v=(g+m)/2,k=(p+y)/2,S=(m+w)/2,M=(y+b)/2,F=(v+S)/2,T=(k+M)/2,N=1/0,C=!1,R=0,O=0;if(L.Ig(x,t,g,p,v,k,F,T,a,h,l,c,u,d)){let V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,C=!0,R=d.x,O=d.y)}if(L.Ig(F,T,S,M,w,b,o,r,a,h,l,c,u,d)){let V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,C=!0,R=d.x,O=d.y)}return C&&(d.x=R,d.y=O),C}else{if(!L.su(x,t,o,r,a,h,l,c))return!1;let g=(x-o)*(h-c)-(t-r)*(a-l);if(g===0)return!1;let p=((x*r-t*o)*(a-l)-(x-o)*(a*c-h*l))/g,m=((x*r-t*o)*(h-c)-(t-r)*(a*c-h*l))/g;return d.i(p,m),!0}},Eg:(x,t,e,i,s,n,o,r,a,h,l,c,u)=>{let d=0;if(!L.vi(x,t,o,r,u,e,i)||!L.vi(x,t,o,r,u,s,n)){let g=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,w=(s+o)/2,b=(n+r)/2,v=(g+m)/2,k=(p+y)/2,S=(m+w)/2,M=(y+b)/2,F=(v+S)/2,T=(k+M)/2;d+=L.Eg(x,t,g,p,v,k,F,T,a,h,l,c,u),d+=L.Eg(F,T,S,M,w,b,o,r,a,h,l,c,u)}else{let g=(x-o)*(h-c)-(t-r)*(a-l);if(g===0)return d;let p=((x*r-t*o)*(a-l)-(x-o)*(a*c-h*l))/g,m=((x*r-t*o)*(h-c)-(t-r)*(a*c-h*l))/g;if(p>=l)return d;let y=0,w=0;if((a>l?a-l:l-a)<(h>c?h-c:c-h)){if(t<r?(y=t,w=r):(y=r,w=t),m<y||m>w)return d}else if(x<o?(y=x,w=o):(y=o,w=x),p<y||p>w)return d;g>0?d++:g<0&&d--}return d},dl:(x,t,e,i,s,n,o)=>{if(L.z(x,e)){let r=0,a=0;t<i?(r=t,a=i):(r=i,a=t);let h=n;return h<r?(o.i(x,r),!1):h>a?(o.i(x,a),!1):(o.i(x,h),!0)}else if(L.z(t,i)){let r=0,a=0;x<e?(r=x,a=e):(r=e,a=x);let h=s;return h<r?(o.i(r,t),!1):h>a?(o.i(a,t),!1):(o.i(h,t),!0)}else{let r=(e-x)**2+(i-t)**2,a=((x-s)*(x-e)+(t-n)*(t-i))/r;if(a<-5e-6)return o.i(x,t),!1;if(a>1.000005)return o.i(e,i),!1;{let h=x+a*(e-x),l=t+a*(i-t);return o.i(h,l),!0}}},On:(x,t,e,i,s,n,o,r,a)=>{if(L.f(x,e)&&L.f(t,i))return a.i(x,t),!1;if(L.z(s,o)){if(L.z(x,e))return L.dl(x,t,e,i,s,n,a),!1;{let h=(i-t)/(e-x)*(s-x)+t;return L.dl(x,t,e,i,s,h,a)}}else{let h=(r-n)/(o-s);if(L.z(x,e)){let l=h*(x-s)+n,c=0,u=0;return t<i?(c=t,u=i):(c=i,u=t),l<c?(a.i(x,c),!1):l>u?(a.i(x,u),!1):(a.i(x,l),!0)}else{let l=(i-t)/(e-x);if(L.z(h,l))return L.dl(x,t,e,i,s,n,a),!1;{let c=(l*x-h*s+n-t)/(l-h);if(L.z(l,0)){let u=0,d=0;return x<e?(u=x,d=e):(u=e,d=x),c<u?(a.i(u,t),!1):c>d?(a.i(d,t),!1):(a.i(c,t),!0)}else{let u=l*(c-x)+t;return L.dl(x,t,e,i,c,u,a)}}}}},kE:(x,t,e,i,s)=>L.On(e.x,e.y,i.x,i.y,x.x,x.y,t.x,t.y,s),PE:(x,t,e,i,s,n,o,r,a,h)=>{let l=1/0;function c(S,M){let F=(S-x)**2+(M-t)**2;F<l&&(l=F,a.i(S,M))}c(a.x,a.y);let u=0,d=0,g=0,p=0;s<o?(u=s,d=o):(u=o,d=s),n<r?(g=s,p=o):(g=o,p=s);let m=d-u,y=p-g,w=m/2+h,b=y/2+h,v=(s+o)/2,k=(n+r)/2;if(w===0||b===0)return a;if(L.f(x,e)){let S=1-(e-v)**2/(w*w);if(S<0)return a;let M=Math.sqrt(S),F=b*M+k,T=-b*M+k;c(e,F),c(e,T)}else{let S=(i-t)/(e-x),M=1/(w*w)+S*S/(b*b),F=2*S*(t-S*x)/(b*b)-2*S*k/(b*b)-2*v/(w*w),T=2*S*x*k/(b*b)-2*t*k/(b*b)+k*k/(b*b)+v*v/(w*w)-1+(t-S*x)*(t-S*x)/(b*b),N=F*F-4*M*T;if(N<0)return a;let C=Math.sqrt(N),R=(-F+C)/(2*M);c(R,S*R-S*x+t);let O=(-F-C)/(2*M);c(O,S*O-S*x+t)}return a},gl:(x,t,e,i,s,n,o,r,a)=>{let h=1e21,l=x,c=t;if(L.On(x,t,x,i,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}if(L.On(e,t,e,i,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}if(L.On(x,t,e,t,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}if(L.On(x,i,e,i,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}return a.i(l,c),h<1e21},Sw:(x,t,e)=>L.kC(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),kC:(x,t,e,i,s,n,o,r)=>{let a=x,h=x+e,l=t,c=t+i;if(s===o){let u=0,d=0;return n<r?(u=n,d=r):(u=r,d=n),a<=s&&s<=h&&u<=c&&d>=l}if(n===r){let u=0,d=0;return s<o?(u=s,d=o):(u=o,d=s),l<=n&&n<=c&&u<=h&&d>=a}return!!(z.contains(x,t,e,i,s,n)||z.contains(x,t,e,i,o,r)||L.su(a,l,h,l,s,n,o,r)||L.su(h,l,h,c,s,n,o,r)||L.su(h,c,a,c,s,n,o,r)||L.su(a,c,a,l,s,n,o,r))},su:(x,t,e,i,s,n,o,r)=>x===e&&t===i&&s===o&&n===r?x===s&&t===n:L.eu(x,t,e,i,s,n)*L.eu(x,t,e,i,o,r)<=0&&L.eu(s,n,o,r,x,t)*L.eu(s,n,o,r,e,i)<=0,eu:(x,t,e,i,s,n)=>{let o=e-x,r=i-t,a=s-x,h=n-t,l=a*r-h*o;return l===0&&(l=a*o+h*r,l>0&&(a-=o,h-=r,l=a*o+h*r,l<0&&(l=0))),l},Ug:x=>(x<0&&(x+=360),x>=360&&(x-=360),x),TC:(x,t,e,i,s,n)=>{let o=Math.PI;n||(i=i*(o/180),s=s*(o/180));let r=i>s?-1:1,a=1e-5,h=o*2,l=[],c=o/2,u=i,d=Math.min(h,Math.abs(s-i));if(d<a){let g=u+r*Math.min(d,c),p=x+e*Math.cos(u),m=t+e*Math.sin(u),y=x+e*Math.cos(g),w=t+e*Math.sin(g),b=(p+y)/2,v=(m+w)/2;return l.push([p,m,b,v,b,v,y,w]),l}for(;d>a;){let g=u+r*Math.min(d,c);l.push(L.tF(e,u,g,x,t)),d-=Math.abs(g-u),u=g}return l},tF:(x,t,e,i,s)=>{let n=(e-t)/2,o=x*Math.cos(n),r=x*Math.sin(n),a=o,h=-r,l=a*a+h*h,c=l+a*o+h*r,u=4/3*(Math.sqrt(2*l*c)-c)/(a*r-h*o),d=a-u*h,g=h+u*a,p=d,m=-g,y=n+t,w=Math.cos(y),b=Math.sin(y);return[i+x*Math.cos(t),s+x*Math.sin(t),i+d*w-g*b,s+d*b+g*w,i+p*w-m*b,s+p*b+m*w,i+x*Math.cos(e),s+x*Math.sin(e)]},Dg:(x,t,e,i,s,n,o)=>{let r=s,a=n,h=Math.floor((x-e)/r)*r+e,l=Math.floor((t-i)/a)*a+i,c=h;h+r-x<r/2&&(c=h+r);let u=l;return l+a-t<a/2&&(u=l+a),o.i(c,u),o},DC:(x,t)=>{let e=Math.max(x,t),i=Math.min(x,t),s=1,n=1;do s=e%i,n=i,e=i,i=s;while(s>0);return n},iF:(x,t,e,i)=>{let s=e<0,n=i<0,o=0,r=0,a=0;x<t?(r=1,a=0):(r=0,a=1);let h=0,l=0,c=0,u=0;return o=r,h=o===0?x:t,c=o===0?e:i,(o===0?s:n)&&(c=-c),o=a,l=o===0?x:t,u=o===0?e:i,(o===0?s:n)&&(u=-u),L.eF(h,l,c,u,0,0)},eF:(x,t,e,i,s,n)=>{let o=0;if(i>0)if(e>0){let r=x*x,a=t*t,h=x*e,l=t*i,c=-a+l,u=-a+Math.sqrt(h*h+l*l),d=c,g=9999999999;for(let y=0;y<g&&(d=.5*(c+u),!(d===c||d===u));++y){let w=h/(d+r),b=l/(d+a),v=w*w+b*b-1;if(v>0)c=d;else if(v<0)u=d;else break}s=r*e/(d+r),n=a*i/(d+a);let p=s-e,m=n-i;o=Math.sqrt(p*p+m*m)}else s=0,n=t,o=Math.abs(i-t);else{let r=x*x-t*t,a=x*e;if(a<r){let h=a/r,l=h*h;s=x*h,n=t*Math.sqrt(Math.abs(1-l));let c=s-e;o=Math.sqrt(c*c+n*n)}else s=x,n=0,o=Math.abs(e-x)}return o},In:new K,Bg:new K,or:new K,rr:0,Vg:100};L.za=L.QD;var ei=(x=>(x[x.Line=1]="Line",x[x.Rectangle=2]="Rectangle",x[x.Ellipse=3]="Ellipse",x[x.Path=4]="Path",x))(ei||{}),ms=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x))(ms||{});class kt{n;zg;Xg;oc;ru;lu;En;Un;Bn;H;we;xe;Qi;_i;Rs;rc;lc;constructor(t){I.Ki(this),this.n=2,t===void 0&&(t=4),this.H=t,this.we=0,this.xe=0,this.Qi=0,this._i=0,t===4?this.Rs=new G:this.Rs=kt.Mw,this.zg=this.Rs.nt,this.Xg=new z().u(),this.oc=null,this.ru=null,this.lu=NaN,this.En=D.TopLeft,this.Un=D.BottomRight,this.rc=NaN,this.lc=NaN,this.Bn=2}copy(){let t=new kt;if(t.n=this.n&-2,t.H=this.H,t.we=this.we,t.xe=this.xe,t.Qi=this.Qi,t._i=this._i,this.H===4){let e=this.Rs.r,i=t.Rs;for(let s=0;s<e.length;s++){let n=e[s];i.add(n.copy())}t.Rs=i}else t.Rs=this.Rs;return t.zg=this.zg,t.Xg.a(this.Xg),t.oc=this.oc,t.ru=this.ru,t.lu=this.lu,t.En=this.En.P(),t.Un=this.Un.P(),t.rc=this.rc,t.lc=this.lc,t.Bn=this.Bn,t}static Line=1;static Rectangle=2;static Ellipse=3;static Path=4;static Mw=new G().u();get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){if(this.h=!0,this.type!==4)return this;let t=this.figures;t.u();for(let e of t)e.u();return this}equalsApprox(t){if(!(t instanceof kt))return!1;if(this.type!==t.type)return this.type===1&&t.type===4?this.FC(t):t.type===1&&this.type===4?t.FC(this):!1;if(this.type===4){let e=this.figures.r,i=t.figures.r,s=e.length;if(s!==i.length)return!1;for(let n=0;n<s;n++){let o=e[n],r=i[n];if(!o.equalsApprox(r))return!1}return!0}else return L.f(this.startX,t.startX)&&L.f(this.startY,t.startY)&&L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)}FC(t){if(this.type!==1||t.type!==4)return!1;if(t.figures.count===1){let e=t.figures.elt(0);if(e.segments.count===1&&L.f(this.startX,e.startX)&&L.f(this.startY,e.startY)){let i=e.segments.elt(0);if(i.type===2&&L.f(this.endX,i.endX)&&L.f(this.endY,i.endY))return!0}}return!1}static stringify(t){return t.toString()}static stringifyFixed(t){return f.s(t,"number",kt,"stringifyFixed:digits"),e=>e.toString(t)}oi(t){t in ei?this.type=t:f.er(this,t)}toString(t){t===void 0&&(t=-1);let e=s=>s===0?"0":s.toFixed(t),i;switch(this.type){case 1:return t<0?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+e(this.startX)+" "+e(this.startY)+"L"+e(this.endX)+" "+e(this.endY);case 2:return i=new z(this.startX,this.startY,0,0),i.union(this.endX,this.endY,0,0),t<0?"M"+i.x.toString()+" "+i.y.toString()+"H"+i.right.toString()+"V"+i.bottom.toString()+"H"+i.left.toString()+"z":"M"+e(i.x)+" "+e(i.y)+"H"+e(i.right)+"V"+e(i.bottom)+"H"+e(i.left)+"z";case 3:if(i=new z(this.startX,this.startY,0,0),i.union(this.endX,this.endY,0,0),t<0){let r=i.left.toString()+" "+(i.y+i.height/2).toString(),a=i.right.toString()+" "+(i.y+i.height/2).toString();return"M"+r+"A"+(i.width/2).toString()+" "+(i.height/2).toString()+" 0 0 1 "+a+"A"+(i.width/2).toString()+" "+(i.height/2).toString()+" 0 0 1 "+r}else{let r=e(i.left)+" "+e(i.y+i.height/2),a=e(i.right)+" "+e(i.y+i.height/2);return"M"+r+"A"+e(i.width/2)+" "+e(i.height/2)+" 0 0 1 "+a+"A"+e(i.width/2)+" "+e(i.height/2)+" 0 0 1 "+r}case 4:let s="",n=this.figures.r,o=n.length;for(let r=0;r<o;r++){let a=n[r];r>0&&(s+=" x "),a.isFilled&&(s+="F "),s+=a.toString(t)}return s;default:return ei[this.type]}}static fillPath(t){typeof t!="string"&&f.Zi(t,"string",kt,"fillPath:str");let e=t.split(/[Xx]/),i=e.length,s="";for(let n=0;n<i;n++){let o=e[n];if(o.match(/[Ff]/)!==null){n===0?s+=o:s+="X"+(o[0]===" "?"":" ")+o;continue}s+=(n===0?"":"X ")+"F"+(o[0]===" "?"":" ")+o}return s}static Yg="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";static parse(t,e){e===void 0&&(e=!1),typeof t!="string"&&f.Zi(t,"string",kt,"parse:str");let i=new RegExp("(["+kt.Yg+"])(["+kt.Yg+"])","gm"),s=new RegExp("(["+kt.Yg+"])([^s])","gm"),n=new RegExp("([^s])(["+kt.Yg+"])","gm");t=t.replace(/,/gm," "),t=t.replace(i,"$1 $2"),t=t.replace(i,"$1 $2"),t=t.replace(s,"$1 $2"),t=t.replace(n,"$1 $2"),t=t.replace(/([0-9])([+\-])/gm,"$1 $2"),t=t.replace(/[\s\r\t\n]+/gm," "),t=t.replace(/^\s+|\s+$/g,"");let o=t.split(" ");for(let R=0;R<o.length;R++){let O=o[R];if(O.match(/(\.[0-9]*)(\.)/gm)!==null){let V=f.et(),X="",Y=!1;for(let j=0;j<O.length;j++){let U=O[j];U==="."&&!Y?(Y=!0,X+=U):U==="."?(V.push(X),X="."):X+=U}V.push(X),o.splice(R,1);for(let j=0;j<V.length;j++)o.splice(R+j,0,V[j]);R+=V.length-1,f.J(V)}}let r=-1,a="",h="",l=new P(0,0),c=new P(0,0),u=new P(0,0),d=!0;function g(){return r>=v-1||o[r+1].match(N)!==null?!0:(d=!1,!1)}function p(){return r++,o[r]}function m(R){let O=parseFloat(p()),V=parseFloat(p());a===a.toLowerCase()&&(O=u.x+O,V=u.y+V),R.i(O,V)}function y(){return m(u),u}function w(){return m(c),c}function b(){let R=h.toLowerCase();return R==="c"||R==="s"||R==="q"||R==="t"?new P(2*u.x-c.x,2*u.y-c.y):new P(u.x,u.y)}let v=o.length,k=Ke.RC(null),S=!1,M=!1,F=!1,T=!0,N=new RegExp("["+kt.Yg+"]");for(;!(r>=v-1);){if(h=a,a=p(),a==="")continue;d=!0;let R=!1;switch(a.toUpperCase()){case"X":T=!0,S=!1,M=!1;break;case"M":let O=y();for(k.bi===null||T===!0?(k.hu(O.x,O.y,S,!1,!M,F),T=!1):k.sF(O.x,O.y),l.a(u);!g();){let V=y();k.lr(V.x,V.y)}break;case"L":for(;!g();){let V=y();k.lr(V.x,V.y)}d&&(R=!0);break;case"H":for(;!g();)u.i((a===a.toLowerCase()?u.x:0)+parseFloat(p()),u.y),k.lr(u.x,u.y);break;case"V":for(;!g();)u.i(u.x,(a===a.toLowerCase()?u.y:0)+parseFloat(p())),k.lr(u.x,u.y);d&&(R=!0);break;case"C":for(;!g();){let V=new P;m(V);let X=w(),Y=y();k.hr(V.x,V.y,X.x,X.y,Y.x,Y.y)}d&&(R=!0);break;case"S":for(;!g();){let V=b(),X=w(),Y=y();k.hr(V.x,V.y,X.x,X.y,Y.x,Y.y)}d&&(R=!0);break;case"Q":for(;!g();){let V=w(),X=y();k.Nw(V.x,V.y,X.x,X.y)}d&&(R=!0);break;case"T":for(;!g();){let V=b();c.a(V);let X=y();k.Nw(V.x,V.y,X.x,X.y),c.a(X)}d&&(R=!0);break;case"B":for(;!g();){let V=parseFloat(p()),X=parseFloat(p()),Y=parseFloat(p()),j=parseFloat(p()),U=parseFloat(p()),nt=U,at=!1;g()||(nt=parseFloat(p()),g()||(at=parseFloat(p())!==0)),a===a.toLowerCase()&&(Y+=u.x,j+=u.y),k.nF(V,X,Y,j,U,nt,at)}d&&(R=!0);break;case"A":for(;!g();){let V=Math.abs(parseFloat(p())),X=Math.abs(parseFloat(p())),Y=parseFloat(p()),j=!1,U=!1,nt=0,at=0,tt=p();tt.length===1?(j=!!parseFloat(tt),U=!!parseFloat(p()),nt=parseFloat(p()),at=parseFloat(p())):tt.length===2?(j=!!parseFloat(tt[0]),U=!!parseFloat(tt[1]),nt=parseFloat(p()),at=parseFloat(p())):(j=!!parseFloat(tt[0]),U=!!parseFloat(tt[1]),nt=parseFloat(tt.slice(2)),at=parseFloat(p())),a===a.toLowerCase()&&(nt=u.x+nt,at=u.y+at),u.i(nt,at),k.oF(V,X,Y,j,U,nt,at)}d&&(R=!0);break;case"Z":k.rF(),u.a(l);break;case"F":{let V="",X=1;for(;o[r+X];){if(o[r+X]==="0"){F=!0,X++;continue}if(o[r+X].match(/[Uu]/)!==null){X++;continue}if(o[r+X].match(N)===null){X++;continue}V=o[r+X];break}V.match(/[Mm]/)?S=!0:k.lF();break}case"U":{let V="",X=1;for(;o[r+X];){if(o[r+X].match(/[Ff]/)!==null){X++;continue}if(o[r+X].match(N)===null){X++;continue}V=o[r+X];break}V.match(/[Mm]/)?M=!0:k.hF(!1);break}default:if(a==="0"||a==="1")break;f.ni("Unknown geometry command: "+a);break}if(R){f.ni(`Bad geometry command: ${a}, next token: ${p()},
5
5
  string: ${t}`);break}}let C=k.Gg;if(Ke.vC(k),e){let R=C.figures.iterator;for(;R.next();){let O=R.value;O.isFilled=!0}}return C}static OC(t,e){let i=t.length,s=P.l();for(let n=0;n<i;n++){let o=t[n];s.x=o[0],s.y=o[1],e.gt(s),o[0]=s.x,o[1]=s.y,s.x=o[2],s.y=o[3],e.gt(s),o[2]=s.x,o[3]=s.y,s.x=o[4],s.y=o[5],e.gt(s),o[4]=s.x,o[5]=s.y,s.x=o[6],s.y=o[7],e.gt(s),o[6]=s.x,o[7]=s.y}P.e(s)}Hk(){if(this.wt)return!0;if(this.type===4){let t=this.figures;if(this.zg!==t.nt)return!0;let e=this.figures.r,i=e.length;for(let s=0;s<i;s++)if(e[s].Hk())return!0}return!1}Cw(){if(this.wt=!1,this.oc=null,this.ru=null,this.lu=NaN,this.type===4){let e=this.figures;this.zg=e.nt;let i=this.figures.r,s=i.length;for(let n=0;n<s;n++)i[n].aF()}let t=this.Xg;t.Nt(),isNaN(this.rc)||isNaN(this.lc)?t.i(0,0,0,0):t.i(0,0,this.rc,this.lc),this.IC(t,!1),t.unionNoCheck(0,0,0,0),t.u()}computeBoundsWithoutOrigin(){let t=new z;return this.IC(t,!0),t}IC(t,e){switch(this.type){case 1:case 2:case 3:e?t.i(this.we,this.xe,0,0):t.unionNoCheck(this.we,this.xe,0,0),t.unionNoCheck(this.Qi,this._i,0,0);break;case 4:let i=this.figures,s=i.r,n=i.length;for(let o=0;o<n;o++){let r=s[o];e&&o===0?t.i(r.startX,r.startY,0,0):t.unionNoCheck(r.startX,r.startY,0,0);let a=r.segments.r,h=a.length,l=r.startX,c=r.startY;for(let u=0;u<h;u++){let d=a[u];switch(d.type){case 2:case 1:l=d.endX,c=d.endY,t.unionNoCheck(l,c,0,0);break;case 3:L.ou(l,c,d.point1X,d.point1Y,d.point2X,d.point2Y,d.endX,d.endY,.5,t),l=d.endX,c=d.endY;break;case 4:L.jk(l,c,d.point1X,d.point1Y,d.endX,d.endY,.5,t),l=d.endX,c=d.endY;break;case 5:case 6:let g=d.type===5?d.bo(r):d.Bh(r,l,c),p=g.length;if(p===0){l=d.type===5?d.centerX:d.endX,c=d.type===5?d.centerY:d.endY,t.unionNoCheck(l,c,0,0);break}let m=null;for(let y=0;y<p;y++)m=g[y],L.ou(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],.5,t);m!==null&&(l=m[6],c=m[7]);break;default:f.o("Unknown Segment type: "+d.type)}}}break;default:f.o("Unknown Geometry type: "+this.type)}}cF(t,e){let i=this.bounds,s=t/i.width,n=e/i.height;return isFinite(s)||(s=1),isFinite(n)||(n=1),s===1&&n===1?this:this.copy().scale(s,n)}normalize(){this.h&&f.L(this);let t=this.computeBoundsWithoutOrigin();return this.offset(-t.x,-t.y),new P(-t.x,-t.y)}offset(t,e){return this.h&&f.L(this),this.T(1,0,0,1,t,e),this}scale(t,e){return this.h&&f.L(this),this.T(t,0,0,e,0,0),this}rotate(t,e,i){this.h&&f.L(this),e===void 0&&(e=0),i===void 0&&(i=0);let s=Pt.l();return s.Ri(),s.cs(t,e,i),this.T(s.m11,s.m12,s.m21,s.m22,s.dx,s.dy),Pt.e(s),this}T(t,e,i,s,n,o){let r=0,a=0;switch(this.type){case 1:case 2:case 3:r=this.we,a=this.xe,this.we=r*t+a*i+n,this.xe=r*e+a*s+o,r=this.Qi,a=this._i,this.Qi=r*t+a*i+n,this._i=r*e+a*s+o;break;case 4:let h=this.figures.r,l=h.length;for(let c=0;c<l;c++){let u=h[c];r=u.startX,a=u.startY,u.startX=r*t+a*i+n,u.startY=r*e+a*s+o;let d=u.segments.r,g=d.length;for(let p=0;p<g;p++){let m=d[p];switch(m.type){case 2:case 1:r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o;break;case 3:r=m.point1X,a=m.point1Y,m.point1X=r*t+a*i+n,m.point1Y=r*e+a*s+o,r=m.point2X,a=m.point2Y,m.point2X=r*t+a*i+n,m.point2Y=r*e+a*s+o,r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o;break;case 4:r=m.point1X,a=m.point1Y,m.point1X=r*t+a*i+n,m.point1Y=r*e+a*s+o,r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o;break;case 5:if(r=m.centerX,a=m.centerY,m.centerX=r*t+a*i+n,m.centerY=r*e+a*s+o,e!==0){let y=Math.atan2(e,t)*180/Math.PI;y<0&&(y+=360),m.startAngle+=y}t<0&&(m.startAngle=180-m.startAngle,m.sweepAngle=-m.sweepAngle),s<0&&(m.startAngle=-m.startAngle,m.sweepAngle=-m.sweepAngle),m.radiusX*=Math.sqrt(t*t+i*i),m.radiusY!==void 0&&(m.radiusY*=Math.sqrt(e*e+s*s));break;case 6:if(r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o,m.radiusX===0||m.radiusY===0)break;if(e!==0){let y=Math.atan2(e,t)*180/Math.PI;y<0&&(y+=360),m.xAxisRotation+=y}t<0&&(m.xAxisRotation=180-m.xAxisRotation,m.isClockwiseArc=!m.isClockwiseArc),s<0&&(m.xAxisRotation=-m.xAxisRotation,m.isClockwiseArc=!m.isClockwiseArc),m.radiusX*=Math.sqrt(t*t+i*i),m.radiusY*=Math.sqrt(e*e+s*s);break;default:f.o("Unknown Segment type: "+m.type)}}}break}return this.wt=!0,this}containsPoint(t,e){e===void 0&&(e=0);let i=this.we,s=this.xe,n=this.Qi,o=this._i;switch(this.type){case 1:return L.vi(i,s,n,o,e,t.x,t.y);case 2:{let r=Math.min(i,n)-e,a=Math.min(s,o)-e,h=Math.abs(n-i)+e*2,l=Math.abs(o-s)+e*2,c=z.V(r,a,h,l),u=c.containsPoint(t);return z.e(c),u}case 3:{let r=Math.min(i,n)-e,a=Math.min(s,o)-e,h=Math.abs(n-i)+e*2,l=Math.abs(o-s)+e*2,c=h/2,u=l/2;return c<=0||u<=0?!1:(r=t.x-(r+c),a=t.y-(a+u),r*r/(c*c)+a*a/(u*u)<=1)}case 4:return this.qk(t,e,!0,!1);default:return!1}}qk(t,e,i,s){let n=t.x,o=t.y,r=this.bounds.x-20,a=o,h=0,l=0,c=0,u=0,d=0,g=0,p=this.figures.r,m=p.length;for(let y=0;y<m;y++){let w=p[y],b=!w.isEvenOdd;if(w.isFilled){if(i&&w.Wk(n,o,e))return!0}else{if(w.Wk(n,o,s?e:e+2))return!0;continue}let v=w.segments;l=w.startX,c=w.startY;let k=l,S=c,M=v.r;for(let F=0;F<=v.length;F++){let T,N;switch(F!==v.length?(T=M[F],N=T.type,d=T.endX,g=T.endY):(N=2,d=k,g=S),N){case 1:{let C=this.Lw(n,o,r,a,l,c,k,S);if(isNaN(C))return!0;h+=C,k=d,S=g;break}case 2:{let C=this.Lw(n,o,r,a,l,c,d,g);if(isNaN(C))return!0;h+=C;break}case 3:u=L.Eg(l,c,T.point1X,T.point1Y,T.point2X,T.point2Y,d,g,r,a,n,o,.5),h+=u;break;case 4:{let C=(l+2*T.point1X)/3,R=(c+2*T.point1Y)/3,O=(T.point1X*2+d)/3,V=(T.point1Y*2+g)/3;u=L.Eg(l,c,C,R,O,V,d,g,r,a,n,o,.5),h+=u;break}case 5:case 6:{let C=T.type===5?T.bo(w):T.Bh(w,l,c),R=C.length;if(R===0){let V=this.Lw(n,o,r,a,l,c,T.type===5?T.centerX:T.endX,T.type===5?T.centerY:T.endY);if(isNaN(V))return!0;h+=V;break}let O=null;for(let V=0;V<R;V++){if(O=C[V],V===0){let X=this.Lw(n,o,r,a,l,c,O[0],O[1]);if(isNaN(X))return!0;h+=X}u=L.Eg(O[0],O[1],O[2],O[3],O[4],O[5],O[6],O[7],r,a,n,o,.5),h+=u}O!==null&&(d=O[6],g=O[7]);break}default:f.o("Unknown Segment type: "+T.type)}l=d,c=g}if(b){if(h!==0)return!0}else if(h%2!==0)return!0;h=0}return!1}Lw(t,e,i,s,n,o,r,a){if(L.vi(n,o,r,a,.05,t,e))return NaN;let h=(t-i)*(o-a);if(h===0)return 0;let l=((t*s-e*i)*(n-r)-(t-i)*(n*a-o*r))/h,c=(t*s-e*i)*(o-a)/h;if(l>=t)return 0;if((n>r?n-r:r-n)<(o>a?o-a:a-o)){if(o<a){if(c<o||c>a)return 0}else if(c<a||c>o)return 0}else if(n<r){if(l<n||l>r)return 0}else if(l<r||l>n)return 0;return h>0?1:-1}EC(t,e,i){let s=this.figures.r,n=s.length;for(let o=0;o<n;o++)if(s[o].Wk(t,e,i))return!0;return!1}getPointAlongPath(t,e){if(t<0?t=0:t>1&&(t=1),e===void 0&&(e=new P),this.type===1)return e.i(this.startX+t*(this.endX-this.startX),this.startY+t*(this.endY-this.startY)),e;let i=this.flattenedSegments,s=this.flattenedLengths,n=this.flattenedTotalLength,o=i.length,r=n*t,a=0;for(let h=0;h<o;h++){let l=s[h],c=l.length;for(let u=0;u<c;u++){let d=l[u];if(a+d>=r){let g=r-a,p=d===0?0:g/d,m=i[h],y=m[u*2],w=m[u*2+1],b=m[u*2+2],v=m[u*2+3];return e.i(y+(b-y)*p,w+(v-w)*p),e}a+=d}}return e}getAngleAlongPath(t){if(t<0?t=0:t>1&&(t=1),this.type===1)return Math.atan2(this.endY-this.startY,this.endX-this.startX)*180/Math.PI;let e=this.flattenedSegments,i=this.flattenedLengths,s=this.flattenedTotalLength,n=e.length,o=s*t,r=0;for(let a=0;a<n;a++){let h=i[a],l=h.length;for(let c=0;c<l;c++){let u=h[c];if(r+u>=o){let d=e[a],g=d[c*2],p=d[c*2+1],m=d[c*2+2],y=d[c*2+3];return Math.abs(m-g)<1&&Math.abs(y-p)<1?0:Math.abs(m-g)<1?y-p>=0?90:270:Math.abs(y-p)<1?m-g>=0?0:180:Math.atan2(y-p,m-g)*180/Math.PI}r+=u}}return NaN}getPointAndAngleAlongPath(t,e){if(t<0?t=0:t>1&&(t=1),e===void 0&&(e=[]),e.length=3,this.type===1)return e[0]=this.startX+t*(this.endX-this.startX),e[1]=this.startY+t*(this.endY-this.startY),e[2]=Math.atan2(this.endY-this.startY,this.endX-this.startX)*180/Math.PI,e;let i=this.flattenedSegments,s=this.flattenedLengths,n=this.flattenedTotalLength,o=i.length,r=n*t,a=0;for(let h=0;h<o;h++){let l=s[h],c=l.length;for(let u=0;u<c;u++){let d=l[u];if(a+d>=r){let g=r-a,p=d===0?0:g/d,m=i[h],y=m[u*2],w=m[u*2+1],b=m[u*2+2],v=m[u*2+3];e[0]=y+(b-y)*p,e[1]=w+(v-w)*p;let k;return Math.abs(b-y)<1&&Math.abs(v-w)<1?k=0:Math.abs(b-y)<1?k=v-w>=0?90:270:Math.abs(v-w)<1?k=b-y>=0?0:180:k=Math.atan2(v-w,b-y)*180/Math.PI,e[2]=k,e}a+=d}}return e}getFractionForPoint(t){if(this.type===1){let e=this.startX,i=this.startY,s=this.endX,n=this.endY;if(e===s&&i===n)return 0;{let o=t.x,r=t.y,a=0,h=0;if(e===s)return i<n?(a=i,h=n):(a=n,h=i),r<=a?a===i?0:1:r>=h?h===i?0:1:Math.abs(r-i)/(h-a);if(i===n)return e<s?(a=e,h=s):(a=s,h=e),o<=a?a===e?0:1:o>=h?h===e?0:1:Math.abs(o-e)/(h-a);{let l=(s-e)**2+(n-i)**2,c=P.l();L.dl(e,i,s,n,o,r,c);let u=c.x,d=c.y;return P.e(c),Math.sqrt(((u-e)**2+(d-i)**2)/l)}}}else if(this.type===2){let e=this.startX,i=this.startY,s=this.endX,n=this.endY;if(e===s&&i===n)return 0;{let o=s-e,r=n-i,a=o*2+r*2,h=t.x,l=t.y;h=Math.min(Math.max(h,e),s),l=Math.min(Math.max(l,i),n);let c=Math.abs(h-e),u=Math.abs(h-s),d=Math.abs(l-i),g=Math.abs(l-n),p=Math.min(c,u,d,g);if(p===d)return h/a;if(p===u)return(o+l)/a;if(p===g)return(o*2+r-h)/a;if(p===c)return(o*2+r*2-l)/a}}else{let e=this.flattenedSegments,i=this.flattenedLengths,s=this.flattenedTotalLength,n=P.l(),o=1/0,r=0,a=0,h=e.length,l=0,c=0;for(let d=0;d<h;d++){let g=e[d],p=i[d],m=g.length;for(let y=0;y<m;y+=2){let w=g[y],b=g[y+1];if(y===0){l=w,c=b;continue}L.dl(l,c,w,b,t.x,t.y,n);let v=(n.x-t.x)**2+(n.y-t.y)**2;v<o&&(o=v,r=a,r+=Math.sqrt((n.x-l)**2+(n.y-c)**2)),a+=p[(y-2)/2],l=w,c=b}}P.e(n);let u=r/s;return u<0?0:u>1?1:u}return 0}get flattenedSegments(){return this.UC(),this.oc}UC(){if(this.oc===null){let t=this.oc=[],e=this.ru=[];this.fF(t,e)}}get flattenedLengths(){return this.UC(),this.ru}get flattenedTotalLength(){let t=this.lu;if(isNaN(t)){if(this.type===1){let e=Math.abs(this.endX-this.startX),i=Math.abs(this.endY-this.startY);t=Math.sqrt(e*e+i*i)}else if(this.type===2){let e=Math.abs(this.endX-this.startX),i=Math.abs(this.endY-this.startY);t=e*2+i*2}else{let e=this.flattenedLengths,i=e.length;t=0;for(let s=0;s<i;s++){let n=e[s],o=n.length;for(let r=0;r<o;r++)t+=n[r]}}this.lu=t}return t}Jk(t){let e=[],i=0,s=0,n=t.length;for(let o=0;o<n;o+=2){let r=t[o],a=t[o+1];if(o===0){i=r,s=a;continue}let h=Math.sqrt(P.distanceSquared(i,s,r,a));e.push(h),i=r,s=a}return e}fF(t,e){let i=[],s=[];if(this.type===1)i.push(this.startX),i.push(this.startY),i.push(this.endX),i.push(this.endY),t.push(i),s.push(Math.sqrt((this.startX-this.endX)**2+(this.startY-this.endY)**2)),e.push(s);else if(this.type===2)i.push(this.startX),i.push(this.startY),i.push(this.endX),i.push(this.startY),i.push(this.endX),i.push(this.endY),i.push(this.startX),i.push(this.endY),i.push(this.startX),i.push(this.startY),t.push(i),s.push(Math.abs(this.startX-this.endX)),s.push(Math.abs(this.startY-this.endY)),s.push(Math.abs(this.startX-this.endX)),s.push(Math.abs(this.startY-this.endY)),e.push(s);else if(this.type===3){let n=new $t;n.startX=this.endX,n.startY=(this.startY+this.endY)/2;let o=new vt(5);o.startAngle=0,o.sweepAngle=360,o.centerX=(this.startX+this.endX)/2,o.centerY=(this.startY+this.endY)/2,o.radiusX=Math.abs(this.startX-this.endX)/2,o.radiusY=Math.abs(this.startY-this.endY)/2,n.add(o);let r=o.bo(n),a=r.length;if(a===0)i.push(o.centerX),i.push(o.centerY);else{let h=n.startX,l=n.startY;for(let c=0;c<a;c++){let u=r[c];L.vn(h,l,u[2],u[3],u[4],u[5],u[6],u[7],.5,i),h=u[6],l=u[7]}}t.push(i),e.push(this.Jk(i))}else{let n=this.figures.iterator;for(;n.next();){let o=n.value;i=[],i.push(o.startX),i.push(o.startY);let r=o.startX,a=o.startY,h=r,l=a,c=o.segments.r,u=c.length;for(let d=0;d<u;d++){let g=c[d];switch(g.type){case 1:i.length>=4&&(t.push(i),e.push(this.Jk(i))),i=[],i.push(g.endX),i.push(g.endY),r=g.endX,a=g.endY,h=r,l=a;break;case 2:i.push(g.endX),i.push(g.endY),r=g.endX,a=g.endY;break;case 3:L.vn(r,a,g.point1X,g.point1Y,g.point2X,g.point2Y,g.endX,g.endY,.5,i),r=g.endX,a=g.endY;break;case 4:L.Og(r,a,g.point1X,g.point1Y,g.endX,g.endY,.5,i),r=g.endX,a=g.endY;break;case 5:{let p=g.bo(o),m=p.length;if(m===0){i.push(g.centerX),i.push(g.centerY),r=g.centerX,a=g.centerY;break}for(let y=0;y<m;y++){let w=p[y];L.vn(r,a,w[2],w[3],w[4],w[5],w[6],w[7],.5,i),r=w[6],a=w[7]}break}case 6:{let p=g.Bh(o,r,a),m=p.length,y=g.endX,w=g.endY;if(m===0){i.push(y),i.push(w),r=y,a=w;break}for(let b=0;b<m;b++){let v=p[b];L.vn(r,a,v[2],v[3],v[4],v[5],v[6],v[7],.5,i),r=v[6],a=v[7]}break}default:f.o("Segment not of valid type: "+g.type)}g.isClosed&&(i.push(h),i.push(l))}i.length>=4&&(t.push(i),e.push(this.Jk(i)))}}}get type(){return this.H}set type(t){this.H!==t&&(this.h&&f.L(this,t),this.H=t,t===4?this.Rs=new G:(kt.Mw===null&&(kt.Mw=new G().u()),this.Rs=kt.Mw),this.wt=!0)}get startX(){return this.we}set startX(t){this.we!==t&&(this.h&&f.L(this,t),this.we=t,this.wt=!0)}get startY(){return this.xe}set startY(t){this.xe!==t&&(this.h&&f.L(this,t),this.xe=t,this.wt=!0)}get endX(){return this.Qi}set endX(t){this.Qi!==t&&(this.h&&f.L(this,t),this.Qi=t,this.wt=!0)}get endY(){return this._i}set endY(t){this._i!==t&&(this.h&&f.L(this,t),this._i=t,this.wt=!0)}get figures(){return this.Rs}set figures(t){this.Rs!==t&&(this.h&&f.L(this,t),this.Rs=t,this.wt=!0)}add(t){return this.Rs.add(t),this}setSpots(t,e,i,s,n,o,r,a){return this.h&&f.L(this),this.En=new D(t,e,n,o).u(),this.Un=new D(i,s,r,a).u(),this}get spot1(){return this.En}set spot1(t){this.h&&f.L(this,t),this.En=t.P()}get spot2(){return this.Un}set spot2(t){this.h&&f.L(this,t),this.Un=t.P()}get defaultStretch(){return this.Bn}set defaultStretch(t){this.Bn=t}get bounds(){return this.Hk()&&this.Cw(),this.Xg}}kt.stringify=kt.stringify,kt.stringifyFixed=kt.stringifyFixed,kt.fillPath=kt.fillPath,kt.parse=kt.parse;class $t{n;we;xe;hc;Kg;Ee;constructor(t,e,i,s,n){i===void 0&&(i=!0),s===void 0&&(s=!0),n===void 0&&(n=!1),this.n=2|(i?4:0)|(s?8:0)|(n?16:0),t!==void 0?this.we=t:this.we=0,e!==void 0?this.xe=e:this.xe=0,this.hc=new G,this.Kg=this.hc.nt,this.Ee=null}copy(){let t=new $t;t.n=this.n&-2,t.we=this.we,t.xe=this.xe;let e=this.hc.r,i=e.length,s=t.hc;for(let n=0;n<i;n++){let o=e[n].copy();s.add(o)}return t.Kg=this.Kg,t.Ee=this.Ee,t}equalsApprox(t){if(!(t instanceof $t)||!L.f(this.startX,t.startX)||!L.f(this.startY,t.startY))return!1;let e=this.segments.r,i=t.segments.r,s=e.length;if(s!==i.length)return!1;for(let n=0;n<s;n++){let o=e[n],r=i[n];if(!o.equalsApprox(r))return!1}return!0}toString(t){t===void 0&&(t=-1);let e="";if(t<0)e="M"+this.startX.toString()+" "+this.startY.toString();else{let n=o=>o===0?"0":o.toFixed(t);e="M"+n(this.startX)+" "+n(this.startY)}let i=this.segments.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];e+=" "+o.toString(t)}return e}get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){this.h=!0;let t=this.segments;t.u();let e=t.r,i=t.length;for(let s=0;s<i;s++)e[s].u();return this}Hk(){if(this.wt)return!0;let t=this.segments;if(this.Kg!==t.nt)return!0;for(let e of t)if(e.wt)return!0;return!1}aF(){this.wt=!1,this.Ee=null;let t=this.segments;this.Kg=t.nt;for(let e of t)e.wt=!1,e.vs=null}get isFilled(){return(this.n&4)!==0}set isFilled(t){this.h&&f.L(this,t),t?this.n|=4:this.n&=-5}get isShadowed(){return(this.n&8)!==0}set isShadowed(t){this.h&&f.L(this,t),t?this.n|=8:this.n&=-9}get isEvenOdd(){return(this.n&16)!==0}set isEvenOdd(t){this.h&&f.L(this,t),t?this.n|=16:this.n&=-17}get startX(){return this.we}set startX(t){this.h&&f.L(this,t),this.we=t,this.Ee=null,this.wt=!0}get startY(){return this.xe}set startY(t){this.h&&f.L(this,t),this.xe=t,this.Ee=null,this.wt=!0}get segments(){return this.hc}set segments(t){this.h&&f.L(this,t),this.hc=t,this.Ee=null,this.wt=!0}add(t){return this.hc.add(t),this.Ee=null,this}Wk(t,e,i){let s=this,n=s.startX,o=s.startY,r=n,a=o,h=s.segments.r,l=h.length;for(let c=0;c<l;c++){let u=h[c];switch(u.type){case 1:r=u.endX,a=u.endY,n=u.endX,o=u.endY;break;case 2:if(L.vi(n,o,u.endX,u.endY,i,t,e))return!0;n=u.endX,o=u.endY;break;case 3:if(L.Pw(n,o,u.point1X,u.point1Y,u.point2X,u.point2Y,u.endX,u.endY,.5,t,e,i))return!0;n=u.endX,o=u.endY;break;case 4:if(L.Kk(n,o,u.point1X,u.point1Y,u.endX,u.endY,.5,t,e,i))return!0;n=u.endX,o=u.endY;break;case 5:case 6:let d=u.type===5?u.bo(s):u.Bh(s,n,o),g=d.length,p=u.type===5?u.centerX:u.endX,m=u.type===5?u.centerY:u.endY;if(g===0){if(L.vi(n,o,p,m,i,t,e))return!0;n=p,o=m;break}let y=null;for(let w=0;w<g;w++)if(y=d[w],w===0&&L.vi(n,o,y[0],y[1],i,t,e)||L.Pw(y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],.5,t,e,i))return!0;y!==null&&(n=y[6],o=y[7]);break;default:f.o("Unknown Segment type: "+u.type)}if(u.isClosed&&(n!==r||o!==a)&&L.vi(n,o,r,a,i,t,e))return!0}return!1}}var Ci=(x=>(x[x.Move=1]="Move",x[x.Line=2]="Line",x[x.Bezier=3]="Bezier",x[x.QuadraticBezier=4]="QuadraticBezier",x[x.Arc=5]="Arc",x[x.SvgArc=6]="SvgArc",x))(Ci||{});class vt{H;n;Qi;_i;tn;pl;yl;ar;vs;constructor(t,e,i,s,n,o,r,a){if(I.Ki(this),t===void 0&&(t=2),this.H=t,this.n=2,e!==void 0?this.Qi=e:this.Qi=0,i!==void 0?this._i=i:this._i=0,s===void 0&&(s=0),n===void 0&&(n=0),o===void 0&&(o=0),r===void 0&&(r=0),t===6){let h=o;h=h%360,h<0&&(h+=360),this.tn=h,this.pl=0,this.yl=Math.max(s,0),this.ar=Math.max(n,0),typeof r=="boolean"?r&&(this.isLargeArc=!0):typeof r=="number"&&r&&(this.isLargeArc=!0),a&&(this.isClockwiseArc=!0)}else this.tn=s,this.pl=n,t===5&&(o=Math.max(o,0)),this.yl=o,typeof r=="number"?(t===5&&(r=Math.max(r,0)),this.ar=r):this.ar=0;this.vs=null}copy(){let t=new vt;return t.H=this.H,t.n=this.n&-2,t.Qi=this.Qi,t._i=this._i,t.tn=this.tn,t.pl=this.pl,t.yl=this.yl,t.ar=this.ar,t}equalsApprox(t){if(!(t instanceof vt)||this.type!==t.type||this.isClosed!==t.isClosed)return!1;switch(this.type){case 1:case 2:return L.f(this.endX,t.endX)&&L.f(this.endY,t.endY);case 3:return L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)&&L.f(this.point1X,t.point1X)&&L.f(this.point1Y,t.point1Y)&&L.f(this.point2X,t.point2X)&&L.f(this.point2Y,t.point2Y);case 4:return L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)&&L.f(this.point1X,t.point1X)&&L.f(this.point1Y,t.point1Y);case 5:return L.f(this.startAngle,t.startAngle)&&L.f(this.sweepAngle,t.sweepAngle)&&L.f(this.centerX,t.centerX)&&L.f(this.centerY,t.centerY)&&L.f(this.radiusX,t.radiusX)&&L.f(this.radiusY,t.radiusY);case 6:return this.isClockwiseArc===t.isClockwiseArc&&this.isLargeArc===t.isLargeArc&&L.f(this.xAxisRotation,t.xAxisRotation)&&L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)&&L.f(this.radiusX,t.radiusX)&&L.f(this.radiusY,t.radiusY);default:return!1}}oi(t){t in Ci?this.type=t:f.er(this,t)}toString(t){t===void 0&&(t=-1);let e=s=>s===0?"0":s.toFixed(t),i="";switch(this.type){case 1:t<0?i="M"+this.endX.toString()+" "+this.endY.toString():i="M"+e(this.endX)+" "+e(this.endY);break;case 2:t<0?i="L"+this.endX.toString()+" "+this.endY.toString():i="L"+e(this.endX)+" "+e(this.endY);break;case 3:t<0?i="C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():i="C"+e(this.point1X)+" "+e(this.point1Y)+" "+e(this.point2X)+" "+e(this.point2Y)+" "+e(this.endX)+" "+e(this.endY);break;case 4:t<0?i="Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():i="Q"+e(this.point1X)+" "+e(this.point1Y)+" "+e(this.endX)+" "+e(this.endY);break;case 5:t<0?i="B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+" "+this.radiusX.toString()+" "+this.radiusY.toString():i="B"+e(this.startAngle)+" "+e(this.sweepAngle)+" "+e(this.centerX)+" "+e(this.centerY)+" "+e(this.radiusX)+" "+e(this.radiusY);break;case 6:t<0?i="A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():i="A"+e(this.radiusX)+" "+e(this.radiusY)+" "+e(this.xAxisRotation)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+e(this.endX)+" "+e(this.endY);break;default:i=Ci[this.type]}return i+(this.isClosed?"z":"")}static Move=1;static Line=2;static Bezier=3;static QuadraticBezier=4;static Arc=5;static SvgArc=6;get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){return this.h=!0,this}close(){return this.isClosed=!0,this}bo(t){if(this.vs!==null&&t.wt===!1)return this.vs;let e=this.radiusX,i=this.radiusY;if(i===void 0&&(i=e),e===0||i===0)return this.vs=[],this.vs;let s=this.tn,n=this.pl,o=L.TC(0,0,e<i?e:i,this.startAngle,this.startAngle+this.sweepAngle,!1);if(e!==i){let a=Pt.l();a.Ri(),e<i?a.tt(1,i/e):a.tt(e/i,1),kt.OC(o,a),Pt.e(a)}let r=o.length;for(let a=0;a<r;a++){let h=o[a];h[0]+=s,h[1]+=n,h[2]+=s,h[3]+=n,h[4]+=s,h[5]+=n,h[6]+=s,h[7]+=n}return this.vs=o,this.vs}Bh(t,e,i){if(this.vs!==null&&t.wt===!1)return this.vs;if(this.radiusX===0||this.radiusY===0)return this.vs=[],this.vs;let s=e,n=i,o=this.yl,r=this.ar;o===0&&(o=1e-4),r===0&&(r=1e-4);let a=this.tn*(Math.PI/180),h=this.isLargeArc,l=this.isClockwiseArc,c=this.Qi,u=this._i,d=Math.cos(a),g=Math.sin(a),p=d*(s-c)/2+g*(n-u)/2,m=-g*(s-c)/2+d*(n-u)/2,y=p*p/(o*o)+m*m/(r*r);y>1&&(o*=Math.sqrt(y),r*=Math.sqrt(y));let w=(h===l?-1:1)*Math.sqrt((o*o*r*r-o*o*m*m-r*r*p*p)/(o*o*m*m+r*r*p*p));isNaN(w)&&(w=0);let b=w*o*m/r,v=w*-r*p/o;isNaN(b)&&(b=0),isNaN(v)&&(v=0);let k=(s+c)/2+d*b-g*v,S=(n+u)/2+g*b+d*v,M=(st,et)=>Math.sqrt(st*st+et*et),F=(st,et,ut,gt)=>(st*ut+et*gt)/(M(st,et)*M(ut,gt)),T=(st,et,ut,gt)=>(st*gt<et*ut?-1:1)*Math.acos(F(st,et,ut,gt)),N=T(1,0,(p-b)/o,(m-v)/r),C=(p-b)/o,R=(m-v)/r,O=(-p-b)/o,V=(-m-v)/r,X=T(C,R,O,V),Y=F(C,R,O,V);Y<=-1?X=Math.PI:Y>=1&&(X=0),!l&&X>0&&(X=X-2*Math.PI),l&&X<0&&(X=X+2*Math.PI);let j=o>r?o:r,U=o>r?1:o/r,nt=o>r?r/o:1,at=L.TC(0,0,j,N,N+X,!0),tt=Pt.l();return tt.Ri(),tt.Fs(k,S),tt.cs(this.tn,0,0),tt.tt(U,nt),kt.OC(at,tt),Pt.e(tt),this.vs=at,this.vs}get isClosed(){return(this.n&8)!==0}set isClosed(t){this.isClosed!==t&&(t?this.n|=8:this.n&=-9,this.wt=!0)}get type(){return this.H}set type(t){this.h&&f.L(this,t),this.H=t,this.wt=!0}get endX(){return this.Qi}set endX(t){this.h&&f.L(this,t),this.Qi=t,this.wt=!0}get endY(){return this._i}set endY(t){this.h&&f.L(this,t),this._i=t,this.wt=!0}get point1X(){return this.tn}set point1X(t){this.h&&f.L(this,t),this.tn=t,this.wt=!0}get point1Y(){return this.pl}set point1Y(t){this.h&&f.L(this,t),this.pl=t,this.wt=!0}get point2X(){return this.yl}set point2X(t){this.h&&f.L(this,t),this.yl=t,this.wt=!0}get point2Y(){return this.ar}set point2Y(t){this.h&&f.L(this,t),this.ar=t,this.wt=!0}get centerX(){return this.tn}set centerX(t){this.h&&f.L(this,t),this.tn=t,this.wt=!0}get centerY(){return this.pl}set centerY(t){this.h&&f.L(this,t),this.pl=t,this.wt=!0}get radiusX(){return this.yl}set radiusX(t){t<0&&f.W(t,">= zero",vt,"radiusX"),this.h&&f.L(this,t),this.yl=t,this.wt=!0}get radiusY(){return this.ar}set radiusY(t){t<0&&f.W(t,">= zero",vt,"radiusY"),this.h&&f.L(this,t),this.ar=t,this.wt=!0}get startAngle(){return this.Qi}set startAngle(t){this.h&&f.L(this,t),t=t%360,t<0&&(t+=360),this.Qi=t,this.wt=!0}get sweepAngle(){return this._i}set sweepAngle(t){this.h&&f.L(this,t),t>360&&(t=360),t<-360&&(t=-360),this._i=t,this.wt=!0}get isClockwiseArc(){return(this.n&4)!==0}set isClockwiseArc(t){this.h&&f.L(this,t),t?this.n|=4:this.n&=-5,this.wt=!0}get isLargeArc(){return(this.n&16)!==0}set isLargeArc(t){this.h&&f.L(this,t),t?this.n|=16:this.n&=-17,this.wt=!0}get xAxisRotation(){return this.tn}set xAxisRotation(t){this.h&&f.L(this,t),t=t%360,t<0&&(t+=360),this.tn=t,this.wt=!0}}class Ye{N;Aw;Tw;jg;Hg;qg;Wg;Jg;$g;Zg;Qg;_g;tm;im;ko;em;sm;nm;be;constructor(){this.N=null,this.Aw=new P(0,0).u(),this.Tw=new P(0,0).u(),this.jg=0,this.Hg=0,this.qg=1,this.Wg="",this.Jg="",this.$g=!1,this.Zg=!1,this.Qg=0,this._g=0,this.tm=!1,this.im=!1,this.ko=!1,this.em=null,this.sm=0,this.nm=null,this.be=null}copy(){let t=new Ye;return this.clone(t)}clone(t){return t.N=this.N,t.Aw.a(this.viewPoint),t.Tw.a(this.documentPoint),t.jg=this.jg,t.Hg=this.Hg,t.qg=this.qg,t.Wg=this.Wg,t.Jg=this.Jg,t.$g=this.$g,t.Zg=this.Zg,t.Qg=this.Qg,t._g=this._g,t.tm=this.tm,t.im=this.im,t.ko=this.ko,t.em=this.em,t.sm=this.sm,t.nm=this.nm,t.be=this.be,t}toString(){let t="^";return this.modifiers!==0&&(t+="M:"+this.modifiers),this.button!==0&&(t+="B:"+this.button),this.key!==""&&(t+="K:"+this.key),this.clickCount!==0&&(t+="C:"+this.clickCount),this.delta!==0&&(t+="D:"+this.delta),this.handled&&(t+="h"),this.bubbles&&(t+="b"),this.documentPoint!==null&&(t+="@"+this.documentPoint.toString()),t}get diagram(){return this.N}set diagram(t){this.N=t}get viewPoint(){return this.Aw}set viewPoint(t){this.Aw.a(t)}get documentPoint(){return this.Tw}set documentPoint(t){this.Tw.a(t)}getMultiTouchViewPoint(t,e){let i=this.diagram;return i===null||i.BC(this.event,t,e),e}getMultiTouchDocumentPoint(t,e){let i=this.diagram;return i===null||(i.BC(this.event,t,e),e.a(i.transformViewToDoc(e))),e}get modifiers(){return this.jg}set modifiers(t){this.jg=t}get button(){return this.Hg}set button(t){if(this.Hg=t,this.event===null)switch(t){case 0:this.buttons=1;return;case 1:this.buttons=4;return;case 2:this.buttons=2;return}}get buttons(){return this.qg}set buttons(t){this.qg=t}get key(){return this.Wg}set key(t){this.Wg=t}get code(){return this.Jg}set code(t){this.Jg=t}get down(){return this.$g}set down(t){this.$g=t}get up(){return this.Zg}set up(t){this.Zg=t}get clickCount(){return this.Qg}set clickCount(t){this.Qg=t}get delta(){return this._g}set delta(t){this._g=t}get isMultiTouch(){return this.tm}set isMultiTouch(t){this.tm=t}get handled(){return this.im}set handled(t){this.im=t}get bubbles(){return this.ko}set bubbles(t){this.ko=t}get event(){return this.em}set event(t){this.em=t}get isTouchEvent(){let t=this.event;return t===null?!1:t.pointerType==="touch"||t.pointerType==="pen"}get timestamp(){return this.sm}set timestamp(t){this.sm=t}get targetDiagram(){return this.nm}set targetDiagram(t){this.nm=t}get targetObject(){return this.be}set targetObject(t){this.be=t}get control(){return(this.modifiers&1)!==0}set control(t){this.modifiers=t?this.modifiers|1:this.modifiers&-2}get shift(){return(this.modifiers&4)!==0}set shift(t){this.modifiers=t?this.modifiers|4:this.modifiers&-5}get alt(){return(this.modifiers&2)!==0}set alt(t){this.modifiers=t?this.modifiers|2:this.modifiers&-3}get meta(){return(this.modifiers&8)!==0}set meta(t){this.modifiers=t?this.modifiers|8:this.modifiers&-9}get left(){let t=this.event;return t!==null&&(t.type==="mousedown"||t.type==="mouseup"||t.type==="pointerdown"||t.type==="pointerup")?this.button===0:(this.buttons&1)!==0}set left(t){t?this.buttons|=1:this.buttons&=-2}get right(){let t=this.event;return t!==null&&(t.type==="mousedown"||t.type==="mouseup"||t.type==="pointerdown"||t.type==="pointerup")?this.button===2:(this.buttons&2)!==0}set right(t){t?this.buttons|=2:this.buttons&=-3}get middle(){let t=this.event;return t!==null&&(t.type==="mousedown"||t.type==="mouseup"||t.type==="pointerdown"||t.type==="pointerup")?this.button===1:(this.buttons&4)!==0}set middle(t){t?this.buttons|=4:this.buttons&=-5}get commandKey(){let t=this.code,e=this.key;return"cxvyzagCXVYZAG".includes(e)?e.toLowerCase():t==="KeyC"?"c":t==="KeyX"?"x":t==="KeyV"?"v":t==="KeyY"?"y":t==="KeyZ"?"z":t==="KeyA"?"a":t==="KeyG"?"g":t!==""?t:e}}class Wi{N;Pt;om;rm;constructor(){this.N=null,this.Pt="",this.om=null,this.rm=null}copy(){let t=new Wi;return t.N=this.N,t.Pt=this.Pt,t.om=this.om,t.rm=this.rm,t}toString(){let t="*"+this.name;return this.subject!==null&&(t+=":"+this.subject.toString()),this.parameter!==null&&(t+="("+this.parameter.toString()+")"),t}get diagram(){return this.N}set diagram(t){this.N=t}get name(){return this.Pt}set name(t){this.Pt=t}get subject(){return this.om}set subject(t){this.om=t}get parameter(){return this.rm}set parameter(t){this.rm=t}}var ps=(x=>(x[x.Transaction=1]="Transaction",x[x.Property=2]="Property",x[x.Insert=3]="Insert",x[x.Remove=4]="Remove",x))(ps||{});class ii{au;lm;en;ki;N;cu;ac;cc;fc;uc;constructor(){this.au=2,this.lm="",this.en="",this.ki=null,this.N=null,this.cu=null,this.ac=null,this.cc=null,this.fc=null,this.uc=null}static Transaction=1;static Property=2;static Insert=3;static Remove=4;clear(){this.ki=null,this.N=null,this.cu=null,this.ac=null,this.cc=null,this.fc=null,this.uc=null}copy(){let t=new ii;t.au=this.au,t.lm=this.lm,t.en=this.en,t.ki=this.ki,t.N=this.N,t.cu=this.cu;let e=this.ac;return f.G(e)&&f.it(e.copyFrozen)?t.ac=e.copyFrozen():t.ac=e,e=this.cc,f.G(e)&&f.it(e.copyFrozen)?t.cc=e.copyFrozen():t.cc=e,e=this.fc,f.G(e)&&f.it(e.copyFrozen)?t.fc=e.copyFrozen():t.fc=e,e=this.uc,f.G(e)&&f.it(e.copyFrozen)?t.uc=e.copyFrozen():t.uc=e,t}oi(t){t in ps?this.change=t:f.er(this,t)}toString(){let t="";return this.change===1?t+="* ":this.change===2?t+=this.model!==null?"!m":"!d":t+=(this.model!==null?"!m":"!d")+this.change,this.propertyName&&typeof this.propertyName=="string"&&(t+=" "+this.propertyName),this.modelChange&&this.modelChange!==this.propertyName&&(t+=" "+this.modelChange),t+=": ",this.change===1?this.oldValue!==null&&(t+=" "+this.oldValue):(this.object!==null&&(t+=f.toString(this.object)),this.oldValue!==null&&(t+=" old: "+f.toString(this.oldValue)),this.oldParam!==null&&(t+=" "+this.oldParam),this.newValue!==null&&(t+=" new: "+f.toString(this.newValue)),this.newParam!==null&&(t+=" "+this.newParam)),t}getValue(t){return t?this.oldValue:this.newValue}getParam(t){return t?this.oldParam:this.newParam}canUndo(){return this.model!==null||this.diagram!==null}undo(){this.canUndo()&&(this.model!==null?this.model.changeState(this,!0):this.diagram!==null&&this.diagram.VC(this,!0))}canRedo(){return this.model!==null||this.diagram!==null}redo(){this.canRedo()&&(this.model!==null?this.model.changeState(this,!1):this.diagram!==null&&this.diagram.VC(this,!1))}get model(){return this.ki}set model(t){this.ki=t}get diagram(){return this.N}set diagram(t){this.N=t}get change(){return this.au}set change(t){this.au=t}get modelChange(){return this.lm}set modelChange(t){this.lm=t}get propertyName(){return this.en}set propertyName(t){this.en=t}get isTransactionFinished(){return this.au===1&&(this.en==="CommittedTransaction"||this.en==="FinishedUndo"||this.en==="FinishedRedo")}get object(){return this.cu}set object(t){this.cu=t}get oldValue(){return this.ac}set oldValue(t){this.ac=t}get oldParam(){return this.cc}set oldParam(t){this.cc=t}get newValue(){return this.fc}set newValue(t){this.fc=t}get newParam(){return this.uc}set newParam(t){this.uc=t}}class Ai{zC;Pt;$k;constructor(){this.zC=new G().u(),this.Pt="",this.$k=!1}toString(t){let e="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(t!==void 0&&t>0){let i=this.changes.count;for(let s=0;s<i;s++){let n=this.changes.elt(s);n!==null&&(e+=`
6
6
  `+n.toString())}}return e}clear(){let t=this.changes;t.Nt();for(let e=t.count-1;e>=0;e--){let i=t.elt(e);i!==null&&i.clear()}t.clear(),t.u()}canUndo(){return this.isComplete}undo(){if(this.canUndo())for(let t=this.changes.count-1;t>=0;t--){let e=this.changes.elt(t);e!==null&&e.undo()}}canRedo(){return this.isComplete}redo(){if(!this.canRedo())return;let t=this.changes.count;for(let e=0;e<t;e++){let i=this.changes.elt(e);i!==null&&i.redo()}}uF(t){let e=this.changes;for(let i=e.count-1;i>=t;i--){let s=e.elt(i);s!==null&&s.undo(),e.Nt(),e.removeAt(i)}e.u()}optimize(){if(!this.isComplete)return;let t=this.changes;t.Nt();let e=new pt;for(let s=0;s<t.count;s++){let n=t.elt(s);if(n===null||n.change!==2||!n.object)continue;let o=e.get(n.object);o||(o=new pt,e.set(n.object,o));let r=o.get(n.propertyName);r===null?o.set(n.propertyName,-1):(r>0&&t.setElt(r,null),o.set(n.propertyName,s))}let i=0;for(let s=0;s<t.count;s++){let n=t.elt(s);n!==null&&(s>i&&t.setElt(i,n),i++)}for(;t.length>i;)t.pop();t.u()}get changes(){return this.zC}get name(){return this.Pt}set name(t){this.Pt=t}get isComplete(){return this.$k}set isComplete(t){this.$k=t}}class $i{Dw;Oi;XC;Os;Zk;hm;Vn;Qk;_k;sn;dc;Fw;Is;Rw;vw;am;Ow;constructor(t){this.Dw=new I,this.Oi=!1,this.XC=new G().u(),this.Os=-1,this.Zk=999,this.Is=!1,this.hm=null,this.Vn=0,this.Qk=!1,this._k=23,this.sn=new G().u(),this.dc=new G,this.Fw=!0,this.Rw=!1,this.vw=!1,this.am=!1,this.Ow=!1,t&&Object.assign(this,t)}toString(t){let e="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;e+="[";let i=this.nestedTransactionNames.count;for(let s=0;s<i;s++)s>0&&(e+=" "),e+=this.nestedTransactionNames.elt(s);if(e+="]",t!==void 0&&t>0){i=this.history.count;for(let s=0;s<i;s++)e+=`
7
7
  `+this.history.elt(s).toString(t-1)}return e}clear(){let t=this.history;t.Nt();for(let e=t.count-1;e>=0;e--){let i=t.elt(e);i!==null&&i.clear()}t.clear(),this.Os=-1,t.u(),this.Is=!1,this.hm=null,this.Vn=0,this.sn.Nt(),this.sn.clear(),this.sn.u(),this.dc.clear(),this.Rw=!1,this.vw=!1,this.am=!1,this.Ow=!1}copyProperties(t){this.isEnabled=t.isEnabled,this.maxHistoryLength=t.maxHistoryLength,this.cm=t.cm}addModel(t){this.Dw.add(t)}removeModel(t){this.Dw.delete(t)}startTransaction(t){if(t===void 0&&(t=""),t===null&&(t=""),this.isUndoingRedoing)return!1;this.Fw===!0&&(this.Fw=!1,this.Vn++,this.wl||this.xl("StartingFirstTransaction",t,this.currentTransaction),this.Vn>0&&this.Vn--),this.isEnabled&&(this.sn.Nt(),this.sn.add(t),this.sn.u(),this.currentTransaction===null?this.dc.add(0):this.dc.add(this.currentTransaction.changes.count)),this.Vn++;let e=this.transactionLevel===1;return e&&(this.wl||this.xl("StartedTransaction",t,this.currentTransaction)),e}commitTransaction(t){return t===void 0&&(t=""),this.YC(!0,t)}rollbackTransaction(){return this.YC(!1,"")}YC(t,e){if(this.isUndoingRedoing)return!1;this.cm&&this.transactionLevel<1&&f.ni("Ending transaction without having started a transaction: "+e);let i=this.transactionLevel===1,s=this.currentTransaction;i&&t&&(this.wl||this.xl("CommittingTransaction",e,s));let n=0;if(this.transactionLevel>0&&(this.Vn--,this.isEnabled)){let o=this.sn.count;o>0&&(e===""&&(e=this.sn.elt(0)),this.sn.Nt(),this.sn.removeAt(o-1),this.sn.u());let r=this.dc.count;r>0&&(n=this.dc.elt(r-1),this.dc.removeAt(r-1))}if(i){if(t){if(this.am=!1,s===null&&e!==""&&(s=this.currentTransaction),this.isEnabled&&s!==null){let o=s;o.isComplete||(o.isComplete=!0,o.name=e),this.discardHistoryAfterIndex();let r=this.history;r.Nt();let a=this.maxHistoryLength;if(a>=0){if(a===0)r.clear();else if(r.count>=a){let h=r.elt(0);h!==null&&h.clear(),r.removeAt(0),this.Os--}}a!==0&&(r.count===0||r.get(r.count-1)!==o)&&(r.add(o),this.Os++),r.u(),s=o}this.wl||this.xl("CommittedTransaction",e,s)}else{this.Is=!0;try{this.isEnabled&&s!==null&&(s.isComplete=!0,s.undo())}finally{this.wl||this.xl("RolledBackTransaction",e,s),this.Is=!1}s!==null&&s.clear()}return this.hm=null,this.Iw&&this.clear(),this.Iw=!1,this.Ew=!1,!0}else return this.isEnabled&&!t&&s!==null&&s.uF(n),!1}discardHistoryAfterIndex(){if(this.isUndoingRedoing||!this.canRedo())return;let t=this.history;t.Nt();for(let e=t.count-1;e>this.historyIndex;e--){let i=t.elt(e);i!==null&&i.clear(),t.removeAt(e),this.am=!0}t.u()}SE(t){this.Vn+=t,this.Vn<0&&(this.Vn=0)}canUndo(){if(!this.isEnabled||this.transactionLevel>0)return!1;let t=this.transactionToUndo;return!!(t!==null&&t.canUndo())}undo(){if(!this.canUndo())return;let t=this.transactionToUndo;try{this.Is=!0,this.xl("StartingUndo","Undo",t),this.Os--,t.undo()}catch(e){f.ni("undo error: "+e.toString())}finally{this.xl("FinishedUndo","Undo",t),this.Is=!1}}canRedo(){if(!this.isEnabled||this.transactionLevel>0)return!1;let t=this.transactionToRedo;return!!(t!==null&&t.canRedo())}redo(){if(!this.canRedo())return;let t=this.transactionToRedo;try{this.Is=!0,this.xl("StartingRedo","Redo",t),this.Os++,t.redo()}catch(e){f.ni("redo error: "+e.toString())}finally{this.xl("FinishedRedo","Redo",t),this.Is=!1}}xl(t,e,i){i===void 0&&(i=null);let s=new ii;s.change=1,s.propertyName=t,s.object=i,s.oldValue=e;let n=this.models;for(;n.next();){let o=n.value;s.model=o,o.dF(s)}}handleChanged(t){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(t)){let e=this.currentTransaction;e===null&&(e=new Ai,this.hm=e);let i=t.copy(),s=e.changes;if(s.Nt(),s.add(i),s.u(),this.cm&&this._k>0&&this.transactionLevel<=0&&!this.Fw){let n=t.diagram;if(n!==null&&n.Vh===!1)return;f.ni("Change not within a transaction: "+i.toString()),this._k--}}}skipsEvent(t){if(t===null||t.change===1)return!0;let e=t.object;if(e===null)return!1;if(e.layer!==void 0){let i=e.layer;if(i!==null&&i.isTemporary)return!0}else if(e.isTemporary)return!0;return!1}get models(){return this.Dw.iterator}get isEnabled(){return this.Oi}set isEnabled(t){this.Oi=t}get transactionToUndo(){return this.historyIndex>=0&&this.historyIndex<=this.history.count-1?this.history.elt(this.historyIndex):null}get transactionToRedo(){return this.historyIndex<this.history.count-1?this.history.elt(this.historyIndex+1):null}get isUndoingRedoing(){return this.Is}get history(){return this.XC}get maxHistoryLength(){return this.Zk}set maxHistoryLength(t){this.Zk=t}get historyIndex(){return this.Os}get currentTransaction(){return this.hm}get transactionLevel(){return this.Vn}get isInTransaction(){return this.Vn>0}get cm(){return this.Qk}set cm(t){this.Qk=t}get nestedTransactionNames(){return this.sn}get Iw(){return this.Rw}set Iw(t){this.Rw=t}get Ew(){return this.vw}set Ew(t){this.vw=t}get wl(){return this.Ow}set wl(t){this.Ow=t}get isJustDiscarded(){return this.am}}class ee{N;Pt;Oi;tP;iP;fm;GC;constructor(){I.Ki(this),this.N=q.um(),this.Pt="",this.Oi=!0,this.tP=!1,this.iP=null,this.GC=new Ye,this.fm=-1}get diagram(){return this.N}set diagram(t){t instanceof q&&(this.N=t)}toString(){return this.name!==""?this.name+" Tool":f.Dn(this.constructor)}updateAdornments(t){}canStart(){return this.isEnabled}doStart(){}doActivate(){this.isActive=!0}doDeactivate(){this.isActive=!1}doStop(){}doCancel(){this.transactionResult=null,this.stopTool()}stopTool(){let t=this.diagram;t.currentTool===this&&(t.currentTool=null,t.currentCursor="")}doMouseDown(){!this.isActive&&this.canStart()&&this.doActivate()}doMouseMove(){}doMouseUp(){this.stopTool()}doMouseWheel(){}canStartMultiTouch(){return!0}standardPinchZoomStart(){let t=this.diagram,e=t.lastInput,i=e.getMultiTouchViewPoint(0,P.V(NaN,NaN)),s=e.getMultiTouchViewPoint(1,P.V(NaN,NaN));if(!i.isReal()||!s.isReal()){P.e(i),P.e(s);return}if(this.doCancel(),t.getInputOption("hasGestureZoom")){t.eP=t.scale;let n=s.x-i.x,o=s.y-i.y,r=Math.sqrt(n*n+o*o);t.sP=r,e.bubbles=!1}P.e(i),P.e(s)}standardPinchZoomMove(){let t=this.diagram,e=t.lastInput,i=e.getMultiTouchViewPoint(0,P.V(NaN,NaN)),s=e.getMultiTouchViewPoint(1,P.V(NaN,NaN));if(!i.isReal()||!s.isReal()){P.e(i),P.e(s);return}if(this.doCancel(),t.getInputOption("hasGestureZoom")){let n=s.x-i.x,o=s.y-i.y,r=Math.sqrt(n*n+o*o)/t.sP,a=new P((Math.min(s.x,i.x)+Math.max(s.x,i.x))/2,(Math.min(s.y,i.y)+Math.max(s.y,i.y))/2),h=t.eP*r,l=t.commandHandler;if(h!==t.scale&&l.canResetZoom(h)){let c=t.zoomPoint;t.zoomPoint=a,l.resetZoom(h),t.zoomPoint=c}e.bubbles=!1}P.e(i),P.e(s)}doKeyDown(){this.diagram.lastInput.code==="Escape"&&this.doCancel()}doKeyUp(){}startTransaction(t){return t===void 0&&(t=this.name),this.transactionResult=null,this.diagram.startTransaction(t)}stopTransaction(){let t=this.diagram;return this.transactionResult===null?t.rollbackTransaction():t.commitTransaction(this.transactionResult)}standardMouseSelect(){let t=this.diagram;if(!t.allowSelect)return;let e=t.lastInput,i=t.findPartAt(e.documentPoint,!1);if(i!==null){if(f.tr?e.meta:e.control){t.D("ChangingSelection",t.selection);let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!s.isSelected),t.D("ChangedSelection",t.selection)}else if(e.shift){if(!i.isSelected){t.D("ChangingSelection",t.selection);let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!0),t.D("ChangedSelection",t.selection)}}else if(!i.isSelected){let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&t.select(s)}}else e.left&&!(f.tr?e.meta:e.control)&&!e.shift&&t.clearSelection()}standardMouseClick(t,e){t===void 0&&(t=null),e===void 0&&(e=o=>!o.layer?.isTemporary);let i=this.diagram,s=i.lastInput,n=i.findObjectAt(s.documentPoint,t,e);return s.targetObject=n,this.gF(n,s,i),s.handled}gF(t,e,i){if(e.handled=!1,t!==null&&!t.isEnabledObject())return;let s=0;e.left?e.clickCount===1?s=1:e.clickCount===2?s=2:s=1:e.right&&e.clickCount===1&&(s=3);let n="ObjectSingleClicked";if(t!==null){switch(s){case 1:n="ObjectSingleClicked";break;case 2:n="ObjectDoubleClicked";break;case 3:n="ObjectContextClicked";break}s!==0&&i.D(n,t)}else{switch(s){case 1:n="BackgroundSingleClicked";break;case 2:n="BackgroundDoubleClicked";break;case 3:n="BackgroundContextClicked";break}s!==0&&i.D(n)}if(t!==null)for(;t!==null;){let o=null;switch(s){case 1:o=t.click;break;case 2:o=t.doubleClick?t.doubleClick:t.click;break;case 3:o=t.contextClick;break}if(o!==null&&(o(e,t),e.handled))break;t=t.panel}else{let o=null;switch(s){case 1:o=i.click;break;case 2:o=i.doubleClick?i.doubleClick:i.click;break;case 3:o=i.contextClick;break}o!==null&&o(e)}}standardMouseOver(){let t=this.diagram,e=t.lastInput;if(t.animationManager.pi===!0)return;let i=t.skipsUndoManager;t.skipsUndoManager=!0;let s=t.viewportBounds.containsPoint(e.documentPoint)?t.findObjectAt(e.documentPoint,null,null):null;e.event&&(e.event.type==="pointercancel"||e.event.type==="pointerout")&&(s=null),e.targetObject=s;let n=!1;if(s!==t.gc){let o=t.gc,r=o;for(t.gc=s,this.doCurrentObjectChanged(o,s),e.handled=!1;o!==null;){let a=o.mouseLeave;if(a!==null&&(s===o||s!==null&&s.isContainedBy(o)||(a(e,o,s),n=!0,e.handled)))break;o=o.panel}for(o=r,e.handled=!1;s!==null;){let a=s.mouseEnter;if(a!==null&&(o===s||o!==null&&o.isContainedBy(s)||(a(e,s,o),n=!0,e.handled)))break;s=s.panel}s=t.gc}if(s!==null){let o=s,r="";for(;o!==null&&(r=o.cursor,r==="");)o=o.panel;for(t.currentCursor=r,e.handled=!1,o=s;o!==null;){let a=o.mouseOver;if(a!==null&&(a(e,o),n=!0,e.handled))break;o=o.panel}}else{this.doUpdateCursor(null);let o=t.mouseOver;o!==null&&(o(e),n=!0)}n&&t.requestUpdate(),t.skipsUndoManager=i}doUpdateCursor(t){let e=this.diagram;e&&(e.currentCursor="")}doCurrentObjectChanged(t,e){}standardMouseWheel(){let t=this.diagram,e=t.lastInput,i=e.delta;if(i===0||!t.documentBounds.isReal())return;let s=t.commandHandler,n=t.toolManager.mouseWheelBehavior;if(s!==null&&(n===2&&!e.shift||n===1&&e.control)){if(i>0?s.canIncreaseZoom():s.canDecreaseZoom()){let o=t.zoomPoint;t.zoomPoint=e.viewPoint,i>0?s.increaseZoom():s.decreaseZoom(),t.zoomPoint=o}e.bubbles=!1}else if(n===2&&e.shift||n===1&&!e.control){let o=t.position.copy(),r=e.event,a=r.deltaMode,h=r.deltaX,l=r.deltaY,c="pixel";if((h!==0||l!==0)&&!e.shift){switch(a){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break}if(h!==0&&t.allowHorizontalScroll){let u=t.scrollHorizontalLineChange;h=h*(u/16),t.scroll(c,h>0?"right":"left",Math.abs(h))}if(l!==0&&t.allowVerticalScroll){let u=t.scrollVerticalLineChange;l=l*(u/16),t.scroll(c,l>0?"down":"up",Math.abs(l))}}else!e.shift&&t.allowVerticalScroll?(i=i*3*t.scrollVerticalLineChange,t.scroll(c,i>0?"up":"down",Math.abs(i))):e.shift&&t.allowHorizontalScroll&&(i=i*3*t.scrollHorizontalLineChange,t.scroll(c,i>0?"left":"right",Math.abs(i)));this.doWheelChange(t,o,e)}}doWheelChange(t,e,i){(!t.position.equals(e)||i.event.wheelDeltaX!==0)&&(i.bubbles=!1)}standardWaitAfter(t,e){e===void 0&&(e=this.diagram.lastInput),this.cancelWaitAfter();let i=this,s=e.clone(this.GC);this.fm=f.ir(()=>i.doWaitAfter(s),t)}cancelWaitAfter(){this.fm!==-1&&f.Tg(this.fm),this.fm=-1}doWaitAfter(t){}findToolHandleAt(t,e){let i=this.diagram.findObjectAt(t,s=>{for(;s!==null&&!(s.panel instanceof St);)s=s.panel;return s});return i===null?null:i.part.category===e?i:null}isBeyondDragSize(t,e){let i=this.diagram;t===void 0&&(t=i.firstInput.viewPoint),e===void 0&&(e=i.lastInput.viewPoint);let s=i.toolManager.dragSize,n=s.width,o=s.height;return i.firstInput.isTouchEvent&&(n+=6,o+=6),Math.abs(e.x-t.x)>n||Math.abs(e.y-t.y)>o}get name(){return this.Pt}set name(t){f.s(t,"string",ee,"name"),this.Pt=t}get isEnabled(){return this.Oi}set isEnabled(t){f.s(t,"boolean",ee,"isEnabled"),this.Oi=t}get isActive(){return this.tP}set isActive(t){f.s(t,"boolean",ee,"isActive"),this.tP=t}get transactionResult(){return this.iP}set transactionResult(t){t!==null&&f.s(t,"string",ee,"transactionResult"),this.iP=t}}var mn=(x=>(x[x.Scroll=1]="Scroll",x[x.Zoom=2]="Zoom",x[x.None=3]="None",x))(mn||{}),pn=(x=>(x[x.Zoom=1]="Zoom",x[x.Cancel=2]="Cancel",x[x.None=3]="None",x))(pn||{});class xe extends ee{KC;jC;HC;nP;oP;rP;lP;hP;aP;cP;dm;zh;constructor(t){super(),this.name="ToolManager",this.KC=new G,this.jC=new G,this.HC=new G,this.nP=850,this.oP=850,this.rP=new Q(2,2).$(),this.lP=5e3,this.hP=1,this.aP=1,this.cP=null,this.dm=null,this.zh=-1,t&&Object.assign(this,t)}static WheelScroll=1;static WheelZoom=2;static WheelNone=3;static GestureZoom=1;static GestureCancel=2;static GestureNone=3;get mouseWheelBehavior(){return this.hP}set mouseWheelBehavior(t){this.hP=t}get gestureBehavior(){return this.aP}set gestureBehavior(t){this.aP=t}initializeStandardTools(){}updateAdornments(t){let e=this.currentToolTip;if(e instanceof St&&this.dm===t){let i=e.adornedObject;(t!==null?i!==null&&i.part===t:i===null)?this.showToolTip(e,i):this.hideToolTip()}}doMouseDown(){let t=this.diagram,e=t.lastInput;if(e.isTouchEvent&&this.gestureBehavior===2&&(e.bubbles=!1),e.isMultiTouch){if(this.cancelWaitAfter(),this.gestureBehavior===3){e.bubbles=!0;return}if(this.gestureBehavior===2)return;if(t.currentTool.canStartMultiTouch()){t.currentTool.standardPinchZoomStart();return}}let i=t.undoManager,s=this.mouseDownTools.length;for(let n=0;n<s;n++){let o=this.mouseDownTools.elt(n);if(o.diagram=this.diagram,o.canStart()){t.doFocus(),t.currentTool=o,t.currentTool===o&&(o.isActive||o.doActivate(),o.doMouseDown());return}}t.lastInput.button===1&&(this.mouseWheelBehavior===1?this.mouseWheelBehavior=2:this.mouseWheelBehavior===2&&(this.mouseWheelBehavior=1)),this.doActivate(),this.standardWaitAfter(this.holdDelay,e)}doMouseMove(){let t=this.diagram,e=t.lastInput;if(e.isMultiTouch){if(this.gestureBehavior===3){e.bubbles=!0;return}if(this.gestureBehavior===2)return;if(t.currentTool.canStartMultiTouch()){t.currentTool.standardPinchZoomMove();return}}if(this.isActive){let s=this.mouseMoveTools.length;for(let n=0;n<s;n++){let o=this.mouseMoveTools.elt(n);if(o.diagram=this.diagram,o.canStart()){t.doFocus(),t.currentTool=o,t.currentTool===o&&(o.isActive||o.doActivate(),o.doMouseMove());return}}}this.standardMouseActivity(t);let i=e.event;i!==null&&(i.type==="pointermove"||!i.cancelable)&&(e.bubbles=!0)}standardMouseActivity(t){this.standardMouseOver(),this.isBeyondDragSize()&&this.standardWaitAfter(this.isActive?this.holdDelay:this.hoverDelay,t.lastInput)}doCurrentObjectChanged(t,e){let i=this.currentToolTip;i!==null&&(e!==null&&i instanceof St&&(e===i||e.isContainedBy(i))||this.hideToolTip())}doWaitAfter(t){let e=this.diagram;if(e.mF()&&(this.doMouseHover(),this.isActive||this.doToolTip(),t.isTouchEvent&&!e.lastInput.handled)){let i=t.copy();i.button=2,e.lastInput=i,e.Uw=!0,e.doMouseUp();return}}doMouseHover(){let t=this.diagram,e=t.lastInput;e.targetObject===null&&(e.targetObject=t.findObjectAt(e.documentPoint,null,null));let i=e.targetObject;if(i!==null)for(e.handled=!1;i!==null;){let s=this.isActive?i.mouseHold:i.mouseHover;if(s!==null&&(s(e,i),e.handled))break;i=i.panel}else{let s=this.isActive?t.mouseHold:t.mouseHover;s!==null&&s(e)}}doToolTip(){let t=this.diagram,e=t.lastInput;e.targetObject===null&&(e.targetObject=t.findObjectAt(e.documentPoint,null,null));let i=e.targetObject;if(i!==null){let s=this.currentToolTip;if(s instanceof St&&(i===s||i.isContainedBy(s)))return;for(;i!==null;){let n=i.toolTip;if(n!==null){this.showToolTip(n,i);return}i=i.panel}this.hideToolTip()}else{let s=t.toolTip;s!==null?this.showToolTip(s,null):this.hideToolTip()}}showToolTip(t,e){let i=this.diagram;if(t!==this.currentToolTip&&this.hideToolTip(),t instanceof St){t.layerName="Tool",t.selectable=!1,t.scale=1/i.scale,t.category="ToolTip",t.hasPlaceholder()&&(t.placeholder.scale=i.scale);let n=t.diagram;n!==null&&n!==i&&n.remove(t),i.add(t),e!==null?t.adornedObject=e:t.data=i.model,t.ensureBounds(),this.positionToolTip(t,e)}else t instanceof Ne&&t!==this.currentToolTip&&t.show!==null&&t.show(e,i,this);this.currentToolTip=t,this.zh!==-1&&(f.Tg(this.zh),this.zh=-1);let s=this.toolTipDuration;if(s>0&&s!==1/0){let n=this;this.zh=f.ir(()=>n.hideToolTip(),s)}}positionToolTip(t,e){if(t.hasPlaceholder())return;let i=t,s=this.diagram,n=s.lastInput.documentPoint.copy(),o=i.measuredBounds,r=s.viewportBounds;s.lastInput.isTouchEvent&&(n.x-=o.width),n.x+o.width>r.right&&(n.x-=o.width+5/s.scale),n.x<r.x&&(n.x=r.x),n.y+20/s.scale+o.height>r.bottom?n.y-=o.height+5/s.scale:n.y+=20/s.scale,n.y<r.y&&(n.y=r.y),i.position=n}hideToolTip(){this.zh!==-1&&(f.Tg(this.zh),this.zh=-1);let t=this.diagram,e=this.currentToolTip;e!==null&&(e instanceof St?(t.remove(e),this.dm!==null&&this.dm.removeAdornment(e.category),e.data=null,e.adornedObject=null):e instanceof Ne&&e.hide!==null&&e.hide(t,this),this.currentToolTip=null)}get currentToolTip(){return this.cP}set currentToolTip(t){this.cP=t,this.dm=t!==null&&t instanceof St?t.adornedPart:null}doMouseUp(){this.cancelWaitAfter();let t=this.diagram;if(this.isActive){let e=this.mouseUpTools.length;for(let i=0;i<e;i++){let s=this.mouseUpTools.elt(i);if(s.diagram=this.diagram,s.canStart()){t.doFocus(),t.currentTool=s,t.currentTool===s&&(s.isActive||s.doActivate(),s.doMouseUp());return}}}t.doFocus(),this.doDeactivate()}doMouseWheel(){this.standardMouseWheel()}doKeyDown(){let t=this.diagram;t.commandHandler!==null&&t.commandHandler.doKeyDown()}doKeyUp(){let t=this.diagram;t.commandHandler!==null&&t.commandHandler.doKeyUp()}findTool(t){f.s(t,"string",xe,"findTool:name");let e=this.mouseDownTools.length;for(let i=0;i<e;i++){let s=this.mouseDownTools.elt(i);if(s.name===t)return s}e=this.mouseMoveTools.length;for(let i=0;i<e;i++){let s=this.mouseMoveTools.elt(i);if(s.name===t)return s}e=this.mouseUpTools.length;for(let i=0;i<e;i++){let s=this.mouseUpTools.elt(i);if(s.name===t)return s}return null}replaceTool(t,e){f.s(t,"string",xe,"replaceTool:name"),e!==null&&(e.diagram=this.diagram);let i=this.mouseDownTools.length;for(let s=0;s<i;s++){let n=this.mouseDownTools.elt(s);if(n.name===t)return e!==null?this.mouseDownTools.setElt(s,e):this.mouseDownTools.removeAt(s),n}i=this.mouseMoveTools.length;for(let s=0;s<i;s++){let n=this.mouseMoveTools.elt(s);if(n.name===t)return e!==null?this.mouseMoveTools.setElt(s,e):this.mouseMoveTools.removeAt(s),n}i=this.mouseUpTools.length;for(let s=0;s<i;s++){let n=this.mouseUpTools.elt(s);if(n.name===t)return e!==null?this.mouseUpTools.setElt(s,e):this.mouseUpTools.removeAt(s),n}return null}replaceStandardTool(t,e,i){this.Jt(t,e,i)}Jt(t,e,i){f.s(t,"string",xe,"replaceStandardTool:name"),e!==null&&(e.name=t,e.diagram=this.diagram),this.findTool(t)?this.replaceTool(t,e):e!==null&&i.add(e)}get mouseDownTools(){return this.KC}get mouseMoveTools(){return this.jC}get mouseUpTools(){return this.HC}get hoverDelay(){return this.nP}set hoverDelay(t){f.s(t,"number",xe,"hoverDelay"),this.nP=t}get holdDelay(){return this.oP}set holdDelay(t){f.s(t,"number",xe,"holdDelay"),this.oP=t}get dragSize(){return this.rP}set dragSize(t){this.rP=t.P()}get toolTipDuration(){return this.lP}set toolTipDuration(t){f.s(t,"number",xe,"toolTipDuration"),this.lP=t}get actionTool(){return this.findTool("Action")}set actionTool(t){this.Jt("Action",t,this.mouseDownTools)}get relinkingTool(){return this.findTool("Relinking")}set relinkingTool(t){this.Jt("Relinking",t,this.mouseDownTools)}get linkReshapingTool(){return this.findTool("LinkReshaping")}set linkReshapingTool(t){this.Jt("LinkReshaping",t,this.mouseDownTools)}get resizingTool(){return this.findTool("Resizing")}set resizingTool(t){this.Jt("Resizing",t,this.mouseDownTools)}get rotatingTool(){return this.findTool("Rotating")}set rotatingTool(t){this.Jt("Rotating",t,this.mouseDownTools)}get linkingTool(){return this.findTool("Linking")}set linkingTool(t){this.Jt("Linking",t,this.mouseMoveTools)}get draggingTool(){return this.findTool("Dragging")}set draggingTool(t){this.Jt("Dragging",t,this.mouseMoveTools)}get dragSelectingTool(){return this.findTool("DragSelecting")}set dragSelectingTool(t){this.Jt("DragSelecting",t,this.mouseMoveTools)}get panningTool(){return this.findTool("Panning")}set panningTool(t){this.Jt("Panning",t,this.mouseMoveTools)}get contextMenuTool(){return this.findTool("ContextMenu")}set contextMenuTool(t){this.Jt("ContextMenu",t,this.mouseUpTools)}get textEditingTool(){return this.findTool("TextEditing")}set textEditingTool(t){this.Jt("TextEditing",t,this.mouseUpTools)}get clickCreatingTool(){return this.findTool("ClickCreating")}set clickCreatingTool(t){this.Jt("ClickCreating",t,this.mouseUpTools)}get clickSelectingTool(){return this.findTool("ClickSelecting")}set clickSelectingTool(t){this.Jt("ClickSelecting",t,this.mouseUpTools)}}class Dt extends ee{fP;uP;nn;dP;gP;mP;pP;mc;gm;yP;Xh;cr;qC;wP;fu;uu;xP;bP;kP;PP;constructor(t){super(),this.name="Dragging",this.fP=!0,this.PP=!0,this.uP=!0,this.nn=null,this.dP=null,this.gP=null,this.mP=null,this.pP=!1,this.fu=!1,this.mc=new P(NaN,NaN),this.gm=new P,this.yP=!0,this.Xh=100,this.cr=[],this.qC=new I().u(),this.wP=new Qi,this.uu=null,this.xP="copy",this.bP="",this.kP="no-drop",t&&Object.assign(this,t)}get isCopyEnabled(){return this.fP}set isCopyEnabled(t){f.s(t,"boolean",Dt,"isCopyEnabled"),this.fP=t}get copiesEffectiveCollection(){return this.uP}set copiesEffectiveCollection(t){f.s(t,"boolean",Dt,"copiesEffectiveCollection"),this.uP=t}get dragOptions(){return this.wP}set dragOptions(t){this.wP=t}get isGridSnapEnabled(){return this.dragOptions.isGridSnapEnabled}set isGridSnapEnabled(t){f.s(t,"boolean",Dt,"isGridSnapEnabled"),this.dragOptions.isGridSnapEnabled=t}get isComplexRoutingRealtime(){return this.yP}set isComplexRoutingRealtime(t){this.yP=t;let e=this.diagram.findRouter("AvoidsLinks");e!==null&&(e.isRealtime=t)}get isGridSnapRealtime(){return this.dragOptions.isGridSnapRealtime}set isGridSnapRealtime(t){f.s(t,"boolean",Dt,"isGridSnapRealtime"),this.dragOptions.isGridSnapRealtime=t}get gridSnapCellSize(){return this.dragOptions.gridSnapCellSize}set gridSnapCellSize(t){this.dragOptions.gridSnapCellSize.equals(t)||(t=t.P(),this.dragOptions.gridSnapCellSize=t)}get gridSnapCellSpot(){return this.dragOptions.gridSnapCellSpot}set gridSnapCellSpot(t){this.dragOptions.gridSnapCellSpot.equals(t)||(t=t.P(),this.dragOptions.gridSnapCellSpot=t)}get gridSnapOrigin(){return this.dragOptions.gridSnapOrigin}set gridSnapOrigin(t){this.dragOptions.gridSnapOrigin.equals(t)||(t=t.P(),this.dragOptions.gridSnapOrigin=t)}get dragsLink(){return this.dragOptions.dragsLink}set dragsLink(t){f.s(t,"boolean",Dt,"dragsLink"),this.dragOptions.dragsLink=t}get dragsTree(){return this.dragOptions.dragsTree}set dragsTree(t){f.s(t,"boolean",Dt,"dragsTree"),this.dragOptions.dragsTree=t}get copyCursor(){return this.xP}set copyCursor(t){this.xP=t}get moveCursor(){return this.bP}set moveCursor(t){this.bP=t}get nodropCursor(){return this.kP}set nodropCursor(t){this.kP=t}get currentPart(){return this.dP}set currentPart(t){this.dP=t}get copiedParts(){return this.mP}set copiedParts(t){this.mP=t}get draggedParts(){return this.gP}set draggedParts(t){this.gP=t}get draggingParts(){return this.copiedParts!==null?this.copiedParts.toKeySet():this.draggedParts!==null?this.draggedParts.toKeySet():this.qC}get draggedLink(){return this.diagram.draggedLink}set draggedLink(t){this.diagram.draggedLink=t}get isDragOutStarted(){return this.pP}set isDragOutStarted(t){this.pP=t}get startPoint(){return this.gm}set startPoint(t){this.gm.equals(t)||this.gm.a(t)}get delay(){return this.Xh}set delay(t){f.s(t,"number",Dt,"delay"),this.Xh=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||t.isReadOnly&&!t.allowDragOut||!t.allowMove&&!t.allowCopy&&!t.allowDragOut||!t.allowSelect)return!1;let e=t.lastInput;return!e.left||t.currentTool!==this&&(!this.isBeyondDragSize()||e.isTouchEvent&&e.timestamp-t.firstInput.timestamp<this.Xh)?!1:this.findDraggablePart()!==null}findDraggablePart(){let t=this.diagram,e=t.findPartAt(t.firstInput.documentPoint,!1);if(e===null)return null;for(;e!==null&&!e.canSelect();)e=e.containingGroup;return e!==null&&(e.canMove()||e.canCopy())?e:null}standardMouseSelect(){let t=this.diagram;if(!t.allowSelect)return;let e=t.findPartAt(t.firstInput.documentPoint,!1);if(e!==null){for(;e!==null&&!e.canSelect();)e=e.containingGroup;if(this.currentPart=e,this.currentPart!==null&&!this.currentPart.isSelected){t.D("ChangingSelection",t.selection);let i=t.lastInput;!(f.tr?i.meta:i.control)&&!i.shift&&t.clearSelection(!0),this.currentPart.isSelected=!0,t.D("ChangedSelection",t.selection)}}}doActivate(){let t=this.diagram;this.uu=null,this.currentPart===null&&this.standardMouseSelect();let e=this.currentPart;if(e===null||!e.canMove()&&!e.canCopy())return;t.cacheGroupExternalLinks(!0),Dt.dt=null,this.isActive=!0,this.mc.set(t.position),this.SP(t.selection),this.cr.length=0,t.animationManager.stopAnimation();let i=this.computeEffectiveCollection(t.selection,this.dragOptions);this.draggedParts=i,this.PP=!!this.diagram.layout.isRealtime,this.diagram.layout.isRealtime=!1,t.du=!0,t.getRenderingHint("temporaryPixelRatio")===!0&&t.avgSpf>30&&t.Bw(),t.WC(this.draggedParts),t.gu=!0,this.startTransaction("Drag"),this.startPoint=t.firstInput.documentPoint,t.isMouseCaptured=!0,t.allowDragOut&&this.pF()}SP(t){if(!this.dragsLink)return;let e=this.diagram,i=e.model.mm(),s=t.first();i&&t.count===1&&s instanceof _&&this.mayDragLink(s)?(this.draggedLink=s,this.draggedLink.canRelinkFrom()&&this.draggedLink.canRelinkTo()&&this.draggedLink.clearAdornments(),this.nn=e.toolManager.findTool("Relinking"),this.nn===null&&(this.nn=new ys,this.nn.diagram=e),this.nn.originalLink=this.draggedLink):(this.draggedLink=null,this.nn=null)}mayDragLink(t){let e=this.diagram;return e!==null&&e.allowRelink}computeEffectiveCollection(t,e){return this.diagram.commandHandler.computeEffectiveCollection(t,e)}Es(t){return t===void 0?new ni(P.xo):this.isGridSnapEnabled?new ni(new P(Math.round(t.x*1e3)/1e3,Math.round(t.y*1e3)/1e3)):new ni(t.copy())}doDeactivate(){this.isActive=!1;let t=this.diagram;this.diagram.layout.isRealtime=this.PP,t.gu=!1,t.bl=!0,t.cacheGroupExternalLinks(!1),t.stopAutoScroll(),this.MP(),t.NP(this.draggedParts),this.uu=null,this.currentPart=null,this.draggedParts=null,this.isDragOutStarted=!1,this.fu=!1,Dt.yF(),this.JC(),this.mc.i(NaN,NaN),Dt.Yh!==null&&(Dt.Yh.currentCursor=""),Dt.Yh=null,Dt.dt=null,this.kl(),t.isMouseCaptured=!1,t.currentCursor="",t.du=!1,this.stopTransaction(),t.CP(!0)}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}MP(){let t=this.diagram,e=t.skipsUndoManager;t.skipsUndoManager=!0;let i=t.lastInput;this.$C(i,null),t.skipsUndoManager=e,this.cr.length=0}ZC(){this.kl(),this.LP();let t=this.diagram;this.mc.isReal()&&(t.position=this.mc),t.stopAutoScroll()}doCancel(){this.kl(),this.LP();let t=this.diagram;this.mc.isReal()&&(t.position=this.mc),this.stopTool()}doKeyDown(){let t=this.diagram;if(!this.isActive)return;let e=t.lastInput,i=t.previousInput;e.code==="Escape"?this.doCancel():(e.code!==i.code||e.modifiers!==i.modifiers)&&this.doMouseMove()}doKeyUp(){this.isActive&&this.doMouseMove()}wF(t,e){let i=1/0,s=1/0,n=-1/0,o=-1/0,r=t.iterator;for(;r.next();){let a=r.value;if(!a.isVisible())continue;let h=a.location,l=h.x,c=h.y;isNaN(l)||isNaN(c)||(l<i&&(i=l),c<s&&(s=c),l>n&&(n=l),c>o&&(o=c))}return i===1/0?e.i(0,0,0,0):e.i(i,s,n-i,o-s),e}AP(t){if(this.copiedParts!==null)return;let e=this.diagram;if(t&&(e.isReadOnly||e.isModelReadOnly)||this.draggedParts===null)return;let i=e.undoManager;i.isEnabled&&i.isInTransaction?i.currentTransaction!==null&&i.currentTransaction.changes.count>0&&(e.undoManager.rollbackTransaction(),e.startTransaction("Drag")):this.LP(),e.skipsUndoManager=!t,e.partManager.addsToTemporaryLayer=!t,this.startPoint=e.firstInput.documentPoint;let s=this.copiesEffectiveCollection?this.draggedParts.toKeySet():e.selection,n=e.copyParts(s,e,!0),o=new pt,r=this.draggedParts.iterator;for(;r.next();){let h=r.key;if(h.ke()&&h.canCopy()){let l=n.get(h);if(l===null)continue;l.location=h.location,l.ensureBounds(),o.set(l,this.Es(l.location))}}let a=n.iterator;for(;a.next();){let h=a.value;h instanceof _&&h.canCopy()&&o.set(h,this.Es())}if(this.copiedParts=o,this.SP(o.toKeySet()),this.draggedLink!==null){let h=this.draggedLink,l=h.routeBounds;h.fr(this.startPoint.x-(l.x+l.width/2),this.startPoint.y-(l.y+l.height/2))}this.doUpdateCursor(null)}kl(){let t=this.diagram;if(this.copiedParts!==null){if(t.removeParts(this.copiedParts.toKeySet(),!1),this.copiedParts=null,this.draggedParts!==null){let e=this.draggedParts.iterator;for(;e.next();)if(e.key instanceof _){let i=e.value;i.point=new P(0,0)}}this.doUpdateCursor(null)}t.skipsUndoManager=!1,t.partManager.addsToTemporaryLayer=!1,this.startPoint=t.firstInput.documentPoint}JC(){this.draggedLink!==null&&(this.dragsLink&&this.nn!==null&&(this.nn.stopDraggingMouseMove(),this.nn.originalLink=null),this.draggedLink=null,this.nn=null)}pc(t,e){if(t===null)return;let i=this.diagram,s=this.startPoint,n=P.l();n.a(i.lastInput.documentPoint),this.moveParts(t,n.subtract(s),e),P.e(n),i.getRenderingHint("temporaryPixelRatio")===!0&&i.Pl===null&&i.avgSpf>30&&(i.Bw(),i.mu())}moveParts(t,e,i){i===void 0&&(i=!1);let s=this.diagram;s!==null&&s.TP(t,e,this.dragOptions,i)}LP(){if(this.draggedParts===null)return;let t=this.diagram,e=this.draggedParts.iterator;for(;e.next();){let i=e.key;i.ke()&&(i.location=e.value.point)}for(e=this.draggedParts.iterator;e.next();){let i=e.key;if(i instanceof _&&i.suspendsRouting){let s=e.value.point;this.draggedParts.set(i,this.Es()),i.fr(-s.x,-s.y)}}t.maybeUpdate()}xF(t){if(t===null)return!0;let e=t.part;return!!(e===null||e instanceof St||e.layer?.isTemporary||this.draggedParts&&this.draggedParts.has(e)||this.copiedParts&&this.copiedParts.has(e))}DP(t){let e=this.diagram;this.dragsLink&&(this.draggedLink!==null&&(this.draggedLink.fromNode=null,this.draggedLink.toNode=null),this.QC(!1));let i=this.findDragOverObject(t),s=e.lastInput;s.targetObject=i,this.doUpdateCursor(i);let n=e.skipsUndoManager,o=!1;try{if(e.skipsUndoManager=!0,o=this.$C(s,i),!this.isActive&&Dt.dt===null)return;let r=i!==null?i.part:null;if(r===null||e.handlesDragDropForTopLevelParts&&r.isTopLevel&&!(r instanceof ft)){let a=e.mouseDragOver;a!==null&&(a(s),o=!0)}if(!this.isActive&&Dt.dt===null||(this.doDragOver(t,i),!this.isActive&&Dt.dt===null))return}finally{e.skipsUndoManager=n,o&&e.maybeUpdate()}this.uu=i,!e.isReadOnly&&(e.allowMove||e.allowCopy)&&(e.allowHorizontalScroll||e.allowVerticalScroll)&&e.doAutoScroll(s.viewPoint)}findDragOverObject(t){return this.diagram.FP(t,null,e=>!this.xF(e))}doUpdateCursor(t){let e=this.diagram;(t===null||this.uu!==t)&&(!this.diagram.currentTool.isActive||this.mayCopy()?e.currentCursor=this.copyCursor:this.mayMove()?e.currentCursor=this.moveCursor:this.mayDragOut()&&(e.currentCursor=this.nodropCursor))}$C(t,e){let i=!1,s=this.cr.length,n=s>0?this.cr[0]:null;if(e===n)return!1;t.handled=!1;for(let r=0;r<s;r++){let a=this.cr[r],h=a.mouseDragLeave;if(h!==null&&(h(t,a,e),i=!0,t.handled))break}if(this.cr.length=0,!this.isActive&&Dt.dt===null||e===null)return i;t.handled=!1;let o=e;for(;o!==null;)this.cr.push(o),o=this._C(o);s=this.cr.length;for(let r=0;r<s;r++){let a=this.cr[r],h=a.mouseDragEnter;if(h!==null&&(h(t,a,n),i=!0,t.handled))break}return i}ME(t,e){return t===null?!1:!!(t===e||t.isContainedBy(e)||e instanceof ft&&!(t instanceof ft)&&e.handlesDragDropForMembers&&t.part?.isMemberOf(e))}_C(t){let e=t.panel;if(e!==null)return e;if(t instanceof Nt&&!(t instanceof ft)){let i=t.containingGroup;if(i!==null&&i.handlesDragDropForMembers)return i}return null}tL(t,e){let i=this.diagram,s=this.nn;if(s===null)return null;let n=s.portGravity,o=i.findObjectsNear(t,n,l=>s.findValidLinkablePort(l,e)),r=P.l(),a=1/0,h=null;for(let l=o.iterator;l.next();){let c=l.value;if(c.part===null)continue;let u=c.getDocumentPoint(D.Center,r),d=t.distanceSquaredPoint(u);d<a&&(h=c,a=d)}return P.e(r),h}QC(t){let e=this.draggedLink;if(e!==null){if(e.pointsCount<2)return;let i=this.diagram;if(i.isReadOnly)return;let s=this.nn;if(s===null)return;let n=null,o=null;e.fromNode===null&&(n=this.tL(e.getPoint(0),!1),n!==null&&(o=n.part));let r=null,a=null;e.toNode===null&&(r=this.tL(e.getPoint(e.pointsCount-1),!0),r!==null&&(a=r.part)),s.isValidLink(o,n,a,r)?t?(e.defaultFromPoint=e.getPoint(0),e.defaultToPoint=e.getPoint(e.pointsCount-1),e.suspendsRouting=!1,e.fromNode=o,n!==null&&(e.fromPortId=n.portId),e.toNode=a,r!==null&&(e.toPortId=r.portId),e.fromPort!==i.RP&&i.D("LinkRelinked",e,i.RP),e.toPort!==i.vP&&i.D("LinkRelinked",e,i.vP)):s.doDraggingMouseMove(o,n,a,r):s.doDraggingMouseMove(null,null,null,null)}}doDragOver(t,e){}iL(t){let e=this.diagram;this.dragsLink&&this.QC(!0),this.MP();let i=this.findDragOverObject(t),s=e.lastInput;if(s.targetObject=i,i!==null){s.handled=!1;let a=i;for(;a!==null;){let h=a.mouseDrop;if(h!==null&&(h(s,a),s.handled))break;this.bF(s,a),a=this._C(a)}}else{let a=e.mouseDrop;a!==null&&a(s)}if(!this.isActive&&Dt.dt===null)return;let n=this.copiedParts||this.draggedParts;if(n!==null){let a=n.iterator;for(;a.next();){let h=a.key;h instanceof rt&&h.linksConnected.each(l=>l.suspendsRouting=!1)}}if(this.doDropOnto(t,i),!this.isActive&&Dt.dt===null)return;let o=z.l(),r=e.selection.iterator;for(;r.next();){let a=r.value;a instanceof rt&&this.kF(e,a,o)}z.e(o)}bF(t,e){let i=this.diagram,s=e.part;if(i.handlesDragDropForTopLevelParts&&s!==null&&s.isTopLevel&&!(s instanceof ft)){let n=i.mouseDrop;n!==null&&n(t)}}kF(t,e,i){if(!e.canAvoid())return;let s=!1;i=e.getAvoidableRect(i),t.viewportBounds.containsRect(i)&&(s=!0);let n=this.copiedParts||this.draggedParts;if(n===null)return;let o=t.OP(i,a=>a.part,a=>a instanceof _,!0,a=>a instanceof _,s);if(o.count===0)return;let r=o.iterator;for(;r.next();){let a=r.value;n.has(a)&&n.has(e)||!a.isMemberOf(e)&&a.isAvoiding&&a.invalidateRoute()}}doDropOnto(t,e){}doMouseMove(){if(!this.isActive)return;let t=this.diagram,e=t.lastInput;this.simulatedMouseMove(e.event,e.documentPoint,e.targetDiagram)||this.currentPart!==null&&this.draggedParts!==null&&(this.mayCopy()?(this.AP(!1),this.pc(this.copiedParts,!1)):this.mayMove()?(this.kl(),this.pc(this.draggedParts,!0)):this.mayDragOut()?(this.AP(!1),this.pc(this.copiedParts,!1)):this.kl(),this.DP(t.lastInput.documentPoint))}doMouseUp(){if(!this.isActive)return;let t=this.diagram,e=t.lastInput;if(this.simulatedMouseUp(e.event,e.documentPoint,e.targetDiagram))return;let i=!1,s=this.mayCopy();if(s&&this.copiedParts!==null?(this.kl(),this.AP(!0),this.pc(this.copiedParts,!1),this.copiedParts!==null&&(t.D("ChangingSelection",t.selection),t.clearSelection(!0),this.copiedParts.iteratorKeys.each(n=>{n.isSelected=!0}))):(i=!0,this.kl(),this.mayMove()&&(this.pc(this.draggedParts,!0),this.DP(t.lastInput.documentPoint))),this.fu=!0,this.iL(t.lastInput.documentPoint),this.isActive){let n=s&&this.copiedParts,o=n?this.copiedParts?.toKeySet():this.draggedParts?this.draggedParts.toKeySet():null;this.copiedParts=null,i&&this.PF(),t.invalidateDocumentBounds(),t.NP(this.draggedParts),this.transactionResult=n?"Copy":"Move",t.D(n?"SelectionCopied":"SelectionMoved",o)}this.stopTool(),s&&t.D("ChangedSelection",t.selection)}simulatedMouseMove(t,e,i){if(Dt.dt===null)return!1;let s=Dt.dt.diagram;i instanceof q||(i=null);let n=Dt.Yh;if(i!==n){if(n!==null&&n!==s){n.stopAutoScroll(),Dt.dt.isDragOutStarted=!1;let r=n.toolManager.findTool("Dragging");r!==null&&r.doSimulatedDragLeave()}if(Dt.Yh=i,i!==null&&i!==s){Dt.dt.ZC();let r=i.toolManager.findTool("Dragging");r!==null&&(r.eL(),r.doSimulatedDragEnter())}this.doUpdateCursor(null)}if(i===null||i===s||!i.allowDrop||i.isReadOnly||!i.allowInsert)return!1;let o=i.toolManager.findTool("Dragging");if(o!==null){let r=e;t!==null&&(t.targetTouches!==void 0&&(t.targetTouches.length>0?t=t.targetTouches[0]:t.changedTouches.length>0&&(t=t.changedTouches[0])),r=i.getMouse(t)),i.lastInput.documentPoint=r,i.lastInput.viewPoint=i.transformDocToView(r),i.lastInput.down=!1,i.lastInput.up=!1,o.doSimulatedDragOver()}return!0}simulatedMouseUp(t,e,i){if(Dt.dt===null)return!1;let s=Dt.Yh,n=Dt.dt.diagram;if(i===null)return Dt.dt.doCancel(),!0;if(i!==s){if(s!==null){let r=s.toolManager.findTool("Dragging");if(s!==null&&s!==n&&r!==null)return s.stopAutoScroll(),Dt.dt.isDragOutStarted=!1,r.doSimulatedDragLeave(),!1}Dt.Yh=i;let o=i.toolManager.findTool("Dragging");o!==null&&(Dt.dt.ZC(),o.eL(),o.doSimulatedDragEnter())}if(i!==this.diagram){let o=e;t!==null?(t.targetTouches!==void 0&&(t.targetTouches.length>0?t=t.targetTouches[0]:t.changedTouches.length>0&&(t=t.changedTouches[0])),o=i.getMouse(t)):o===null&&(o=new P),i.lastInput.documentPoint=o,i.lastInput.viewPoint=i.transformDocToView(o),i.lastInput.down=!1,i.lastInput.up=!0;let r=i.toolManager.findTool("Dragging");r!==null&&r.doSimulatedDrop();let a=Dt.dt;if(a!==null){let h=a.mayCopy();a.transactionResult=h?"Copy":"Move",a.stopTool()}return!0}return!1}PF(){if(this.draggedParts===null)return;let t=this.draggedParts.iterator;for(;t.next();){let e=t.key;if(e instanceof rt){let i=e.containingGroup;i!==null&&i.hasPlaceholder()&&!this.draggedParts.has(i)&&i.placeholder.c()}}}mayCopy(){if(!this.isCopyEnabled)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowCopy||!(f.tr?t.lastInput.alt:t.lastInput.control))return!1;let e=t.selection.iterator;for(;e.next();)if(e.value.canCopy())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canCopy())}mayDragOut(){if(!this.isCopyEnabled)return!1;let t=this.diagram;if(!t.allowDragOut||!t.allowCopy||t.allowMove)return!1;let e=t.selection.iterator;for(;e.next();)if(e.value.canCopy())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canCopy())}mayMove(){let t=this.diagram;if(t.isReadOnly||!t.allowMove)return!1;let e=t.selection.iterator;for(;e.next();)if(e.value.canMove())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canMove())}eL(){Dt.Vw.has(this)||Dt.Vw.add(this)}static yF(){if(Dt.Vw.count>0){let t=Dt.Vw,e=t.length;for(let i=0;i<e;i++){let s=t.elt(i);s.JC(),s.kl(),s.MP(),s.diagram.stopAutoScroll()}t.clear()}}computeBorder(t,e,i){return!this.fu&&this.draggedParts!==null&&!this.draggedParts.has(t)?i.a(e):null}getDraggingSource(){return Dt.dt}mayDragIn(){let t=this.diagram;if(!t.allowDrop||t.isReadOnly||t.isModelReadOnly||!t.allowInsert)return!1;let e=Dt.dt;return!(e===null||e.diagram.model.dataFormat!==t.model.dataFormat)}doSimulatedDragEnter(){if(!this.mayDragIn())return;let t=this.diagram;t.animationManager.stopAnimation(),t.ur(),t.animationManager.stopAnimation();let e=Dt.dt;e!==null&&(this.diagram.du=!0,t.lastInput.event===null&&(t.lastInput.event=e.diagram.lastInput.event)),this.doUpdateCursor(null)}doSimulatedDragLeave(){let t=Dt.dt;t!==null&&t.doSimulatedDragOut(),this.diagram.du=!1,this.doCancel()}doSimulatedDragOver(){let t=this.diagram;t.animationManager.pu=!0;let e=Dt.dt;if(e!==null&&e.draggedParts!==null){if(!this.mayDragIn())return;this.sL(e.draggedParts.toKeySet(),!1,t.firstInput),this.pc(this.copiedParts,!1),this.DP(t.lastInput.documentPoint)}t.animationManager.pu=!1}doSimulatedDrop(){let t=this.diagram,e=Dt.dt;if(e!==null){let i=e.diagram;if(e.fu=!0,this.kl(),e.draggedParts===null||!this.mayDragIn())return;t.animationManager.pu=!0,t.D("ChangingSelection",t.selection),this.startTransaction("Drop"),this.sL(e.draggedParts.toKeySet(),!0,t.lastInput),this.pc(this.copiedParts,!1);let s=new I;this.copiedParts!==null&&(t.clearSelection(!0),this.copiedParts.iteratorKeys.each(n=>{n.isSelected=!0,s.add(n)})),this.iL(t.lastInput.documentPoint),t.invalidateDocumentBounds(),this.copiedParts!==null&&(this.transactionResult="ExternalCopy"),this.copiedParts=null,t.doFocus(),t.du=!1,t.D("ExternalObjectsDropped",s,i),this.stopTransaction(),t.D("ChangedSelection",t.selection)}t.animationManager.pu=!1}sL(t,e,i){if(this.copiedParts!==null)return;let s=this.diagram;if(s.isReadOnly||s.isModelReadOnly)return;s.skipsUndoManager=!e,s.partManager.addsToTemporaryLayer=!e,this.startPoint=i.documentPoint;let n=s.copyParts(t,s,!0),o=z.l();this.wF(t,o);let r=o.x+o.width/2,a=o.y+o.height/2;z.e(o);let h=this.gm,l=new pt,c=P.l(),u=t.iterator;for(;u.next();){let g=u.value;if(g instanceof _&&g.canCopy()){let p=n.get(g);if(p===null)continue;p.points=g.points,p.fr(h.x-r,h.y-a),p.suspendsRouting=!0,l.set(p,this.Es())}}let d=t.iterator;for(;d.next();){let g=d.value;if(g.ke()&&g.canCopy()){let p=n.get(g);if(p===null)continue;let m=g.location;c.i(h.x-(r-m.x),h.y-(a-m.y)),p.location=c,p.ensureBounds(),l.set(p,this.Es(c))}}if(P.e(c),this.copiedParts=l,this.SP(l.toKeySet()),this.draggedLink!==null){let g=this.draggedLink,p=g.routeBounds;g.fr(this.startPoint.x-(p.x+p.width/2),this.startPoint.y-(p.y+p.height/2))}this.doUpdateCursor(null)}pF(){this.isDragOutStarted=!0,this.fu=!1,Dt.dt=this,Dt.Yh=this.diagram,this.doSimulatedDragOut()}doSimulatedDragOut(){let t=this.diagram;!this.mayCopy()&&!this.mayMove()?t.currentCursor=this.nodropCursor:t.currentCursor="",this.uu=null}computeMove(t,e,i,s){let n=this.diagram;return n!==null?n.computeMove(t,e,this.dragOptions,s):new P}static Vw=new G;static dt=null;static Yh=null}xe.prototype.doCancel=function(){Dt.dt!==null&&Dt.dt.doCancel(),ee.prototype.doCancel.call(this)};class Ge extends ee{IP;EP;Sl;UP;BP;Gh;VP;Kh;zP;XP;YP;GP;KP;jP;nL;HP;Ml;qP;constructor(){super(),this.IP=100,this.EP=!1,this.Sl="pointer",this.UP=new _({layerName:"Tool"}).add(new ct({isPanelMain:!0,stroke:"blue"}).theme("stroke","tempLink"),new ct({toArrow:"Standard",fill:"blue",stroke:"blue"}).theme("fill","tempLink").theme("stroke","tempLink")).Et(),this.Gh=new ct("Rectangle",{portId:"",fill:null,stroke:"magenta",strokeWidth:2,desiredSize:Q.Uk}).theme("stroke","tempPort"),this.BP=new rt({selectable:!1,layerName:"Tool"}).add(this.Gh).Et(),this.Kh=new ct("Rectangle",{portId:"",fill:null,stroke:"magenta",strokeWidth:2,desiredSize:Q.Uk}).theme("stroke","tempPort"),this.VP=new rt({selectable:!1,layerName:"Tool"}).add(this.Kh).Et(),this.zP=null,this.XP=null,this.YP=null,this.GP=null,this.KP=null,this.jP=!0,this.nL=new pt,this.HP=null,this.Ml=null,this.qP=null}doStop(){this.diagram.stopAutoScroll(),this.originalLink=null,this.originalFromNode=null,this.originalFromPort=null,this.originalToNode=null,this.originalToPort=null,this.validPortsCache.clear(),this.targetPort=null}get portGravity(){return this.IP}set portGravity(t){f.s(t,"number",Ge,"portGravity"),t>=0&&(this.IP=t)}get isUnconnectedLinkValid(){return this.EP}set isUnconnectedLinkValid(t){f.s(t,"boolean",Ge,"isUnconnectedLinkValid"),this.EP=t}get linkingCursor(){return this.Sl}set linkingCursor(t){this.Sl=t}get temporaryLink(){return this.UP}set temporaryLink(t){t.Et(),this.UP=t}get temporaryFromNode(){return this.BP}set temporaryFromNode(t){t.Et(),this.BP=t,t&&(this.Gh=t.port)}get temporaryFromPort(){return this.Gh}set temporaryFromPort(t){if(this.Gh!==null){let e=this.Gh.panel;if(e!==null){let i=e.C.indexOf(this.Gh);e.removeAt(i),e.insertAt(i,t)}}this.Gh=t}get temporaryToNode(){return this.VP}set temporaryToNode(t){t.Et(),this.VP=t,t&&(this.Kh=t.port)}get temporaryToPort(){return this.Kh}set temporaryToPort(t){if(this.Kh!==null){let e=this.Kh.panel;if(e!==null){let i=e.C.indexOf(this.Kh);e.removeAt(i),e.insertAt(i,t)}}this.Kh=t}get originalLink(){return this.zP}set originalLink(t){this.zP=t}get originalFromNode(){return this.XP}set originalFromNode(t){this.XP=t}get originalFromPort(){return this.YP}set originalFromPort(t){this.YP=t}get originalToNode(){return this.GP}set originalToNode(t){this.GP=t}get originalToPort(){return this.KP}set originalToPort(t){this.KP=t}get isForwards(){return this.jP}set isForwards(t){this.jP=t}get validPortsCache(){return this.nL}get targetPort(){return this.HP}set targetPort(t){this.HP=t}copyPortProperties(t,e,i,s,n){if(t===null||e===null||i===null||s===null)return;let o=e.getDocumentScale(),r=Q.l();r.width=e.naturalBounds.width*o,r.height=e.naturalBounds.height*o,s.desiredSize=r,Q.e(r),n?(s.toSpot=e.toSpot,s.toEndSegmentLength=e.toEndSegmentLength):(s.fromSpot=e.fromSpot,s.fromEndSegmentLength=e.fromEndSegmentLength),i.locationSpot=D.Center;let a=P.l();i.location=e.getDocumentPoint(D.Center,a),P.e(a),s.angle=e.getDocumentAngle(),this.portTargeted!==null&&this.portTargeted(t,e,i,s,n)}setNoTargetPortProperties(t,e,i){e!==null&&(e.desiredSize=Q.Uk,e.fromSpot=D.None,e.toSpot=D.None),t!==null&&(t.location=this.diagram.lastInput.documentPoint),this.portTargeted!==null&&this.portTargeted(null,null,t,e,i)}doMouseDown(){this.isActive&&this.doMouseMove()}doMouseMove(){if(this.isActive){let t=this.diagram;if(this.targetPort=this.findTargetPort(this.isForwards),this.targetPort!==null&&this.targetPort.part instanceof rt){let e=this.targetPort.part;this.isForwards?this.copyPortProperties(e,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(e,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(t.allowHorizontalScroll||t.allowVerticalScroll)&&t.doAutoScroll(t.lastInput.viewPoint)}}findValidLinkablePort(t,e){if(t===null)return null;let i=t.part;if(!(i instanceof rt))return null;for(;t!==null;){let s=e?t.toLinkable:t.fromLinkable;if(s===!0&&(t.portId!==null||t instanceof rt)&&(e?this.isValidTo(i,t):this.isValidFrom(i,t)))return t;if(s===!1)return null;t=t.panel}return null}findTargetPort(t){let e=this.diagram,i=e.lastInput.documentPoint,s=this.portGravity,n=e.findObjectsNear(i,s,h=>this.findValidLinkablePort(h,t),null,!0),o=1/0,r=null,a=n.iterator;for(;a.next();){let h=a.value,l=h.part;if(!(l instanceof rt))continue;let c=h.getDocumentPoint(D.Center,P.l()),u=i.x-c.x,d=i.y-c.y;P.e(c);let g=u*u+d*d;if(g<o){let p=this.validPortsCache.get(h);p!==null?p&&(r=h,o=g):t&&this.isValidLink(this.originalFromNode,this.originalFromPort,l,h)||!t&&this.isValidLink(l,h,this.originalToNode,this.originalToPort)?(this.validPortsCache.set(h,!0),r=h,o=g):this.validPortsCache.set(h,!1)}}if(r!==null){let h=r.part;if(h instanceof rt&&(h.layer===null||h.layer.allowLink))return r}return null}isValidFrom(t,e){if(t===null||e===null)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(t.layer!==null&&!t.layer.allowLink||e.fromLinkable!==!0))return!1;let i=e.fromMaxLinks;if(i<1/0){if(this.originalLink!==null&&t===this.originalFromNode&&e===this.originalFromPort)return!0;let s=e.portId;if(s===null&&(s=""),t.findLinksOutOf(s).count>=i)return!1}return!0}isValidTo(t,e){if(t===null||e===null)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(t.layer!==null&&!t.layer.allowLink||e.toLinkable!==!0))return!1;let i=e.toMaxLinks;if(i<1/0){if(this.originalLink!==null&&t===this.originalToNode&&e===this.originalToPort)return!0;let s=e.portId;if(s===null&&(s=""),t.findLinksInto(s).count>=i)return!1}return!0}isInSameNode(t,e){if(t===null||e===null)return!1;if(t===e)return!0;let i=t.part,s=e.part;return i!==null&&i===s}isLinked(t,e){if(t===null||e===null)return!1;let i=t.part;if(!(i instanceof rt))return!1;let s=t.portId;s===null&&(s="");let n=e.part;if(!(n instanceof rt))return!1;let o=e.portId;o===null&&(o="");let r=n.findLinksInto(o);for(;r.next();){let a=r.value;if(a.fromNode===i&&a.fromPortId===s)return!0}return!1}isValidLink(t,e,i,s){if(!this.isValidFrom(t,e)||!this.isValidTo(i,s)||e!==null&&s!==null&&(!(e.fromLinkableSelfNode&&s.toLinkableSelfNode)&&this.isInSameNode(e,s)||!(e.fromLinkableDuplicates&&s.toLinkableDuplicates)&&this.isLinked(e,s))||this.originalLink!==null&&(t!==null&&this.isLabelDependentOnLink(t,this.originalLink)||i!==null&&this.isLabelDependentOnLink(i,this.originalLink))||t!==null&&i!==null&&(t.data===null&&i.data!==null||t.data!==null&&i.data===null)||!this.isValidCycle(t,i,this.originalLink))return!1;let n;return t!==null&&e!==null&&(n=t.linkValidation,n!==null&&!n(t,e,i,s,this.originalLink))||i!==null&&s!==null&&(n=i.linkValidation,n!==null&&!n(t,e,i,s,this.originalLink))?!1:(n=this.linkValidation,n!==null?n(t,e,i,s,this.originalLink):!0)}isLabelDependentOnLink(t,e){if(t===null)return!1;let i=t.labeledLink;if(i===null)return!1;if(i===e)return!0;let s=new I;return s.add(t),this.WP(i,e,s)}WP(t,e,i){if(t===e)return!0;let s=t.fromNode;if(s!==null&&s.labeledLink&&(i.add(s),this.WP(s.labeledLink,e,i)))return!0;let n=t.toNode;return!!(n!==null&&n.labeledLink&&(i.add(n),this.WP(n.labeledLink,e,i)))}isValidCycle(t,e,i){if(i===void 0&&(i=null),t===null||e===null)return this.isUnconnectedLinkValid;let s=this.diagram,n=1;if(s&&(s.model.pm()?n=s.isTreePathToChildren?5:6:n=s.validCycle),n===1)return!0;if(n===5){let o=i||this.temporaryLink;if(o!==null&&!o.isTreeLink)return!0;let r=e.linksConnected;for(;r.next();){let a=r.value;if(a!==i&&a.isTreeLink&&a.toNode===e)return!1}return!this.yu(t,e,i,!0)}else if(n===6){let o=i||this.temporaryLink;if(o!==null&&!o.isTreeLink)return!0;let r=t.linksConnected;for(;r.next();){let a=r.value;if(a!==i&&a.isTreeLink&&a.fromNode===t)return!1}return!this.yu(t,e,i,!0)}else{if(n===2)return!this.SF(t,e,i);if(n===3)return!this.yu(t,e,i,!1);if(n===4)return!this.MF(t,e,i)}return!0}yu(t,e,i,s){if(t===e)return!0;if(t===null||e===null)return!1;let n=t.linksConnected;for(;n.next();){let o=n.value;if(o===i||s&&!o.isTreeLink||o.toNode!==t)continue;let r=o.fromNode;if(!(r===t||r===null)&&this.yu(r,e,i,s))return!0}return!1}SF(t,e,i){if(t===e)return!0;let s=new I;return s.add(e),this.oL(s,t,e,i)}oL(t,e,i,s){if(e===i)return!0;if(e===null||i===null||t.has(e))return!1;t.add(e);let n=e.linksConnected;for(;n.next();){let o=n.value;if(o===s||o.toNode!==e)continue;let r=o.fromNode;if(!(r===e||r===null)&&this.oL(t,r,i,s))return!0}return!1}MF(t,e,i){if(t===e)return!0;let s=new I;return s.add(e),this.rL(s,t,e,i)}rL(t,e,i,s){if(e===i)return!0;if(e===null||i===null||t.has(e))return!1;t.add(e);let n=e.linksConnected;for(;n.next();){let o=n.value;if(o===s)continue;let r=o.fromNode,a=o.toNode,h=r===e?a:r;if(!(h===e||h===null)&&this.rL(t,h,i,s))return!0}return!1}get linkValidation(){return this.Ml}set linkValidation(t){t!==null&&f.k(t,Ge,"linkValidation"),this.Ml=t}get portTargeted(){return this.qP}set portTargeted(t){t!==null&&f.k(t,Ge,"portTargeted"),this.qP=t}}var yn=(x=>(x[x.Either=1]="Either",x[x.ForwardsOnly=2]="ForwardsOnly",x[x.BackwardsOnly=3]="BackwardsOnly",x))(yn||{});class Li extends Ge{JP;$P;b;ZP;constructor(t){super(),this.name="Linking",this.JP={},this.$P=null,this.b=1,this.ZP=null,t&&Object.assign(this,t)}static Either=1;static ForwardsOnly=2;static BackwardsOnly=3;get archetypeLinkData(){return this.JP}set archetypeLinkData(t){t!==null&&f.ec(t,Li,"archetypeLinkData"),this.JP=t}get archetypeLabelNodeData(){return this.$P}set archetypeLabelNodeData(t){t!==null&&f.ec(t,Li,"archetypeLabelNodeData"),this.$P=t}get direction(){return this.b}set direction(t){this.b=t}get startObject(){return this.ZP}set startObject(t){this.ZP=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||t.isModelReadOnly||!t.allowLink||!t.model.zw()||!t.lastInput.left||t.currentTool!==this&&!this.isBeyondDragSize()?!1:this.findLinkablePort()!==null}findLinkablePort(){let t=this.diagram,e=this.startObject;if(e===null&&(e=t.findObjectAt(t.firstInput.documentPoint,null,null)),e===null)return null;let i=e.part;if(!(i instanceof rt))return null;let s=this.direction;if(s===1||s===2){let n=this.findValidLinkablePort(e,!1);if(n!==null)return this.isForwards=!0,n;if(this.startObject===i){let o=i.port;if(this.findValidLinkablePort(o,!1))return this.isForwards=!0,o}}if(s===1||s===3){let n=this.findValidLinkablePort(e,!0);if(n!==null)return this.isForwards=!1,n;if(this.startObject===i){let o=i.port;if(this.findValidLinkablePort(o,!0))return this.isForwards=!1,o}}return null}doActivate(){let t=this.diagram,e=this.findLinkablePort();if(e===null){this.stopTool();return}if(this.startTransaction(this.name),t.isMouseCaptured=!0,t.currentCursor=this.linkingCursor,this.isForwards){this.temporaryToNode!==null&&(this.temporaryToNode.location=t.lastInput.documentPoint),this.originalFromPort=e;let i=this.originalFromPort.part;i instanceof rt&&(this.originalFromNode=i),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else{this.temporaryFromNode!==null&&(this.temporaryFromNode.location=t.lastInput.documentPoint),this.originalToPort=e;let i=this.originalToPort.part;i instanceof rt&&(this.originalToNode=i),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)}t.add(this.temporaryFromNode),this.temporaryFromNode&&this.temporaryFromNode.ensureBounds(),t.add(this.temporaryToNode),this.temporaryToNode&&this.temporaryToNode.ensureBounds(),this.temporaryLink!==null&&(this.temporaryFromNode!==null&&(this.temporaryLink.fromNode=this.temporaryFromNode),this.temporaryToNode!==null&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.invalidateRoute(),t.add(this.temporaryLink)),this.isActive=!0}doDeactivate(){this.isActive=!1;let t=this.diagram;t.remove(this.temporaryLink),t.remove(this.temporaryFromNode),t.remove(this.temporaryToNode),t.isMouseCaptured=!1,t.currentCursor="",this.stopTransaction()}doStop(){super.doStop(),this.startObject=null}doMouseUp(){if(this.isActive){let t=this.diagram;this.transactionResult=null;let e=null,i=null,s=null,n=null,o=null;try{this.targetPort=this.findTargetPort(this.isForwards);let r=this.targetPort;if(r!==null){let a=r.part;a instanceof rt&&(this.isForwards?(this.originalFromNode!==null&&(e=this.originalFromNode,i=this.originalFromPort),s=a,n=r):(e=a,i=r,this.originalToNode!==null&&(s=this.originalToNode,n=this.originalToPort)))}else this.isForwards?this.originalFromNode!==null&&this.isUnconnectedLinkValid&&(e=this.originalFromNode,i=this.originalFromPort):this.originalToNode!==null&&this.isUnconnectedLinkValid&&(s=this.originalToNode,n=this.originalToPort);e!==null||s!==null?(o=this.insertLink(e,i,s,n),o!==null?(r===null&&(this.isForwards?o.defaultToPoint=t.lastInput.documentPoint:o.defaultFromPoint=t.lastInput.documentPoint),t.allowSelect&&(t.D("ChangingSelection",t.selection),t.clearSelection(!0),o.isSelected=!0),this.transactionResult=this.name,t.D("LinkDrawn",o)):this.doNoLink(e,i,s,n)):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),o&&t.allowSelect&&t.D("ChangedSelection",t.selection)}}}isNewTreeLink(){let t=this.archetypeLinkData;if(t===null)return!0;if(t instanceof _)return t.isTreeLink;let e=this.diagram;if(e===null)return!0;let i=e.partManager.getLinkCategoryForData(t),s=e.partManager.findLinkTemplateForCategory(i);return s!==null?s.isTreeLink:!0}insertLink(t,e,i,s){return this.diagram.partManager.insertLink(t,e,i,s)}doNoLink(t,e,i,s){}}class ys extends Ge{lL=null;hL=null;QP=null;_P=null;fs;tS;constructor(t){super(),this.name="Relinking",this.fromHandleArchetype=new ct("Diamond",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",cursor:this.linkingCursor,segmentIndex:0}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.toHandleArchetype=new ct("Diamond",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",cursor:this.linkingCursor,segmentIndex:-1}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.fs=null,this.tS=new z,t&&Object.assign(this,t)}updateAdornments(t){if(t===null||!(t instanceof _))return;let e="RelinkFrom",i=null;if(t.isSelected&&!this.diagram.isReadOnly){let s=t.selectionObject;s!==null&&t.canRelinkFrom()&&t.actualBounds.isReal()&&t.isVisible()&&s.actualBounds.isReal()&&s.isVisibleObject()&&(i=t.findAdornment(e),i===null&&(i=this.makeAdornment(s,!1),t.addAdornment(e,i)))}if(i===null&&t.removeAdornment(e),e="RelinkTo",i=null,t.isSelected&&!this.diagram.isReadOnly){let s=t.selectionObject;s!==null&&t.canRelinkTo()&&t.actualBounds.isReal()&&t.isVisible()&&s.actualBounds.isReal()&&s.isVisibleObject()&&(i=t.findAdornment(e),i===null?(i=this.makeAdornment(s,!0),t.addAdornment(e,i)):i.c())}i===null&&t.removeAdornment(e)}makeAdornment(t,e){let i=e?this._P:this.QP;return i&&(i=i.copy(),i.adornedObject=t),i}get fromHandleArchetype(){return this.lL}set fromHandleArchetype(t){this.lL=t,t!==null?this.QP=new St(H.Link).add(t).Et():this.QP=null}get toHandleArchetype(){return this.hL}set toHandleArchetype(t){this.hL=t,t!==null?this._P=new St(H.Link).add(t).Et():this._P=null}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowRelink||!t.model.zw()||!t.lastInput.left)return!1;let e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkFrom");return e===null&&(e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkTo")),e!==null}doActivate(){let t=this.diagram;if(this.originalLink===null){let i=this.handle;if(i===null&&(i=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkFrom"),i===null&&(i=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkTo"))),i===null)return;let s=i.part;if(!(s instanceof St)||!(s.adornedPart instanceof _))return;this.handle=i,this.isForwards=s===null||s.category==="RelinkTo",this.originalLink=s.adornedPart}let e=this.originalLink;e!==null&&(this.startTransaction(this.name),t.isMouseCaptured=!0,t.currentCursor=this.linkingCursor,this.originalFromPort=e.fromPort,this.originalFromNode=e.fromNode,this.originalToPort=e.toPort,this.originalToNode=e.toNode,this.tS.set(e.actualBounds),e.pointsCount>0&&(e.fromNode===null&&(this.temporaryFromPort!==null&&(this.temporaryFromPort.desiredSize=Q.sc),this.temporaryFromNode!==null&&(this.temporaryFromNode.location=e.getPoint(0))),e.toNode===null&&(this.temporaryToPort!==null&&(this.temporaryToPort.desiredSize=Q.sc),this.temporaryToNode!==null&&(this.temporaryToNode.location=e.getPoint(e.pointsCount-1)))),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0),t.add(this.temporaryFromNode),t.add(this.temporaryToNode),this.temporaryLink!==null&&(this.temporaryFromNode!==null&&(this.temporaryLink.fromNode=this.temporaryFromNode),this.temporaryToNode!==null&&(this.temporaryLink.toNode=this.temporaryToNode),this.copyLinkProperties(e,this.temporaryLink),this.temporaryLink.invalidateRoute(),t.add(this.temporaryLink)),this.isActive=!0)}copyLinkProperties(t,e){if(t===null||e===null)return;e.adjusting=t.adjusting,e.corner=t.corner;let i=t.curve;(i===11||i===10)&&(i=0),e.curve=i,e.curviness=t.curviness,e.isTreeLink=t.isTreeLink,e.points=t.points,e.routing=t.routing,e.smoothness=t.smoothness,e.fromSpot=t.fromSpot,e.fromEndSegmentLength=t.fromEndSegmentLength,e.fromShortLength=t.fromShortLength,e.toSpot=t.toSpot,e.toEndSegmentLength=t.toEndSegmentLength,e.toShortLength=t.toShortLength}doDeactivate(){this.isActive=!1;let t=this.diagram;t.remove(this.temporaryLink),t.remove(this.temporaryFromNode),t.remove(this.temporaryToNode),t.isMouseCaptured=!1,t.currentCursor="",this.stopTransaction()}doStop(){super.doStop(),this.handle=null}doMouseUp(){if(this.isActive){let t=this.diagram;this.transactionResult=null;let e=this.originalFromNode,i=this.originalFromPort,s=this.originalToNode,n=this.originalToPort,o=this.originalLink;try{if(this.targetPort=this.findTargetPort(this.isForwards),this.targetPort!==null){let r=this.targetPort.part;r instanceof rt&&(this.isForwards?(s=r,n=this.targetPort):(e=r,i=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?(s=null,n=null):(e=null,i=null):o=null;o!==null?(this.reconnectLink(o,this.isForwards?s:e,this.isForwards?n:i,this.isForwards),this.targetPort===null&&(this.isForwards?o.defaultToPoint=t.lastInput.documentPoint:o.defaultFromPoint=t.lastInput.documentPoint,o.invalidateRoute()),this.transactionResult=this.name,t.D("LinkRelinked",o,this.isForwards?this.originalToPort:this.originalFromPort)):this.originalLink!==null&&this.doNoRelink(this.originalLink,this.isForwards),this.originalLink!==null&&this.originalLink.invalidateOtherJumpOvers(this.tS)}finally{this.stopTool()}}}reconnectLink(t,e,i,s){let n=i!==null&&i.portId!==null?i.portId:"";return s?(t.toNode=e,t.toPortId=n):(t.fromNode=e,t.fromPortId=n),!0}doNoRelink(t,e){}doDraggingMouseMove(t,e,i,s){t!==null?(this.copyPortProperties(t,e,this.temporaryFromNode,this.temporaryFromPort,!1),this.diagram.add(this.temporaryFromNode)):this.diagram.remove(this.temporaryFromNode),i!==null?(this.copyPortProperties(i,s,this.temporaryToNode,this.temporaryToPort,!0),this.diagram.add(this.temporaryToNode)):this.diagram.remove(this.temporaryToNode)}stopDraggingMouseMove(){this.diagram.remove(this.temporaryFromNode),this.diagram.remove(this.temporaryToNode)}}var xn=(x=>(x[x.None=0]="None",x[x.Horizontal=1]="Horizontal",x[x.Vertical=2]="Vertical",x[x.All=3]="All",x))(xn||{});class Ji extends ee{dr;iS;eS;fs;Xw;sS;ym;constructor(t){super(),this.name="LinkReshaping",this.dr=new ct("Rectangle",{desiredSize:Q.yC,fill:"lightblue",stroke:"dodgerblue"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.iS=new ct("Diamond",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",cursor:"move"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.eS=3,this.fs=null,this.Xw=null,this.sS=new P,this.ym=new G,t&&Object.assign(this,t)}static None=0;static Horizontal=1;static Vertical=2;static All=3;getReshapingBehavior(t){return t?t.gr:0}setReshapingBehavior(t,e){t.gr=e}updateAdornments(t){if(t===null||!(t instanceof _))return;let e=null;if(t.isSelected&&!this.diagram.isReadOnly){let i=t.path;i!==null&&t.canReshape()&&t.actualBounds.isReal()&&t.isVisible()&&i.actualBounds.isReal()&&i.isVisibleObject()&&(e=t.findAdornment(this.name),(e===null||e.nS!==t.pointsCount||e.oS!==t.resegmentable)&&(e=this.makeAdornment(i),e!==null&&(e.nS=t.pointsCount,e.oS=t.resegmentable,t.addAdornment(this.name,e))))}e===null&&t.removeAdornment(this.name)}makeAdornment(t){let e=t.part,i=e.points,s=e.pointsCount,n=e.isOrthogonal,o=null;if(i!==null&&s>1){o=new St,o.type=H.Link;let r=e.firstPickIndex,a=e.lastPickIndex,h=n?1:0;if(e.resegmentable&&e.computeCurve()!==9)for(let l=r+h;l<a-h;l++){let c=this.makeResegmentHandle(t,l);c!==null&&(c.segmentIndex=l,c.segmentFraction=.5,c.fromMaxLinks=999,o.add(c))}for(let l=r+1;l<a;l++){let c=this.makeHandle(t,l);if(c!==null){if(c.segmentIndex=l,l!==r)if(l===r+1&&n){let u=e.getPoint(r),d=e.getPoint(r+1);L.f(u.x,d.x)&&L.f(u.y,d.y)?(d=e.getPoint(r-1),L.f(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):L.f(u.y,d.y)&&(this.setReshapingBehavior(c,1),c.cursor="w-resize")):L.f(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):L.f(u.y,d.y)&&(this.setReshapingBehavior(c,1),c.cursor="w-resize")}else if(l===a-1&&n){let u=e.getPoint(a-1),d=e.getPoint(a);L.f(u.x,d.x)&&L.f(u.y,d.y)?(u=e.getPoint(a+1),L.f(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):L.f(u.y,d.y)&&(this.setReshapingBehavior(c,1),c.cursor="w-resize")):L.f(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):L.f(u.y,d.y)&&(this.setReshapingBehavior(c,1),c.cursor="w-resize")}else l===a||(this.setReshapingBehavior(c,3),c.cursor="move");o.add(c)}}o.adornedObject=t}return o}makeHandle(t,e){let i=this.handleArchetype;return i===null?null:i.copy().rS()}get handleArchetype(){return this.dr}set handleArchetype(t){this.dr=t}makeResegmentHandle(t,e){let i=this.midHandleArchetype;return i===null?null:i.copy().rS()}get midHandleArchetype(){return this.iS}set midHandleArchetype(t){this.iS=t}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}get adornedLink(){return this.Xw}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||!t.allowReshape||!t.lastInput.left?!1:this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null}doActivate(){let t=this.diagram;if(this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle===null)return;let e=this.handle.part.adornedPart;if(e instanceof _){if(this.Xw=e,t.isMouseCaptured=!0,this.startTransaction(this.name),e.resegmentable&&this.handle.fromMaxLinks===999){let i=e.points.copy(),s=this.getResegmentingPoint();if(i.insertAt(this.handle.segmentIndex+1,s),e.isOrthogonal&&i.insertAt(this.handle.segmentIndex+1,s),e.points=i,e.invalidateAdornments(),e.updateAdornments(),this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name),this.handle===null){this.doDeactivate();return}}this.sS=e.getPoint(this.handle.segmentIndex),this.ym=e.points.copy(),this.isActive=!0}}doDeactivate(){this.stopTransaction(),this.handle=null,this.Xw=null;let t=this.diagram;t.isMouseCaptured=!1,this.isActive=!1}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}doCancel(){let t=this.adornedLink;t!==null&&(t.points=this.ym),this.stopTool()}getResegmentingPoint(){return this.handle===null?this.diagram.lastInput.documentPoint:this.handle.getDocumentPoint(D.Center)}doMouseMove(){let t=this.diagram;if(this.isActive){let e=this.computeReshape(t.lastInput.documentPoint);this.reshape(e)}}doMouseUp(){let t=this.diagram;if(this.isActive){let e=this.computeReshape(t.lastInput.documentPoint);this.reshape(e);let i=this.adornedLink;if(i!==null&&i.resegmentable&&this.handle!==null){let s=this.handle.segmentIndex,n=i.getPoint(s-1),o=i.getPoint(s),r=i.getPoint(s+1);if(i.isOrthogonal){if(s>i.firstPickIndex+1&&s<i.lastPickIndex-1){let a=i.getPoint(s-2);if(this.isWithinResegmentingDistance(n,o)&&(this.isInLineOrtho(a,n,o,r,!0)||this.isInLineOrtho(a,n,o,r,!1))){let h=i.points.copy();this.isInLineOrtho(a,n,o,r,!0)?(h.setElt(s-2,new P(a.x,(r.y+a.y)/2)),h.setElt(s+1,new P(r.x,(r.y+a.y)/2))):(h.setElt(s-2,new P((r.x+a.x)/2,a.y)),h.setElt(s+1,new P((r.x+a.x)/2,r.y))),h.removeAt(s),h.removeAt(s-1),i.points=h,i.invalidateAdornments()}else if(a=i.getPoint(s+2),this.isWithinResegmentingDistance(o,r)&&(this.isInLineOrtho(n,o,r,a,!0)||this.isInLineOrtho(n,o,r,a,!1))){let h=i.points.copy();this.isInLineOrtho(n,o,r,a,!0)?(h.setElt(s-1,new P(n.x,(n.y+a.y)/2)),h.setElt(s+2,new P(a.x,(n.y+a.y)/2))):(h.setElt(s-1,new P((n.x+a.x)/2,n.y)),h.setElt(s+2,new P((n.x+a.x)/2,a.y))),h.removeAt(s+1),h.removeAt(s),i.points=h,i.invalidateAdornments()}}}else{let a=P.l();if(L.dl(n.x,n.y,r.x,r.y,o.x,o.y,a)&&a.distanceSquaredPoint(o)<this.resegmentingDistance*this.resegmentingDistance){let h=i.points.copy();h.removeAt(s),i.points=h,i.invalidateAdornments()}P.e(a)}}t.invalidateDocumentBounds(),this.transactionResult=this.name,t.D("LinkReshaped",this.adornedLink,this.ym)}this.stopTool()}isWithinResegmentingDistance(t,e){return Math.abs(t.x-e.x)<this.resegmentingDistance&&Math.abs(t.y-e.y)<this.resegmentingDistance}isInLineOrtho(t,e,i,s,n){return n?Math.abs(t.y-e.y)<this.resegmentingDistance&&Math.abs(e.y-i.y)<this.resegmentingDistance&&Math.abs(i.y-s.y)<this.resegmentingDistance:Math.abs(t.x-e.x)<this.resegmentingDistance&&Math.abs(e.x-i.x)<this.resegmentingDistance&&Math.abs(i.x-s.x)<this.resegmentingDistance}get resegmentingDistance(){return this.eS}set resegmentingDistance(t){f.s(t,"number",Ji,"resegmentingDistance"),this.eS=t}reshape(t){let e=this.adornedLink;if(e===null)return;let i=this.handle;if(i===null)return;e.startRoute();let s=i.segmentIndex,n=this.getReshapingBehavior(i);if(e.isOrthogonal)if(s===e.firstPickIndex+1){let o=e.firstPickIndex+1;n===2?(e.setPointAt(o,e.getPoint(o-1).x,t.y),e.setPointAt(o+1,e.getPoint(o+2).x,t.y)):n===1&&(e.setPointAt(o,t.x,e.getPoint(o-1).y),e.setPointAt(o+1,t.x,e.getPoint(o+2).y))}else if(s===e.lastPickIndex-1){let o=e.lastPickIndex-1;n===2?(e.setPointAt(o-1,e.getPoint(o-2).x,t.y),e.setPointAt(o,e.getPoint(o+1).x,t.y)):n===1&&(e.setPointAt(o-1,t.x,e.getPoint(o-2).y),e.setPointAt(o,t.x,e.getPoint(o+1).y))}else{let o=s,r=e.getPoint(o),a=e.getPoint(o-1),h=e.getPoint(o+1);L.f(a.x,r.x)&&L.f(r.y,h.y)?(L.f(a.x,e.getPoint(o-2).x)&&!L.f(a.y,e.getPoint(o-2).y)?(e.insertPointAt(o,t.x,a.y),s++,o++):e.setPointAt(o-1,t.x,a.y),L.f(h.y,e.getPoint(o+2).y)&&!L.f(h.x,e.getPoint(o+2).x)?e.insertPointAt(o+1,h.x,t.y):e.setPointAt(o+1,h.x,t.y)):L.f(a.y,r.y)&&L.f(r.x,h.x)?(L.f(a.y,e.getPoint(o-2).y)&&!L.f(a.x,e.getPoint(o-2).x)?(e.insertPointAt(o,a.x,t.y),s++,o++):e.setPointAt(o-1,a.x,t.y),L.f(h.x,e.getPoint(o+2).x)&&!L.f(h.y,e.getPoint(o+2).y)?e.insertPointAt(o+1,t.x,h.y):e.setPointAt(o+1,t.x,h.y)):L.f(a.x,r.x)&&L.f(r.x,h.x)?(L.f(a.x,e.getPoint(o-2).x)&&!L.f(a.y,e.getPoint(o-2).y)?(e.insertPointAt(o,t.x,a.y),s++,o++):e.setPointAt(o-1,t.x,a.y),L.f(h.x,e.getPoint(o+2).x)&&!L.f(h.y,e.getPoint(o+2).y)?e.insertPointAt(o+1,t.x,h.y):e.setPointAt(o+1,t.x,h.y)):L.f(a.y,r.y)&&L.f(r.y,h.y)&&(L.f(a.y,e.getPoint(o-2).y)&&!L.f(a.x,e.getPoint(o-2).x)?(e.insertPointAt(o,a.x,t.y),s++,o++):e.setPointAt(o-1,a.x,t.y),L.f(h.y,e.getPoint(o+2).y)&&!L.f(h.x,e.getPoint(o+2).x)?e.insertPointAt(o+1,h.x,t.y):e.setPointAt(o+1,h.x,t.y)),e.setPointAt(s,t.x,t.y)}else{e.setPointAt(s,t.x,t.y);let o=e.fromNode,r=e.fromPort;if(o!==null){let l=o.findVisibleNode();l!==null&&l!==o&&(o=l,r=o.port)}if(s===1&&r!==null&&e.computeSpot(!0,r).isNoSpot()){let l=r.getDocumentPoint(D.Center,P.l()),c=e.getLinkPointFromPoint(o,r,l,t,!0,P.l());e.setPointAt(0,c.x,c.y),P.e(l),P.e(c)}let a=e.toNode,h=e.toPort;if(a!==null){let l=a.findVisibleNode();l!==null&&l!==a&&(a=l,h=a.port)}if(s===e.pointsCount-2&&h!==null&&e.computeSpot(!1,h).isNoSpot()){let l=h.getDocumentPoint(D.Center,P.l()),c=e.getLinkPointFromPoint(a,h,l,t,!1,P.l());e.setPointAt(e.pointsCount-1,c.x,c.y),P.e(l),P.e(c)}}e.commitRoute()}computeReshape(t){let e=this.adornedLink;if(e===null)return t;let i=this.handle;if(i===null)return t;let s=i.segmentIndex;switch(this.getReshapingBehavior(i)){case 3:return t;case 2:{let n=e.getPoint(s);return new P(n.x,t.y)}case 1:{let n=e.getPoint(s);return new P(t.x,n.y)}default:case 0:return e.getPoint(s)}}get originalPoint(){return this.sS}get originalPoints(){return this.ym}}class Ti extends ee{pr;yr;Po;yc;lS;us;dr;fs;wm;hS;wc;Yw;Gw;Kw;constructor(t){super(),this.name="Resizing",this.pr=new Q(1,1).u(),this.yr=new Q(9999,9999).u(),this.Po=new Q(NaN,NaN).u(),this.yc=!1,this.lS=!0,this.us=null,this.dr=new ct("Rectangle",{alignmentFocus:D.Center,desiredSize:Q.yC,fill:"lightblue",stroke:"dodgerblue",strokeWidth:1,cursor:"pointer"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.fs=null,this.wm=new P,this.hS=new Q,this.wc=new P,this.Yw=new Q(0,0),this.Gw=new Q(1/0,1/0),this.Kw=new Q(1,1),t&&Object.assign(this,t)}updateAdornments(t){if(!(t===null||t instanceof _)){if(t.isSelected&&!this.diagram.isReadOnly){let e=t.resizeObject,i=t.findAdornment(this.name);if(e!==null&&t.canResize()&&t.actualBounds.isReal()&&t.isVisible()&&e.actualBounds.isReal()&&e.isVisibleObject()&&((i===null||i.adornedObject!==e)&&(i=this.makeAdornment(e)),i!==null)){let s=e.getDocumentAngle();t.Nl()&&this.updateResizeHandles(i,s),t.addAdornment(this.name,i);return}}t.removeAdornment(this.name)}}makeAdornment(t){let e=null,i=t.part?.resizeAdornmentTemplate;if(i){if(e=i.copy(),e===null)return null}else{e=new St,e.type=H.Spot,e.locationSpot=D.Center;let s=new ve;s.isPanelMain=!0,e.add(s);let n=this.makeHandle(t,D.TopLeft);n!==null&&e.add(n),n=this.makeHandle(t,D.TopRight),n!==null&&e.add(n),n=this.makeHandle(t,D.BottomRight),n!==null&&e.add(n),n=this.makeHandle(t,D.BottomLeft),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleTop),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleRight),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleBottom),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleLeft),n!==null&&e.add(n)}return e.adornedObject=t,e}makeHandle(t,e){let i=this.handleArchetype;if(i===null)return null;let s=i.copy().rS();return s.alignment=e,s}updateResizeHandles(t,e){if(t!==null){if(!t.alignment.isDefault()&&(t.cursor==="pointer"||t.cursor.indexOf("resize")>0))this.NF(t,e);else if(t instanceof H){let i=t.elements;for(;i.next();){let s=i.value;this.updateResizeHandles(s,e)}}}}NF(t,e){let i=t.alignment;i.isNoSpot()&&(i=D.Center);let s=e;if(i.x<=0)i.y<=0?s+=225:i.y>=1?s+=135:s+=180;else if(i.x>=1)i.y<=0?s+=315:i.y>=1&&(s+=45);else if(i.y<=0)s+=270;else if(i.y>=1)s+=90;else return;s<0?s+=360:s>=360&&(s-=360),s<22.5?t.cursor="e-resize":s<67.5?t.cursor="se-resize":s<112.5?t.cursor="s-resize":s<157.5?t.cursor="sw-resize":s<202.5?t.cursor="w-resize":s<247.5?t.cursor="nw-resize":s<292.5?t.cursor="n-resize":s<337.5?t.cursor="ne-resize":t.cursor="e-resize"}get handleArchetype(){return this.dr}set handleArchetype(t){this.dr=t}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}get adornedObject(){return this.us}set adornedObject(t){t!==null&&t.part instanceof St&&f.o("new handle must not be in an Adornment: "+t),this.us=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||!t.allowResize||!t.lastInput.left?!1:this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null}doActivate(){let t=this.diagram;this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle!==null&&(this.adornedObject=this.handle.part.adornedObject,this.adornedObject!==null&&this.adornedObject.part!==null&&(t.isMouseCaptured=!0,t.animationManager.stopAnimation(),t.gu=!0,this.startTransaction(this.name),this.wm.set(this.adornedObject.getDocumentPoint(this.handle.alignment.opposite())),this.wc.set(this.adornedObject.part.location),this.hS.set(this.adornedObject.desiredSize),this.Kw=this.computeCellSize(),this.Yw=this.computeMinSize(),this.Gw=this.computeMaxSize(),this.isActive=!0))}doDeactivate(){let t=this.diagram;t.gu=!1,t.bl=!0,this.stopTransaction(),this.handle=null,this.us=null,t.isMouseCaptured=!1,this.isActive=!1}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}doCancel(){this.adornedObject!==null&&this.adornedObject.part!==null&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation),this.stopTool()}doMouseMove(){let t=this.diagram;if(!this.isActive||this.adornedObject===null||this.handle===null)return;let e=this.Yw,i=this.Gw,s=this.Kw,n=t.lastInput.documentPoint,o=this.adornedObject.getLocalPoint(n,P.l()),r=this.computeReshape(),a=this.computeResize(o,this.handle.alignment,e,i,s,r);this.resize(a),t.maybeUpdate(),P.e(o)}doMouseUp(){let t=this.diagram;if(this.isActive&&this.adornedObject!==null&&this.handle!==null){let e=this.Yw,i=this.Gw,s=this.Kw,n=this.adornedObject.getLocalPoint(t.lastInput.documentPoint,P.l()),o=this.computeReshape(),r=this.computeResize(n,this.handle.alignment,e,i,s,o);this.resize(r),P.e(n),t.invalidateDocumentBounds(),this.transactionResult=this.name,t.D("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()}resize(t){let e=this.diagram,i=this.adornedObject;if(i===null)return;i.desiredSize=t.size;let s=i.part;if(s===null||this.handle===null)return;s.ensureBounds();let n=i.getDocumentPoint(this.handle.alignment.opposite());if(s instanceof ft){let o=new G;o.add(s);let r;!this.dragsMembers&&!s.hasPlaceholder()&&(r=new Qi,r.dragsMembers=!1),e.moveParts(o,this.oppositePoint.copy().subtract(n),!0,r)}else s.location=s.location.copy().subtract(n).add(this.oppositePoint);e.maybeUpdate()}computeResize(t,e,i,s,n,o){if(this.adornedObject===null)return z.Fg;e.isNoSpot()&&(e=D.Center);let r=this.adornedObject.naturalBounds,a=r.x,h=r.y,l=r.x+r.width,c=r.y+r.height,u=1;if(!o){let p=r.width,m=r.height;p<=0&&(p=1),m<=0&&(m=1),u=m/p}let d=P.l();L.Dg(t.x,t.y,a,h,n.width,n.height,d);let g=r.copy();return e.x<=0?e.y<=0?(g.x=Math.max(d.x,l-s.width),g.x=Math.min(g.x,l-i.width),g.width=Math.max(l-g.x,i.width),g.y=Math.max(d.y,c-s.height),g.y=Math.min(g.y,c-i.height),g.height=Math.max(c-g.y,i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u):(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width),g.x=l-g.width,g.y=c-g.height)):e.y>=1?(g.x=Math.max(d.x,l-s.width),g.x=Math.min(g.x,l-i.width),g.width=Math.max(l-g.x,i.width),g.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u):(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width),g.x=l-g.width)):(g.x=Math.max(d.x,l-s.width),g.x=Math.min(g.x,l-i.width),g.width=l-g.x,o||(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u,g.y=h+.5*(c-h-g.height))):e.x>=1?e.y<=0?(g.width=Math.max(Math.min(d.x-a,s.width),i.width),g.y=Math.max(d.y,c-s.height),g.y=Math.min(g.y,c-i.height),g.height=Math.max(c-g.y,i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u):(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width),g.y=c-g.height)):e.y>=1?(g.width=Math.max(Math.min(d.x-a,s.width),i.width),g.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u):(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width))):(g.width=Math.max(Math.min(d.x-a,s.width),i.width),o||(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u,g.y=h+.5*(c-h-g.height))):e.y<=0?(g.y=Math.max(d.y,c-s.height),g.y=Math.min(g.y,c-i.height),g.height=c-g.y,o||(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width,g.x=a+.5*(l-a-g.width))):e.y>=1&&(g.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width,g.x=a+.5*(l-a-g.width))),P.e(d),g}computeReshape(){let t=0;return this.adornedObject instanceof ct&&(t=this.adornedObject.aS()),!(t===6||this.diagram.lastInput.shift)}computeMinSize(){if(this.adornedObject===null)return Q.sc;let t=this.adornedObject.minSize.copy(),e=this.minSize;return!isNaN(e.width)&&e.width>t.width&&(t.width=e.width),!isNaN(e.height)&&e.height>t.height&&(t.height=e.height),t}computeMaxSize(){if(this.adornedObject===null)return Q.Bk;let t=this.adornedObject.maxSize.copy(),e=this.maxSize;return!isNaN(e.width)&&e.width<t.width&&(t.width=e.width),!isNaN(e.height)&&e.height<t.height&&(t.height=e.height),t}computeCellSize(){let t=new Q(NaN,NaN),e=this.adornedObject?.part;if(e){let n=e.resizeCellSize;!isNaN(n.width)&&n.width>0&&(t.width=n.width),!isNaN(n.height)&&n.height>0&&(t.height=n.height)}let i=this.cellSize;isNaN(t.width)&&!isNaN(i.width)&&i.width>0&&(t.width=i.width),isNaN(t.height)&&!isNaN(i.height)&&i.height>0&&(t.height=i.height);let s=this.diagram;if((isNaN(t.width)||isNaN(t.height))&&s){let n=s.grid;n!==null&&n.visible&&this.isGridSnapEnabled&&(i=n.gridCellSize,isNaN(t.width)&&!isNaN(i.width)&&i.width>0&&(t.width=i.width),isNaN(t.height)&&!isNaN(i.height)&&i.height>0&&(t.height=i.height))}return(isNaN(t.width)||t.width===0||t.width===1/0)&&(t.width=1),(isNaN(t.height)||t.height===0||t.height===1/0)&&(t.height=1),t}get minSize(){return this.pr}set minSize(t){if(!this.pr.equals(t)){let e=t.width;isNaN(e)&&(e=0);let i=t.height;isNaN(i)&&(i=0),this.pr.i(e,i)}}get maxSize(){return this.yr}set maxSize(t){if(!this.yr.equals(t)){let e=t.width;isNaN(e)&&(e=1/0);let i=t.height;isNaN(i)&&(i=1/0),this.yr.i(e,i)}}get cellSize(){return this.Po}set cellSize(t){this.Po.equals(t)||this.Po.a(t)}get isGridSnapEnabled(){return this.yc}set isGridSnapEnabled(t){f.s(t,"boolean",Ti,"isGridSnapEnabled"),this.yc=t}get dragsMembers(){return this.lS}set dragsMembers(t){f.s(t,"boolean",Ti,"dragsMembers"),this.lS=t}get oppositePoint(){return this.wm}set oppositePoint(t){this.wm.equals(t)||this.wm.a(t)}get originalDesiredSize(){return this.hS}get originalLocation(){return this.wc}}class si extends ee{cS;fS;us=null;dr=null;jw=null;fs=null;uS;xm;wc;dS;gS;constructor(t){super(),this.name="Rotating",this.cS=45,this.fS=2,this.wc=new P,this.us=null,this.handleArchetype=new ct("Ellipse",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",strokeWidth:1,cursor:"pointer"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.fs=null,this.uS=0,this.xm=new P(NaN,NaN),this.dS=0,this.gS=50,t&&Object.assign(this,t)}updateAdornments(t){if(t!==null){if(t.Cl()){let e=t.rotateObject;if(e===t||e===t.path||e.isPanelMain)return}if(t.isSelected&&!this.diagram.isReadOnly){let e=t.rotateObject;if(e!==null&&t.canRotate()&&t.actualBounds.isReal()&&t.isVisible()&&e.actualBounds.isReal()&&e.isVisibleObject()){let i=t.findAdornment(this.name);if((i===null||i.adornedObject!==e)&&(i=this.makeAdornment(e)),i!==null){i.angle=e.getDocumentAngle(),i.hasPlaceholder()||(i.location=this.computeAdornmentLocation(e)),t.addAdornment(this.name,i);return}}}t.removeAdornment(this.name)}}makeAdornment(t){let e=null,i=t.part?.rotateAdornmentTemplate;return i?e=i.copy():this.jw!==null&&(e=this.jw.copy()),e===null?null:(e.adornedObject=t,e)}get handleArchetype(){return this.dr}set handleArchetype(t){this.dr=t,t!==null?this.jw=new St(H.Position,{locationSpot:D.Center}).add(t).Et():this.jw=null}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}get adornedObject(){return this.us}set adornedObject(t){t!==null&&t.part instanceof St&&f.o("new handle must not be in an Adornment: "+t),this.us=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||!t.allowRotate||!t.lastInput.left?!1:this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null}doActivate(){let t=this.diagram;if(this.adornedObject===null){if(this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle===null)return;this.adornedObject=this.handle.part.adornedObject}this.adornedObject===null||this.adornedObject.part===null||(t.isMouseCaptured=!0,t.delaysLayout=!0,this.startTransaction(this.name),this.uS=this.adornedObject.angle,this.xm=this.computeRotationPoint(this.adornedObject),this.wc=this.adornedObject.part.location.copy(),this.isActive=!0)}computeRotationPoint(t){let e=t.part;if(e!==null){let i=e.locationObject;if(e.rotationSpot.isSpot())return t.getDocumentPoint(e.rotationSpot);if(t===e||t===i)return i.getDocumentPoint(e.locationSpot)}return t.getDocumentPoint(D.Center)}computeAdornmentLocation(t){let e=this.rotationPoint;e.isReal()||(e=this.computeRotationPoint(t));let i=t.getLocalPoint(e),s=this.handleAngle;s<0?s+=360:s>=360&&(s-=360),s=Math.round(Math.round(s/45)*45);let n=this.handleDistance;return s===0?i.x=t.naturalBounds.width+n:s===45?(i.x=t.naturalBounds.width+n,i.y=t.naturalBounds.height+n):s===90?i.y=t.naturalBounds.height+n:s===135?(i.x=-n,i.y=t.naturalBounds.height+n):s===180?i.x=-n:s===225?(i.x=-n,i.y=-n):s===270?i.y=-n:s===315&&(i.x=t.naturalBounds.width+n,i.y=-n),t.getDocumentPoint(i)}doDeactivate(){let t=this.diagram;this.stopTransaction(),this.handle=null,this.us=null,this.xm=new P(NaN,NaN),t.isMouseCaptured=!1,this.isActive=!1}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}doCancel(){let t=this.diagram;t.delaysLayout=!1,this.rotate(this.originalAngle),this.stopTool()}doMouseMove(){let t=this.diagram;if(this.isActive){let e=this.computeRotate(t.lastInput.documentPoint);this.rotate(e)}}doMouseUp(){let t=this.diagram;if(this.isActive){t.delaysLayout=!1;let e=this.computeRotate(t.lastInput.documentPoint);this.rotate(e),t.invalidateDocumentBounds(),this.transactionResult=this.name,t.D("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()}rotate(t){let e=this.adornedObject;if(e===null||e.part===null)return;e.angle=t;let i=e.part;i.ensureBounds();let s=i.locationObject,n=i.rotateObject;if(s===n||s.isContainedBy(n)){let o=this.wc.copy();i.location=o.subtract(this.rotationPoint).rotate(t-this.originalAngle).add(this.rotationPoint)}this.diagram.maybeUpdate()}computeRotate(t){let e=this.rotationPoint.directionPoint(t)-this.handleAngle,i=this.adornedObject?.panel;i&&(e-=i.getDocumentAngle()),e>=360?e-=360:e<0&&(e+=360);let s=Math.min(Math.abs(this.snapAngleMultiple),180),n=Math.min(Math.abs(this.snapAngleEpsilon),s/2);return!this.diagram.lastInput.shift&&s>0&&n>0&&(e%s<n?e=Math.floor(e/s)*s:e%s>s-n&&(e=(Math.floor(e/s)+1)*s)),e>=360?e-=360:e<0&&(e+=360),e}get snapAngleMultiple(){return this.cS}set snapAngleMultiple(t){f.s(t,"number",si,"snapAngleMultiple"),this.cS=t}get snapAngleEpsilon(){return this.fS}set snapAngleEpsilon(t){f.s(t,"number",si,"snapAngleEpsilon"),this.fS=t}get originalAngle(){return this.uS}get rotationPoint(){return this.xm}set rotationPoint(t){this.xm=t.copy()}get handleAngle(){return this.dS}set handleAngle(t){f.s(t,"number",si,"handleAngle"),this.dS=t}get handleDistance(){return this.gS}set handleDistance(t){f.s(t,"number",si,"handleDistance"),this.gS=t}}class wn extends ee{constructor(t){super(),this.name="ClickSelecting",t&&Object.assign(this,t)}canStart(){return!(!this.isEnabled||this.isBeyondDragSize())}doMouseUp(){this.isActive&&(this.standardMouseSelect(),this.standardMouseClick()||this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip()),this.stopTool()}}class bn extends ee{xc;constructor(t){super(),this.name="Action",this.xc=null,t&&Object.assign(this,t)}canStart(){if(!this.isEnabled)return!1;let t=this.diagram,e=t.lastInput,i=t.findObjectAt(e.documentPoint,s=>{for(;s.panel!==null;){if(s.isActionable)return s;s=s.panel}return s});return i!==null&&i.isActionable?(this.xc=i,t.gc=t.findObjectAt(e.documentPoint,null,null),!0):!1}doMouseDown(){if(!this.isActive)this.canStart()&&this.doActivate();else{let t=this.diagram.lastInput,e=this.xc;if(e===null)return;t.targetObject=e,e.actionDown!==null&&e.actionDown(t,e)}}doMouseMove(){if(this.isActive){let t=this.diagram.lastInput,e=this.xc;if(e===null)return;t.targetObject=e,e.actionMove!==null&&e.actionMove(t,e)}}doMouseUp(){if(this.isActive){let t=this.diagram.lastInput,e=this.xc;if(e===null)return;t.targetObject=e,e.actionUp!==null&&e.actionUp(t,e),this.standardMouseClick(i=>{for(;i.panel!==null;){if(i.isActionable&&i===e)return i;i=i.panel}return i},i=>i===e)}this.stopTool()}doCancel(){let t=this.diagram.lastInput,e=this.xc;e!==null&&(t.targetObject=e,e.actionCancel!==null&&e.actionCancel(t,e),this.stopTool())}doStop(){this.xc=null}}class di extends ee{Ll;mS;yc;pS;constructor(t){super(),this.name="ClickCreating",this.Ll=null,this.mS=!0,this.yc=!1,this.pS=new P(0,0),t&&Object.assign(this,t)}canStart(){if(!this.isEnabled||this.archetypeNodeData===null)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(t.lastInput.clickCount===1&&(this.pS=t.lastInput.viewPoint.copy()),t.lastInput.clickCount!==2||this.isBeyondDragSize(this.pS))return!1}else if(t.lastInput.clickCount!==1)return!1;return!(t.currentTool!==this&&t.findPartAt(t.lastInput.documentPoint,!0)!==null)}doMouseUp(){let t=this.diagram;this.isActive&&this.insertPart(t.lastInput.documentPoint),this.stopTool()}insertPart(t){let e=this.diagram,i=this.archetypeNodeData;if(i===null)return null;let s=null;try{if(e.D("ChangingSelection",e.selection),this.startTransaction(this.name),i instanceof Nt)i.ke()&&(i.Et(),s=i.copy(),s!==null&&e.add(s));else if(i!==null){let n=e.model.copyNodeData(i);f.G(n)&&(e.model.addNodeData(n),s=e.findPartForData(n))}if(s!==null){let n=P.V(t.x,t.y);this.isGridSnapEnabled&&this.diagram.yS(s,t,n),s.location=n,e.allowSelect&&(e.clearSelection(!0),s.isSelected=!0),P.e(n)}e.invalidateDocumentBounds(),this.transactionResult=this.name,e.D("PartCreated",s)}finally{this.stopTransaction(),e.D("ChangedSelection",e.selection)}return s}get archetypeNodeData(){return this.Ll}set archetypeNodeData(t){t!==null&&f.ec(t,di,"archetypeNodeData"),this.Ll=t}get isDoubleClick(){return this.mS}set isDoubleClick(t){f.s(t,"boolean",di,"isDoubleClick"),this.mS=t}get isGridSnapEnabled(){return this.yc}set isGridSnapEnabled(t){f.s(t,"boolean",di,"isGridSnapEnabled"),this.yc=t}}class Di extends ee{Xh;wS;Al;constructor(t){super(),this.name="DragSelecting",this.Xh=175,this.wS=!1,this.Al=new Nt({layerName:"Tool",selectable:!1}).add(new ct("Rectangle",{name:"SHAPE",fill:null,stroke:"magenta"}).theme("stroke","dragSelect")).Et(),t&&Object.assign(this,t)}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(!t.allowSelect)return!1;let e=t.lastInput;return!(!e.left||t.currentTool!==this&&(!this.isBeyondDragSize()||e.timestamp-t.firstInput.timestamp<this.delay||t.findPartAt(e.documentPoint,!0)!==null))}doActivate(){let t=this.diagram;this.isActive=!0,t.isMouseCaptured=!0,t.skipsUndoManager=!0,this.box&&t.add(this.box),this.doMouseMove()}doDeactivate(){let t=this.diagram;t.stopAutoScroll(),this.box&&t.remove(this.box),t.skipsUndoManager=!1,t.isMouseCaptured=!1,this.isActive=!1}doMouseMove(){let t=this.diagram;if(this.isActive&&this.box!==null){let e=this.computeBoxBounds(),i=this.box.findObject("SHAPE");i===null&&(i=this.box.findMainElement());let s=Q.l().i(e.width,e.height);i!==null&&(i.desiredSize=s),this.box.bc(e.x,e.y,!1),Q.e(s),(t.allowHorizontalScroll||t.allowVerticalScroll)&&t.doAutoScroll(t.lastInput.viewPoint)}}doMouseUp(){if(this.isActive){let t=this.diagram;this.box&&t.remove(this.box);try{t.currentCursor="wait",t.D("ChangingSelection",t.selection),this.selectInRect(this.computeBoxBounds()),t.D("ChangedSelection",t.selection)}finally{t.currentCursor=""}}this.stopTool()}computeBoxBounds(){let t=this.diagram;return new z(t.firstInput.documentPoint,t.lastInput.documentPoint)}selectInRect(t){let e=this.diagram,i=e.lastInput,s=e.findPartsIn(t,this.isPartialInclusion);if(f.tr?i.meta:i.control)if(i.shift){let n=s.iterator;for(;n.next();){let o=n.value;o.isSelected&&(o.isSelected=!1)}}else{let n=s.iterator;for(;n.next();){let o=n.value;o.isSelected=!o.isSelected}}else if(i.shift){let n=s.iterator;for(;n.next();){let o=n.value;o.isSelected||(o.isSelected=!0)}}else{let n=new G,o=e.selection.iterator;for(;o.next();){let h=o.value;s.has(h)||n.add(h)}let r=n.iterator;for(;r.next();){let h=r.value;h.isSelected=!1}let a=s.iterator;for(;a.next();){let h=a.value;h.isSelected||(h.isSelected=!0)}}}get delay(){return this.Xh}set delay(t){f.s(t,"number",Di,"delay"),this.Xh=t}get isPartialInclusion(){return this.wS}set isPartialInclusion(t){f.s(t,"boolean",Di,"isPartialInclusion"),this.wS=t}get box(){return this.Al}set box(t){t!==null&&t.Et(),this.Al=t}}class Zi extends ee{Hw;aL;ko;xS;constructor(t){super(),this.name="Panning",this.Hw=new P,this.aL=new P,this.ko=!1;let e=this;this.xS=()=>{let i=e.diagram;i!==null&&i.Pi(A.document,"scroll",e.xS,!1),e.stopTool()},t&&Object.assign(this,t)}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return!(!t.allowHorizontalScroll&&!t.allowVerticalScroll||!t.lastInput.left||t.currentTool!==this&&!this.isBeyondDragSize())}doActivate(){let t=this.diagram;this.ko?(t.lastInput.bubbles=!0,t.Ut(A.document,"scroll",this.xS,!1)):(t.currentCursor="move",t.isMouseCaptured=!0,this.Hw.a(t.position)),this.isActive=!0}doDeactivate(){let t=this.diagram;t.currentCursor="",t.isMouseCaptured=!1,this.isActive=!1}doCancel(){let t=this.diagram;t.position=this.Hw,t.isMouseCaptured=!1,this.stopTool()}doMouseMove(){this.cL()}doMouseUp(){this.cL(),this.stopTool()}cL(){let t=this.diagram;if(this.isActive&&t){if(this.ko){t.lastInput.bubbles=!0;return}let e=t.position,i=t.firstInput.documentPoint,s=t.lastInput.documentPoint,n=e.x+i.x-s.x,o=e.y+i.y-s.y;t.allowHorizontalScroll||(n=e.x),t.allowVerticalScroll||(o=e.y),t.position=this.aL.i(n,o)}}get bubbles(){return this.ko}set bubbles(t){f.s(t,"boolean",Zi,"bubbles"),this.ko=t}get originalPosition(){return this.Hw}}class Ne{qw;Ww;bS;kS;constructor(t){this.qw=null,this.Ww=null,this.bS=null,this.kS=null,t&&Object.assign(this,t)}get mainElement(){return this.bS}set mainElement(t){this.bS=t}get show(){return this.qw}set show(t){this.qw!==t&&(t!==null&&f.k(t,Ne,"show"),this.qw=t)}get hide(){return this.Ww}set hide(t){this.Ww!==t&&(t!==null&&f.k(t,Ne,"hide"),this.Ww=t)}get valueFunction(){return this.kS}set valueFunction(t){this.kS=t}}class we{ri;Jw;kc;constructor(t,e,i){this.ri=t,this.Jw=e,this.kc=i}}class qt extends ee{PS;$w;SS;MS;Zw;Qw;bm;constructor(t){super(),this.name="ContextMenu",this.PS=null,this.$w=null,this.SS=null,this.MS=new P,this.Zw=null,this.bm=!1;let e=this;this.Qw=()=>e.stopTool(),t&&Object.assign(this,t)}CF(){let t=new Ne;t.show=(r,a,h)=>h.showDefaultContextMenu(),t.hide=(r,a)=>a.hideDefaultContextMenu(),qt.wu=t;let e=this;this.Qw=()=>e.stopTool();let i=f.hs("div"),s=f.hs("div");i.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px",s.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";let n=f.hs("style");A.document.getElementsByTagName("head")[0].appendChild(n),n.sheet.insertRule(".goCXul { list-style: none; }",0),n.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0),n.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);let o=this.diagram;o!==null&&(o.Ut(i,"contextmenu",qt.jh,!1),o.Ut(i,"selectstart",qt.jh,!1),o.Ut(s,"contextmenu",qt.jh,!1)),i.className="goCXforeground",s.className="goCXbackground",A.document.body&&(A.document.body.appendChild(i),A.document.body.appendChild(s)),qt.km=i,qt.Pm=s,qt.NS=!0}static wu=null;static NS=!1;static Pm;static km;static jh(t){return t.preventDefault(),!1}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return this.isBeyondDragSize()||!t.lastInput.right||t.lastInput.clickCount>1?!1:!!(t.lastInput.isTouchEvent&&this.defaultTouchContextMenu!==null||this.findObjectWithContextMenu()!==null)}doStart(){let t=this.diagram;this.MS.set(t.firstInput.documentPoint)}doStop(){this.hideContextMenu(),this.currentObject=null,this.bm=!1}findObjectWithContextMenu(t){t===void 0&&(t=null);let e=this.diagram,i=e.lastInput,s=null;if(t instanceof q||(t instanceof dt?s=t:s=e.findObjectAt(i.documentPoint,null,n=>!n.layer?.isTemporary)),s!==null){let n=s;for(;n!==null;){if(n.contextMenu!==null)return n;n=n.panel}if(e.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return s.part}else if(e.contextMenu!==null)return e;return null}doActivate(){}doMouseDown(){if(super.doMouseDown(),this.isActive&&this.currentContextMenu instanceof St){let t=this.diagram.toolManager.findTool("Action");t!==null&&t.canStart()&&(t.doActivate(),t.doMouseDown(),t.doDeactivate())}this.diagram.toolManager.mouseDownTools.has(this)&&this.doContextClick()}doMouseUp(){if(this.isActive&&this.currentContextMenu instanceof St){let t=this.diagram.toolManager.findTool("Action");t!==null&&t.canStart()&&(t.doActivate(),t.doCancel(),t.doDeactivate())}this.doContextClick()}doContextClick(){let t=this.diagram;if(!this.isActive)this.canStart()&&(this.openMenu(!0),this.isActive||this.stopTool());else{let e=this.currentContextMenu;if(e===null)return;let i=null;e instanceof Ne||(i=t.findObjectAt(t.lastInput.documentPoint,null,null),i!==null&&i.isContainedBy(e)&&this.standardMouseClick(null,null)),this.maybeStopTool(i)}}maybeStopTool(t){this.stopTool(),this.canStart()&&(this.diagram.currentTool=this,this.doMouseUp())}openMenu(t,e){if(e===void 0&&(e=null),this.bm)return;this.bm=!0,t&&this.standardMouseSelect();let i=this.standardMouseClick();if(this.bm=!1,!i){this.isActive=!0;let s=qt.wu;if(e===null&&(e=this.findObjectWithContextMenu()),e!==null){let n=e.contextMenu;n!==null?(this.currentObject=e instanceof dt?e:null,this.showContextMenu(n,this.currentObject)):s!==null&&this.showContextMenu(s,this.currentObject)}else s!==null&&this.showContextMenu(s,null);this.currentContextMenu instanceof St&&!this.currentContextMenu.visible&&this.stopTool()}}doMouseMove(){let t=this.diagram.toolManager.findTool("Action");t!==null&&t.doMouseMove(),this.isActive&&this.diagram.toolManager.doMouseMove()}showContextMenu(t,e){let i=this.diagram;if(t!==this.currentContextMenu&&this.hideContextMenu(),t instanceof St){let s=t;s.layerName="Tool",s.selectable=!1,s.scale=1/i.scale,s.category=this.name,s.hasPlaceholder()&&(s.placeholder.scale=i.scale);let n=s.diagram;n!==null&&n!==i&&n.remove(s),i.add(s),e!==null?s.adornedObject=e:s.data=i.model,s.ensureBounds(),this.positionContextMenu(s,e)}else t instanceof Ne&&t.show!==null&&t.show(e,i,this);this.currentContextMenu=t}positionContextMenu(t,e){if(t.hasPlaceholder())return;let i=t,s=this.diagram,n=s.lastInput.documentPoint.copy(),o=i.measuredBounds,r=s.viewportBounds;s.lastInput.isTouchEvent&&(n.x-=o.width),n.x+o.width>r.right&&(n.x-=o.width+5/s.scale),n.x<r.x&&(n.x=r.x),n.y+o.height>r.bottom&&(n.y-=o.height+5/s.scale),n.y<r.y&&(n.y=r.y),i.position=n}hideContextMenu(){let t=this.diagram,e=this.currentContextMenu;e!==null&&(e instanceof St?(t.remove(e),this.$w!==null&&this.$w.removeAdornment(e.category),e.data=null,e.adornedObject=null):e instanceof Ne&&(e.hide!==null?e.hide(t,this):e.mainElement!==null&&(e.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())}LF(){let t=this,e=new G;return e.add(new we("Copy",i=>i.commandHandler.copySelection(),i=>i.commandHandler.canCopySelection())),e.add(new we("Cut",i=>i.commandHandler.cutSelection(),i=>i.commandHandler.canCutSelection())),e.add(new we("Delete",i=>i.commandHandler.deleteSelection(),i=>i.commandHandler.canDeleteSelection())),e.add(new we("Paste",i=>i.commandHandler.pasteSelection(t.mouseDownPoint),i=>i.commandHandler.canPasteSelection(t.mouseDownPoint))),e.add(new we("Select All",i=>i.commandHandler.selectAll(),i=>i.commandHandler.canSelectAll())),e.add(new we("Undo",i=>i.commandHandler.undo(),i=>i.commandHandler.canUndo())),e.add(new we("Redo",i=>i.commandHandler.redo(),i=>i.commandHandler.canRedo())),e.add(new we("Scroll To Part",i=>i.commandHandler.scrollToPart(),i=>i.commandHandler.canScrollToPart())),e.add(new we("Zoom To Fit",i=>i.commandHandler.zoomToFit(),i=>i.commandHandler.canZoomToFit())),e.add(new we("Reset Zoom",i=>i.commandHandler.resetZoom(),i=>i.commandHandler.canResetZoom())),e.add(new we("Group Selection",i=>i.commandHandler.groupSelection(),i=>i.commandHandler.canGroupSelection())),e.add(new we("Ungroup Selection",i=>i.commandHandler.ungroupSelection(),i=>i.commandHandler.canUngroupSelection())),e.add(new we("Edit Text",i=>i.commandHandler.editTextBlock(),i=>i.commandHandler.canEditTextBlock())),e}showDefaultContextMenu(){let t=this.diagram;this.Zw===null&&(this.Zw=this.LF()),qt.km.innerHTML="",qt.Pm.addEventListener("pointerdown",this.Qw,!1);let e=this,i=f.hs("ul");i.className="goCXul",qt.km.appendChild(i),i.innerHTML="";let s=this.Zw.iterator;for(;s.next();){let n=s.value,o=n.Jw,r=n.kc;if(!f.it(o)||f.it(r)&&!r(t))continue;let a=f.hs("li");a.className="goCXli";let h=f.hs("a");h.className="goCXa",h.href="#",h.Jw=o,h.addEventListener("pointerdown",function(l){return this.Jw(t),e.stopTool(),l.preventDefault(),!1},!1),h.textContent=n.ri,a.appendChild(h),i.appendChild(a)}qt.km.style.display="block",qt.Pm.style.display="block"}hideDefaultContextMenu(){if(this.currentContextMenu===null||this.currentContextMenu!==qt.wu)return;qt.km.style.display="none",qt.Pm.style.display="none";let t=this.diagram;t!==null&&t.Pi(qt.Pm,"pointerdown",this.Qw,!1),this.currentContextMenu=null}get currentContextMenu(){return this.PS}set currentContextMenu(t){this.PS=t,this.$w=t instanceof St?t.adornedPart:null}get defaultTouchContextMenu(){return qt.NS===!1&&qt.wu===null&&q.isUsingDOM()&&this.CF(),qt.wu}set defaultTouchContextMenu(t){t===null&&(qt.NS=!0),qt.wu=t}get currentObject(){return this.SS}set currentObject(t){this.SS=t}get mouseDownPoint(){return this.MS}}var vn=(x=>(x[x.LostFocus=1]="LostFocus",x[x.MouseDown=2]="MouseDown",x[x.Tab=3]="Tab",x[x.Enter=4]="Enter",x))(vn||{}),kn=(x=>(x[x.SingleClick=1]="SingleClick",x[x.SingleClickSelected=2]="SingleClickSelected",x[x.DoubleClick=3]="DoubleClick",x))(kn||{}),Sn=(x=>(x[x.None=1]="None",x[x.Active=2]="Active",x[x.Editing=3]="Editing",x[x.Validating=4]="Validating",x[x.Invalid=5]="Invalid",x[x.Validated=6]="Validated",x))(Sn||{});class me extends ee{Pe;CS;LS;Tl;Gt;AS;TS;DS;_w;FS;constructor(t){super(),this.name="TextEditing",this.Pe=new xt,this.CS=null,this.LS=2,this.Tl=null,this.Gt=1,this.AS=1,this.TS=!0,this.DS=null,this._w=new Ne,this.AF(this._w),t&&Object.assign(this,t)}static LostFocus=1;static MouseDown=2;static Tab=3;static Enter=4;static SingleClick=1;static SingleClickSelected=2;static DoubleClick=3;static StateNone=1;static StateActive=2;static StateEditing=3;static StateValidating=4;static StateInvalid=5;static StateValidated=6;AF(t){if(!q.isUsingDOM())return;let e=f.hs("textarea");this.FS=e;let i=this;e.addEventListener("input",function(s){if(i.textBlock===null)return;let n=i.measureTemporaryTextBlock(this.value),o=this.textScale;this.style.width=20+Math.max(i.textBlock.measuredBounds.width,n.measuredBounds.width)*o+"px",this.rows=Math.max(i.textBlock.lineCount,n.lineCount)},!1),e.addEventListener("keydown",function(s){if(s.isComposing||i.textBlock===null)return;let n=s.key;if(n==="Enter"){i.textBlock.isMultiline===!1&&s.preventDefault(),i.acceptText(4);return}else if(n==="Tab"){i.acceptText(3),s.preventDefault();return}else n==="Escape"&&(i.doCancel(),i.diagram!==null&&i.diagram.doFocus())},!1),e.addEventListener("focus",function(s){i.TF(s)},!1),e.addEventListener("blur",function(s){i.DF(s)},!1),t.valueFunction=()=>e.value,t.mainElement=e,t.show=(s,n,o)=>{if(!(s instanceof xt)||!n||!n.div||!(o instanceof me))return;if(o.state===5){e.style.border="3px solid red",e.focus();return}let r=s.getDocumentPoint(D.Center),a=n.position,h=n.scale,l=s.getDocumentScale()*h;l<o.minimumEditorScale&&(l=o.minimumEditorScale);let c=s.naturalBounds.width*l+6,u=s.naturalBounds.height*l+2,d=(r.x-a.x)*h,g=(r.y-a.y)*h,p=s.verticalAlignment,m=(s.lineHeight+s.spacingAbove+s.spacingBelow)*s.lineCount*l,y=.5*u-.5*m,w=p.y*u-p.y*m+p.offsetY-y-m/2;e.value=s.text,n.div.style.font=s.font;let b=1;e.style.position="absolute",e.style.zIndex="100",e.style.font="inherit",e.style.fontSize=l*100+"%",e.style.lineHeight="normal",e.style.width=c+"px",e.style.left=(d-c/2|0)-b+"px",e.style.top=(g+w|0)-b+"px",e.style.textAlign=s.textAlign,e.style.margin="0",e.style.padding=b+"px",e.style.border="0",e.style.outline="none",e.style.whiteSpace="pre-wrap",e.style.overflow="hidden",e.rows=s.lineCount,e.textScale=l,e.className="goTXarea",n.div.appendChild(e),e.focus(),o.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))},t.hide=(s,n)=>{s.div&&s.div.removeChild(e)}}get textBlock(){return this.CS}set textBlock(t){this.CS=t}get currentTextEditor(){return this.DS}set currentTextEditor(t){this.DS=t}get defaultTextEditor(){return this._w}set defaultTextEditor(t){this._w=t}get starting(){return this.LS}set starting(t){this.LS=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||t.isReadOnly||me.Pc&&me.Pc!==this&&(me.Pc.acceptText(2),me.Pc&&me.Pc!==this)||!t.lastInput.left||this.isBeyondDragSize())return!1;let e=t.lastInput.documentPoint,i=t.findObjectAt(e);if(i===null||!(i instanceof xt)||!i.editable||i.part===null||!i.part.canEdit())return!1;let s=i.part;return!(s===null||this.starting===2&&!s.isSelected||this.starting===3&&t.lastInput.clickCount<2)}doStart(){me.Pc=this,this.textBlock!==null&&this.doActivate()}doActivate(){if(this.isActive)return;let t=this.diagram;if(t===null)return;let e=this.textBlock;if(e===null&&(e=t.findObjectAt(t.lastInput.documentPoint)),e===null||!(e instanceof xt)||(this.textBlock=e,e.part===null))return;t.animationManager.stopAnimation(),this.isActive=!0,this.Gt=2;let i=this.defaultTextEditor;e.textEditor!==null&&(i=e.textEditor),this.Pe=this.textBlock.copy();let s=new z(this.textBlock.getDocumentPoint(D.TopLeft),this.textBlock.getDocumentPoint(D.BottomRight));t.scrollToRect(s),i!==null&&i.show!==null&&i.show(e,t,this),this.currentTextEditor=i}doCancel(){this.stopTool()}doMouseUp(){this.canStart()&&this.doActivate()}doMouseDown(){this.isActive&&this.acceptText(2)}acceptText(t){switch(t){case 2:this.Gt===6?this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus():(this.Gt===2||this.Gt===5||this.Gt===3)&&(this.Gt=4,this.fL());break;case 1:case 4:case 3:if(t===4&&this.textBlock!==null&&this.textBlock.isMultiline===!0)return;(this.Gt===2||this.Gt===5||this.Gt===3)&&(this.Gt=4,this.fL());break}}fL(){let t=this.textBlock,e=this.diagram,i=this.currentTextEditor;if(t!==null&&i!==null){let s=t.text,n="";if(i.valueFunction!==null&&(n=i.valueFunction()),!this.isValidText(t,s,n)){this.Gt=5,this.doError(s,n);return}this.startTransaction(this.name),this.Gt=6,this.transactionResult=this.name,t.text=n,this.doSuccess(s,n),e!==null&&e.D("TextEdited",t,s),this.stopTransaction(),this.stopTool(),e!==null&&e.doFocus()}}doError(t,e){let i=this.textBlock;if(i===null)return;i.errorFunction!==null&&i.errorFunction(this,t,e);let s=this.currentTextEditor;s!==null&&s.show!==null&&s.show(i,this.diagram,this)}doSuccess(t,e){let i=this.textBlock;i!==null&&i.textEdited!==null&&i.textEdited(i,t,e)}doDeactivate(){let t=this.diagram;if(t!==null){if(this.Gt=1,this.currentTextEditor!==null){let e=this.currentTextEditor;e!==null&&e.hide!==null&&e.hide(t,this)}this.textBlock=null,this.isActive=!1}}doStop(){me.Pc=null}TF(t){if(this.currentTextEditor===null||this.state===1)return;let e=this.FS;this.Gt===2&&(this.Gt=3),f.it(e.select)&&this.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))}DF(t){if(this.currentTextEditor===null||this.state===1)return;let e=this.FS;f.it(e.focus)&&e.focus(),f.it(e.select)&&this.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))}isValidText(t,e,i){let s=this.textValidation;if(s!==null&&!s(t,e,i))return!1;let n=t.textValidation;return!(n!==null&&!n(t,e,i))}get textValidation(){return this.Tl}set textValidation(t){t!==null&&f.k(t,me,"textValidation"),this.Tl=t}get minimumEditorScale(){return this.AS}set minimumEditorScale(t){t!==null&&f.s(t,"number",me,"minimumEditorScale"),this.AS=t}get selectsTextOnActivate(){return this.TS}set selectsTextOnActivate(t){t!==null&&f.s(t,"boolean",me,"selectsTextOnActivate"),this.TS=t}get state(){return this.Gt}set state(t){this.Gt!==t&&(this.Gt=t)}measureTemporaryTextBlock(t){let e=this.Pe;return e.text=t,this.textBlock!==null&&e.ht(this.textBlock.Dl,1/0),e}static Pc=null}var Pn=(x=>(x[x.Default=1]="Default",x[x.AnimateLocations=2]="AnimateLocations",x[x.None=3]="None",x))(Pn||{});class pe{N;Si;Oi;wr;zn;So;RS;vS;Sm;pi;Sc;on;Mm;Hh;tx;Nm;ix;Mc;pu;Cm;constructor(t){this.N=q.um(),this.Si=!1,this.Sm=!1,this.pi=!1,this.Sc=!1,this.ix=!0,this.Mc=1,this.pu=!1,this.Oi=!0,this.wr=!0,this.So=600,this.RS=!1,this.vS=!1,this.zn=new I,this.on=new Ce,this.Mm=new Ce,this.on.ds=this,this.Hh=new I,this.tx=new I,this.Nm=new I,this.Cm=new I,t&&Object.assign(this,t)}Mo(t){this.N=t}NE(){return this.N}canStart(t){return!0}Fl(t){return!this.Oi||!this.canStart(t)?!1:(this.zn.add(t),this.defaultAnimation.isAnimating&&this.stopAnimation(),this.N.Mi(),this.pi=!0,!0)}getBundleAnimation(){return this.Mm}OS(){if(!this.Oi||(this.Mm.ce.count>0&&this.Mm.start(),!this.pi))return;let t=this.on,e=this.N,i=this.zn.has("Model");if(i&&(this.Sc=!0,this.Mc===1?(t.isViewportUnconstrained=!0,t.ce.clear(),t.add(e,"position",e.position.copy().offset(0,-200),e.position),t.add(e,"opacity",0,1)):this.Mc===3&&t.ce.clear(),this.Mc===2&&e.ex.equals(e.at)?this.ix=!0:this.ix=!1,e.D("InitialAnimationStarting",this)),i&&!this.wr||t.ce.count===0){this.zn.clear(),this.pi=!1,t.ce.clear(),t.nx(e),this.Sc=!1,e.S();return}this.zn.clear(),e.xr=!1;let s=t.ce.get(e);e.autoScale!==1&&s!==null&&(delete s.ei.scale,delete s.gs.scale);let n=this;A.requestAnimationFrame(()=>{n.pi===!1||t.Si||(e.getRenderingHint("temporaryPixelRatio")&&e.Bw(),e.IS(),n.pi=!1,t.start(),t.Si&&(n.xu(),e.invalidateDocumentBounds(),t.uL(0),e.ur(!0),n.bu(),e.D("AnimationStarting",n)))})}ES(){return this.zn.has("Trigger")&&this.zn.count===1}dL(t,e,i,s){this.isTicking||this.ES()||t instanceof _&&(t.fromNode!==null||t.toNode!==null)||this.on.add(t,"position",e,i,s)}lx(t){return this.on.lx(t)}US(t){return this.on.US(t)}FF(t){let e=this.Hh,i=this;function s(){if(i.Nm.count>0&&(e.addAll(i.Nm),i.Nm.clear(),i.Si=!0),i.Si===!1||e.count===0)return;i.tx.addAll(e);let n=i.tx.iterator;for(;n.next();){let o=n.value;o.Si!==!1&&(o.RF()?o.gL(!1):o.Nc=!0)}if(i.tx.clear(),i.Si===!1){A.requestAnimationFrame(s);return}i.xu(),i.N.ur(),i.bu(),A.requestAnimationFrame(s)}this.Si?this.vF(t):(this.Si=!0,e.add(t),A.requestAnimationFrame(()=>s()))}vF(t){this.Nm.add(t)}OF(){let t=this.Hh.iterator;for(;t.next();)t.value.Nc=!1}xu(){if(this.Sm)return;let t=this.N;this.RS=t.skipsUndoManager,this.vS=t.fe,t.skipsUndoManager=!0,t.fe=!0,this.Sm=!0}bu(){let t=this.N;t.skipsUndoManager=this.RS,t.fe=this.vS,this.Sm=!1}stopAnimation(t){let e=this.on;if(this.pi===!0&&(this.pi=!1,this.Sc=!1,this.zn.clear(),e.IF()&&this.N.requestUpdate()),!this.Si){e.ce.clear(),e.nx(this.N);return}if(e.ku(!0),e.nx(null),t===!0){let i=this.Hh.toArray();for(let s=0;s<i.length;s++)i[s].ku(!0)}}ku(t){this.Hh.delete(t),this.Hh.count===0&&(this.Si=!1,this.N.requestUpdate()),t===this.defaultAnimation&&this.N.D("AnimationFinished",this)}Cc(t,e){this.pi&&(!this.zn.has("Expand Tree")&&!this.zn.has("Expand SubGraph")||(this.on.Cc(t,e),this.mL(t)))}Lc(t,e){this.pi&&(!this.zn.has("Collapse Tree")&&!this.zn.has("Collapse SubGraph")||(this.on.Lc(t,e),this.on.BS(e,"position",e.position,e.position),this.mL(t)))}pL(t,e){!this.pi||t.equals(e)||this.ES()||(this.N.Vh||(t=e.copy()),this.on.BS(this.N,"position",t,e))}yL(t,e){this.pi&&(this.ES()||this.on.add(this.N,"scale",t,e))}VS(t,e){t.Se&&(t.br=e,this.Cm.add(t))}mL(t){let e=t.findLinksConnected();for(;e.next();){let i=e.value;i.Se&&(i.br=i.points.copy(),this.Cm.add(i))}}get isEnabled(){return this.Oi}set isEnabled(t){f.s(t,"boolean",pe,"isEnabled"),this.Oi=t,t&&this.Hh.each(e=>{!e.isAnimating&&e.runCount===1/0&&e.start()})}get duration(){return this.So}set duration(t){f.s(t,"number",pe,"duration"),t<1&&f.W(t,">= 1",pe,"duration"),this.So=t}get isAnimating(){return this.Si}get isTicking(){return this.Sm}get isInitial(){return this.wr}set isInitial(t){f.s(t,"boolean",pe,"isInitial"),this.wr=t}get defaultAnimation(){return this.on}get activeAnimations(){return this.Hh}get initialAnimationStyle(){return this.Mc}set initialAnimationStyle(t){this.Mc=t}static hx=new pt;static defineAnimationEffect(t,e){pe.hx.set(t,e)}static zS(t,e,i,s,n){t===null&&(t=[0,0,0,0]),e===null&&(e=[0,0,0,0]);let o=t[0],r=t[1],a=t[2],h=t[3],l=e[0],c=e[1],u=e[2],d=e[3];a===0||a===100?(o=l,r=c):(u===0||u===100)&&(l=o,c=r),Math.abs(l-o)>180&&(l>o?o+=360:l+=360);let g=n(i,o,l-o,s)%360,p=n(i,r,c-r,s),m=n(i,a,u-a,s),y=n(i,h,d-h,s);return"hsla("+g+", "+p+"%, "+m+"%, "+y+")"}static Default=1;static AnimateLocations=2;static None=3}{let x=pe.hx,t=(e,i,s,n,o,r)=>{e.position=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))};x.set("position:diagram",t),x.set("position",t),x.set("position:part",(e,i,s,n,o,r)=>{o<r?e.bc(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r),!1):e.position=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))}),x.set("location",(e,i,s,n,o,r)=>{o<r?e.bc(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r),!0):e.location=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))}),x.set("position:placeholder",(e,i,s,n,o,r)=>{o<r?e.bc(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r),!1):e.position=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))}),x.set("position:nodeCollapse",(e,i,s,n,o,r)=>{let a=e.actualBounds,h=s.actualBounds,l=h.x+h.width/2-a.width/2,c=h.y+h.height/2-a.height/2;o<r?e.bc(n(o,i.x,l-i.x,r),n(o,i.y,c-i.y,r),!1):e.position=new P(n(o,i.x,l-i.x,r),n(o,i.y,c-i.y,r))}),x.set("desiredSize",(e,i,s,n,o,r)=>{e.desiredSize=new Q(n(o,i.width,s.width-i.width,r),n(o,i.height,s.height-i.height,r))}),x.set("width",(e,i,s,n,o,r)=>{e.width=n(o,i,s-i,r)}),x.set("height",(e,i,s,n,o,r)=>{e.height=n(o,i,s-i,r)}),x.set("fill",(e,i,s,n,o,r)=>{e.fill=pe.zS(i,s,o,r,n)}),x.set("stroke",(e,i,s,n,o,r)=>{e.stroke=pe.zS(i,s,o,r,n)}),x.set("strokeWidth",(e,i,s,n,o,r)=>{e.strokeWidth=n(o,i,s-i,r)}),x.set("strokeDashOffset",(e,i,s,n,o,r)=>{e.strokeDashOffset=n(o,i,s-i,r)}),x.set("background",(e,i,s,n,o,r)=>{e.background=pe.zS(i,s,o,r,n)}),x.set("opacity",(e,i,s,n,o,r)=>{e.opacity=n(o,i,s-i,r)}),x.set("scale",(e,i,s,n,o,r)=>{e.scale=n(o,i,s-i,r)}),x.set("angle",(e,i,s,n,o,r)=>{e.angle=n(o,i,s-i,r)})}class Ce{ax;Lm;Si;Pu;So;ms;wL;Ac;ce;cx;ei;Xn;Su;Tc;fx;ux;Nc;XS;gx;ds;N;YS;GS;KS;constructor(t){this.N=null,this.ds=null,this.XS=null,this.gx=null,this.YS=!1,this.Si=!1,this.Nc=!1,this.ei=0,this.Xn=0,this.ax=Ce.EaseInOutQuad,this.Lm=Ce.EaseInOutQuad,this.Su=!1,this.Tc=!1,this.fx=1,this.ux=0,this.So=NaN,this.ms=NaN,this.GS=0,this.Pu=null,this.wL=P.xo,this.ce=new pt,this.cx=new pt,this.Ac=new I,this.KS=1,t&&Object.assign(this,t)}suspend(){this.Nc=!0}advanceTo(t,e){e&&(this.Nc=!1),this.Su&&t>=this.ms&&(this.Tc=!0,t=t-this.ms),this.GS=t,this.gL(!0),this.ds.xu(),this.N.ur(),this.ds.bu(),this.N.redraw()}nx(t){if(this.cx.clear(),this.Tc=!1,this.ux=0,this.ms=NaN,this.Ac.count>0&&this.Ac.clear(),t!==null){let e=t.links;for(;e.next();)e.value.br=null}}IF(){return this.ce.count>0}start(){if(this.ce.count===0)return this;if(this.Si)return this;let t=this.N,e=this.ce.iterator;for(;e.next();){let s=e.key;t===null&&(s instanceof q?t=s:s instanceof dt&&(t=s.diagram))}if(t!==null)this.N=t,this.ds=t.animationManager;else return this;let i=this.ds;return i.isEnabled===!1?this:(this.ms=isNaN(this.So)?i.duration:this.So,this.Lm=this.ax,i.Sc&&i.Mc===1&&this===i.defaultAnimation&&(this.Lm=Ce.EaseOutExpo,this.ms=isNaN(this.So)?i.duration===600?900:i.duration:this.So),this.KS=t.scrollMode,this.isViewportUnconstrained&&(t.qh=2),i.xu(),this.Ac.each(s=>{s.data=null,t.add(s)}),i.bu(),this.Si=!0,this.ei=+new Date,this.Xn=this.ei+this.ms,i.FF(this),this)}addTemporaryPart(t,e){return t.ke()?(this.Ac.add(t),this.N=e,this):this}add(t,e,i,s,n){if(this.N===null&&(t instanceof q?this.N=t:t instanceof dt&&t.diagram!==null&&(this.N=t.diagram)),t instanceof Nt){if(!t.isAnimated)return this;e==="position"&&(e="position:part")}return this.BS(t,e,i,s,n),this}BS(t,e,i,s,n){let o=this.ce,r,a,h;if(t instanceof q&&e==="position"&&(e="position:diagram"),(e==="fill"||e==="stroke"||e==="background")&&(E.No(i),E.jS(),i=[E.Ii.n0,E.Ii.n1,E.Ii.n2,E.Ii.n3],E.No(s),E.jS(),s=[E.Ii.n0,E.Ii.n1,E.Ii.n2,E.Ii.n3]),o.has(t))r=o.get(t),a=r.ei,h=r.gs,a[e]===void 0&&(a[e]=this.Mu(i)),h[e]=this.Mu(s);else{if(e==="position"&&i.equalsApprox(s))return;a={},h={},a[e]=this.Mu(i),h[e]=this.Mu(s),r=new Qo(a,h,n),o.set(t,r)}let l=a[e];l instanceof P&&!l.isReal()&&l.a(this.wL),n&&e.indexOf("position:")===0&&t instanceof Nt?r.mx.location=this.Mu(t.location):n&&(r.mx[e]=this.Mu(i))}Mu(t){return t instanceof P||t instanceof Q?t.copy():t}EF(t){let e=this.ce;if(e.has(t)){let i=e.get(t);i.yx=!0}}lx(t){if(!this.Si)return!1;let e=this.ce.get(t);return e!==null&&e.yx}US(t){if(!this.Si)return!1;let e=this.ce.get(t);return e!==null&&!!(e.ei.position||e.ei["position:part"]||e.ei.location)}RF(){if(this.Ac.count>0)return!0;let t=this.ce.iterator;for(;t.next();){let e=t.key;if(e instanceof dt&&e.diagram!==null||e instanceof q)return!0}return!1}gL(t){if(this.Nc&&!t)return;let e=this.ds;if(this.Si===!1)return;let i=+new Date,s=i>this.Xn?this.ms:i-this.ei;t&&(s=this.GS,s<this.ms?(this.ei=+new Date-s,this.Xn=this.ei+this.ms):s=this.ms),e.xu(),this.uL(s),this.N.ur(!0),e.bu(),i>this.Xn&&(this.Su&&!this.Tc?(this.ei=+new Date,this.Xn=this.ei+this.ms,this.Tc=!0):this.ku(!1))}uL(t){let e=this.ms,i=this.ce.iterator,s=this.Tc;for(;i.next();){let n=i.key;if(n instanceof dt&&n.diagram===null)continue;let o=i.value,r=s?o.gs:o.ei,a=s?o.ei:o.gs,h=pe.hx;for(let l in a)l==="position"&&(a["position:placeholder"]||a["position:nodeCollapse"])||h.get(l)!==null&&h.get(l)(n,r[l],a[l],this.Lm,t,e,this)}}stop(){return this.Si?(this.ku(!0),this):this}ku(t){if(this.gx!==null&&this.gx.UF(this.XS),!this.Si)return;let e=this.N,i=this.ds;i.Sc=!1,this.Si=!1,this.Nc=!1,i.xu();let s=this.ce,n=this.Ac.iterator;for(;n.next();)e.remove(n.value);let o=this.Su,r=s.iterator,a=pe.hx;for(;r.next();){let l=r.key,c=r.value,u=o?c.gs:c.ei,d=o?c.ei:c.gs,g=c.mx;for(let p in d)if(a.get(p)!==null){let m=p;c.wx&&(m==="position:nodeCollapse"||m==="position:placeholder")&&(m="position"),a.get(m)(l,u[p],g[p]!==void 0?g[p]:c.wx?u[p]:d[p],this.Lm,this.ms,this.ms,this)}c.wx&&g.location!==void 0&&l instanceof Nt&&(l.location=g.location),c.yx&&l instanceof Nt&&l.Ei(!1)}this.ux++;let h=!t&&this.fx>this.ux;if(!h&&(this===i.Mm||this===i.defaultAnimation)&&this.ce.clear(),e.xx.clear(),e.CP(!1),e.invalidateDocumentBounds(),e.S(),e.ur(!0),i.defaultAnimation===this){let l=i.Cm.iterator;for(;l.next();)l.value.BF();i.Cm.clear()}if(e.ur(!0),this.isViewportUnconstrained&&(e.scrollMode=this.KS),i.bu(),h){this.Tc=!1,this.start();return}this.nx(null),e.xL(),i.ku(this),this.Pu&&this.Pu(this),e.requestUpdate()}Cc(t,e){let i=e.actualBounds,s=null;if(e instanceof ft&&(s=e.placeholder),s!==null&&s.visible){let n=s.getDocumentPoint(D.TopLeft),o=s.padding;n.x+=o.left,n.y+=o.top,this.add(t,"position",n,t.position,!1)}else this.add(t,"position",new P(i.x+i.width/2,i.y+i.height/2),t.position,!1);this.add(t,"scale",.01,t.scale,!1),t instanceof ft&&this.VF(t,e)}VF(t,e){let i=t.memberParts;for(;i.next();){let s=i.value;s instanceof rt&&this.Cc(s,e)}}Lc(t,e){if(!t.isVisible())return;let i=null;if(e instanceof ft&&(i=e.placeholder),i!==null&&i.visible){let s=i.getDocumentPoint(D.TopLeft),n=i.padding;s.x+=n.left,s.y+=n.top,this.add(t,"position:placeholder",t.position,s,!0)}else this.add(t,"position:nodeCollapse",t.position,e,!0);this.add(t,"scale",t.scale,.01,!0),this.EF(t),t instanceof ft&&this.zF(t,e)}zF(t,e){let i=t.memberParts;for(;i.next();){let s=i.value;s instanceof rt&&this.Lc(s,e)}}get duration(){return this.So}set duration(t){f.s(t,"number",Ce,"duration"),t<1&&f.W(t,">= 1",Ce,"duration"),this.So=t}get reversible(){return this.Su}set reversible(t){this.Su=t}get runCount(){return this.fx}set runCount(t){t>0?this.fx=t:f.o("Animation.runCount value must be a positive integer.")}get finished(){return this.Pu}set finished(t){this.Pu!==t&&(t!==null&&f.k(t,Ce,"finished"),this.Pu=t)}get easing(){return this.ax}set easing(t){this.ax=t}get isViewportUnconstrained(){return this.YS}set isViewportUnconstrained(t){this.YS=t}get isAnimating(){return this.Si}getTemporaryState(t){let e=this.cx.get(t);return e===null&&(e={},this.cx.set(t,e)),e}static EaseLinear=(t,e,i,s)=>i*t/s+e;static EaseInOutQuad=(t,e,i,s)=>(t/=s/2,t<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e);static EaseInQuad=(t,e,i,s)=>i*(t/=s)*t+e;static EaseOutQuad=(t,e,i,s)=>-i*(t/=s)*(t-2)+e;static EaseInExpo=(t,e,i,s)=>t===0?e:i*Math.pow(2,10*(t/s-1))+e;static EaseOutExpo=(t,e,i,s)=>t===s?e+i:i*(-Math.pow(2,-10*t/s)+1)+e}class Qo{ei;gs;mx;wx;yx;constructor(t,e,i){this.ei=t,this.gs=e,this.mx={},this.wx=i,this.yx=!1}}var Mn=(x=>(x[x.Default=1]="Default",x[x.Immediate=2]="Immediate",x[x.Bundled=3]="Bundled",x))(Mn||{});class Fi{be;en;Nu;Dc;constructor(t,e,i){this.be=null,this.en=t,this.Nu=i||1,this.Dc=null,e!==void 0&&(this.Dc=e,i===void 0&&(this.Nu=2))}copy(){let t=new Fi(this.en);t.Nu=this.Nu;let e=this.Dc;if(e!==null){let i={};e.duration!==void 0&&(i.duration=e.duration),e.finished!==void 0&&(i.finished=e.finished),e.easing!==void 0&&(i.easing=e.easing),t.Dc=i}return t}get propertyName(){return this.en}set propertyName(t){this.en=t}get animationSettings(){return this.Dc}set animationSettings(t){this.Dc=t}XF(t){let e=this.Dc;e!==null&&(e.duration&&(t.duration=e.duration),e.finished&&(t.finished=e.finished),e.easing&&(t.easing=e.easing))}get startCondition(){return this.Nu}set startCondition(t){this.Nu=t}static Default=1;static Immediate=2;static Bundled=3}class Vt{N;Pt;$t;kr;Rl;vl;Ol;Il;El;Ul;Bl;Vl;zl;Xl;Yl;Gl;kc;Kl;bx;Am;Cu;Ct;constructor(t){I.Ki(this),this.N=null,this.Ct=new G,this.Pt="",this.$t=1,this.kr=!1,this.Rl=!0,this.vl=!0,this.Ol=!0,this.Il=!0,this.El=!0,this.Ul=!0,this.Bl=!0,this.Vl=!0,this.zl=!0,this.Xl=!0,this.Yl=!0,this.Gl=!0,this.kc=!0,this.Kl=!0,this.bx=!0,this.Am=!1,this.Cu=[],t&&Object.assign(this,t)}YF(){let t=this.Ct;for(let e=0;e<t.length;e++)t.r[e].HS(null);t.clear(),this.Cu.length=0}Mo(t){this.N=t}toString(t){t===void 0&&(t=0);let e='Layer "'+this.name+'"';if(t<=0)return e;let i=0,s=0,n=0,o=0,r=0,a=this.Ct.iterator;for(;a.next();){let l=a.value;l instanceof ft?n++:l instanceof rt?s++:l instanceof _?o++:l instanceof St?r++:i++}let h="";if(i>0&&(h+=i+" Parts "),s>0&&(h+=s+" Nodes "),n>0&&(h+=n+" Groups "),o>0&&(h+=o+" Links "),r>0&&(h+=r+" Adornments "),t>1){let l=this.Ct.iterator;for(;l.next();){let c=l.value;h+=`