@esri/solutions-components 1.2.0-next.3 → 1.2.0-next.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 (459) hide show
  1. package/dist/cdn/{2B2JMPFN.js → 22ZSWKAP.js} +2 -2
  2. package/dist/cdn/{DTQPYWIB.js → 23ABFTR6.js} +2 -2
  3. package/dist/cdn/{UUFG2IPV.js → 23I4BA7K.js} +2 -2
  4. package/dist/cdn/{P5ETCO7H.js → 25VZKI54.js} +1 -1
  5. package/dist/cdn/{VUQWNJXP.js → 262XEZAR.js} +2 -2
  6. package/dist/cdn/{ZPGXJFXY.js → 2CBLRUOD.js} +2 -2
  7. package/dist/cdn/{QVKG5VJZ.js → 2CX7WBJK.js} +2 -2
  8. package/dist/cdn/{GDNCH7FM.js → 2GSSS7N5.js} +2 -2
  9. package/dist/cdn/{TANEEDP3.js → 2HE3XNY7.js} +1 -1
  10. package/dist/cdn/{64JDACKK.js → 2HK3BXGQ.js} +1 -1
  11. package/dist/cdn/{VF6P6PS2.js → 2MHHLMAP.js} +2 -2
  12. package/dist/cdn/{BIT3Z27V.js → 2RCBXDY6.js} +2 -2
  13. package/dist/cdn/{VPGE5727.js → 2RNPOQZB.js} +2 -2
  14. package/dist/cdn/{SVKD3HCO.js → 2TOU3AN5.js} +2 -2
  15. package/dist/cdn/{VMLVIBVL.js → 2WXGFL52.js} +2 -2
  16. package/dist/cdn/{RXU36Q5Q.js → 2ZJVYO5L.js} +1 -1
  17. package/dist/cdn/{ARMMHG3S.js → 34CQDTIX.js} +2 -2
  18. package/dist/cdn/{7LSLVXGD.js → 35BEKCWY.js} +2 -2
  19. package/dist/cdn/{AOC5GCMF.js → 3BMV5UUD.js} +2 -2
  20. package/dist/cdn/{QX5H4XZ4.js → 3EB5ZS26.js} +2 -2
  21. package/dist/cdn/{BSMBN633.js → 3GBS4PX4.js} +2 -2
  22. package/dist/cdn/{4QXAYPME.js → 3LGLF5OE.js} +2 -2
  23. package/dist/cdn/{P57EK6OT.js → 3M27VPQ3.js} +2 -2
  24. package/dist/cdn/{7UCFU6IJ.js → 3PD7ARIA.js} +1 -1
  25. package/dist/cdn/{I7OV3TY4.js → 3R7I767T.js} +1 -1
  26. package/dist/cdn/{Q4JKPYH3.js → 3TSCGGAX.js} +2 -2
  27. package/dist/cdn/{2TADYBIO.js → 3UXGWXBS.js} +2 -2
  28. package/dist/cdn/{TN2UEPVT.js → 3XBIPVX2.js} +2 -2
  29. package/dist/cdn/{XBOSZH7N.js → 3YF2JNPH.js} +2 -2
  30. package/dist/cdn/{65AXSWLQ.js → 44VI6MEG.js} +2 -2
  31. package/dist/cdn/{J2VOTAZW.js → 4BRX4PEE.js} +2 -2
  32. package/dist/cdn/{2XCAUYR2.js → 4DF5N4JQ.js} +2 -2
  33. package/dist/cdn/{L5GLQINC.js → 4ES6G2Y2.js} +2 -2
  34. package/dist/cdn/{Q67QGD63.js → 4HIDSTIQ.js} +2 -2
  35. package/dist/cdn/{3JMRSSB5.js → 4IEIQVGE.js} +2 -2
  36. package/dist/cdn/{V75D7IJY.js → 4MSUNNIN.js} +2 -2
  37. package/dist/cdn/{T2TMGGNG.js → 4PQV62XZ.js} +2 -2
  38. package/dist/cdn/{5Z7ZG2XK.js → 4PSCZYXY.js} +2 -2
  39. package/dist/cdn/{RLKKLGY4.js → 4PTO2WHC.js} +2 -2
  40. package/dist/cdn/{PKCDCMTI.js → 4QMKENCR.js} +1 -1
  41. package/dist/cdn/{2LVJZ2NV.js → 4RJYZHLS.js} +2 -2
  42. package/dist/cdn/{BVPEEMND.js → 4RV4IDOJ.js} +2 -2
  43. package/dist/cdn/{GGN6M4IW.js → 4WEAWPJU.js} +2 -2
  44. package/dist/cdn/{H35JZY2E.js → 52A65NFY.js} +1 -1
  45. package/dist/cdn/{OACHOZNB.js → 57OL4QCV.js} +1 -1
  46. package/dist/cdn/{D37JXHEV.js → 5DKF6DVK.js} +2 -2
  47. package/dist/cdn/{UPKV6OGB.js → 5QBB6ZOG.js} +1 -1
  48. package/dist/cdn/{AWOFK74F.js → 5W6QXGFW.js} +2 -2
  49. package/dist/cdn/{EOUSEWUA.js → 5ZPOVO47.js} +2 -2
  50. package/dist/cdn/{3EU6WGZO.js → 6362HZ65.js} +1 -1
  51. package/dist/cdn/{LOK5CX76.js → 63O5DY5A.js} +2 -2
  52. package/dist/cdn/{JVKOJX2S.js → 6C7OOJ6H.js} +1 -1
  53. package/dist/cdn/{SVGFOYCQ.js → 6ES7SEYG.js} +2 -2
  54. package/dist/cdn/{KMO43UXT.js → 6GCMD7O4.js} +2 -2
  55. package/dist/cdn/{NVM5PDRT.js → 6LOI3OHQ.js} +2 -2
  56. package/dist/cdn/{HZI7AR5Z.js → 6MAZZ22I.js} +1 -1
  57. package/dist/cdn/{4I7PCYCC.js → 6MQLDUUH.js} +2 -2
  58. package/dist/cdn/{7KWG3Z6K.js → 6MURC2GB.js} +2 -2
  59. package/dist/cdn/{SBVYCA5T.js → 6QLVSTJ3.js} +2 -2
  60. package/dist/cdn/{QKG5BAFS.js → 6RNWAVPL.js} +1 -1
  61. package/dist/cdn/{MR53MAQ6.js → 6ZVK62QB.js} +2 -2
  62. package/dist/cdn/{YADLOKQK.js → 73ETZPZ7.js} +2 -2
  63. package/dist/cdn/{E27JDCXQ.js → 755M2TCZ.js} +2 -2
  64. package/dist/cdn/{LQJ7XXC5.js → 7GJCQW7D.js} +2 -2
  65. package/dist/cdn/{ZCHM4BFA.js → 7I6L52EP.js} +3 -3
  66. package/dist/cdn/{YERONLAQ.js → 7KFFYWQ7.js} +2 -2
  67. package/dist/cdn/{UAZL2ZIR.js → 7NSKIKHV.js} +2 -2
  68. package/dist/cdn/{2MHGYWN7.js → 7R7463AQ.js} +2 -2
  69. package/dist/cdn/{OCQ4MKGB.js → 7RZIRVRD.js} +2 -2
  70. package/dist/cdn/{FNE6U57W.js → AAI5LMSF.js} +2 -2
  71. package/dist/cdn/{4MHLESLH.js → AD4NPA2M.js} +1 -1
  72. package/dist/cdn/{NY6XIURZ.js → AD7LM3CM.js} +4 -4
  73. package/dist/cdn/{2L4XL6GG.js → AI6HYDN5.js} +2 -2
  74. package/dist/cdn/{K2UJVJCK.js → AMVHYPDE.js} +2 -2
  75. package/dist/cdn/{2TADDW4W.js → AOXMXGZG.js} +2 -2
  76. package/dist/cdn/{C5M3F3HQ.js → AQLTILZX.js} +2 -2
  77. package/dist/cdn/{BC4V4TZO.js → AQR7MTOO.js} +2 -2
  78. package/dist/cdn/{VTPTDE33.js → ASRSYNRR.js} +2 -2
  79. package/dist/cdn/{WXYWYTJG.js → ATAHO4MQ.js} +2 -2
  80. package/dist/cdn/{IHL22CRN.js → AUDMGPLD.js} +2 -2
  81. package/dist/cdn/{R3RWVGJC.js → B3PAHL22.js} +2 -2
  82. package/dist/cdn/{36VZRVY2.js → B6QNXGKF.js} +2 -2
  83. package/dist/cdn/{6I4GOE3Y.js → BBSGWWJO.js} +2 -2
  84. package/dist/cdn/BESWB64W.js +18 -0
  85. package/dist/cdn/{2W5UVWEN.js → BF5DZ5ZS.js} +2 -2
  86. package/dist/cdn/{N3IWMVZ5.js → BFZ5DGBI.js} +2 -2
  87. package/dist/cdn/{HL4GCE2D.js → BGYNN7N6.js} +2 -2
  88. package/dist/cdn/{EWXCPV2X.js → BIUFKQEB.js} +1 -1
  89. package/dist/cdn/{HS2SGNFL.js → BIW2OZSL.js} +2 -2
  90. package/dist/cdn/{QC4H73ZM.js → BJJ6U2L3.js} +2 -2
  91. package/dist/cdn/{ZMGJ7NGP.js → BSLVXBXB.js} +1 -1
  92. package/dist/cdn/{OQPY5EJA.js → BSOB2EDD.js} +2 -2
  93. package/dist/cdn/{2WLLRLZ7.js → BSZJRCCH.js} +2 -2
  94. package/dist/cdn/{6ROK6EHE.js → BUEJRCBJ.js} +2 -2
  95. package/dist/cdn/{EAQS76QZ.js → C6IUHMOC.js} +2 -2
  96. package/dist/cdn/{3Q6YGL57.js → CK24R5TU.js} +2 -2
  97. package/dist/cdn/{62ISZVOF.js → CNJJOYMN.js} +2 -2
  98. package/dist/cdn/{6NG5X7FZ.js → CTMOZHK5.js} +2 -2
  99. package/dist/cdn/{W4XCDIQT.js → CTRTCQ5M.js} +2 -2
  100. package/dist/cdn/{L5NUJEH6.js → D4P3I7HE.js} +2 -2
  101. package/dist/cdn/{D2WVODK6.js → D5FVGFPY.js} +2 -2
  102. package/dist/cdn/{2FURWI7Y.js → DA5WFI7X.js} +2 -2
  103. package/dist/cdn/{SL6H3SHV.js → DCFD6372.js} +2 -2
  104. package/dist/cdn/{VERTSCDD.js → DGLPGQSF.js} +2 -2
  105. package/dist/cdn/{FID2OEYF.js → DND72PIS.js} +2 -2
  106. package/dist/cdn/{B4OEZKHF.js → DQ5PZE73.js} +1 -1
  107. package/dist/cdn/{23F7WS6U.js → DSFQPJTN.js} +2 -2
  108. package/dist/cdn/{6JQ4EGSQ.js → DSVNI5EY.js} +2 -2
  109. package/dist/cdn/{RHL6NUIU.js → DTTRPJYC.js} +2 -2
  110. package/dist/cdn/{CXWN46XU.js → DUDOFJC4.js} +2 -2
  111. package/dist/cdn/{BHUNFJZD.js → E2HYEAJX.js} +2 -2
  112. package/dist/cdn/{DA2RWFBR.js → E5JW2PWC.js} +2 -2
  113. package/dist/cdn/{62GUE4Z3.js → E63TRZHO.js} +2 -2
  114. package/dist/cdn/{FHL2CPZT.js → ECHLW7AM.js} +2 -2
  115. package/dist/cdn/{U6QNATC3.js → EHSMARTM.js} +2 -2
  116. package/dist/cdn/{CRISXI26.js → EHVKT3K3.js} +1 -1
  117. package/dist/cdn/{APV7UOJA.js → EHVRBJDY.js} +2 -2
  118. package/dist/cdn/{53SCKT44.js → EON3JEAK.js} +2 -2
  119. package/dist/cdn/{ZGLJOWGH.js → EPK7TC4Z.js} +2 -2
  120. package/dist/cdn/{4EWREADY.js → EQFGASVI.js} +2 -2
  121. package/dist/cdn/{FFAQ3R3T.js → F4EAUSYQ.js} +2 -2
  122. package/dist/cdn/{NG5AQI5M.js → FBLE5JBI.js} +2 -2
  123. package/dist/cdn/{HEO5YC5E.js → FED5CWZX.js} +2 -2
  124. package/dist/cdn/FK2YMQFK.js +18 -0
  125. package/dist/cdn/{S4TJ224O.js → FOJ4DMUK.js} +2 -2
  126. package/dist/cdn/{IVWVJPPG.js → FVJX7T4J.js} +2 -2
  127. package/dist/cdn/{DX5ZAVMY.js → FXA6L2BI.js} +2 -2
  128. package/dist/cdn/{2C5JNPGO.js → FYADULQT.js} +2 -2
  129. package/dist/cdn/{RE4N56Q2.js → FZKUNP7A.js} +2 -2
  130. package/dist/cdn/{7L3YAL47.js → FZZRNOKW.js} +2 -2
  131. package/dist/cdn/G2AZAWTQ.js +4 -0
  132. package/dist/cdn/{M7I6TQVN.js → G7X4FKIM.js} +1 -1
  133. package/dist/cdn/{PVBHNQMI.js → GAUJIKE5.js} +2 -2
  134. package/dist/cdn/{6RBJGB46.js → GFSPUX5Q.js} +2 -2
  135. package/dist/cdn/{ILW4KIM2.js → GHRFEIK7.js} +2 -2
  136. package/dist/cdn/{64CYMAYN.js → GWKF3E4T.js} +1 -1
  137. package/dist/cdn/{QCUZ36WP.js → GWWQ2QF4.js} +2 -2
  138. package/dist/cdn/{MAS7EYR3.js → H77VYOZC.js} +2 -2
  139. package/dist/cdn/{35UXOOHD.js → HAIYG6TD.js} +1 -1
  140. package/dist/cdn/{PIYRA3IK.js → HCVNYSM3.js} +2 -2
  141. package/dist/cdn/{KJ266TAM.js → HFOR26C4.js} +2 -2
  142. package/dist/cdn/{4MQB77K7.js → HIXYM3OX.js} +2 -2
  143. package/dist/cdn/{C27Y63JS.js → HLGD7JCW.js} +2 -2
  144. package/dist/cdn/{CQ5FSDXN.js → HMMGIFFN.js} +1 -1
  145. package/dist/cdn/{GBLJSF3O.js → HOILHII3.js} +2 -2
  146. package/dist/cdn/{KZFM7YTE.js → HSZFICY2.js} +2 -2
  147. package/dist/cdn/{PFG6ZMZH.js → I2FRGOEW.js} +2 -2
  148. package/dist/cdn/{XQMJCJMU.js → IAM2KB3B.js} +2 -2
  149. package/dist/cdn/{NHCXGI3Z.js → IGOPVVNK.js} +2 -2
  150. package/dist/cdn/{WJDDXVE5.js → IJ2MEXDM.js} +2 -2
  151. package/dist/cdn/{4DCZ2ZRI.js → IQ7XNR7D.js} +2 -2
  152. package/dist/cdn/{7YX7AHVW.js → IQNMYMJW.js} +2 -2
  153. package/dist/cdn/IS4IY5C2.js +4 -0
  154. package/dist/cdn/{POBHMXVN.js → ITRH5UXW.js} +2 -2
  155. package/dist/cdn/{LFNGTUHE.js → IUTC5UY6.js} +2 -2
  156. package/dist/cdn/{ZANJ2QQO.js → IXZPEW5K.js} +2 -2
  157. package/dist/cdn/J2MDUIYP.js +18 -0
  158. package/dist/cdn/{LBSP4K35.js → J2TRNJS4.js} +2 -2
  159. package/dist/cdn/{YGKAUSDA.js → J3LLHMP2.js} +2 -2
  160. package/dist/cdn/{KEFKS53V.js → J4FVOVTO.js} +2 -2
  161. package/dist/cdn/{2RVAN3GE.js → J4GKJOX7.js} +2 -2
  162. package/dist/cdn/{TKYFLPXP.js → J66RPP2I.js} +2 -2
  163. package/dist/cdn/{X74GGNIS.js → JAYHYI2A.js} +2 -2
  164. package/dist/cdn/{EQ3MVJLN.js → JDJ35FLD.js} +2 -2
  165. package/dist/cdn/{U6JEQWZ5.js → JDXO4XXH.js} +2 -2
  166. package/dist/cdn/{DQAOXKZZ.js → JEON2H5H.js} +2 -2
  167. package/dist/cdn/{I5HY4B6L.js → JGTYJGZO.js} +2 -2
  168. package/dist/cdn/{QZG7DRDQ.js → JMA4D2SH.js} +2 -2
  169. package/dist/cdn/{OS52MWOK.js → JTBXXC5K.js} +2 -2
  170. package/dist/cdn/K47KZZUG.js +4 -0
  171. package/dist/cdn/K7HHAGLP.js +4 -0
  172. package/dist/cdn/{TOJDM5UZ.js → KJBVTRFE.js} +2 -2
  173. package/dist/cdn/{2Y2EWR7H.js → KKTPKASN.js} +2 -2
  174. package/dist/cdn/{TV2SJ62Y.js → KMWQSKKC.js} +2 -2
  175. package/dist/cdn/{DCZHIM53.js → KPO2P4JG.js} +2 -2
  176. package/dist/cdn/{HHILRSR3.js → KRS7IVQF.js} +2 -2
  177. package/dist/cdn/{CT4XO4WW.js → KU6T5QUV.js} +1 -1
  178. package/dist/cdn/{45BXFKGN.js → L2HHXMQN.js} +2 -2
  179. package/dist/cdn/{ACQPRV6Q.js → LBVGHIKI.js} +2 -2
  180. package/dist/cdn/{AX4BFIAK.js → LDUSE7RY.js} +2 -2
  181. package/dist/cdn/{QFI4JQHX.js → LHGFJ7NN.js} +2 -2
  182. package/dist/cdn/{JZC3ICX7.js → LHVQAEXF.js} +2 -2
  183. package/dist/cdn/{TPO5J63A.js → LJB22QBW.js} +2 -2
  184. package/dist/cdn/{FM7AGRNK.js → LJHZSBBH.js} +2 -2
  185. package/dist/cdn/{BEBW4GAM.js → LMY5GROJ.js} +2 -2
  186. package/dist/cdn/{RV4NW4XO.js → LOU4XX7I.js} +2 -2
  187. package/dist/cdn/{Q24E6XEJ.js → LQIGBJUX.js} +2 -2
  188. package/dist/cdn/{JKXQNJEW.js → LQY43HH3.js} +2 -2
  189. package/dist/cdn/{74OGQVZH.js → LRXPLTUH.js} +2 -2
  190. package/dist/cdn/{ABDWQOBA.js → LSIUPCQX.js} +2 -2
  191. package/dist/cdn/{6AWOKZWN.js → LVRHTVE2.js} +2 -2
  192. package/dist/cdn/{AUCJ7ZFB.js → LXMZCX7H.js} +2 -2
  193. package/dist/cdn/{PXL6KSAZ.js → M2I7YXJQ.js} +2 -2
  194. package/dist/cdn/{RC5HYK5Q.js → MEMA2P5F.js} +2 -2
  195. package/dist/cdn/{2SZF4MLJ.js → MJFEXQHB.js} +1 -1
  196. package/dist/cdn/{VXDIW5WH.js → MODMAIUT.js} +2 -2
  197. package/dist/cdn/{5G4RLNCB.js → MPQ2WKFO.js} +2 -2
  198. package/dist/cdn/{TO5P7NGV.js → MVWOM5CI.js} +2 -2
  199. package/dist/cdn/{B24TVNRU.js → MXVR2QNO.js} +2 -2
  200. package/dist/cdn/{LZJPR4X7.js → N6BJELBO.js} +2 -2
  201. package/dist/cdn/{TNEMCYWH.js → N6YXZIU7.js} +2 -2
  202. package/dist/cdn/{JEBENHMN.js → NALO2PEE.js} +2 -2
  203. package/dist/cdn/{4GQA73TQ.js → NH4VNVID.js} +2 -2
  204. package/dist/cdn/{7CPPZBTT.js → NKQNWRPN.js} +2 -2
  205. package/dist/cdn/{4PPJBKDP.js → NOILZDGF.js} +2 -2
  206. package/dist/cdn/{H2HVUDCU.js → NOZBG5XN.js} +2 -2
  207. package/dist/cdn/{62NAX7KS.js → NPQY5PDV.js} +2 -2
  208. package/dist/cdn/{FNUPI5TB.js → NRD4JFR4.js} +2 -2
  209. package/dist/cdn/{GQEO4O6A.js → NTP4QY5V.js} +2 -2
  210. package/dist/cdn/{2NLKFSQN.js → NW6JV6AN.js} +2 -2
  211. package/dist/cdn/{LZN5VEV6.js → NWPXFHBU.js} +2 -2
  212. package/dist/cdn/{BAFRQNS7.js → O25C7WUB.js} +2 -2
  213. package/dist/cdn/{GVXCIENL.js → O4KP2CJ5.js} +2 -2
  214. package/dist/cdn/{WEERXYI7.js → O4MLPAI2.js} +2 -2
  215. package/dist/cdn/{AB76D7WU.js → OIRN6MY3.js} +2 -2
  216. package/dist/cdn/{CDKVJSXJ.js → OJEYKHXS.js} +2 -2
  217. package/dist/cdn/{76WRSP3A.js → OKTRI4JY.js} +2 -2
  218. package/dist/cdn/{4LZZGUWP.js → OMVXQRF3.js} +2 -2
  219. package/dist/cdn/{OXZXBSMK.js → OVM4C5PO.js} +2 -2
  220. package/dist/cdn/{N4Z6EYO4.js → OX6HPOJU.js} +2 -2
  221. package/dist/cdn/{OA5X23GP.js → P4ZGZS3X.js} +2 -2
  222. package/dist/cdn/{UVJGULSN.js → P5A2C3I6.js} +2 -2
  223. package/dist/cdn/{PWNQBRTS.js → PD7PACAU.js} +2 -2
  224. package/dist/cdn/{TLNGNV7G.js → PIINFOXI.js} +2 -2
  225. package/dist/cdn/{LMVNSMV2.js → PJCB22CG.js} +2 -2
  226. package/dist/cdn/{7QYTSIGP.js → PNU6Z2B3.js} +2 -2
  227. package/dist/cdn/{RUQI6YVJ.js → PQ2FIB26.js} +2 -2
  228. package/dist/cdn/{UOSNNDWX.js → PSUS7JOM.js} +2 -2
  229. package/dist/cdn/{2IRNZ42K.js → PW7XPWMS.js} +2 -2
  230. package/dist/cdn/{6GNQRHUK.js → Q2Q3MH2L.js} +2 -2
  231. package/dist/cdn/{6RAGUS7J.js → Q3BBMTUQ.js} +2 -2
  232. package/dist/cdn/{2QVOCL3G.js → Q4NVOORT.js} +2 -2
  233. package/dist/cdn/{DI4JRI7B.js → Q5P5K4DE.js} +2 -2
  234. package/dist/cdn/{IGWJ7WZQ.js → QA2AUJRH.js} +2 -2
  235. package/dist/cdn/{CW3G7QFS.js → QCLY7EDL.js} +2 -2
  236. package/dist/cdn/{N77DPTLF.js → QCS66WC6.js} +1 -1
  237. package/dist/cdn/{SGFO45SM.js → QG72OZSU.js} +2 -2
  238. package/dist/cdn/{3E7HOSDD.js → QGVSJPGQ.js} +2 -2
  239. package/dist/cdn/{NOVJRUUK.js → QHOOJDQR.js} +2 -2
  240. package/dist/cdn/{DQBTQ7WA.js → QHOZO6J3.js} +2 -2
  241. package/dist/cdn/{46UDJ6Q6.js → QKGDGDPJ.js} +2 -2
  242. package/dist/cdn/{BQT6MIAJ.js → QMT2TLRK.js} +2 -2
  243. package/dist/cdn/{WGSBFQ5N.js → QPAWYTLN.js} +2 -2
  244. package/dist/cdn/{LYMRS7P6.js → QTCSAKOZ.js} +1 -1
  245. package/dist/cdn/{3NJX3MB3.js → QTLI6QMJ.js} +2 -2
  246. package/dist/cdn/{6V7JLIJ5.js → QVYS4YXX.js} +2 -2
  247. package/dist/cdn/{25CBXU7A.js → QWIUAAW5.js} +2 -2
  248. package/dist/cdn/{ZUUYQFKK.js → R7XZMQKZ.js} +2 -2
  249. package/dist/cdn/{67P77RII.js → RAJWTYAS.js} +2 -2
  250. package/dist/cdn/{TAXDYLNQ.js → RFZUKMQP.js} +2 -2
  251. package/dist/cdn/{ZQUJXA67.js → RGUOCCYZ.js} +2 -2
  252. package/dist/cdn/{VXRLLXEF.js → RIXPIYEW.js} +2 -2
  253. package/dist/cdn/{NZGGCRYY.js → RKEEFYVJ.js} +2 -2
  254. package/dist/cdn/{DB6YMDTC.js → RLBN72JI.js} +2 -2
  255. package/dist/cdn/{EEENCZTC.js → ROVUCE3I.js} +2 -2
  256. package/dist/cdn/{DR37YWXO.js → RSSME7QC.js} +1 -1
  257. package/dist/cdn/{7CPTTYU3.js → S67OYUND.js} +2 -2
  258. package/dist/cdn/{KR4KMGJB.js → SF4B26QV.js} +2 -2
  259. package/dist/cdn/{NKYNFTHT.js → SFPDV4DU.js} +2 -2
  260. package/dist/cdn/{NYQ4OZXY.js → SJSFG3K3.js} +2 -2
  261. package/dist/cdn/{CPVXVEVK.js → SKDJ6XTR.js} +2 -2
  262. package/dist/cdn/{Z2CJ77IR.js → SLYIJ4XB.js} +2 -2
  263. package/dist/cdn/SONNGGXT.js +4 -0
  264. package/dist/cdn/{JKFTGZOQ.js → SQBZR4WV.js} +2 -2
  265. package/dist/cdn/{234YSPUP.js → SRH3X7BF.js} +2 -2
  266. package/dist/cdn/{BCXBU3KU.js → SRYAXNYQ.js} +1 -1
  267. package/dist/cdn/{RDYTTPKB.js → SSVBZXUN.js} +1 -1
  268. package/dist/cdn/{YCJGW46U.js → T5SL2XC2.js} +2 -2
  269. package/dist/cdn/{62XTNKST.js → TA6JWCUQ.js} +1 -1
  270. package/dist/cdn/TCRE226Q.js +4 -0
  271. package/dist/cdn/{BCTLXB2M.js → TDB7HB35.js} +2 -2
  272. package/dist/cdn/{TOTUDQKH.js → TM5OMGCV.js} +2 -2
  273. package/dist/cdn/{SOAYGRAI.js → TQ5B3ZGM.js} +2 -2
  274. package/dist/cdn/{RT67IRZT.js → TWNRBZK5.js} +2 -2
  275. package/dist/cdn/{ARZ6JPA3.js → U3IG6OVD.js} +1 -1
  276. package/dist/cdn/{FFFY6LX5.js → U47M6DQ4.js} +2 -2
  277. package/dist/cdn/{M2OW6QBQ.js → U5T2RELD.js} +2 -2
  278. package/dist/cdn/{T5EHVA6S.js → UBJJ4M7T.js} +2 -2
  279. package/dist/cdn/UCDUCIRN.js +4 -0
  280. package/dist/cdn/{FTF5P4HQ.js → UGFAJLUH.js} +2 -2
  281. package/dist/cdn/{LNNSONRN.js → UJFLGBLN.js} +2 -2
  282. package/dist/cdn/{EMWBS4WA.js → ULZDIARS.js} +2 -2
  283. package/dist/cdn/{IJZ5WMRB.js → UWKL5KUQ.js} +2 -2
  284. package/dist/cdn/{PGDXLL6Y.js → V3OVUJJM.js} +2 -2
  285. package/dist/cdn/{ILOQ3A64.js → VCQKPKHX.js} +2 -2
  286. package/dist/cdn/{QOFGAP4Z.js → VGXQMADM.js} +2 -2
  287. package/dist/cdn/{OC2PGR4W.js → VITMRSLU.js} +2 -2
  288. package/dist/cdn/{2TB3YOHP.js → VMEXQML7.js} +2 -2
  289. package/dist/cdn/{K6ZPYGKA.js → VNQ4CD76.js} +2 -2
  290. package/dist/cdn/{RANKC4FB.js → VQATHECJ.js} +2 -2
  291. package/dist/cdn/{BMUTEUNT.js → VRDHLEG3.js} +2 -2
  292. package/dist/cdn/{IZQ2GJTG.js → VROCYI23.js} +2 -2
  293. package/dist/cdn/{4OWQLN7N.js → VTVPCSOJ.js} +2 -2
  294. package/dist/cdn/{TO66PKJF.js → W2RRYIVC.js} +2 -2
  295. package/dist/cdn/{IMTDRHTU.js → W3WAMZRW.js} +1 -1
  296. package/dist/cdn/{WY23ERGW.js → W47W63ZI.js} +2 -2
  297. package/dist/cdn/{JMBWWCV6.js → W54E24J4.js} +2 -2
  298. package/dist/cdn/{MNNUTOFN.js → W6JMDPEX.js} +1 -1
  299. package/dist/cdn/{L7GUOPMU.js → W7EADDXL.js} +2 -2
  300. package/dist/cdn/{5O75XOMI.js → W7JCIXQB.js} +2 -2
  301. package/dist/cdn/{3X7XYYFW.js → WJ66Q24A.js} +2 -2
  302. package/dist/cdn/{3LHVSQGT.js → WJHAIMMP.js} +2 -2
  303. package/dist/cdn/{VXVWFC3D.js → WLCWFEFA.js} +2 -2
  304. package/dist/cdn/{GT7IOPMK.js → WOGFIR3E.js} +2 -2
  305. package/dist/cdn/{BXQASW7J.js → WPYH5QCE.js} +1 -1
  306. package/dist/cdn/{5A6Y54WJ.js → WQPN3U5A.js} +2 -2
  307. package/dist/cdn/{WERJXBD5.js → WYV4FWVR.js} +1 -1
  308. package/dist/cdn/{5QF7JXXA.js → X2LHTYBS.js} +2 -2
  309. package/dist/cdn/{DDTBMHDE.js → X3MGYKAA.js} +2 -2
  310. package/dist/cdn/{B6FXHHYN.js → X56WS44V.js} +2 -2
  311. package/dist/cdn/{NCI5BIFP.js → X7PJKWCS.js} +2 -2
  312. package/dist/cdn/{XBL3EGZR.js → XFPRHAJS.js} +2 -2
  313. package/dist/cdn/{OCFWH2MU.js → XIQRELVI.js} +2 -2
  314. package/dist/cdn/{C2ENPVZG.js → XOICTNAX.js} +2 -2
  315. package/dist/cdn/{IUNP2FEQ.js → XR77S45T.js} +2 -2
  316. package/dist/cdn/{BEHKUS5D.js → XSSWDAZD.js} +2 -2
  317. package/dist/cdn/{5YYJDNXT.js → XTRCBDVE.js} +2 -2
  318. package/dist/cdn/{CTC7YRAU.js → XXJZBEJK.js} +2 -2
  319. package/dist/cdn/{6DO5FV6V.js → Y4KY2BT6.js} +2 -2
  320. package/dist/cdn/{JZIIJVDB.js → Y7PYZFGF.js} +2 -2
  321. package/dist/cdn/{7ASZTQ45.js → YACWQ43M.js} +2 -2
  322. package/dist/cdn/{URS66YMT.js → YCR4UW2R.js} +2 -2
  323. package/dist/cdn/{OE4MMX4T.js → YDPBZG4I.js} +2 -2
  324. package/dist/cdn/{ASDXD6UG.js → YJNKYO7U.js} +1 -1
  325. package/dist/cdn/{ECC74KLR.js → YKN26FEK.js} +2 -2
  326. package/dist/cdn/{CAPI4G74.js → YL3MEG3W.js} +2 -2
  327. package/dist/cdn/{45HNI5CK.js → YLRTFGI4.js} +2 -2
  328. package/dist/cdn/{COPHOT6L.js → YPPMRTOK.js} +1 -1
  329. package/dist/cdn/{FD2JMETF.js → YSD4IXAD.js} +2 -2
  330. package/dist/cdn/{CVKEYABL.js → YTKNEJX6.js} +2 -2
  331. package/dist/cdn/{LHJTXTF5.js → YUQPGIF2.js} +2 -2
  332. package/dist/cdn/{VY7447H3.js → YWLL7PI6.js} +2 -2
  333. package/dist/cdn/{SEQYFJN3.js → YXKKXNN6.js} +2 -2
  334. package/dist/cdn/{S3VHQFOC.js → YYE5JLDE.js} +2 -2
  335. package/dist/cdn/{Z5K6UMGM.js → Z62WB65N.js} +2 -2
  336. package/dist/cdn/ZA6OBRNM.js +18 -0
  337. package/dist/cdn/{FO5BU27P.js → ZCNYP4GS.js} +2 -2
  338. package/dist/cdn/{37TV2MQL.js → ZEC26XA5.js} +2 -2
  339. package/dist/cdn/{YVGSFUVM.js → ZIQLKBJ5.js} +2 -2
  340. package/dist/cdn/{YAGTTBJW.js → ZNXVWPPB.js} +2 -2
  341. package/dist/cdn/{2BUXYBPD.js → ZOU5ALFP.js} +2 -2
  342. package/dist/cdn/{YQ67CMRM.js → ZQUOKCF6.js} +1 -1
  343. package/dist/cdn/{FZE37VRW.js → ZTJFOSFR.js} +2 -2
  344. package/dist/cdn/index.js +2 -2
  345. package/dist/chunks/Auth.js +1 -1
  346. package/dist/chunks/CardsFetcher.js +1 -1
  347. package/dist/chunks/appConfig.js +1 -1
  348. package/dist/chunks/cardFetchingUtils.js +1 -1
  349. package/dist/chunks/cardsHelpers.js +1 -1
  350. package/dist/chunks/common.js +1 -1
  351. package/dist/chunks/deployAppContexts.js +1 -1
  352. package/dist/chunks/downloadUtils.js +1 -1
  353. package/dist/chunks/getItemIcon.js +1 -1
  354. package/dist/chunks/helpers.js +1 -1
  355. package/dist/chunks/interfaces.js +1 -1
  356. package/dist/chunks/loadModules.js +1 -1
  357. package/dist/chunks/mapViewUtils.js +1 -1
  358. package/dist/chunks/pciUtils.js +1 -1
  359. package/dist/chunks/popupUtils.js +1 -1
  360. package/dist/chunks/prepareDataForSolutionDisplay.js +1 -1
  361. package/dist/chunks/privilegeUtils.js +1 -1
  362. package/dist/chunks/publicNotificationContext.js +1 -1
  363. package/dist/chunks/queryUtils.js +1 -1
  364. package/dist/chunks/runtime.js +1 -1
  365. package/dist/chunks/solution-store.js +1 -1
  366. package/dist/chunks/templates.js +1 -1
  367. package/dist/chunks/useT9n.js +1 -1
  368. package/dist/components/arcgis-solutions-assistant/customElement.js +1 -1
  369. package/dist/components/basemap-gallery/customElement.js +1 -1
  370. package/dist/components/buffer-tools/customElement.js +1 -1
  371. package/dist/components/card-manager/customElement.js +1 -1
  372. package/dist/components/consent-manager/customElement.js +1 -1
  373. package/dist/components/create-feature/customElement.js +1 -1
  374. package/dist/components/create-related-feature/customElement.js +1 -1
  375. package/dist/components/crowdsource-manager/customElement.js +1 -1
  376. package/dist/components/crowdsource-reporter/customElement.js +1 -1
  377. package/dist/components/deduct-calculator/customElement.js +1 -1
  378. package/dist/components/delete-button/customElement.js +1 -1
  379. package/dist/components/delete-dialog/customElement.js +1 -1
  380. package/dist/components/edit-card/customElement.js +1 -1
  381. package/dist/components/feature-details/customElement.js +1 -1
  382. package/dist/components/feature-list/customElement.js +1 -1
  383. package/dist/components/field-selection/customElement.js +1 -1
  384. package/dist/components/floor-filter/customElement.js +1 -1
  385. package/dist/components/info-card/customElement.js +1 -1
  386. package/dist/components/json-editor/customElement.js +1 -1
  387. package/dist/components/layer-list/customElement.js +1 -1
  388. package/dist/components/layer-table/customElement.js +4 -3
  389. package/dist/components/map-card/customElement.js +4 -3
  390. package/dist/components/map-draw-tools/customElement.js +1 -1
  391. package/dist/components/map-fullscreen/customElement.js +1 -1
  392. package/dist/components/map-layer-picker/customElement.js +1 -1
  393. package/dist/components/map-legend/customElement.js +1 -1
  394. package/dist/components/map-picker/customElement.js +1 -1
  395. package/dist/components/map-search/customElement.js +1 -1
  396. package/dist/components/map-select-tools/customElement.js +1 -1
  397. package/dist/components/map-tools/customElement.js +1 -1
  398. package/dist/components/pci-calculator/customElement.js +1 -1
  399. package/dist/components/pdf-download/customElement.js +1 -1
  400. package/dist/components/public-notification/customElement.js +1 -1
  401. package/dist/components/refine-selection/customElement.js +1 -1
  402. package/dist/components/selection-tool/customElement.js +1 -1
  403. package/dist/components/solution-article-card/customElement.js +1 -1
  404. package/dist/components/solution-configuration/customElement.js +1 -1
  405. package/dist/components/solution-configure-dialog/customElement.js +1 -1
  406. package/dist/components/solution-configure-titles/customElement.js +1 -1
  407. package/dist/components/solution-contents/customElement.js +1 -1
  408. package/dist/components/solution-delete-dialog/customElement.js +1 -1
  409. package/dist/components/solution-deploy-dialog/customElement.js +1 -1
  410. package/dist/components/solution-deployed-card/customElement.js +1 -1
  411. package/dist/components/solution-deploying-dialog/customElement.js +1 -1
  412. package/dist/components/solution-details-card/customElement.js +1 -1
  413. package/dist/components/solution-details-panel/customElement.js +1 -1
  414. package/dist/components/solution-item/customElement.js +1 -1
  415. package/dist/components/solution-item-accordion/customElement.js +1 -1
  416. package/dist/components/solution-item-details/customElement.js +1 -1
  417. package/dist/components/solution-item-diagram/customElement.js +1 -1
  418. package/dist/components/solution-item-icon/customElement.js +1 -1
  419. package/dist/components/solution-item-sharing/customElement.js +1 -1
  420. package/dist/components/solution-organization-variables/customElement.js +1 -1
  421. package/dist/components/solution-resource-item/customElement.js +1 -1
  422. package/dist/components/solution-snapshot-gallery/customElement.js +1 -1
  423. package/dist/components/solution-social-share/customElement.js +1 -1
  424. package/dist/components/solution-spatial-ref/customElement.js +1 -1
  425. package/dist/components/solution-template-data/customElement.js +1 -1
  426. package/dist/components/solution-variables/customElement.js +1 -1
  427. package/dist/components/solutions-all-panel/customElement.js +1 -1
  428. package/dist/components/solutions-all-shell/customElement.js +1 -1
  429. package/dist/components/solutions-article-panel/customElement.js +1 -1
  430. package/dist/components/solutions-articles/customElement.js +1 -1
  431. package/dist/components/solutions-articles-shell/customElement.js +1 -1
  432. package/dist/components/solutions-deploy-app/customElement.js +13 -13
  433. package/dist/components/solutions-deploy-app-nav/customElement.d.ts +2 -0
  434. package/dist/components/solutions-deploy-app-nav/customElement.js +30 -15
  435. package/dist/components/solutions-deployed-filter-panel/customElement.js +1 -1
  436. package/dist/components/solutions-deployed-panel/customElement.js +1 -1
  437. package/dist/components/solutions-deployed-shell/customElement.js +1 -1
  438. package/dist/components/solutions-filter-panel/customElement.js +1 -1
  439. package/dist/components/solutions-searchsort-toolbar/customElement.js +1 -1
  440. package/dist/components/spatial-ref/customElement.js +1 -1
  441. package/dist/components/store-manager/customElement.js +1 -1
  442. package/dist/docs/api.json +38 -1
  443. package/dist/docs/docs.json +30 -1
  444. package/dist/docs/vscode.html-custom-data.json +1 -1
  445. package/dist/docs/web-types.json +2 -2
  446. package/dist/index.js +1 -1
  447. package/dist/loader.js +2 -2
  448. package/package.json +1 -1
  449. package/dist/cdn/7YT73G5X.js +0 -4
  450. package/dist/cdn/CLIFIAZI.js +0 -4
  451. package/dist/cdn/IBFX4PWN.js +0 -18
  452. package/dist/cdn/JJ33PDCY.js +0 -4
  453. package/dist/cdn/P3SCBY53.js +0 -4
  454. package/dist/cdn/STTGVLDE.js +0 -4
  455. package/dist/cdn/WF2LBWF7.js +0 -4
  456. package/dist/cdn/WVURBKDW.js +0 -18
  457. package/dist/cdn/XO3JIQCS.js +0 -4
  458. package/dist/cdn/XQ5KACZ3.js +0 -18
  459. package/dist/cdn/XU2SIPXX.js +0 -18
@@ -1,7 +1,7 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/1.2/esri/copyright.txt for details.
3
- v1.2.0-next.3 */
4
- import{a as Qn}from"./4GQA73TQ.js";import{a as Zn}from"./25CBXU7A.js";import"./T2TMGGNG.js";import"./HEO5YC5E.js";import{b as Jn}from"./BVPEEMND.js";import{C as Qs,D as _s,E as $n,h as Hn,i as Wn}from"./64JDACKK.js";import"./IMTDRHTU.js";(function(){let C=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};C.requestAnimationFrame===void 0&&(C.setImmediate===void 0?C.requestAnimationFrame=x=>C.setTimeout(x,0):C.requestAnimationFrame=C.setImmediate);class g{static ur=C.navigator!==void 0&&C.navigator.platform!==void 0&&C.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static NP(t,e,i){let s=-1;return function(){let n=this,o=arguments;s!==-1&&g.yc(s),s=g.dn(()=>{s=-1,i||t.apply(n,o)},e),i&&!s&&t.apply(n,o)}}static dn(t,e){return C.setTimeout(t,e)}static yc(t){C.clearTimeout(t)}static Ni(t){return C.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),g.o(i)}static se(t,e,i,s){}static s(t,e,i,s){}static CU(t,e,i){}static wc(t,e,i){if(t===null||typeof t!="object"){let s=g.LL(e);i!==void 0&&(s+="."+i),g.si(t,"object",s)}}static S(t,e,i){g.s(t,"function",e,i)}static LU(t,e,i){}static si(t,e,i,s){}static J(t,e,i,s){let n=g.LL(i);s!==void 0&&(n+="."+s),g.o(n+" is not in the range "+e+": "+t)}static Gi(t){}static dr(t,e){}static ne(t){C.console&&C.console.log(t)}static $(t){return t!==null&&typeof t=="object"}static nt(t){return typeof t=="function"}static CP=[];static ot(){let t=g.CP.pop();return t===void 0?[]:t}static Z(t){t.length=0,g.CP.push(t)}static AU=Object.freeze([]);static LL(t){return t===null?"*":typeof t=="string"?t:g.nt(t)?t.name:""}static Hn(t){return g.nt(t)?t.className?t.className:t.name:g.$(t)&&t.constructor?g.Hn(t.constructor):typeof t}static Wa(t,e){return e==null||e===""?null:g.$(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return 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 Hw(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.TU;if(s&&s[e])return!0;i=Object.getPrototypeOf(i)}return!1}static zF(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 XF(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 We(t){return g.zF(g.XF(t))}static color1="@COLOR1";static color2="@COLOR2";static jw="32ab5ff3b26f42dc0ed90f21412913b5"}g.vfo="29e647fdb3";class z{LP;constructor(){this.LP=[]}toString(){return this.LP.join("")}add(t){t!==""&&this.LP.push(t)}}class W{}class J{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}Ml(){}toString(){return"EmptyIterator"}static instance=new J}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):J.instance}get count(){return 1}Ml(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class et{jt;Xs;Gt;Tt;constructor(t){this.jt=t,this.Xs=null,t.gr=null,this.Gt=t.lt,this.Tt=-1}[Symbol.iterator](){return this.Xs===null?this.jt.r.values():this.jt.r.filter(this.Xs).values()}key;value;get iterator(){return this}get predicate(){return this.Xs}set predicate(t){this.Xs=t}reset(){let t=this.jt;t.gr=null,this.Gt=t.lt,this.Tt=-1}next(){let t=this.jt;if(t.lt!==this.Gt){if(this.key<0)return!1;g.Gi(t)}let e=t.r,i=e.length,s=++this.Tt,n=this.Xs;if(n!==null)for(;s<i;){let o=e[s];if(n(o))return this.Tt=s,this.key=s,this.value=o,!0;s++}else{if(s<i)return this.key=s,this.value=e[s],!0;this.Ml()}return!1}hasNext(){return this.next()}first(){let t=this.jt;this.Gt=t.lt,this.Tt=0;let e=t.r,i=e.length,s=this.Xs;if(s!==null){let n=0;for(;n<i;){let o=e[n];if(s(o))return this.Tt=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.jt;e.gr=null;let i=e.lt;this.Tt=-1;let s=e.r,n=s.length,o=this.Xs;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(t(a))return!0;e.lt!==i&&g.Gi(e)}}return!1}all(t){let e=this.jt;e.gr=null;let i=e.lt;this.Tt=-1;let s=e.r,n=s.length,o=this.Xs;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(!t(a))return!1;e.lt!==i&&g.Gi(e)}}return!0}each(t){let e=this.jt;e.gr=null;let i=e.lt;this.Tt=-1;let s=e.r,n=s.length,o=this.Xs;for(let r=0;r<n;r++){let a=s[r];o!==null&&!o(a)||(t(a),e.lt!==i&&g.Gi(e))}return this}map(t){let e=this.jt;e.gr=null;let i=e.lt;this.Tt=-1;let s=[],n=e.r,o=n.length,r=this.Xs;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(s.push(t(l)),e.lt!==i&&g.Gi(e))}let a=new U;return a.r=s,a.Yi(),a.iterator}filter(t){let e=this.jt;e.gr=null;let i=e.lt;this.Tt=-1;let s=[],n=e.r,o=n.length,r=this.Xs;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(t(l)&&s.push(l),e.lt!==i&&g.Gi(e))}let a=new U;return a.r=s,a.Yi(),a.iterator}get count(){let t=this.Xs;if(t!==null){let e=0,i=this.jt.r,s=i.length;for(let n=0;n<s;n++)t(i[n])&&e++;return e}else return this.jt.r.length}Ml(){this.key=-1,this.value=null,this.Gt=-1,this.Xs=null,this.jt.gr=this}toString(){return"ListIterator@"+this.Tt+"/"+this.jt.count}}class ct{jt;Gt;Tt;constructor(t){this.jt=t,t.pr=null,this.Gt=t.lt,this.Tt=t.r.length}[Symbol.iterator](){return this.jt.r.reverse().values()}key;value;get iterator(){return this}reset(){let t=this.jt;t.pr=null,this.Gt=t.lt,this.Tt=t.r.length}next(){let t=this.jt;if(t.lt!==this.Gt){if(this.key<0)return!1;g.Gi(t)}let e=--this.Tt;return e>=0?(this.key=e,this.value=t.r[e],!0):(this.Ml(),!1)}hasNext(){return this.next()}first(){let t=this.jt;this.Gt=t.lt;let e=t.r,i=e.length-1;if(this.Tt=i,i>=0){let s=e[i];return this.key=i,this.value=s,s}else return null}any(t){let e=this.jt;e.pr=null;let i=e.lt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];if(t(r))return!0;e.lt!==i&&g.Gi(e)}return!1}all(t){let e=this.jt;e.pr=null;let i=e.lt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];if(!t(r))return!1;e.lt!==i&&g.Gi(e)}return!0}each(t){let e=this.jt;e.pr=null;let i=e.lt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];t(r),e.lt!==i&&g.Gi(e)}return this}map(t){let e=this.jt;e.pr=null;let i=e.lt,s=[],n=e.r,o=n.length;this.Tt=o;for(let a=o-1;a>=0;a--){let h=n[a];s.push(t(h)),e.lt!==i&&g.Gi(e)}let r=new U;return r.r=s,r.Yi(),r.iterator}filter(t){let e=this.jt;e.pr=null;let i=e.lt,s=[],n=e.r,o=n.length;this.Tt=o;for(let a=o-1;a>=0;a--){let h=n[a];t(h)&&s.push(h),e.lt!==i&&g.Gi(e)}let r=new U;return r.r=s,r.Yi(),r.iterator}get count(){return this.jt.r.length}Ml(){this.key=-1,this.value=null,this.Gt=-1,this.jt.pr=this}toString(){return"ListIteratorBackwards("+this.Tt+"/"+this.jt.count+")"}}class U{f;r;lt;gr;pr;constructor(t){I.Je(this),this.f=!1,this.r=[],this.lt=0,this.gr=null,this.pr=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.r.values()}Yi(){let t=this.lt;t++,t>999999999&&(t=0),this.lt=t}b(){return this.f=!0,this}ce(){return this.f=!1,this}toString(){return"List()#"+I.xs(this)}add(t){return this.f&&g.L(this,t),this.r.push(t),this.Yi(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.f&&g.L(this);let e=this.r;if(t.first){let i=t.iterator;for(;i.next();)e.push(i.value)}else for(let i of t)e.push(i);return this.Yi(),this}clear(){this.f&&g.L(this),this.r.length=0,this.Yi()}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)&&g.J(t,"0 <= i < length",U,"elt:i"),e[t]}get(t){return this.elt(t)}setElt(t,e){let i=this.r;(t<0||t>=i.length)&&g.J(t,"0 <= i < length",U,"setElt:i"),this.f&&g.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.f&&g.L(this);let t=this.r;if(t.length>0){let e=t.pop();return e===void 0?null:e}return null}any(t){let e=this.r,i=this.lt,s=e.length;for(let n=0;n<s;n++){if(t(e[n]))return!0;this.lt!==i&&g.Gi(this)}return!1}all(t){let e=this.r,i=this.lt,s=e.length;for(let n=0;n<s;n++){if(!t(e[n]))return!1;this.lt!==i&&g.Gi(this)}return!0}each(t){let e=this.r,i=this.lt,s=e.length;for(let n=0;n<s;n++)t(e[n]),this.lt!==i&&g.Gi(this);return this}map(t){let e=new U,i=[],s=this.r,n=this.lt,o=s.length;for(let r=0;r<o;r++)i.push(t(s[r])),this.lt!==n&&g.Gi(this);return e.r=i,e.Yi(),e}filter(t){let e=new U,i=[],s=this.r,n=this.lt,o=s.length;for(let r=0;r<o;r++){let a=s[r];t(a)&&i.push(a),this.lt!==n&&g.Gi(this)}return e.r=i,e.Yi(),e}insertAt(t,e){t<0&&g.J(t,">= 0",U,"insertAt:i"),this.f&&g.L(this,t);let i=this.r;t>=i.length?i.push(e):i.splice(t,0,e),this.Yi()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.f&&g.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.Yi(),!0)}removeAt(t){let e=this.r;(t<0||t>=e.length)&&g.J(t,"0 <= i < length",U,"removeAt:i"),this.f&&g.L(this,t),t===e.length-1?e.pop():e.splice(t,1),this.Yi()}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.f&&g.L(this);let n=t,o=e+1;for(;o<s;)i[n++]=i[o++];return i.length=s-(e-t+1),this.Yi(),this}copy(){let t=new U,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 AL(){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.f&&g.L(this),this.r.sort(t),this.Yi(),this}sortRange(t,e,i){let s=this.r,n=s.length;e===void 0&&(e=0),i===void 0&&(i=n),this.f&&g.L(this);let o=i-e;if(o<=1)return this;if((e<0||e>=n-1)&&g.J(e,"0 <= from < length",U,"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.Yi()),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.Yi(),this}reverse(){return this.f&&g.L(this),this.r.reverse(),this.Yi(),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 J.instance;let t=this.gr;return t!==null?(t.reset(),t):new et(this)}get iteratorBackwards(){if(this.r.length<=0)return J.instance;let t=this.pr;return t!==null?(t.reset(),t):new ct(this)}}class Lt{Do;oe;constructor(t){this.Do=t,this.oe=t.g.values()}[Symbol.iterator](){return this.Do.g.values()}key;value;get iterator(){return this}reset(){let t=this.Do;this.oe=t.g.values()}next(){let t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.Do.g.size===0?null:(this.oe=this.Do.g.values(),this.oe.next().value)}any(t){return this.Do.any(t)}all(t){return this.Do.all(t)}each(t){return this.Do.each(t),this}map(t){let e=new U;return this.Do.g.forEach(i=>e.add(t(i))),e.iterator}filter(t){let e=new U;return this.Do.g.forEach(i=>{t(i)&&e.add(i)}),e.iterator}get count(){return this.Do.count}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"SetIterator"}}class I{f;g;constructor(t){this.f=!1,this.g=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.values()}values(){return this.g.values()}b(){return this.f=!0,this}ce(){return this.f=!1,this}toString(){return"Set()#"+I.xs(this)}add(t){return t===null?this:(this.g.add(t),this)}addAll(t){if(t===null)return this;if(this.f&&g.L(this),t.first){let e=t.iterator;for(;e.next();)this.g.add(e.value)}else for(let e of t)this.g.add(e);return this}has(t){return this.g.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;if(t.first){let e=t.iterator;for(;e.next();)if(!this.has(e.value))return!1}else for(let e of t)if(!this.has(e))return!1;return!0}containsAny(t){if(t===null)return!0;if(t.first){let e=t.iterator;for(;e.next();)if(this.has(e.value))return!0}else for(let e of t)if(this.has(e))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.f&&g.L(this),this.g.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.f&&g.L(this),t.first){let e=t.iterator;for(;e.next();)this.delete(e.value)}else for(let e of t)this.delete(e);return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.f&&g.L(this);let e=new I;e.addAll(t);let i=[];if(t.first){let s=t.iterator;for(;s.next();){let n=s.value;e.has(n)||i.push(n)}}else for(let s of t)e.has(s)||i.push(s);return this.removeAll(i),this}clear(){this.f&&g.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 U;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?J.instance:new Lt(this)}entries(){return this.g.entries()}keys(){return this.g.keys()}forEach(t,e){return this.g.forEach(t,e)}static qw=1;static Je(t){t.__gohashid=I.qw++}static xs(t){return t.__gohashid}}class Rt{q;oe;constructor(t){this.q=t,this.oe=t.g.keys()}[Symbol.iterator](){return this.q.g.keys()}key;value;get iterator(){return this}reset(){let t=this.q;this.oe=t.g.keys()}next(){let t=this.oe.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.oe=this.q.g.keys(),this.oe.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 U;for(let s of e.g)i.add(t(s[0]));return i.iterator}filter(t){let e=this.q,i=new U;for(let s of e.g){let n=s[0];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapKeySetIterator"}}class le extends I{q;constructor(t){super(),I.Je(this),this.f=!0,this.q=t}[Symbol.iterator](){return this.g.keys()}values(){return this.g.keys()}b(){return this}ce(){return this}toString(){return"MapKeySet("+this.q.toString()+")"}add(t){g.o("This Set is read-only: "+this.toString())}has(t){return this.q.has(t)}contains(t){return this.has(t)}delete(t){g.o("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){g.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 le(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 U,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?J.instance:new Rt(this.q)}}class Ee{q;oe;constructor(t){this.q=t,this.oe=t.g.values()}[Symbol.iterator](){return this.q.g.values()}key;value;get iterator(){return this}reset(){let t=this.q;this.oe=t.g.values()}next(){let t=this.oe.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.oe=this.q.g.values(),this.oe.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 U;for(let s of e.g)i.add(t(s[1]));return i.iterator}filter(t){let e=this.q,i=new U;for(let s of e.g){let n=s[1];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapValueSetIterator"}}class Ht{constructor(t,e){this.key=t,this.value=e}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class $t{q;oe;constructor(t){this.q=t,this.oe=t.g.entries()}[Symbol.iterator](){return this.q.g.entries()}key;value;get iterator(){return this}reset(){let t=this.q;this.oe=t.g.entries()}next(){let t=this.oe.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.oe=this.q.g.entries();let t=this.oe.next().value;return this.key=t[0],this.value=t[1],new Ht(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 U,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ht(n,s):(i.key=n,i.value=s),e.add(t(i))}),e.iterator}filter(t){let e=new U,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ht(n,s):(i.key=n,i.value=s),t(i)&&(e.add(i),i=null)}),e.iterator}get count(){return this.q.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapIterator"}}class wt{f;g;constructor(t){I.Je(this),this.f=!1,this.g=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.entries()}entries(){return this.g.entries()}b(){return this.f=!0,this}ce(){return this.f=!1,this}toString(){return"Map()#"+I.xs(this)}set(t,e){return this.f&&g.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.f&&g.L(this),t instanceof wt){let e=t.iterator;for(;e.next();)this.g.set(e.key,e.value)}else if(t.first){let e=t.iterator;for(;e.next();){let i=e.value;this.g.set(i.key,i.value)}}else for(let e of t){let i=e;Array.isArray(i)?this.g.set(i[0],i[1]):this.g.set(i.key,i.value)}return this}first(){if(this.g.size===0)return null;let t=this.g.entries().next().value;return t?new Ht(t[0],t[1]):null}any(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ht(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 Ht(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 Ht(i,s):(e.key=i,e.value=s),t(e);return this}map(t){let e=new wt,i=null;for(let[s,n]of this.g)i===null?i=new Ht(s,n):(i.key=s,i.value=n),e.set(s,t(i));return e}filter(t){let e=new wt,i=null;for(let[s,n]of this.g)i===null?i=new Ht(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.f&&g.L(this,t),this.g.delete(t))}remove(t){return this.delete(t)}clear(){this.f&&g.L(this),this.g.clear()}copy(){let t=new wt;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 Ht(s[0],s[1]),i++;return e}toKeySet(){return new le(this)}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?J.instance:new $t(this)}get iteratorKeys(){return this.count<=0?J.instance:new Rt(this)}keys(){return this.g.keys()}get iteratorValues(){return this.count<=0?J.instance:new Ee(this)}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}}class P{px;py;f;constructor(t,e){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof e=="number"?(this.px=t,this.py=e):g.o("Invalid arguments to Point constructor: "+t+", "+e),this.f=!1}h(t){return this.px=t.px,this.py=t.py,this}e(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}kt(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().b()}b(){return this.f||(this.f=!0),this}Ww(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 g.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 A.u(this.px,t.x)&&A.u(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=A.Ee(t),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.TL(t.x-this.px,t.y-this.py)}direction(t,e){return this.TL(t-this.px,e-this.py)}TL(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 A.ku(t,e,i,s,n,o)}compareWithLineSegmentPoint(t,e){return A.ku(t.x,t.y,e.x,e.y,this.x,this.y)}static intersectingLineSegments(t,e,i,s,n,o,r,a){return A.Pu(t,e,i,s,n,o,r,a)}projectOntoLineSegment(t,e,i,s){return A.Nl(t,e,i,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,e){return A.Nl(t.x,t.y,e.x,e.y,this.px,this.py,this),this}snapToGrid(t,e,i,s){return A._g(this.px,this.py,t,e,i,s,this),this}snapToGridPoint(t,e){return A._g(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}v(t){return t.gt(this),this}Ki(t){return t.Ci(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 gn=new P(0,0).kt();static DL=new P(-1/0,-1/0).kt();static vL=new P(1/0,1/0).kt();static FL=new P(6,6).kt();static mn=new P(NaN,NaN).kt();static Jw=[];static l(){let t=P.Jw.pop();return t===void 0?new P:t}static bs(t){let e=P.Jw.pop();return e===void 0?t.copy():e.h(t)}static z(t,e){let i=P.Jw.pop();return i===void 0?new P(t,e):(i.x=t,i.y=e,i)}static i(t){P.Jw.push(t)}}class _{sw;sh;f;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):g.o("Invalid arguments to Size constructor: "+t+", "+e),this.f=!1}h(t){return this.sw=t.sw,this.sh=t.sh,this}e(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 _;return t.sw=this.sw,t.sh=this.sh,t}kt(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().b()}b(){return this.f||(this.f=!0),this}Ww(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 _(s,o)}else return new _}static stringify(t){return t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return g.s(t,"number",_,"stringifyFixed:digits"),e=>e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof _?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,e){return this.sw===t&&this.sh===e}equalsApprox(t){return A.u(this.sw,t.width)&&A.u(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&&g.J(t,">= 0",_,"width"),this.sw=t}get height(){return this.sh}set height(t){t<0&&g.J(t,">= 0",_,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static xc=new _(0,0).kt();static AP=new _(1,1).kt();static RL=new _(6,6).kt();static Su=new _(8,8).kt();static OL=new _(10,10).kt();static TP=new _(1/0,1/0).kt();static $w=new _(NaN,NaN).kt();static IL=[];static l(){let t=_.IL.pop();return t===void 0?new _:t}static i(t){_.IL.push(t)}}class B{rx;ry;rw;rh;f;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 _?(this.rx=n,this.ry=o,this.rw=e.width,this.rh=e.height):g.o("Incorrect second argument supplied to Rect constructor "+e)}else g.o("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+s);this.f=!1}h(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}e(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}jn(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 B;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}kt(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().b()}b(){return this.f||(this.f=!0),this}ce(){return this.f&&(Object.isFrozen(this)&&g.o("cannot thaw constant: "+this),this.f=!1),this}Ww(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 B(s,o,r,a)}else return new B}static stringify(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return g.s(t,"number",B,"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 B?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 A.u(this.rx,t.x)&&A.u(this.ry,t.y)&&A.u(this.rw,t.width)&&A.u(this.rh,t.height)}equalsApproxTo(t,e,i,s){return A.u(this.rx,t)&&A.u(this.ry,e)&&A.u(this.rw,i)&&A.u(this.rh,s)}equalsApproxClose(t){return A.X(this.rx,t.x)&&A.X(this.ry,t.y)&&A.X(this.rw,t.width)&&A.X(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.Zw(e,t,e,t)}addMargin(t){return this.Zw(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.Zw(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.Zw(t,e,i,s)}Zw(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.EL(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.EL(t,e,i,s)}EL(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))}UL(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.re(t.x,t.y,0,0)}unionRect(t){return this.re(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.re(t,e,i,s)}re(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}nearestSideDirection(t,e){return A.Qw(this,t,e,!0)}nearestSideDirectionPoint(t){return A.Qw(this,t.x,t.y,!0)}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,f=a,p=e,m=o;return d+=p,f+=m,!(p>f||m>d)}static intersectsLineSegment(t,e,i,s,n,o,r,a){return A.VL(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&&g.J(t,">= 0",B,"width"),this.rw=t}get height(){return this.rh}set height(t){t<0&&g.J(t,">= 0",B,"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 _(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 tm=new B(0,0,0,0).kt();static GF=new B(NaN,NaN,NaN,NaN).kt();static _w=[];static l(){let t=B._w.pop();return t===void 0?new B:t}static bs(t){let e=B._w.pop();return e===void 0?t.copy():e.h(t)}static z(t,e,i,s){let n=B._w.pop();return n===void 0?new B(t,e,i,s):n.e(t,e,i,s)}static i(t){B._w.push(t)}}class Dt{mt;mr;mb;ml;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):g.o("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+s)}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 Dt;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}kt(){return Object.freeze(this),this}N(){return Object.isFrozen(this)?this:this.copy().kt()}Ww(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 Dt;let o=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(o=parseFloat(n)),isNaN(o))return new Dt(s);let r=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(r=parseFloat(n)),isNaN(r))return new Dt(s,o);let a=NaN;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),isNaN(a)?new Dt(s,o):new Dt(s,o,r,a)}else return new Dt}static stringify(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return g.s(t,"number",Dt,"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 Dt?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 A.u(this.mt,t.top)&&A.u(this.mr,t.right)&&A.u(this.mb,t.bottom)&&A.u(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 em=new Dt(0,0,0,0).kt();static BL=new Dt(2,2,2,2).kt()}class T{sx;sy;ox;oy;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)}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 T;return t.sx=this.sx,t.sy=this.sy,t.ox=this.ox,t.oy=this.oy,t}kt(){return Object.freeze(this),this}N(){return Object.isFrozen(this)?this:this.copy().kt()}Ww(t){}Hi(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this.kt()}DU(t,e){(isNaN(t)||t>1||t<0)&&g.J(t,"0 <= "+e+" <= 1",T,e)}vU(t,e){(isNaN(t)||t===1/0||t===-1/0)&&g.J(t,"real number, not NaN or Infinity",T,e)}static parse(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return T.None;if(t==="TopLeft")return T.TopLeft;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return T.TopCenter;if(t==="TopRight")return T.TopRight;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return T.LeftCenter;if(t==="Center")return T.Center;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return T.RightCenter;if(t==="BottomLeft")return T.BottomLeft;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return T.BottomCenter;if(t==="BottomRight")return T.BottomRight;if(t==="TopSide")return T.TopSide;if(t==="LeftSide")return T.LeftSide;if(t==="RightSide")return T.RightSide;if(t==="BottomSide")return T.BottomSide;if(t==="TopBottomSides")return T.TopBottomSides;if(t==="LeftRightSides")return T.LeftRightSides;if(t==="TopLeftSides")return T.TopLeftSides;if(t==="TopRightSides")return T.TopRightSides;if(t==="BottomLeftSides")return T.BottomLeftSides;if(t==="BottomRightSides")return T.BottomRightSides;if(t==="NotTopSide")return T.NotTopSide;if(t==="NotLeftSide")return T.NotLeftSide;if(t==="NotRightSide")return T.NotRightSide;if(t==="NotBottomSide")return T.NotBottomSide;if(t==="AllSides")return T.AllSides;if(t==="Default")return T.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 T(s,o,r,a)}else return new T}static stringify(t){return t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return g.s(t,"number",T,"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(T.None)?"None":this.equals(T.TopLeft)?"TopLeft":this.equals(T.TopCenter)?"Top":this.equals(T.TopRight)?"TopRight":this.equals(T.LeftCenter)?"Left":this.equals(T.Center)?"Center":this.equals(T.RightCenter)?"Right":this.equals(T.BottomLeft)?"BottomLeft":this.equals(T.BottomCenter)?"Bottom":this.equals(T.BottomRight)?"BottomRight":this.equals(T.TopSide)?"TopSide":this.equals(T.LeftSide)?"LeftSide":this.equals(T.RightSide)?"RightSide":this.equals(T.BottomSide)?"BottomSide":this.equals(T.TopBottomSides)?"TopBottomSides":this.equals(T.LeftRightSides)?"LeftRightSides":this.equals(T.TopLeftSides)?"TopLeftSides":this.equals(T.TopRightSides)?"TopRightSides":this.equals(T.BottomLeftSides)?"BottomLeftSides":this.equals(T.BottomRightSides)?"BottomRightSides":this.equals(T.NotTopSide)?"NotTopSide":this.equals(T.NotLeftSide)?"NotLeftSide":this.equals(T.NotRightSide)?"NotRightSide":this.equals(T.NotBottomSide)?"NotBottomSide":this.equals(T.AllSides)?"AllSides":this.equals(T.Default)?"Default":"None"}equals(t){return t instanceof T?(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 T(.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(T.Left))t=T.LeftSide;else if(t.equals(T.Right))t=T.RightSide;else if(t.equals(T.Top))t=T.TopSide;else if(t.equals(T.Bottom))t=T.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 T(0,0,0,0).Hi(0);static Default=new T(0,0,-1,0).Hi(-1);static TopLeft=new T(0,0,0,0).kt();static TopCenter=new T(.5,0,0,0).kt();static TopRight=new T(1,0,0,0).kt();static LeftCenter=new T(0,.5,0,0).kt();static Center=new T(.5,.5,0,0).kt();static RightCenter=new T(1,.5,0,0).kt();static BottomLeft=new T(0,1,0,0).kt();static BottomCenter=new T(.5,1,0,0).kt();static BottomRight=new T(1,1,0,0).kt();static MiddleTop=T.TopCenter;static MiddleLeft=T.LeftCenter;static MiddleRight=T.RightCenter;static MiddleBottom=T.BottomCenter;static Top=T.TopCenter;static Left=T.LeftCenter;static Right=T.RightCenter;static Bottom=T.BottomCenter;static TopSide=new T(0,0,1,1).Hi(1);static LeftSide=new T(0,0,1,2).Hi(1);static RightSide=new T(0,0,1,4).Hi(1);static BottomSide=new T(0,0,1,8).Hi(1);static TopBottomSides=new T(0,0,1,9).Hi(1);static LeftRightSides=new T(0,0,1,6).Hi(1);static TopLeftSides=new T(0,0,1,3).Hi(1);static TopRightSides=new T(0,0,1,5).Hi(1);static BottomLeftSides=new T(0,0,1,10).Hi(1);static BottomRightSides=new T(0,0,1,12).Hi(1);static NotTopSide=new T(0,0,1,14).Hi(1);static NotLeftSide=new T(0,0,1,13).Hi(1);static NotRightSide=new T(0,0,1,11).Hi(1);static NotBottomSide=new T(0,0,1,7).Hi(1);static AllSides=new T(0,0,1,15).Hi(1);static DP=new T(.156,.156).kt();static vP=new T(.844,.844).kt()}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}FP(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1}Ue(){return this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0,this}bc(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}zL(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}tx(){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}ks(t,e,i){if(t=A.Ee(t),t===0)return this;this.Gs(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.Gs(-e,-i),this}Gs(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this}it(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this}YF(){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.e(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)}Ci(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.e(r*i+a*n,r*s+a*o)}Mu(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.e(h*i+l*n+r,h*s+l*o+a)}im(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,f=s*o+i*a+l,p=s*r+i*h+c,m=e*o+n*a+l,y=e*r+n*h+c,b=s*o+n*a+l,v=s*r+n*h+c,w=u,k=u,S=d,M=d;return w=Math.min(w,f),k=Math.max(k,f),S=Math.min(S,p),M=Math.max(M,p),w=Math.min(w,m),k=Math.max(k,m),S=Math.min(S,y),M=Math.max(M,y),w=Math.min(w,b),k=Math.max(k,b),S=Math.min(S,v),M=Math.max(M,v),t.e(w,S,k-w,M-S),t}static XL=[];static l(){let t=Pt.XL.pop();return t===void 0?new Pt:t}static i(t){Pt.XL.push(t)}static RP="54a702f3e53909c447824c6706603faf4c"}let A={KF:"7da71ca0ad381e90",qn:4*((Math.sqrt(2)-1)/3),GL:[],ex:x=>{if(x<=0)return 0;let t=A.GL;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);A.GL=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)},u:(x,t)=>{let e=x-t;return e<.5&&e>-.5},X:(x,t)=>{let e=x-t;return e<5e-8&&e>-5e-8},Ve:(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,f=l-s;if(f<=o&&o<=d)if(c-u>d-f)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},ix:(x,t,e,i,s,n,o,r,a,h,l,c)=>{if(!A.Ve(x,t,o,r,c,e,i)||!A.Ve(x,t,o,r,c,s,n)){let u=(x+e)/2,d=(t+i)/2,f=(e+s)/2,p=(i+n)/2,m=(s+o)/2,y=(n+r)/2,b=(u+f)/2,v=(d+p)/2,w=(f+m)/2,k=(p+y)/2,S=(b+w)/2,M=(v+k)/2;return A.ix(x,t,u,d,b,v,S,M,a,h,l,c)||A.ix(S,M,w,k,m,y,o,r,a,h,l,c)}else return A.Ve(x,t,o,r,c,h,l)},YL:(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,f=(n+r)/2,p=(h+c)/2,m=(l+u)/2,y=(c+d)/2,b=(u+f)/2;return a.e((p+y)/2,(m+b)/2),a},HF:(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,f=(a+l)/2,p=(h+c)/2,m=(l+u)/2,y=(c+d)/2;return P.direction(f,p,m,y)},Nu:(x,t,e,i,s,n,o,r,a,h)=>{if(!A.Ve(x,t,o,r,a,e,i)||!A.Ve(x,t,o,r,a,s,n)){let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,f=(s+o)/2,p=(n+r)/2,m=(l+u)/2,y=(c+d)/2,b=(u+f)/2,v=(d+p)/2,w=(m+b)/2,k=(y+v)/2;A.Nu(x,t,l,c,m,y,w,k,a,h),A.Nu(w,k,b,v,f,p,o,r,a,h)}else h.re(x,t,0,0),h.re(o,r,0,0);return h},Wn:(x,t,e,i,s,n,o,r,a,h)=>{if(!A.Ve(x,t,o,r,a,e,i)||!A.Ve(x,t,o,r,a,s,n)){let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,f=(s+o)/2,p=(n+r)/2,m=(l+u)/2,y=(c+d)/2,b=(u+f)/2,v=(d+p)/2,w=(m+b)/2,k=(y+v)/2;A.Wn(x,t,l,c,m,y,w,k,a,h),A.Wn(w,k,b,v,f,p,o,r,a,h)}else h.length===0&&(h.push(x),h.push(t)),h.push(o),h.push(r);return h},OP:(x,t,e,i,s,n,o,r,a,h)=>{if(A.Ve(x,t,s,n,h,e,i))return A.Ve(x,t,s,n,h,r,a);{let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,f=(l+u)/2,p=(c+d)/2;return A.OP(x,t,l,c,f,p,o,r,a,h)||A.OP(f,p,u,d,s,n,o,r,a,h)}},IP:(x,t,e,i,s,n,o,r)=>{if(A.Ve(x,t,s,n,o,e,i))r.re(x,t,0,0),r.re(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;A.IP(x,t,a,h,u,d,o,r),A.IP(u,d,l,c,s,n,o,r)}return r},sm:(x,t,e,i,s,n,o,r)=>{if(A.Ve(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;A.sm(x,t,a,h,u,d,o,r),A.sm(u,d,l,c,s,n,o,r)}return r},nm:(x,t,e,i,s,n,o,r,a,h,l,c,u,d)=>{if(!A.Ve(x,t,o,r,u,e,i)||!A.Ve(x,t,o,r,u,s,n)){let f=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,b=(s+o)/2,v=(n+r)/2,w=(f+m)/2,k=(p+y)/2,S=(m+b)/2,M=(y+v)/2,F=(w+S)/2,D=(k+M)/2,N=1/0,L=!1,R=0,O=0;if(A.nm(x,t,f,p,w,k,F,D,a,h,l,c,u,d)){let V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,L=!0,R=d.x,O=d.y)}if(A.nm(F,D,S,M,b,v,o,r,a,h,l,c,u,d)){let V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,L=!0,R=d.x,O=d.y)}return L&&(d.x=R,d.y=O),L}else{if(!A.Pu(x,t,o,r,a,h,l,c))return!1;let f=(x-o)*(h-c)-(t-r)*(a-l);if(f===0)return!1;let p=((x*r-t*o)*(a-l)-(x-o)*(a*c-h*l))/f,m=((x*r-t*o)*(h-c)-(t-r)*(a*c-h*l))/f;return d.e(p,m),!0}},om:(x,t,e,i,s,n,o,r,a,h,l,c,u)=>{let d=0;if(!A.Ve(x,t,o,r,u,e,i)||!A.Ve(x,t,o,r,u,s,n)){let f=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,b=(s+o)/2,v=(n+r)/2,w=(f+m)/2,k=(p+y)/2,S=(m+b)/2,M=(y+v)/2,F=(w+S)/2,D=(k+M)/2;d+=A.om(x,t,f,p,w,k,F,D,a,h,l,c,u),d+=A.om(F,D,S,M,b,v,o,r,a,h,l,c,u)}else{let f=(x-o)*(h-c)-(t-r)*(a-l);if(f===0)return d;let p=((x*r-t*o)*(a-l)-(x-o)*(a*c-h*l))/f,m=((x*r-t*o)*(h-c)-(t-r)*(a*c-h*l))/f;if(p>=l)return d;let y=0,b=0;if((a>l?a-l:l-a)<(h>c?h-c:c-h)){if(t<r?(y=t,b=r):(y=r,b=t),m<y||m>b)return d}else if(x<o?(y=x,b=o):(y=o,b=x),p<y||p>b)return d;f>0?d++:f<0&&d--}return d},Nl:(x,t,e,i,s,n,o)=>{if(A.X(x,e)){let r=0,a=0;t<i?(r=t,a=i):(r=i,a=t);let h=n;return h<r?(o.e(x,r),!1):h>a?(o.e(x,a),!1):(o.e(x,h),!0)}else if(A.X(t,i)){let r=0,a=0;x<e?(r=x,a=e):(r=e,a=x);let h=s;return h<r?(o.e(r,t),!1):h>a?(o.e(a,t),!1):(o.e(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.e(x,t),!1;if(a>1.000005)return o.e(e,i),!1;{let h=x+a*(e-x),l=t+a*(i-t);return o.e(h,l),!0}}},vo:(x,t,e,i,s,n,o,r,a)=>{if(A.u(x,e)&&A.u(t,i))return a.e(x,t),!1;if(A.X(s,o)){if(A.X(x,e))return A.Nl(x,t,e,i,s,n,a),!1;{let h=(i-t)/(e-x)*(s-x)+t;return A.Nl(x,t,e,i,s,h,a)}}else{let h=(r-n)/(o-s);if(A.X(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.e(x,c),!1):l>u?(a.e(x,u),!1):(a.e(x,l),!0)}else{let l=(i-t)/(e-x);if(A.X(h,l))return A.Nl(x,t,e,i,s,n,a),!1;{let c=(l*x-h*s+n-t)/(l-h);if(A.X(l,0)){let u=0,d=0;return x<e?(u=x,d=e):(u=e,d=x),c<u?(a.e(u,t),!1):c>d?(a.e(d,t),!1):(a.e(c,t),!0)}else{let u=l*(c-x)+t;return A.Nl(x,t,e,i,c,u,a)}}}}},Cl:(x,t,e,i,s,n,o,r,a)=>{let h=1e21,l=x,c=t;if(A.vo(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(A.vo(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(A.vo(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(A.vo(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.e(l,c),h<1e21},nx:(x,t,e)=>A.VL(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),VL:(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!!(B.contains(x,t,e,i,s,n)||B.contains(x,t,e,i,o,r)||A.Pu(a,l,h,l,s,n,o,r)||A.Pu(h,l,h,c,s,n,o,r)||A.Pu(h,c,a,c,s,n,o,r)||A.Pu(a,c,a,l,s,n,o,r))},Pu:(x,t,e,i,s,n,o,r)=>x===e&&t===i&&s===o&&n===r?x===s&&t===n:A.ku(x,t,e,i,s,n)*A.ku(x,t,e,i,o,r)<=0&&A.ku(s,n,o,r,x,t)*A.ku(s,n,o,r,e,i)<=0,ku:(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},Qw(x,t,e,i){i===void 0&&(i=!1);let s=0,n=x===null?t:(t-x.x)/(x.width>0?x.width:1),o=x===null?e:(e-x.y)/(x.height>0?x.height:1);return n>o?n>1-o||(i||n<1-o?s=270:s=315):i||n<o?n>1-o?s=90:i||n<1-o?s=180:s=135:n<.5?s=225:n>.5&&(s=45),s},Ee:x=>(x>=360?x-=360:x<0&&(x+=360),x),jF:(x,t)=>x>t?Math.min(x-t,Math.abs(x-360-t)):t>x?Math.min(t-x,Math.abs(x-(t-360))):0,KL:(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 f=u+r*Math.min(d,c),p=x+e*Math.cos(u),m=t+e*Math.sin(u),y=x+e*Math.cos(f),b=t+e*Math.sin(f),v=(p+y)/2,w=(m+b)/2;return l.push([p,m,v,w,v,w,y,b]),l}for(;d>a;){let f=u+r*Math.min(d,c);l.push(A.qF(e,u,f,x,t)),d-=Math.abs(f-u),u=f}return l},qF:(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,f=h+u*a,p=d,m=-f,y=n+t,b=Math.cos(y),v=Math.sin(y);return[i+x*Math.cos(t),s+x*Math.sin(t),i+d*b-f*v,s+d*v+f*b,i+p*b-m*v,s+p*v+m*b,i+x*Math.cos(e),s+x*Math.sin(e)]},_g:(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.e(c,u),o},HL:(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},WF:(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),A.JF(h,l,c,u,0,0)},JF:(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,f=9999999999;for(let y=0;y<f&&(d=.5*(c+u),!(d===c||d===u));++y){let b=h/(d+r),v=l/(d+a),w=b*b+v*v-1;if(w>0)c=d;else if(w<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},Jn:{},rm:new W,yr:new W,wr:0,lm:100};A.za=A.KF;var ii=(x=>(x[x.Line=1]="Line",x[x.Rectangle=2]="Rectangle",x[x.Ellipse=3]="Ellipse",x[x.Path=4]="Path",x))(ii||{}),ys=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x))(ys||{});class St{n;am;hm;kc;Cu;Lu;$n;Zn;Qn;W;Li;Ai;ni;oi;Ys;Pc;Sc;constructor(t,e){I.Je(this),this.n=2,t===void 0&&(t=4),this.W=t,this.Li=0,this.Ai=0,this.ni=0,this.oi=0,t===4?this.Ys=new U:this.Ys=St.lx,this.am=this.Ys.lt,this.hm=new B,this.kc=null,this.Cu=null,this.Lu=NaN,this.$n=T.TopLeft,this.Zn=T.BottomRight,this.Pc=NaN,this.Sc=NaN,this.Qn=2,e&&Object.assign(this,e)}copy(){let t=new St;if(t.n=this.n&-2,t.W=this.W,t.Li=this.Li,t.Ai=this.Ai,t.ni=this.ni,t.oi=this.oi,this.W===4){let e=this.Ys.r,i=t.Ys;for(let s=0;s<e.length;s++){let n=e[s];i.add(n.copy())}t.Ys=i}else t.Ys=this.Ys;return t.am=this.am,t.hm.h(this.hm),t.kc=this.kc,t.Cu=this.Cu,t.Lu=this.Lu,t.$n=this.$n.N(),t.Zn=this.Zn.N(),t.Pc=this.Pc,t.Sc=this.Sc,t.Qn=this.Qn,t}static Line=1;static Rectangle=2;static Ellipse=3;static Path=4;static lx=new U().b();get f(){return(this.n&1)!==0}set f(t){t?this.n|=1:this.n&=-2}get yt(){return(this.n&2)!==0}set yt(t){t?this.n|=2:this.n&=-3}b(){if(this.f=!0,this.type!==4)return this;let t=this.figures;t.b();for(let e of t)e.b();return this}equalsApprox(t){if(!(t instanceof St))return!1;if(this.type!==t.type)return this.type===1&&t.type===4?this.jL(t):t.type===1&&this.type===4?t.jL(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 A.u(this.startX,t.startX)&&A.u(this.startY,t.startY)&&A.u(this.endX,t.endX)&&A.u(this.endY,t.endY)}jL(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&&A.u(this.startX,e.startX)&&A.u(this.startY,e.startY)){let i=e.segments.elt(0);if(i.type===2&&A.u(this.endX,i.endX)&&A.u(this.endY,i.endY))return!0}}return!1}static stringify(t){return t.toString()}static stringifyFixed(t){return g.s(t,"number",St,"stringifyFixed:digits"),e=>e.toString(t)}fe(t){t in ii?this.type=t:g.dr(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 B(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 B(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 ii[this.type]}}static fillPath(t){typeof t!="string"&&g.si(t,"string",St,"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 cm="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";static parse(t,e){e===void 0&&(e=!1),typeof t!="string"&&g.si(t,"string",St,"parse:str");let i=new RegExp("(["+St.cm+"])(["+St.cm+"])","gm"),s=new RegExp("(["+St.cm+"])([^s])","gm"),n=new RegExp("([^s])(["+St.cm+"])","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=g.ot(),K="",Y=!1;for(let X=0;X<O.length;X++){let G=O[X];G==="."&&!Y?(Y=!0,K+=G):G==="."?(V.push(K),K="."):K+=G}V.push(K),o.splice(R,1);for(let X=0;X<V.length;X++)o.splice(R+X,0,V[X]);R+=V.length-1,g.Z(V)}}let r=-1,a="",h="",l=new P(0,0),c=new P(0,0),u=new P(0,0),d=!0;function f(){return r>=w-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.e(O,V)}function y(){return m(u),u}function b(){return m(c),c}function v(){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 w=o.length,k=Ye.qL(null),S=!1,M=!1,F=!1,D=!0,N=new RegExp("["+St.cm+"]");for(;!(r>=w-1);){if(h=a,a=p(),a==="")continue;d=!0;let R=!1;switch(a.toUpperCase()){case"X":D=!0,S=!1,M=!1;break;case"M":let O=y();for(k.Ne===null||D===!0?(k.Au(O.x,O.y,S,!1,!M,F),D=!1):k.$F(O.x,O.y),l.h(u);!f();){let V=y();k.Ks(V.x,V.y)}break;case"L":for(;!f();){let V=y();k.Ks(V.x,V.y)}d&&(R=!0);break;case"H":for(;!f();)u.e((a===a.toLowerCase()?u.x:0)+parseFloat(p()),u.y),k.Ks(u.x,u.y);break;case"V":for(;!f();)u.e(u.x,(a===a.toLowerCase()?u.y:0)+parseFloat(p())),k.Ks(u.x,u.y);d&&(R=!0);break;case"C":for(;!f();){let V=new P;m(V);let K=b(),Y=y();k.xr(V.x,V.y,K.x,K.y,Y.x,Y.y)}d&&(R=!0);break;case"S":for(;!f();){let V=v(),K=b(),Y=y();k.xr(V.x,V.y,K.x,K.y,Y.x,Y.y)}d&&(R=!0);break;case"Q":for(;!f();){let V=b(),K=y();k.Tu(V.x,V.y,K.x,K.y)}d&&(R=!0);break;case"T":for(;!f();){let V=v();c.h(V);let K=y();k.Tu(V.x,V.y,K.x,K.y),c.h(K)}d&&(R=!0);break;case"B":for(;!f();){let V=parseFloat(p()),K=parseFloat(p()),Y=parseFloat(p()),X=parseFloat(p()),G=parseFloat(p()),rt=G,lt=!1;f()||(rt=parseFloat(p()),f()||(lt=parseFloat(p())!==0)),a===a.toLowerCase()&&(Y+=u.x,X+=u.y),k.ZF(V,K,Y,X,G,rt,lt)}d&&(R=!0);break;case"A":for(;!f();){let V=Math.abs(parseFloat(p())),K=Math.abs(parseFloat(p())),Y=parseFloat(p()),X=!1,G=!1,rt=0,lt=0,st=p();st.length===1?(X=!!parseFloat(st),G=!!parseFloat(p()),rt=parseFloat(p()),lt=parseFloat(p())):st.length===2?(X=!!parseFloat(st[0]),G=!!parseFloat(st[1]),rt=parseFloat(p()),lt=parseFloat(p())):(X=!!parseFloat(st[0]),G=!!parseFloat(st[1]),rt=parseFloat(st.slice(2)),lt=parseFloat(p())),a===a.toLowerCase()&&(rt=u.x+rt,lt=u.y+lt),u.e(rt,lt),k.QF(V,K,Y,X,G,rt,lt)}d&&(R=!0);break;case"Z":k._F(),u.h(l);break;case"F":{let V="",K=1;for(;o[r+K];){if(o[r+K]==="0"){F=!0,K++;continue}if(o[r+K].match(/[Uu]/)!==null){K++;continue}if(o[r+K].match(N)===null){K++;continue}V=o[r+K];break}V.match(/[Mm]/)?S=!0:k.tR();break}case"U":{let V="",K=1;for(;o[r+K];){if(o[r+K].match(/[Ff]/)!==null){K++;continue}if(o[r+K].match(N)===null){K++;continue}V=o[r+K];break}V.match(/[Mm]/)?M=!0:k.eR(!1);break}default:if(a==="0"||a==="1")break;g.ne("Unknown geometry command: "+a);break}if(R){g.ne(`Bad geometry command: ${a}, next token: ${p()},
3
+ v1.2.0-next.4 */
4
+ import{a as Qn}from"./NH4VNVID.js";import{a as Zn}from"./QWIUAAW5.js";import"./4PQV62XZ.js";import"./FED5CWZX.js";import{b as Jn}from"./4RV4IDOJ.js";import{C as Qs,D as _s,E as $n,h as Hn,i as Wn}from"./2HK3BXGQ.js";import"./W3WAMZRW.js";(function(){let C=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};C.requestAnimationFrame===void 0&&(C.setImmediate===void 0?C.requestAnimationFrame=x=>C.setTimeout(x,0):C.requestAnimationFrame=C.setImmediate);class g{static ur=C.navigator!==void 0&&C.navigator.platform!==void 0&&C.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static NP(t,e,i){let s=-1;return function(){let n=this,o=arguments;s!==-1&&g.yc(s),s=g.dn(()=>{s=-1,i||t.apply(n,o)},e),i&&!s&&t.apply(n,o)}}static dn(t,e){return C.setTimeout(t,e)}static yc(t){C.clearTimeout(t)}static Ni(t){return C.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),g.o(i)}static se(t,e,i,s){}static s(t,e,i,s){}static CU(t,e,i){}static wc(t,e,i){if(t===null||typeof t!="object"){let s=g.LL(e);i!==void 0&&(s+="."+i),g.si(t,"object",s)}}static S(t,e,i){g.s(t,"function",e,i)}static LU(t,e,i){}static si(t,e,i,s){}static J(t,e,i,s){let n=g.LL(i);s!==void 0&&(n+="."+s),g.o(n+" is not in the range "+e+": "+t)}static Gi(t){}static dr(t,e){}static ne(t){C.console&&C.console.log(t)}static $(t){return t!==null&&typeof t=="object"}static nt(t){return typeof t=="function"}static CP=[];static ot(){let t=g.CP.pop();return t===void 0?[]:t}static Z(t){t.length=0,g.CP.push(t)}static AU=Object.freeze([]);static LL(t){return t===null?"*":typeof t=="string"?t:g.nt(t)?t.name:""}static Hn(t){return g.nt(t)?t.className?t.className:t.name:g.$(t)&&t.constructor?g.Hn(t.constructor):typeof t}static Wa(t,e){return e==null||e===""?null:g.$(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return 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 Hw(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.TU;if(s&&s[e])return!0;i=Object.getPrototypeOf(i)}return!1}static zF(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 XF(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 We(t){return g.zF(g.XF(t))}static color1="@COLOR1";static color2="@COLOR2";static jw="32ab5ff3b26f42dc0ed90f21412913b5"}g.vfo="29e647fdb3";class z{LP;constructor(){this.LP=[]}toString(){return this.LP.join("")}add(t){t!==""&&this.LP.push(t)}}class W{}class J{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}Ml(){}toString(){return"EmptyIterator"}static instance=new J}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):J.instance}get count(){return 1}Ml(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class et{jt;Xs;Gt;Tt;constructor(t){this.jt=t,this.Xs=null,t.gr=null,this.Gt=t.lt,this.Tt=-1}[Symbol.iterator](){return this.Xs===null?this.jt.r.values():this.jt.r.filter(this.Xs).values()}key;value;get iterator(){return this}get predicate(){return this.Xs}set predicate(t){this.Xs=t}reset(){let t=this.jt;t.gr=null,this.Gt=t.lt,this.Tt=-1}next(){let t=this.jt;if(t.lt!==this.Gt){if(this.key<0)return!1;g.Gi(t)}let e=t.r,i=e.length,s=++this.Tt,n=this.Xs;if(n!==null)for(;s<i;){let o=e[s];if(n(o))return this.Tt=s,this.key=s,this.value=o,!0;s++}else{if(s<i)return this.key=s,this.value=e[s],!0;this.Ml()}return!1}hasNext(){return this.next()}first(){let t=this.jt;this.Gt=t.lt,this.Tt=0;let e=t.r,i=e.length,s=this.Xs;if(s!==null){let n=0;for(;n<i;){let o=e[n];if(s(o))return this.Tt=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.jt;e.gr=null;let i=e.lt;this.Tt=-1;let s=e.r,n=s.length,o=this.Xs;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(t(a))return!0;e.lt!==i&&g.Gi(e)}}return!1}all(t){let e=this.jt;e.gr=null;let i=e.lt;this.Tt=-1;let s=e.r,n=s.length,o=this.Xs;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(!t(a))return!1;e.lt!==i&&g.Gi(e)}}return!0}each(t){let e=this.jt;e.gr=null;let i=e.lt;this.Tt=-1;let s=e.r,n=s.length,o=this.Xs;for(let r=0;r<n;r++){let a=s[r];o!==null&&!o(a)||(t(a),e.lt!==i&&g.Gi(e))}return this}map(t){let e=this.jt;e.gr=null;let i=e.lt;this.Tt=-1;let s=[],n=e.r,o=n.length,r=this.Xs;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(s.push(t(l)),e.lt!==i&&g.Gi(e))}let a=new U;return a.r=s,a.Yi(),a.iterator}filter(t){let e=this.jt;e.gr=null;let i=e.lt;this.Tt=-1;let s=[],n=e.r,o=n.length,r=this.Xs;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(t(l)&&s.push(l),e.lt!==i&&g.Gi(e))}let a=new U;return a.r=s,a.Yi(),a.iterator}get count(){let t=this.Xs;if(t!==null){let e=0,i=this.jt.r,s=i.length;for(let n=0;n<s;n++)t(i[n])&&e++;return e}else return this.jt.r.length}Ml(){this.key=-1,this.value=null,this.Gt=-1,this.Xs=null,this.jt.gr=this}toString(){return"ListIterator@"+this.Tt+"/"+this.jt.count}}class ct{jt;Gt;Tt;constructor(t){this.jt=t,t.pr=null,this.Gt=t.lt,this.Tt=t.r.length}[Symbol.iterator](){return this.jt.r.reverse().values()}key;value;get iterator(){return this}reset(){let t=this.jt;t.pr=null,this.Gt=t.lt,this.Tt=t.r.length}next(){let t=this.jt;if(t.lt!==this.Gt){if(this.key<0)return!1;g.Gi(t)}let e=--this.Tt;return e>=0?(this.key=e,this.value=t.r[e],!0):(this.Ml(),!1)}hasNext(){return this.next()}first(){let t=this.jt;this.Gt=t.lt;let e=t.r,i=e.length-1;if(this.Tt=i,i>=0){let s=e[i];return this.key=i,this.value=s,s}else return null}any(t){let e=this.jt;e.pr=null;let i=e.lt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];if(t(r))return!0;e.lt!==i&&g.Gi(e)}return!1}all(t){let e=this.jt;e.pr=null;let i=e.lt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];if(!t(r))return!1;e.lt!==i&&g.Gi(e)}return!0}each(t){let e=this.jt;e.pr=null;let i=e.lt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];t(r),e.lt!==i&&g.Gi(e)}return this}map(t){let e=this.jt;e.pr=null;let i=e.lt,s=[],n=e.r,o=n.length;this.Tt=o;for(let a=o-1;a>=0;a--){let h=n[a];s.push(t(h)),e.lt!==i&&g.Gi(e)}let r=new U;return r.r=s,r.Yi(),r.iterator}filter(t){let e=this.jt;e.pr=null;let i=e.lt,s=[],n=e.r,o=n.length;this.Tt=o;for(let a=o-1;a>=0;a--){let h=n[a];t(h)&&s.push(h),e.lt!==i&&g.Gi(e)}let r=new U;return r.r=s,r.Yi(),r.iterator}get count(){return this.jt.r.length}Ml(){this.key=-1,this.value=null,this.Gt=-1,this.jt.pr=this}toString(){return"ListIteratorBackwards("+this.Tt+"/"+this.jt.count+")"}}class U{f;r;lt;gr;pr;constructor(t){I.Je(this),this.f=!1,this.r=[],this.lt=0,this.gr=null,this.pr=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.r.values()}Yi(){let t=this.lt;t++,t>999999999&&(t=0),this.lt=t}b(){return this.f=!0,this}ce(){return this.f=!1,this}toString(){return"List()#"+I.xs(this)}add(t){return this.f&&g.L(this,t),this.r.push(t),this.Yi(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.f&&g.L(this);let e=this.r;if(t.first){let i=t.iterator;for(;i.next();)e.push(i.value)}else for(let i of t)e.push(i);return this.Yi(),this}clear(){this.f&&g.L(this),this.r.length=0,this.Yi()}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)&&g.J(t,"0 <= i < length",U,"elt:i"),e[t]}get(t){return this.elt(t)}setElt(t,e){let i=this.r;(t<0||t>=i.length)&&g.J(t,"0 <= i < length",U,"setElt:i"),this.f&&g.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.f&&g.L(this);let t=this.r;if(t.length>0){let e=t.pop();return e===void 0?null:e}return null}any(t){let e=this.r,i=this.lt,s=e.length;for(let n=0;n<s;n++){if(t(e[n]))return!0;this.lt!==i&&g.Gi(this)}return!1}all(t){let e=this.r,i=this.lt,s=e.length;for(let n=0;n<s;n++){if(!t(e[n]))return!1;this.lt!==i&&g.Gi(this)}return!0}each(t){let e=this.r,i=this.lt,s=e.length;for(let n=0;n<s;n++)t(e[n]),this.lt!==i&&g.Gi(this);return this}map(t){let e=new U,i=[],s=this.r,n=this.lt,o=s.length;for(let r=0;r<o;r++)i.push(t(s[r])),this.lt!==n&&g.Gi(this);return e.r=i,e.Yi(),e}filter(t){let e=new U,i=[],s=this.r,n=this.lt,o=s.length;for(let r=0;r<o;r++){let a=s[r];t(a)&&i.push(a),this.lt!==n&&g.Gi(this)}return e.r=i,e.Yi(),e}insertAt(t,e){t<0&&g.J(t,">= 0",U,"insertAt:i"),this.f&&g.L(this,t);let i=this.r;t>=i.length?i.push(e):i.splice(t,0,e),this.Yi()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.f&&g.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.Yi(),!0)}removeAt(t){let e=this.r;(t<0||t>=e.length)&&g.J(t,"0 <= i < length",U,"removeAt:i"),this.f&&g.L(this,t),t===e.length-1?e.pop():e.splice(t,1),this.Yi()}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.f&&g.L(this);let n=t,o=e+1;for(;o<s;)i[n++]=i[o++];return i.length=s-(e-t+1),this.Yi(),this}copy(){let t=new U,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 AL(){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.f&&g.L(this),this.r.sort(t),this.Yi(),this}sortRange(t,e,i){let s=this.r,n=s.length;e===void 0&&(e=0),i===void 0&&(i=n),this.f&&g.L(this);let o=i-e;if(o<=1)return this;if((e<0||e>=n-1)&&g.J(e,"0 <= from < length",U,"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.Yi()),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.Yi(),this}reverse(){return this.f&&g.L(this),this.r.reverse(),this.Yi(),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 J.instance;let t=this.gr;return t!==null?(t.reset(),t):new et(this)}get iteratorBackwards(){if(this.r.length<=0)return J.instance;let t=this.pr;return t!==null?(t.reset(),t):new ct(this)}}class Lt{Do;oe;constructor(t){this.Do=t,this.oe=t.g.values()}[Symbol.iterator](){return this.Do.g.values()}key;value;get iterator(){return this}reset(){let t=this.Do;this.oe=t.g.values()}next(){let t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.Do.g.size===0?null:(this.oe=this.Do.g.values(),this.oe.next().value)}any(t){return this.Do.any(t)}all(t){return this.Do.all(t)}each(t){return this.Do.each(t),this}map(t){let e=new U;return this.Do.g.forEach(i=>e.add(t(i))),e.iterator}filter(t){let e=new U;return this.Do.g.forEach(i=>{t(i)&&e.add(i)}),e.iterator}get count(){return this.Do.count}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"SetIterator"}}class I{f;g;constructor(t){this.f=!1,this.g=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.values()}values(){return this.g.values()}b(){return this.f=!0,this}ce(){return this.f=!1,this}toString(){return"Set()#"+I.xs(this)}add(t){return t===null?this:(this.g.add(t),this)}addAll(t){if(t===null)return this;if(this.f&&g.L(this),t.first){let e=t.iterator;for(;e.next();)this.g.add(e.value)}else for(let e of t)this.g.add(e);return this}has(t){return this.g.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;if(t.first){let e=t.iterator;for(;e.next();)if(!this.has(e.value))return!1}else for(let e of t)if(!this.has(e))return!1;return!0}containsAny(t){if(t===null)return!0;if(t.first){let e=t.iterator;for(;e.next();)if(this.has(e.value))return!0}else for(let e of t)if(this.has(e))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.f&&g.L(this),this.g.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.f&&g.L(this),t.first){let e=t.iterator;for(;e.next();)this.delete(e.value)}else for(let e of t)this.delete(e);return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.f&&g.L(this);let e=new I;e.addAll(t);let i=[];if(t.first){let s=t.iterator;for(;s.next();){let n=s.value;e.has(n)||i.push(n)}}else for(let s of t)e.has(s)||i.push(s);return this.removeAll(i),this}clear(){this.f&&g.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 U;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?J.instance:new Lt(this)}entries(){return this.g.entries()}keys(){return this.g.keys()}forEach(t,e){return this.g.forEach(t,e)}static qw=1;static Je(t){t.__gohashid=I.qw++}static xs(t){return t.__gohashid}}class Rt{q;oe;constructor(t){this.q=t,this.oe=t.g.keys()}[Symbol.iterator](){return this.q.g.keys()}key;value;get iterator(){return this}reset(){let t=this.q;this.oe=t.g.keys()}next(){let t=this.oe.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.oe=this.q.g.keys(),this.oe.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 U;for(let s of e.g)i.add(t(s[0]));return i.iterator}filter(t){let e=this.q,i=new U;for(let s of e.g){let n=s[0];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapKeySetIterator"}}class le extends I{q;constructor(t){super(),I.Je(this),this.f=!0,this.q=t}[Symbol.iterator](){return this.g.keys()}values(){return this.g.keys()}b(){return this}ce(){return this}toString(){return"MapKeySet("+this.q.toString()+")"}add(t){g.o("This Set is read-only: "+this.toString())}has(t){return this.q.has(t)}contains(t){return this.has(t)}delete(t){g.o("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){g.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 le(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 U,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?J.instance:new Rt(this.q)}}class Ee{q;oe;constructor(t){this.q=t,this.oe=t.g.values()}[Symbol.iterator](){return this.q.g.values()}key;value;get iterator(){return this}reset(){let t=this.q;this.oe=t.g.values()}next(){let t=this.oe.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.oe=this.q.g.values(),this.oe.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 U;for(let s of e.g)i.add(t(s[1]));return i.iterator}filter(t){let e=this.q,i=new U;for(let s of e.g){let n=s[1];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapValueSetIterator"}}class Ht{constructor(t,e){this.key=t,this.value=e}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class $t{q;oe;constructor(t){this.q=t,this.oe=t.g.entries()}[Symbol.iterator](){return this.q.g.entries()}key;value;get iterator(){return this}reset(){let t=this.q;this.oe=t.g.entries()}next(){let t=this.oe.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.oe=this.q.g.entries();let t=this.oe.next().value;return this.key=t[0],this.value=t[1],new Ht(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 U,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ht(n,s):(i.key=n,i.value=s),e.add(t(i))}),e.iterator}filter(t){let e=new U,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ht(n,s):(i.key=n,i.value=s),t(i)&&(e.add(i),i=null)}),e.iterator}get count(){return this.q.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapIterator"}}class wt{f;g;constructor(t){I.Je(this),this.f=!1,this.g=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.entries()}entries(){return this.g.entries()}b(){return this.f=!0,this}ce(){return this.f=!1,this}toString(){return"Map()#"+I.xs(this)}set(t,e){return this.f&&g.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.f&&g.L(this),t instanceof wt){let e=t.iterator;for(;e.next();)this.g.set(e.key,e.value)}else if(t.first){let e=t.iterator;for(;e.next();){let i=e.value;this.g.set(i.key,i.value)}}else for(let e of t){let i=e;Array.isArray(i)?this.g.set(i[0],i[1]):this.g.set(i.key,i.value)}return this}first(){if(this.g.size===0)return null;let t=this.g.entries().next().value;return t?new Ht(t[0],t[1]):null}any(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ht(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 Ht(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 Ht(i,s):(e.key=i,e.value=s),t(e);return this}map(t){let e=new wt,i=null;for(let[s,n]of this.g)i===null?i=new Ht(s,n):(i.key=s,i.value=n),e.set(s,t(i));return e}filter(t){let e=new wt,i=null;for(let[s,n]of this.g)i===null?i=new Ht(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.f&&g.L(this,t),this.g.delete(t))}remove(t){return this.delete(t)}clear(){this.f&&g.L(this),this.g.clear()}copy(){let t=new wt;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 Ht(s[0],s[1]),i++;return e}toKeySet(){return new le(this)}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?J.instance:new $t(this)}get iteratorKeys(){return this.count<=0?J.instance:new Rt(this)}keys(){return this.g.keys()}get iteratorValues(){return this.count<=0?J.instance:new Ee(this)}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}}class P{px;py;f;constructor(t,e){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof e=="number"?(this.px=t,this.py=e):g.o("Invalid arguments to Point constructor: "+t+", "+e),this.f=!1}h(t){return this.px=t.px,this.py=t.py,this}e(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}kt(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().b()}b(){return this.f||(this.f=!0),this}Ww(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 g.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 A.u(this.px,t.x)&&A.u(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=A.Ee(t),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.TL(t.x-this.px,t.y-this.py)}direction(t,e){return this.TL(t-this.px,e-this.py)}TL(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 A.ku(t,e,i,s,n,o)}compareWithLineSegmentPoint(t,e){return A.ku(t.x,t.y,e.x,e.y,this.x,this.y)}static intersectingLineSegments(t,e,i,s,n,o,r,a){return A.Pu(t,e,i,s,n,o,r,a)}projectOntoLineSegment(t,e,i,s){return A.Nl(t,e,i,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,e){return A.Nl(t.x,t.y,e.x,e.y,this.px,this.py,this),this}snapToGrid(t,e,i,s){return A._g(this.px,this.py,t,e,i,s,this),this}snapToGridPoint(t,e){return A._g(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}v(t){return t.gt(this),this}Ki(t){return t.Ci(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 gn=new P(0,0).kt();static DL=new P(-1/0,-1/0).kt();static vL=new P(1/0,1/0).kt();static FL=new P(6,6).kt();static mn=new P(NaN,NaN).kt();static Jw=[];static l(){let t=P.Jw.pop();return t===void 0?new P:t}static bs(t){let e=P.Jw.pop();return e===void 0?t.copy():e.h(t)}static z(t,e){let i=P.Jw.pop();return i===void 0?new P(t,e):(i.x=t,i.y=e,i)}static i(t){P.Jw.push(t)}}class _{sw;sh;f;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):g.o("Invalid arguments to Size constructor: "+t+", "+e),this.f=!1}h(t){return this.sw=t.sw,this.sh=t.sh,this}e(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 _;return t.sw=this.sw,t.sh=this.sh,t}kt(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().b()}b(){return this.f||(this.f=!0),this}Ww(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 _(s,o)}else return new _}static stringify(t){return t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return g.s(t,"number",_,"stringifyFixed:digits"),e=>e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof _?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,e){return this.sw===t&&this.sh===e}equalsApprox(t){return A.u(this.sw,t.width)&&A.u(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&&g.J(t,">= 0",_,"width"),this.sw=t}get height(){return this.sh}set height(t){t<0&&g.J(t,">= 0",_,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static xc=new _(0,0).kt();static AP=new _(1,1).kt();static RL=new _(6,6).kt();static Su=new _(8,8).kt();static OL=new _(10,10).kt();static TP=new _(1/0,1/0).kt();static $w=new _(NaN,NaN).kt();static IL=[];static l(){let t=_.IL.pop();return t===void 0?new _:t}static i(t){_.IL.push(t)}}class B{rx;ry;rw;rh;f;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 _?(this.rx=n,this.ry=o,this.rw=e.width,this.rh=e.height):g.o("Incorrect second argument supplied to Rect constructor "+e)}else g.o("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+s);this.f=!1}h(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}e(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}jn(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 B;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}kt(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().b()}b(){return this.f||(this.f=!0),this}ce(){return this.f&&(Object.isFrozen(this)&&g.o("cannot thaw constant: "+this),this.f=!1),this}Ww(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 B(s,o,r,a)}else return new B}static stringify(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return g.s(t,"number",B,"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 B?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 A.u(this.rx,t.x)&&A.u(this.ry,t.y)&&A.u(this.rw,t.width)&&A.u(this.rh,t.height)}equalsApproxTo(t,e,i,s){return A.u(this.rx,t)&&A.u(this.ry,e)&&A.u(this.rw,i)&&A.u(this.rh,s)}equalsApproxClose(t){return A.X(this.rx,t.x)&&A.X(this.ry,t.y)&&A.X(this.rw,t.width)&&A.X(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.Zw(e,t,e,t)}addMargin(t){return this.Zw(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.Zw(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.Zw(t,e,i,s)}Zw(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.EL(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.EL(t,e,i,s)}EL(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))}UL(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.re(t.x,t.y,0,0)}unionRect(t){return this.re(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.re(t,e,i,s)}re(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}nearestSideDirection(t,e){return A.Qw(this,t,e,!0)}nearestSideDirectionPoint(t){return A.Qw(this,t.x,t.y,!0)}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,f=a,p=e,m=o;return d+=p,f+=m,!(p>f||m>d)}static intersectsLineSegment(t,e,i,s,n,o,r,a){return A.VL(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&&g.J(t,">= 0",B,"width"),this.rw=t}get height(){return this.rh}set height(t){t<0&&g.J(t,">= 0",B,"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 _(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 tm=new B(0,0,0,0).kt();static GF=new B(NaN,NaN,NaN,NaN).kt();static _w=[];static l(){let t=B._w.pop();return t===void 0?new B:t}static bs(t){let e=B._w.pop();return e===void 0?t.copy():e.h(t)}static z(t,e,i,s){let n=B._w.pop();return n===void 0?new B(t,e,i,s):n.e(t,e,i,s)}static i(t){B._w.push(t)}}class Dt{mt;mr;mb;ml;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):g.o("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+s)}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 Dt;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}kt(){return Object.freeze(this),this}N(){return Object.isFrozen(this)?this:this.copy().kt()}Ww(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 Dt;let o=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(o=parseFloat(n)),isNaN(o))return new Dt(s);let r=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(r=parseFloat(n)),isNaN(r))return new Dt(s,o);let a=NaN;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),isNaN(a)?new Dt(s,o):new Dt(s,o,r,a)}else return new Dt}static stringify(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return g.s(t,"number",Dt,"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 Dt?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 A.u(this.mt,t.top)&&A.u(this.mr,t.right)&&A.u(this.mb,t.bottom)&&A.u(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 em=new Dt(0,0,0,0).kt();static BL=new Dt(2,2,2,2).kt()}class T{sx;sy;ox;oy;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)}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 T;return t.sx=this.sx,t.sy=this.sy,t.ox=this.ox,t.oy=this.oy,t}kt(){return Object.freeze(this),this}N(){return Object.isFrozen(this)?this:this.copy().kt()}Ww(t){}Hi(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this.kt()}DU(t,e){(isNaN(t)||t>1||t<0)&&g.J(t,"0 <= "+e+" <= 1",T,e)}vU(t,e){(isNaN(t)||t===1/0||t===-1/0)&&g.J(t,"real number, not NaN or Infinity",T,e)}static parse(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return T.None;if(t==="TopLeft")return T.TopLeft;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return T.TopCenter;if(t==="TopRight")return T.TopRight;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return T.LeftCenter;if(t==="Center")return T.Center;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return T.RightCenter;if(t==="BottomLeft")return T.BottomLeft;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return T.BottomCenter;if(t==="BottomRight")return T.BottomRight;if(t==="TopSide")return T.TopSide;if(t==="LeftSide")return T.LeftSide;if(t==="RightSide")return T.RightSide;if(t==="BottomSide")return T.BottomSide;if(t==="TopBottomSides")return T.TopBottomSides;if(t==="LeftRightSides")return T.LeftRightSides;if(t==="TopLeftSides")return T.TopLeftSides;if(t==="TopRightSides")return T.TopRightSides;if(t==="BottomLeftSides")return T.BottomLeftSides;if(t==="BottomRightSides")return T.BottomRightSides;if(t==="NotTopSide")return T.NotTopSide;if(t==="NotLeftSide")return T.NotLeftSide;if(t==="NotRightSide")return T.NotRightSide;if(t==="NotBottomSide")return T.NotBottomSide;if(t==="AllSides")return T.AllSides;if(t==="Default")return T.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 T(s,o,r,a)}else return new T}static stringify(t){return t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return g.s(t,"number",T,"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(T.None)?"None":this.equals(T.TopLeft)?"TopLeft":this.equals(T.TopCenter)?"Top":this.equals(T.TopRight)?"TopRight":this.equals(T.LeftCenter)?"Left":this.equals(T.Center)?"Center":this.equals(T.RightCenter)?"Right":this.equals(T.BottomLeft)?"BottomLeft":this.equals(T.BottomCenter)?"Bottom":this.equals(T.BottomRight)?"BottomRight":this.equals(T.TopSide)?"TopSide":this.equals(T.LeftSide)?"LeftSide":this.equals(T.RightSide)?"RightSide":this.equals(T.BottomSide)?"BottomSide":this.equals(T.TopBottomSides)?"TopBottomSides":this.equals(T.LeftRightSides)?"LeftRightSides":this.equals(T.TopLeftSides)?"TopLeftSides":this.equals(T.TopRightSides)?"TopRightSides":this.equals(T.BottomLeftSides)?"BottomLeftSides":this.equals(T.BottomRightSides)?"BottomRightSides":this.equals(T.NotTopSide)?"NotTopSide":this.equals(T.NotLeftSide)?"NotLeftSide":this.equals(T.NotRightSide)?"NotRightSide":this.equals(T.NotBottomSide)?"NotBottomSide":this.equals(T.AllSides)?"AllSides":this.equals(T.Default)?"Default":"None"}equals(t){return t instanceof T?(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 T(.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(T.Left))t=T.LeftSide;else if(t.equals(T.Right))t=T.RightSide;else if(t.equals(T.Top))t=T.TopSide;else if(t.equals(T.Bottom))t=T.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 T(0,0,0,0).Hi(0);static Default=new T(0,0,-1,0).Hi(-1);static TopLeft=new T(0,0,0,0).kt();static TopCenter=new T(.5,0,0,0).kt();static TopRight=new T(1,0,0,0).kt();static LeftCenter=new T(0,.5,0,0).kt();static Center=new T(.5,.5,0,0).kt();static RightCenter=new T(1,.5,0,0).kt();static BottomLeft=new T(0,1,0,0).kt();static BottomCenter=new T(.5,1,0,0).kt();static BottomRight=new T(1,1,0,0).kt();static MiddleTop=T.TopCenter;static MiddleLeft=T.LeftCenter;static MiddleRight=T.RightCenter;static MiddleBottom=T.BottomCenter;static Top=T.TopCenter;static Left=T.LeftCenter;static Right=T.RightCenter;static Bottom=T.BottomCenter;static TopSide=new T(0,0,1,1).Hi(1);static LeftSide=new T(0,0,1,2).Hi(1);static RightSide=new T(0,0,1,4).Hi(1);static BottomSide=new T(0,0,1,8).Hi(1);static TopBottomSides=new T(0,0,1,9).Hi(1);static LeftRightSides=new T(0,0,1,6).Hi(1);static TopLeftSides=new T(0,0,1,3).Hi(1);static TopRightSides=new T(0,0,1,5).Hi(1);static BottomLeftSides=new T(0,0,1,10).Hi(1);static BottomRightSides=new T(0,0,1,12).Hi(1);static NotTopSide=new T(0,0,1,14).Hi(1);static NotLeftSide=new T(0,0,1,13).Hi(1);static NotRightSide=new T(0,0,1,11).Hi(1);static NotBottomSide=new T(0,0,1,7).Hi(1);static AllSides=new T(0,0,1,15).Hi(1);static DP=new T(.156,.156).kt();static vP=new T(.844,.844).kt()}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}FP(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1}Ue(){return this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0,this}bc(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}zL(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}tx(){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}ks(t,e,i){if(t=A.Ee(t),t===0)return this;this.Gs(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.Gs(-e,-i),this}Gs(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this}it(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this}YF(){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.e(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)}Ci(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.e(r*i+a*n,r*s+a*o)}Mu(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.e(h*i+l*n+r,h*s+l*o+a)}im(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,f=s*o+i*a+l,p=s*r+i*h+c,m=e*o+n*a+l,y=e*r+n*h+c,b=s*o+n*a+l,v=s*r+n*h+c,w=u,k=u,S=d,M=d;return w=Math.min(w,f),k=Math.max(k,f),S=Math.min(S,p),M=Math.max(M,p),w=Math.min(w,m),k=Math.max(k,m),S=Math.min(S,y),M=Math.max(M,y),w=Math.min(w,b),k=Math.max(k,b),S=Math.min(S,v),M=Math.max(M,v),t.e(w,S,k-w,M-S),t}static XL=[];static l(){let t=Pt.XL.pop();return t===void 0?new Pt:t}static i(t){Pt.XL.push(t)}static RP="54a702f3e53909c447824c6706603faf4c"}let A={KF:"7da71ca0ad381e90",qn:4*((Math.sqrt(2)-1)/3),GL:[],ex:x=>{if(x<=0)return 0;let t=A.GL;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);A.GL=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)},u:(x,t)=>{let e=x-t;return e<.5&&e>-.5},X:(x,t)=>{let e=x-t;return e<5e-8&&e>-5e-8},Ve:(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,f=l-s;if(f<=o&&o<=d)if(c-u>d-f)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},ix:(x,t,e,i,s,n,o,r,a,h,l,c)=>{if(!A.Ve(x,t,o,r,c,e,i)||!A.Ve(x,t,o,r,c,s,n)){let u=(x+e)/2,d=(t+i)/2,f=(e+s)/2,p=(i+n)/2,m=(s+o)/2,y=(n+r)/2,b=(u+f)/2,v=(d+p)/2,w=(f+m)/2,k=(p+y)/2,S=(b+w)/2,M=(v+k)/2;return A.ix(x,t,u,d,b,v,S,M,a,h,l,c)||A.ix(S,M,w,k,m,y,o,r,a,h,l,c)}else return A.Ve(x,t,o,r,c,h,l)},YL:(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,f=(n+r)/2,p=(h+c)/2,m=(l+u)/2,y=(c+d)/2,b=(u+f)/2;return a.e((p+y)/2,(m+b)/2),a},HF:(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,f=(a+l)/2,p=(h+c)/2,m=(l+u)/2,y=(c+d)/2;return P.direction(f,p,m,y)},Nu:(x,t,e,i,s,n,o,r,a,h)=>{if(!A.Ve(x,t,o,r,a,e,i)||!A.Ve(x,t,o,r,a,s,n)){let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,f=(s+o)/2,p=(n+r)/2,m=(l+u)/2,y=(c+d)/2,b=(u+f)/2,v=(d+p)/2,w=(m+b)/2,k=(y+v)/2;A.Nu(x,t,l,c,m,y,w,k,a,h),A.Nu(w,k,b,v,f,p,o,r,a,h)}else h.re(x,t,0,0),h.re(o,r,0,0);return h},Wn:(x,t,e,i,s,n,o,r,a,h)=>{if(!A.Ve(x,t,o,r,a,e,i)||!A.Ve(x,t,o,r,a,s,n)){let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,f=(s+o)/2,p=(n+r)/2,m=(l+u)/2,y=(c+d)/2,b=(u+f)/2,v=(d+p)/2,w=(m+b)/2,k=(y+v)/2;A.Wn(x,t,l,c,m,y,w,k,a,h),A.Wn(w,k,b,v,f,p,o,r,a,h)}else h.length===0&&(h.push(x),h.push(t)),h.push(o),h.push(r);return h},OP:(x,t,e,i,s,n,o,r,a,h)=>{if(A.Ve(x,t,s,n,h,e,i))return A.Ve(x,t,s,n,h,r,a);{let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,f=(l+u)/2,p=(c+d)/2;return A.OP(x,t,l,c,f,p,o,r,a,h)||A.OP(f,p,u,d,s,n,o,r,a,h)}},IP:(x,t,e,i,s,n,o,r)=>{if(A.Ve(x,t,s,n,o,e,i))r.re(x,t,0,0),r.re(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;A.IP(x,t,a,h,u,d,o,r),A.IP(u,d,l,c,s,n,o,r)}return r},sm:(x,t,e,i,s,n,o,r)=>{if(A.Ve(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;A.sm(x,t,a,h,u,d,o,r),A.sm(u,d,l,c,s,n,o,r)}return r},nm:(x,t,e,i,s,n,o,r,a,h,l,c,u,d)=>{if(!A.Ve(x,t,o,r,u,e,i)||!A.Ve(x,t,o,r,u,s,n)){let f=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,b=(s+o)/2,v=(n+r)/2,w=(f+m)/2,k=(p+y)/2,S=(m+b)/2,M=(y+v)/2,F=(w+S)/2,D=(k+M)/2,N=1/0,L=!1,R=0,O=0;if(A.nm(x,t,f,p,w,k,F,D,a,h,l,c,u,d)){let V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,L=!0,R=d.x,O=d.y)}if(A.nm(F,D,S,M,b,v,o,r,a,h,l,c,u,d)){let V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,L=!0,R=d.x,O=d.y)}return L&&(d.x=R,d.y=O),L}else{if(!A.Pu(x,t,o,r,a,h,l,c))return!1;let f=(x-o)*(h-c)-(t-r)*(a-l);if(f===0)return!1;let p=((x*r-t*o)*(a-l)-(x-o)*(a*c-h*l))/f,m=((x*r-t*o)*(h-c)-(t-r)*(a*c-h*l))/f;return d.e(p,m),!0}},om:(x,t,e,i,s,n,o,r,a,h,l,c,u)=>{let d=0;if(!A.Ve(x,t,o,r,u,e,i)||!A.Ve(x,t,o,r,u,s,n)){let f=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,b=(s+o)/2,v=(n+r)/2,w=(f+m)/2,k=(p+y)/2,S=(m+b)/2,M=(y+v)/2,F=(w+S)/2,D=(k+M)/2;d+=A.om(x,t,f,p,w,k,F,D,a,h,l,c,u),d+=A.om(F,D,S,M,b,v,o,r,a,h,l,c,u)}else{let f=(x-o)*(h-c)-(t-r)*(a-l);if(f===0)return d;let p=((x*r-t*o)*(a-l)-(x-o)*(a*c-h*l))/f,m=((x*r-t*o)*(h-c)-(t-r)*(a*c-h*l))/f;if(p>=l)return d;let y=0,b=0;if((a>l?a-l:l-a)<(h>c?h-c:c-h)){if(t<r?(y=t,b=r):(y=r,b=t),m<y||m>b)return d}else if(x<o?(y=x,b=o):(y=o,b=x),p<y||p>b)return d;f>0?d++:f<0&&d--}return d},Nl:(x,t,e,i,s,n,o)=>{if(A.X(x,e)){let r=0,a=0;t<i?(r=t,a=i):(r=i,a=t);let h=n;return h<r?(o.e(x,r),!1):h>a?(o.e(x,a),!1):(o.e(x,h),!0)}else if(A.X(t,i)){let r=0,a=0;x<e?(r=x,a=e):(r=e,a=x);let h=s;return h<r?(o.e(r,t),!1):h>a?(o.e(a,t),!1):(o.e(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.e(x,t),!1;if(a>1.000005)return o.e(e,i),!1;{let h=x+a*(e-x),l=t+a*(i-t);return o.e(h,l),!0}}},vo:(x,t,e,i,s,n,o,r,a)=>{if(A.u(x,e)&&A.u(t,i))return a.e(x,t),!1;if(A.X(s,o)){if(A.X(x,e))return A.Nl(x,t,e,i,s,n,a),!1;{let h=(i-t)/(e-x)*(s-x)+t;return A.Nl(x,t,e,i,s,h,a)}}else{let h=(r-n)/(o-s);if(A.X(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.e(x,c),!1):l>u?(a.e(x,u),!1):(a.e(x,l),!0)}else{let l=(i-t)/(e-x);if(A.X(h,l))return A.Nl(x,t,e,i,s,n,a),!1;{let c=(l*x-h*s+n-t)/(l-h);if(A.X(l,0)){let u=0,d=0;return x<e?(u=x,d=e):(u=e,d=x),c<u?(a.e(u,t),!1):c>d?(a.e(d,t),!1):(a.e(c,t),!0)}else{let u=l*(c-x)+t;return A.Nl(x,t,e,i,c,u,a)}}}}},Cl:(x,t,e,i,s,n,o,r,a)=>{let h=1e21,l=x,c=t;if(A.vo(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(A.vo(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(A.vo(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(A.vo(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.e(l,c),h<1e21},nx:(x,t,e)=>A.VL(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),VL:(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!!(B.contains(x,t,e,i,s,n)||B.contains(x,t,e,i,o,r)||A.Pu(a,l,h,l,s,n,o,r)||A.Pu(h,l,h,c,s,n,o,r)||A.Pu(h,c,a,c,s,n,o,r)||A.Pu(a,c,a,l,s,n,o,r))},Pu:(x,t,e,i,s,n,o,r)=>x===e&&t===i&&s===o&&n===r?x===s&&t===n:A.ku(x,t,e,i,s,n)*A.ku(x,t,e,i,o,r)<=0&&A.ku(s,n,o,r,x,t)*A.ku(s,n,o,r,e,i)<=0,ku:(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},Qw(x,t,e,i){i===void 0&&(i=!1);let s=0,n=x===null?t:(t-x.x)/(x.width>0?x.width:1),o=x===null?e:(e-x.y)/(x.height>0?x.height:1);return n>o?n>1-o||(i||n<1-o?s=270:s=315):i||n<o?n>1-o?s=90:i||n<1-o?s=180:s=135:n<.5?s=225:n>.5&&(s=45),s},Ee:x=>(x>=360?x-=360:x<0&&(x+=360),x),jF:(x,t)=>x>t?Math.min(x-t,Math.abs(x-360-t)):t>x?Math.min(t-x,Math.abs(x-(t-360))):0,KL:(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 f=u+r*Math.min(d,c),p=x+e*Math.cos(u),m=t+e*Math.sin(u),y=x+e*Math.cos(f),b=t+e*Math.sin(f),v=(p+y)/2,w=(m+b)/2;return l.push([p,m,v,w,v,w,y,b]),l}for(;d>a;){let f=u+r*Math.min(d,c);l.push(A.qF(e,u,f,x,t)),d-=Math.abs(f-u),u=f}return l},qF:(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,f=h+u*a,p=d,m=-f,y=n+t,b=Math.cos(y),v=Math.sin(y);return[i+x*Math.cos(t),s+x*Math.sin(t),i+d*b-f*v,s+d*v+f*b,i+p*b-m*v,s+p*v+m*b,i+x*Math.cos(e),s+x*Math.sin(e)]},_g:(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.e(c,u),o},HL:(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},WF:(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),A.JF(h,l,c,u,0,0)},JF:(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,f=9999999999;for(let y=0;y<f&&(d=.5*(c+u),!(d===c||d===u));++y){let b=h/(d+r),v=l/(d+a),w=b*b+v*v-1;if(w>0)c=d;else if(w<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},Jn:{},rm:new W,yr:new W,wr:0,lm:100};A.za=A.KF;var ii=(x=>(x[x.Line=1]="Line",x[x.Rectangle=2]="Rectangle",x[x.Ellipse=3]="Ellipse",x[x.Path=4]="Path",x))(ii||{}),ys=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x))(ys||{});class St{n;am;hm;kc;Cu;Lu;$n;Zn;Qn;W;Li;Ai;ni;oi;Ys;Pc;Sc;constructor(t,e){I.Je(this),this.n=2,t===void 0&&(t=4),this.W=t,this.Li=0,this.Ai=0,this.ni=0,this.oi=0,t===4?this.Ys=new U:this.Ys=St.lx,this.am=this.Ys.lt,this.hm=new B,this.kc=null,this.Cu=null,this.Lu=NaN,this.$n=T.TopLeft,this.Zn=T.BottomRight,this.Pc=NaN,this.Sc=NaN,this.Qn=2,e&&Object.assign(this,e)}copy(){let t=new St;if(t.n=this.n&-2,t.W=this.W,t.Li=this.Li,t.Ai=this.Ai,t.ni=this.ni,t.oi=this.oi,this.W===4){let e=this.Ys.r,i=t.Ys;for(let s=0;s<e.length;s++){let n=e[s];i.add(n.copy())}t.Ys=i}else t.Ys=this.Ys;return t.am=this.am,t.hm.h(this.hm),t.kc=this.kc,t.Cu=this.Cu,t.Lu=this.Lu,t.$n=this.$n.N(),t.Zn=this.Zn.N(),t.Pc=this.Pc,t.Sc=this.Sc,t.Qn=this.Qn,t}static Line=1;static Rectangle=2;static Ellipse=3;static Path=4;static lx=new U().b();get f(){return(this.n&1)!==0}set f(t){t?this.n|=1:this.n&=-2}get yt(){return(this.n&2)!==0}set yt(t){t?this.n|=2:this.n&=-3}b(){if(this.f=!0,this.type!==4)return this;let t=this.figures;t.b();for(let e of t)e.b();return this}equalsApprox(t){if(!(t instanceof St))return!1;if(this.type!==t.type)return this.type===1&&t.type===4?this.jL(t):t.type===1&&this.type===4?t.jL(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 A.u(this.startX,t.startX)&&A.u(this.startY,t.startY)&&A.u(this.endX,t.endX)&&A.u(this.endY,t.endY)}jL(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&&A.u(this.startX,e.startX)&&A.u(this.startY,e.startY)){let i=e.segments.elt(0);if(i.type===2&&A.u(this.endX,i.endX)&&A.u(this.endY,i.endY))return!0}}return!1}static stringify(t){return t.toString()}static stringifyFixed(t){return g.s(t,"number",St,"stringifyFixed:digits"),e=>e.toString(t)}fe(t){t in ii?this.type=t:g.dr(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 B(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 B(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 ii[this.type]}}static fillPath(t){typeof t!="string"&&g.si(t,"string",St,"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 cm="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";static parse(t,e){e===void 0&&(e=!1),typeof t!="string"&&g.si(t,"string",St,"parse:str");let i=new RegExp("(["+St.cm+"])(["+St.cm+"])","gm"),s=new RegExp("(["+St.cm+"])([^s])","gm"),n=new RegExp("([^s])(["+St.cm+"])","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=g.ot(),K="",Y=!1;for(let X=0;X<O.length;X++){let G=O[X];G==="."&&!Y?(Y=!0,K+=G):G==="."?(V.push(K),K="."):K+=G}V.push(K),o.splice(R,1);for(let X=0;X<V.length;X++)o.splice(R+X,0,V[X]);R+=V.length-1,g.Z(V)}}let r=-1,a="",h="",l=new P(0,0),c=new P(0,0),u=new P(0,0),d=!0;function f(){return r>=w-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.e(O,V)}function y(){return m(u),u}function b(){return m(c),c}function v(){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 w=o.length,k=Ye.qL(null),S=!1,M=!1,F=!1,D=!0,N=new RegExp("["+St.cm+"]");for(;!(r>=w-1);){if(h=a,a=p(),a==="")continue;d=!0;let R=!1;switch(a.toUpperCase()){case"X":D=!0,S=!1,M=!1;break;case"M":let O=y();for(k.Ne===null||D===!0?(k.Au(O.x,O.y,S,!1,!M,F),D=!1):k.$F(O.x,O.y),l.h(u);!f();){let V=y();k.Ks(V.x,V.y)}break;case"L":for(;!f();){let V=y();k.Ks(V.x,V.y)}d&&(R=!0);break;case"H":for(;!f();)u.e((a===a.toLowerCase()?u.x:0)+parseFloat(p()),u.y),k.Ks(u.x,u.y);break;case"V":for(;!f();)u.e(u.x,(a===a.toLowerCase()?u.y:0)+parseFloat(p())),k.Ks(u.x,u.y);d&&(R=!0);break;case"C":for(;!f();){let V=new P;m(V);let K=b(),Y=y();k.xr(V.x,V.y,K.x,K.y,Y.x,Y.y)}d&&(R=!0);break;case"S":for(;!f();){let V=v(),K=b(),Y=y();k.xr(V.x,V.y,K.x,K.y,Y.x,Y.y)}d&&(R=!0);break;case"Q":for(;!f();){let V=b(),K=y();k.Tu(V.x,V.y,K.x,K.y)}d&&(R=!0);break;case"T":for(;!f();){let V=v();c.h(V);let K=y();k.Tu(V.x,V.y,K.x,K.y),c.h(K)}d&&(R=!0);break;case"B":for(;!f();){let V=parseFloat(p()),K=parseFloat(p()),Y=parseFloat(p()),X=parseFloat(p()),G=parseFloat(p()),rt=G,lt=!1;f()||(rt=parseFloat(p()),f()||(lt=parseFloat(p())!==0)),a===a.toLowerCase()&&(Y+=u.x,X+=u.y),k.ZF(V,K,Y,X,G,rt,lt)}d&&(R=!0);break;case"A":for(;!f();){let V=Math.abs(parseFloat(p())),K=Math.abs(parseFloat(p())),Y=parseFloat(p()),X=!1,G=!1,rt=0,lt=0,st=p();st.length===1?(X=!!parseFloat(st),G=!!parseFloat(p()),rt=parseFloat(p()),lt=parseFloat(p())):st.length===2?(X=!!parseFloat(st[0]),G=!!parseFloat(st[1]),rt=parseFloat(p()),lt=parseFloat(p())):(X=!!parseFloat(st[0]),G=!!parseFloat(st[1]),rt=parseFloat(st.slice(2)),lt=parseFloat(p())),a===a.toLowerCase()&&(rt=u.x+rt,lt=u.y+lt),u.e(rt,lt),k.QF(V,K,Y,X,G,rt,lt)}d&&(R=!0);break;case"Z":k._F(),u.h(l);break;case"F":{let V="",K=1;for(;o[r+K];){if(o[r+K]==="0"){F=!0,K++;continue}if(o[r+K].match(/[Uu]/)!==null){K++;continue}if(o[r+K].match(N)===null){K++;continue}V=o[r+K];break}V.match(/[Mm]/)?S=!0:k.tR();break}case"U":{let V="",K=1;for(;o[r+K];){if(o[r+K].match(/[Ff]/)!==null){K++;continue}if(o[r+K].match(N)===null){K++;continue}V=o[r+K];break}V.match(/[Mm]/)?M=!0:k.eR(!1);break}default:if(a==="0"||a==="1")break;g.ne("Unknown geometry command: "+a);break}if(R){g.ne(`Bad geometry command: ${a}, next token: ${p()},
5
5
  string: ${t}`);break}}let L=k.fm;if(Ye.WL(k),e){let R=L.figures.iterator;for(;R.next();){let O=R.value;O.isFilled=!0}}return L}static JL(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.i(s)}EP(){if(this.yt)return!0;if(this.type===4){let t=this.figures;if(this.am!==t.lt)return!0;let e=this.figures.r,i=e.length;for(let s=0;s<i;s++)if(e[s].EP())return!0}return!1}hx(){if(this.yt=!1,this.kc=null,this.Cu=null,this.Lu=NaN,this.type===4){let e=this.figures;this.am=e.lt;let i=this.figures.r,s=i.length;for(let n=0;n<s;n++)i[n].iR()}let t=this.hm;isNaN(this.Pc)||isNaN(this.Sc)?t.e(0,0,0,0):t.e(0,0,this.Pc,this.Sc),this.$L(t,!1),t.re(0,0,0,0)}computeBoundsWithoutOrigin(){let t=new B;return this.$L(t,!0),t}$L(t,e){switch(this.type){case 1:case 2:case 3:e?t.e(this.Li,this.Ai,0,0):t.re(this.Li,this.Ai,0,0),t.re(this.ni,this.oi,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.e(r.startX,r.startY,0,0):t.re(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.re(l,c,0,0);break;case 3:A.Nu(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:A.IP(l,c,d.point1X,d.point1Y,d.endX,d.endY,.5,t),l=d.endX,c=d.endY;break;case 5:case 6:let f=d.type===5?d.Fo(r):d.Ja(r,l,c),p=f.length;if(p===0){l=d.type===5?d.centerX:d.endX,c=d.type===5?d.centerY:d.endY,t.re(l,c,0,0);break}let m=null;for(let y=0;y<p;y++)m=f[y],A.Nu(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:g.o("Unknown Segment type: "+d.type)}}}break;default:g.o("Unknown Geometry type: "+this.type)}}sR(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.f&&g.L(this);let t=this.computeBoundsWithoutOrigin();return this.offset(-t.x,-t.y),new P(-t.x,-t.y)}offset(t,e){return this.f&&g.L(this),this.v(1,0,0,1,t,e),this}scale(t,e){return this.f&&g.L(this),this.v(t,0,0,e,0,0),this}rotate(t,e,i){this.f&&g.L(this),e===void 0&&(e=0),i===void 0&&(i=0);let s=Pt.l();return s.Ue(),s.ks(t,e,i),this.v(s.m11,s.m12,s.m21,s.m22,s.dx,s.dy),Pt.i(s),this}v(t,e,i,s,n,o){let r=0,a=0;switch(this.type){case 1:case 2:case 3:r=this.Li,a=this.Ai,this.Li=r*t+a*i+n,this.Ai=r*e+a*s+o,r=this.ni,a=this.oi,this.ni=r*t+a*i+n,this.oi=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,f=d.length;for(let p=0;p<f;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:g.o("Unknown Segment type: "+m.type)}}}break}return this.yt=!0,this}containsPoint(t,e){e===void 0&&(e=0);let i=this.Li,s=this.Ai,n=this.ni,o=this.oi;switch(this.type){case 1:return A.Ve(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=B.z(r,a,h,l),u=c.containsPoint(t);return B.i(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.UP(t,e,!0,!1);default:return!1}}UP(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,f=0,p=this.figures.r,m=p.length;for(let y=0;y<m;y++){let b=p[y],v=!b.isEvenOdd;if(b.isFilled){if(i&&b.VP(n,o,e))return!0}else{if(b.VP(n,o,s?e:e+2))return!0;continue}let w=b.segments;l=b.startX,c=b.startY;let k=l,S=c,M=w.r,F=M[0];for(let D=0;D<=w.length;D++){let N;switch(D!==w.length?(F=M[D],N=F.type,d=F.endX,f=F.endY):(N=2,d=k,f=S),N){case 1:{let L=this.cx(n,o,r,a,l,c,k,S);if(isNaN(L))return!0;h+=L,k=d,S=f;break}case 2:{let L=this.cx(n,o,r,a,l,c,d,f);if(isNaN(L))return!0;h+=L;break}case 3:u=A.om(l,c,F.point1X,F.point1Y,F.point2X,F.point2Y,d,f,r,a,n,o,.5),h+=u;break;case 4:{let L=(l+2*F.point1X)/3,R=(c+2*F.point1Y)/3,O=(F.point1X*2+d)/3,V=(F.point1Y*2+f)/3;u=A.om(l,c,L,R,O,V,d,f,r,a,n,o,.5),h+=u;break}case 5:case 6:{let L=F.type===5?F.Fo(b):F.Ja(b,l,c),R=L.length;if(R===0){let V=this.cx(n,o,r,a,l,c,F.type===5?F.centerX:F.endX,F.type===5?F.centerY:F.endY);if(isNaN(V))return!0;h+=V;break}let O=null;for(let V=0;V<R;V++){if(O=L[V],V===0){let K=this.cx(n,o,r,a,l,c,O[0],O[1]);if(isNaN(K))return!0;h+=K}u=A.om(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],f=O[7]);break}default:g.o("Unknown Segment type: "+F.type)}l=d,c=f}if(v){if(h!==0)return!0}else if(h%2!==0)return!0;h=0}return!1}cx(t,e,i,s,n,o,r,a){if(A.Ve(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}ZL(t,e,i){let s=this.figures.r,n=s.length;for(let o=0;o<n;o++)if(s[o].VP(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.e(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 f=r-a,p=d===0?0:f/d,m=i[h],y=m[u*2],b=m[u*2+1],v=m[u*2+2],w=m[u*2+3];return e.e(y+(v-y)*p,b+(w-b)*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],f=d[c*2],p=d[c*2+1],m=d[c*2+2],y=d[c*2+3];return Math.abs(m-f)<1&&Math.abs(y-p)<1?0:Math.abs(m-f)<1?y-p>=0?90:270:Math.abs(y-p)<1?m-f>=0?0:180:Math.atan2(y-p,m-f)*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 f=r-a,p=d===0?0:f/d,m=i[h],y=m[u*2],b=m[u*2+1],v=m[u*2+2],w=m[u*2+3];e[0]=y+(v-y)*p,e[1]=b+(w-b)*p;let k;return Math.abs(v-y)<1&&Math.abs(w-b)<1?k=0:Math.abs(v-y)<1?k=w-b>=0?90:270:Math.abs(w-b)<1?k=v-y>=0?0:180:k=Math.atan2(w-b,v-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();A.Nl(e,i,s,n,o,r,c);let u=c.x,d=c.y;return P.i(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),f=Math.abs(l-n),p=Math.min(c,u,d,f);if(p===d)return h/a;if(p===u)return(o+l)/a;if(p===f)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 f=e[d],p=i[d],m=f.length;for(let y=0;y<m;y+=2){let b=f[y],v=f[y+1];if(y===0){l=b,c=v;continue}A.Nl(l,c,b,v,t.x,t.y,n);let w=(n.x-t.x)**2+(n.y-t.y)**2;w<o&&(o=w,r=a,r+=Math.sqrt((n.x-l)**2+(n.y-c)**2)),a+=p[(y-2)/2],l=b,c=v}}P.i(n);let u=r/s;return u<0?0:u>1?1:u}return 0}get flattenedSegments(){return this.QL(),this.kc}QL(){if(this.kc===null){let t=this.kc=[],e=this.Cu=[];this.nR(t,e)}}get flattenedLengths(){return this.QL(),this.Cu}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}BP(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}nR(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 jt;n.startX=this.endX,n.startY=(this.startY+this.endY)/2;let o=new xt(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.Fo(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];A.Wn(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.BP(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 f=c[d];switch(f.type){case 1:i.length>=4&&(t.push(i),e.push(this.BP(i))),i=[],i.push(f.endX),i.push(f.endY),r=f.endX,a=f.endY,h=r,l=a;break;case 2:i.push(f.endX),i.push(f.endY),r=f.endX,a=f.endY;break;case 3:A.Wn(r,a,f.point1X,f.point1Y,f.point2X,f.point2Y,f.endX,f.endY,.5,i),r=f.endX,a=f.endY;break;case 4:A.sm(r,a,f.point1X,f.point1Y,f.endX,f.endY,.5,i),r=f.endX,a=f.endY;break;case 5:{let p=f.Fo(o),m=p.length;if(m===0){i.push(f.centerX),i.push(f.centerY),r=f.centerX,a=f.centerY;break}for(let y=0;y<m;y++){let b=p[y];A.Wn(r,a,b[2],b[3],b[4],b[5],b[6],b[7],.5,i),r=b[6],a=b[7]}break}case 6:{let p=f.Ja(o,r,a),m=p.length,y=f.endX,b=f.endY;if(m===0){i.push(y),i.push(b),r=y,a=b;break}for(let v=0;v<m;v++){let w=p[v];A.Wn(r,a,w[2],w[3],w[4],w[5],w[6],w[7],.5,i),r=w[6],a=w[7]}break}default:g.o("Segment not of valid type: "+f.type)}f.isClosed&&(i.push(h),i.push(l))}i.length>=4&&(t.push(i),e.push(this.BP(i)))}}}get type(){return this.W}set type(t){this.W!==t&&(this.f&&g.L(this,t),this.W=t,t===4?this.Ys=new U:(St.lx===null&&(St.lx=new U().b()),this.Ys=St.lx),this.yt=!0)}get startX(){return this.Li}set startX(t){this.Li!==t&&(this.f&&g.L(this,t),this.Li=t,this.yt=!0)}get startY(){return this.Ai}set startY(t){this.Ai!==t&&(this.f&&g.L(this,t),this.Ai=t,this.yt=!0)}get endX(){return this.ni}set endX(t){this.ni!==t&&(this.f&&g.L(this,t),this.ni=t,this.yt=!0)}get endY(){return this.oi}set endY(t){this.oi!==t&&(this.f&&g.L(this,t),this.oi=t,this.yt=!0)}get figures(){return this.Ys}set figures(t){this.Ys!==t&&(this.f&&g.L(this,t),this.Ys=t,this.yt=!0)}add(t){return this.Ys.add(t),this}setSpots(t,e,i,s,n,o,r,a){return this.f&&g.L(this),this.$n=new T(t,e,n,o),this.Zn=new T(i,s,r,a),this}get spot1(){return this.$n}set spot1(t){this.f&&g.L(this,t),this.$n=t.N()}get spot2(){return this.Zn}set spot2(t){this.f&&g.L(this,t),this.Zn=t.N()}get defaultStretch(){return this.Qn}set defaultStretch(t){this.Qn=t}get bounds(){return this.EP()&&this.hx(),this.hm}polygonClosestSegment(t,e){if(e===void 0&&(e=10),this.type!==4)return null;let i=t.x,s=t.y,n=1/0,o=0,r=0,a=0,h=0,l=0,c=0,u=0,d=0;return this.figures.each(f=>{let p=f.startX,m=f.startY;f.segments.each(y=>{let b=y.endX,v=y.endY,w=0;if(y.type===2)w=P.distanceLineSegmentSquared(i,s,p,m,b,v);else{p=y.endX,m=y.endY;return}w<n&&(n=w,o=a,r=h,l=p,c=m,u=b,d=v),p=b,m=v,h++,y.isClosed&&(b=f.startX,v=f.startY,w=P.distanceLineSegmentSquared(i,s,p,m,b,v),w<n&&(n=w,o=a,r=h,l=p,c=m,u=b,d=v),h++)}),a++,h=0}),n<e*e?{figi:o,segi:r,ax:l,ay:c,bx:u,by:d}:null}get polygonArea(){if(this.type===4){let t=this.figures.iterator,e=0,i=0,s=0,n=0,o=0;for(;t.next();){let r=t.value;if(!r.isFilled)continue;e=r.startX,i=r.startY;let a=r.segments.iterator;for(;a.next();){let h=a.value;s=h.endX,n=h.endY,h.type===1||h.type!==5&&(o+=e*n-i*s),e=s,i=n}o+=e*r.startY-i*r.startX}return Math.abs(o)/2}else if(this.type===2){let t=Math.abs(this.startX-this.endX),e=Math.abs(this.startY-this.endY);return t*e}else if(this.type===3){let t=Math.abs(this.startX-this.endX),e=Math.abs(this.startY-this.endY);return Math.PI*t/2*e/2}else return 0}get polygonLength(){if(this.type===4){let t=this.figures.iterator,e=0,i=0,s=0,n=0,o=0;for(;t.next();){let r=t.value;e=r.startX,i=r.startY;let a=r.segments.iterator;for(;a.next();){let l=a.value;s=l.endX,n=l.endY,l.type===1||l.type!==5&&(o+=Math.sqrt((s-e)*(s-e)+(n-i)*(n-i))),e=s,i=n}let h=r.segments.last();h&&h.isClosed&&(s=r.startX,n=r.startY,o+=Math.sqrt((s-e)*(s-e)+(n-i)*(n-i)))}return o}else if(this.type===2){let t=Math.abs(this.startX-this.endX),e=Math.abs(this.startY-this.endY);return t*2+e*2}else if(this.type===3){let t=Math.abs(this.startX-this.endX)/2,e=Math.abs(this.startY-this.endY)/2;if(t+e===0)return 0;let i=(t-e)*(t-e)/((t+e)*(t+e)),s=i,n=1+s/4;return s*=i,n+=s/64,s*=i,n+=s/256,s*=i,n+=s*25/16384,s*=i,n+=s*49/65536,s*=i,n+=s*441/1048576,Math.PI*(t+e)*n}else{let t=this.startX,e=this.startY,i=this.endX,s=this.endY;return Math.sqrt((i-t)*(i-t)+(s-e)*(s-e))}}static computeConvexHull(t){t.sort((s,n)=>s.x===n.x?n.y-s.y:n.x-s.x);let e=[];for(let s=0;s<t.length;s++){for(;e.length>=2&&t[s].compareWithLineSegmentPoint(e[e.length-2],e[e.length-1])>=0;)e.pop();e.push(t[s])}e.pop();let i=[];for(let s=t.length-1;s>=0;s--){for(;i.length>=2&&t[s].compareWithLineSegmentPoint(i[i.length-2],i[i.length-1])>=0;)i.pop();i.push(t[s])}return i.pop(),e.concat(i)}static generatePolygon(t,e,i){e===void 0&&(e=0),i===void 0&&(i=!0);let s=new St;if(t.length>1)if(e>0)if(i){t.push(t[0]),t.push(t[1]);let n=!0,o=new jt(0,0,i,!1);for(let a=1;a<t.length;a++){let h=(t[a-1].x+t[a].x)/2,l=(t[a-1].y+t[a].y)/2,c=t[a-1].distanceSquaredPoint(t[a]),u=.5*e/Math.sqrt(c);if(u<.5){let d=t[a-1].x+(t[a].x-t[a-1].x)*u,f=t[a-1].y+(t[a].y-t[a-1].y)*u;if(n?(n=!1,o.startX=d,o.startY=f):o.add(new xt(3,d,f,t[a-1].x,t[a-1].y,t[a-1].x,t[a-1].y)),a<t.length-1){let p=t[a].x+(t[a-1].x-t[a].x)*u,m=t[a].y+(t[a-1].y-t[a].y)*u;o.add(new xt(2,p,m))}}else n?(n=!1,o.startX=h,o.startY=l):o.add(new xt(3,h,l,t[a-1].x,t[a-1].y,t[a-1].x,t[a-1].y))}let r=o.segments.last();r&&r.close(),s.add(o)}else{let n=new jt(t[0].x,t[0].y,!1,!1);for(let o=1;o<t.length;o++){let r=(t[o-1].x+t[o].x)/2,a=(t[o-1].y+t[o].y)/2,h=t[o-1].distanceSquaredPoint(t[o]),l=.5*e/Math.sqrt(h);if(l<.5){if(o>1){let d=t[o-1].x+(t[o].x-t[o-1].x)*l,f=t[o-1].y+(t[o].y-t[o-1].y)*l;n.add(new xt(3,d,f,t[o-1].x,t[o-1].y,t[o-1].x,t[o-1].y))}let c=t[o].x+(t[o-1].x-t[o].x)*l,u=t[o].y+(t[o-1].y-t[o].y)*l;n.add(new xt(2,c,u))}else o>1&&n.add(new xt(3,r,a,t[o-1].x,t[o-1].y,t[o-1].x,t[o-1].y));o===t.length-1&&n.add(new xt(2,t[o].x,t[o].y))}s.add(n)}else{let n=new jt(t[0].x,t[0].y,i,!1);for(let o=1;o<t.length;o++)n.add(new xt(2,t[o].x,t[o].y));if(i){let o=n.segments.last();o&&o.close()}s.add(n)}return s}}St.stringify=St.stringify,St.stringifyFixed=St.stringifyFixed,St.fillPath=St.fillPath,St.parse=St.parse;class jt{n;Li;Ai;Mc;um;ji;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.Li=t:this.Li=0,e!==void 0?this.Ai=e:this.Ai=0,this.Mc=new U,this.um=this.Mc.lt,this.ji=null}copy(){let t=new jt;t.n=this.n&-2,t.Li=this.Li,t.Ai=this.Ai;let e=this.Mc.r,i=e.length,s=t.Mc;for(let n=0;n<i;n++){let o=e[n].copy();s.add(o)}return t.um=this.um,t.ji=this.ji,t}equalsApprox(t){if(!(t instanceof jt)||!A.u(this.startX,t.startX)||!A.u(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 f(){return(this.n&1)!==0}set f(t){t?this.n|=1:this.n&=-2}get yt(){return(this.n&2)!==0}set yt(t){t?this.n|=2:this.n&=-3}b(){this.f=!0;let t=this.segments;t.b();let e=t.r,i=t.length;for(let s=0;s<i;s++)e[s].b();return this}EP(){if(this.yt)return!0;let t=this.segments;if(this.um!==t.lt)return!0;for(let e of t)if(e.yt)return!0;return!1}iR(){this.yt=!1,this.ji=null;let t=this.segments;this.um=t.lt;for(let e of t)e.yt=!1,e.Hs=null}get isFilled(){return(this.n&4)!==0}set isFilled(t){this.f&&g.L(this,t),t?this.n|=4:this.n&=-5}get isShadowed(){return(this.n&8)!==0}set isShadowed(t){this.f&&g.L(this,t),t?this.n|=8:this.n&=-9}get isEvenOdd(){return(this.n&16)!==0}set isEvenOdd(t){this.f&&g.L(this,t),t?this.n|=16:this.n&=-17}get startX(){return this.Li}set startX(t){this.f&&g.L(this,t),this.Li=t,this.ji=null,this.yt=!0}get startY(){return this.Ai}set startY(t){this.f&&g.L(this,t),this.Ai=t,this.ji=null,this.yt=!0}get segments(){return this.Mc}set segments(t){this.f&&g.L(this,t),this.Mc=t,this.ji=null,this.yt=!0}add(t){return this.Mc.add(t),this.ji=null,this}VP(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(A.Ve(n,o,u.endX,u.endY,i,t,e))return!0;n=u.endX,o=u.endY;break;case 3:if(A.ix(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(A.OP(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.Fo(s):u.Ja(s,n,o),f=d.length,p=u.type===5?u.centerX:u.endX,m=u.type===5?u.centerY:u.endY;if(f===0){if(A.Ve(n,o,p,m,i,t,e))return!0;n=p,o=m;break}let y=null;for(let b=0;b<f;b++)if(y=d[b],b===0&&A.Ve(n,o,y[0],y[1],i,t,e)||A.ix(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:g.o("Unknown Segment type: "+u.type)}if(u.isClosed&&(n!==r||o!==a)&&A.Ve(n,o,r,a,i,t,e))return!0}return!1}}var Di=(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))(Di||{});class xt{W;n;ni;oi;pn;Ll;Al;br;Hs;constructor(t,e,i,s,n,o,r,a){if(I.Je(this),t===void 0&&(t=2),this.W=t,this.n=2,e!==void 0?this.ni=e:this.ni=0,i!==void 0?this.oi=i:this.oi=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.pn=h,this.Ll=0,this.Al=Math.max(s,0),this.br=Math.max(n,0),typeof r=="boolean"?r&&(this.isLargeArc=!0):typeof r=="number"&&r&&(this.isLargeArc=!0),a&&(this.isClockwiseArc=!0)}else this.pn=s,this.Ll=n,t===5&&(o=Math.max(o,0)),this.Al=o,typeof r=="number"?(t===5&&(r=Math.max(r,0)),this.br=r):this.br=0;this.Hs=null}copy(){let t=new xt;return t.W=this.W,t.n=this.n&-2,t.ni=this.ni,t.oi=this.oi,t.pn=this.pn,t.Ll=this.Ll,t.Al=this.Al,t.br=this.br,t}equalsApprox(t){if(!(t instanceof xt)||this.type!==t.type||this.isClosed!==t.isClosed)return!1;switch(this.type){case 1:case 2:return A.u(this.endX,t.endX)&&A.u(this.endY,t.endY);case 3:return A.u(this.endX,t.endX)&&A.u(this.endY,t.endY)&&A.u(this.point1X,t.point1X)&&A.u(this.point1Y,t.point1Y)&&A.u(this.point2X,t.point2X)&&A.u(this.point2Y,t.point2Y);case 4:return A.u(this.endX,t.endX)&&A.u(this.endY,t.endY)&&A.u(this.point1X,t.point1X)&&A.u(this.point1Y,t.point1Y);case 5:return A.u(this.startAngle,t.startAngle)&&A.u(this.sweepAngle,t.sweepAngle)&&A.u(this.centerX,t.centerX)&&A.u(this.centerY,t.centerY)&&A.u(this.radiusX,t.radiusX)&&A.u(this.radiusY,t.radiusY);case 6:return this.isClockwiseArc===t.isClockwiseArc&&this.isLargeArc===t.isLargeArc&&A.u(this.xAxisRotation,t.xAxisRotation)&&A.u(this.endX,t.endX)&&A.u(this.endY,t.endY)&&A.u(this.radiusX,t.radiusX)&&A.u(this.radiusY,t.radiusY);default:return!1}}fe(t){t in Di?this.type=t:g.dr(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=Di[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 f(){return(this.n&1)!==0}set f(t){t?this.n|=1:this.n&=-2}get yt(){return(this.n&2)!==0}set yt(t){t?this.n|=2:this.n&=-3}b(){return this.f=!0,this}close(){return this.isClosed=!0,this}Fo(t){if(this.Hs!==null&&t.yt===!1)return this.Hs;let e=this.radiusX,i=this.radiusY;if(i===void 0&&(i=e),e===0||i===0)return this.Hs=[],this.Hs;let s=this.pn,n=this.Ll,o=A.KL(0,0,e<i?e:i,this.startAngle,this.startAngle+this.sweepAngle,!1);if(e!==i){let a=Pt.l();a.Ue(),e<i?a.it(1,i/e):a.it(e/i,1),St.JL(o,a),Pt.i(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.Hs=o,this.Hs}Ja(t,e,i){if(this.Hs!==null&&t.yt===!1)return this.Hs;if(this.radiusX===0||this.radiusY===0)return this.Hs=[],this.Hs;let s=e,n=i,o=this.Al,r=this.br;o===0&&(o=1e-4),r===0&&(r=1e-4);let a=this.pn*(Math.PI/180),h=this.isLargeArc,l=this.isClockwiseArc,c=this.ni,u=this.oi,d=Math.cos(a),f=Math.sin(a),p=d*(s-c)/2+f*(n-u)/2,m=-f*(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 b=(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(b)&&(b=0);let v=b*o*m/r,w=b*-r*p/o;isNaN(v)&&(v=0),isNaN(w)&&(w=0);let k=(s+c)/2+d*v-f*w,S=(n+u)/2+f*v+d*w,M=(ht,ot)=>Math.sqrt(ht*ht+ot*ot),F=(ht,ot,dt,pt)=>(ht*dt+ot*pt)/(M(ht,ot)*M(dt,pt)),D=(ht,ot,dt,pt)=>(ht*pt<ot*dt?-1:1)*Math.acos(F(ht,ot,dt,pt)),N=D(1,0,(p-v)/o,(m-w)/r),L=(p-v)/o,R=(m-w)/r,O=(-p-v)/o,V=(-m-w)/r,K=D(L,R,O,V),Y=F(L,R,O,V);Y<=-1?K=Math.PI:Y>=1&&(K=0),!l&&K>0&&(K=K-2*Math.PI),l&&K<0&&(K=K+2*Math.PI);let X=o>r?o:r,G=o>r?1:o/r,rt=o>r?r/o:1,lt=A.KL(0,0,X,N,N+K,!0),st=Pt.l();return st.Ue(),st.Gs(k,S),st.ks(this.pn,0,0),st.it(G,rt),St.JL(lt,st),Pt.i(st),this.Hs=lt,this.Hs}get isClosed(){return(this.n&8)!==0}set isClosed(t){this.isClosed!==t&&(t?this.n|=8:this.n&=-9,this.yt=!0)}get type(){return this.W}set type(t){this.f&&g.L(this,t),this.W=t,this.yt=!0}get endX(){return this.ni}set endX(t){this.f&&g.L(this,t),this.ni=t,this.yt=!0}get endY(){return this.oi}set endY(t){this.f&&g.L(this,t),this.oi=t,this.yt=!0}get point1X(){return this.pn}set point1X(t){this.f&&g.L(this,t),this.pn=t,this.yt=!0}get point1Y(){return this.Ll}set point1Y(t){this.f&&g.L(this,t),this.Ll=t,this.yt=!0}get point2X(){return this.Al}set point2X(t){this.f&&g.L(this,t),this.Al=t,this.yt=!0}get point2Y(){return this.br}set point2Y(t){this.f&&g.L(this,t),this.br=t,this.yt=!0}get centerX(){return this.pn}set centerX(t){this.f&&g.L(this,t),this.pn=t,this.yt=!0}get centerY(){return this.Ll}set centerY(t){this.f&&g.L(this,t),this.Ll=t,this.yt=!0}get radiusX(){return this.Al}set radiusX(t){t<0&&g.J(t,">= zero",xt,"radiusX"),this.f&&g.L(this,t),this.Al=t,this.yt=!0}get radiusY(){return this.br}set radiusY(t){t<0&&g.J(t,">= zero",xt,"radiusY"),this.f&&g.L(this,t),this.br=t,this.yt=!0}get startAngle(){return this.ni}set startAngle(t){this.f&&g.L(this,t),t=t%360,t<0&&(t+=360),this.ni=t,this.yt=!0}get sweepAngle(){return this.oi}set sweepAngle(t){this.f&&g.L(this,t),t>360&&(t=360),t<-360&&(t=-360),this.oi=t,this.yt=!0}get isClockwiseArc(){return(this.n&4)!==0}set isClockwiseArc(t){this.f&&g.L(this,t),t?this.n|=4:this.n&=-5,this.yt=!0}get isLargeArc(){return(this.n&16)!==0}set isLargeArc(t){this.f&&g.L(this,t),t?this.n|=16:this.n&=-17,this.yt=!0}get xAxisRotation(){return this.pn}set xAxisRotation(t){this.f&&g.L(this,t),t=t%360,t<0&&(t+=360),this.pn=t,this.yt=!0}}class Se{a;fx;ux;dm;gm;mm;pm;ym;wm;xm;bm;km;Pm;Sm;Ro;Mm;Nm;Ps;Ti;constructor(){this.a=null,this.fx=new P(0,0).b(),this.ux=new P(0,0).b(),this.dm=0,this.gm=0,this.mm=1,this.pm="",this.ym="",this.wm=!1,this.xm=!1,this.bm=0,this.km=0,this.Pm=!1,this.Sm=!1,this.Ro=!1,this.Mm=null,this.Nm=0,this.Ps=null,this.Ti=null}copy(){let t=new Se;return this.clone(t)}clone(t){return t.a=this.a,t.fx.h(this.viewPoint),t.ux.h(this.documentPoint),t.dm=this.dm,t.gm=this.gm,t.mm=this.mm,t.pm=this.pm,t.ym=this.ym,t.wm=this.wm,t.xm=this.xm,t.bm=this.bm,t.km=this.km,t.Pm=this.Pm,t.Sm=this.Sm,t.Ro=this.Ro,t.Mm=this.Mm,t.Nm=this.Nm,t.Ps=this.Ps,t.Ti=this.Ti,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.a}set diagram(t){this.a=t}get viewPoint(){return this.fx}set viewPoint(t){this.fx.h(t)}get documentPoint(){return this.ux}set documentPoint(t){this.ux.h(t)}getMultiTouchViewPoint(t,e){let i=this.diagram;return i===null||i._L(this.event,t,e),e}getMultiTouchDocumentPoint(t,e){let i=this.diagram;return i===null||(i._L(this.event,t,e),e.h(i.transformViewToDoc(e))),e}get modifiers(){return this.dm}set modifiers(t){this.dm=t}get button(){return this.gm}set button(t){if(this.gm=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.mm}set buttons(t){this.mm=t}get key(){return this.pm}set key(t){this.pm=t}get code(){return this.ym}set code(t){this.ym=t}get down(){return this.wm}set down(t){this.wm=t}get up(){return this.xm}set up(t){this.xm=t}get clickCount(){return this.bm}set clickCount(t){this.bm=t}get delta(){return this.km}set delta(t){this.km=t}get isMultiTouch(){return this.Pm}set isMultiTouch(t){this.Pm=t}get handled(){return this.Sm}set handled(t){this.Sm=t}get bubbles(){return this.Ro}set bubbles(t){this.Ro=t}get event(){return this.Mm}set event(t){this.Mm=t}get isTouchEvent(){let t=this.event;return t===null?!1:t.pointerType==="touch"||t.pointerType==="pen"}get timestamp(){return this.Nm}set timestamp(t){this.Nm=t}get targetDiagram(){return this.Ps}set targetDiagram(t){this.Ps=t}get targetObject(){return this.Ti}set targetObject(t){this.Ti=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 Qi{a;Pt;Cm;Lm;constructor(){this.a=null,this.Pt="",this.Cm=null,this.Lm=null}copy(){let t=new Qi;return t.a=this.a,t.Pt=this.Pt,t.Cm=this.Cm,t.Lm=this.Lm,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.a}set diagram(t){this.a=t}get name(){return this.Pt}set name(t){this.Pt=t}get subject(){return this.Cm}set subject(t){this.Cm=t}get parameter(){return this.Lm}set parameter(t){this.Lm=t}}var xs=(x=>(x[x.Transaction=1]="Transaction",x[x.Property=2]="Property",x[x.Insert=3]="Insert",x[x.Remove=4]="Remove",x))(xs||{});class si{Du;Am;yn;Ce;a;vu;Nc;Cc;Lc;Ac;constructor(){this.Du=2,this.Am="",this.yn="",this.Ce=null,this.a=null,this.vu=null,this.Nc=null,this.Cc=null,this.Lc=null,this.Ac=null}static Transaction=1;static Property=2;static Insert=3;static Remove=4;clear(){this.Ce=null,this.a=null,this.vu=null,this.Nc=null,this.Cc=null,this.Lc=null,this.Ac=null}copy(){let t=new si;t.Du=this.Du,t.Am=this.Am,t.yn=this.yn,t.Ce=this.Ce,t.a=this.a,t.vu=this.vu;let e=this.Nc;return g.$(e)&&g.nt(e.copyFrozen)?t.Nc=e.copyFrozen():t.Nc=e,e=this.Cc,g.$(e)&&g.nt(e.copyFrozen)?t.Cc=e.copyFrozen():t.Cc=e,e=this.Lc,g.$(e)&&g.nt(e.copyFrozen)?t.Lc=e.copyFrozen():t.Lc=e,e=this.Ac,g.$(e)&&g.nt(e.copyFrozen)?t.Ac=e.copyFrozen():t.Ac=e,t}fe(t){t in xs?this.change=t:g.dr(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+=g.toString(this.object)),this.oldValue!==null&&(t+=" old: "+g.toString(this.oldValue)),this.oldParam!==null&&(t+=" "+this.oldParam),this.newValue!==null&&(t+=" new: "+g.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.tA(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.tA(this,!1))}get model(){return this.Ce}set model(t){this.Ce=t}get diagram(){return this.a}set diagram(t){this.a=t}get change(){return this.Du}set change(t){this.Du=t}get modelChange(){return this.Am}set modelChange(t){this.Am=t}get propertyName(){return this.yn}set propertyName(t){this.yn=t}get isTransactionFinished(){return this.Du===1&&(this.yn==="CommittedTransaction"||this.yn==="FinishedUndo"||this.yn==="FinishedRedo")}get object(){return this.vu}set object(t){this.vu=t}get oldValue(){return this.Nc}set oldValue(t){this.Nc=t}get oldParam(){return this.Cc}set oldParam(t){this.Cc=t}get newValue(){return this.Lc}set newValue(t){this.Lc=t}get newParam(){return this.Ac}set newParam(t){this.Ac=t}}class Fi{eA;Pt;zP;constructor(){this.eA=new U().b(),this.Pt="",this.zP=!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.ce();for(let e=t.count-1;e>=0;e--){let i=t.elt(e);i!==null&&i.clear()}t.clear(),t.b()}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()}}oR(t){let e=this.changes;for(let i=e.count-1;i>=t;i--){let s=e.elt(i);s!==null&&s.undo(),e.ce(),e.removeAt(i)}e.b()}thaw(){this.changes.ce()}optimize(){if(!this.isComplete)return;let t=this.changes;t.ce();let e=new Map;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 Map,e.set(n.object,o));let r=o.get(n.propertyName);r===void 0?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.b()}get changes(){return this.eA}get name(){return this.Pt}set name(t){this.Pt=t}get isComplete(){return this.zP}set isComplete(t){this.zP=t}}class _i{gx;Be;iA;js;XP;Tm;Tl;GP;YP;wn;Tc;mx;qs;yx;wx;Dm;xx;constructor(t){this.gx=new I,this.Be=!1,this.iA=new U().b(),this.js=-1,this.XP=999,this.qs=!1,this.Tm=null,this.Tl=0,this.GP=!1,this.YP=23,this.wn=new U().b(),this.Tc=new U,this.mx=!0,this.yx=!1,this.wx=!1,this.Dm=!1,this.xx=!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.ce();for(let e=t.count-1;e>=0;e--){let i=t.elt(e);i!==null&&i.clear()}t.clear(),this.js=-1,t.b(),this.qs=!1,this.Tm=null,this.Tl=0,this.wn.ce(),this.wn.clear(),this.wn.b(),this.Tc.clear(),this.yx=!1,this.wx=!1,this.Dm=!1,this.xx=!1}copyProperties(t){this.isEnabled=t.isEnabled,this.maxHistoryLength=t.maxHistoryLength,this.vm=t.vm}addModel(t){this.gx.add(t)}removeModel(t){this.gx.delete(t)}startTransaction(t){if(t===void 0&&(t=""),t===null&&(t=""),this.isUndoingRedoing)return!1;this.mx===!0&&(this.mx=!1,this.Tl++,this.Dl||this.vl("StartingFirstTransaction",t,this.currentTransaction),this.Tl>0&&this.Tl--),this.isEnabled&&(this.wn.ce(),this.wn.add(t),this.wn.b(),this.currentTransaction===null?this.Tc.add(0):this.Tc.add(this.currentTransaction.changes.count)),this.Tl++;let e=this.transactionLevel===1;return e&&(this.Dl||this.vl("StartedTransaction",t,this.currentTransaction)),e}commitTransaction(t){return t===void 0&&(t=""),this.sA(!0,t)}rollbackTransaction(){return this.sA(!1,"")}sA(t,e){if(this.isUndoingRedoing)return!1;this.vm&&this.transactionLevel<1&&g.ne("Ending transaction without having started a transaction: "+e);let i=this.transactionLevel===1,s=this.currentTransaction;i&&t&&(this.Dl||this.vl("CommittingTransaction",e,s));let n=0;if(this.transactionLevel>0&&(this.Tl--,this.isEnabled)){let o=this.wn.count;o>0&&(e===""&&(e=this.wn.elt(0)),this.wn.ce(),this.wn.removeAt(o-1),this.wn.b());let r=this.Tc.count;r>0&&(n=this.Tc.elt(r-1),this.Tc.removeAt(r-1))}if(i){if(t){if(this.Dm=!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.ce();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.js--}}a!==0&&(r.count===0||r.get(r.count-1)!==o)&&(r.add(o),this.js++),r.b(),s=o}this.Dl||this.vl("CommittedTransaction",e,s)}else{this.qs=!0;try{this.isEnabled&&s!==null&&(s.isComplete=!0,s.undo())}finally{this.Dl||this.vl("RolledBackTransaction",e,s),this.qs=!1}s!==null&&s.clear()}return this.Tm=null,this.kx&&this.clear(),this.kx=!1,this.Px=!1,!0}else return this.isEnabled&&!t&&s!==null&&s.oR(n),!1}discardHistoryAfterIndex(){if(this.isUndoingRedoing||!this.canRedo())return;let t=this.history;t.ce();for(let e=t.count-1;e>this.historyIndex;e--){let i=t.elt(e);i!==null&&i.clear(),t.removeAt(e),this.Dm=!0}t.b()}thaw(){this.history.ce()}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;if(t!==null)try{this.qs=!0,this.vl("StartingUndo","Undo",t),this.js--,t.undo()}catch(e){g.ne("undo error: "+e.toString())}finally{this.vl("FinishedUndo","Undo",t),this.qs=!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;if(t!==null)try{this.qs=!0,this.vl("StartingRedo","Redo",t),this.js++,t.redo()}catch(e){g.ne("redo error: "+e.toString())}finally{this.vl("FinishedRedo","Redo",t),this.qs=!1}}vl(t,e,i){let s=new si;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.rR(s)}}handleChanged(t){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(t)){let e=this.currentTransaction;e===null&&(e=new Fi,this.Tm=e);let i=t.copy(),s=e.changes;if(s.ce(),s.add(i),s.b(),this.vm&&this.YP>0&&this.transactionLevel<=0&&!this.mx){let n=t.diagram;if(n!==null&&n.$a===!1)return;g.ne("Change not within a transaction: "+i.toString()),this.YP--}}}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.gx.iterator}get isEnabled(){return this.Be}set isEnabled(t){this.Be=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.qs}get history(){return this.iA}get maxHistoryLength(){return this.XP}set maxHistoryLength(t){this.XP=t}get historyIndex(){return this.js}get currentTransaction(){return this.Tm}get transactionLevel(){return this.Tl}get isInTransaction(){return this.Tl>0}get vm(){return this.GP}set vm(t){this.GP=t}get nestedTransactionNames(){return this.wn}get kx(){return this.yx}set kx(t){this.yx=t}get Px(){return this.wx}set Px(t){this.wx=t}get Dl(){return this.xx}set Dl(t){this.xx=t}get isJustDiscarded(){return this.Dm}}class ie{a;Pt;Be;KP;HP;Fm;nA;constructor(){I.Je(this),this.a=j.Rm(),this.Pt="",this.Be=!0,this.KP=!1,this.HP=null,this.nA=new Se,this.Fm=-1}get diagram(){return this.a}set diagram(t){t instanceof j&&(this.a=t)}toString(){return this.name!==""?this.name+" Tool":g.Hn(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.z(NaN,NaN)),s=e.getMultiTouchViewPoint(1,P.z(NaN,NaN));if(!i.isReal()||!s.isReal()){P.i(i),P.i(s);return}if(this.doCancel(),t.getInputOption("hasGestureZoom")){t.jP=t.scale;let n=s.x-i.x,o=s.y-i.y,r=Math.sqrt(n*n+o*o);t.qP=r,e.bubbles=!1}P.i(i),P.i(s)}standardPinchZoomMove(){let t=this.diagram,e=t.lastInput,i=e.getMultiTouchViewPoint(0,P.z(NaN,NaN)),s=e.getMultiTouchViewPoint(1,P.z(NaN,NaN));if(!i.isReal()||!s.isReal()){P.i(i),P.i(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.qP,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.jP*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.i(i),P.i(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(g.ur?e.meta:e.control){t.T("ChangingSelection",t.selection);let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!s.isSelected),t.T("ChangedSelection",t.selection)}else if(e.shift){if(!i.isSelected){t.T("ChangingSelection",t.selection);let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!0),t.T("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&&!(g.ur?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.oA(n,s,i)}oA(t,e,i){if(e.handled=!1,t!==null&&!t.isEnabledObject())return!1;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.T(n,t)}else{switch(s){case 1:n="BackgroundSingleClicked";break;case 2:n="BackgroundDoubleClicked";break;case 3:n="BackgroundContextClicked";break}s!==0&&i.T(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)}return e.handled}standardMouseOver(){let t=this.diagram,e=t.lastInput;if(t.animationManager.ke===!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.Dc){let o=t.Dc,r=o;for(t.Dc=s,this.rA(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.Dc}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="")}rA(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.nA);this.Fm=g.dn(()=>i.doWaitAfter(s),t)}cancelWaitAfter(){this.Fm!==-1&&g.yc(this.Fm),this.Fm=-1}doWaitAfter(t){}findToolHandleAt(t,e){let i=this.diagram.findObjectAt(t,s=>{for(;s!==null&&!(s.panel instanceof Mt);)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){g.s(t,"string",ie,"name"),this.Pt=t}get isEnabled(){return this.Be}set isEnabled(t){g.s(t,"boolean",ie,"isEnabled"),this.Be=t}get isActive(){return this.KP}set isActive(t){g.s(t,"boolean",ie,"isActive"),this.KP=t}get transactionResult(){return this.HP}set transactionResult(t){t!==null&&g.s(t,"string",ie,"transactionResult"),this.HP=t}}var pn=(x=>(x[x.Scroll=1]="Scroll",x[x.Zoom=2]="Zoom",x[x.None=3]="None",x))(pn||{}),yn=(x=>(x[x.Zoom=1]="Zoom",x[x.Cancel=2]="Cancel",x[x.None=3]="None",x))(yn||{});class de extends ie{lA;aA;hA;WP;JP;$P;ZP;QP;_P;tS;Om;Za;constructor(t){super(),this.name="ToolManager",this.lA=new U,this.aA=new U,this.hA=new U,this.WP=850,this.JP=850,this.$P=new _(2,2).kt(),this.ZP=5e3,this.QP=1,this._P=1,this.tS=null,this.Om=null,this.Za=-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.QP}set mouseWheelBehavior(t){this.QP=t}get gestureBehavior(){return this._P}set gestureBehavior(t){this._P=t}initializeStandardTools(){}updateAdornments(t){let e=this.currentToolTip;if(e instanceof Mt&&this.Om===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.cA(t);let i=e.event;i!==null&&(i.type==="pointermove"||!i.cancelable)&&(e.bubbles=!0)}cA(t){this.standardMouseOver(),this.isBeyondDragSize()&&this.standardWaitAfter(this.isActive?this.holdDelay:this.hoverDelay,t.lastInput)}rA(t,e){let i=this.currentToolTip;i!==null&&(e!==null&&i instanceof Mt&&(e===i||e.isContainedBy(i))||this.hideToolTip())}doWaitAfter(t){let e=this.diagram;if(!e.lR())return;let i=e.lastInput;if(e.lastInput=t,this.doMouseHover(),this.isActive||this.doToolTip(),t.isTouchEvent&&!e.lastInput.handled){let s=t.copy();s.button=2,e.lastInput=s,e.Sx=!0,e.doMouseUp()}e.lastInput=i}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 Mt&&(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){e!==null&&g.se(e,tt,de,"showToolTip:obj");let i=this.diagram;if(t!==this.currentToolTip&&this.hideToolTip(),t instanceof Mt){t.layerName="Tool",t.selectable=!1,t.scale=1/i.scale,t.category="ToolTip",t.hasPlaceholder()&&(t.placeholder.scale=i.scale);let s=t.diagram;s!==null&&s!==i&&s.remove(t),i.add(t),e!==null?t.adornedObject=e:t.data=i.model,t.ensureBounds(),this.positionToolTip(t,e)}else t instanceof Me&&t!==this.currentToolTip&&t.show!==null&&t.show(e,i,this);this.currentToolTip=t,this.extendToolTip(this.toolTipDuration)}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}extendToolTip(t){t===void 0&&(t=3e3),this.currentToolTip!==null&&(this.Za!==-1&&(g.yc(this.Za),this.Za=-1),t>0&&t!==1/0&&(this.Za=g.dn(()=>this.hideToolTip(),t)))}hideToolTip(){this.Za!==-1&&(g.yc(this.Za),this.Za=-1);let t=this.diagram,e=this.currentToolTip;e!==null&&(e instanceof Mt?(t.remove(e),this.Om!==null&&this.Om.removeAdornment(e.category),e.data=null,e.adornedObject=null):e instanceof Me&&e.hide!==null&&e.hide(t,this),this.currentToolTip=null)}get currentToolTip(){return this.tS}set currentToolTip(t){this.tS=t,this.Om=t!==null&&t instanceof Mt?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){g.s(t,"string",de,"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){g.s(t,"string",de,"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){g.s(t,"string",de,"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.lA}get mouseMoveTools(){return this.aA}get mouseUpTools(){return this.hA}get hoverDelay(){return this.WP}set hoverDelay(t){g.s(t,"number",de,"hoverDelay"),this.WP=t}get holdDelay(){return this.JP}set holdDelay(t){g.s(t,"number",de,"holdDelay"),this.JP=t}get dragSize(){return this.$P}set dragSize(t){this.$P=t.N()}get toolTipDuration(){return this.ZP}set toolTipDuration(t){g.s(t,"number",de,"toolTipDuration"),this.ZP=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 Tt extends ie{eS;iS;xn;sS;nS;oS;rS;vc;Im;lS;Qa;kr;fA;aS;Fu;Ru;hS;cS;fS;uS;static Mx=new U;static le=null;static _a=null;constructor(t){super(),this.name="Dragging",this.eS=!0,this.uS=!0,this.iS=!0,this.xn=null,this.sS=null,this.nS=null,this.oS=null,this.rS=!1,this.Fu=!1,this.vc=new P(NaN,NaN),this.Im=new P,this.lS=!0,this.Qa=100,this.kr=[],this.fA=new I().b(),this.aS=new es,this.Ru=null,this.hS="copy",this.cS="",this.fS="no-drop",t&&Object.assign(this,t)}get isCopyEnabled(){return this.eS}set isCopyEnabled(t){g.s(t,"boolean",Tt,"isCopyEnabled"),this.eS=t}get copiesEffectiveCollection(){return this.iS}set copiesEffectiveCollection(t){g.s(t,"boolean",Tt,"copiesEffectiveCollection"),this.iS=t}get dragOptions(){return this.aS}set dragOptions(t){this.aS=t}get isGridSnapEnabled(){return this.dragOptions.isGridSnapEnabled}set isGridSnapEnabled(t){g.s(t,"boolean",Tt,"isGridSnapEnabled"),this.dragOptions.isGridSnapEnabled=t}get isComplexRoutingRealtime(){return this.lS}set isComplexRoutingRealtime(t){this.lS=t;let e=this.diagram.findRouter("AvoidsLinks");e!==null&&(e.isRealtime=t)}get isGridSnapRealtime(){return this.dragOptions.isGridSnapRealtime}set isGridSnapRealtime(t){g.s(t,"boolean",Tt,"isGridSnapRealtime"),this.dragOptions.isGridSnapRealtime=t}get gridSnapCellSize(){return this.dragOptions.gridSnapCellSize}set gridSnapCellSize(t){this.dragOptions.gridSnapCellSize.equals(t)||(t=t.N(),this.dragOptions.gridSnapCellSize=t)}get gridSnapCellSpot(){return this.dragOptions.gridSnapCellSpot}set gridSnapCellSpot(t){this.dragOptions.gridSnapCellSpot.equals(t)||(t=t.N(),this.dragOptions.gridSnapCellSpot=t)}get gridSnapOrigin(){return this.dragOptions.gridSnapOrigin}set gridSnapOrigin(t){this.dragOptions.gridSnapOrigin.equals(t)||(t=t.N(),this.dragOptions.gridSnapOrigin=t)}get dragsLink(){return this.dragOptions.dragsLink}set dragsLink(t){g.s(t,"boolean",Tt,"dragsLink"),this.dragOptions.dragsLink=t}get dragsTree(){return this.dragOptions.dragsTree}set dragsTree(t){g.s(t,"boolean",Tt,"dragsTree"),this.dragOptions.dragsTree=t}get copyCursor(){return this.hS}set copyCursor(t){this.hS=t}get moveCursor(){return this.cS}set moveCursor(t){this.cS=t}get nodropCursor(){return this.fS}set nodropCursor(t){this.fS=t}get currentPart(){return this.sS}set currentPart(t){t!==null&&g.se(t,bt,Tt,"currentPart"),this.sS=t}get copiedParts(){return this.oS}set copiedParts(t){this.oS=t}get draggedParts(){return this.nS}set draggedParts(t){this.nS=t}get draggingParts(){return this.copiedParts!==null?this.copiedParts.toKeySet():this.draggedParts!==null?this.draggedParts.toKeySet():this.fA}get draggedLink(){return this.diagram.draggedLink}set draggedLink(t){t!==null&&g.se(t,q,Tt,"draggedLink"),this.diagram.draggedLink=t}get isDragOutStarted(){return this.rS}set isDragOutStarted(t){this.rS=t}get startPoint(){return this.Im}set startPoint(t){this.Im.equals(t)||this.Im.h(t)}get delay(){return this.Qa}set delay(t){g.s(t,"number",Tt,"delay"),this.Qa=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.Qa)?!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.T("ChangingSelection",t.selection);let i=t.lastInput;!(g.ur?i.meta:i.control)&&!i.shift&&t.clearSelection(!0),this.currentPart.isSelected=!0,t.T("ChangedSelection",t.selection)}}}doActivate(){let t=this.diagram;this.Ru=null,this.currentPart===null&&this.standardMouseSelect();let e=this.currentPart;if(e===null||!e.canMove()&&!e.canCopy())return;t.cacheGroupExternalLinks(!0),Tt.le=null,this.isActive=!0,this.vc.set(t.position),this.dS(t.selection),this.kr.length=0,t.animationManager.stopAnimation();let i=this.computeEffectiveCollection(t.selection,this.dragOptions);this.draggedParts=i,this.uS=!!this.diagram.layout.isRealtime,this.diagram.layout.isRealtime=!1,t.Ou=!0,t.getRenderingHint("temporaryPixelRatio")===!0&&t.avgSpf>30&&t.Nx(),t.uA(this.draggedParts),t.Iu=!0,this.startTransaction("Drag"),this.startPoint=t.firstInput.documentPoint,t.isMouseCaptured=!0,t.allowDragOut&&this.aR()}dS(t){if(!this.dragsLink)return;let e=this.diagram,i=e.model.Em(),s=t.first();i&&t.count===1&&s instanceof q&&this.mayDragLink(s)?(this.draggedLink=s,this.draggedLink.canRelinkFrom()&&this.draggedLink.canRelinkTo()&&this.draggedLink.clearAdornments(),this.xn=e.toolManager.findTool("Relinking"),this.xn===null&&(this.xn=new di,this.xn.diagram=e),this.xn.originalLink=this.draggedLink):(this.draggedLink=null,this.xn=null)}mayDragLink(t){let e=this.diagram;return e!==null&&e.allowRelink}computeEffectiveCollection(t,e){return this.diagram.commandHandler.computeEffectiveCollection(t,e)}Ws(t){return t===void 0?new ni(P.gn):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.uS,t.Iu=!1,t.Fl=!0,t.cacheGroupExternalLinks(!1),t.stopAutoScroll(),this.gS(),t.mS(this.draggedParts),this.Ru=null,this.currentPart=null,this.draggedParts=null,this.isDragOutStarted=!1,this.Fu=!1,Tt.hR(),this.dA(),this.vc.e(NaN,NaN),Tt._a!==null&&(Tt._a.currentCursor=""),Tt._a=null,Tt.le=null,this.Rl(),t.isMouseCaptured=!1,t.currentCursor="",t.Ou=!1,this.stopTransaction(),t.pS(!0)}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}gS(){let t=this.diagram,e=t.skipsUndoManager;t.skipsUndoManager=!0;let i=t.lastInput;this.gA(i,null),t.skipsUndoManager=e,this.kr.length=0}mA(){this.Rl(),this.yS();let t=this.diagram;this.vc.isReal()&&(t.position=this.vc),t.stopAutoScroll()}doCancel(){this.Rl(),this.yS();let t=this.diagram;this.vc.isReal()&&(t.position=this.vc),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()}cR(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.e(0,0,0,0):e.e(i,s,n-i,o-s),e}wS(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.yS(),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 wt,r=this.draggedParts.iterator;for(;r.next();){let h=r.key;if(h.Di()&&h.canCopy()){let l=n.get(h);if(l===null)continue;l.location=h.location,l.ensureBounds(),o.set(l,this.Ws(l.location))}}let a=n.iterator;for(;a.next();){let h=a.value;h instanceof q&&h.canCopy()&&o.set(h,this.Ws())}if(this.copiedParts=o,this.dS(o.toKeySet()),this.draggedLink!==null){let h=this.draggedLink,l=h.routeBounds;h.Pr(this.startPoint.x-(l.x+l.width/2),this.startPoint.y-(l.y+l.height/2))}this.doUpdateCursor(null)}Rl(){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 q){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}dA(){this.draggedLink!==null&&(this.dragsLink&&this.xn!==null&&(this.xn.stopDraggingMouseMove(),this.xn.originalLink=null),this.draggedLink=null,this.xn=null)}Fc(t,e){if(t===null)return;let i=this.diagram,s=this.startPoint,n=P.l();n.h(i.lastInput.documentPoint),this.moveParts(t,n.subtract(s),e),P.i(n),i.getRenderingHint("temporaryPixelRatio")===!0&&i.Ol===null&&i.avgSpf>30&&(i.Nx(),i.Eu())}moveParts(t,e,i){i===void 0&&(i=!1);let s=this.diagram;s!==null&&s.Cx(t,e,this.dragOptions,i)}yS(){if(this.draggedParts===null)return;let t=this.diagram,e=this.draggedParts.iterator;for(;e.next();){let i=e.key;i.Di()&&(i.location=e.value.point)}for(e=this.draggedParts.iterator;e.next();){let i=e.key;if(i instanceof q&&i.suspendsRouting){let s=e.value.point;this.draggedParts.set(i,this.Ws()),i.Pr(-s.x,-s.y)}}t.maybeUpdate()}fR(t){if(t===null)return!0;let e=t.part;return!!(e===null||e instanceof Mt||e.layer?.isTemporary||this.draggedParts&&this.draggedParts.has(e)||this.copiedParts&&this.copiedParts.has(e))}xS(t){let e=this.diagram;this.dragsLink&&(this.draggedLink!==null&&(this.draggedLink.fromNode=null,this.draggedLink.toNode=null),this.pA(!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.gA(s,i),!this.isActive&&Tt.le===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&&Tt.le===null||(this.doDragOver(t,i),!this.isActive&&Tt.le===null))return}finally{e.skipsUndoManager=n,o&&e.maybeUpdate()}this.Ru=i,!e.isReadOnly&&(e.allowMove||e.allowCopy)&&(e.allowHorizontalScroll||e.allowVerticalScroll)&&e.doAutoScroll(s.viewPoint)}findDragOverObject(t){return this.diagram.bS(t,null,e=>!this.fR(e))}doUpdateCursor(t){let e=this.diagram;(t===null||this.Ru!==t)&&(!this.diagram.currentTool.isActive||this.mayCopy()?e.currentCursor=this.copyCursor:this.mayMove()?e.currentCursor=this.moveCursor:this.mayDragOut()&&(e.currentCursor=this.nodropCursor))}gA(t,e){let i=!1,s=this.kr.length,n=s>0?this.kr[0]:null;if(e===n)return!1;t.handled=!1;for(let r=0;r<s;r++){let a=this.kr[r],h=a.mouseDragLeave;if(h!==null&&(h(t,a,e),i=!0,t.handled))break}if(this.kr.length=0,!this.isActive&&Tt.le===null||e===null)return i;t.handled=!1;let o=e;for(;o!==null;)this.kr.push(o),o=this.yA(o);s=this.kr.length;for(let r=0;r<s;r++){let a=this.kr[r],h=a.mouseDragEnter;if(h!==null&&(h(t,a,n),i=!0,t.handled))break}return i}FU(t,e){return t===null?!1:!!(t===e||t.isContainedBy(e)||e instanceof ft&&!(t instanceof ft)&&e.handlesDragDropForMembers&&t.part?.isMemberOf(e))}yA(t){let e=t.panel;if(e!==null)return e;if(t instanceof bt&&!(t instanceof ft)){let i=t.containingGroup;if(i!==null&&i.handlesDragDropForMembers)return i}return null}wA(t,e){let i=this.diagram,s=this.xn;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(T.Center,r),d=t.distanceSquaredPoint(u);d<a&&(h=c,a=d)}return P.i(r),h}pA(t){let e=this.draggedLink;if(e!==null){if(e.pointsCount<2)return;let i=this.diagram;if(i.isReadOnly)return;let s=this.xn;if(s===null)return;let n=null,o=null;e.fromNode===null&&(n=this.wA(e.getPoint(0),!1),n!==null&&(o=n.part));let r=null,a=null;e.toNode===null&&(r=this.wA(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.kS&&i.T("LinkRelinked",e,i.kS),e.toPort!==i.PS&&i.T("LinkRelinked",e,i.PS)):s.doDraggingMouseMove(o,n,a,r):s.doDraggingMouseMove(null,null,null,null)}}doDragOver(t,e){}xA(t){let e=this.diagram;this.dragsLink&&this.pA(!0),this.gS();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.uR(s,a),a=this.yA(a)}}else{let a=e.mouseDrop;a!==null&&a(s)}if(!this.isActive&&Tt.le===null)return;let n=this.copiedParts||this.draggedParts;if(n!==null){let a=n.iterator;for(;a.next();){let h=a.key;h instanceof it&&h.linksConnected.each(l=>l.suspendsRouting=!1)}}if(this.doDropOnto(t,i),!this.isActive&&Tt.le===null)return;let o=B.l(),r=e.selection.iterator;for(;r.next();){let a=r.value;a instanceof it&&this.dR(e,a,o)}B.i(o)}uR(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)}}dR(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.SS(i,a=>a.part,a=>a instanceof q,!0,a=>a instanceof q,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.$t()}}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.wS(!1),this.Fc(this.copiedParts,!1)):this.mayMove()?(this.Rl(),this.Fc(this.draggedParts,!0)):this.mayDragOut()?(this.wS(!1),this.Fc(this.copiedParts,!1)):this.Rl(),this.xS(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.Rl(),this.wS(!0),this.Fc(this.copiedParts,!1),this.copiedParts!==null&&(t.T("ChangingSelection",t.selection),t.clearSelection(!0),this.copiedParts.iteratorKeys.each(n=>{n.isSelected=!0}))):(i=!0,this.Rl(),this.mayMove()&&(this.Fc(this.draggedParts,!0),this.xS(t.lastInput.documentPoint))),this.Fu=!0,this.xA(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.gR(),t.invalidateDocumentBounds(),t.mS(this.draggedParts),this.transactionResult=n?"Copy":"Move",t.T(n?"SelectionCopied":"SelectionMoved",o)}this.stopTool(),s&&t.T("ChangedSelection",t.selection)}simulatedMouseMove(t,e,i){if(Tt.le===null)return!1;let s=Tt.le.diagram;i instanceof j||(i=null);let n=Tt._a;if(i!==n){if(n!==null&&n!==s){n.stopAutoScroll(),Tt.le.isDragOutStarted=!1;let r=n.toolManager.findTool("Dragging");r!==null&&r.doSimulatedDragLeave()}if(Tt._a=i,i!==null&&i!==s){Tt.le.mA();let r=i.toolManager.findTool("Dragging");r!==null&&(r.bA(),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(Tt.le===null)return!1;let s=Tt._a,n=Tt.le.diagram;if(i===null)return Tt.le.doCancel(),!0;if(i!==s){if(s!==null){let r=s.toolManager.findTool("Dragging");if(s!==null&&s!==n&&r!==null)return s.stopAutoScroll(),Tt.le.isDragOutStarted=!1,r.doSimulatedDragLeave(),!1}Tt._a=i;let o=i.toolManager.findTool("Dragging");o!==null&&(Tt.le.mA(),o.bA(),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=Tt.le;if(a!==null){let h=a.mayCopy();a.transactionResult=h?"Copy":"Move",a.stopTool()}return!0}return!1}gR(){if(this.draggedParts===null)return;let t=this.draggedParts.iterator;for(;t.next();){let e=t.key;if(e instanceof it){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||!(g.ur?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())}bA(){Tt.Mx.has(this)||Tt.Mx.add(this)}static hR(){if(Tt.Mx.count>0){let t=Tt.Mx,e=t.length;for(let i=0;i<e;i++){let s=t.elt(i);s.dA(),s.Rl(),s.gS(),s.diagram.stopAutoScroll()}t.clear()}}mR(t,e,i){return!this.Fu&&this.draggedParts!==null&&!this.draggedParts.has(t)?(i.h(e),!0):!1}get draggingSource(){return Tt.le}mayDragIn(){let t=this.diagram;if(!t.allowDrop||t.isReadOnly||t.isModelReadOnly||!t.allowInsert)return!1;let e=Tt.le;return!(e===null||e.diagram.model.dataFormat!==t.model.dataFormat)}doSimulatedDragEnter(){if(!this.mayDragIn())return;let t=this.diagram;t.animationManager.stopAnimation(),t.Sr(),t.animationManager.stopAnimation();let e=Tt.le;e!==null&&(this.diagram.Ou=!0,t.lastInput.event===null&&(t.lastInput.event=e.diagram.lastInput.event)),this.doUpdateCursor(null)}doSimulatedDragLeave(){let t=Tt.le;t!==null&&t.doSimulatedDragOut(),this.diagram.Ou=!1,this.doCancel()}doSimulatedDragOver(){let t=this.diagram;t.animationManager.Uu=!0;let e=Tt.le;if(e!==null&&e.draggedParts!==null){if(!this.mayDragIn())return;this.kA(e.draggedParts.toKeySet(),!1,t.firstInput),this.Fc(this.copiedParts,!1),this.xS(t.lastInput.documentPoint)}t.animationManager.Uu=!1}doSimulatedDrop(){let t=this.diagram,e=Tt.le;if(e!==null){let i=e.diagram;if(e.Fu=!0,this.Rl(),e.draggedParts===null||!this.mayDragIn())return;t.animationManager.Uu=!0,t.T("ChangingSelection",t.selection),this.startTransaction("Drop"),this.kA(e.draggedParts.toKeySet(),!0,t.lastInput),this.Fc(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.xA(t.lastInput.documentPoint),t.invalidateDocumentBounds(),this.copiedParts!==null&&(this.transactionResult="ExternalCopy"),this.copiedParts=null,t.doFocus(),t.Ou=!1,t.T("ExternalObjectsDropped",s,i),this.stopTransaction(),t.T("ChangedSelection",t.selection)}t.animationManager.Uu=!1}kA(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=B.l();this.cR(t,o);let r=o.x+o.width/2,a=o.y+o.height/2;B.i(o);let h=this.Im,l=new wt,c=P.l(),u=t.iterator;for(;u.next();){let f=u.value;if(f instanceof q&&f.canCopy()){let p=n.get(f);if(p===null)continue;p.points=f.points,p.Pr(h.x-r,h.y-a),p.suspendsRouting=!0,l.set(p,this.Ws())}}let d=t.iterator;for(;d.next();){let f=d.value;if(f.Di()&&f.canCopy()){let p=n.get(f);if(p===null)continue;let m=f.location;c.e(h.x-(r-m.x),h.y-(a-m.y)),p.location=c,p.ensureBounds(),l.set(p,this.Ws(c))}}if(P.i(c),this.copiedParts=l,this.dS(l.toKeySet()),this.draggedLink!==null){let f=this.draggedLink,p=f.routeBounds;f.Pr(this.startPoint.x-(p.x+p.width/2),this.startPoint.y-(p.y+p.height/2))}this.doUpdateCursor(null)}aR(){this.isDragOutStarted=!0,this.Fu=!1,Tt.le=this,Tt._a=this.diagram,this.doSimulatedDragOut()}doSimulatedDragOut(){let t=this.diagram;!this.mayCopy()&&!this.mayMove()?t.currentCursor=this.nodropCursor:t.currentCursor="",this.Ru=null}computeMove(t,e,i,s){let n=this.diagram;return n!==null?n.computeMove(t,e,this.dragOptions,s):new P}}de.prototype.doCancel=function(){Tt.le!==null&&Tt.le.doCancel(),ie.prototype.doCancel.call(this)};class xe extends ie{MS;NS;Il;CS;LS;th;AS;eh;TS;DS;vS;FS;RS;OS;PA;IS;El;ES;constructor(){super(),this.MS=100,this.NS=!1,this.Il="pointer",this.CS=new q({layerName:"Tool"}).add(new at({isPanelMain:!0,stroke:"blue"}).theme("stroke","tempLink"),new at({toArrow:"Standard",fill:"blue",stroke:"blue"}).theme("fill","tempLink").theme("stroke","tempLink")).It(),this.th=new at("Rectangle",{portId:"",fill:null,stroke:"magenta",strokeWidth:2,desiredSize:_.AP}).theme("stroke","tempPort"),this.LS=new it({selectable:!1,layerName:"Tool"}).add(this.th).It(),this.eh=new at("Rectangle",{portId:"",fill:null,stroke:"magenta",strokeWidth:2,desiredSize:_.AP}).theme("stroke","tempPort"),this.AS=new it({selectable:!1,layerName:"Tool"}).add(this.eh).It(),this.TS=null,this.DS=null,this.vS=null,this.FS=null,this.RS=null,this.OS=!0,this.PA=new wt,this.IS=null,this.El=null,this.ES=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.MS}set portGravity(t){g.s(t,"number",xe,"portGravity"),t>=0&&(this.MS=t)}get isUnconnectedLinkValid(){return this.NS}set isUnconnectedLinkValid(t){g.s(t,"boolean",xe,"isUnconnectedLinkValid"),this.NS=t}get linkingCursor(){return this.Il}set linkingCursor(t){this.Il=t}get temporaryLink(){return this.CS}set temporaryLink(t){t.It(),this.CS=t}get temporaryFromNode(){return this.LS}set temporaryFromNode(t){t.It(),this.LS=t,t&&(this.th=t.port)}get temporaryFromPort(){return this.th}set temporaryFromPort(t){if(this.th!==null){let e=this.th.panel;if(e!==null){let i=e.D.indexOf(this.th);e.removeAt(i),e.insertAt(i,t)}}this.th=t}get temporaryToNode(){return this.AS}set temporaryToNode(t){t.It(),this.AS=t,t&&(this.eh=t.port)}get temporaryToPort(){return this.eh}set temporaryToPort(t){if(this.eh!==null){let e=this.eh.panel;if(e!==null){let i=e.D.indexOf(this.eh);e.removeAt(i),e.insertAt(i,t)}}this.eh=t}get originalLink(){return this.TS}set originalLink(t){t!==null&&g.se(t,q,xe,"originalLink"),this.TS=t}get originalFromNode(){return this.DS}set originalFromNode(t){t!==null&&g.se(t,it,xe,"originalFromNode"),this.DS=t}get originalFromPort(){return this.vS}set originalFromPort(t){t!==null&&g.se(t,tt,xe,"originalFromPort"),this.vS=t}get originalToNode(){return this.FS}set originalToNode(t){t!==null&&g.se(t,it,xe,"originalToNode"),this.FS=t}get originalToPort(){return this.RS}set originalToPort(t){t!==null&&g.se(t,tt,xe,"originalToPort"),this.RS=t}get isForwards(){return this.OS}set isForwards(t){this.OS=t}get validPortsCache(){return this.PA}get targetPort(){return this.IS}set targetPort(t){t!==null&&g.se(t,tt,xe,"targetPort"),this.IS=t}copyPortProperties(t,e,i,s,n){if(t===null||e===null||i===null||s===null)return;let o=e.getDocumentScale(),r=_.l();r.width=e.naturalBounds.width*o,r.height=e.naturalBounds.height*o,s.desiredSize=r,_.i(r),n?(s.toSpot=e.toSpot,s.toEndSegmentLength=e.toEndSegmentLength):(s.fromSpot=e.fromSpot,s.fromEndSegmentLength=e.fromEndSegmentLength),i.locationSpot=T.Center;let a=P.l();i.location=e.getDocumentPoint(T.Center,a),P.i(a),s.angle=e.getDocumentAngle(),this.portTargeted!==null&&this.portTargeted(t,e,i,s,n)}setNoTargetPortProperties(t,e,i){e!==null&&(e.desiredSize=_.AP,e.fromSpot=T.None,e.toSpot=T.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 it){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 it))return null;for(;t!==null;){let s=e?t.toLinkable:t.fromLinkable;if(s===!0&&(t.portId!==null||t instanceof it)&&(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 it))continue;let c=h.getDocumentPoint(T.Center,P.l()),u=i.x-c.x,d=i.y-c.y;P.i(c);let f=u*u+d*d;if(f<o){let p=this.validPortsCache.get(h);p!==null?p&&(r=h,o=f):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=f):this.validPortsCache.set(h,!1)}}if(r!==null){let h=r.part;if(h instanceof it&&(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 it))return!1;let s=t.portId;s===null&&(s="");let n=e.part;if(!(n instanceof it))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.US(i,e,s)}US(t,e,i){if(t===e)return!0;let s=t.fromNode;if(s!==null&&s.labeledLink&&(i.add(s),this.US(s.labeledLink,e,i)))return!0;let n=t.toNode;return!!(n!==null&&n.labeledLink&&(i.add(n),this.US(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.Um()?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.Vu(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.Vu(t,e,i,!0)}else{if(n===2)return!this.pR(t,e,i);if(n===3)return!this.Vu(t,e,i,!1);if(n===4)return!this.yR(t,e,i)}return!0}Vu(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.Vu(r,e,i,s))return!0}return!1}pR(t,e,i){if(t===e)return!0;let s=new Set;return s.add(e),this.SA(s,t,e,i)}SA(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.SA(t,r,i,s))return!0}return!1}yR(t,e,i){if(t===e)return!0;let s=new Set;return s.add(e),this.MA(s,t,e,i)}MA(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.MA(t,h,i,s))return!0}return!1}get linkValidation(){return this.El}set linkValidation(t){t!==null&&g.S(t,xe,"linkValidation"),this.El=t}get portTargeted(){return this.ES}set portTargeted(t){t!==null&&g.S(t,xe,"portTargeted"),this.ES=t}}var xn=(x=>(x[x.Either=1]="Either",x[x.ForwardsOnly=2]="ForwardsOnly",x[x.BackwardsOnly=3]="BackwardsOnly",x))(xn||{});class Ge extends xe{VS;BS;P;zS;constructor(t){super(),this.name="Linking",this.VS={},this.BS=null,this.P=1,this.zS=null,t&&Object.assign(this,t)}static Either=1;static ForwardsOnly=2;static BackwardsOnly=3;get archetypeLinkData(){return this.VS}set archetypeLinkData(t){t!==null&&g.wc(t,Ge,"archetypeLinkData"),t instanceof tt&&g.se(t,q,Ge,"archetypeLinkData"),this.VS=t}get archetypeLabelNodeData(){return this.BS}set archetypeLabelNodeData(t){t!==null&&g.wc(t,Ge,"archetypeLabelNodeData"),t instanceof tt&&g.se(t,it,Ge,"archetypeLabelNodeData"),this.BS=t}get direction(){return this.P}set direction(t){this.P=t}get startObject(){return this.zS}set startObject(t){t!==null&&g.se(t,tt,Ge,"startObject"),this.zS=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||t.isModelReadOnly||!t.allowLink||!t.model.Lx()||!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 it))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 it&&(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 it&&(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.$t(),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 it&&(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.T("ChangingSelection",t.selection),t.clearSelection(!0),o.isSelected=!0),this.transactionResult=this.name,t.T("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.T("ChangedSelection",t.selection)}}}isNewTreeLink(){let t=this.archetypeLinkData;if(t===null)return!0;if(t instanceof q)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 di extends xe{NA=null;CA=null;XS=null;GS=null;Ss;YS;constructor(t){super(),this.name="Relinking",this.fromHandleArchetype=new at("Diamond",{desiredSize:_.Su,fill:"lightblue",stroke:"dodgerblue",cursor:this.linkingCursor,segmentIndex:0}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.toHandleArchetype=new at("Diamond",{desiredSize:_.Su,fill:"lightblue",stroke:"dodgerblue",cursor:this.linkingCursor,segmentIndex:-1}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.Ss=null,this.YS=new B,t&&Object.assign(this,t)}updateAdornments(t){if(t===null||!(t instanceof q))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.GS:this.XS;return i&&(i=i.copy(),i.adornedObject=t),i}get fromHandleArchetype(){return this.NA}set fromHandleArchetype(t){t!==null&&g.se(t,tt,di,"fromHandleArchetype"),this.NA=t,t!==null?this.XS=new Mt(H.Link).add(t).It():this.XS=null}get toHandleArchetype(){return this.CA}set toHandleArchetype(t){t!==null&&g.se(t,tt,di,"toHandleArchetype"),this.CA=t,t!==null?this.GS=new Mt(H.Link).add(t).It():this.GS=null}get handle(){return this.Ss}set handle(t){t!==null&&(t.part instanceof Mt||g.o("new handle is not in an Adornment: "+t)),this.Ss=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowRelink||!t.model.Lx()||!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 Mt)||!(s.adornedPart instanceof q))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.YS.set(e.actualBounds),e.pointsCount>0&&(e.fromNode===null&&(this.temporaryFromPort!==null&&(this.temporaryFromPort.desiredSize=_.xc),this.temporaryFromNode!==null&&(this.temporaryFromNode.location=e.getPoint(0))),e.toNode===null&&(this.temporaryToPort!==null&&(this.temporaryToPort.desiredSize=_.xc),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.$t(),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 it&&(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.$t()),this.transactionResult=this.name,t.T("LinkRelinked",o,this.isForwards?this.originalToPort:this.originalFromPort)):this.originalLink!==null&&this.doNoRelink(this.originalLink,this.isForwards),this.originalLink!==null&&this.originalLink.invalidateOtherJumpOvers(this.YS)}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 bn=(x=>(x[x.None=0]="None",x[x.Horizontal=1]="Horizontal",x[x.Vertical=2]="Vertical",x[x.All=3]="All",x))(bn||{});class fi extends ie{Mr;KS;HS;Ss;Ax;jS;Vm;constructor(t){super(),this.name="LinkReshaping",this.Mr=new at("Rectangle",{desiredSize:_.RL,fill:"lightblue",stroke:"dodgerblue"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.KS=new at("Diamond",{desiredSize:_.Su,fill:"lightblue",stroke:"dodgerblue",cursor:"move"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.HS=3,this.Ss=null,this.Ax=null,this.jS=new P,this.Vm=new U,t&&Object.assign(this,t)}static None=0;static Horizontal=1;static Vertical=2;static All=3;getReshapingBehavior(t){return t?t.Nr:0}setReshapingBehavior(t,e){t.Nr=e}updateAdornments(t){if(t===null||!(t instanceof q))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.qS!==t.pointsCount||e.WS!==t.resegmentable)&&(e=this.makeAdornment(i),e!==null&&(e.qS=t.pointsCount,e.WS=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 Mt,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);A.u(u.x,d.x)&&A.u(u.y,d.y)?(d=e.getPoint(r-1),A.u(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):A.u(u.y,d.y)&&(this.setReshapingBehavior(c,1),c.cursor="w-resize")):A.u(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):A.u(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);A.u(u.x,d.x)&&A.u(u.y,d.y)?(u=e.getPoint(a+1),A.u(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):A.u(u.y,d.y)&&(this.setReshapingBehavior(c,1),c.cursor="w-resize")):A.u(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):A.u(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().JS()}get handleArchetype(){return this.Mr}set handleArchetype(t){t!==null&&g.se(t,tt,fi,"handleArchetype"),this.Mr=t}makeResegmentHandle(t,e){let i=this.midHandleArchetype;return i===null?null:i.copy().JS()}get midHandleArchetype(){return this.KS}set midHandleArchetype(t){t!==null&&g.se(t,tt,fi,"midHandleArchetype"),this.KS=t}get handle(){return this.Ss}set handle(t){t!==null&&(t.part instanceof Mt||g.o("new handle is not in an Adornment: "+t)),this.Ss=t}get adornedLink(){return this.Ax}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 q){if(this.Ax=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.jS=e.getPoint(this.handle.segmentIndex),this.Vm=e.points.copy(),this.isActive=!0}}doDeactivate(){this.stopTransaction(),this.handle=null,this.Ax=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.Vm),this.stopTool()}getResegmentingPoint(){return this.handle===null?this.diagram.lastInput.documentPoint:this.handle.getDocumentPoint(T.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(A.Nl(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.i(a)}}t.invalidateDocumentBounds(),this.transactionResult=this.name,t.T("LinkReshaped",this.adornedLink,this.Vm)}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.HS}set resegmentingDistance(t){g.s(t,"number",fi,"resegmentingDistance"),this.HS=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);A.u(a.x,r.x)&&A.u(r.y,h.y)?(A.u(a.x,e.getPoint(o-2).x)&&!A.u(a.y,e.getPoint(o-2).y)?(e.insertPointAt(o,t.x,a.y),s++,o++):e.setPointAt(o-1,t.x,a.y),A.u(h.y,e.getPoint(o+2).y)&&!A.u(h.x,e.getPoint(o+2).x)?e.insertPointAt(o+1,h.x,t.y):e.setPointAt(o+1,h.x,t.y)):A.u(a.y,r.y)&&A.u(r.x,h.x)?(A.u(a.y,e.getPoint(o-2).y)&&!A.u(a.x,e.getPoint(o-2).x)?(e.insertPointAt(o,a.x,t.y),s++,o++):e.setPointAt(o-1,a.x,t.y),A.u(h.x,e.getPoint(o+2).x)&&!A.u(h.y,e.getPoint(o+2).y)?e.insertPointAt(o+1,t.x,h.y):e.setPointAt(o+1,t.x,h.y)):A.u(a.x,r.x)&&A.u(r.x,h.x)?(A.u(a.x,e.getPoint(o-2).x)&&!A.u(a.y,e.getPoint(o-2).y)?(e.insertPointAt(o,t.x,a.y),s++,o++):e.setPointAt(o-1,t.x,a.y),A.u(h.x,e.getPoint(o+2).x)&&!A.u(h.y,e.getPoint(o+2).y)?e.insertPointAt(o+1,t.x,h.y):e.setPointAt(o+1,t.x,h.y)):A.u(a.y,r.y)&&A.u(r.y,h.y)&&(A.u(a.y,e.getPoint(o-2).y)&&!A.u(a.x,e.getPoint(o-2).x)?(e.insertPointAt(o,a.x,t.y),s++,o++):e.setPointAt(o-1,a.x,t.y),A.u(h.y,e.getPoint(o+2).y)&&!A.u(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(T.Center,P.l()),c=e.getLinkPointFromPoint(o,r,l,t,!0,P.l());e.setPointAt(0,c.x,c.y),P.i(l),P.i(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(T.Center,P.l()),c=e.getLinkPointFromPoint(a,h,l,t,!1,P.l());e.setPointAt(e.pointsCount-1,c.x,c.y),P.i(l),P.i(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.jS}get originalPoints(){return this.Vm}}class gi extends ie{Cr;Lr;Oo;Rc;$S;Ms;Mr;Ss;Bm;ZS;Oc;Tx;Dx;vx;constructor(t){super(),this.name="Resizing",this.Cr=new _(1,1).b(),this.Lr=new _(9999,9999).b(),this.Oo=new _(NaN,NaN).b(),this.Rc=!1,this.$S=!0,this.Ms=null,this.Mr=new at("Rectangle",{alignmentFocus:T.Center,desiredSize:_.RL,fill:"lightblue",stroke:"dodgerblue",strokeWidth:1,cursor:"pointer"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.Ss=null,this.Bm=new P,this.ZS=new _,this.Oc=new P,this.Tx=new _(0,0),this.Dx=new _(1/0,1/0),this.vx=new _(1,1),t&&Object.assign(this,t)}updateAdornments(t){if(t!==null){if(t.Ar()){let e=t.rotateObject;if(e===t||e===t.path||e.isPanelMain)return}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.Ul()&&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 Mt,e.type=H.Spot,e.locationSpot=T.Center;let s=new we;s.isPanelMain=!0,e.add(s);let n=this.makeHandle(t,T.TopLeft);n!==null&&e.add(n),n=this.makeHandle(t,T.TopRight),n!==null&&e.add(n),n=this.makeHandle(t,T.BottomRight),n!==null&&e.add(n),n=this.makeHandle(t,T.BottomLeft),n!==null&&e.add(n),n=this.makeHandle(t,T.MiddleTop),n!==null&&e.add(n),n=this.makeHandle(t,T.MiddleRight),n!==null&&e.add(n),n=this.makeHandle(t,T.MiddleBottom),n!==null&&e.add(n),n=this.makeHandle(t,T.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().JS();return s.alignment=e,s}updateResizeHandles(t,e){if(t!==null){if(!t.alignment.isDefault()&&(t.cursor==="pointer"||t.cursor.indexOf("resize")>0))this.wR(t,e);else if(t instanceof H){let i=t.elements;for(;i.next();){let s=i.value;this.updateResizeHandles(s,e)}}}}wR(t,e){let i=t.alignment;i.isNoSpot()&&(i=T.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=A.Ee(s),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.Mr}set handleArchetype(t){t!==null&&g.se(t,tt,gi,"handleArchetype"),this.Mr=t}get handle(){return this.Ss}set handle(t){t!==null&&(t.part instanceof Mt||g.o("new handle is not in an Adornment: "+t)),this.Ss=t}get adornedObject(){return this.Ms}set adornedObject(t){t!==null&&t.part instanceof Mt&&g.o("new handle must not be in an Adornment: "+t),this.Ms=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.Iu=!0,this.startTransaction(this.name),this.Bm.set(this.adornedObject.getDocumentPoint(this.handle.alignment.opposite())),this.Oc.set(this.adornedObject.part.location),this.ZS.set(this.adornedObject.desiredSize),this.vx=this.computeCellSize(),this.Tx=this.computeMinSize(),this.Dx=this.computeMaxSize(),this.isActive=!0))}doDeactivate(){let t=this.diagram;t.Iu=!1,t.Fl=!0,this.stopTransaction(),this.handle=null,this.Ms=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.Tx,i=this.Dx,s=this.vx,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.i(o)}doMouseUp(){let t=this.diagram;if(this.isActive&&this.adornedObject!==null&&this.handle!==null){let e=this.Tx,i=this.Dx,s=this.vx,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.i(n),t.invalidateDocumentBounds(),this.transactionResult=this.name,t.T("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 U;o.add(s);let r;!this.dragsMembers&&!s.hasPlaceholder()&&(r=new es,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 B.tm;e.isNoSpot()&&(e=T.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();A._g(t.x,t.y,a,h,n.width,n.height,d);let f=r.copy();return e.x<=0?e.y<=0?(f.x=Math.max(d.x,l-s.width),f.x=Math.min(f.x,l-i.width),f.width=Math.max(l-f.x,i.width),f.y=Math.max(d.y,c-s.height),f.y=Math.min(f.y,c-i.height),f.height=Math.max(c-f.y,i.height),o||(f.height/f.width>=1?(f.height=Math.max(Math.min(u*f.width,s.height),i.height),f.width=f.height/u):(f.width=Math.max(Math.min(f.height/u,s.width),i.width),f.height=u*f.width),f.x=l-f.width,f.y=c-f.height)):e.y>=1?(f.x=Math.max(d.x,l-s.width),f.x=Math.min(f.x,l-i.width),f.width=Math.max(l-f.x,i.width),f.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(f.height/f.width>=1?(f.height=Math.max(Math.min(u*f.width,s.height),i.height),f.width=f.height/u):(f.width=Math.max(Math.min(f.height/u,s.width),i.width),f.height=u*f.width),f.x=l-f.width)):(f.x=Math.max(d.x,l-s.width),f.x=Math.min(f.x,l-i.width),f.width=l-f.x,o||(f.height=Math.max(Math.min(u*f.width,s.height),i.height),f.width=f.height/u,f.y=h+.5*(c-h-f.height))):e.x>=1?e.y<=0?(f.width=Math.max(Math.min(d.x-a,s.width),i.width),f.y=Math.max(d.y,c-s.height),f.y=Math.min(f.y,c-i.height),f.height=Math.max(c-f.y,i.height),o||(f.height/f.width>=1?(f.height=Math.max(Math.min(u*f.width,s.height),i.height),f.width=f.height/u):(f.width=Math.max(Math.min(f.height/u,s.width),i.width),f.height=u*f.width),f.y=c-f.height)):e.y>=1?(f.width=Math.max(Math.min(d.x-a,s.width),i.width),f.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(f.height/f.width>=1?(f.height=Math.max(Math.min(u*f.width,s.height),i.height),f.width=f.height/u):(f.width=Math.max(Math.min(f.height/u,s.width),i.width),f.height=u*f.width))):(f.width=Math.max(Math.min(d.x-a,s.width),i.width),o||(f.height=Math.max(Math.min(u*f.width,s.height),i.height),f.width=f.height/u,f.y=h+.5*(c-h-f.height))):e.y<=0?(f.y=Math.max(d.y,c-s.height),f.y=Math.min(f.y,c-i.height),f.height=c-f.y,o||(f.width=Math.max(Math.min(f.height/u,s.width),i.width),f.height=u*f.width,f.x=a+.5*(l-a-f.width))):e.y>=1&&(f.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(f.width=Math.max(Math.min(f.height/u,s.width),i.width),f.height=u*f.width,f.x=a+.5*(l-a-f.width))),P.i(d),f}computeReshape(){let t=0;return this.adornedObject instanceof at&&(t=this.adornedObject.QS()),!(t===6||this.diagram.lastInput.shift)}computeMinSize(){if(this.adornedObject===null)return _.xc;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 _.TP;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 _(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.Cr}set minSize(t){if(!this.Cr.equals(t)){let e=t.width;isNaN(e)&&(e=0);let i=t.height;isNaN(i)&&(i=0),this.Cr.e(e,i)}}get maxSize(){return this.Lr}set maxSize(t){if(!this.Lr.equals(t)){let e=t.width;isNaN(e)&&(e=1/0);let i=t.height;isNaN(i)&&(i=1/0),this.Lr.e(e,i)}}get cellSize(){return this.Oo}set cellSize(t){this.Oo.equals(t)||this.Oo.h(t)}get isGridSnapEnabled(){return this.Rc}set isGridSnapEnabled(t){g.s(t,"boolean",gi,"isGridSnapEnabled"),this.Rc=t}get dragsMembers(){return this.$S}set dragsMembers(t){g.s(t,"boolean",gi,"dragsMembers"),this.$S=t}get oppositePoint(){return this.Bm}set oppositePoint(t){this.Bm.equals(t)||this.Bm.h(t)}get originalDesiredSize(){return this.ZS}get originalLocation(){return this.Oc}}class qe extends ie{_S;tM;Ms=null;Mr=null;Fx=null;Ss=null;eM;zm;Oc;iM;sM;constructor(t){super(),this.name="Rotating",this._S=45,this.tM=2,this.Oc=new P,this.Ms=null,this.handleArchetype=new at("Ellipse",{desiredSize:_.Su,fill:"lightblue",stroke:"dodgerblue",strokeWidth:1,cursor:"pointer"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.Ss=null,this.eM=0,this.zm=new P(NaN,NaN),this.iM=0,this.sM=50,t&&Object.assign(this,t)}updateAdornments(t){if(t!==null){if(t.Ar()){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.Fx!==null&&(e=this.Fx.copy()),e===null?null:(e.adornedObject=t,e)}get handleArchetype(){return this.Mr}set handleArchetype(t){t!==null&&g.se(t,tt,qe,"handleArchetype"),this.Mr=t,t!==null?this.Fx=new Mt(H.Position,{locationSpot:T.Center}).add(t).It():this.Fx=null}get handle(){return this.Ss}set handle(t){t!==null&&(t.part instanceof Mt||g.o("new handle is not in an Adornment: "+t)),this.Ss=t}get adornedObject(){return this.Ms}set adornedObject(t){t!==null&&t.part instanceof Mt&&g.o("new handle must not be in an Adornment: "+t),this.Ms=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.eM=this.adornedObject.angle,this.zm=this.computeRotationPoint(this.adornedObject),this.Oc=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(T.Center)}computeAdornmentLocation(t){let e=this.rotationPoint;e.isReal()||(e=this.computeRotationPoint(t));let i=t.getLocalPoint(e),s=this.handleAngle;s=A.Ee(s),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.Ms=null,this.zm=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.T("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.Oc.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=A.Ee(e);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)),A.Ee(e)}get snapAngleMultiple(){return this._S}set snapAngleMultiple(t){g.s(t,"number",qe,"snapAngleMultiple"),this._S=t}get snapAngleEpsilon(){return this.tM}set snapAngleEpsilon(t){g.s(t,"number",qe,"snapAngleEpsilon"),this.tM=t}get originalAngle(){return this.eM}get rotationPoint(){return this.zm}set rotationPoint(t){this.zm=t.copy()}get handleAngle(){return this.iM}set handleAngle(t){g.s(t,"number",qe,"handleAngle"),this.iM=t}get handleDistance(){return this.sM}set handleDistance(t){g.s(t,"number",qe,"handleDistance"),this.sM=t}}class wn extends ie{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 vn extends ie{Ic;constructor(t){super(),this.name="Action",this.Ic=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.Ic=i,t.Dc=t.findObjectAt(e.documentPoint,null,null),!0):!1}doMouseDown(){if(!this.isActive)this.canStart()&&this.doActivate();else{let t=this.diagram.lastInput,e=this.Ic;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.Ic;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.Ic;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.Ic;e!==null&&(t.targetObject=e,e.actionCancel!==null&&e.actionCancel(t,e),this.stopTool())}doStop(){this.Ic=null}}class mi extends ie{Vl;nM;Rc;oM;constructor(t){super(),this.name="ClickCreating",this.Vl=null,this.nM=!0,this.Rc=!1,this.oM=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.oM=t.lastInput.viewPoint.copy()),t.lastInput.clickCount!==2||this.isBeyondDragSize(this.oM))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.T("ChangingSelection",e.selection),this.startTransaction(this.name),i instanceof bt)i.Di()&&(i.It(),s=i.copy(),s!==null&&e.add(s));else if(i!==null){let n=e.model.copyNodeData(i);e.model.addNodeData(n),s=e.findPartForData(n)}if(s!==null){let n=P.z(t.x,t.y);this.isGridSnapEnabled&&this.diagram.rM(s,t,n),s.location=n,e.allowSelect&&(e.clearSelection(!0),s.isSelected=!0),P.i(n)}e.invalidateDocumentBounds(),this.transactionResult=this.name,e.T("PartCreated",s)}finally{this.stopTransaction(),e.T("ChangedSelection",e.selection)}return s}get archetypeNodeData(){return this.Vl}set archetypeNodeData(t){t!==null&&g.wc(t,mi,"archetypeNodeData"),this.Vl=t}get isDoubleClick(){return this.nM}set isDoubleClick(t){g.s(t,"boolean",mi,"isDoubleClick"),this.nM=t}get isGridSnapEnabled(){return this.Rc}set isGridSnapEnabled(t){g.s(t,"boolean",mi,"isGridSnapEnabled"),this.Rc=t}}class Oi extends ie{Qa;lM;Bl;constructor(t){super(),this.name="DragSelecting",this.Qa=175,this.lM=!1,this.Bl=new bt({layerName:"Tool",selectable:!1}).add(new at("Rectangle",{name:"SHAPE",fill:null,stroke:"magenta"}).theme("stroke","dragSelect")).It(),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=_.l().e(e.width,e.height);i!==null&&(i.desiredSize=s),this.box.Ec(e.x,e.y,!1),_.i(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.T("ChangingSelection",t.selection),this.selectInRect(this.computeBoxBounds()),t.T("ChangedSelection",t.selection)}finally{t.currentCursor=""}}this.stopTool()}computeBoxBounds(){let t=this.diagram;return new B(t.firstInput.documentPoint,t.lastInput.documentPoint)}selectInRect(t){let e=this.diagram,i=e.lastInput,s=e.findPartsIn(t,this.isPartialInclusion);if(g.ur?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 U,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.Qa}set delay(t){g.s(t,"number",Oi,"delay"),this.Qa=t}get isPartialInclusion(){return this.lM}set isPartialInclusion(t){g.s(t,"boolean",Oi,"isPartialInclusion"),this.lM=t}get box(){return this.Bl}set box(t){t!==null&&t.It(),this.Bl=t}}class ts extends ie{Rx;LA;Ro;aM;constructor(t){super(),this.name="Panning",this.Rx=new P,this.LA=new P,this.Ro=!1;let e=this;this.aM=()=>{let i=e.diagram;i!==null&&i.Le(C.document,"scroll",e.aM,!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.Ro?(t.lastInput.bubbles=!0,t.Et(C.document,"scroll",this.aM,!1)):(t.currentCursor="move",t.isMouseCaptured=!0,this.Rx.h(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.Rx,t.isMouseCaptured=!1,this.stopTool()}doMouseMove(){this.AA()}doMouseUp(){this.AA(),this.stopTool()}AA(){let t=this.diagram;if(this.isActive&&t){if(this.Ro){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.LA.e(n,o)}}get bubbles(){return this.Ro}set bubbles(t){g.s(t,"boolean",ts,"bubbles"),this.Ro=t}get originalPosition(){return this.Rx}}class Me{Ox;Ix;hM;cM;constructor(t){this.Ox=null,this.Ix=null,this.hM=null,this.cM=null,t&&Object.assign(this,t)}get mainElement(){return this.hM}set mainElement(t){t!==null&&g.se(t,HTMLElement,Me,"mainElement"),this.hM=t}get show(){return this.Ox}set show(t){this.Ox!==t&&(t!==null&&g.S(t,Me,"show"),this.Ox=t)}get hide(){return this.Ix}set hide(t){this.Ix!==t&&(t!==null&&g.S(t,Me,"hide"),this.Ix=t)}get valueFunction(){return this.cM}set valueFunction(t){this.cM=t}}class ke{ue;Ex;Uc;constructor(t,e,i){this.ue=t,this.Ex=e,this.Uc=i}}class Xt extends ie{fM;Ux;uM;dM;Vx;Bx;Xm;constructor(t){super(),this.name="ContextMenu",this.fM=null,this.Ux=null,this.uM=null,this.dM=new P,this.Vx=null,this.Xm=!1;let e=this;this.Bx=()=>e.stopTool(),t&&Object.assign(this,t)}xR(){let t=new Me;t.show=(r,a,h)=>h.showDefaultContextMenu(),t.hide=(r,a)=>a.hideDefaultContextMenu(),Xt.Bu=t;let e=this;this.Bx=()=>e.stopTool();let i=g.Ni("div"),s=g.Ni("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=g.Ni("style");C.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.Et(i,"contextmenu",Xt.ih,!1),o.Et(i,"selectstart",Xt.ih,!1),o.Et(s,"contextmenu",Xt.ih,!1)),i.className="goCXforeground",s.className="goCXbackground",C.document.body&&(C.document.body.appendChild(i),C.document.body.appendChild(s)),Xt.Gm=i,Xt.Ym=s,Xt.gM=!0}static Bu=null;static gM=!1;static Ym;static Gm;static ih(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.dM.set(t.firstInput.documentPoint)}doStop(){this.hideContextMenu(),this.currentObject=null,this.Xm=!1}findObjectWithContextMenu(t){t===void 0&&(t=null);let e=this.diagram,i=e.lastInput,s=null;if(t instanceof j||(t instanceof tt?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 Mt){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 Mt){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 Me||(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.Xm)return;this.Xm=!0;let i=!1;if(e instanceof j){let s=this.diagram.lastInput;s.targetObject=null,i=this.oA(null,s,this.diagram)}else t&&this.standardMouseSelect(),i=this.standardMouseClick();if(this.Xm=!1,!i){this.isActive=!0;let s=Xt.Bu;if(e===null&&(e=this.findObjectWithContextMenu()),e!==null){let n=e.contextMenu;n!==null?(this.currentObject=e instanceof tt?e:null,this.showContextMenu(n,this.currentObject)):s!==null&&this.showContextMenu(s,this.currentObject)}else s!==null&&this.showContextMenu(s,null);this.currentContextMenu instanceof Mt&&!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){e!==null&&g.se(e,tt,Xt,"showContextMenu:obj");let i=this.diagram;if(t!==this.currentContextMenu&&this.hideContextMenu(),t instanceof Mt){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 Me&&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 Mt?(t.remove(e),this.Ux!==null&&this.Ux.removeAdornment(e.category),e.data=null,e.adornedObject=null):e instanceof Me&&(e.hide!==null?e.hide(t,this):e.mainElement!==null&&(e.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())}bR(){let t=this,e=new U;return e.add(new ke("Copy",i=>i.commandHandler.copySelection(),i=>i.commandHandler.canCopySelection())),e.add(new ke("Cut",i=>i.commandHandler.cutSelection(),i=>i.commandHandler.canCutSelection())),e.add(new ke("Delete",i=>i.commandHandler.deleteSelection(),i=>i.commandHandler.canDeleteSelection())),e.add(new ke("Paste",i=>i.commandHandler.pasteSelection(t.mouseDownPoint),i=>i.commandHandler.canPasteSelection(t.mouseDownPoint))),e.add(new ke("Select All",i=>i.commandHandler.selectAll(),i=>i.commandHandler.canSelectAll())),e.add(new ke("Undo",i=>i.commandHandler.undo(),i=>i.commandHandler.canUndo())),e.add(new ke("Redo",i=>i.commandHandler.redo(),i=>i.commandHandler.canRedo())),e.add(new ke("Scroll To Part",i=>i.commandHandler.scrollToPart(),i=>i.commandHandler.canScrollToPart())),e.add(new ke("Zoom To Fit",i=>i.commandHandler.zoomToFit(),i=>i.commandHandler.canZoomToFit())),e.add(new ke("Reset Zoom",i=>i.commandHandler.resetZoom(),i=>i.commandHandler.canResetZoom())),e.add(new ke("Group Selection",i=>i.commandHandler.groupSelection(),i=>i.commandHandler.canGroupSelection())),e.add(new ke("Ungroup Selection",i=>i.commandHandler.ungroupSelection(),i=>i.commandHandler.canUngroupSelection())),e.add(new ke("Edit Text",i=>i.commandHandler.editTextBlock(),i=>i.commandHandler.canEditTextBlock())),e}showDefaultContextMenu(){let t=this.diagram;this.Vx===null&&(this.Vx=this.bR()),Xt.Gm.innerHTML="",Xt.Ym.addEventListener("pointerdown",this.Bx,!1);let e=this,i=g.Ni("ul");i.className="goCXul",Xt.Gm.appendChild(i),i.innerHTML="";let s=this.Vx.iterator;for(;s.next();){let n=s.value,o=n.Ex,r=n.Uc;if(!g.nt(o)||g.nt(r)&&!r(t))continue;let a=g.Ni("li");a.className="goCXli";let h=g.Ni("a");h.className="goCXa",h.href="#",h.Ex=o,h.addEventListener("pointerdown",function(l){return this.Ex(t),e.stopTool(),l.preventDefault(),!1},!1),h.textContent=n.ue,a.appendChild(h),i.appendChild(a)}Xt.Gm.style.display="block",Xt.Ym.style.display="block"}hideDefaultContextMenu(){if(this.currentContextMenu===null||this.currentContextMenu!==Xt.Bu)return;Xt.Gm.style.display="none",Xt.Ym.style.display="none";let t=this.diagram;t!==null&&t.Le(Xt.Ym,"pointerdown",this.Bx,!1),this.currentContextMenu=null}doMouseWheel(){this.standardMouseWheel()}get currentContextMenu(){return this.fM}set currentContextMenu(t){this.fM=t,this.Ux=t instanceof Mt?t.adornedPart:null}get defaultTouchContextMenu(){return Xt.gM===!1&&Xt.Bu===null&&j.isUsingDOM()&&this.xR(),Xt.Bu}set defaultTouchContextMenu(t){t===null&&(Xt.gM=!0),Xt.Bu=t}get currentObject(){return this.uM}set currentObject(t){t!==null&&g.se(t,tt,Xt,"currentObject"),this.uM=t}get mouseDownPoint(){return this.dM}}var kn=(x=>(x[x.LostFocus=1]="LostFocus",x[x.MouseDown=2]="MouseDown",x[x.Tab=3]="Tab",x[x.Enter=4]="Enter",x))(kn||{}),Pn=(x=>(x[x.SingleClick=1]="SingleClick",x[x.SingleClickSelected=2]="SingleClickSelected",x[x.DoubleClick=3]="DoubleClick",x))(Pn||{}),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 fe extends ie{vi;mM;pM;zl;Gt;yM;wM;xM;zx;Xx;constructor(t){super(),this.name="TextEditing",this.vi=new gt,this.mM=null,this.pM=2,this.zl=null,this.Gt=1,this.yM=1,this.wM=!0,this.xM=null,this.zx=new Me,this.Xx=null,this.kR(this.zx),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;kR(t){if(!j.isUsingDOM())return;let e=g.Ni("textarea");this.Xx=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.PR(s)},!1),e.addEventListener("blur",function(s){i.SR(s)},!1),t.valueFunction=()=>e.value,t.mainElement=e,t.show=(s,n,o)=>{if(!(s instanceof gt)||!n||!n.div||!(o instanceof fe))return;if(o.state===5){e.style.border="3px solid red",e.focus();return}let r=s.getDocumentPoint(T.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,f=(r.y-a.y)*h,p=s.verticalAlignment,m=(s.lineHeight+s.spacingAbove+s.spacingBelow)*s.lineCount*l,y=.5*u-.5*m,b=p.y*u-p.y*m+p.offsetY-y-m/2;e.value=s.text,n.div.style.font=s.font;let v=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)-v+"px",e.style.top=(f+b|0)-v+"px",e.style.textAlign=s.textAlign,e.style.margin="0",e.style.padding=v+"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.mM}set textBlock(t){t!==null&&g.se(t,gt,fe,"textBlock"),this.mM=t}get currentTextEditor(){return this.xM}set currentTextEditor(t){this.xM=t}get defaultTextEditor(){return this.zx}set defaultTextEditor(t){this.zx=t}get starting(){return this.pM}set starting(t){this.pM=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||t.isReadOnly||fe.Vc&&fe.Vc!==this&&(fe.Vc.acceptText(2),fe.Vc&&fe.Vc!==this)||!t.lastInput.left||this.isBeyondDragSize())return!1;let e=t.lastInput.documentPoint,i=t.findObjectAt(e);if(i===null||!(i instanceof gt)||!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(){fe.Vc=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 gt)||(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.vi=this.textBlock.copy();let s=new B(this.textBlock.getDocumentPoint(T.TopLeft),this.textBlock.getDocumentPoint(T.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.TA());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.TA());break}}TA(){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.T("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(){fe.Vc=null}PR(t){if(this.currentTextEditor===null||this.state===1)return;let e=this.Xx;this.Gt===2&&(this.Gt=3),g.nt(e.select)&&this.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))}SR(t){if(this.currentTextEditor===null||this.state===1)return;let e=this.Xx;g.nt(e.focus)&&e.focus(),g.nt(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.zl}set textValidation(t){t!==null&&g.S(t,fe,"textValidation"),this.zl=t}get minimumEditorScale(){return this.yM}set minimumEditorScale(t){t!==null&&g.s(t,"number",fe,"minimumEditorScale"),this.yM=t}get selectsTextOnActivate(){return this.wM}set selectsTextOnActivate(t){t!==null&&g.s(t,"boolean",fe,"selectsTextOnActivate"),this.wM=t}get state(){return this.Gt}set state(t){this.Gt!==t&&(this.Gt=t)}measureTemporaryTextBlock(t){let e=this.vi;return e.text=t,this.textBlock!==null&&e.ht(this.textBlock.Xl,1/0),e}static Vc=null}var Mn=(x=>(x[x.Default=1]="Default",x[x.AnimateLocations=2]="AnimateLocations",x[x.None=3]="None",x))(Mn||{});class be{a;Ae;Be;Tr;_n;Io;bM;kM;Km;Gx;ke;Bc;bn;Hm;nh;Yx;jm;Kx;zc;Uu;qm;constructor(t){this.a=j.Rm(),this.Ae=!1,this.Km=!1,this.Gx=!1,this.ke=!1,this.Bc=!1,this.Kx=!0,this.zc=1,this.Uu=!1,this.Be=!0,this.Tr=!0,this.Io=600,this.bM=!1,this.kM=!1,this._n=new I,this.bn=new Te,this.Hm=new Te,this.bn.Ns=this,this.nh=new I,this.Yx=new I,this.jm=new I,this.qm=new I,t&&Object.assign(this,t)}Eo(t){this.a=t}RU(){return this.a}canStart(t){return!0}Gl(t){return!this.Be||!this.canStart(t)?!1:(this._n.add(t),this.defaultAnimation.isAnimating&&this.stopAnimation(),this.a.Te(),this.ke=!0,!0)}getBundleAnimation(){return this.Hm}PM(){if(!this.Be||(this.Hm.pi.count>0&&this.Hm.start(),!this.ke))return;let t=this.bn,e=this.a,i=this._n.has("Model");if(i&&(this.Bc=!0,this.zc===1?(t.isViewportUnconstrained=!0,t.pi.clear(),t.add(e,"position",e.position.copy().offset(0,-200),e.position),t.add(e,"opacity",0,1)):this.zc===3&&t.pi.clear(),this.zc===2&&e.Hx.equals(e.ct)?this.Kx=!0:this.Kx=!1,e.T("InitialAnimationStarting",this)),i&&!this.Tr||t.pi.count===0){this._n.clear(),this.ke=!1,t.pi.clear(),t.jx(e),this.Bc=!1,e.C();return}this._n.clear(),e.Dr=!1;let s=t.pi.get(e);e.autoScale!==1&&s!==null&&(delete s.ae.scale,delete s.Cs.scale);let n=this;C.requestAnimationFrame(()=>{n.ke===!1||t.Ae||(e.getRenderingHint("temporaryPixelRatio")&&e.Nx(),e.SM(),n.ke=!1,t.start(),t.Ae&&(n.zu(),e.invalidateDocumentBounds(),t.DA(0),e.Sr(!0),n.Xu(),e.T("AnimationStarting",n)))})}MM(){return this._n.has("Trigger")&&this._n.count===1}vA(t,e,i,s){this.isTicking||this.MM()||t instanceof q&&(t.fromNode!==null||t.toNode!==null)||this.bn.add(t,"position",e,i,s)}qx(t){return this.bn.qx(t)}NM(t){return this.bn.NM(t)}MR(t){let e=this.nh,i=this;function s(){if(i.jm.count>0&&(e.addAll(i.jm),i.jm.clear(),i.Ae=!0),i.Ae===!1||e.count===0){i.Gx=!1;return}i.Yx.addAll(e);let n=i.Yx.iterator;for(;n.next();){let o=n.value;o.Ae!==!1&&(o.NR()?o.FA(!1):o.Xc=!0)}if(i.Yx.clear(),i.Ae===!1){C.requestAnimationFrame(s);return}i.zu(),i.a.Sr(),i.Xu(),C.requestAnimationFrame(s)}this.Ae?this.RA(t):(this.Ae=!0,this.Gx?this.RA(t):(this.Gx=!0,e.add(t),C.requestAnimationFrame(()=>s())))}RA(t){this.jm.add(t)}CR(){let t=this.nh.iterator;for(;t.next();)t.value.Xc=!1}zu(){if(this.Km)return;let t=this.a;this.bM=t.skipsUndoManager,this.kM=t.yi,t.skipsUndoManager=!0,t.yi=!0,this.Km=!0}Xu(){let t=this.a;t.skipsUndoManager=this.bM,t.yi=this.kM,this.Km=!1}stopAnimation(t){let e=this.bn;if(this.ke===!0&&(this.ke=!1,this.Bc=!1,this._n.clear(),e.LR()&&this.a.requestUpdate()),!this.Ae){e.pi.clear(),e.jx(this.a);return}if(e.Gu(!0),e.jx(null),t===!0){let i=this.nh.toArray();for(let s=0;s<i.length;s++)i[s].Gu(!0)}}Gu(t){this.nh.delete(t),this.nh.count===0&&(this.Ae=!1,this.a.requestUpdate()),t===this.defaultAnimation&&this.a.T("AnimationFinished",this)}Gc(t,e){this.ke&&(!this._n.has("Expand Tree")&&!this._n.has("Expand SubGraph")||(this.bn.Gc(t,e),this.OA(t)))}Yc(t,e){this.ke&&(!this._n.has("Collapse Tree")&&!this._n.has("Collapse SubGraph")||(this.bn.Yc(t,e),this.bn.CM(e,"position",e.position,e.position),this.OA(t)))}IA(t,e){!this.ke||t.equals(e)||this.MM()||(this.a.$a||(t=e.copy()),this.bn.CM(this.a,"position",t,e))}EA(t,e){this.ke&&(this.MM()||this.bn.add(this.a,"scale",t,e))}LM(t,e){t.Fi&&(t.vr=e,this.qm.add(t))}OA(t){let e=t.findLinksConnected();for(;e.next();){let i=e.value;i.Fi&&(i.vr=i.points.copy(),this.qm.add(i))}}get isEnabled(){return this.Be}set isEnabled(t){g.s(t,"boolean",be,"isEnabled"),this.Be=t,t&&this.nh.each(e=>{!e.isAnimating&&e.runCount===1/0&&e.start()})}get duration(){return this.Io}set duration(t){g.s(t,"number",be,"duration"),t<1&&g.J(t,">= 1",be,"duration"),this.Io=t}get isAnimating(){return this.Ae}get isTicking(){return this.Km}get isInitial(){return this.Tr}set isInitial(t){g.s(t,"boolean",be,"isInitial"),this.Tr=t}get defaultAnimation(){return this.bn}get activeAnimations(){return this.nh}get initialAnimationStyle(){return this.zc}set initialAnimationStyle(t){this.zc=t}static Wx=new wt;static defineAnimationEffect(t,e){be.Wx.set(t,e)}static AM(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 f=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("+f+", "+p+"%, "+m+"%, "+y+")"}static Default=1;static AnimateLocations=2;static None=3}{let x=be.Wx,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.Ec(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.Ec(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.Ec(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.Ec(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 _(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=be.AM(i,s,o,r,n)}),x.set("stroke",(e,i,s,n,o,r)=>{e.stroke=be.AM(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=be.AM(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 Te{Jx;Wm;Ae;Yu;Io;Ls;UA;Kc;pi;$x;ae;to;Ku;Hc;Zx;Qx;Xc;TM;_x;Ns;a;DM;vM;FM;constructor(t){this.a=null,this.Ns=null,this.TM=null,this._x=null,this.DM=!1,this.Ae=!1,this.Xc=!1,this.ae=0,this.to=0,this.Jx=Te.EaseInOutQuad,this.Wm=Te.EaseInOutQuad,this.Ku=!1,this.Hc=!1,this.Zx=1,this.Qx=0,this.Io=NaN,this.Ls=NaN,this.vM=0,this.Yu=null,this.UA=P.gn,this.pi=new wt,this.$x=new wt,this.Kc=new I,this.FM=1,t&&Object.assign(this,t)}suspend(){this.Xc=!0}advanceTo(t,e){e&&(this.Xc=!1),this.Ku&&t>=this.Ls&&(this.Hc=!0,t=t-this.Ls),this.vM=t,this.FA(!0),this.Ns.zu(),this.a.Sr(),this.Ns.Xu(),this.a.redraw()}jx(t){if(this.$x.clear(),this.Hc=!1,this.Qx=0,this.Ls=NaN,this.Kc.count>0&&this.Kc.clear(),t!==null){let e=t.links;for(;e.next();)e.value.vr=null}}LR(){return this.pi.count>0}start(){if(this.pi.count===0)return this;if(this.Ae)return this;let t=this.a,e=this.pi.iterator;for(;e.next();){let s=e.key;t===null&&(s instanceof j?t=s:s instanceof tt&&(t=s.diagram))}if(t!==null)this.a=t,this.Ns=t.animationManager;else return this;let i=this.Ns;return i.isEnabled===!1?this:(this.Ls=isNaN(this.Io)?i.duration:this.Io,this.Wm=this.Jx,i.Bc&&i.zc===1&&this===i.defaultAnimation&&(this.Wm=Te.EaseOutExpo,this.Ls=isNaN(this.Io)?i.duration===600?900:i.duration:this.Io),this.FM=t.scrollMode,this.isViewportUnconstrained&&(t.oh=2),i.zu(),this.Kc.each(s=>{s.data=null,t.add(s)}),i.Xu(),this.Ae=!0,this.ae=+new Date,this.to=this.ae+this.Ls,i.MR(this),this)}addTemporaryPart(t,e){return t.Di()?(this.Kc.add(t),this.a=e,this):this}add(t,e,i,s,n){if(this.a===null&&(t instanceof j?this.a=t:t instanceof tt&&t.diagram!==null&&(this.a=t.diagram)),t instanceof bt){if(!t.isAnimated)return this;e==="position"&&(e="position:part")}return this.CM(t,e,i,s,n),this}CM(t,e,i,s,n){let o=this.pi,r,a,h;if(t instanceof j&&e==="position"&&(e="position:diagram"),(e==="fill"||e==="stroke"||e==="background")&&(E.Uo(i),E.RM(),i=[E.ze.n0,E.ze.n1,E.ze.n2,E.ze.n3],E.Uo(s),E.RM(),s=[E.ze.n0,E.ze.n1,E.ze.n2,E.ze.n3]),o.has(t))r=o.get(t),a=r.ae,h=r.Cs,a[e]===void 0&&(a[e]=this.Hu(i)),h[e]=this.Hu(s);else{if(e==="position"&&i.equalsApprox(s))return;a={},h={},a[e]=this.Hu(i),h[e]=this.Hu(s),r=new Qo(a,h,n),o.set(t,r)}let l=a[e];l instanceof P&&!l.isReal()&&l.h(this.UA),n&&e.indexOf("position:")===0&&t instanceof bt?r.tb.location=this.Hu(t.location):n&&(r.tb[e]=this.Hu(i))}Hu(t){return t instanceof P||t instanceof _?t.copy():t}AR(t){let e=this.pi;if(e.has(t)){let i=e.get(t);i.eb=!0}}qx(t){if(!this.Ae)return!1;let e=this.pi.get(t);return e!==null&&e.eb}NM(t){if(!this.Ae)return!1;let e=this.pi.get(t);return e!==null&&!!(e.ae.position||e.ae["position:part"]||e.ae.location)}NR(){if(this.Kc.count>0)return!0;let t=this.pi.iterator;for(;t.next();){let e=t.key;if(e instanceof tt&&e.diagram!==null||e instanceof j)return!0}return!1}FA(t){if(this.Xc&&!t)return;let e=this.Ns;if(this.Ae===!1)return;let i=+new Date,s=i>this.to?this.Ls:i-this.ae;t&&(s=this.vM,s<this.Ls?(this.ae=+new Date-s,this.to=this.ae+this.Ls):s=this.Ls),e.zu(),this.DA(s),this.a.Sr(!0),e.Xu(),i>this.to&&(this.Ku&&!this.Hc?(this.ae=+new Date,this.to=this.ae+this.Ls,this.Hc=!0):this.Gu(!1))}DA(t){let e=this.Ls,i=this.pi.iterator,s=this.Hc;for(;i.next();){let n=i.key;if(n instanceof tt&&n.diagram===null)continue;let o=i.value,r=s?o.Cs:o.ae,a=s?o.ae:o.Cs,h=be.Wx;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.Wm,t,e,this)}}stop(){return this.Ae?(this.Gu(!0),this):this}Gu(t){if(this._x!==null&&this._x.TR(this.TM),!this.Ae)return;let e=this.a,i=this.Ns;i.Bc=!1,this.Ae=!1,this.Xc=!1,i.zu();let s=this.pi,n=this.Kc.iterator;for(;n.next();)e.remove(n.value);let o=this.Ku,r=s.iterator,a=be.Wx;for(;r.next();){let l=r.key,c=r.value,u=o?c.Cs:c.ae,d=o?c.ae:c.Cs,f=c.tb;for(let p in d)if(a.get(p)!==null){let m=p;c.ib&&(m==="position:nodeCollapse"||m==="position:placeholder")&&(m="position"),a.get(m)(l,u[p],f[p]!==void 0?f[p]:c.ib?u[p]:d[p],this.Wm,this.Ls,this.Ls,this)}c.ib&&f.location!==void 0&&l instanceof bt&&(l.location=f.location),c.eb&&l instanceof bt&&l.Xe(!1)}this.Qx++;let h=!t&&this.Zx>this.Qx;if(!h&&(this===i.Hm||this===i.defaultAnimation)&&this.pi.clear(),e.sb.clear(),e.pS(!1),e.invalidateDocumentBounds(),e.C(),e.Sr(!0),i.defaultAnimation===this){let l=i.qm.iterator;for(;l.next();)l.value.DR();i.qm.clear()}if(e.Sr(!0),this.isViewportUnconstrained&&(e.scrollMode=this.FM),i.Xu(),h){this.Hc=!1,this.start();return}this.jx(null),e.VA(),i.Gu(this),this.Yu&&this.Yu(this),e.requestUpdate()}Gc(t,e){let i=e.actualBounds,s=null;if(e instanceof ft&&(s=e.placeholder),s!==null&&s.visible){let n=s.getDocumentPoint(T.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.vR(t,e)}vR(t,e){let i=t.memberParts;for(;i.next();){let s=i.value;s instanceof it&&this.Gc(s,e)}}Yc(t,e){if(!t.isVisible())return;let i=null;if(e instanceof ft&&(i=e.placeholder),i!==null&&i.visible){let s=i.getDocumentPoint(T.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.AR(t),t instanceof ft&&this.FR(t,e)}FR(t,e){let i=t.memberParts;for(;i.next();){let s=i.value;s instanceof it&&this.Yc(s,e)}}get duration(){return this.Io}set duration(t){g.s(t,"number",Te,"duration"),t<1&&g.J(t,">= 1",Te,"duration"),this.Io=t}get reversible(){return this.Ku}set reversible(t){this.Ku=t}get runCount(){return this.Zx}set runCount(t){t>0?this.Zx=t:g.o("Animation.runCount value must be a positive integer.")}get finished(){return this.Yu}set finished(t){this.Yu!==t&&(t!==null&&g.S(t,Te,"finished"),this.Yu=t)}get easing(){return this.Jx}set easing(t){this.Jx=t}get isViewportUnconstrained(){return this.DM}set isViewportUnconstrained(t){this.DM=t}get isAnimating(){return this.Ae}getTemporaryState(t){let e=this.$x.get(t);return e===null&&(e={},this.$x.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{ae;Cs;tb;ib;eb;constructor(t,e,i){this.ae=t,this.Cs=e,this.tb={},this.ib=i,this.eb=!1}}var Nn=(x=>(x[x.Default=1]="Default",x[x.Immediate=2]="Immediate",x[x.Bundled=3]="Bundled",x))(Nn||{});class Ri{Ti;yn;ju;jc;constructor(t,e,i){this.Ti=null,this.yn=t,this.ju=i||1,this.jc=null,e!==void 0&&(this.jc=e,i===void 0&&(this.ju=2))}copy(){let t=new Ri(this.yn);t.ju=this.ju;let e=this.jc;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.jc=i}return t}get propertyName(){return this.yn}set propertyName(t){this.yn=t}get animationSettings(){return this.jc}set animationSettings(t){this.jc=t}RR(t){let e=this.jc;e!==null&&(e.duration&&(t.duration=e.duration),e.finished&&(t.finished=e.finished),e.easing&&(t.easing=e.easing))}get startCondition(){return this.ju}set startCondition(t){this.ju=t}static Default=1;static Immediate=2;static Bundled=3}class Vt{a;Pt;Zt;Fr;Yl;Kl;Hl;jl;ql;Wl;Jl;$l;Zl;Ql;_l;ta;Uc;ea;nb;Jm;qu;Ct;constructor(t){I.Je(this),this.a=null,this.Ct=new U,this.Pt="",this.Zt=1,this.Fr=!1,this.Yl=!0,this.Kl=!0,this.Hl=!0,this.jl=!0,this.ql=!0,this.Wl=!0,this.Jl=!0,this.$l=!0,this.Zl=!0,this.Ql=!0,this._l=!0,this.ta=!0,this.Uc=!0,this.ea=!0,this.nb=!0,this.Jm=!1,this.qu=[],t&&Object.assign(this,t)}OR(){let t=this.Ct;for(let e=0;e<t.length;e++)t.r[e].OM(null);t.clear(),this.qu.length=0}Eo(t){this.a=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 it?s++:l instanceof q?o++:l instanceof Mt?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+=`